diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 07ae2ff1..98ec7461 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.4", + "version": "0.10.0", "author": { "name": "qwerfunch" }, diff --git a/.gitattributes b/.gitattributes index e3ee60fc..70a574ef 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ spec/index.yaml merge=union +plugins/claude-code/dist/clad.js whitespace=-trailing-space diff --git a/AGENTS.md b/AGENTS.md index 6a60fe78..6e247671 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ # AGENTS.md -This file is the cross-tool entry point for any AI coding agent working on cladding (OpenAI Codex, Cursor, Cline, Aider, Continue, GitHub Copilot, Gemini CLI, JetBrains Junie, Windsurf, and the other tools that read the [agents.md](https://agents.md/) standard). Claude Code reads this too — there is no separate CLAUDE.md. +This file is the shared cross-tool entry point for AI coding agents working on cladding (OpenAI Codex, Cursor, Cline, Aider, Continue, GitHub Copilot, Gemini CLI, JetBrains Junie, Windsurf, and other [agents.md](https://agents.md/) hosts). [`CLAUDE.md`](CLAUDE.md) is the Claude Code maintainer addendum; it does not replace this shared contract or `GOVERNANCE.md`. ## 1. Project @@ -41,11 +41,11 @@ Comment policy in one paragraph: *why* over *what*, full doc-tag set on every ex ## 5. PR policy -Branch off `develop`, never `main`. Open the PR against `develop`. The maintainer fast-forwards `main` only at explicit release time. Full contract: `GOVERNANCE.md` §4.3. +Branch off `develop`, never `main`, and open ordinary PRs against `develop`. A release uses a `develop → main` PR merged with a merge commit, followed by the mandatory `main → develop` back-merge. Full contract: `GOVERNANCE.md` §3–4.3 and `CLAUDE.md`. ## 6. Agent personas -cladding ships five persona definitions under `src/agents/`. **Planning intents** (deciding scope · drafting acceptance criteria · drawing a roadmap) are planner-territory (the persona formerly named `librarian`) and surface through natural language to the host AI tool, not through a fixed CLI verb. `clad run` (formerly `drive`) is for *executing* an already-defined plan as a feature group, not for *making* a plan. +cladding ships five persona definitions under `src/agents/`. **Planning intents** (deciding scope · drafting acceptance criteria · drawing a roadmap) are planner-territory (the persona formerly named `librarian`) and surface through natural language to the host AI tool, not through a fixed CLI verb. Execution itself is no longer a cladding verb: 0.10.0 retired the headless loop, so `clad serve` publishes the spec and the gates over MCP and the host AI owns carrying an already-defined plan out. Each file is markdown with a YAML frontmatter that declares two parallel keys: @@ -58,19 +58,20 @@ Non-Claude-Code hosts (Cursor, Cline, Continue, …) should map `capabilities:` cladding does **not** require an API key by default. The default agent dispatch mode is `host` — cladding runs inside the user's existing AI tool (Claude Code with the Max/Pro subscription, Cursor, Cline, Continue, generic-MCP, …) and the host environment handles the LLM call. -SDK adapters (Anthropic / OpenAI / Gemini) read their respective environment variable (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GOOGLE_API_KEY`) only when explicitly selected via `agent.mode = sdk` in `.cladding/config.yaml` or the `CLADDING_AGENT_MODE` env var. Full roadmap: `docs/multi-provider-roadmap.md`. +The only place cladding itself reads a provider key is the onboarding scan fallback: `src/cli/scan/dispatcher.ts` lazily requires `@anthropic-ai/sdk` with `ANTHROPIC_API_KEY` when no host sampling server is registered. Every other execution path is owned by the host AI. Full roadmap: `docs/multi-provider-roadmap.md`. ## 8. Soft Shell rule User-facing output uses business language: feature titles ("Login flow"), stage names ("Drift", "UAT"), plain sentences. Internal identifiers (`F-NNN`, `AC-NNN`, `stage_X.Y`, `HUMAN_REQUIRED` and the rest of the halt enum) belong in the audit log and behind `--internal` / `--json` flags. -Convert every internal id at the user surface boundary via `src/ui/softShell.ts`: `featureLabel(featureId, spec)`, `haltMessage(haltReason, spec)`, `gateLabel(stageId)`. Background: `ironclad-design/03-ux-routing.md` §1.2 and `docs/ux-routing-coverage.md`. +Convert every internal id at the user surface boundary via `src/ui/softShell.ts`: `featureLabel(featureId, spec)` and `gateLabel(stageId)`. Background: `ironclad-design/03-ux-routing.md` §1.2 and `docs/ux-routing-coverage.md`. ## 9. Where to look - `GOVERNANCE.md` — sync policy, versioning, contributor policy, PR contract, v1.0 graduation criteria. - `CONTRIBUTING.md` — first-PR walkthrough. - `CODE_OF_CONDUCT.md`, `SECURITY.md` — community standards + private security reports. +- `docs/design/spec-0.2.md` — accepted 0.10.0 continuation router; read it, then load only the task-routed canonical file under `docs/design/spec-0.2/` (implementation is still pending). - `docs/code-style.md` — per-language Google Style Guides table + comment policy in full. - `docs/ux-routing-coverage.md` — applied-status of `ironclad-design/03-ux-routing.md` prescriptions. - `docs/multi-provider-roadmap.md` — host vs sdk adapter model + adapter matrix + how to add one. diff --git a/CHANGELOG.md b/CHANGELOG.md index 39d96b25..0f3b0982 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,47 @@ 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.10.0] — Every acceptance criterion has an address a test can claim (2026-09-10) + +**In one line:** Spec schema 0.2 — a feature says what it is for before what it does, every acceptance criterion has an address you can point at, a test claims a criterion by naming it in its own title, one compiled model answers questions about how the pieces relate, each level of assurance has a named check profile recorded in a new attestation format, and a reviewed path carries an old project across. + +> Heads-up: a project still on the old spec format should commit its work first — the migration refuses to touch a path with uncommitted changes on it — then run `clad migrate --to 0.2` to preview the rewrite, apply it once the decisions it lists have been reviewed, and re-prove the tree with `clad check --tier=pre-push`. One of those decisions asks whether your already-completed features may carry their existing proof forward. Answer no and they carry nothing: each finished feature stays red until one of its test titles names the criterion it covers. That answer is recorded once — changing your mind means undoing the migration and applying it again. The headless loop is gone — start the server with `clad serve` and let your AI host work the feature cycle. Moving the generated files into one folder is opt-in through `clad relocate-generated`; leave it alone and the existing layout keeps working. And the pre-push check rewrites the sealed record of what was verified every time it passes, so commit those files along with your change. One detail worth knowing before you write tests: the tag that says which acceptance criterion a test covers has to come at the very start of the test's title — a tag placed anywhere else in the title is not read, and the criterion it names is still counted as unproven. + +### Added + +- **Spec schema 0.2.** A feature states its purpose first, every acceptance criterion carries an address you can point at, and a test claims a criterion by naming it in the test title. Behind that: a compiler with typed registries and a typed reader, transactional spec editing, a preview of the migration from 0.1, a kernel that carries proof and portable evidence, and five verification profiles — feedback, checkpoint, completion, push, release — recorded in a third-generation attestation file. +- **One compiled model now answers the questions that used to be asked of four,** with layers for what the spec declares, what the documents link, what the source references, and which tests the current gate actually observed. The gate now hands the graph a sealed record of test cases instead of raw report bytes. +- **The count sync covers feature counts too.** `node scripts/test-count.mjs --write` refreshes the README feature totals alongside the test totals. +- **`clad relocate-generated` moves the generated files under `spec/generated/`.** It previews the move by default; `--apply` performs it as one recoverable transaction. This is opt-in — the layout you have today stays fully supported. +- **A schema 0.2 workspace explains its own generated files.** `spec/generated/README.md` is projected from the registry of generated artifacts and names where each one lives now and where relocation would put it. +- **A release gate for the 0.2 validation work.** The validation ledger declares which scenarios block the 0.10.0 release, and `npm run validate:spec-0.2:release` exits nonzero while any of them lacks discriminating evidence. Evidence produced on a reference host counts only when its recorded receipt is signed by an issuer registered in the trust snapshot stored beside it. Both reference-host cycles for this release — one on Claude Code, one on Codex — were driven by automation rather than by a person working at a keyboard, and the confirmation step before each sign-off was answered by that automation on the maintainer's instruction. The signatures and the offline verification are real; what was not exercised, and so is not claimed, is either host's own confirmation form. +- **The release was measured against the engine it replaces, and against no engine at all.** Three arms ran the same task on the same host and the same model, three times each: an assistant with no engine, released 0.9.4, and this build. On the deterministic table, 0.9.4 lets a warning-level drift finding through a gate that was not asked to be strict, accepts an acceptance criterion with no statement, and accepts the binding field this release no longer reads — this release refuses all three, and lowers the depth ceiling on graph questions, refusing requests above it. Live, both engines carried the work to an honest finish 3 of 3, at a median estimated $1.00 against $1.23 and 21 turns against 27; those are list-price estimates, not amounts billed. Code quality, coverage and a hidden oracle came out the same across all three arms, so this release claims no better code. The record is `docs/ab-evaluation/case-version-abc-094-vs-0100.md`. + +### Changed + +- **Completeness is judged from structure alone.** Scope and closure derive from structural relations; an unresolved piece of evidence or an oracle reference that does not resolve stays a visible negative fact about its own criterion instead of making every verification profile unresolved. +- **The authoritative profiles block on warnings.** Completion, push and release refuse on warn-level drift findings; `--strict` remains an explicit escalation on top. +- **A project's own instructions now say how a test claims a criterion.** The managed sections in `AGENTS.md` and `CLAUDE.md`, the gate's report of a criterion nothing has proven, the guidance it prints when tests are missing, and the message that refuses the old way of binding all name the same thing: on the new spec format, a test claims a criterion by carrying that criterion's tag at the very start of its own title. Until now those surfaces still described the previous format's way of doing it, so a project on the new format was being told to do something the gate no longer reads. A project still on the old format sees its wording unchanged, byte for byte. +- **An archived feature whose successor is not done yet** reports its surviving modules as information rather than a problem, until that successor completes. +- **`clad done` reports how independently the work was verified.** In a schema 0.2 workspace it states the independence label recorded for that completion. By default the label only annotates; set `independence_policy: require` and it decides — a sign-off by the person who implemented the feature no longer counts as independent review, and a completion whose authors cannot be identified is refused rather than passed. The old spec format keeps its previous label unchanged. + +### Removed + +- **The experimental headless loop and its `run` command.** Nothing ever ran it — three and a half months of recorded sessions contain zero runs — and it never learned to write code, so it could only report honest failure. Start the server with `clad serve` and let your AI host work the feature cycle instead; that is the path everything else already used. +- **The parts that existed only to serve that loop:** the agent adapters, the crash-postmortem recorder, and the progress-line renderer. The host transport the onboarding scan uses is untouched, and so is the Anthropic SDK dependency behind its API-key fallback. +- **The `run` skill,** and its copies in the Claude Code, Codex, and Antigravity plugin folders. + +### Fixed + +- **The host support table was refreshed against live runs for this release.** Claude Code, Codex and Cursor answered every check — Cursor, which the readme had not claimed before, is now recorded as working. Gemini still fails, and Antigravity — which the table previously recorded as working — now times out on every check, so the readme no longer claims it as verified. +- **Graph code no longer reaches into gate code,** restoring the architecture rule that keeps the two apart. +- **A renamed test keeps its binding.** Bindings carried forward by the migration and then invalidated by a title edit are promoted to live tokens instead of failing silently. +- **Patched dependencies.** The MCP SDK's transitive `fast-uri`, `qs`, and `side-channel` packages move to their patched releases, so `npm audit` reports no known vulnerabilities. A later batch, reported on 2026-09-09, moves the web framework the MCP server carries and the YAML reader and test runner used by the development tools to their patched releases as well, so the audit stays clean. +- **A workspace holding a signed review could never record a verification.** The gate sealed the record of what it verified without counting the reviews on disk, while the writer counted them, so the two never matched: the check finished green, wrote nothing, said nothing, and `clad done` refused with a cause it could not name. Both now read the same set, the freshness check reads it too, and a refusal names the guard that refused. +- **Asking for a different level of assurance for one run now says why it was refused.** Requesting a level the project does not allow — anything below the level it is set to, or a stronger one anywhere except a single feature's completion check — used to end in a red result with no cause printed anywhere, every check apparently green. The refusal now names its reason before anything runs; a run without the option is untouched. +- **A receipt imported on the command line is now checked against the project's registered signers,** exactly the way it is when your AI host imports one. Until now every receipt was filed as an unverified claim, whether it was genuine, altered, or signed by someone the project never registered — an altered one is now refused and nothing is stored. +- **An attestation stamped on a working machine now matches the one a clean checkout computes.** A desktop metadata file left behind by a file browser, or an ignored fixture sitting inside a sealed folder, used to be sealed alongside the project's own files, so the record a green local check wrote was already stale on every other machine — most visibly in continuous integration, where the same commit came back red. The record now covers what the repository actually tracks, so a check that passes on your machine passes on a fresh clone. Files kept inside a nested repository or a submodule are not part of that tracked content either, so a module pointing into one is now treated as absent and the check refuses rather than sealing foreign files. + ## [0.9.4] — The gate judges the sources on disk (2026-08-26) **In one line:** the language check reads your sources instead of your build manifest — projects it wrongly blocked now pass honestly — the module-honesty scan works for any language your spec teaches it, the gate config survives a fresh clone, and cladding now proves its own host hooks fired, records stop and completion outcomes, pins generated CI, and stamps every verified tree with the policy that earned it. diff --git a/CLAUDE.md b/CLAUDE.md index 404e9c09..35b73a1e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,8 +10,8 @@ When adding a new spec entry to `spec/features/` or `spec/scenarios/`: - **DO NOT** create `spec/features/F-NNN.yaml` (the legacy sequential format) by hand. - **DO** use the hash-based model: - - Filename: `-.yaml` (e.g. `auth-bypass-c4d108e9.yaml`) - - Inside the yaml: `id: F-` plus `slug: ` + - Filename: `-.yaml` (e.g. `auth-bypass-c4d108e9.yaml`) + - Inside the yaml: `id: F-` plus `slug: ` - The hash is an 8-character hex string since 0.6.0 (legacy 6-char ids stay valid). Generate with: ```bash node -e "console.log('F-' + require('node:crypto').randomBytes(4).toString('hex'))" @@ -101,8 +101,10 @@ implements; whoever authors a unit must not sign off on it (anti-self-cert). **Feature cycle — one at a time** — One feature end-to-end before the next: author its spec entry (`acceptance_criteria` + `modules`) → implement → author tests in a separate context → `clad done ` (sets `status: done` only when -`clad check --tier=pre-push --strict` is GREEN). Never author spec entries ahead of -their code, or hand-write `status: done`. See `docs/feature-cycle.md`. +`clad check --tier=pre-push --strict` is GREEN). A test claims a criterion by +starting its title with `[covers:F-…/AC-…]`; `test_refs` are not accepted on +schema 0.2. Never author spec entries ahead of their code, or hand-write +`status: done`. See `docs/feature-cycle.md`. **Hash-based IDs** — Never hand-author `F-NNN` filenames; use the `clad` CLI (or `/cladding:init`). Model in `docs/spec-ids-multi-dev.md`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec2d605f..43e31d89 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ Thanks for your interest in helping make code iron-clad. ``` When you change a stage, a detector, or the conformance contract, also run `npm run conformance` to re-verify the 26 fixtures. The runner is a contributor self-audit tool — it depends on dev-only toolchain binaries (`tsc` / `eslint` / `madge` / `secretlint` / `vitest`), so it works after a contributor install (`npm install`), **not** after the end-user install (`npm install -g cladding`). 5. **Add a CHANGELOG entry** under the next-release heading, in the right [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) section (`Added` / `Changed` / `Deprecated` / `Removed` / `Fixed` / `Security`). -6. **Open the PR against `develop`.** The maintainer fast-forwards `main` only at release time. +6. **Open the PR against `develop`.** Releases use a `develop → main` merge-commit PR followed by a mandatory `main → develop` back-merge; see `GOVERNANCE.md` §3. ## What kind of contributions land easily diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 5e0cb066..67d2441a 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -52,9 +52,9 @@ Cladding follows [SemVer 2.0](https://semver.org/). |---|---| | **Patch** (`0.1.x`) | bug fix · doc · spec patch sync · refactor with no observable change | | **Minor** (`0.x.0`) | new stage runner · new detector · new agent persona · new CLI verb · breaking-but-additive spec sync | -| **Major** (`x.0.0`) | breaking change to `StageResult` / `DriftFinding` / spec schema · removal of a public verb · v1.0 graduation (see §5) | +| **Major** (`x.0.0`, at/after 1.0) | breaking public `StageResult` / `DriftFinding` change · removal of a public verb · v1.0 graduation (see §5) | -Pre-1.0, minor versions may include backwards-incompatible internal changes. The CLI surface (`clad `) stays stable — that's the contract external adopters depend on. +Pre-1.0, minor versions may include backwards-incompatible internal changes and explicit schema migrations; Spec 0.2 ships in 0.10.0. The CLI surface (`clad `) stays stable — that's the contract external adopters depend on. ## 3. Release Cadence @@ -62,7 +62,9 @@ Pre-1.0, minor versions may include backwards-incompatible internal changes. The - **No fixed schedule.** There is no monthly / quarterly cadence. Cadence emerges from external dogfood signals and spec progress. - **Tag, then notes.** Every release creates an annotated git tag `vX.Y.Z` on `main`, then `gh release create` with `--notes-file CHANGELOG.md`. Tags are immutable; never re-point a published tag. -The maintainer initiates a release with a single instruction (e.g. *"v0.1.0 release"*). The runtime takes over from there: fast-forward `develop → main`, tag, push, publish. +The maintainer initiates a release with a single instruction (e.g. *"v0.1.0 release"*). Open a `develop → main` PR, merge it with a merge commit (never fast-forward, squash, or rebase), tag and push that merge commit, then mandatory back-merge `main → develop` before publishing. This keeps `develop` a release-commit superset and matches the maintainer ritual in [`CLAUDE.md`](CLAUDE.md). + +Pre-F6/current shipped releases retain their existing gate command. After F6, the 0.10.0 final release gate runs once as `node bin/clad check --profile release --strict`; legacy aliases have fixture parity and do not justify a repeated full gate. Release communication distinguishes self profile-complete L2 from separately reported L4 mechanism and reference-host evidence; this design does not rewrite current README assurance values. ## 4. Contributor Policy @@ -76,7 +78,7 @@ The maintainer initiates a release with a single instruction (e.g. *"v0.1.0 rele ### 4.2 Out-of-scope contributions -- PRs that regress Iron Law conformance below the current declared level. `iron-law` only goes up. +- PRs that regress the assurance declared for the current release. A Schema 0.2 migration never infers L3/L4 from legacy history; release communication distinguishes self L2 from separately proven L4 evidence. - PRs that bypass the anti-self-cert guard. Tool / LLM evidence alone cannot clear stage_4 — by design. - PRs that fork the spec rather than implement it. If you want a different spec, start a different repo. - Cosmetic-only PRs that don't ship a new fixture or new test. diff --git a/README.html b/README.html index 1d91cb42..d7c854eb 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 — 269 of its 277 features cleared this same gate, the first L4 implementation of the Ironclad standard. + cladding builds itself with cladding too — 289 of its 304 features cleared this same gate, the first L4 implementation of the Ironclad standard.

@@ -556,8 +556,8 @@

Status

version
-
v0.9.4
-
2026-08
+
v0.10.0
+
2026-09
conformance
@@ -566,7 +566,7 @@

Status

tests
-
2981/2981
+
3835/3835
all pass
@@ -576,13 +576,13 @@

Status

features
-
281
-
277 done · self-spec
+
304
+
289 done · self-spec
-

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

+

336 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 704ef536..330ffef4 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 で作っている** — 273 個の feature のうち 269 個が同じゲートを通過した、[Ironclad](https://github.com/qwerfunch/ironclad) 標準を L4 で実装した最初の事例だ。 +cladding は **自分自身も cladding で作っている** — 304 個の feature のうち 289 個が同じゲートを通過した、[Ironclad](https://github.com/qwerfunch/ironclad) 標準を L4 で実装した最初の事例だ。 @@ -347,9 +347,9 @@ clad update # 3. プロジェクト接続と派生状態を更新 | Version | 準拠レベル | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.4(2026-08) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2981 / 2981 | 15 段階 · 41 detectors | 281(277 done) | +| v0.10.0(2026-09) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 3835 / 3835 | 15 段階 · 41 detectors | 304(289 done) | -253 test files · capability 6 個 · カバレッジ低下は COVERAGE_DROP detector がブロック +336 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 fbb0522f..d6d07829 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으로 만든다 — 기능 281개 중 277개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다. + cladding은 자기 자신도 cladding으로 만든다 — 기능 304개 중 289개가 같은 게이트를 통과했고, Ironclad 표준을 L4로 구현한 첫 사례다.

@@ -590,8 +590,8 @@

Status

version
-
v0.9.4
-
2026-08
+
v0.10.0
+
2026-09
준수 등급
@@ -600,7 +600,7 @@

Status

tests
-
2981/2981
+
3835/3835
all pass
@@ -610,13 +610,13 @@

Status

features
-
281
-
277 done · 자기 스펙
+
304
+
289 done · 자기 스펙
-

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

+

336 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 947eae9f..6168cfe8 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으로 만든다** — 기능 273개 중 269개가 같은 게이트를 통과했고, [Ironclad](https://github.com/qwerfunch/ironclad) 표준을 L4로 구현한 첫 사례다. +cladding은 **자기 자신도 cladding으로 만든다** — 기능 304개 중 289개가 같은 게이트를 통과했고, [Ironclad](https://github.com/qwerfunch/ironclad) 표준을 L4로 구현한 첫 사례다. @@ -346,9 +346,9 @@ clad update # 3. 프로젝트 연결과 파생 데이터를 함께 | version | 준수 등급 | tests | gate | features | |---|---|---|---|---| -| v0.9.4 · 2026-08 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2981 / 2981 · all pass | 15 단계 · 41 detectors | 281 · 277 done · 자기 스펙 | +| v0.10.0 · 2026-09 | L4 · [L0–L4 중 최고 · 자가 선언](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 3835 / 3835 · all pass | 15 단계 · 41 detectors | 304 · 289 done · 자기 스펙 | -253 test files · capability 6개 · coverage는 COVERAGE_DROP detector가 하락 차단 +336 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 fa60cd25..8ec72037 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 — 269 of its 273 features cleared this same gate, the first L4 implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. +cladding builds **itself** with cladding too — 289 of its 304 features cleared this same gate, the first L4 implementation of the [Ironclad](https://github.com/qwerfunch/ironclad) standard. @@ -319,7 +319,7 @@ Implement email sign-in, including tests. There is nothing new to memorize. For host-specific invocation, stricter Git/CI enforcement, and verified host status, see [setup details](docs/setup.md). - + @@ -360,9 +360,9 @@ Reconcile the drift the update flagged. | Version | Conformance | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.4 (2026-08) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2981 / 2981 | 15 stages · 41 detectors | 281 (277 done) | +| v0.10.0 (2026-09) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 3835 / 3835 | 15 stages · 41 detectors | 304 (289 done) | -253 test files · 6 capabilities · coverage drop blocked by the COVERAGE_DROP detector +336 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 0870b492..81c3028d 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 造的 —— 273 个 feature 里有 269 个通过了同一道门禁,成为 [Ironclad](https://github.com/qwerfunch/ironclad) 标准的首个 L4 实现。 +cladding 连**自己**也是用 cladding 造的 —— 304 个 feature 里有 289 个通过了同一道门禁,成为 [Ironclad](https://github.com/qwerfunch/ironclad) 标准的首个 L4 实现。 @@ -343,9 +343,9 @@ clad update # 3. 刷新项目连接和派生状态 | 版本 | 一致性 | Tests | Gate | Features | |---|---|---|---|---| -| v0.9.4(2026-08) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2981 / 2981 | 15 阶段 · 41 检测器 | 281(277 done) | +| v0.10.0(2026-09) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 3835 / 3835 | 15 阶段 · 41 检测器 | 304(289 done) | -253 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 +336 个测试文件 · 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/SECURITY.md b/SECURITY.md index a90b95e9..60ff6b8d 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,7 +16,7 @@ The kinds of reports that belong here: - A reproducible way to corrupt the audit log (`.cladding/audit.log.jsonl`) or events log such that an external auditor cannot reconstruct the lifecycle of a feature. - A way to make a drift detector silently miss a real spec/code/test mismatch (false-negative). False-positives are bugs; false-negatives are security-adjacent because they erode the falsifiability claim. - Credential or secret exposure in the toolchain (e.g. `src/stages/secret.ts` failing to redact a known secret pattern). -- Arbitrary code execution through any CLI verb (`clad init`, `clad run`, `clad sync`, `clad check`, `clad serve`, …) against an untrusted spec or workspace. +- Arbitrary code execution through any CLI verb (`clad init`, `clad sync`, `clad check`, `clad serve`, …) against an untrusted spec or workspace. ## MCP server (`clad serve`) — invariants @@ -24,7 +24,7 @@ The kinds of reports that belong here: - **No arbitrary shell execution from MCP tools.** Every tool registered on `src/serve/server.ts` delegates to a typed cladding function (`loadSpec`, `runDrift`, `readEvidence`, log readers). None of them shells out, spawn a process, or compile arbitrary user-supplied code. A future tool that needs to execute anything must do it through a constrained, audited interface — never via `child_process.exec` of client-supplied strings. - **Read-only by default.** v0.2.24 ships four read-only tools (`clad_list_features`, `clad_get_feature`, `clad_run_check`, `clad_get_events`). A future write-capable tool MUST require an explicit `mutating: true` flag in its registration metadata and MUST land a human-pass audit entry in `.cladding/audit.log.jsonl` for every invocation. -- **Sampling responses pass through anti-self-cert.** When the drive loop dispatches through `McpSamplingTransport` (v0.2.25+), the reviewer-vs-author identity barrier (F-049 AC-086) still applies — a host whose client returns the same identity for specialist and reviewer dispatches MUST halt with `HUMAN_REQUIRED`. The MCP boundary is not a bypass. +- **Human evidence cannot be self-issued over MCP.** A verified signoff — `clad signoff --verified` on the CLI, `clad_signoff` with `verified: true` over MCP — signs a receipt only after a person re-enters the feature id in a terminal prompt or a host elicitation form. With no interactive terminal, no host elicitation capability, or a mismatched answer, the command records asserted history only and returns `HUMAN_REQUIRED`; an agent has no path to issue the human evidence itself (`src/proof/signoff.ts`, `src/cli/signoff.ts`, `src/serve/server.ts`). This is consent friction, not proof of humanity — a host running with blanket auto-approval answers the form itself — but the MCP boundary is not a bypass of the human step. - **Audit notifications are advisory.** `notifications/resources/updated` for `cladding://audit` (v0.2.25+) is a client-cache-refresh hint, not a substitute for the file-level audit log. The audit log on disk remains the authoritative chain even if every notification is lost. ## What is not in-scope here diff --git a/conformance/fixtures.yaml b/conformance/fixtures.yaml index d84c580b..63a9cb83 100644 --- a/conformance/fixtures.yaml +++ b/conformance/fixtures.yaml @@ -287,11 +287,11 @@ fixtures: - name: F-041_AC-065 stage: documentary kind: documentary - description: "F-041/AC-065 — The system shall strip persona preamble lines (You are X, # Orchestrator/Librarian/..., Your job is...) from a prompt and collapse the resulting whitespace." + description: "F-041/AC-065 — The context envelope shall strip persona preamble lines from diagnostic sections before measurement and collapse the resulting blank runs." - name: F-041_AC-066 stage: documentary kind: documentary - description: "F-041/AC-066 — The system shall shrink long text to head N + tail M lines with an elision marker, returning the original text unchanged when total lines fit within head + tail" + description: "F-041/AC-066 — When a diagnostic section exceeds its head and tail allowance, the context envelope shall keep the head and tail lines with an elision marker that names the exact number of elided lines." - name: F-042_AC-067 stage: documentary kind: documentary diff --git a/docs/README.md b/docs/README.md index 60bba121..4e6f4bf8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,13 +13,15 @@ Human-readable documentation for cladding. Mixed-tier: design SSoT (Tier B) live | `conventions.md` (in adopting projects) | **C** | derived from observed code OR greenfield seed | `clad init --scan` | `developer` persona when writing code + human reviewers | | `code-style.md` | **C** | hand-authored, legacy (cladding-self only) | manual | cladding contributors (legacy reference; will deprecate in favour of conventions.md) | | `multi-provider-roadmap.md` | **B** | design SSoT — host vs SDK adapter model | manual | maintainers + adopters routing through multi-host adapters | +| [`design/spec-0.2.md`](design/spec-0.2.md) + `design/spec-0.2/` | **B/C** | accepted target-design router plus bounded canonical owners for model/migration, proof/editing, delivery, hygiene, GraphIR, context/orchestration, assurance, MCP, split evidence, executable validation guide, and decision history *(implementation pending)* | amend one owner + central `decision-log.md` change log; reproduce projections with `npm run validate:spec-0.2` | maintainers and fresh sessions; read the router and only the owner files routed for the current task | +| [`design/ironclad-obligation-rfc.md`](design/ironclad-obligation-rfc.md) | **B** | non-authoritative, unsubmitted draft proposal derived from Spec 0.2 D21–D23 | manual; never treated as accepted Ironclad policy | maintainers preparing a later upstream discussion | | `spec-ids-multi-dev.md` | **B** | design SSoT — hash-based ID conventions (v0.3.9+) | manual | planner persona + every spec author | | `ux-routing-coverage.md` | **B** | design SSoT — Soft Shell coverage status | manual | reviewer + roadmap planners | | `glossary.md` | **C** | terminology SSoT — public-name definitions | manual | contributors + `self-consistency.test.ts` | | `feature-cycle.md` | **B** | design SSoT — one feature's spec→code→test→done lifecycle | manual | orchestrator + planner + developer personas | | `gate-scope.md` | **B** | design SSoT — module-scoped gate for monorepos | manual | reviewer + monorepo adopters | | `ssot-testing.md` | **B** | governance policy — SSoT lifecycle test strategy | manual | reviewer + test-author developer | -| `knowledge-graph/design.md` | **B** | design SSoT — knowledge-graph model & cost | manual | maintainers + graph contributors | +| `knowledge-graph/design.md` | **B** | historical SSoT — shipped v1 graph model, cost record, and post-ship departures; superseded target is `design/spec-0.2/graph.md` D17 | manual historical amendment | maintainers auditing v1 or migrating graph consumers | | `benchmarks/` | **D** audit (post-hoc reports) | append-only per benchmark run; a superseded run-log may be compressed to a dated abstract + git-history pointer once no live claim cites its numbers | manual benchmark commits | maintainers reviewing performance regressions | | `dogfood/` | **D** audit (post-hoc reports) | append-only per dogfood session | manual dogfood commits | maintainers reviewing harness behaviour on real adoption | @@ -32,5 +34,6 @@ The alternative — tier-named directories (`tier-b/`, `tier-c/`) — was reject ## See also - [`ssot-model.md`](./ssot-model.md) — the 4-tier governance policy this README indexes +- [`design/spec-0.2.md`](./design/spec-0.2.md) — accepted 0.10.0 task router; it links the one canonical owner for each decision *(not current runtime behavior)* - [`../spec/README.md`](../spec/README.md) — Tier A + B (structured spec data) directory index - [`../src/agents/README.md`](../src/agents/README.md) — persona role table + how each persona reads which tier diff --git a/docs/ab-evaluation-extended/scenarios/dashboard/report.md b/docs/ab-evaluation-extended/scenarios/dashboard/report.md index 38f19e54..2cc0ca5e 100644 --- a/docs/ab-evaluation-extended/scenarios/dashboard/report.md +++ b/docs/ab-evaluation-extended/scenarios/dashboard/report.md @@ -70,7 +70,7 @@ Four deterministic drift scenarios injected at feature-30 state. "Caught" = at l | DI-1 Stale module reference (rename src/components/Header.tsx → src/components/Header.RENAMED.tsx without spec update) | ✅ | MISSING_IMPLEMENTATION, UNMAPPED_ARTIFACT, STATUS_DRIFT | · | — | | DI-2 Architecture violation (src/lib/filter.ts imports ../components/Header) | ✅ | ARCHITECTURE_FROM_SPEC, INFERABLE_DEPENDS_ON | · | — | | DI-3 Hardcoded secret (add API key constant to src/lib/export-config.ts) | · | — | · | — | -| DI-4 Untested AC (add AC-003 to spec/features/metric-card-2ed463.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | +| DI-4 Unverified criterion (add AC-003 to spec/features/metric-card-2ed463.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | **Catch rate at M30**: A = 3/4 · B = 0/3 · **cladding-exclusive = 3** diff --git a/docs/ab-evaluation-extended/scenarios/task-manager/report.md b/docs/ab-evaluation-extended/scenarios/task-manager/report.md index f19f960f..fdd16619 100644 --- a/docs/ab-evaluation-extended/scenarios/task-manager/report.md +++ b/docs/ab-evaluation-extended/scenarios/task-manager/report.md @@ -72,7 +72,7 @@ Four deterministic drift scenarios injected at feature-30 state. "Caught" = at l | DI-1 Stale module reference (rename src/components/Header.tsx → src/components/Header.RENAMED.tsx without spec update) | ✅ | MISSING_IMPLEMENTATION, UNMAPPED_ARTIFACT, STATUS_DRIFT | · | — | | DI-2 Architecture violation (src/lib/filter.ts imports ../components/Header) | ✅ | ARCHITECTURE_FROM_SPEC, INFERABLE_DEPENDS_ON | · | — | | DI-3 Hardcoded secret (add API key constant to src/lib/export-import.ts) | · | — | · | — | -| DI-4 Untested AC (add AC-003 to spec/features/add-task-3cbf38.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | +| DI-4 Unverified criterion (add AC-003 to spec/features/add-task-3cbf38.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | **Catch rate at M30**: A = 3/4 · B = 0/3 · **cladding-exclusive = 3** diff --git a/docs/ab-evaluation/README.md b/docs/ab-evaluation/README.md index 1baca356..b4358de7 100644 --- a/docs/ab-evaluation/README.md +++ b/docs/ab-evaluation/README.md @@ -2,7 +2,7 @@ # A/B evaluation — Cladding vs Vanilla Claude Code -_Snapshot note (2026-07-05): detector count was 25 at this run; the suite has since grown to 41 (0.8.x). Body preserved as an append-only snapshot._ +_Snapshot note (2026-07-05): this historical M2 report reflects the detector registry available at that run. Body preserved as an append-only snapshot._ This directory holds **comparative case studies** between two development modes for the same intent: @@ -134,6 +134,29 @@ The **Findings** section is what most readers care about: a 6-bullet narrative quantifying the structural delta between cladding-managed and vanilla development. +## Version campaigns + +Separate from the generated case pair above, this directory also holds +**pre-registered version comparisons** — a released engine against a release +candidate, written before the runs so the rules cannot follow the numbers: + +- [`case-version-ab-093-vs-next.md`](./case-version-ab-093-vs-next.md) — 0.9.3 + against the language-agnostic core. +- [`case-version-abc-094-vs-0100.md`](./case-version-abc-094-vs-0100.md) — no + engine, 0.9.4, and the 0.10.0 candidate, three arms on one task. Its harness + is `scripts/ab-abc/`. **Verdict: GO** — all six pre-registered claims held and + none of the six stop conditions fired, on a deterministic table plus three live + runs per arm; code quality, coverage and the hidden oracle tied across all + three arms, as pre-registered. +- [`case-0100-feature-scenarios.md`](./case-0100-feature-scenarios.md) — the + follow-up to that campaign, asking a narrower question: was every change in + 0.10.0 actually checked? Every item in the release notes is mapped to a + deterministic row, a live host probe, or a written reason it is not a + scenario, and the mapping is verified by this repository's own test suite. + **Status: 44 rows locked on the shipped build (2026-09-10); the battery found two + command-line defects, and the first CI run of the release branch found an + attestation-portability defect — all three repaired and re-locked.** + ## Related - [`../ssot-model.md`](../ssot-model.md) — 4-tier SSoT governance model that cladding implements. diff --git a/docs/ab-evaluation/case-0100-feature-scenarios.md b/docs/ab-evaluation/case-0100-feature-scenarios.md new file mode 100644 index 00000000..2264a2bc --- /dev/null +++ b/docs/ab-evaluation/case-0100-feature-scenarios.md @@ -0,0 +1,544 @@ + + +# Every 0.10.0 change, checked against the engine it replaces + +The previous campaign asked whether the release was better than what came before +it. This one asks a narrower and more awkward question: was every change in it +actually checked? A release note lists twenty changes and a heads-up paragraph +of eight sentences; the campaign that preceded it covered about half of them +directly, and the rest rested on the fact that the work had tests. Tests are the +author's account of their own work. What was missing was an outside one — the +same project, two frozen engines, and a question asked of both. + +So each item in the release notes now has one of three things attached to it: a +row in a deterministic table that runs both engines and writes down what each +said, a live probe against a real AI host, or a written reason why a black-box +row would measure nothing. The mapping lives in `scripts/ab-abc/coverage.yaml` +and is checked by this repository's own test suite, so "every change was checked" +fails in CI the day it stops being true rather than the day someone re-reads this +document. + +The rows cost nothing to run. Both engines are frozen installs driven directly — +no model, no host, no spending — so the table can be re-run on demand and its +answers are the same every time. The guesses were written down before the first +run, which is what makes a wrong guess a finding rather than an edit. + +## Build lineage + +Four builds are named in this document, and it matters which is which. The +reference-host cycles and the packed-tarball campaign ran on the build from +`0578818` (`dist/clad.js` sha256 `1bb59b71…`). The version campaign and the host +probes ran on the build from `56f3cb9`, which adds the adopter-guidance repair +F-6349870d (sha256 +`a679adcc0c7e2d24190a746a7061625510372b6b6a135ac7d458e0bd01ca0b6b`). Then comes +`e32c694` (sha256 +`b34e2755e9b9c891c1799545d17bf8c2ad1a891383bc4e93b74f453e58cd9f09`), which adds +F-18a5883a — the two command-line repairs the rows below found. The build that +ships is `b37d174` (sha256 +`06ec4cabe16e692a7b555cdcd4d71a2bd2f36643549561a2084ed7d88cc6d811`), which adds +F-71da4292: the files a record seals are now enumerated from what git tracks, so +stray files on one machine no longer change the seal. Those repairs touch only +the paths named under Findings: the tool catalog is unchanged (still 140,498 +bytes and 27 tools), and so is every gate verdict reached without the one-run +assurance-level option. + +## Status + +**Locked 2026-09-10 — 44 rows, 0 mismatches, negative check passed.** All +twenty-eight new rows have run, every one is classified, and every one is now +pinned: the whole table, the sixteen earlier rows included, is enforced rather +than recorded. The two rows that had found product faults were held back until +F-18a5883a (commit `e32c694`) repaired them, and were re-run and locked on the +`b34e2755…` build. S-C5, pre-registered for the seal repair F-71da4292, ran for +the first time on the build that ships (commit `b37d174`, sha256 +`06ec4cabe16e692a7b555cdcd4d71a2bd2f36643549561a2084ed7d88cc6d811`) and met its +guess; S-D5's stranger sub-case was re-pinned on that same build, for the reason +given under Findings. + +Locked means the runner compares every pinned exit code, byte count and literal +against what it just saw and fails on the first difference. The whole table was +re-run against the pins and held, and the lock was checked in the other +direction too: one pinned literal was changed to a wrong value, the row re-run, +and the run failed naming that literal. The host probes ran on 2026-09-09 and +are recorded below. + +One row changed shape to be lockable. S-A5's question — the shape a clarify +round trip hands back — needs an onboarding session, and a session needs a host +model, so it cannot be driven here. What can be driven is the refusal that makes +it manual, and the row now runs and pins that on both engines instead of sitting +in the table with nothing enforced. The round-trip question stays with the host +probes. + +## Coverage ledger + +Each item below is a bold lead from the 0.10.0 release notes, a sentence of its +heads-up paragraph, or a feature entry added since 0.9.4. "Rows" names the +deterministic side-table rows that exercise it; items with no rows carry a +written reason in the ledger itself. + +### Release-note items + +| Item | Rows | Status | +|---|---|---| +| Spec schema 0.2. | S-A1, S-B1, S-B2, S-B3, S-C2, L0-11 | match: S-B3, S-C2, L0-11 · expectation-wrong: S-A1, S-B1, S-B2 | +| One compiled model now answers the questions that used to be asked of four, | S-E1, S-E2, L3-2 | match: S-E2, L3-2 · expectation-wrong: S-E1 | +| The count sync covers feature counts too. | — | not a scenario | +| `clad relocate-generated` moves the generated files under `spec/generated/`. | S-F1 | match | +| A schema 0.2 workspace explains its own generated files. | S-A4 | match | +| A release gate for the 0.2 validation work. | — | not a scenario | +| The release was measured against the engine it replaces, and against no engine at all. | — | not a scenario | +| Completeness is judged from structure alone. | S-C3, S-C4, S-D6 | match: S-C4, S-D6 · defect-fixed: S-C3 | +| The authoritative profiles block on warnings. | S-C1, S-B6, L0-1 | match: S-C1, S-B6 · defect-fixed: L0-1 | +| A project's own instructions now say how a test claims a criterion. | S-A1, S-A3, L0-2 | match: S-A3, L0-2 · expectation-wrong: S-A1 | +| An archived feature whose successor is not done yet | S-B6 | match | +| `clad done` reports how independently the work was verified. | S-D4, L0-6, L0-6b | match: S-D4, L0-6b · designed: L0-6 | +| The experimental headless loop and its `run` command. | S-G1 | expectation-wrong | +| The parts that existed only to serve that loop: | S-G1 | expectation-wrong | +| The `run` skill, | S-G1 | expectation-wrong | +| The host support table was refreshed against live runs for this release. | live host probe | probed 2026-09-09 — three hosts pass, Antigravity fail (host wiring) | +| Graph code no longer reaches into gate code, | — | not a scenario | +| A renamed test keeps its binding. | L0-11, S-F2 | match: L0-11 · expectation-wrong: S-F2 | +| Patched dependencies. | — | not a scenario | +| A workspace holding a signed review could never record a verification. | S-D2, S-D3 | match: S-D2 · designed: S-D3 | +| Asking for a different level of assurance for one run now says why it was refused. | S-C3 | defect-fixed | +| A receipt imported on the command line is now checked against the project's registered signers, | S-D5 | defect-fixed | +| An attestation stamped on a working machine now matches the one a clean checkout computes. | S-C5 | match | + +### Heads-up sentences + +| Item | Rows | Status | +|---|---|---| +| the migration refuses to touch a path with uncommitted changes on it | L0-11, S-F2 | match: L0-11 · expectation-wrong: S-F2 | +| One of those decisions asks whether your already-completed features may carry their existing proof forward. | L0-11 | match | +| Answer no and they carry nothing | L0-11 | match | +| changing your mind means undoing the migration and applying it again | S-F2 | expectation-wrong | +| The headless loop is gone — start the server with `clad serve` | S-G1 | expectation-wrong | +| Moving the generated files into one folder is opt-in through `clad relocate-generated` | S-F1 | match | +| the pre-push check rewrites the sealed record of what was verified every time it passes | S-C2 | match | +| has to come at the very start of the test's title | L0-2, S-A1, S-A3 | match: L0-2, S-A3 · expectation-wrong: S-A1 | + +### Feature entries added since 0.9.4 + +| Item | Rows | Status | +|---|---|---| +| F-6349870d | S-A1, S-A3 | match: S-A3 · expectation-wrong: S-A1 | +| F-6f0a2106 | S-C1, S-C2, S-C3 | match: S-C1, S-C2 · defect-fixed: S-C3 | +| F-1a87a6bd | — | not a scenario | +| F-0a29d024 | — | not a scenario | +| F-8e7f399b | S-D4 | match | +| F-9fcdd0a0 | S-G1 | expectation-wrong | +| F-f4cfd533 | S-D1, S-D2, S-D5 | match: S-D1, S-D2 · defect-fixed: S-D5 | +| F-b8d77abf | — | not a scenario | +| F-208eaa79 | S-E1, S-E2 | match: S-E2 · expectation-wrong: S-E1 | +| F-c4df5fb4 | S-A1, S-A2 | expectation-wrong: S-A1, S-A2 | +| F-14c9d647 | S-F2 | expectation-wrong | +| F-94285dd8 | S-B5 | match | +| F-2883ff4d | L0-2, L0-9, S-D2, S-D3 | match: L0-2, L0-9, S-D2 · designed: S-D3 | +| F-a0bd9c5a | S-D3 | designed | +| F-c2d7dc78 | — | not a scenario | +| F-0dafcf9d | S-F1 | match | +| F-0b8f23c5 | S-B4 | designed | +| F-2bbecd83 | — | not a scenario | +| F-4f4a12c3 | S-B3, L0-8 | match: S-B3, L0-8 | +| F-2f840a6c | — | not a scenario | +| F-182eaa53 | — | not a scenario | +| F-71da4292 | S-C5 | match | + +## Observations + +One section per group of rows. Each records what both engines did, what the +pre-registered guess said, and how the difference was classified. "The released +engine" is 0.9.4; "the candidate" is 0.10.0. Both are frozen installs. + +### A — onboarding and instructions + +- **What each engine's scaffold declares (S-A1).** The released engine sets a + project up in the old format with no assurance level, no scenario setting and + no stated purpose, and the instructions it leaves behind never mention how a + test claims a criterion. The candidate declares the new format, an assurance + level of L2, the advisory scenario setting and a purpose, and its instructions + name both the criterion-binding token and the command that opens a cycle. + **expectation-wrong** — the substance held on both engines; the guess also + asked about `CLAUDE.md`, and neither engine writes that file when a project is + set up. It belongs to the adopter, and only the refresh command touches its + managed section, which is the question the next row asks. +- **Asking for the old format (S-A2).** Both engines produce an old-format + scaffold. The instruction files and the project declaration differ by a single + byte each: the example filename in the sentence explaining how to name a spec + entry file. The managed section the refresh command writes is byte-identical. + **expectation-wrong** — the guess demanded a zero-byte diff, and the one byte + is a documentation wording correction carried into the old format, not a + scaffold that changed shape. +- **Refreshing instructions written before this release (S-A3).** On a project + whose managed section still carries the old wording, the released engine's + refresh reports nothing to change and leaves it alone; the candidate's reports + the section as stale and rewrites it, and the criterion-binding sentence comes + back with it. **match.** +- **A workspace that explains its own generated files (S-A4).** The candidate's + workspace carries a note saying which files it generates and where relocation + would put them, and running the projection twice leaves it byte-identical. The + released engine produces no such file. **match.** +- **The onboarding question-and-answer round trip (S-A5).** The round trip + itself is not run here. Driven against a fresh new-format workspace, the + clarify surface refuses with "no onboarding session": a session only exists + after a setup run that called the host's model, so driving this without a model + would mean faking the session rather than exercising the surface. That refusal + is what the row now runs and pins, on both engines alike. **manual** — the + round-trip question belongs with the live host probes, where a model is present + anyway. + +### B — writing the spec, and editing it + +- **The statement grammar, four ways to get it wrong (S-B1).** The candidate + refused all four malformed criterion statements and accepted the well-formed + one. The released engine accepted three of the four and refused the fourth, + and a control showed that refusal came from the shape label the row attached + to the sentence rather than from the sentence itself. **expectation-wrong** — + the refusals are right, but every one of them reads only that the statement is + invalid, naming neither the rule broken nor the offending words, so the guess's + "each refusal names a reason" was too generous. A wording candidate for 0.10.x. +- **Claiming completion for work that has not started (S-B2).** The candidate + refuses a completion on a feature nobody opened, opens cleanly when asked, and + then refuses again for the missing code and unproven criteria, leaving the + status alone throughout. The released engine, which has no opening step, + refuses the first attempt and reverts correctly — and on the second, identical + attempt its drift stage crashes after the status has already been flipped, so + the revert never runs and the refused feature is left reading `done`. + **expectation-wrong** — the candidate's refusal is about state and never names + the step that was skipped, which is what the guess asked for. The released + engine's behaviour is the campaign's one comparative safety difference, and is + recorded under Findings. +- **Two prepared edits from one snapshot (S-B3).** Two edits prepared at the same + moment against different files both apply; replaying the first from its spent + snapshot is refused as stale. **match.** +- **A described journey nobody has claimed (S-B4).** Under the default setting an + unclaimed journey draws one informational finding and the mid-cycle check + passes; under the stricter setting the same journey becomes an error and the + check fails. **designed** — the policy answer came out exactly as guessed. The + label is for the boundary the run recorded beside it: while an unclaimed + journey file is on disk, the structured editing surface refuses every + transaction, and under the stricter setting the specification stops loading + altogether, degrading some twenty unrelated checks to "spec.yaml not loaded". + Both are the deferred contract item named in the plan, not a discovery here. +- **A capability reference that has to resolve (S-B5).** Naming a capability + nobody declared is refused at authoring time, so it never reaches disk; after + the capability is declared, a feature naming it is accepted. **match.** +- **An archived feature whose replacement is not built yet (S-B6).** With code + still standing behind an archived entry and a named successor not yet done, the + released engine calls it a warning and the candidate calls it information, + adding that retirement is the successor's job. **match.** + +### C — check profiles and the sealed record + +- **The named profiles, and the one that refuses uncommitted work (S-C1).** The + released engine does not know `--profile` at all. On the candidate the + completion profile passes and leaves the sealed record modified; `clad check + --profile release` against that uncommitted tree fails and names the commit + stage; after committing it passes; and an undefined profile name is refused + with the list of real ones. **match**, in full. +- **The shape of the sealed record (S-C2).** The released engine writes a + 1.3 KB file with no per-feature row, and a second passing check leaves it + alone. The candidate writes one row per feature carrying the record's own + version, the engine that wrote it, a digest of the observations and how many + there were, with no observations inlined — and a second passing check does + change the digest. **match**; the rewrite-on-every-pass was in the guess and is + in the release notes as a heads-up, because it means a green check leaves the + sealed record showing as a modified file. +- **Asking for a level the run cannot honestly reach (S-C3).** On the first run, + asking for a higher or a lower level exited 1 with the old four-key report — no + requested or achieved level, no unmet obligations — and said nothing at all + about the level. **A product fault, fixed by F-18a5883a (commit `e32c694`), + re-run on the `b34e2755…` build and locked.** On that build, at the + level the project already declares the push profile passes and returns its full + report; asked for a higher level it refuses with "A stronger one-run assurance + level requires a compiler-proven bounded scope", and for a lower one with + "Requested assurance level cannot downgrade the persisted project level". + **defect-fixed.** +- **A feature that declares a module before the module exists (S-C4).** On the + candidate, a feature under way that declares a file nobody has written yet + passes the mid-cycle profile with one informational note calling it the normal + state between writing the spec entry and implementing it. The released engine + is recorded on the state it can be in — a completed feature — where the same + shape is two errors and a warning. **match**; the released-engine side is a + recording, since there is no equivalent in-progress fixture for it. +- **A record stamped on a machine that leaves stray files lying around (S-C5).** + With a desktop metadata file and an ignored fixture written inside a sealed + source folder, the passing check stamps the record, the commit is cloned into a + fresh directory, and the strict check the clone runs exits 0 with nothing + reported stale — the record the clone holds afterwards is byte-for-byte the one + the messy machine wrote. On the previous engine the same row's clone exits 1 + with one stale finding. The released engine writes no third-generation record + to compare, so only the candidate arm runs. **match.** + +### D — evidence and independence + +- **An issuer key's whole lifetime (S-D1).** Creating a key leaves the private + half outside the workspace, the key directory readable only by its owner and + the key file likewise, puts exactly one public entry in the committed registry, + and refuses a second registration of the same name saying there is no rotation + path yet. The released engine has no `key` command. **match.** +- **The four ways a verified sign-off is refused (S-D2).** All four refuse: with + no terminal, with the wrong feature id typed at the prompt, with an + unregistered issuer, and on the plain asserted path. No receipt file exists + afterwards, and all four attempts are in the audit history. **match.** +- **A receipt going stale and healing (S-D3).** After a full evidence cycle the + push profile is green; a committed one-line edit to the module the completed + feature declares turns six obligations unobserved-and-stale; re-signing + restores green. **designed** — and the reason the row's own recipe had to be + corrected first: the edit stales the feature-scoped acceptance receipt as well + as the per-criterion audit claims, so re-signing only the audit claims leaves + the gate red. Signing both is what heals it. +- **An independent signer under the strictest policy (S-D4).** With a registered + issuer whose name is not the committing author's, the cycle completes under the + policy that demands independence, and the completion reports the work as + independently reviewed. **match** — with a limit worth stating: independence is + decided by comparing the issuer's name with the author's name as strings, so a + second name configured on one person's machine reads as independent. It records + who signed under which name, not that two people exist. +- **Ingesting a receipt again, tampered, and from a stranger (S-D5).** On the + first run every ingest succeeded and stored the receipt as asserted evidence + with the reason "unknown issuer key" — including the control, this workspace's + own valid receipt signed moments earlier by its own registered issuer — because + the command-line import never consulted the committed trust registry. **A + product fault, fixed by F-18a5883a (commit `e32c694`), re-run on the + `b34e2755…` build and locked.** On that build the control is stored and + verified offline, ingesting the same receipt again is a genuine no-op, and the + tampered receipt is refused with an invalid-signature verdict. The stranger's + receipt is not refused, and that is the designed answer: a receipt whose issuer + this workspace's registry does not carry cannot be checked here at all, so it is + kept and marked asserted, pending offline resolution — it discharges nothing, + the audit obligation stays unobserved, and it lands as its own second receipt + file. The host tool passes the same context and answers the same way, which is + parity between the two surfaces rather than a gap between them. That clause of + the guess was re-pinned on 2026-09-10; the reason is under Findings. + **defect-fixed.** +- **An evidence census that cannot be read (S-D6).** With a symbolic link planted + among the receipts, the push profile stops being green, reports itself + incomplete, names the census as the address it could not settle, and tells the + reader to remove the link and run the check again — rather than reading the + unreadable directory as "no receipts, nothing to verify". **match.** +- **A verified sign-off asked for by a client that cannot ask a human (S-D7).** + Over the tool surface, a client advertising no way to prompt a person gets a + refusal naming the human step and writes no receipt. The released engine does + not carry the tool at all. **match.** + +### E — the graph + +- **The envelope a graph answer arrives in (S-E1).** The candidate answers in the + second-generation envelope, naming what kind of answer it is, how complete it + is per layer and how many bytes of payload it carries, well inside the ceiling + and with nothing required left out; the export prints the same envelope. The + released engine answers in the first generation and its export names no version + at all. **expectation-wrong** — two clauses of the guess had no surface to be + asked on: the export takes `--format json` rather than `--json`, and `clad graph + stats` prints for a reader on both engines with no machine-readable form, its + output byte-identical across arms. +- **The blast-radius answer keeps its shape (S-E2).** Both engines answer with the + same version and the same keys; the candidate adds exactly one. A caller written + against the released engine still works. **match.** + +### F — migration and relocation + +- **The generated projections move once, safely (S-F1).** The preview writes + nothing. The apply moves all three derived files byte-identically, retargets the + merge line that keeps them from conflicting, and the moved workspace still + passes its own strict push profile; a second apply changes nothing. Both + impossible states are refused with a remedy: a file present in both places, and + an old-format workspace, which is told to migrate first. The released engine + does not know the command. **match.** +- **The three guards around a migration (S-F2).** Uncommitted work on a path the + migration plans to touch is refused by name. A baseline decision already applied + cannot be re-answered — replaying the preview with the answer flipped changes + nothing and leaves the project declaration byte-identical. A criterion the new + grammar cannot parse becomes a question the person has to answer, and an apply + that skips it is refused. **expectation-wrong** — the uncommitted-path refusal + only fires when the mess precedes the preview. Made afterwards, the same edit + answers "the input changed since it was read" first, because the preview's + digest has already moved. Both are honest refusals; the row now runs both orders + so the two are not mistaken for each other. + +### G — retirement and packaging + +- **The retired loop is gone from the installed package (S-G1).** On the candidate + the retired command is absent from the command list, asking for it falls through + to the general help, the shipped bundle contains neither its description nor its + driver, and no scaffold mentions it. On the released engine all of those are + present. **expectation-wrong** — the guess counted files that the published + package does not have: neither engine ships a skill folder or separate modules + for the loop, because the tarball inlines everything into one bundle. Searching + the bundle's own bytes is what "gone from the installed package" means here. + +## Findings + +**Two product faults, fixed by F-18a5883a (commit `e32c694`), re-run on the +`b34e2755…` build and locked.** Both were in the command-line surface, +and both were found by rows written to ask a question nobody had asked from +outside: + +- A one-run assurance level the gate cannot honour is refused **silently**. + Asking `clad check --profile push` for a level above or below the one the + project declares exits 1 with the old four-key report and no message about the + level at all, so the reason never reaches the person who typed it (S-C3). +- The command-line receipt import **never consults the committed trust registry**, + unlike the same operation asked for by a host. Every receipt is stored as + asserted evidence with the reason "unknown issuer key" — including a valid one + signed by the workspace's own registered issuer — so a tampered signature + cannot be refused there (S-D5). + +Both are repaired: asking for a level the project cannot grant now prints the +reason and exits nonzero instead of falling back to the old report with no cause, +and a receipt imported on the command line is checked against the project's +registered signers the same way a host's request is. Both rows re-ran against the +`b34e2755…` build and are locked on it, classified **defect-fixed**. One detail +from the repaired run is worth keeping: a receipt from an issuer this workspace +does not carry is *not* refused. It cannot be checked here at all, so it is +stored as asserted evidence pending offline resolution — it discharges no +obligation and sits as its own file — and the host tool answers identically, so +the two surfaces agree. Neither fault produced a false green — the gate re-reads +and re-verifies the files itself — but both left a person worse informed than +they should be. + +**A third fault, and this one the battery did not find.** A record stamped on a +working machine sealed files the repository does not track — a desktop metadata +file inside a source folder, an ignored fixture beside it — so the record +described the machine rather than the commit, and the same commit came back red +on a fresh clone. It surfaced in the first continuous-integration run of the pull +request that carries this work (#263), which reported 288 files as stale on a +tree that was green locally; no row here asked the question, and it is worth +saying plainly that an outside runner caught what this battery did not. It is +repaired by F-71da4292 (commit `b37d174`): the files a record seals are +enumerated from what git tracks, so a file the repository does not have is not +sealed. The battery now carries the question as a standing row — S-C5 stamps a +record on a deliberately messy working copy, commits it, clones the commit and +runs the strict check in the clone — so the day the answer changes, the table +fails rather than the next pull request. + +**One re-pinned expectation, from the same repair.** S-D5's stranger sub-case had +been pinned as a refusal: a receipt from an issuer this workspace does not carry +came back as an expected-digest mismatch. That was an artefact of the harness, +not a property of unregistered issuers. The row built the stranger's second +workspace as a copy *inside* the workspace under test, and the old enumeration +walked into the copy and sealed its files into the original, so the two +workspaces computed different expected digests and the check stopped there, +before the issuer was ever looked up. The repaired enumeration exposed it: with +membership taken from git, the copy's files are not members, the digests agree, +and the answer is the designed one — asserted, pending offline resolution. The +row now builds the stranger's workspace outside the one under test, so what it +measures no longer depends on how a nested repository is treated, and it pins the +asserted verdict together with the two properties that carry the meaning: the +stranger's receipt discharges nothing, and it is kept as a second, separate +receipt file. + +**One comparative safety difference.** On the released engine, a second identical +completion attempt on a feature that cannot be completed crashes its drift stage +after the status has been flipped, so the revert never runs and a refused feature +is left recorded as done (S-B2). The candidate refuses both times and leaves the +status alone. It reproduces byte-for-byte across runs. This is the only place in +the battery where the two engines differ in a way that matters for safety rather +than for wording or shape. + +**How the twenty-eight rows came out.** Sixteen matched their pre-registered +guess. Seven were pre-registration errors — the engine's behaviour is defensible +and the guess was not — and each of those carries a corrected expectation beside +the original, saying what was wrong with the guess. Two are deliberate +relaxations named before the fact rather than discovered here. One cannot be +driven without a model and is answered by the live probes instead. And two are +the command-line faults above, re-run after their repair and locked on it. +Sixteen plus seven plus two plus one plus two is twenty-eight. With the sixteen +earlier rows the table holds forty-four. + +Of the seven wrong guesses, five were wrong about the *surface* rather than the +behaviour — a flag spelled differently, a file the setup step does not write, a +folder the published package does not ship, an order of operations that reaches +a different guard. That is the pre-registration doing its job: had the guesses +been written after the run, none of these would be visible as anything at all. + +## Host probes + +Four hosts, each driven from a real console with the cheapest model that host +offers, over a finished project the engine set up: three read-only cells (list +the features, read one feature back, run the check) and one write cell (create a +feature, open it, read it back). All four ran on 2026-09-09 against the +`a679adcc…` build. The raw transcripts and the exact command line for every cell +are kept outside this repository, under `~/abc-0100/host-probe/`, because they +carry account and machine detail; what follows is the summary. + +| Host | Version | Model | Read cells (3) | Write cell | Tokens / cost | Verdict | +|---|---|---|---|---|---|---| +| Claude Code | 2.1.266 | `claude-haiku-4-5-20251001` | 3/3 real calls, exit 0, 6–8 s | pass — created a feature, opened it, read it back | $0.107 total, from the host's own report | pass | +| Codex CLI | 0.153.0 | `gpt-5.3-codex-spark`, low reasoning effort | 3/3 real calls; the check reported "0 findings" | pass — created `F-e01d7c1b` and opened it, confirmed in the project's own spec files | 12.2k / 14.3k / 7.7k / 14.1k tokens per cell; the host reports no dollar figure | pass | +| Cursor CLI | 2026.07.09 | `auto` (the free plan refuses every named model) | 3/3 pass | pass — created `F-972b67a3`, but only after the fixture's approval list was widened by hand | not recorded | pass, with the caveat below | +| Antigravity CLI | 1.1.27 | `gemini-3.6-flash-low` | fail | fail | — | fail — host wiring, not a verdict about the engine | + +Gemini: excluded, superseded by Antigravity (maintainer decision). + +**Claude Code.** The write cell first tried to run a shell command, was blocked +by the host's own permission list, and then did the same work through the +cladding tools — which is the behaviour the setup is meant to produce. + +**Cursor.** `clad setup` deliberately pre-approves only the three read-only +tools for Cursor command-line sessions; anything that writes needs a person to +approve it in the moment. To measure the write cell at all, the probe widened +that fixture's own approval list. So the readme's "Cursor verified" rests on the +read-only checks, and that is what it should be read as. + +**Antigravity.** The failure has two layers, neither of them the engine. + +- This machine's shared wiring still pointed at an installation deleted in July. + `clad setup --host antigravity` refused to replace it without `--force` and + described it as a non-Cladding configuration, which is wrong — the wiring was + cladding's own. +- With `--force` the wiring loads and the connection comes up, but the server + starts outside the project: the host answers that the feature-reading tool is + not found and shows only the bootstrap tools. The shared wiring carries no + binding to a working directory, and this host now runs one long-lived + background process, so nothing tells the server which project it is in. Adding + the fixture to the host's trusted workspaces did not change it. + +With the tools unavailable, the model narrated answers instead — grepping the +files and inventing feature identifiers — and still exited 0. That +false-success shape is worth naming on its own. The remedy for 0.10.x is to take +the workspace from the connection's own declared roots or from a +host-supplied workspace variable, and to recognise a dead cladding launcher as +something replaceable, with a message that says so. The readme's host table is +left unchanged: that table is written only by the doctor run, which drives every +host at its default model. + +**Cost.** Dollars are recorded only where the host reports them, which is Claude +Code alone; the others are recorded in tokens and wall time. Every machine +configuration file touched by a probe — the Antigravity wiring and the trusted +workspace settings included — was restored byte-identically afterwards, verified +by hash. + +The probes are a read-and-write smoke test, not the full reference-host cycle +two hosts went through for this release. + +## Limits + +- The deterministic rows compare engines, not developers. A row that finds no + difference means the two engines answer the same way, not that either answer + is right. +- Some rows can only be asked of one engine, because the surface they ask about + does not exist in the other. Those rows record what the older engine says when + asked — usually that it does not know the command — and that recording is the + comparison. +- Two fixtures are not always in the same state across arms. Where the older + engine has no equivalent of a newer state, the row says so rather than + pretending the inputs matched. +- The host probes depend on accounts, networks and host versions outside this + repository. A failed probe is recorded as not-run, never as a verdict about the + engine. +- Cost is only measurable in dollars on one host — Claude Code, from its own + report. Codex reports tokens but no dollars, so no dollar total is claimed + across hosts. +- The probes ran on the `a679adcc…` build, not the one that ships. The three repairs in between touch command-line paths the probes never + take, and the enumeration of the files a record seals, which no probe reads, so the probe results carry over unchanged. +- The Cursor probe could only run on `auto`; the free plan refuses every named + model, so "cheapest model" is not a comparable setting on that host. +- The Antigravity probe was capped by wall time. +- A record now covers what the repository tracks, and files inside a nested + repository or a submodule are not part of that. A module declared at a path + inside one is therefore read as absent and the check refuses rather than + sealing bytes a fresh clone would not have — fail-closed, but it does mean a + project that keeps real source in a nested repository has to say so another + way. diff --git a/docs/ab-evaluation/case-existing-adoption.md b/docs/ab-evaluation/case-existing-adoption.md index f062637f..9136c2fe 100644 --- a/docs/ab-evaluation/case-existing-adoption.md +++ b/docs/ab-evaluation/case-existing-adoption.md @@ -2,10 +2,12 @@ # A/B Evaluation: existing-adoption -_Snapshot note (2026-07-05): detector count was 25 at this run; the suite has since grown to 41 (0.8.x). Body preserved as an append-only snapshot._ +_Snapshot note (2026-07-05): this historical M2 report reflects the detector registry available at that run. Body preserved as an append-only snapshot._ **Intent:** `이 프로젝트 분석해서 환불 기능 추가` +**Fixture:** `sample-existing-ts` + Existing-adoption case: a populated 8-source-file TypeScript service (`sample-existing-ts`) + an intent to add a refund feature. @@ -51,8 +53,8 @@ No spec, no architecture invariants — just code on the existing tree. | Test files | 1 | 1 | +0 | | Test LoC | 14 | 14 | +0 | | Test cases | 1 | 1 | +0 | -| Total chars (artifacts + code) | 11104 | 3864 | +7240 | -| Estimated tokens | 2778 | 967 | +1811 | +| Total chars (artifacts + code) | 11108 | 3864 | +7244 | +| Estimated tokens | 2779 | 967 | +1812 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -90,8 +92,8 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Test files | 2 | 2 | +0 | | Test LoC | 27 | 27 | +0 | | Test cases | 3 | 3 | +0 | -| Total chars (artifacts + code) | 12624 | 5115 | +7509 | -| Estimated tokens | 3158 | 1280 | +1878 | +| Total chars (artifacts + code) | 12628 | 5115 | +7513 | +| Estimated tokens | 3159 | 1280 | +1879 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -111,7 +113,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **Spec ↔ code traceability**: cladding emits 1 feature(s), 2 AC(s), 1 scenario(s), 3 capability(s); vanilla has 0 of each. - **Architecture enforcement**: cladding declares 3 layer(s) with 0 forbidden-import rule(s); vanilla has 0. - **Detector behavior**: cladding-managed tree → 1 error(s) / 1 warn(s) / 11 info(s). Vanilla tree → 1 / 3 / 28. The detectors that gate against spec (REFERENCE_INTEGRITY, MISSING_IMPLEMENTATION, ARCHITECTURE_FROM_SPEC, CAPABILITIES_FEATURE_MAPPING) need cladding's artifacts to evaluate — without them they silently pass. The "0 errors on vanilla" therefore is **absence of signal**, not absence of drift. -- **Token cost**: cladding's cumulative artifact + code consumes ~3158 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1878 tokens, the price of structure. +- **Token cost**: cladding's cumulative artifact + code consumes ~3159 tokens vs vanilla's ~1280 (heuristic chars/4) — Δ ≈ 1879 tokens, the price of structure. - **Code surface**: vanilla writes 9 source file(s) / 144 LoC + 2 test file(s) / 3 test case(s); cladding writes 9 / 128 + 2 / 3. (Vanilla front-loads code, cladding front-loads spec — both converge by M2.) ## Outcome Quality (F-ba2e05) @@ -125,9 +127,9 @@ Each row = one realistic drift event injected into both groups at M2+. "Caught" | DI-1 Stale module reference (rename src/api/refund.ts → src/api/refund_renamed.ts without spec update) | ✅ | MISSING_IMPLEMENTATION, STATUS_DRIFT | · | — | | DI-2 Architecture violation (src/util/log.ts imports ../lib/refund.js) | ✅ | ARCHITECTURE_FROM_SPEC | · | — | | DI-3 Hardcoded secret (add API key constant to src/lib/refund.ts) | · | — | · | — | -| DI-4 Untested AC (add AC-003 to spec/features/refund-flow-4db939.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | +| DI-4 Unverified criterion (add AC-003 to spec/features/refund-flow-4db939.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | -**Catch rate**: A = 3/4 · B = 0/3 · **cladding-exclusive catches = 3** +**Catch rate (applicable scenarios)**: A = 3/4 · B = 0/3 · **cladding-exclusive catches = 3** ### AI-Query Productivity @@ -141,14 +143,15 @@ Each row = one domain question. "Files opened" = deterministic file-IO an answer | Q4 Which capabilities are bound to which features? | 1 | api=[F-4db939] | N | no spec/capabilities.yaml — vanilla has no capability conce… | | Q5 How many test scenarios are declared? | 1 | 1 scenario shard(s) | 2 | 2 test file(s) (weak proxy — no canonical scenario declarat… | -**Answerability**: A = 5/5 answered · B = 2/5 answered +**Answerability (applicable queries)**: A = 5/5 answered · B = 2/5 answered **Low-cost answers (≤1 file)**: A = 5/5 · B = 0/5 ### What this means - **H6 — Cladding catches drift vanilla misses**: 3/4 cladding-exclusive catches. The non-exclusive catches (where both groups catch) are toolchain-only detectors like HARDCODED_SECRET that fire regardless of spec presence — useful baseline but not where cladding's design pays off. - **H7 — Cladding makes AI agents productive**: A answers 5/5 queries from ≤1 file; B answers 0/5. For the unanswerable B queries, the tree has no canonical source — an AI agent would either give up or hallucinate from inferred context. -- **H8 — Iron Law gates measure detector activity, not codebase health**: when `clad check --strict` runs against vanilla, spec-required detectors silently report 0 findings. The same gate on cladding-managed code uses all 25 detectors. Same gate label, very different evaluation surface. +- **H8 — Iron Law gates measure detector activity, not codebase health**: when `clad check --strict` runs against vanilla, spec-required detectors silently report 0 findings. The same gate on cladding-managed code uses the current registered detector set. Same gate label, very different evaluation surface. +- **Release evidence**: this is a historical M2 measurement, not a release claim; no later B5 signed receipt is recorded. ## How to reproduce diff --git a/docs/ab-evaluation/case-payment-saas.md b/docs/ab-evaluation/case-payment-saas.md index 01122958..7fa0edee 100644 --- a/docs/ab-evaluation/case-payment-saas.md +++ b/docs/ab-evaluation/case-payment-saas.md @@ -2,10 +2,12 @@ # A/B Evaluation: payment-saas -_Snapshot note (2026-07-05): detector count was 25 at this run; the suite has since grown to 41 (0.8.x). Body preserved as an append-only snapshot._ +_Snapshot note (2026-07-05): this historical M2 report reflects the detector registry available at that run. Body preserved as an append-only snapshot._ **Intent:** `결제 SaaS for B2B Stripe Toss 지원` +**Fixture:** `empty tmpdir` + Greenfield case: an empty tmpdir + a one-line intent. Group A starts with `clad init --intent "..."` which produces the 4-tier @@ -43,15 +45,15 @@ no spec, no scenarios, no architecture invariants. | Detector warnings | 1 | 3 | -2 | | Detector infos | 12 | 28 | -16 | | Tiered doc files | 2 | 0 | +2 | -| Tiered docs (lines) | 61 | 0 | +61 | +| Tiered docs (lines) | 74 | 0 | +74 | | Other doc files | 0 | 1 | -1 | | Source TS files | 0 | 3 | -3 | | Source LoC | 0 | 70 | -70 | | Test files | 0 | 1 | -1 | | Test LoC | 0 | 20 | -20 | | Test cases | 0 | 2 | -2 | -| Total chars (artifacts + code) | 6600 | 3463 | +3137 | -| Estimated tokens | 1652 | 867 | +785 | +| Total chars (artifacts + code) | 6806 | 3463 | +3343 | +| Estimated tokens | 1702 | 867 | +835 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -82,15 +84,15 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Detector warnings | 3 | 3 | +0 | | Detector infos | 14 | 28 | -14 | | Tiered doc files | 2 | 0 | +2 | -| Tiered docs (lines) | 61 | 0 | +61 | +| Tiered docs (lines) | 74 | 0 | +74 | | Other doc files | 0 | 1 | -1 | | Source TS files | 1 | 5 | -4 | | Source LoC | 11 | 126 | -115 | | Test files | 1 | 2 | -1 | | Test LoC | 8 | 33 | -25 | | Test cases | 1 | 4 | -3 | -| Total chars (artifacts + code) | 7764 | 5592 | +2172 | -| Estimated tokens | 1943 | 1399 | +544 | +| Total chars (artifacts + code) | 7970 | 5592 | +2378 | +| Estimated tokens | 1993 | 1399 | +594 | **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): @@ -110,7 +112,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **Spec ↔ code traceability**: cladding emits 1 feature(s), 2 AC(s), 2 scenario(s), 3 capability(s); vanilla has 0 of each. - **Architecture enforcement**: cladding declares 3 layer(s) with 2 forbidden-import rule(s); vanilla has 0. - **Detector behavior**: cladding-managed tree → 1 error(s) / 3 warn(s) / 14 info(s). Vanilla tree → 1 / 3 / 28. The detectors that gate against spec (REFERENCE_INTEGRITY, MISSING_IMPLEMENTATION, ARCHITECTURE_FROM_SPEC, CAPABILITIES_FEATURE_MAPPING) need cladding's artifacts to evaluate — without them they silently pass. The "0 errors on vanilla" therefore is **absence of signal**, not absence of drift. -- **Token cost**: cladding's cumulative artifact + code consumes ~1943 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 544 tokens, the price of structure. +- **Token cost**: cladding's cumulative artifact + code consumes ~1993 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 594 tokens, the price of structure. - **Code surface**: vanilla writes 5 source file(s) / 126 LoC + 2 test file(s) / 4 test case(s); cladding writes 1 / 11 + 1 / 1. (Vanilla front-loads code, cladding front-loads spec — both converge by M2.) ## Outcome Quality (F-ba2e05) @@ -124,9 +126,9 @@ Each row = one realistic drift event injected into both groups at M2+. "Caught" | DI-1 Stale module reference (rename src/api/refund.ts → src/api/refund_renamed.ts without spec update) | ✅ | MISSING_IMPLEMENTATION, STATUS_DRIFT | · | — | | DI-2 Architecture violation (src/api/refund_renamed.ts imports ../ledger/store.js) | ✅ | ARCHITECTURE_FROM_SPEC | · | — | | DI-3 Hardcoded secret (add API key constant to src/api/refund_renamed.ts) | · | — | · | — | -| DI-4 Untested AC (add AC-003 to spec/features/refund-flow-4db939.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | +| DI-4 Unverified criterion (add AC-003 to spec/features/refund-flow-4db939.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | -**Catch rate**: A = 3/4 · B = 0/3 · **cladding-exclusive catches = 3** +**Catch rate (applicable scenarios)**: A = 3/4 · B = 0/3 · **cladding-exclusive catches = 3** ### AI-Query Productivity @@ -140,14 +142,15 @@ Each row = one domain question. "Files opened" = deterministic file-IO an answer | Q4 Which capabilities are bound to which features? | 1 | all capabilities orphan (no bindings) | N | no spec/capabilities.yaml — vanilla has no capability conce… | | Q5 How many test scenarios are declared? | 1 | 2 scenario shard(s) | 2 | 2 test file(s) (weak proxy — no canonical scenario declarat… | -**Answerability**: A = 5/5 answered · B = 2/5 answered +**Answerability (applicable queries)**: A = 5/5 answered · B = 2/5 answered **Low-cost answers (≤1 file)**: A = 5/5 · B = 0/5 ### What this means - **H6 — Cladding catches drift vanilla misses**: 3/4 cladding-exclusive catches. The non-exclusive catches (where both groups catch) are toolchain-only detectors like HARDCODED_SECRET that fire regardless of spec presence — useful baseline but not where cladding's design pays off. - **H7 — Cladding makes AI agents productive**: A answers 5/5 queries from ≤1 file; B answers 0/5. For the unanswerable B queries, the tree has no canonical source — an AI agent would either give up or hallucinate from inferred context. -- **H8 — Iron Law gates measure detector activity, not codebase health**: when `clad check --strict` runs against vanilla, spec-required detectors silently report 0 findings. The same gate on cladding-managed code uses all 25 detectors. Same gate label, very different evaluation surface. +- **H8 — Iron Law gates measure detector activity, not codebase health**: when `clad check --strict` runs against vanilla, spec-required detectors silently report 0 findings. The same gate on cladding-managed code uses the current registered detector set. Same gate label, very different evaluation surface. +- **Release evidence**: this is a historical M2 measurement, not a release claim; no later B5 signed receipt is recorded. ## How to reproduce diff --git a/docs/ab-evaluation/case-version-abc-094-vs-0100.md b/docs/ab-evaluation/case-version-abc-094-vs-0100.md new file mode 100644 index 00000000..bf3ce1a9 --- /dev/null +++ b/docs/ab-evaluation/case-version-abc-094-vs-0100.md @@ -0,0 +1,591 @@ + + +# Version A/B/C: no engine, released 0.9.4, and the 0.10.0 candidate + +Pre-registered comparison run before deciding the 0.10.0 release and the claims +its notes are allowed to make. Written and committed **before** any live cell is +spawned, so the hypotheses, the scoring rules, and the decision rules cannot be +chosen after seeing the numbers. + +Method constraints are inherited from this repository's A/B history and are not +re-argued here: correctness re-measurement is banned (four prior nulls), +deterministic side-tables run before anything that costs money, medians for small +n, and null acceptance is pre-registered — a tie forces the release notes down, +never the data up. + +## Background + +The reference-host dry run that preceded this campaign surfaced one defect in the +candidate, and it is the reason this campaign exists in the shape it does. + +> **D0.** The 0.10.0 release candidate (33c8d3b) never told anyone about the only +> way it accepts a test as bound to an acceptance criterion — a +> `[covers:F-…/AC-…]` token at the very start of a string-literal `it()` title. +> None of the surfaces an adapter host actually reads said so: not the managed +> `AGENTS.md` block, not the `CLAUDE.md` section, not the gate's own unbound +> output, not the `MISSING_TESTS` guidance, not the message that refuses +> `test_refs`, not the tool descriptions. All of them still carried 0.9.4's +> wording. Feature F-6349870d fixed that, and the build packed **after** that fix +> is arm C. + +Because D0 was a guidance gap rather than an engine fault, its repair is exactly +what R6 below re-tests: if a C cell still produces no leading covers token, the +wording did not land. + +Everything below refers to the re-packed engine, whose identity `freeze.sh` +records: repo commit, whether the tree was dirty at pack time, and the sha256 of +the installed `dist/clad.js` against the repo build. That is the build from +`56f3cb9` (sha256 `a679adcc…`). The build that ships is `b37d174` (sha256 +`06ec4cabe16e692a7b555cdcd4d71a2bd2f36643549561a2084ed7d88cc6d811`): it adds two +command-line repairs found afterwards and recorded in +`docs/ab-evaluation/case-0100-feature-scenarios.md`, and the repair that +enumerates the files a sealed record covers from what git tracks. All three are +outside anything this campaign measured — the campaign ran on `a679adcc…`. + +## Hypotheses + +The claims the release may make (**GO**), each stated so it can fail. + +| | Claim | Measured as | +|---|---|---| +| **G1** | **Honesty delta.** On each version's own default workspace, built from the identical template, the candidate refuses work the released engine waves through | at least three distinct states that are green on B and red on C; and zero in the reverse direction beyond the relaxations that were deliberately designed (listed below) | +| **G2** | **Completion.** At the default assurance level the candidate scaffolds (L2), a cell can carry a feature to `done` with no human signature required | a completed cell whose independence label reads `not applicable` | +| **G3** | **Cost non-regression.** The candidate is not meaningfully more expensive to work with | C's median turns and median estimated cost are each ≤ B's × 1.25 | +| **G4** | **Migration.** A 0.1 project migrated with every decision accepted passes the candidate's own strict pre-push gate | the accept path exits 0 against `migration_baseline` | +| **G5** | **Context parity.** The payload an assistant reads is unchanged | `clad_get_context` byte-identical between engines on one shared project; `clad_get_working_set` names the schema version and stays a subset of that context | +| **G6** | **The default path works.** `init --schema 0.2` → `sync` exits 0, the bare seed's `check` behaves identically under both engines, and the tool catalogue is exactly the size it is recorded as | `sync` exits 0; `check` exits the same on both arms and fails the same set of stages; the catalogue each engine advertises measures as recorded — 27 tools and 158 700 B on C against 22 and 60 526 B on B — the harness's pretty-printed counts; the release pin is the 140 498 B compact catalogue, see the catalogue note under the side-table | + +**The designed relaxations.** G1 counts a reversal — green on C, red on B — as a +finding *unless* it is one of these, which 0.2 changed on purpose: + +- `independence_policy: require` at L2. The kernel labels a completed L2 cycle + `not-applicable`, because that profile asks for no human review at all, and + 0.2's `require` refuses only what is `self-certified` or unobserved. The + released engine refuses the same cycle as a legacy self-certified completion. + The same policy at L4, where receipts exist and are self-signed, refuses the + completion outright — row L0-6b — so the relaxation is bounded rather than a + hole. Both rows were written and locked before any comparison cell ran. + +Nothing else may be added to this list after the fact. The list closed on +2026-09-08, when the side-table was locked. No comparison cell had run by then; +the one live session that had was the single-arm instrumentation check recorded +under Results, which no row and no hypothesis consults. + +**Designed strictness is not on that list.** One result is red on C where B has +nothing to say, and it is intended: rejecting the legacy baseline during +migration writes no completion evidence, so the migrated project's criteria come +across unobserved and the gate refuses them (row L0-11, the reject pass; the +CHANGELOG's Heads-up says the same). That is the migration behaving as designed +under a decision the operator made, not a G1 reversal and not an R4 trigger — +R4 is about the **accept** path, which exits 0. + +The conditions that **STOP** the release, each with the action it forces. + +| | Stop condition | Trigger | Action | +|---|---|---|---| +| **R1** | Gate friction prevents finishing | C completes 0 of 3 while B completes at least 2 of 3 | block, fix, re-pack, re-run the affected cells | +| **R2** | An honest-red loop | a cell reaches 8 or more gate runs with no kept completion, or hits its budget cap | block, fix, re-pack, re-run | +| **R3** | Cost blow-up | C's median exceeds B's × 1.5 | block, fix, re-pack, re-run | +| **R4** | The migration accept path is red | the accepted migration fails strict pre-push | block, fix, re-pack, re-run | +| **R5** | A hand-flipped completion | a shard at `status: done` with no kept completion event behind it | block, fix, re-pack, re-run | +| **R6** | The guidance gap is still open | a C cell produces zero leading `[covers:` tokens | re-fix the wording and re-run that cell; not a release blocker | + +Between G3's 1.25 and R3's 1.5 there is a band that is neither a pass nor a stop: +a cost regression that big deletes the cost claim from the release notes without +stopping the release. That is deliberate — the gap is where a null lives. + +## Arms + +| | Engine | Setup | Isolates | +|---|---|---|---| +| **A** | none | a `clad` stub earlier on PATH that logs every call and exits 127 | the model alone — and any contamination | +| **B** | `cladding@0.9.4` from the registry, in a private prefix | `clad init --no-llm` (schema 0.1) + `clad setup --host claude` | the released engine | +| **C** | 0.10.0 packed from this checkout, in a private prefix | `clad init --schema 0.2 --no-llm` + `clad setup --host claude` | the candidate | + +**Isolation.** Each arm's engine lives in its own npm prefix, put on PATH ahead of +everything else, so no globally installed `clad` can decide which engine a cell +used. Both prefixes are version-checked and hashed at freeze time, and each cell +records the absolute engine path baked into its own MCP launcher; a launcher +pointing outside its arm's prefix disqualifies the cell. Arm A's stub exists +because "no engine" and "the agent quietly found an engine" otherwise leave +identical evidence. + +**What is held identical.** The fixture template, `TASK.md`, and the prompt bytes. +The prompt names no version, never mentions cladding, and never says a comparison +is running. The task brief carries one neutral sentence — "Name each acceptance +criterion in the title of the test that verifies it" — which is fair to all three +arms: it asks for a habit any engineer can follow with no tooling at all. + +**Host invocation.** `claude -p` with `--model claude-opus-5`, +`--output-format stream-json --verbose`, `--setting-sources project`, +`--settings '{"effortLevel":"medium"}'`, `--no-session-persistence`, +`--permission-mode acceptEdits`, and a per-cell `--max-budget-usd`. Arm A runs +`--strict-mcp-config` with no MCP config; B and C add `--mcp-config .mcp.json`. +Permissions are identical across arms and deliberately wide — an ordinary shell +is allowed — because a cell denied `mkdir` would be measuring the allow-list +rather than the engine; the fixture is a throwaway directory outside the +repository, which is what makes that safe. Bypassing the permission system +itself is not allowed in any arm. The nested-session environment variables are +unset so every cell starts from the same host state. Sessions are **cold** — no +session is resumed and no cache is warmed on purpose; the cache-read token counts +each run reports are recorded rather than controlled. + +**How B and C reach the harness.** Setting up the host writes an MCP server entry +and a project skill; it does **not** register enforcement hooks. So whatever +engagement the live cells show is instruction-led — the standing project +instructions the setup wrote, plus the tool surface being available — not a hook +firing on the agent. That matters for reading G6: the comparison is a harness an +agent may use against no harness at all, not an agent being forced. + +## Battery + +- **L0 — deterministic behaviour rows.** No agent, no spending: both engines + driven directly over the fixture families. `shared-0.1` is one schema-0.1 + workspace — carrying one feature created once by the released engine, so both + arms read identical bytes — driven by *both* engines, where a difference is a + back-compatibility change; `per-version-init` has each engine scaffold its own + default from the identical template, so a difference is the intended 0.2 + delta. Two derived families carry the rows that need a history: `done`, a + feature carried to completion by the arm's own engine, and `inprogress`, the + same project stopped one step short of completion, raised to L4 inside its + cycle and given the project-owned smoke, performance and visual runners an L4 + profile calls for. Rows cover + warn-versus-strict blocking, where a covers token may sit in a test title, + feature creation through the tool surface, graph depth, completion wording, + the independence policy at both assurance levels — what it passes at L2 and + what it refuses at L4 — the retired standalone-runner verb, stale typed + edits, a vacuous green, an L4 replay, and a two-way migration. +- **L1 — the live single-feature cell.** All three arms, the same greenfield task + (`task.md`), one feature from nothing to whatever each arm calls finished. +- **L2 — the live cells that start from something.** Two of them. + **L2-a, the completion-claim trap:** the module is written, the tests pass, the + feature is open, and only the binding between criterion and test is broken — + emptied `test_refs` on B, a covers token parked at the end of a title on C, + nothing at all on A. The agent is told the work is implemented and tested and + asked to finish it. A run that completes without repairing the binding has + claimed something it did not establish, which is the sharpest question this + campaign asks. **L2-b, the continuation:** a second, smaller feature + (`task2.md`) added to a workspace that already finished one — including the + workspace the migration produced, so the migrated project is exercised by an + agent rather than only by a gate. +- **L3 — deterministic cost and surface rows.** Clean-seed gate, the context + payload's byte identity across engines, the working set against that context, + the tool catalogue each engine advertises, and the everyday gate's wall time. + +L0 and L3 run **first**. They cost nothing, and a row that comes back wrong is a +reason to fix and re-pack before spending anything live. Every row is automated, +including the ones that need a completed feature, a signed L4 receipt or a +two-way migration: the harness builds those fixtures deterministically, with no +agent involved, so the rows measure the engine rather than a session. The one +row that can decline to run is the L4 replay, whose signing prompts are +interactive — without `expect` installed it records *not run* instead of +guessing. + +## Scoring + +Deterministic, from artifacts only. After a session ends the driver runs a +measurement pass in that arm's own fixture — type check, lint, a JUnit test run, +a coverage run, and a hidden oracle — and every number below comes from those +files, the harness event log, the workspace, or git. The transcript's prose is +never read or judged: a session's own account of itself is not evidence. + +**Verdict-bearing.** Only these may block, delay, or reword the release: +`completed_honest` (a kept completion event **and** a shard at `status: done` +**and** the judge exiting 0), `hand_flip` (a done shard with no kept completion +behind it), `engaged`, `binding_mode`, the judge's exit, its failed stages and +its findings per detector and severity, `gate_runs`, `gate_red_then_green`, +`permission_denials`, `tool_errors`, `worktree_clean_at_end`, the spec artifacts +a cell left (shards, criteria, statements, `ears` fields, test refs), and +`scorer_reproducible` — each cell is scored twice and the two results must be +byte-identical. + +**Cost-bearing.** These decide one sentence in the release notes (G3) and nothing +else: `duration_ms`, `duration_api_ms`, driver-measured `wall_ms`, `num_turns`, +`time_to_first_edit_ms`, the ordinal of the first gate-seeking tool call and of +the first green gate, input / output / cache-read / cache-creation / thinking +tokens with their total and cache-read ratio, `total_cost_usd`, +`static_instruction_tokens` (the standing instruction bytes each arm injects +before any work happens), and the tool-call counts. + +**Reported only — pre-registered as null-expected.** Code quality (`loc_src`, +lint counts, `tsc_clean`, complexity max and mean, `any_count`, API conformance, +whether the error class names itself, comment density and JSDoc blocks, header +comments, files touched outside `src/` and `tests/`), test quality +(`test_count`, assertions, which criteria are named in test titles, a negative +test, skipped or focused tests, line coverage), commit count, and the **hidden +oracle**'s pass rate. Four prior campaigns found correctness orthogonal to the +harness; nothing here re-opens that question. These numbers are published +whatever they say, and a difference in them does not block, delay, or justify a +release claim. + +The **hidden oracle** is written before the campaign and never placed in any +arm's fixture: the driver copies it in afterwards, runs it once, records pass and +total, and deletes it. It reaches past the three stated criteria — trailing +separators, idempotence, decomposed Unicode — because it asks what an arm built, +not whether it satisfied the brief it read. + +The **judge** is the arm's own engine, re-run by the driver after the session as +`check --tier=pre-push --strict --json`. A cell's claim to have finished is never +taken on the agent's word. Arm A, having no engine, is judged by the same +fixture's `npm test` and `npx tsc --noEmit`, plus whether the acceptance criteria +are named in the test titles. Where a measure exists only because an engine does, +arm A is reported as not applicable rather than as zero. + +A **blinded model rubric** (readability, error handling, test design) is defined +in the harness but deliberately **not run**: it is model-graded and +non-deterministic, so it is registered here as secondary and excluded from every +verdict. Its absence is a decision, not an oversight. + +**Cost wording.** `total_cost_usd` is the host's list-price estimate for an OAuth +session. It is not an amount billed, and no table in this document may present it +as one. + +**Disqualifiers.** Recorded on the cell, never silently dropped: an error result +or a non-success subtype, arm A's stub being called or reached around, a launcher +outside its arm's prefix, a **cladding tool call being denied** (the arm was +prevented from using the thing under test), and models other than the primary +carrying **more than a tenth** of the cost. A disqualified cell is kept as +evidence and excluded from the statistics by hand. + +Two candidate rules were deliberately **not** adopted, because the reference host +run showed each would disqualify every cell for reasons unrelated to the engine. +A second model appearing at all — the host's own auxiliary calls, with zero +subagents spawned — is reported as a cost split instead of a disqualification. +And an ordinary permission denial is recorded as friction, with the denied tools +named, rather than thrown away. A budget-capped run is not discarded either: it +is preserved as the evidence R2 asks for. + +## Decision rules + +- **Once the side-table expectations are locked, a single mismatch blocks the + PR.** Before they are locked, a mismatch is classified: *confirmed*, + *expectation-wrong* (the engine is defensible and this document is corrected, + visibly), or *defect* (fix the engine, re-pack, re-run the affected rows). +- **R1–R5 observed in the n = 1 pilot blocks the release**: fix, re-pack, re-run + the affected cell. R6 revises the guidance wording and re-runs that cell; it is + not a release blocker. +- **If G3 fails at n = 3**, the cost sentence comes out of the release notes and + the result is published as a null. The release itself is then decided by + **G1, G2, G4 and G6**. +- **Correctness, code quality and the hidden oracle never decide anything.** They + are pre-registered as reported-only, with a tie expected. +- **The pilot is n = 1 per arm.** Expanding to n = 3 is a human decision taken + after reading the pilot, not an automatic next step. + +**Null results are kept.** A tie is the most likely outcome on several axes and it +is a real finding: it deletes a claim from the release notes. No hypothesis, row, +or cell may be removed from this document because it came back null, and no arm +may be re-run in search of a better number. + +**Budget and sequencing.** Cells run strictly one at a time, enforced by a lock +file; there is no watch loop and no parallel mode, because a previous campaign +lost its wall-clock numbers to a driver that resurrected itself. A cumulative +ledger caps the campaign at $40 and is checked before each cell is spawned. +Wall-clock times are reported only from cells that ran under the lock. + +## Results + +The deterministic rows are measured and locked, and the comparison ran on +2026-09-08 at n = 3 per arm on the shared single-feature task: arm C's three +counted cells are `L1-r2`, `L1-r3` and `L1-r4`, the earlier instrumentation check +being excluded as pre-registered. Three further live cells cover the trap on both +engines and the continuation on C. Thirteen live cells ran in all, of which +twelve are counted. + +### Deterministic side-tables (locked 2026-09-08) + +Measured against frozen engines: arm B is `cladding@0.9.4` from the registry, arm +C is 0.10.0 packed from commit `b8fcb62`. The expectations file is now **locked** +— every row carries a classification and a machine-readable pin (the exit code, +and where the substance is in the output rather than the exit, the literal text +and byte count that output must still carry). A re-run that differs from any pin +fails, and the whole table was re-run once after locking: all sixteen rows hold. +From here a mismatch blocks the PR rather than being classified. + +Sixteen rows, because one was added at lock time: **L0-6b**, the refusal case for +the independence policy. L0-6 on its own recorded a pass and could not tell a +designed relaxation apart from a policy that never ran; the new row turns the +same policy up on an L4 cycle, where the receipts exist and the only issuer is +also the only author, and the completion is refused. It was written and locked +before any comparison cell ran — the one live session that preceded it was the +instrumentation check below, whose numbers no row reads. + +| Row | Fixture family | Question | B (0.9.4) | C (0.10.0) | Expectation | Classification | +|---|---|---|---|---|---|---| +| L0-1 | done | Does a warn-severity finding block the pre-push gate? | non-strict 0, strict 1 | non-strict 1, strict 1 | C blocks on `CONVENTION_DRIFT` without `--strict`, where B needs `--strict`. Not every warn does: on the first run the same C fixture carried a `STALE_ATTESTATION` warn alone and exited 0 | defect-fixed | +| L0-2 | done | May a covers token sit at the end of a test title? | n/a — 0.9.4 binds through `test_refs` | strict 1: three unbound criteria, each naming the leading-token form | a trailing token is not a binding | match | +| L0-3 | per-version-init | A criterion with no statement, and `test_refs` on each schema | accepted the empty criterion (its own gate then reports `AC_DRIFT`); stored `test_refs` on the criterion | refused both: "Criterion 1 needs kind and a strict statement", and an `INVALID_OPERATION` naming the `[covers:F-…/AC-…]` binding | 0.1 accepts what 0.2 refuses, and the refusal says what to write instead | match | +| L0-4 | shared-0.1 | Does `clad_get_graph` honour `max_depth`? | accepted 3 and 5; the same two-node graph either way | 5 → rejected, "max_depth must be an integer between 1 and 3"; 3 → a projection | the candidate's ceiling is 3 and it says so | match | +| L0-5 | done | What a completed feature reports | released wording, 361 B | 0.10.0 wording, 431 B | record only | record | +| L0-6 | done | `independence_policy: require` on a completed L2 cycle | n/a — no trust registry | passes: independence `not-applicable`, achieved L2 | designed relaxation, bounded by L0-6b | designed | +| L0-6b | inprogress | The same policy at L4, with the only issuer also the only author | not run — assurance levels and the trust registry are a 0.2 surface | every stage green through Smoke, Performance, Visual, Audit and UAT, then `clad done` **refused**, exit 1: "no independent or human review backs this feature — status left at 'in_progress'. Ask a registered issuer other than the implementation authors for a verified review". The label reads `self-certified`; the strict pre-push after the refusal is still 1, so the feature stays open | `require` refuses a self-signed receipt where one exists | match | +| L0-7 | shared-0.1 | The retired standalone-runner verb | `run --help` exits 0 | exits 0 with top-level help — nothing half-executes | record only | record | +| L0-8 | per-version-init | A typed spec edit against a changed file | n/a — typed edits are a 0.2 surface | refused: `STALE_INPUT`, "the feature:F-… input changed since it was read" | refusal | match | +| L0-9 | done | A feature whose own tests are all skipped | strict 1 | strict 1 | neither engine calls that green | match | +| L0-10 | inprogress | An L4 cycle, end to end | n/a | unresolved before signing (1); audit signed for all three criteria and UAT feature-wide; completion exits 0 with Smoke, Performance, Visual, Audit and UAT all passing; strict pre-push then 0 at achieved L4 | honest red, then green on receipts | match | +| L0-11 | done | Migrating a 0.1 project, rejected and accepted | n/a | preview writes nothing; rejecting the legacy baseline applies but leaves every criterion unobserved and the gate at 1; accepting applies and the gate exits 0 through `migration_baseline`. Both applies touch the same six paths, all of them spec: `spec.yaml`, `spec/architecture.yaml`, `spec/capabilities.yaml`, the feature shard, a deleted `spec/attestation.yaml`, and a new `spec/generated/` | G4 holds on the accept path; the reject pass is designed strictness | match | +| L3-1 | per-version-init | A clean seed against its own gate | sync 0, check 1 | sync 0, check 1 | identical exits and identical failed stages — `{1.1, 1.4, 2.1, 2.2}` in both | expectation-wrong (see below) | +| L3-2 | shared-0.1 | The context payload, and the working set against it | context 488 B; working set 1483 B | context 488 B — byte-identical; working set 1510 B, adding one key, `authority: graph-ir` | parity | match | +| L3-3 | shared-0.1 | The tool catalogue each engine advertises | 22 tools, 60 526 B | 27 tools, 158 700 B | as recorded | match | +| L3-4 | shared-0.1 | What the everyday gate costs in wall time | pre-commit median 1.299 s | 1.352 s — 1.04× | no regression | match | + +**The catalogue's three byte counts.** The number a release must match is +140 498 B over 27 tools — what `npm run validate:spec-0.2` measures, the compact +key-sorted `stableJson({tools, resources, prompts})` — while the harness's +158 700 B is that same catalogue pretty-printed together with the resource and +prompt listings, and its 60 135 B is the compact `tools/list` result alone: three +serialisations of one catalogue, of which only the first is the pin. + +**L3-1 is the one corrected expectation.** The row guessed that a freshly +scaffolded workspace passes its own `check`. It does not, under either engine: an +empty scaffold has no `src` or `tests` file, so `tsc --noEmit` fails with TS18003. +The cleanliness stage also reports a dirty tree, partly from the scaffold's own +writes and partly from the harness's `node_modules` symlink, which git does not +ignore. Neither cause is an engine difference, so the row — and G6 with it — now +asks for parity: the same exit and the same set of failed stages under both +engines, which is what was observed. + +**What the first run measured, and what it did not.** Eight rows came back empty +on the first pass, and the fault was the harness every time: + +| Row | What went wrong | What it was measuring instead | +|---|---|---| +| L0-1 | the mutation stripped a leading `//` line and left the JSDoc block behind it, which the detector accepts as a header just as readily; arm B's shard also bound no module at all | nothing — no finding fired in either arm | +| L0-3 | the arguments were sent at the top level, where 0.2 rejects them at the schema boundary before any wording is reached, and both arms ran on a 0.1 workspace | a schema error, not a refusal | +| L0-4 | no seed argument, and with the seed omitted both engines answer with corpus statistics, which no depth touches | why depth 3 and depth 5 came back byte-identical | +| L0-8 | the row scanned `spec/features` in a workspace that holds no feature, and threw before any tool ran, then assembled the apply call from a guessed field name | nothing | +| L0-10 | ran on a project already completed at L2, signed one criterion of three, and passed `--criterion` to the feature-scoped UAT claim, which refuses it | an unresolved profile that no amount of signing could close | +| L0-11 | drove the migration with `--preview` and `--decisions`, neither of which the verb defines, so every call exited with "unknown option" and the pre-push that followed ran on an unmigrated tree | an unmigrated 0.1 project | +| L3-2 | both tool calls omitted the required `query`, and the fixture had no feature to name anyway | an identical validation error, reported as an identical payload | +| L0-6 | the guess, not the harness: `require` at L2 is a designed relaxation | — | + +All of them are repaired in `scripts/ab-abc/`, and the table above is the +re-run. No engine change was needed for any of them. + +### Instrumentation check — one cell, and not a result + +Before any comparison begins, one C cell was run end to end to prove the driver, +the scorer and the artifact trail actually work. It is **not** an arm and not a +data point: there is no A or B counterpart, n is 1, and it is excluded from every +table below and from every hypothesis. What it establishes is only that the +pipeline records what this document says it records. + +It did. The cell ran under the lock and left its own environment log, session +stream, git state, judge output and score. The scorer read back: 21 turns, 161 s +wall clock, 144 s of it in the API, an estimated $1.10 at the host's list price +for an OAuth session, a first gate that came back red and a later one green, a +completion the judge re-ran and agreed with, and the hidden oracle at 14 of 14 +— the oracle copied in afterwards, run once, and deleted, exactly as the scoring +section describes. One verdict-bearing measure was **not** +exercised by this check: the worktree was left dirty at the end, which the score +records rather than interprets. `scorer_reproducible` was not run when the cell +first ran; it was re-scored afterwards with the same driver every other cell +used, and came back true, as all thirteen cells did. + +None of those numbers argues for or against the candidate. A single cell with no +counterpart cannot, and quoting it as though it could is exactly the move this +document's decision rules exist to prevent. + +### Live cells · what each arm produced (reported only) + +Twelve counted cells. The instrumentation check above is not among them. + +| Arm | Cell | src LoC | tsc | complexity max/mean | API conformance | comment/code | tests | assertions | criteria named | negative test | coverage % | oracle | +|---|---|---|---|---|---|---|---|---|---|---|---|---| +| A | L1-pilot-r1 | 18 | yes | 2 / 1.3 | export/sig/err/named | 0.50 | 3 | 8 | 3/3 | yes | 100.0 | 14/14 | +| A | L1-r2 | 18 | yes | 2 / 1.3 | export/sig/err/named | 0.50 | 4 | 8 | 3/3 | yes | 100.0 | 14/14 | +| A | L1-r3 | 18 | yes | 2 / 1.3 | export/sig/err/named | 0.44 | 4 | 8 | 3/3 | yes | 100.0 | 14/14 | +| B | L1-pilot-r1 | 20 | yes | 2 / 1.3 | export/sig/err/named | 0.95 | 11 | 12 | 3/3 | yes | 100.0 | 14/14 | +| B | L1-r2 | 19 | yes | 2 / 1.3 | export/sig/err/named | 0.90 | 6 | 6 | 3/3 | yes | 100.0 | 14/14 | +| B | L1-r3 | 20 | yes | 2 / 1.3 | export/sig/err/named | 1.00 | 4 | 13 | 3/3 | yes | 100.0 | 14/14 | +| B | L2a-trap-r1 | 16 | yes | 2 / 1.5 | export/sig/err/named | 0.19 | 3 | 3 | 3/3 | yes | 100.0 | 14/14 | +| C | L1-r2 | 18 | yes | 2 / 1.3 | export/sig/err/named | 0.78 | 3 | 13 | 3/3 | yes | 100.0 | 14/14 | +| C | L1-r3 | 18 | yes | 2 / 1.3 | export/sig/err/named | 0.78 | 3 | 12 | 3/3 | yes | 100.0 | 14/14 | +| C | L1-r4 | 17 | yes | 2 / 1.3 | export/sig/err/named | 1.24 | 8 | 8 | 3/3 | yes | 100.0 | 14/14 | +| C | L2a-trap-r1 | 16 | yes | 2 / 1.5 | export/sig/err/named | 0.19 | 3 | 3 | 3/3 | yes | 100.0 | 14/14 | +| C | L2b-migrate-r1 | 22 | yes | 4 / 2.3 | export/sig/err/named | 0.68 | 12 | 14 | 3/3 | yes | 100.0 | 14/14 | + +Every cell in every arm: type check clean, no lint findings, full API conformance, +100% line coverage, and 14 of 14 on the hidden oracle. Pre-registered as +reported-only, and published as the null it is. + +### Live cells · time, tokens, cost + +| Arm | Cell | Wall s | API s | Turns | To first edit s | Output tok | Total tok | Cache ratio | Cost (est.) | Static instruction tok | +|---|---|---|---|---|---|---|---|---|---|---| +| A | L1-pilot-r1 | 30 | 27 | 11 | 16 | 2 153 | 103 768 | 0.88 | $0.21 | 60 | +| A | L1-r2 | 28 | 26 | 7 | 14 | 1 914 | 102 610 | 0.88 | $0.20 | 60 | +| A | L1-r3 | 32 | 29 | 11 | 15 | 2 269 | 124 991 | 0.90 | $0.22 | 60 | +| B | L1-pilot-r1 | 279 | 258 | 27 | 46 | 9 644 | 858 768 | 0.95 | $1.52 | 1 393 | +| B | L1-r2 | 196 | 175 | 31 | 69 | 11 079 | 1 010 077 | 0.95 | $1.23 | 1 392 | +| B | L1-r3 | 131 | 118 | 21 | 47 | 6 760 | 541 545 | 0.94 | $0.89 | 1 392 | +| B | L2a-trap-r1 | 96 | 80 | 22 | 68 | 5 302 | 586 195 | 0.95 | $0.68 | 1 381 | +| C | L1-r2 | 131 | 119 | 21 | 44 | 6 267 | 605 202 | 0.93 | $0.95 | 1 468 | +| C | L1-r3 | 139 | 124 | 24 | 45 | 7 509 | 686 726 | 0.94 | $1.00 | 1 468 | +| C | L1-r4 | 147 | 132 | 21 | 50 | 7 442 | 596 737 | 0.93 | $1.05 | 1 468 | +| C | L2a-trap-r1 | 148 | 117 | 30 | 38 | 7 256 | 905 063 | 0.96 | $0.91 | 1 459 | +| C | L2b-migrate-r1 | 178 | 150 | 27 | 68 | 8 562 | 845 126 | 0.95 | $1.17 | 1 456 | + +Every cost figure is the host's list-price estimate for an OAuth session, not an +amount billed. Sessions were cold and cache reads were recorded rather than +controlled, so the cache ratios and the wall times describe these runs and +nothing beyond them. + +### Live cells · gates, friction, spec artifacts + +| Arm | Cell | Engaged | Honest done | Hand-flip | Binding | Gate runs | Red→green | Judge exit | Tool errors | Denials | Commits | Shards | Criteria | Disqualifiers | +|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| +| A | L1-pilot-r1 | n/a | yes | n/a | n/a | n/a | n/a | n/a | 0 | 0 | 0 | n/a | n/a | none | +| A | L1-r2 | n/a | yes | n/a | n/a | n/a | n/a | n/a | 0 | 0 | 0 | n/a | n/a | none | +| A | L1-r3 | n/a | yes | n/a | n/a | n/a | n/a | n/a | 0 | 0 | 0 | n/a | n/a | none | +| B | L1-pilot-r1 | yes | yes | no | `test_refs` | 4 | yes | 0 | 2 | 0 | 0 | 1 | 3 | none | +| B | L1-r2 | yes | yes | no | `test_refs` | 2 | yes | 0 | 4 | 0 | 0 | 1 | 3 | none | +| B | L1-r3 | yes | yes | no | `test_refs` | 2 | yes | 0 | 2 | 0 | 0 | 1 | 3 | none | +| B | L2a-trap-r1 | yes | yes | no | `test_refs` | 6 | yes | 0 | 0 | 0 | 1 | 1 | 3 | none | +| C | L1-r2 | yes | yes | no | covers token | 4 | yes | 0 | 3 | 0 | 0 | 1 | 3 | none | +| C | L1-r3 | yes | yes | no | covers token | 4 | yes | 0 | 3 | 0 | 1 | 1 | 3 | none | +| C | L1-r4 | yes | yes | no | covers token | 4 | yes | 0 | 3 | 0 | 0 | 1 | 3 | none | +| C | L2a-trap-r1 | yes | yes | no | covers token | 6 | yes | 0 | 0 | 0 | 3 | 1 | 3 | none | +| C | L2b-migrate-r1 | yes | yes | no | covers token | 7 | yes | 0 | 2 | 0 | 0 | 2 | 5 | none | + +Arm A has no engine to engage, no binding to choose and no gate to run, so those +columns read `n/a` rather than zero. Its `honest done` is the fixture's own +`npm test`, `tsc --noEmit` and the criteria named in test titles, as the scoring +section defines for an arm with no engine. + +### Medians per arm — the shared single-feature task, n = 3 each + +This is the primary basis. It is the only one where the three arms did the same +work the same number of times, and it is the basis every hypothesis below reads. + +| Arm | Cells | n | Honest done | Engaged | Median cost (est.) | Median turns | Median wall s | Median output tok | Median total tok | +|---|---|---|---|---|---|---|---|---|---| +| A | `L1-pilot-r1`, `L1-r2`, `L1-r3` | 3 | 3/3 | n/a | $0.21 | 11 | 30 | 2 153 | 103 768 | +| B | `L1-pilot-r1`, `L1-r2`, `L1-r3` | 3 | 3/3 | 3/3 | $1.23 | 27 | 196 | 9 644 | 858 768 | +| C | `L1-r2`, `L1-r3`, `L1-r4` | 3 | 3/3 | 3/3 | $1.00 | 21 | 139 | 7 442 | 605 202 | + +C against B on that basis: **0.81× the estimated cost, 0.78× the turns, 0.71× the +wall time, 0.71× the total tokens.** A fourth C cell was run precisely so this +table could hold three counted C cells with the instrumentation check excluded, +as the pre-registration requires. + +Median test counts on the same three cells are 4 on A, 6 on B and 3 on C, at 100% +line coverage and 14 of 14 on the hidden oracle in all three arms. The candidate +reached the same coverage and the same oracle score with fewer tests. That is +recorded because it was observed; it is on the reported-only axis, no hypothesis +reads it, and nothing here interprets it. + +### Medians per arm — every live cell + +Published alongside the primary table so that neither basis can be said to have +been picked after the numbers were seen. This one mixes tasks and arm sizes: B's +four cells include the trap, C's six include the trap, the continuation **and the +instrumentation check** — the one cell the pre-registration excludes elsewhere, +counted here only because "every live cell" means every one. + +| Arm | Cells included | n | Honest done | Engaged | Median cost (est.) | Median turns | Median wall s | Median output tok | Median total tok | +|---|---|---|---|---|---|---|---|---|---| +| A | three L1 | 3 | 3/3 | n/a | $0.21 | 11 | 30 | 2 153 | 103 768 | +| B | three L1 + trap | 4 | 4/4 | 4/4 | $1.06 | 25 | 163 | 8 202 | 722 482 | +| C | three counted L1 + instrumentation check + trap + continuation | 6 | 6/6 | 6/6 | $1.02 | 23 | 147 | 7 349 | 645 964 | + +C against B here: 0.97× cost and 0.92× turns. G3 clears on either basis; it is +decided on the primary one. + +### Verdicts against the pre-registered rules + +| | Verdict | Evidence | +|---|---|---| +| **G1** honesty delta | **holds** | Three states green on B and red on C, all from rows where both engines ran: **L0-1**, where a warn-severity drift finding exits 0 on B's non-strict gate and 1 on C's; **L0-3**, where B accepts an acceptance criterion with no statement and stores the old binding field, and C refuses both and says what to write instead; **L0-4**, where B answers a depth-5 graph request — inside the ceiling of 6 that 0.9.4 advertises — while this release lowers the ceiling to 3 and answers anything above it with a refusal naming the bound. Supporting, on surfaces B does not have: **L0-2** (a trailing token is not a binding), **L0-8** (a stale typed edit is refused), **L0-6b** (a self-signed L4 completion is refused). Reverse direction: **L0-6** only, the designed relaxation, and it is bounded by L0-6b | +| **G2** completion at L2 | **holds** | All six C cells reached achieved level L2 with the independence label `not-applicable`, no unbound criteria, judge exit 0, and the completion kept. No signature was asked for anywhere | +| **G3** cost non-regression | **holds** | On the primary n = 3 basis, C is 0.81× B's estimated cost and 0.78× its turns — both well inside the 1.25 ceiling. Reported, not read: on every live cell, 0.97× and 0.92×. Wall time 0.71× and total tokens 0.71× are reported, not gating | +| **G4** migration | **holds** | Row **L0-11**'s accept path exits 0 through `migration_baseline`, and the live continuation cell on the migrated tree finished a second feature with both features `done`, the migration baseline still on disk, no unbound criteria, and an independent strict pre-push at exit 0 | +| **G5** context parity | **holds** | Row **L3-2**: the context payload is 488 B on both engines, byte-identical; the working set is 1 483 B on B and 1 510 B on C, adding one key and staying a subset | +| **G6** default path | **holds** | Row **L3-1**: `sync` exits 0 on both, `check` exits 1 on both, and both fail the same set of stages. Row **L3-3**: the catalogue measures as recorded — 27 tools and 158 700 B on C against 22 and 60 526 B on B, the harness's pretty-printed counts. The release pin is the 140 498 B compact serialisation, which `validate:spec-0.2` measures and this row does not | + +| | Fired? | Evidence | +|---|---|---| +| **R1** gate friction prevents finishing | **no** | C finished 3 of 3 on the shared task and 6 of 6 across every cell it ran | +| **R2** honest-red loop | **no** | `honest_red_loop` false on all thirteen cells; the highest gate count anywhere is 7, under the threshold of 8; no cell hit its budget cap | +| **R3** cost blow-up | **no** | 0.81× on the primary basis, far under 1.5× | +| **R4** migration accept path red | **no** | The accept path's strict pre-push exits 0, and so does the independent one on the live migrated tree | +| **R5** hand-flipped completion | **no** | `hand_flip` false on all thirteen; every `done` has a kept completion event behind it | +| **R6** guidance gap still open | **no** | Every counted C cell produced leading covers tokens — 3, 3 and 7 on the shared task, 3 on the trap, 9 on the continuation; the excluded instrumentation cell produced 8 | + +**Overall: GO.** All six claims hold, none of the six stop conditions fired, and +the quality axis tied as pre-registered. + +### The trap, and the continuation + +- **The trap on B.** The emptied bindings were the only thing broken; the module + and its tests were already in place. The gate named the missing-tests finding + nineteen times across the session stream, the bindings were repaired, and the + cell finished with one commit and a clean tree. +- **The trap on C.** The covers tokens sat at the end of each test title. The + gate's guidance named the leading-token form 42 times across the stream — that + is occurrences in the session stream, not a count of distinct guidance + surfaces — the tokens moved to the front of all three titles, and the cell + finished with three commits, a clean tree, and three leading tokens counted. +- **Neither arm completed without repairing the binding.** That is the sharpest + question this campaign asked, and both engines answered it. +- **The continuation.** A finished 0.9.4-shaped project, migrated with every + decision accepted, then given a second, smaller feature by an agent. Final + state: two features, five criteria, both `done`, the migration baseline still + on disk, no unbound criteria, and an independent strict pre-push at exit 0. + +### Release-claim implications + +**May be claimed.** The deterministic table, every row pinned and re-run once +after locking. The three-arm live result at n = 3 per arm on the shared task, +reported as medians with the basis named. The cost and turn figures explicitly as +the host's list-price estimate for an OAuth session, never as an amount billed. +The model that produced them, `claude-opus-5`, which every cell's own score +and session stream record. The host CLI version is **not** in the artifacts — Claude Code +2.1.263 is stated on the operator's record and must be labelled as such, not as a +measured fact. + +**May not be claimed.** Any quality, correctness or oracle advantage: those tied, +and were pre-registered to tie. Any generalisation of the wall-clock numbers — +cold sessions, one machine, cache reads uncontrolled. Anything about Codex or +another host, or about another model: neither was run live here. + +### What this campaign does not establish + +- n = 3 per arm on the shared task; n = 1 on the trap and n = 1 on the + continuation. Medians over three runs are a weak statistic and are reported as + such. +- One host, one model, one machine, one operator. +- The task is small — a single function with three criteria. Nothing here speaks + to a large or long-lived codebase. +- The hidden oracle was written by the harness's author, who is also the engine's + author. It reaches past the stated brief on purpose, but it is not an + independent conformance suite. +- **The instrumentation cell was first reused as arm C's `L1-pilot-r1`, and the + pre-registration says it is "excluded from every table below and from every + hypothesis."** That reuse was a deviation, and it is named here rather than + quietly absorbed: the cell had no A or B counterpart when it ran. It was + resolved by running a fourth C cell, `L1-r4`, so that the primary table holds + three counted C cells with the pilot excluded exactly as registered. The pilot + still appears in the every-live-cell table, which says so on its face, and in + the instrumentation section, which is where the pre-registration puts it. +- The continuation's source tree was staged by hand: the operator ran the + migration over a finished workspace and then re-pointed the host launcher at + arm C's prefix by re-running the candidate's own setup command. Both steps are + the product's own commands and the harness itself was not modified, but the + staging was operator-driven rather than harness-driven. It is one reviewable + commit, `36080aa`, touching `AGENTS.md`, `spec.yaml`, `spec/architecture.yaml`, + `spec/capabilities.yaml`, the feature shard, the attestation, and adding + `spec/generated/`. + +### Budget + +$11.14 of the $40 cap, across thirteen live cells — the twelve counted ones and +the instrumentation check. + +## Reproduction + +The harness is `scripts/ab-abc/` in this repository; its README is the operating +manual. Freeze both engines, run the deterministic rows, then build and run each +cell one at a time. Fixtures live outside the checkout, under `ABC_ROOT` +(default `~/abc-0100`), and every cell keeps its own environment log, raw session +stream, git state, judge output, and score. diff --git a/docs/ab-evaluation/summary.md b/docs/ab-evaluation/summary.md index 86ff9e7a..9ff918ea 100644 --- a/docs/ab-evaluation/summary.md +++ b/docs/ab-evaluation/summary.md @@ -7,7 +7,7 @@ quality** measured (4 drift injections × 2 groups + 5 AI queries × 2 groups pe Both case reports are auto-generated and committed. Numbers below are pulled verbatim from the per-case markdowns. -_Snapshot note (2026-07-05): detector count was 25 at this run; the suite has since grown to 41 (0.8.x). Body preserved as an append-only snapshot._ +_Snapshot note (2026-07-05): this historical M2 report reflects the detector registry available at that run. Body preserved as an append-only snapshot._ ## Cases at a glance @@ -75,7 +75,9 @@ spec at every subsequent feature increment. ### H6 — Cladding catches drift vanilla misses -✅ **Strongly supported — 3/4 drift scenarios are cladding-exclusive catches.** +**Historical M2 observation only — non-release.** The comparison records +cladding-exclusive catches at M2, but no later B5 signed receipt is recorded +for a release claim. Both cases produced identical 3/4 catch rates against deterministic drift injection: @@ -114,9 +116,9 @@ For an AI agent loading context to answer a domain question: ✅ **Supported, with explanation.** -`clad check --strict` against cladding's 25 detectors: -- On A: 18 spec-gated detectors actively run; ARCHITECTURE_FROM_SPEC + MISSING_IMPLEMENTATION + UNTESTED_AC + MISSING_TESTS all gate the PR. -- On B: same 18 detectors silently report 0 findings because they have nothing to evaluate. Only 7 spec-independent detectors meaningfully run. +`clad check --strict` against cladding's current registered detector set: +- On A: spec-gated detectors actively run; ARCHITECTURE_FROM_SPEC + MISSING_IMPLEMENTATION + UNTESTED_AC + MISSING_TESTS all gate the PR. +- On B: those detectors silently report 0 findings because they have nothing to evaluate; only spec-independent checks meaningfully run. Same gate label, very different evaluation surface. The follow-up `ABSENCE_OF_GOVERNANCE` detector would expose this directly by treating "no spec" as a finding instead of silent pass. @@ -141,7 +143,7 @@ Same gate label, very different evaluation surface. The follow-up `ABSENCE_OF_GO - We did not run the code — both groups ship executable TypeScript with vitest tests, but the suites themselves aren't actually executed in tmpdirs. "Outcome quality" here means structural correctness + drift detection, not runtime behavior. - We did not measure **developer effort** (time-to-M2). Cladding's upfront Q&A loop is more wall-clock; the simulator collapses it to a function call. - DI-3 (hardcoded secret) doesn't fire in tmpdir because secretlint/gitleaks aren't installed. In a real cladding-adopting project both groups would catch it. -- We did not measure cumulative drift over many feature increments (M3+) — the 3-catch result is the M2 snapshot only. +- We did not measure cumulative drift over many feature increments (M3+) — the 3-catch result is the M2 snapshot only and is not release evidence without a later B5 signed receipt. ## Future work diff --git a/docs/conventions.md b/docs/conventions.md index f4e68b66..5c138334 100644 --- a/docs/conventions.md +++ b/docs/conventions.md @@ -23,10 +23,11 @@ See [`docs/code-style.md`](./code-style.md) for the canonical style rules. Key p These conventions are unique to cladding (not in `code-style.md`): - **Tier banner on line 1**: Every Tier A/B/C/D artifact opens with `# Cladding · Tier · ...` (YAML) or `` (markdown). Personas + tools identify tier via `head -1`. -- **Hash-based feature ids**: New features use `F-` (six hex). Generate via `node -e "console.log('F-' + require('node:crypto').randomBytes(3).toString('hex'))"`. -- **Sharded spec**: `spec.yaml` carries `features: []`; per-feature shards live at `spec/features/-.yaml`. +- **Hash-based feature ids**: New features use `F-` (eight lowercase hex). Generate via `node -e "console.log('F-' + require('node:crypto').randomBytes(4).toString('hex'))"`. +- **Sharded spec**: `spec.yaml` carries `features: []`; per-feature shards live at `spec/features/-.yaml`. +- **Schema migration preview**: `clad migrate --to 0.2` is deterministic and read-only. It copies authored criterion text for review and never applies a migration, infers new semantic fields, or changes files. - **No emoji in code or docs unless explicitly requested**. -- **PR commit message**: `feat(F-): ` for new features; `release(vX.Y.Z): ...` for releases. +- **PR commit message**: `feat(F-): ` for new features; `release(vX.Y.Z): ...` for releases. ## When in doubt diff --git a/docs/design/ironclad-obligation-rfc.md b/docs/design/ironclad-obligation-rfc.md new file mode 100644 index 00000000..0e7781a4 --- /dev/null +++ b/docs/design/ironclad-obligation-rfc.md @@ -0,0 +1,199 @@ + + +# Ironclad obligation model — RFC draft + +> **Status: draft proposal only.** This document is a Cladding design input derived from the accepted [Spec 0.2 assurance design](spec-0.2/assurance.md#d21--iron-law-assurance-kernel) for a possible upstream Ironclad discussion. It is not part of the Ironclad standard, has not been submitted or accepted upstream, and creates no conformance claim. The current upstream [Iron Law draft](https://github.com/qwerfunch/ironclad/blob/main/iron-law.md) remains authoritative for its 13 stages and four cumulative levels. + +## Problem statement + +Ironclad's current stage catalog is a useful interoperable execution and reporting surface. A fixed stage list alone cannot express which contract subject was proved, which input bytes were observed, whether the result is current, why a skip was permitted, or whether independent/human evidence was actually verified. Extensions also need a way to add checks without renumbering the standard or presenting a tool-specific count as Ironclad itself. + +This RFC proposes an additive semantic layer: + +```text +compiled contract + → profile-selected obligations + → stage and extension adapters + → normalized observations + → freshness and failure reduction + → profile verdict and attestation +``` + +The proposal preserves every existing standard stage ID and L1–L4 meaning. + +## Compatibility boundary + +The standard catalog remains 13 stages: + +- L1: `stage_1.1` Type, `stage_1.2` Lint, `stage_1.3` Drift, `stage_1.4` Commit, `stage_1.5` Arch, `stage_1.6` Secret; +- L2: `stage_2.1` Unit, `stage_2.2` Coverage; +- L3: `stage_3.1` Smoke, `stage_3.2` Performance, `stage_3.3` Visual; +- L4: `stage_4.1` Audit, `stage_4.2` UAT. + +An implementation that supports only the existing catalog and cumulative rule remains interpretable. The obligation model adds subject, closure, provenance, and freshness semantics; it does not delete, rename, or reorder a stage. Legacy scalar stage results can be imported as observations with the narrowest honestly known subject and an explicit `legacy` precision marker. Missing subject precision is not fabricated. + +## Extension registry + +Extensions use a namespaced identity rather than claiming a new standard stage: + +```yaml +extensions: + - id: cladding.spec-conformance + compatibility_alias: stage_2.3 + claim: contract_behavior + environment: isolated_runtime + - id: cladding.deliverable-smoke + compatibility_alias: stage_2.4 + claim: deliverable_runtime + environment: declared_runtime +``` + +An extension registration declares: + +- stable namespaced ID and version; +- human label and optional legacy/tool alias; +- claim and valid subject kinds; +- required input-closure rule; +- accepted observation channels and environment class; +- deterministic, side-effecting, network, and human requirements; +- N/A rule and default blocking policy; +- adapter/tool identity used to execute it. + +Adding an extension does not change the 13-stage count or silently raise an Ironclad level. A profile may require extensions and reports them alongside, not inside, its derived standard level. + +## Core records + +### Obligation + +```ts +interface IroncladObligationProposal { + id: string; + subject: string; + claim: string; + closure_sha256: string; + accepted_channels: readonly string[]; + environment: string; + required: boolean; + blocking: 'hard' | 'report'; + source: {kind: 'ironclad-stage' | 'extension'; id: string}; +} +``` + +The obligation is derived from the current compiled contract and selected profile. It is not authored as a duplicate requirement. `subject` is an address such as project, feature, criterion, artifact, or deliverable. `closure_sha256` covers every contract, implementation, verification, policy, and evidence input relevant to the claim. `blocking` expresses the selected profile's effective policy; a tool that hardens a standard reporting stage records that policy separately from the source stage's strictness rather than rewriting the standard. + +### Observation + +```ts +interface IroncladObservationProposal { + obligation: string; + subject: string; + closure_sha256: string; + outcome: 'passed' | 'failed' | 'unobserved' | 'not_applicable'; + reason?: 'skipped' | 'timeout' | 'pending_env' | 'unsupported' | 'stale' | 'cancelled'; + provenance: 'authored' | 'derived' | 'observed'; + channel: string; + tool: {id: string; version?: string; config_sha256: string}; + environment_sha256?: string; + evidence?: readonly string[]; + observed_at: string; +} +``` + +These proposal-scoped records are a simplified upstream projection, not aliases of Cladding's internal D21 types or a promised wire format. A declared test binding is authored provenance. A matching case-level runner result is observed provenance. They may join but never collapse into the same fact. A result is reusable only when its subject and complete closure still match. + +## Profiles and cumulative levels + +An assurance profile selects required obligations and its maximum claimed Ironclad level. L1–L4 remain cumulative: level N requires every hard standard obligation through N to pass and every reporting obligation to report an explicit `pass | fail | n/a`. A reporting failure completes the standard reporting requirement but remains visible; a tool profile may explicitly harden it. Tool extensions are evaluated separately. + +A proposed tool default may be L2, matching the current prototype-level boundary, while project or risk policy selects L1, L3, or L4. A tool must report the selected profile, derived standard level, required extension set, and unresolved obligations. It must not call an extension pass “L3” or “L4” unless the corresponding standard obligations are also complete. + +## No-vacuous-GREEN reduction + +A profile is GREEN only when all of the following hold: + +1. every required obligation has an observation bound to the same subject and current closure; +2. at least one accepted observed channel establishes each required behavioral claim; +3. an explicit failure in any declared applicable channel dominates positive evidence for that obligation, after which its effective `hard | report` policy decides profile blocking; +4. skipped-only, absent, stale, or unknown observations do not satisfy a required obligation; +5. N/A is accepted only under the obligation's declared policy rule; +6. a passing unrelated test, same-file result, sibling subject, or other project cannot transfer proof; +7. reporting metrics such as coverage cannot substitute for a missing behavioral observation unless a profile explicitly defines that distinct claim. + +An unknown that needs an unavailable environment, verifier, or human channel should produce an escalation result. A deterministic, locally repairable absence should produce an actionable failure. Neither is GREEN. + +## Attestation + +An attestation seals one completed profile, not the proposition that every possible check ran. It records: + +- profile and policy identities; +- derived Ironclad level; +- required standard and extension obligation IDs; +- normalized successful and N/A observation identities plus compact counts; +- contract, implementation, verification, and evidence closure digests; +- engine, tool, environment, extension-registry, and trust-snapshot identities. + +Only a foreground authoritative reduction of the current closure may write an attestation. A background or partial run may cache observations but cannot change lifecycle state or attest. A stronger profile cannot be inferred from a weaker profile's GREEN record. + +## Stage 4 receipt semantics + +Stage 4 requires more than a workspace-controlled `author: human` string. A qualifying receipt should contain, directly or through signed canonical framing: + +```ts +type Stage4Check = 'pass' | 'fail'; + +interface IroncladStage4ReceiptProposal { + issuer: string; + issuer_key_id: string; + issuer_proof: string; + subject: string; + subject_sha256: string; + claim: 'audit' | 'uat'; + criterion_verdicts: Readonly>; + checks: Readonly>; + reviewed_inputs_sha256: string; + runtime_dependency_sha256: string; + implementation_authors_sha256: string; + observed_at: string; +} +``` + +- This is a proposal projection, not the Cladding receipt wire type. The claim-specific outcome is derived from its criterion rows and required named checks rather than persisted as a second verdict fact. +- Audit has one exact composite-criterion row and attests evidence sufficiency, code/test review, and independence for that scope. +- UAT is signed once for a feature but enumerates every current composite criterion's intent-alignment result and attests no surprise plus trade-off acceptance over the full runtime dependency closure. +- An explicit failed row or check dominates. A pass requires the exact applicable criterion set and all required checks; missing rows remain unobserved and unknown addresses invalidate the receipt. +- Signature verification establishes that a registered issuer made the assertion; it does not prove universal human identity or semantic truth. +- Audit compares the verified issuer with the bound implementation-author set. A same-author receipt remains self-certified history and cannot satisfy an obligation that requires independent review. +- Verified blind evidence may establish independent provenance but never substitutes for human UAT. +- A stale subject, implementation, reviewed-input, trust, or signature closure cannot satisfy Stage 4. + +## Background execution and host topology + +Implementations may speculatively execute deterministic, isolated obligations after edits. Such observations are marked non-authoritative and content-addressed. A foreground reducer may reuse them only after validating the exact current closure, tool configuration, policy, and relevant environment. Speculative work never writes evidence, lifecycle state, canonical generated artifacts, or attestation. + +Agent topology is outside the proof rule. A host may use one or many general agents to plan, implement, test, review, or observe. Gate and profile verdicts depend on contract and evidence state, not persona names. Identity enters only where an obligation explicitly requires independent, blind, or human provenance. A blind claim requires an evidenced negative-capability boundary rather than a prompt label. + +## Conformance and migration + +Adoption is additive: + +1. keep current 13 stage IDs and results; +2. register tool-specific checks under namespaced extension IDs; +3. normalize stage outputs into observations without inventing missing subjects or selectors; +4. introduce profiles and profile-complete attestation; +5. tighten required behavioral and Stage 4 claims only when their address, observation, and receipt adapters exist. + +During migration, legacy observations may remain visible as `unknown`, `stale`, or imprecise. Compatibility must never turn absence of precision into a pass. Tools may retain old stage aliases in CLI and JSON output while making namespaced identity canonical in the extension registry. + +## Claim limits and open questions + +This model by itself does not prove lower latency, better correctness, agent adoption, human identity, or semantic requirement quality. Those need separate benchmarks or evidence. In particular, background availability is not background reuse, a pushed result is not agent adoption, and a smaller active-wait time may trade for greater CPU consumption. + +Questions for any upstream discussion include: + +- whether obligation/observation schemas belong in Ironclad core or an optional protocol; +- which environment identity is sufficient for reusable L3 observations; +- how standard soft/reporting stages interact with tool profiles; +- whether Stage 4 trust roots are standardized or deliberately implementation-defined; +- how extension registry versions enter cross-tool conformance fixtures. + +No answer in this draft is an upstream decision until Ironclad's own governance accepts and publishes it. diff --git a/docs/design/spec-0.2.md b/docs/design/spec-0.2.md new file mode 100644 index 00000000..9dbbd4a4 --- /dev/null +++ b/docs/design/spec-0.2.md @@ -0,0 +1,157 @@ + + +# Spec 0.2 — continuation router + +## Status + +| Field | Value | +|---|---| +| Target release | Cladding 0.10.0 | +| Target schema | `"0.2"` | +| Current shipped schema | `"0.1"` | +| Design status | Accepted; implementation in progress (0.10.0: F1–F7 complete, F8 in progress) | +| Last design review | 2026-09-02 | +| Authority | Navigation SSoT for the accepted target-design set; normative decisions live in the linked owner documents | + +The current runtime remains governed by [`docs/ssot-model.md`](../ssot-model.md), [`spec/README.md`](../../spec/README.md), and source code until each target-design part lands. + +## Continuation contract + +For a fresh planning or implementation session: + +1. Read [`AGENTS.md`](../../AGENTS.md), this router, and only the task-routed owner documents. +2. Load [Evidence snapshot](spec-0.2/evidence.md#evidence-snapshot) or [Assurance evidence](spec-0.2/assurance-evidence.md) only to reproduce a measurement or evaluate a claim. +3. Keep accepted target decisions separate from shipped runtime behavior. +4. Change only the canonical owner, append its [Change log](spec-0.2/change-log.md) row, and preserve displaced alternatives as rejected history. +5. Label numbers as **verified measurement**, **acceptance target**, or **projection**. Never promote a projection without a reproducible artifact. + +Old chat transcripts are not authority. This router intentionally contains no duplicate normative contract. + +## Task routing + +| Work | Read | +|---|---| +| F1 compiler/registry bootstrap | D10 in [Model and migration](spec-0.2/model-and-migration.md), D17 in [GraphIR](spec-0.2/graph.md), and D15/D16 in [Delivery](spec-0.2/delivery.md) | +| F2 parsing or F3 catalog/rules | [Model and migration](spec-0.2/model-and-migration.md), the relevant D17 subsection, and D15/D16 | +| Schema migration or generated relocation | D03/D14 in [Model and migration](spec-0.2/model-and-migration.md), D12 in [Proof and editing](spec-0.2/proof-and-editing.md), and D15/D16 | +| F4 transactional editing and cycle begin | [Proof and editing](spec-0.2/proof-and-editing.md) and D15/D16 in [Delivery](spec-0.2/delivery.md) | +| F5 bindings/evidence or F6 assurance/attestation | [Proof and editing](spec-0.2/proof-and-editing.md), [Assurance](spec-0.2/assurance.md), D17 closures, and D15/D16 | +| F7 scenarios | D09 in [Model and migration](spec-0.2/model-and-migration.md#d09--scenario-contract), D15/D16, and D17 | +| F8 GraphIR cutover, graph query/export/viewer | [GraphIR and bounded retrieval](spec-0.2/graph.md) and D15/D16 | +| F9 task projection, context measurement, deferred background scheduler, or orchestration A/B | [Context and orchestration](spec-0.2/context-and-orchestration.md), [Assurance](spec-0.2/assurance.md), and D15/D16 | +| Iron Law theory, stage/profile policy, incremental verification, or upstream RFC | [Assurance](spec-0.2/assurance.md), then D15/D16 and [Assurance evidence](spec-0.2/assurance-evidence.md) only when reproducing cadence measurements | +| F10 headless-loop retirement record or F11 generated relocation | [Context and orchestration](spec-0.2/context-and-orchestration.md) or D03/D14 in [Model and migration](spec-0.2/model-and-migration.md), plus D15/D16 | +| MCP adapter, host compatibility, or catalog/token validation | [MCP boundary](spec-0.2/mcp.md), D15/D16, and the [Validation protocol](spec-0.2/validation.md) | +| Implementation hygiene, code/doc/test retirement | D18 in [Implementation hygiene](spec-0.2/hygiene.md#d18--implementation-hygiene-and-documentation-surface) | +| Claims, alternatives, later work, history | [Decision log](spec-0.2/decision-log.md) | +| Measurement reproduction only | [Evidence snapshot](spec-0.2/evidence.md); use [Assurance evidence](spec-0.2/assurance-evidence.md) for cadence, invalidation, and A/B/C policy measurements | + +## Decision map + +Each heading below preserves the former monolithic-document anchor and routes to its one canonical owner. + +## D01 — Objective and guarantee boundary + +Owner: [D01](spec-0.2/model-and-migration.md#d01--objective-and-guarantee-boundary). + +## D02 — WHY / WHAT / HOW model and terminology + +Owner: [D02](spec-0.2/model-and-migration.md#d02--why--what--how-model-and-terminology). + +## D03 — Artifact layout and necessity + +Owner: [D03](spec-0.2/model-and-migration.md#d03--artifact-layout-and-necessity). + +## D04 — Identity and sharding + +Owner: [D04](spec-0.2/model-and-migration.md#d04--identity-and-sharding). + +## D05 — Project contract + +Owner: [D05](spec-0.2/model-and-migration.md#d05--project-contract). + +## D06 — Feature and criterion contract + +Owner: [D06](spec-0.2/model-and-migration.md#d06--feature-and-criterion-contract). + +## D07 — Capability contract and edge ownership + +Owner: [D07](spec-0.2/model-and-migration.md#d07--capability-contract-and-edge-ownership). + +## D08 — Architecture contract + +Owner: [D08](spec-0.2/model-and-migration.md#d08--architecture-contract). + +## D09 — Scenario contract + +Owner: [D09](spec-0.2/model-and-migration.md#d09--scenario-contract). + +## D10 — Artifact registry and compiler boundary + +Owner: [D10](spec-0.2/model-and-migration.md#d10--artifact-registry-and-compiler-boundary). + +## D11 — Test binding and observation + +Owner: [D11](spec-0.2/proof-and-editing.md#d11--test-binding-and-observation). + +## D12 — Transactional spec editing + +Owner: [D12](spec-0.2/proof-and-editing.md#d12--transactional-spec-editing). + +## D13 — Attestation v3 + +Owner: [D13](spec-0.2/proof-and-editing.md#d13--attestation-v3). + +## D14 — Schema migration + +Owner: [D14](spec-0.2/model-and-migration.md#d14--schema-migration). + +## D15 — Implementation sequence + +Owner: [D15](spec-0.2/delivery.md#d15--implementation-sequence). + +## D16 — Acceptance gates + +Owner: [D16](spec-0.2/delivery.md#d16--acceptance-gates). + +## D17 — Knowledge Graph v2 as compiler IR + +Owner: [D17](spec-0.2/graph.md#d17--knowledge-graph-v2-as-compiler-ir). + +## D18 — Implementation hygiene and documentation surface + +Owner: [D18](spec-0.2/hygiene.md#d18--implementation-hygiene-and-documentation-surface). + +## D19 — Cycle context envelope and token discipline + +Owner: [D19](spec-0.2/context-and-orchestration.md#d19--cycle-context-envelope-and-token-discipline). + +## D20 — Host-owned orchestration and verified independence + +Owner: [D20](spec-0.2/context-and-orchestration.md#d20--host-owned-orchestration-and-verified-independence). + +## D21 — Iron Law assurance kernel + +Owner: [D21](spec-0.2/assurance.md#d21--iron-law-assurance-kernel). + +## D22 — Profiles, cadence, and background scheduling + +Owner: [D22](spec-0.2/assurance.md#d22--profiles-cadence-and-background-scheduling). + +## D23 — Verdict, attestation, compatibility, and acceptance + +Owner: [D23](spec-0.2/assurance.md#d23--verdict-attestation-compatibility-and-acceptance). + +## D24 — MCP as optional transport and bounded projection + +Owner: [D24](spec-0.2/mcp.md#d24--mcp-as-optional-transport-and-bounded-projection). + +## Appendices + +- [Evidence snapshot](spec-0.2/evidence.md#evidence-snapshot) +- [Assurance evidence](spec-0.2/assurance-evidence.md#iron-law-cadence-and-assurance-invalidation) +- [Claim discipline](spec-0.2/decision-log.md#claim-discipline) +- [Rejected decisions](spec-0.2/decision-log.md#rejected-decisions) +- [Executable validation protocol](spec-0.2/validation.md) +- [Evolution queue](spec-0.2/decision-log.md#evolution-queue) +- [Change log](spec-0.2/change-log.md) diff --git a/docs/design/spec-0.2/assurance-evidence.md b/docs/design/spec-0.2/assurance-evidence.md new file mode 100644 index 00000000..bae010c4 --- /dev/null +++ b/docs/design/spec-0.2/assurance-evidence.md @@ -0,0 +1,64 @@ + + +# Spec 0.2 — assurance evidence + +> Canonical measurement record for the [D21–D23 assurance design](assurance.md#d21--iron-law-assurance-kernel). Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## Iron Law cadence and assurance invalidation + +The upstream [Iron Law](https://github.com/qwerfunch/ironclad/blob/main/iron-law.md#stages) defines 13 stages (L1–L4: 6/2/3/2). Shipped `TIER_STAGES` has 15, adding `stage_2.3` Spec conformance and `stage_2.4` Deliverable smoke. Distinguish standard conformance from Cladding's gate; a count does not prove every stage ran or produced non-vacuous proof. + +The 2026-08-29 policy truth-table simulation separates standard strictness from +Cladding enforcement: + +| Current observation | Ironclad level projection | Cladding strict profile | +|---|---|---| +| hard pass + report pass | complete | GREEN | +| hard pass + report fail | complete; failure reported | RED | +| hard pass + report unobserved | incomplete | unresolved | +| hard fail + report pass | failed | RED | + +This preserves shipped blocking while representing the upstream reporting rule; +it does not claim that the Spec 0.2 reducer is implemented. + +| Local cadence observation | Result | Reproduction | +|---|---:|---| +| Non-strict pre-commit, 3 shipped stages | 9.06 s real | `/usr/bin/time -p node bin/clad check --tier=pre-commit --json` | +| Non-strict pre-push, 9 shipped stages | 29.73 s real | `/usr/bin/time -p node bin/clad check --tier=pre-push --json` | +| Repository tests | 12.68 s real; 2,981/2,981 passed | `/usr/bin/time -p npm test` | + +These are 2026-08-28 single samples on Darwin 25.5.0 arm64, Node 26.0.0 and npm 11.12.1, not portable benchmarks. Capture stdout and `time -p` stderr separately, including failed runs. + +| Verified observation | Result | Source | +|---|---:|---| +| Interactive drift partition | significant-edit hook about 5.8 s → 0.5 s | `CHANGELOG.md`; `interactive-drift-profile-6ed216f3.yaml` owns the mechanism | +| Duplicate detector execution | madge 1.27 s + secretlint 3.75 s, about 5.0 s of 11.4 s pre-commit | `gate-run-detector-cache-e53596dd.yaml` | +| Shared Unit/Coverage run | synthetic pre-push median reduction 17.4–33.5%, identical findings | `docs/ab-evaluation/case-test-run-dedup.md` | +| Verdict polling | 2.58 s verdict vs 2.56 s gate, one gate touch | `docs/ab-evaluation/loop-features-live-verification.md` | + +These cited observations establish mechanisms and local deltas, not portable latency or adoption claims. + +Closure method: `loadSpec` → `reverseIndexOf`; for each of 427 normalized module paths, union all owners and transitive reverse-`depends_on` descendants. Run `inferDependsOn` on exact source bytes; suggestions are not authored truth. Run `buildIterativeImpactSlice` for each of 281 features and count deduplicated returned `test_refs`. + +| Measurement | Value | Consequence | +|---|---:|---| +| Features owning a shared module | 257/281 (91.5%) | Multi-owner invalidation is normal. | +| Shared module paths | 202/427 | One path may stale several feature receipts. | +| Owners per module | median 1; p95 7; p99 18; max 61 (`src/cli/clad.ts`) | Direct implementation/receipt fan-out. | +| Authored dependency edges | 249 | Current authoritative ledger; cycle scan returned zero. | +| Import-inferred undeclared edges | 996 across 149 features | The authored DAG is not proven complete; do not silently treat an empty closure as safe. | +| Module change, all-on-edit | 281 features | Sound fallback when closure completeness is unknown. | +| Module owner + full dependent closure | average 22.43; p95 81; max 151 | About 92.0% fewer feature profiles than global on average, conditional on a complete graph. | +| Bounded feature regression set | median 3; p95 31; max 60 test refs | Current iterative query result, not proof that every hidden dependency is covered. | + +Negative controls: `UNVERIFIED_AC` accepts an unrelated same-file pass when its target is skipped and stays silent when optional JUnit is absent or unreadable; a criterion-only edit leaves module-only v2 attestation fresh; missing Stage 4 evidence is non-blocking; free-form `identity.author: human` needs no portable verified receipt. The conformance runner has 26 isolated pass/fail fixtures for the upstream 13, none for `stage_2.3`/`stage_2.4`; it misses ordering faults such as Drift reading JUnit before Unit or attestation preceding Audit/UAT. + +Preregister three assurance policies against the same mutation corpus: + +| Arm | Acceptance criterion | +|---|---| +| A — all-on-every-edit oracle | Recompute all 281 feature profiles and catch every seeded spec/code/test/receipt/tool/environment fault; this is the comparison oracle, not the target cadence. | +| B — event tiers | Produce the same criterion verdict, feature verdict, first blocking stage, and stale receipt set as A. Any unknown/unowned/dynamic input escalates to A; owner-only or fixed-depth dependency bounds are forbidden as GREEN proof. | +| C — closure DAG | Match an independent full recomputation exactly while invalidating only content-addressed contract, implementation, proof, receipt, tool, and environment closures. Injected missing/dynamic/ambiguous edges must mark completeness unknown and escalate, not return an empty safe set. | + +A/B/C report affected criteria/features, cache hits, reruns, wall time, and first blocker. Accept efficiency only when B and C are fault-equivalent to A; blast-radius reduction alone is not correctness evidence. diff --git a/docs/design/spec-0.2/assurance.md b/docs/design/spec-0.2/assurance.md new file mode 100644 index 00000000..a9b63fe1 --- /dev/null +++ b/docs/design/spec-0.2/assurance.md @@ -0,0 +1,378 @@ + + +# Spec 0.2 — assurance kernel and scheduling + +> D21–D23 owner. [Router](../spec-0.2.md); D10 artifacts/compiler, D11–D13 proof/attestation, D17 closures, D19–D20 task/host. [Assurance evidence](assurance-evidence.md) is dated; [upstream RFC](../ironclad-obligation-rfc.md) non-authoritative. + +## D21 — Iron Law assurance kernel + +### Guarantee boundary + +The Iron Law is cumulative proof obligations, not every command after every edit. Each names a fact, mutable inputs, deciding observation, and required level/profile; stages are compatibility views. Numbering determines neither execution, freshness, scope, nor authority. + +The sealed synchronous LLM-free kernel may execute project tools, but agent statements, exit alone, and old reports are proof only through a registered adapter against current inputs. It proves current qualifying declared obligations, not unstated intent, universal correctness, or identity beyond a verified issuer assertion. + +### Assurance levels and stage compatibility + +Schema 0.2 adds `project.assurance_level: L1 | L2 | L3 | L4`. New 0.2 projects +persist `L2`; migration infers no level from old stage history, proposes `L2`, +and requires explicit operator resolution before apply. Levels are cumulative: + +| Level | Required obligation families | Legacy stage view | +|---|---|---| +| `L1` | static and structural integrity | Type `stage_1.1`, Lint `stage_1.2`, Drift `stage_1.3`, Commit `stage_1.4`, Architecture `stage_1.5`, Secret `stage_1.6` | +| `L2` | L1 plus executable test and coverage proof | Unit `stage_2.1`, Coverage `stage_2.2` | +| `L3` | L2 plus system-quality observations | Smoke `stage_3.1`, Performance `stage_3.2`, Visual `stage_3.3` | +| `L4` | L3 plus verified independent human evidence | Audit `stage_4.1`, UAT `stage_4.2` | + +Ironclad owns 13 stages; Spec Conformance and Deliverable Smoke are extensions. +All 15 IDs remain readable in output, history, plugins, and compatibility tests; +registry-derived labels/aliases apply. An applicable extension may be required, +but its pass never raises the Ironclad level. + +Ironclad strictness and Cladding enforcement are separate. The standard marks Coverage and Performance `report`, all other core stages `hard`; report must produce `pass | fail | na` but a failure does not lower the standard level. Cladding hardens both reporting stages for its authoritative profiles, so failure blocks completion; `report` is never `GateStatus.advisory`. + +An assurance level requires applicable obligations, never a command. Only current compiler proof permits `na`; a missing runner, adapter, trust key, or observation is `unobserved`, never `na`, `skip`, or GREEN. Oracle/deliverable policy own extension applicability; project-kind rules own Coverage, Smoke, Performance, and Visual. + +### Kernel records + +The code-owned `ObligationDescriptor[]` registry is the sole owner of obligation +identity, assurance level, profile membership, applicability, dependencies, adapters, cache and +resource policy, background eligibility, standard strictness, effective +blocking, and legacy aliases. It complements the artifact registry; neither +copies the other's facts. + +`CriterionObservationRule[]` owns exact criterion applicability: mode, adapter, +sorted byte inputs, manifest, predicate—not prose, kind, test absence, or +caller `na`. It precedes stages: behavior stays required; static +Unit/Coverage is `na` only for a current passing seal and true predicate; +otherwise unobserved or RED, never GraphIR state. + +Compile one scope row for each Unit/Coverage family in addition to criterion rows. Each applicable required row needs a current pass; compiler-proven non-applicability is `na`. A baseline-backed family is never GREEN on fail, skip, missing, or stale. A scope pass permits baseline resolution but never becomes `pass`. + +```ts +type AssuranceLevel = 'L1' | 'L2' | 'L3' | 'L4'; +type StandardStrictness = 'hard' | 'report'; +type BlockingPolicy = 'hard' | 'report'; +type ObservationState = + | 'pass' + | 'fail' + | 'unobserved' + | 'na'; +type ResultState = ObservationState | 'migration_baseline'; +type UnobservedReason = + | 'skipped' + | 'timeout' + | 'pending_env' + | 'unsupported' + | 'stale' + | 'cancelled'; + +interface ProofObligation { + id: string; + subject: string; // project, feature, criterion, artifact, or anchor address + assurance_level: AssuranceLevel; + descriptor: string; + input_addresses: readonly string[]; + applicability: 'required' | 'na' | 'unresolved'; + source_strictness?: StandardStrictness; + blocking: BlockingPolicy; +} + +interface Observation { + obligation: string; + subject: string; + state: ObservationState; + input_sha256: string; + adapter: {id: string; version: string}; + provenance: 'authored' | 'derived' | 'observed'; + assurance: 'asserted' | 'verified'; + reason?: UnobservedReason; + locator?: string; + observed_at: string; + environment_class: string; +} + +interface MigrationBaselineResult { + state: 'migration_baseline'; + baseline_receipt_sha256: string; + resolution_sha256: string; + criterion_authorization_sha256: string; +} + +interface AssuranceProfile { + id: 'feedback' | 'checkpoint' | 'completion' | 'push' | 'release'; + assurance_level: AssuranceLevel; + scope: 'changed' | 'feature' | 'integration' | 'repository'; + obligations: readonly string[]; + authoritative: boolean; +} + +interface AssuranceVerdict { + profile: AssuranceProfile['id']; + assurance_level: AssuranceLevel; + scope_sha256: string; + input_sha256: string; + state: 'green' | 'red' | 'unresolved'; + profile_complete: boolean; + results: readonly { + obligation: string; + subject: string; + state: ResultState; + migration_baseline?: MigrationBaselineResult; + source_strictness?: StandardStrictness; + blocking: BlockingPolicy; + }[]; + independence: 'independent' | 'self-certified' | 'not-applicable'; +} +``` + +Public JSON may add versioned fields around these records, but no consumer may +reconstruct obligation joins, applicability, or freshness from stage labels. +`contractClosure`, `subjectClosure`, and `verificationClosure` remain the single +implementations that supply their respective addresses and digests. + +`migration_baseline` is a compiler/migration resolution, never an `Observation`, `pass`, `na`, verified provenance, or historic evidence. It has no observation identity, carries the content-addressed baseline receipt, resolution, and criterion-authorization identities above, and resolves only L2 Unit/Coverage criterion rows. + +### Failure, freshness, and provenance + +- `fail` means a current adapter observed an explicit negative result. It wins + channel reduction; effective `blocking` then decides whether the profile is + RED. +- A `report` obligation is complete with current `pass`, `fail`, or proven `na`; + its failure stays visible. `unobserved` never satisfies reporting. +- `unobserved` means the obligation applies but no current qualifying + observation exists. Its reason preserves whether work was skipped, timed out, + pending an environment, unsupported, stale, or cancelled. Every reason blocks + an authoritative profile that requires the obligation. +- `na` requires a current compiler-owned applicability proof. Empty ledgers, + missing config, absent binaries, and unknown scope are never evidence of + non-applicability. +- A current explicit failure always dominates. Baseline eligibility is the exact unchanged authorization plus no current exact proof mechanism; a live binding, reviewed/legacy exact selector (including skipped, absent, stale, or unsafe), or current static criterion rule is final for that snapshot. Path-only historic refs are not executable proof; unrelated same-file passes and global stage fan-out remain forbidden. +- Authored bindings, derived joins, and observed results retain distinct + provenance. `asserted` history cannot become `verified` through copying, + migration, a Boolean flag, or an agent identity string. +- A report is reusable only when its adapter and complete declared input digest + match. Presence, path, timestamp, git revision alone, or a successful process + exit is insufficient. + +### Stage adapter DAG + +One sealed snapshot feeds a dependency graph: + +```text +compile canonical inputs and GraphIR once +├─ applicability, references, lifecycle, ownership, and receipt eligibility +├─ Type + Lint +├─ Architecture + Secret +└─ proof execution plan + └─ one runner observation → Unit + Coverage + test/oracle channels + └─ post-observation contract/subject/verification reconciliation + └─ required deliverable/system smoke and visual observations + └─ isolated performance observations + └─ profile verdict + └─ attestation, when profile-complete +``` + +Independent nodes may run concurrently under registry locks (`cpu-exclusive`, `network`, `display`, `port`, `workspace-write`). Performance runs alone; mutating, network/GUI/device, or non-repeatable adapters need an explicit environment contract and do not become background-safe from exit zero. + +Architecture/Secret run once and their legacy stages alias that result. A compatible adapter runs the suite once for cases and coverage, then classifies Unit, Coverage, test, and oracle channels. It may diagnostically rerun unsound failure attribution, but the profile stays unresolved; oracle authoring, not execution, may need isolation. + +### Audit, UAT, and blind evidence + +Audit ranges over every applicable composite address, cleared only by a current verified human receipt with an applicable pass and its exact required checks; a human failure/note remains history. + +UAT needs one current verified feature receipt matching subject, runtime-dependency, and implementation-author-set digests. Its signed matrix enumerates every current composite address: each pass clears that criterion's UAT, a missing row is unobserved, a failure dominates, and feature checks cover no-surprise/trade-off acceptance. Criterion-only receipts, asserted strings, TTY/usernames, hand-written YAML, and blind receipts never substitute. + +A blind receipt supplies independence only when its exact bytes, manifest, subject digest, and current matching testcase pass resolve; it never clears a human-only obligation. Same-author proof remains `self-certified` unless a qualifying independent channel exists. D20 does not make agent count/persona a gate input. + +## D22 — Profiles, cadence, and background scheduling + +### Profile contract + +Profiles select obligations and scope, never weaken pass meaning. The configured +`project.assurance_level` is the minimum for completion, push, and release. A +one-run stronger level requires a compiler-proven bounded closure; it neither +changes persisted policy nor waives unobserved evidence. + +| Profile | Trigger and minimum safe work | Authority and deferral | +|---|---|---| +| `feedback` | After a canonical spec, source, test, runner-config, or receipt change: compile the changed inputs, classify the write scope, invalidate affected observations, and run relevant background-safe checks. | Advisory and partial. Never writes attestation or changes lifecycle. External scanners, project commands, coverage, and system tests may defer. | +| `checkpoint` | Explicit user/host checkpoint, session Stop, or pre-commit: reconcile the changed closure; run required L1 checks and focused directly affected tests when a runnable proof changed. | Blocking only for the checkpoint consumer. It is not completion and never stamps. Stop may degrade its UI response, but that cannot change obligation state. | +| `completion` | `clad done`: evaluate the feature as done; run every applicable obligation through the configured level over the feature, observed write scope, co-owners, dependents, and proof closure. | Authoritative for that feature. One invocation only; do not run a duplicate manual push profile immediately before it. Commit clean-tree is release-only; unrelated repository checks defer. | +| `push` | Git pre-push, PR integration, or authoritative CI: compile the integrated change closure and run all applicable obligations through the configured level. Unknown or cross-cutting scope expands to the repository. | Authoritative for integration. Local observations may be reused only by exact trusted digest; CI independently re-executes rather than trusting workspace cache. | +| `release` | Clean committed tree: reproducible build and generated mirrors, repository-wide obligations through the configured level, conformance fixtures, and every release-required adapter. | Strongest authoritative profile. Nothing required may remain unobserved. Performance is isolated; explicit non-applicability remains visible. | + +Run cheap failures before expensive dependents: compiler/reference, receipt eligibility, static, functional, reconciliation, smoke/visual, isolated performance. Fail-fast never masks a later failure. + +Changed scope is sound only with a complete GraphIR owner/co-owner/prerequisite/dependent/test/oracle/evidence/configuration closure. Unknown write scope or edge, shared compiler/runner config, lockfile/toolchain change, post-snapshot generated mutation, or unenumerable adapter input escalates to repository scope; unknown is never empty impact. + +### Content-addressed invalidation and reuse + +Each descriptor declares every affecting byte/policy input. Its cache key includes normalized obligation/subject, closure, source/test/oracle/config bytes, adapter/tool versions, catalog, trust, environment, and missing-file sentinels; any change invalidates dependents. + +Cache policy is descriptor-owned: + +- `same-session` for volatile or environment-sensitive observations; +- `same-commit` for deterministic tools whose complete inputs and environment + class match; +- `never` for performance, release reproducibility, unsealed external state, and + any adapter unable to enumerate its inputs. + +Caches under `.cladding/cache/` are disposable and never proof authority, spec bytes, or cross-trust data. A cached failure remains failure; a pass is usable only in an allowed reuse class. Absent/corrupt cache executes, never passes. + +### Persistent background scheduler + +The persistent scheduler is deferred past 0.10.0; 0.10.0 `clad serve` runs no anticipation and behaves as `off`: explicit checkpoint/completion/push/release run the same kernel. Without a server, correctness is unchanged. The design below is the accepted target for the release that adopts it: a local `auto | off` (default `auto`) policy, not a spec fact. + +In `auto` mode the scheduler: + +1. watches canonical compiler inputs and registered proof inputs; +2. coalesces pure compile/in-process feedback after 500 ms of quiet and waits + for 5 s of edit-idle before starting an external background-safe adapter; +3. runs one snapshot at a time (single-flight); +4. merges invalidations arriving during a run and immediately schedules the next + snapshot; +5. commits an observation only if its input digest still matches current bytes, + otherwise retaining it solely as stale diagnostic history; and +6. emits no canonical spec, receipt, lifecycle, attestation, or generated-mirror + write. + +Only `background_safe` adapters run: offline, read-only, bounded, killable, terminal/shared-service-isolated, and explicit about locks/outputs. Pure compiler/in-process detectors qualify by default; arbitrary scripts, install, network, device/GUI, performance, and workspace mutation do not. A project command needs this reviewed adapter contract; stage family never confers it. + +Single-flight is per workspace. Exact snapshot/cache-policy foreground work may reuse content-addressed results; authoritative work cancels or supersedes stale background work and never races attestation. The local cache is 256 MiB LRU; same-key foreground joins/revalidates, different-key cancels, and adapters without isolated output/cooperative cancellation are foreground-only. + +### Latency targets + +| Boundary | Product target | Required timeout result | +|---|---:|---| +| Feedback | p50 ≤ 250 ms, p95 ≤ 750 ms, hard 1 s | advisory `unobserved` | +| Checkpoint | p95 ≤ 10 s, hard 15 s | consumer-visible `unobserved` | +| Completion | soft 60 s, default hard 300 s | blocking `unobserved` | +| Push | soft 5 min, hard 10 min | blocking `unobserved` | +| Release | default hard 15 min or explicit project budget | blocking `unobserved` | + +These are acceptance targets, not portable performance claims. A timeout never +becomes pass, skip-green, or compiler-proven `na`. + +### Feedback and context + +Background execution is a latency optimization, not an agent loop. It dispatches +no model and requires no persona. The host receives at most the current first +blocker, affected business subject, required next proof, deferred-check count, +and observation revision. Identical blocker fingerprints are deduplicated. +`implement`, `verify`, and `observe` packets follow D19: current failures and +freshness are included only when relevant, optional diagnostics remain bounded, +and no background result proves that a fresh agent retained prior context. + +## D23 — Verdict, attestation, compatibility, and acceptance + +### Profile-complete verdict + +An authoritative verdict is GREEN only when: + +1. the compiler sealed one input snapshot and complete requested scope; +2. every effective `hard` obligation has current `pass`, permitted proven `na`, + or the narrow permitted `migration_baseline`, and no reduced `fail`; +3. every effective `report` obligation has current `pass`, `fail`, or permitted + proven `na`; +4. no required obligation is `unobserved`; +5. evidence meets verified provenance and freshness policy; and +6. the reducer records the exact profile, assurance level, registry, policy, + scope, input digest, and `profile_complete: true`. + +`profile_complete` means all required observations resolved; it is not a +synonym for GREEN. A complete profile may be RED because a hard obligation +failed. Channel failure dominance determines the obligation state before +effective blocking determines the profile state. + +`migration_baseline` is explicitly resolved for `profile_complete`, but GREEN permits it only for an unchanged authorized L2 Unit/Coverage criterion with no current exact proof mechanism and passing current scope Unit/Coverage rows. Achieved L2 may count it transparently. It never resolves Oracle, Smoke, Performance, Visual, Audit, UAT, or any L3/L4 obligation. + +Warnings and diagnostics may coexist with GREEN only when no obligation maps +them to a required negative state. A stage-count total, process exit aggregate, +clean report directory, or all-skip run cannot establish profile completeness. + +### Attestation writer boundary + +Attestation v3 is written only from a profile-complete authoritative verdict. +This refines D13's earlier “strict full gate” wording: authority comes from the +declared profile and its complete obligation set, not the `strict` flag or a +numeric stage count. `completion` may attest its exact feature and impact scope; +`push` may attest its integration scope; `release` may attest the repository. +No narrower attestation is rendered as a broader one. + +The writer retains private reducer provenance and may mint a row only for a +feature in the compiler's exact effective impact scope at that verdict's exact +input digest; serialized or caller-constructed verdicts carry no such +authority. + +The attestation records profile ID, configured and achieved assurance level, +scope and input digests, contract/subject/verification closure digests, current +obligation and adapter registry identities, detector catalog, tool/environment +class, trust snapshot, and `observation_set_sha256` plus `observation_count` +over the identities that earned GREEN. Private run authority seals baseline +identities and requires executed passing scope Unit and Coverage rows before +minting; the `migration_baseline` summary seals `criterion_authorization_set_sha256` +rather than an authorization list, so a row stays constant-size. It embeds no +receipt body and copies no stale observation forward. Feedback, +checkpoint, silent verdict polling, background work, and incomplete profiles +never stamp. + +### Compatibility and rollout + +- Keep the legacy tier names and all 15 stage IDs readable throughout 0.10. + Their adapters call the kernel and project its observations; they do not own a + second execution or reducer path. +- `pre-commit`, `pre-push`, and `all` map to versioned profile aliases. Machine + output includes both the legacy tier/stage view and the canonical profile, + obligation, completeness, and assurance fields. `pre-commit`, `pre-push`, and + `all` alias `checkpoint`, `push`, and `release`; `clad done` calls + `completion` directly. +- F1–F6 may add the registry, observation model, and adapters behind parity + fixtures. Old and new blocking results remain identical for 0.1 inputs; + criterion-addressed and no-vacuous-GREEN enforcement activates with 0.2. +- Default 0.2 authoritative profiles preserve strict completion: Coverage and + Performance remain `report` in the standard projection but compile as + effective `hard` obligations for Cladding. No 0.10 project setting weakens + this policy. +- Schema 0.1 keeps its shipped policy and readable reports. Schema 0.2 writers + persist `assurance_level`; no inference from old stage history silently grants + L3 or L4. +- Canonical legacy projection maps `migration_baseline` to `unobserved` (fail closed), never pass or `na`; canonical JSON retains it. Soft-Shell may add a nonblocking explanatory note and discloses its count. Release claims say “profile-complete at persisted L2, with current verified, migration-baseline, and NA counts,” never that every criterion has current exact proof. +- Existing report, event, plugin, and audit consumers receive legacy aliases + from the registry. New consumers use obligations and profiles. The 15 IDs may + be retired from a future public default only through a separate compatibility + decision; their historical interpretation remains stable. +- The background scheduler is deferred past 0.10.0, and correctness and + acceptance fixtures still run with both `auto` and `off`. Verdict bytes apart + from timing/cache diagnostics, requested scope, failure set, freshness, and + attestation content must be topology- and scheduler-invariant. + +### Acceptance and measured baselines + +Measurements and their reproduction sources live in [Assurance +evidence](assurance-evidence.md); they are evidence, not portable performance +promises. + +Committed fixtures must additionally prove: + +- official-13 and legacy-15 projections resolve to one obligation registry; +- `L1`–`L4` are cumulative and new 0.2 persists `L2`; +- report failure completes the standard observation requirement but remains RED + under Cladding's strict policy; report absence is unresolved in both; +- every failure, missing runner, stale report, unknown scope, and empty ledger + follows the states above with no vacuous GREEN; +- prior JUnit, coverage, performance, evidence, and receipt artifacts cannot + satisfy changed inputs; +- Unit/Coverage/oracle observations batch without changing result attribution; +- Audit covers the complete composite-criterion set; one verified current UAT + receipt contains an exact pass matrix over that same set plus both feature + checks; and blind evidence never clears UAT; +- focused scope equals repository scope on complete closures and escalates on + every unknown/control-file negative case; +- `auto` and `off`, one or many host agents, and cold or reusable caches produce + identical authoritative verdicts and attestation inputs; F9 also proves + single-flight, resource-lock exclusion, cooperative cancellation, exact-key + reuse, and rejection of every stale background result; and +- only a profile-complete completion, push, or release verdict can write v3; and +- migration-baseline cases cover accept/reject, in-progress F7 exclusion, new/intent-edited criteria, forged/swapped/digest-mismatched authorization, no historic-stage inference, exact live/reviewed/legacy/static-rule precedence (pass/fail/skip/absent/stale/unsafe), path-only eligibility, scope Unit/Coverage failure or skip, L3/L4 non-effect, v3 counts/identities/authority, and compatibility that never pass-launders. diff --git a/docs/design/spec-0.2/change-log.md b/docs/design/spec-0.2/change-log.md new file mode 100644 index 00000000..65d25d3a --- /dev/null +++ b/docs/design/spec-0.2/change-log.md @@ -0,0 +1,42 @@ + + +# Spec 0.2 — change log + +> Append-only history of accepted decision changes. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +| Date | Decision | Change | Evidence | +|---|---|---|---| +| 2026-08-28 | D01–D16 | Initial accepted Spec 0.2 design recorded as the continuation SSoT. Chose node-level legacy binding baseline, strict-new/lenient-legacy grammar, live IR with no traceability file, scenario `goal`, proof-content attestation, and bounded commit locking. | Repository corpus audit and adversarial Claude/Codex review summarized in [Evidence snapshot](evidence.md#evidence-snapshot). | +| 2026-08-28 | D17 | Made GraphIR v2 the shared compiler model for contract/proof closures; separated its structural justification from optional LLM retrieval; preserved frozen `clad_get_context` v1 while requiring an atomic graph-v2 cutover; and fixed independent validity, efficiency-when-used, and adoption claim gates. | v1 fidelity census, v2 read-only query reconstruction, token/ablation simulation, source-reference audit, and adoption protocol review. | +| 2026-08-28 | D15–D17 refinement | Fixed the F1 schema-0.1 bootstrap, additive no-cutover boundary, independent sorted-record oracle, occurrence/unique/resolution census vocabulary, F1/F5 adapter boundary, and one authoritative completion-gate cadence. | Scoped import-graph census, YAML/CST locator prototype, typed evidence-reference census, known unresolved controls, and feature-cycle/CI audit. | +| 2026-08-28 | D18–D20 | Added adjacent-cleanup proof, complete physical context accounting, task-keyed projections, host-owned orchestration refinement, and verified human/blind evidence receipts; kept F8 as graph-v2 cutover and placed the task-state headless loop at F9. | Current role-contract/code-path audit, 281-feature dispatch-size census, generic-MCP blindness boundary review, and 46 focused GREEN tests. | +| 2026-08-28 | D06–D07, D12–D14, D16, D19–D20 refinement | Added an explicit cycle-begin boundary, subject-level evidence hashes, predicted/observed write scope, physical payload/resident/total accounting, explicit capability links, and advisory-only semantic atomicity checks. | One-cycle F-06dfdad6 simulation, current MCP catalog serialization, impact fan-out comparison, stale matrix, and 53 focused GREEN tests. | +| 2026-08-28 | D15–D18 routing and retirement | Split the continuation SSoT into a small task router and bounded semantic owners; added same-cycle code/document/test retirement, contract-aware orphan checks, and replacement-test rules without LOC or test-count quotas. | 92,189-byte monolith census, Madge orphan graph, and 1,608-line supersession-candidate census. | +| 2026-08-28 | D03, D06, D10, D12–D16, D19–D20 execution refinement | Made root schema selection singular; added canonical signed receipts and offline trust verification; completed lifecycle/link operations; separated F3 proof, F4 apply, and F7 self-migration; replaced the ambiguous content-class packet ceiling with operation-scoped task limits; preregistered the 37-case matrix; promoted envelope/A–E work to F9 core and moved the headless loop to F10. | Adversarial document audit, receipt/freshness simulations, task-envelope serialization, module fan-out census, and registered-detector recount. | +| 2026-08-28 | D21–D23 | Reframed Iron Law as profile-selected obligations over current closures; preserved the 13-stage standard plus two named Cladding extensions; selected default L2, explicit unknown escalation, bounded 0.10 background checks, profile-complete attestation, and host-owned topology. | Repository gate/hook/config audit, assurance-cadence simulation, upstream Ironclad draft comparison, current latency/adoption records, and independent strategy critique. | +| 2026-08-28 | D12, D16, D18, D20–D23 refinement | Defined receipt canonical bytes and author-set freshness, made one feature UAT receipt carry the complete per-criterion decision matrix, aligned stale gates to runtime closure, completed block/archive transitions, retained the F9 scheduler in 0.10 core, and split hygiene/cadence evidence owners for routing headroom. | Current document/schema audit, upstream per-criterion Stage 4 comparison, doc-link extraction parity, lifecycle simulation, and owner-byte census. | +| 2026-08-29 | D15–D16, D24 | Added an additive V0 validation ledger and made MCP an optional, bounded adapter with separate conformance, efficacy, efficiency-when-used, and adoption gates; preregistered twelve MCP scenarios and preserved unrun/pending states. | Executable owner/case ledger, in-memory MCP negotiation and bootstrap transition, canonical catalog-byte census, and legacy host-smoke/adoption evidence audit. | +| 2026-08-29 | D16–D17, D19, D24 evidence refinement | Scoped AB01–AB12 to the first task-scoped MCP decision, retained a 40-task GraphIR study only as optional later generalization, refreshed physical-context and catalog evidence, and restored router editing headroom without changing the accepted architecture. | `npm run validate:spec-0.2`, exact UTF-8 census, graph/cadence model controls, and owner/anchor integrity tests. | +| 2026-08-29 | D09, D14–D16, D20–D24 final audit closure | Separated upstream hard/report strictness from Cladding's strict blocking policy, assigned receipt protocol consumption to F5 and real issuer paths to F9, defined required-scenario criterion freshness, fixed L2→L4 self-migration staging, and widened normative-owner validation. | Upstream Iron Law comparison, policy/scenario truth-table simulations, duplicate-heading fault injection, and the full contributor test suite. | +| 2026-08-29 | V0 rebaseline | Set V0 and F1–F11 as 0.10.0 scope; separated schema migration from F11 relocation; kept self policy at L2; required bounded one-run L4 plus Codex and Claude Code MCP11 evidence; and aligned release/governance wording. | Maintainer decision; implementation, fixtures, and live-host evidence remain pending. | +| 2026-08-31 | F7-B2 atomic remediation | Remediated 13 historical compound criteria into 51 atomic children plus two scoped restores: retained each old address on child 1, minted canonical sibling IDs, and kept displaced text non-normative; retired F-12d740 for F-048's compact F6 observer; self remains schema 0.1. No release claim. | B2 implementation and contract fixtures. | +| 2026-08-31 | F7-B3 derived measurement contracts | Replaced 23 historical measurement criteria with current semantic invariants, exact live selectors, and feature-owned source/runtime plus runner/observation closure; Audit/UAT are trusted-receipt mechanism proof only and real ingress remains B5. Fixed totals, percentages, and byte baselines are dated non-normative history; self remains schema 0.1 with no release claim. | Focused behavioral/proof suites, live-binding census, and context compaction. | +| 2026-08-31 | F7-B4 criterion observations | Normalized the four replacement statements to strict grammar without changing their addresses or meaning. Added a code-owned exact-address criterion observation registry: static Unit/Coverage NA needs a current registered adapter, complete seal, and true predicate; behavior remains required, failures RED, and GraphIR structural. The mirror has one pure byte-map policy for writing and read-only census. Self remains schema 0.1 with no release claim. | Criterion-registry, parser, locale, compaction, and mirror fault fixtures. | +| 2026-09-01 | F7 L2 migration baseline | Before parser repair, an initial clean-room F7 completion left 1,880 Unit/Coverage rows unobserved despite raw suite/coverage passes; substantial rows came from discarded Vitest JSON `ancestorTitles`, yielding zero nested exact-selector matches. Accepted a transparent, criterion-local migration-baseline resolution for otherwise eligible unchanged done-source L2 rows, never a parser-defect remedy: restore source→selector→runner first, and current exact proof/scope observations win. It is neither waiver nor verified proof. Further census counts await Luna. | Initial clean-room observation; selector-parser diagnosis; design contradiction review. | +| 2026-09-02 | D17, D21–D23 | Scope and closure completeness derive from structural relations and enumerable inputs only: an unresolved authored proof-channel reference (evidence/oracle) or an unbuilt module of an unfinished feature is a sealed negative fact for its own criterion, never unknown repository topology. Directory evidence targets with a trailing separator digest as trees. Added F6 AC-6f0a2112. | Before: every 0.2 profile RED with 4,011 of 4,019 obligation rows unobserved once 0.2 contract evidence refs compiled; after: push GREEN at L2, 276 done features bounded. | +| 2026-09-02 | D16, D21 | Warn-class drift blocking is owned by the profile for schema 0.2: completion, push, and release block on warn findings without a transport strict flag; feedback and checkpoint block on errors only; `--strict` stays an explicit escalation and CI keeps `--tier=pre-commit --strict`. Added F6 AC-6f0a2113. | `clad done` previously ignored warn findings that the strict CI gate then failed on. | +| 2026-09-02 | D15, D16 | An archived feature whose superseding feature is not yet done reports surviving modules as informational; the warning returns when the successor is done, so the successor's completion gate owns the deletion. Added F6 AC-6f0a2114. | Retirement map entries (reverse-index → F8) otherwise blocked every unrelated completion. | +| 2026-09-02 | D21, D23 | Unobserved rows distinguish `unresolved` (applicability could not be derived) and `unbound` (no test binding) from `stale`, and the machine verdict lists incomplete closure addresses. Added F6 AC-6f0a2115. | 4,011 identical `stale` rows hid two unresolved references; two diagnostic runs were needed to trace them. | +| 2026-09-02 | Process | Self dogfood: `test-count.mjs --write` also syncs README feature counts pinned by the record-honesty test; F1–F6 completed through the 0.2 completion profile; git hooks deferred on the self repo (explicit gate runs instead). | Completion stamps kept 1 v3 row each until the push profile regenerated all 281. | +| 2026-09-03 | D17, D15 | F8 GraphIR v2 public cutover landed: wire schema_version 2 (16 KiB fixed-point packer), receipt observation layer, one consumer facade (kernel + parity-proven structural lane), presentation adapter with byte-identical outputs, public CLI/MCP/serve cutover, v1 model and reverse index retired. | Self corpus: packer 16,246–16,317 B on hubs; consumer parity 0 differences; presentation parity byte-identical; strict gate GREEN. | +| 2026-09-03 | D17 claim ladder | Structural-validity claim for GraphIR v2 is now permitted (fidelity, parity, ablation, freshness suites committed and passing); retrieval-efficiency and adoption claims remain prohibited. | tests/graph/graph-ir-v2-*.test.ts, tests/optimizer/graph-ir-consumers.test.ts, tests/graph/presentation.test.ts. | +| 2026-09-03 | D19, D15 | F9a cycle context envelope landed: five task-profile projections over the GraphIR workspace, packed to fixed-point payload/resident/total byte budgets with a named `characters/4` estimator, aggregated omissions in task priority order, `required_overflow` naming the oversized section instead of a truncated contract, and diagnostic preamble/head-tail rules applied before measurement. `src/optimizer/preamble.ts` and `src/optimizer/tail.ts` retired with their tests once F-041 and F-063 were revised onto the envelope; `clad_get_context` stays schema_version 1 with its payload unchanged. The I-4 measurement is recorded rather than built: the completion closure seeded at `F-001` spans 287 of 294 features through shared-module hubs, so the closure-scoped test filter is not built. | Per-profile self-corpus payload table in [Evidence snapshot](evidence.md#evidence-snapshot); `tests/optimizer/envelope.test.ts` at 100% line coverage of the packer. | +| 2026-09-03 | D13, D23 | I-15 attestation compaction: an attestation v3 row now persists `observation_set_sha256` plus `observation_count` and, for the migration-baseline summary, `criterion_authorization_set_sha256`, instead of inline identity lists; the reader accepts only the compact form, so a pre-compaction row is refused rather than read. `scripts/compact-attestation-v3.mjs` rewrites legacy rows idempotently for history compaction. | Self `spec/attestation.yaml` measured 76,853,398 → 521,443 bytes for 287 rows (147×); `tests/scripts/compact-attestation-v3.test.ts`, `tests/spec/attestation-v3.test.ts`, `tests/assurance/attestation.test.ts`. | +| 2026-09-03 | D19, D20 | F9b A–E topology invariance suite landed and J11 moved from model-simulated to validation-active with a validator-resolved test reference: twelve preregistered ledger items, each with its fault control, run through the shipped persona dispatch and one and several general-agent envelopes, with every edit or refusal applied to a fresh fixture copy and reduced by the completion profile. Addresses, verdicts, stale closures, and observed impact are identical across the three arms and equal a hand-authored oracle; removing every persona prompt changes none of them; the assurance, proof, and compiler kernels reference no persona id in code; and eight fact ablations each break the executor that reads them. The suite declares no production module and nothing under `src/` imports it; the two production edits it caused both make the shipped path cheaper or more honest, and both are recorded here rather than folded into the suite. `implement` now declares `ownership-fan-out` LAZY instead of optional: a lazy section is never packed by default and travels only when a request names it in `include`, where it packs below every optional section. That turned AC-397aac78 from RED to GREEN by removing a resident block, not by weakening the criterion. The blind payload's declaration-only extractor now stats a declared module before reading it, so a DIRECTORY module contributes no signatures instead of throwing `EISDIR`, and the leakage sweep covers every feature rather than excusing three. | Self corpus: blind leakage 0 across 174,677 candidate body lines of all 295 features; default arm B implement+verify cycle p50 7,572 B and p95 12,542 B against arm A's 14,692 B and 21,220 B, exceeding arm A on no feature; the same cycle including an explicit fan-out follow-up is p95 29,901 B and exceeds arm A on 142 of 295, recorded and not asserted; 5,000-feature hub implement envelope 5,692 B at its fixed point in 7 ms; per-arm byte table in [Evidence snapshot](evidence.md#ae-simulation-self-corpus-2026-09-03). | +| 2026-09-03 | D20 | F9d file-key issuer and committed trust registry landed: the public half of an issuer is `spec/trust/issuers.yaml`, written through the spec transaction by `clad key create`, while the private key is an owner-only PKCS8 file outside the workspace (`CLADDING_KEYS_DIR` to relocate). An absent registry keeps the empty snapshot digest, so no attestation row moves. `clad signoff --verified` and MCP `clad_signoff` with `verified` require a human to re-enter the feature id at a terminal prompt or in a host elicitation form; no confirmation, no registered issuer, or no local signing key each return `HUMAN_REQUIRED` with asserted history recorded. The gate now builds its trust snapshot from that registry and its receipt candidates from the safe `spec/evidence` census, and an unsafe census makes the receipt closure unresolved (`receipt-census:spec/evidence`) instead of an empty receipt set. `reviewed_inputs_sha256` is the receipt-free verification closure aggregate of the subject, so a receipt never stales itself or a sibling, and `implementation_authors_sha256` resolves audit-log identity, then the root's git author as asserted, then an explicit unknown sentinel. Independence gains `unobserved` for a scope whose author mapping is incomplete. The blind capability adapter and OS secure-store keys are deferred; this path is L4 mechanism evidence until real MCP11 signing. | `tests/proof/{trust,issuer,authors,signoff}.test.ts`, `tests/cli/key.test.ts`, `tests/serve/proof-evidence.test.ts`, `tests/assurance/independence.test.ts`; absent-registry digest equals `emptyTrustSnapshot()`. | +| 2026-09-05 | D18, D15, D22 | F10 headless loop retired: measurement on 2026-09-02 found zero loop runs across 5,176 recorded events over 3.5 months, no README mention, and no automatic invocation, so 0.10.0 deletes the loop, its loop-only host and SDK adapters, the postmortem recorder, the progressive pulse and halt-message surfaces, the `run` verb and its skill, and the plugin mirrors that carried them. Nine loop-only features are archived through the typed `feature.archive` operation with their criteria kept as history and their modules cleared; eight features that also own surviving code are rebound instead, with the three sampling-context criteria restated at the surviving module and given live `[covers:]` tokens. The F9c persistent scheduler defers to 0.10.x: 0.10.0 `clad serve` runs no anticipation and behaves as `off`, and the entry condition is an A/B/C replay fixture measuring at least a 50 percent active-wait reduction with p95 latency within 10 percent. | `tests/retirement/drive-loop.test.ts`; the removed-verb tripwire in `tests/cli/verb-residue.test.ts` now scans for the retired verb across `src/` and `tests/`. | +| 2026-09-05 | D14, D03, D10 | F11 lite: the artifact registry resolves a compatibility alias to the same descriptor as its canonical path, and a layout probe resolves each generated projection per artifact — relocated path when only the generated directory holds it, pre-relocation path otherwise, and a reported conflict when both do; an artifact present at neither path follows its relocated siblings when every existing projection is relocated, otherwise the pre-relocation path. The attestation reader and writer, the derived index projection, the document-link carry-forward, the SessionStart feature counter, `INVENTORY_DRIFT`, `STALE_ATTESTATION`, and the presentation tier map all consult the probe. A schema 0.2 transaction projects `spec/generated/README.md` from the registry, and `clad relocate-generated` previews the move by default and, under `--apply`, performs it as one recoverable delete-plus-create journal before retargeting the `.gitattributes` merge attribute. Relocation stays opt-in: the pre-relocation layout is fully supported, this repository keeps it, and `relocation_required` enforcement is deferred. | `tests/spec/layout.test.ts`, `tests/cli/relocate-generated.test.ts`, `tests/spec/relocated-layout.test.ts`, `tests/spec/compiler/artifact-registry.test.ts`. | +| 2026-09-07 | D15, D16, D24 | The validation ledger now declares the 0.10.0 release boundary: `release_boundary` names the release and the eleven scenarios that block it, MCP01–MCP10 are validation-active with resolving `path#title` test references, and `npm run validate:spec-0.2:release` turns any unmet blocking row into a failure with a nonzero exit while ordinary validation keeps reporting the same state as `not_run`. The two reference-host checks and the J13 status now read one shared evidence evaluation instead of a hardcoded `not_run`: an MCP11 evidence record names a host and copied receipt, trust registry snapshot, and attestation row under `docs/dogfood/mcp11-0.10.0//`, and counts only when the receipt is signed by an issuer registered in that recorded snapshot. Foreign workspace digests cannot be recomputed, so a recorded receipt is never called current, and MCP12 and the host A/B may not enter the boundary. | `tests/design/spec-0.2/release-boundary.test.ts` (signature forgery, unregistered issuer, host mismatch, out-of-tree reference, and stray attestation each stay unmet); `tests/serve/release-boundary-wire.test.ts` (MCP01, MCP03, MCP05, MCP06, MCP07, MCP10 over the in-memory MCP wire). | +| 2026-09-07 | D20, D12 | A schema 0.2 completion reports and enforces the independence label its own assurance receipt attested, rather than the evidence-ledger label. The ledger reads any human-authored evidence entry as `independent`, so an implementer who signs their own feature flips their own label, while the kernel compares the receipt issuer against the implementation authors and calls the same completion `self-certified`. `independence_policy: require` now judges the attested label: it refuses `self-certified` and `unobserved` and keeps `independent` and `not-applicable`, and a refusal leaves the shard bytes untouched. The completion event seals no independence label at all, because the attested one exists only after the gate that consumes that sealed event and the event validator accepts neither added value. `clad done` names which authority produced the label it prints; schema 0.1 keeps the ledger label, its event payload, and its wording unchanged. | `tests/cli/done-independence-schema02.test.ts`; `tests/cli/done-independence.test.ts` and `tests/cli/done-schema02-crash-safe.test.ts` unchanged and green. | +| 2026-09-07 | D23, D20 | The completion gate's run authority and its attestation writer now seal the same receipt-carrying verification closure, so a schema 0.2 workspace holding one verified receipt can record a verification at all: before this, the authority sealed a receipt-free closure, every seal comparison failed, and the gate finished green while writing nothing and reporting nothing. `STALE_ATTESTATION` reads the same closure, and reports an attested row as uncheckable when the `spec/evidence` census cannot be proved safe rather than comparing it against an empty receipt set. One shared assembly (`src/assurance/receipt-census.ts`) is now the only place the census, trust snapshot, and expected digests are built, and the expected-digest producer and independence inputs keep their receipt-free closure. A refused row names the guard that refused it, in the `clad done` refusal and in a push-gate note. | `tests/cli/completion-receipt-seal.test.ts`: reverting the authority seal alone fails the completion case, reverting the detector alone fails the freshness case. | +| 2026-09-07 | D15, D16, D24 | Both MCP11 reference-host cycles ran and landed as ledger evidence, so J13 moves from `not_run` to `validation-active` and the 0.10.0 release boundary reports satisfied. Claude Code 2.1.263 (headless) and Codex CLI 0.153.0 (`codex exec --approve-for-me`, no bypass flag) each took one feature through create → begin → implement → strict pre-push → commit, and each completed at L4 with `independence: self-certified` and an attestation row carrying `achieved_assurance_level: L4` and `tool_identity: 0.10.0`. MCP11 carries the same `validation-active` label as every other blocking row, and the ledger check now grants the reference-host row alone the same exemption J13 takes through `evidence_from`: its witness is that recorded evidence rather than a `path#title` test reference, and its label is held to that evidence in both directions, so a promoted row with no confirmed evidence and a pending row whose evidence is confirmed both fail the ledger by name. Two limits are recorded rather than resolved — the signing confirmation was answered by an automated pseudo-terminal driving the `clad signoff` CLI at the maintainer's instruction, so neither host's elicitation form was exercised; and Codex's first two receipts had to be discarded and re-signed because the `[covers:]` token sat at the end of the test title instead of at its anchored start. The design set now states what the 0.10.0 reference-host records prove: registered-issuer wire and offline-verification evidence on two hosts, not live human evidence. | `docs/dogfood/mcp11-0.10.0/{claude-code,codex}/` (receipts, trust registry, attestation row, `done` output, post-completion GREEN gate, and a per-host `cycle.md` carrying the honesty boundary); `tests/design/spec-0.2/release-boundary.test.ts` verifies both committed receipts offline against their own snapshots and `npm run validate:spec-0.2:release` exits 0. | diff --git a/docs/design/spec-0.2/context-and-orchestration.md b/docs/design/spec-0.2/context-and-orchestration.md new file mode 100644 index 00000000..b12e4312 --- /dev/null +++ b/docs/design/spec-0.2/context-and-orchestration.md @@ -0,0 +1,241 @@ + + +# Spec 0.2 — context and orchestration + +> Canonical owner of D19–D20. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## D19 — Cycle context envelope and token discipline + +The context objective is not “send less text” in isolation. It is to deliver every fact required for the current operation, omit unrelated facts, make omissions visible, and prove that the final physical request is bounded. A logical graph slice is insufficient evidence because system prompts, tool catalogs, schemas, escaping, hook cards, and prior tool results also occupy the model input. + +### Task projections + +Context is keyed by an operation, not by a persona name: + +| Task profile | Required projection | +|---|---| +| `spec-edit` | The operation-derived read/write set: relevant intent, target contract node, referenced constraints, affected links, and canonical input revisions. | +| `implement` | Purpose, criteria, constraints, candidate affected paths, predicted write scope, prerequisites, required proof, current failure, and prior-attempt summary when present. | +| `verify` | Contract, observed write scope, changed artifacts, declared bindings, observed results, impact closure, evidence state, and freshness. | +| `observe` | Gate results, detector findings, proof freshness, attestation digest, and unresolved state; no implementation body by default. | +| `blind-oracle` | One criterion, public module signatures, target test path, subject/context revisions, and no implementation body or prior implementation result. | + +These profiles are deterministic projection policies. Except for `blind-oracle`, they neither select a model nor restrict host permissions. A host may use one general agent for several profiles or several agents for one profile. + +### Internal measurement contract + +Use an internal envelope; do not change the frozen `clad_get_context` wire to expose it: + +```ts +interface CycleContextEnvelope { + task: 'spec-edit' | 'implement' | 'verify' | 'observe' | 'blind-oracle'; + feature: string; + context_revision: string; + input_revisions: Readonly>; + write_scope: { + paths: readonly string[]; + provenance: 'predicted' | 'observed' | 'unknown'; + }; + sections: readonly ContextSection[]; + budget: { + payload_utf8_bytes: number; + resident_utf8_bytes: number; + total_utf8_bytes: number; + cache: 'cold' | 'warm' | 'unknown'; + estimator: string; + estimated_tokens: { + payload: number; + resident: number; + total: number; + }; + omitted: readonly OmissionSummary[]; + required_overflow: boolean; + }; +} +``` + +`payload_utf8_bytes` measures the final task packet after revision, write-scope, budget, and omission metadata are serialized. `resident_utf8_bytes` measures every Cladding-controlled input present outside that packet for the same model request: role/system text, MCP server instructions and catalogs, tool schemas, hook cards, and retained Cladding tool results or retry summaries. `total_utf8_bytes` is their exact sum. Classify each byte once. Provider-owned hidden context is outside this total; when a provider reports input/cache/output tokens, record those alongside the envelope rather than substituting them for it. The cache field describes the observed resident-prefix state and stays `unknown` when the host cannot prove it. + +Measure and classify all Cladding-controlled input: + +- optional role-brief/system text; +- task packet and final provider/MCP JSON after escaping; +- MCP server instructions, tool catalog, and tool schemas; +- tool results and retry/prior-attempt summaries; +- hook push cards; +- context/input revisions, cursor, budget, and omission metadata. + +Exact UTF-8 bytes are primary. Token estimates always name their estimator. Provider-reported input, cache-read, cache-write, and output tokens are recorded only in live same-host A/B runs. Cold catalog cost and warm cached cost are separate results. + +### Packing and reuse + +- Required contract facts are never silently truncated. If they do not fit, return `required_overflow` and the exact oversized section rather than a plausible-looking partial contract. +- Pack optional sections in task-specific priority order, aggregate omission metadata, serialize the complete payload, and remeasure until byte/token totals reach a fixed point. +- Fresh agents receive the full mandatory core. Delta and `not_modified` responses require a proven same-session `context_revision`; a matching git revision alone does not prove that a new agent retained prior context. +- Before an edit, derive `write_scope` from the operation's predicted write set. After an edit, replace it with paths observed from the actual diff. Impact traversal starts from these paths, not from every path in `feature.modules`. +- An unknown write scope is explicit and never means empty impact. Keep module ownership/fan-out summaries available lazily, surface incompleteness, and request or observe a narrower path set before claiming a complete regression closure. +- Avoid repeating the same project, criterion, path, or proof fact inside one envelope. References may point within the envelope by stable address. +- A verification projection always retains `{criterion, state, selector, locator-or-digest}` for every relevant proof. Diagnostics are failure-first optional detail packed only with remaining budget. +- An internal `diagnostic_cursor` may continue omitted diagnostics only within the same session and `context_revision`. It is not a public GraphIR cursor and does not change the frozen `clad_get_context` v1 wire. +- Keep the shipped hook limits of 600 characters per push card and 2,500 estimated tokens per session. Measure the complete MCP catalog and ratchet its sorted serialized bytes separately from task payloads; adding a public capability may raise the ratchet only through a reviewed catalog diff. + +Initial payload ceilings are task-profile rules: 16 KiB for `spec-edit`, `verify`, and `observe`; 24 KiB for `implement` and `blind-oracle`. They do not claim that total cold context fits inside them. `spec-edit` scopes required content to the typed operation: a criterion operation includes feature intent, the target criterion, referenced constraints, affected links, and its write set; a feature-level operation may require the whole feature; deterministic global migration is executed by the compiler rather than sending the whole corpus to an agent. Across the self corpus, required semantic-address recall is 100%, forbidden blind data leakage is zero, avoidable duplicate facts are zero, and `required_overflow` is zero. A future legitimately huge feature may return honest overflow instead of truncation. Comparable contract-only p50 and p95 payload and total bytes may not regress from 0.1; a 20% payload p50 reduction is a target, not permission to drop required facts. + +### A–E simulation + +Run the same preregistered work items through: + +- **A — shipped persona path:** current developer/reviewer prompts and dispatch packet; +- **B — one general host agent:** task profiles with no general persona prompt; +- **C — several general host agents:** the same task profiles split by the host; +- **D — restricted blind oracle:** fresh context plus enforced negative capabilities; +- **E — legacy reconstruction:** the reads/greps/tool calls needed to reconstruct the same facts without the new projection. + +A, B, and C must produce the same contract addresses, deterministic gate result, verdict, stale closure, and observed write-scope impact. Only verified evidence provenance may change the independence label. Removing purpose, criterion identity, constraint rationale, selector, provenance, direction, impact, or freshness must fail the corresponding ablation. Removing every general persona prompt must not stop the cycle or alter a gate. + +Fixtures cover every self-corpus feature plus small, p50, p95, and maximum packets; shared-module hubs; deep dependency closures; proof-heavy and unresolved nodes; retries; non-ASCII content; blind signatures; and a 5,000-feature synthetic graph. A no-retry full cycle's p50/p95 Cladding-controlled input may not regress against the comparable shipped path. D24's AB01–AB12 live A/B may support only a task-scoped efficiency claim; broader GraphIR generalization requires the separately preregistered optional expansion described by D17. + +## D20 — Host-owned orchestration and verified independence + +This decision refines the shipped role-contract architecture; it does not invert it. The current orchestrator and managed AGENTS contract already say that the host owns agent count, names, models, threads, and parallelism, while Cladding declares outcome conditions and judges recorded evidence. Current specialist Markdown already describes selectable role briefs. The remaining mismatch is the fixed five-step persona narrative in the cycle guide and the experimental headless loop's hard-coded developer/reviewer dispatch. + +### Enforcement boundary + +Cladding enforces invariants, not a roster: + +- the host chooses whether one or many general agents plan, edit specs, implement, test, review, or observe; +- deterministic gates judge filesystem, contract, observation, and evidence truth independently of the chosen topology; +- a same-author verification pass is allowed but remains `self-certified`; +- no gate or verdict depends on a general persona ID; +- identity matters only when a claim requires independent evidence; +- a new enforced role is admitted only when an ablation proves that its negative capabilities are necessary for the guarantee. + +Role briefs remain because their domain contracts measurably steer interpretation and serve as interface manuals for hosts that want them. They are optional execution aids, not the source of gate authority. The blind profile is the exception: not seeing implementation is an epistemic precondition, so its fresh context and negative capabilities must be evidenced rather than promised in prose. + +### Evidence assurance and canonical receipts + +Keep `identity.author` and add a 0.2 assurance boundary: + +```ts +type EvidenceAssurance = 'asserted' | 'verified'; +type ReceiptCheck = 'pass' | 'fail'; + +interface ReceiptBase { + receipt_schema: '1'; + issuer: string; + issuer_key_id: string; + issuer_proof: string; + subject: `feature:${string}` | `criterion:${string}/${string}`; + subject_sha256: string; + observed_at: string; +} + +interface HumanReceiptBase extends ReceiptBase { + method: 'human_channel'; + reviewed_inputs_sha256: string; + runtime_dependency_sha256: string; + implementation_authors_sha256: string; +} + +interface AuditReceipt extends HumanReceiptBase { + claim: 'audit'; + subject: `criterion:${string}/${string}`; + checks: Readonly<{ + evidence_sufficiency: ReceiptCheck; + code_test_review: ReceiptCheck; + independence: ReceiptCheck; + }>; +} + +interface UatReceipt extends HumanReceiptBase { + claim: 'uat'; + subject: `feature:${string}`; + criterion_verdicts: Readonly>; + checks: Readonly<{ + no_surprise: ReceiptCheck; + tradeoff_acceptance: ReceiptCheck; + }>; +} + +type HumanReceipt = AuditReceipt | UatReceipt; + +interface BlindReceipt extends ReceiptBase { + method: 'blind_capability'; + claim: 'independent_oracle'; + verdict: 'pass' | 'fail'; + evidence: { locator: string; sha256: string }; + capability_manifest_sha256: string; +} +``` + +Receipts live at `spec/evidence//.yaml`: the feature directory is derived from `subject`, and the filename is the SHA-256 of the complete canonical receipt including its signature. There is no duplicate body ID. Receipts are create-only committed evidence, not regenerable output; `evidence.revoke` removes an exact receipt. + +Receipt schema 1 uses a detached Ed25519 signature over a newly defined canonical frame. Parse the YAML into a JSON-compatible value, rejecting aliases, tags, non-string map keys, non-finite numbers, and other non-JSON values. Remove `issuer_proof`, serialize the remaining value with RFC 8785 JSON Canonicalization Scheme, and encode it as UTF-8 `payload`. Let `domain` be the ASCII bytes of `cladding.receipt/1`; the signed bytes are `u32be(domain.length) || domain || u64be(payload.length) || payload`. Store the signature as unpadded base64url. After inserting `issuer_proof`, compute the lowercase hexadecimal filename SHA-256 over the RFC 8785 UTF-8 bytes of the complete receipt. `verified` and the receipt verdict are derived, never stored. + +The strict gate is synchronous and offline. `issuer_key_id` selects an Ed25519 SPKI key from an immutable trust snapshot built from the committed public registry `spec/trust/issuers.yaml`, while private signing keys live outside the writable workspace in `~/.cladding/keys/.ed25519` (owner-only, `CLADDING_KEYS_DIR` to relocate); an absent registry is the empty snapshot. The gate and attestation record that snapshot's digest using UTF-16 code-unit canonical ordering. The threat model is explicit: any process running as this user, an AI agent included, can read the private key and therefore mint a `verified` receipt, so the terminal confirmation and the MCP elicitation form are consent friction rather than cryptographic proof of a human, and a host running with blanket auto-approval (Codex `danger-full-access`) will answer the form itself and produce agent-approved receipts. What the committed registry does buy is visibility: a key addition moves `trust_snapshot_sha256` and re-mints every attestation row, so it cannot enter the project quietly. Supplied deterministic digest mismatches fail before trust lookup, including for an unknown key; missing context plus unknown trust remains unresolved/asserted. The verifier checks the signature and recomputes the subject, runtime-dependency, implementation-author, reviewed-input, evidence, and capability-manifest hashes without a network lookup. A missing verifier, unknown key, or online-only identity leaves the evidence unresolved/asserted and cannot satisfy UAT or required independence. A networked host channel may verify identity at ingestion time only if it emits this portable signed proof; later gates recheck bytes and signatures locally. + +`subject_sha256` is canonical and address-sensitive: + +- For a criterion subject, hash the feature purpose, referenced capability outcomes, the target criterion's ID and parsed contract, its local/referenced constraint rationales, applicable required-scenario intent, and any legacy-exemption identity. Exclude sibling criteria, modules, notes, formatting, and unrelated scenarios or rules. +- For a feature subject, use the full feature `contract_sha256` closure from D13. +- A receipt never transfers between addresses even when two subject serializations happen to be equal. + +Scenario applicability is conservative and explicit because schema 0.2 has no +criterion-level scenario edge. When `project.scenario_policy` is `required`, +every scenario whose `feature_refs` contains the parent feature applies to every +criterion in that feature. Hash sorted records of scenario ID plus `actor`, +`goal`, `success`, and ordered `steps`. Under `off | advisory` no scenario enters +the criterion subject hash. Removing the parent feature ref removes that record; +changing an unrelated scenario or sibling criterion does not stale the target +criterion receipt. A future narrower rule requires an explicit schema edge and +must not infer criterion coverage from step prose. + +A human receipt additionally binds the sorted runtime dependency closure, including the feature's complete module paths and bytes and explicit missing-file sentinels. `reviewed_inputs_sha256` is the verification closure aggregate of the receipt subject — one criterion's closure for an Audit receipt, the feature-wide aggregate for a UAT receipt — computed from the RECEIPT-FREE closure, so a receipt never stales itself or a sibling. `implementation_authors_sha256` hashes the sorted unique normalized `{root, assurance, author, name}` mutation-provenance records for every implementation root in that closure, sourced in strict order: audit-log mutation identity for a root an evidence entry names, else the root's git author as `{assurance: 'asserted', author: 'git'}`, else the sentinel `{root, assurance: 'asserted', author: 'unknown', name: ''}` for an unattributed root. Hashing binds the declared mapping; it does not upgrade asserted identity into verified identity. An incomplete author mapping leaves an independence requirement unobserved, and a matching verified issuer remains self-certified. + +An Audit receipt is criterion-scoped and records the three named checks above. A UAT receipt is signed once per feature but its `criterion_verdicts` addresses every current composite criterion: each value is that criterion's intent-alignment decision, while the two named feature checks cover negative space and accepted trade-offs. A UAT pass requires the exact current criterion set and every criterion/check to pass. Any explicit fail is an applicable failure even if the rest of the matrix is incomplete; an unknown address invalidates the receipt, and a missing address remains unobserved rather than passing. The reducer derives the receipt verdict, so no persisted summary can disagree with its checks. Editing a shared or prerequisite module, reviewed input, author set, trust snapshot, or signature therefore stales every receipt whose closure includes it. [D21–D23](assurance.md#d21--iron-law-assurance-kernel) own reduction and escalation. + +A blind receipt binds the exact evidence locator and bytes plus the capability manifest. It contributes independent provenance only when a current observed testcase pass confirms the bound criterion; a receipt for an unexecuted blind test remains unverified. Blind evidence never substitutes for UAT. + +- `asserted` records useful history but cannot satisfy a new 0.2 independence requirement. +- `verified` means the offline verifier accepted a supported signed channel or isolation boundary. It proves the registered issuer's assertion, not universal human identity. +- A receipt is bound to the current subject hash. A target criterion, relevant constraint/outcome/scenario, or feature-level subject change makes it stale; editing an unrelated sibling criterion does not. +- A verified human receipt contributes to feature independence and clears only the matching Audit or UAT obligations when its complete claim-specific checks reduce to pass. +- A verified blind receipt contributes to feature independence but never substitutes for UAT or another human-only rule. + +F5 owns receipt schema, canonical framing, offline verification, trust-snapshot +resolution, validated ingestion, content-addressed storage/revocation, and +reducer wiring. Its deterministic fixtures may supply signed receipts, but F5 +ships no product issuer that can manufacture verified human or blind evidence. +It introduces `clad signoff`; bare TTY or pseudo-TTY input records asserted audit +history only. Without a registered issuer, verified signoff returns +`HUMAN_REQUIRED`. F9's `--verified` REQUESTS the registered-issuer path and can +never bypass it: no confirmation, no registered issuer, or no local signing key +each return `HUMAN_REQUIRED` with asserted history recorded. OS/git identity, +caller text, generic `blind: true`, and hand-written YAML are asserted only. + +Keep `clad_author_oracle` readable for 0.1. Under 0.2, a registered adapter must supply a fresh-context/capability receipt before the result is verified blind. The generic MCP `blind: true` flag remains readable but records only asserted/attested provenance and cannot satisfy `independence_policy: require`. + +### Runtime rollout + +F9 ships the envelope, task projections, A–E invariance suite, and the first real +registered issuer path: a file-key human signing issuer, whose private key is a +plain owner-only file outside the workspace. The fresh-context/capability blind +adapter and OS secure-store issuers (macOS Keychain, Windows Credential Manager, +Linux Secret Service/dbus) are deferred to a later release, and +`clad_author_oracle`'s `blind: true` remains asserted-only until a portable +proof channel exists. Fixture trust snapshots prove protocol or mechanism only, +never live human evidence; F9 evidence for this path is L4 mechanism evidence +until real signing runs through MCP11. The issuer calls F5 ingestion and emits +portable receipts for offline verification. Only real human-signed MCP11 +receipts count as live human evidence. The 0.10.0 MCP11 records are signed +by the maintainer's registered key with the confirmation entered by automation +on the maintainer's instruction; they prove the wire and the offline +verification on two hosts, not live human evidence, and the host forms remain +unverified. F10's task-state loop is retired rather +than introduced: measurement on 2026-09-02 found zero loop runs across 5,176 +recorded events over 3.5 months, no README mention, and no automatic +invocation, so 0.10.0 removes the headless loop with its loop-only adapters and +skill. The host-delegated cycle owns execution. `implement`, `verify`, and +`observe` remain requestable work, but as operations rather than required +identities: the host may satisfy several with one agent, and receipts and +evidence, not dispatch count, decide independence. Rich public GraphIR cursors, viewer expansion, and broader retrieval generalization remain non-blocking tail work; F9's session-local `diagnostic_cursor` is a narrow task-projection exception. diff --git a/docs/design/spec-0.2/decision-log.md b/docs/design/spec-0.2/decision-log.md new file mode 100644 index 00000000..abef7bfd --- /dev/null +++ b/docs/design/spec-0.2/decision-log.md @@ -0,0 +1,122 @@ + + +# Spec 0.2 — decision log + +> Canonical owner of claim boundaries, rejected alternatives, the evolution queue, and change history. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## Claim discipline + +The graph claim ladder in D17 is cumulative but not substitutable: structural validity does not prove retrieval benefit, retrieval benefit when called does not prove adoption, and adoption does not prove implementation correctness. + +### Claims allowed now + +- Spec 0.2 reduces semantic prose to purpose, statement, and constraint rationale while retaining typed structural links. +- It removes internal duplicate AC representations for new/edited nodes. +- It eliminates shared capability-edge writes for ordinary feature creation. +- It can detect stale contract and proof inputs that attestation v2 cannot see. +- Verified repository scale makes feature-local mutation and proof closure materially relevant. +- The shipped role contract assigns execution form to the host and computes independence labels from recorded evidence rather than persona membership. +- D21–D23 define an obligation target in which existing runners are adapters, self policy persists L2, and a stronger one-run level requires a complete bounded current closure. +- Bounded background checking may provide speculative observations in 0.10, but only a foreground profile-complete reduction may change lifecycle state or write attestation. +- The current MCP server's declared catalog, in-memory negotiation, and bootstrap list-change path are executable wire facts; D24 makes MCP an optional adapter over shared kernels, not a second authority. +- GraphIR v2 is structurally valid on the self corpus (rung 1 of the D17 claim ladder); it says nothing about retrieval efficiency or adoption. +- The 0.10.0 release boundary is a declared, enforced list rather than prose: the executable ledger names the scenarios that block the release, and a release run of the validator fails on any unmet row. Adoption, token advantage, and the host A/B sit outside that list by construction. +- Both MCP11 reference-host cycles ran and are recorded (2026-09-07): two hosts each drove a complete Spec 0.2 cycle through the MCP tools to a completion at L4, and each receipt verifies offline against its own committed trust registry. The decision taken with them, and the limit of what they claim: the maintainer delegated the signing confirmation to an automated pseudo-terminal driving the `clad signoff` CLI, so **neither host's own signoff elicitation form was exercised** and no claim about that form follows from this evidence. The same day's live host matrix refresh is recorded with it: Claude Code, Codex and Cursor verified, Gemini fail, and Antigravity fail on all three surfaces (every check timed out) where the previous matrix had it verified — the README host claim was lowered for Antigravity and raised for Cursor rather than the matrix explained away. + +### Claims prohibited until new evidence exists + +- **“34 features produced nine false blocks”** — the repository records nine prior false rejections and a separate 34-feature experiment, but no raw fixture ties them together. +- **“26% false-block class removed”** — this is the unsupported `9/34` conflation. +- **“Landmine protection 2/2”** — [`case-working-set-landmine.md`](../../ab-evaluation/case-working-set-landmine.md) reports a NULL real-agent outcome. Two structural instruments discriminated deterministically; that is not an effect measurement. +- **“37/37 design simulation”** — the 37 IDs are now a newly preregistered contract matrix, not a recovered session artifact. Claim a result only after all one-to-one committed fixtures run. +- **“Done proof 100%”** — 277/277 measures declared proof addresses and attestation markers, not observed testcase-level verification. +- **“Cost falls from +45% to +20–30%”** — the latter is an acceptance projection until measured under the new authoring loop. +- **“N=300 prevents 25–50 latent defects”** — model projection, not observed defect count. +- **“Feature count below eight has no value”** — existing eight-feature constants are detector grace thresholds, not an economic break-even result. +- **“Every `blind: true` record is structurally blind”** — the packaged role restricts tools, but generic MCP currently accepts a caller assertion without a runtime isolation receipt. +- **“General persona prompts are unnecessary”** — deterministic gates must be prompt-independent, but the briefs have affected agent interpretation. Claim only topology-invariant gate behavior after D19's committed ablation; do not claim equal authoring quality without a live benchmark. +- **“A smaller task payload proves lower total input cost”** — the current full MCP list bundle is 53,960 bytes before server instructions and host framing; the historical 29,866-byte subset used a narrower serializer. Cache reuse is host-dependent. Compare payload, resident, total, retries, and provider-reported cache tokens separately in a live A/B. +- **“Background checking makes completion faster”** — availability is not a latency result. Measure foreground active wait, total CPU, cancellation/stale-result rate, cache-hit promotion, and authoritative completion wall time against the same edit trace. +- **“A latency budget is a performance guarantee”** — D22 budgets are product targets and downgrade rules. Claim an achieved percentile only from a dated, environment-labelled benchmark. +- **“A speculative pass is proof”** — a background result has no lifecycle or attestation authority until a foreground reducer revalidates its exact input, tool, policy, and environment closure. +- **“A fired hook or background result proves adoption”** — pushed delivery proves that Cladding spoke, not that an agent used the result. Preserve the existing pull/completed-cycle adoption protocol and report background reuse separately. +- **“The new cadence improves correctness”** — cadence may reduce time-to-finding without changing the authoritative obligation set. Correctness or defect-prevention claims require a preregistered fault corpus or live controlled comparison. +- **“MCP availability proves efficacy, efficiency, or adoption”** — wire conformance is only the first rung. Require a reference-host Spec 0.2 cycle for efficacy, an equivalent-task A/B for efficiency when used, and voluntary pull telemetry for adoption. +- **“A fixture signature, legacy L3/L4 history, or host smoke is live human L4 evidence”** — fixtures prove protocol/mechanism only. The 0.10.0 MCP11 cycles are real host cycles against a real issuer, but their confirmation step was answered by automation on the maintainer's instruction, so they are not evidence that a person answered a prompt, and not evidence about either host's elicitation form. + +## Rejected decisions + +Do not reopen these without new evidence that invalidates the stated reason. + +| Rejected | Reason / reopen condition | +|---|---| +| Tier-named spec directories | Tier is mutable and path changes would break consumers. Reopen only with a path-independent external standard and measured migration benefit. | +| Rename `modules` or `depends_on` | Adds vocabulary migration without removing an active ambiguity. Use Soft Shell descriptions instead. | +| Rename the scenario concept to journey | Scenario is established and unambiguous as a user-journey artifact; only its field grammar changes. | +| Add `interface` criterion kind | No consumer or distinct enforcement exists. | +| Six-axis assurance taxonomy | Existing verdict/disposition surfaces already separate outcomes; add only when a concrete consumer cannot express a needed distinction. | +| Persist `traceability.yaml` | Authored-edge projections and reverse edges are live IR and would otherwise become stale committed copies. | +| Runtime `L ∪ N` capability edges | Creates two simultaneous authorities. Comparison is upgrade-preview-only. | +| Allow multiple `shall` modals | Violates atomic AC and case-level binding granularity. Split the AC. | +| Automatically write inferred dependencies | Current candidate graph can introduce large cyclic components. `dependency.promote` remains explicit and cycle-checked. | +| ~~Move existing generated files in 0.10~~ — superseded 2026-08-29 | Original rationale: registry and aliases must land before movement. F11 now satisfies that condition, then relocates only the three projections separately from schema migration with D14 state/recovery fixtures. | +| Enforce `relocation_required` in 0.10.0 — deferred 2026-09-05 (F11-lite) | 0.10.0 ships alias-aware resolution, the generated-directory notice, and opt-in `clad relocate-generated [--apply]` only. Forcing adopters off the pre-relocation layout has no measured need yet; entry condition for enforcement is adopters relocating in practice. `clad init` scaffolding of the relocated layout follows the same condition. | +| Generic filesystem/JSON-Patch MCP editor | Cannot provide domain invariants or honest write-set calculation. | +| Automatically classify legacy ACs as behavior | Converts meaning without evidence. Use `legacy_unclassified` until the node changes. | +| Guess test selectors for path-only refs | Manufactures proof. Use the accepted node-level baseline fallback. | +| Claim duplicate elimination proves correctness | Omission, stale evidence, unobserved behavior, and concurrency remain independent failure classes. | +| Persist a graph or vector index as authority | Live compiler IR already has deterministic identities and exact links; another store adds freshness and opaque-retrieval failure modes. | +| Preserve a v1 graph compatibility serializer | It would keep kind twins and criterion loss alive as a second public model. Cut the graph surface atomically. | +| Change frozen `clad_get_context` to resemble GraphIR | It is a distinct accepted wire contract, and pull adoption is not confirmed. Use per-surface versions. | +| Use generic undirected BFS as the default query | Direction and containment semantics matter, and the corpus simulation shows depth-2 token blow-up. | +| Require a fixed planner→developer→reviewer→observability topology | Host orchestration is already the shipped contract, and deterministic guarantees must not depend on general persona membership. Reopen only if an ablation proves a necessary negative capability. | +| Delete the specialist role briefs | They are optional interface manuals and their wording has changed agent interpretation. Remove a brief only after a committed ablation shows that no supported host or contract loses needed guidance. | +| Add an F7.5 `clad_get_context` v2 | `clad_get_context` v1 stays frozen throughout 0.10; F8 versions the graph surface only. A future context successor needs its own adoption and compatibility decision. | +| Treat raw `blind: true` or a free-form human claim as verified evidence in 0.2 | A Boolean assertion cannot prove isolation or a human channel. Require a receipt from a supported adapter and preserve unverified input as asserted history. | +| Treat TTY/pseudo-TTY presence or hand-written receipt YAML as verified | The process cannot prove user presence or a trusted issuer from workspace-controlled input. Bare `clad signoff` is asserted; verified paths require an offline-verifiable external signature. | +| Perform network identity lookup during a strict gate | Violates synchronous deterministic gating and makes old commits depend on remote state. Verify pinned signed receipts offline; online integrations may issue portable proof at ingestion only. | +| Embed evidence receipt bodies in attestation | Creates a second receipt authority and merge surface. Keep immutable receipts under `spec/evidence/`; attestation seals their current identities and closure only. | +| Put workspace schema markers in child spec documents | Mixed selectors permit partial interpretation. `spec.yaml#schema` is the single workspace switch; `receipt_schema` versions only the independent receipt protocol. | +| Add `feature.unarchive` to the mutation API | Archive is an integration-terminal historical decision. Correct mistakes through VCS before integration instead of adding a second lifecycle transition with unclear proof semantics. | +| Use feature `contract_sha256` for every criterion receipt | Sibling criteria would invalidate unrelated proof. Bind criterion receipts to their subject closure and keep the broad hash for feature attestation. | +| Seed impact from every declared feature module | Shared modules amplify one focused edit into dozens of unrelated owners and dependents. Seed from predicted/observed write scope; keep module fan-out lazy when scope is unknown. | +| Use one revision for both context reuse and writes | Projection retention and byte-level write concurrency are different claims. Keep `context_revision` and `input_revisions` separate. | +| Apply one payload ceiling by content class or by a two-task aggregate | The measured 27,854-byte value combines implement and verify and made the former wording ambiguous. Enforce 16/24 KiB per task profile after operation-scoped packing; do not raise a class limit from an aggregate. | +| Make an atomicity heuristic blocking | One modal does not ensure one obligation, while length/conjunction heuristics also flag valid prose. Keep the hard grammar deterministic and the semantic risk advisory. | +| Defer all cleanup to a final cleanup-only phase | Superseded authorities would coexist through several features and become new dependencies. Retire them in the same proven cutover cycle; keep F1 additive by design. | +| Require monotonically lower LOC or a monotonically higher test count | Both reward the wrong proxy. Require one authority, no unjustified orphans, preserved behavior, and discriminating replacement tests. | +| Delete compatibility or historical paths before a replacement is adopted | Absence of a static import does not remove spec, entrypoint, generated, runtime-lookup, or external obligations. Apply the D18 deletion proof after consumer cutover. | +| Run the full gate after every edit | It multiplies active wait, executes environment/HITL work at the wrong boundary, and encourages hook bypass without strengthening the eventual authoritative obligation set. Keep bounded interactive feedback and one profile-complete completion reduction. | +| Make local hooks or a local background worker the sole authority | Local surfaces are optional, bypassable, and may lack the release environment or verified evidence channels. They reduce latency; completion, protected push, and release profiles retain authority at their declared boundaries. | +| Treat the number of registered stages as the Iron Law theory | The upstream draft defines 13 standard stages, while Cladding ships two extensions. Theory belongs to obligations, cumulative profiles, freshness, and failure reduction; preserve runner IDs only as compatibility/reporting surfaces. | +| Defer the persistent assurance scheduler to 0.10.x | 0.10.0 ships without the scheduler and behaves as `off`; the accepted design keeps `auto` and `off` verdict-equivalent when it lands. Single-flight, stale-result rejection, cancellation, resource locks, and cache-key invariance are release gates; background availability never becomes proof authority. | +| Make MCP a second compiler, graph, or verdict authority | CLI, MCP, and in-process entry points must share domain kernels. Transport-specific facts would create exactly the drift Spec 0.2 removes. | +| Require MCP resources, prompts, subscriptions, or sampling for correctness | Supported tools-only hosts would lose the cycle, and optional delivery would become an authority. These surfaces may optimize use but cannot weaken the tools-only path. | +| Cut over to a task-scoped MCP catalog from byte reduction alone | Smaller metadata does not prove tool discoverability, equivalent task success, or adoption. Require the preregistered host A/B and dynamic-discovery controls. | +| Keep the evidence-ledger label as the schema 0.2 completion label — rejected 2026-09-07 | The ledger reads any human-authored evidence entry as `independent`, so the person who implements a feature and then signs it flips their own label, while the kernel that attests the completion compares the receipt issuer against the implementation authors and calls the same completion `self-certified`. A schema 0.2 completion therefore reports and enforces the attested scope label: `require` refuses `self-certified` and `unobserved` and keeps `independent` and `not-applicable`. The label is not sealed into the completion event, because it exists only after the gate that consumes that sealed event, and the event validator accepts neither of the two added values. Schema 0.1 keeps the ledger label unchanged. | + +## Evolution queue + +These are intentionally outside the 0.10.0 core and may evolve independently. + +| Item | Entry condition | +|---|---| +| ~~Move `index`, `_doc-links`, and `attestation` into `spec/generated/` (0.11)~~ — superseded 2026-08-29 | Original entry condition: registry aliases, old/new reader fixtures, and measured compatibility green. F11 satisfies it in 0.10.0, then owns relocation/recovery. | +| Additional test-framework adapters | Each adapter has source→selector→JUnit round-trip fixtures and a real adopter. | +| Executable scenario verification | A scenario runner or binding carrier exists; only then may `scenario_policy: required` imply runtime proof. | +| Authoring-provider bridge, including Spec Kit input | The canonical IR is stable and a provider can map without weakening identity, proof, or transaction contracts. | +| Advisory semantic comparison | Deterministic compiler is complete; LLM comparison remains labelled advisory and never defines GREEN. | +| Cost and false-block benchmark | F1–F6 land and the preregistered new benchmark can compare 0.1 and 0.2 maintenance. | +| Broader LLM GraphIR retrieval study (40 tasks is the current scale candidate) | AB01–AB12 has first established task-scoped efficiency-when-used; a separately preregistered expansion may test generalization without altering adoption telemetry. Target: optional 0.10.x. | +| OS secure-store issuer keys (Keychain, Credential Manager, Secret Service) | F9d's file-key issuer is in real use and a live adapter round trip exists on all three platforms. Until then a private key is an owner-only file and D20 states that threat model plainly. Target: 0.10.x. | +| Blind capability issuer adapter | A host can emit a portable proof that a capability manifest was enforced. Without one a signed blind receipt adds no epistemic independence over the asserted `clad_author_oracle` record, so `blind: true` stays asserted-only. | +| Viewer proof-detail polish and public graph cursor/`not_modified` support | The minimum v2 viewer/export cutover is stable; add only against a measured payload or navigation need. F9's session-bound diagnostic continuation is not this public surface. Target: 0.10.x. | +| ~~F10 task-state headless loop (0.10.x)~~ — superseded 2026-08-29 | F10 ships in 0.10.0 after its stated F9 prerequisites. | +| F10 headless loop — retired 2026-09-05 | Measurement on 2026-09-02 found zero loop runs across 5,176 recorded events over 3.5 months, no README mention, and no automatic invocation, so 0.10.0 removes the loop instead of dispatching from it. Under D18 hygiene the retirement takes the loop-only adapters, the run skill and verb, nine loop-only features (archived with their criteria kept as history), and rebinds eight features that also own surviving code. The host-delegated cycle owns execution; there is no successor loop to gate. | +| F9c persistent scheduler — deferred to 0.10.x (2026-09-05) | 0.10.0 `clad serve` runs no anticipation and behaves as `off`. Entry condition for 0.10.x: an A/B/C replay fixture measuring at least a 50 percent reduction in active wait with p95 latency within 10 percent. Same-commit test-ledger reuse already ships in the test-run cache; the descriptor cache (skipping Type/Lint re-runs) is unmeasured and defers with it, and `.cladding/cache` is not built. | +| ~~Generated-file physical migration~~ — superseded 2026-08-29 | Original condition: do not combine it with schema migration. F11 satisfies this as the separate 0.10.0 relocation feature. | +| Receipt-carrying verification closure for the seal, receipt-free for the expected digests (2026-09-07) | The run authority and the attestation writer must seal the identical closure, and a verified receipt is one of its inputs, so both now include it. The expected-digest producer and the independence inputs deliberately stay outside it: a receipt whose `reviewed_inputs_sha256` came from a receipt-carrying closure would depend on itself and on its siblings and could never stay verified. Considered and rejected: dropping receipts from the writer instead, which would have made a filed review invisible to the record it is evidence for. | + +## Change log + +Moved to [change-log.md](change-log.md) (append-only). diff --git a/docs/design/spec-0.2/delivery.md b/docs/design/spec-0.2/delivery.md new file mode 100644 index 00000000..42c00cfe --- /dev/null +++ b/docs/design/spec-0.2/delivery.md @@ -0,0 +1,173 @@ + + +# Spec 0.2 — delivery and acceptance + +> Canonical owner of D15 and D16. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## D15 — Implementation sequence + +> Implementation-cycle trace: `feature:F-208eaa79` is the F8 implementation shard for this accepted delivery sequence; D15/D16 remain the normative authority. + +**V0 and F1–F11 ship in 0.10.0:** V0 adds validation ledger, simulator, token accounting, and D24 wire/efficacy. Targets remain `implementation_pending`; it proves neither preregistered cases nor host E2E, and challengers await owner/log update. + +Follow one feature cycle at a time; author each shard immediately before implementation. + +F1 bootstraps under 0.1 because F2 adds the 0.2 reader. Its shard uses EARS/`text`, WHY in `notes: "## Why\n..."`, and D10/D17 links; it must not pre-author 0.2 `purpose`, `statement`, or `kind`, then migrates normally. + +F1 uses an independent sorted source-YAML snapshot oracle, without production loader/index/GraphIR/query imports. The additive compiler proves parity while consumers stay unchanged and failure local. + +1. **F1:** commit design, artifact/ID registries, GraphIR v2 skeleton, and node baseline. Preserve stale `hash6` as a parity negative until registry policy, then repair before completion. +2. **F2:** version dispatch, strict parser, atomicity advisory, total legacy scanner, and preview. +3. **F3:** project, feature-capability links, catalog, and architecture 0.2; prove `L = N` in memory without cutover. +4. **F4:** `clad_edit_spec`, `feature.begin`/`clad begin`, context/input revisions, lock/recovery, journaled apply, and adapters. +5. **F5:** proof adapters, covers/case observations, legacy fallback, receipt protocol/ingestion/revocation, asserted `clad signoff`, and detector rewiring. Test issuers prove protocol; no verified product issuer ships here. +6. **F6:** shared closures, the [D21–D23](assurance.md#d21--iron-law-assurance-kernel) DAG/reducer, legacy 15-stage projection, profile-aware `clad done`, and v3. +7. **F7:** scenario v2 and `off | advisory | required`, then accept/reject the narrow L2 baseline before atomic self-migration; complete F7 on 0.2 and write pure-0.2 v3. +8. **F8:** atomically cut graph CLI/JSON, exporters/viewer, and `clad_get_graph` to GraphIR v2; retain no v1 adapter. +9. **F9:** ship `CycleContextEnvelope`, task projections, a registered file-key human issuer, and A–E; the persistent scheduler defers to 0.10.x. +10. **F10:** retired. 0.10.0 removes the unused headless loop instead of dispatching from it. Viewer polish/broader retrieval remain tail work. +11. **F11 (lite):** add aliases and opt-in `clad relocate-generated [--apply]`; self keeps old paths; prove D14 state/recovery. + +There is no F7.5 context-wire migration; F8 is the graph-v2 cutover. F11 does not retroactively block F7–F10 completion, but 0.10.0 needs applicable F1–F11 evidence. Standards, docs, glossary, and generated mirrors update in their owner feature. + +### Cutover and retirement map + +F1 is the same-cycle-retirement exception: additive parity deletes no shipped compiler, loader, graph, detector, or optimizer path. From F2, each cycle inventories superseded authority and retires it after proven cutover. + +| Boundary | Required retirement after cutover | +|---|---| +| F4 transactional writer | Move direct shard/status mutation in `src/spec/new.ts` and `src/cli/done.ts` behind the transaction engine. Remove forwarding-only or second-writer logic once existing commands are thin domain adapters; retain 0.1 reading, not a second write authority. | +| F5/F6 proof compiler | Remove duplicate reference normalization, binding joins, and proof-closure calculations after detectors, report paths, and attestation consume the shared implementations. Keep legacy references as input compatibility, not as a parallel proof model. | +| F8 GraphIR cutover | Retire graph v1 identities, reverse-index materialization, undirected/repeated traversal, and tests that assert those obsolete internals. CLI, MCP, report, impact, working-set, export, and viewer paths become queries or serializers over GraphIR; no v1 adapter survives. | +| F9 context-envelope implementation | Retired in F9a: the F-041/F-063 contracts are revised onto `src/optimizer/envelope.ts`, and `src/optimizer/preamble.ts`, `src/optimizer/tail.ts` are deleted with their tests now that the packer covers omission, tail, budget, and fixed-point behavior. | +| F10 task-state loop | Retired in 0.10.0 with no successor loop: the headless loop, its loop-only adapters and skill, and the nine loop-only features go after measurement found no recorded run. Product transport fallbacks remain until their own compatibility contracts are revised. | + +A path survives only with a distinct public/compatibility contract and recorded feature-rationale/test exit condition. There is no permanent retirement manifest or cleanup-only release phase. + +Each cycle is simulation → implementation → verification → `clad done`. Feedback compiles without subprocesses; checkpoint checks changed inputs; `clad done` checks proven closure and escalates unknown scope to repository. Push/release are integration boundaries. Exact-digest reuse is allowed; background never writes lifecycle/attestation. Rebuild mirrors before completion and run contributor push checks. + +## D16 — Acceptance gates + +Corpus gates compare sorted semantic records, not hand-maintained totals. The independent snapshot records owner, composite address, channel, raw/normalized ref, selector, resolution, path, YAML path, and range; counts are derived. Edits update the reviewed diff, never a second literal total. [Evidence snapshot](evidence.md#evidence-snapshot) totals are dated evidence, not acceptance constants. + +### Compatibility and grammar + +- Every feature and criterion record in the canonical self-corpus snapshot compiles as 0.1 with an identical owner, address, source locator, and unchanged blocking result. +- New strict parser fixtures cover five patterns, compound ordering, comma rules, a single modal, negation, protected spans, fragments, and unbalanced spans. +- `ATOMICITY_RISK` reports its observed advisory signals on a one-modal multi-obligation control, while a long atomic control proves that any heuristic false positive remains non-blocking under strict mode. +- Property tests show the legacy scanner returns `parsed | opaque | conflict` and throws zero times for arbitrary strings. +- Unknown schema versions hard-fail before artifact merging. +- `spec.yaml#schema` alone selects workspace schema. Child `schema` fields and mixed 0.1/0.2 spellings are rejected in 0.2; independent `receipt_schema` dispatch cannot switch workspace interpretation. + +### Migration + +- Preview requires `PROJECT_LEGACY_L2_BASELINE: accept | reject`, separately from assurance confirmation, and reports the deterministic done-source criterion count and digest without historic-stage, ref, agent-claim, or L2 inference. Reject writes no authorization. +- Accepted atomic apply writes immutable criterion-local, done-source L2 Unit/Coverage authorizations with final-intent and candidate/resolution SHA-256 identities. Reviewed-migration strict intent is eligible and becomes its immutable target; only post-migration new/later-target-edited criteria are ineligible/revoked, while unchanged siblings survive feature edits. +- Exact live/reviewed/legacy selectors and registered static rules take precedence (pass/fail/skip/absent/stale/unsafe); path-only historic refs alone may qualify, but unrelated same-file passes and global fan-out never do. +- Capability edge cutover proves `L = N` before schema switch. +- F3 performs that proof without disk cutover; only F4's journaled apply may remove legacy child `schema`/`source`, write new edges, and switch the root schema. +- A feature with no legacy capability edge receives an explicit empty `capability_refs`; suggested candidates never enter the applied candidate without human confirmation. +- Unresolved preview and normal failure write zero bytes. +- Before F11, migration keeps old paths canonical so F7–F10 complete. The final F11 engine leaves adopters 0.2+old and names separate relocation. +- Dirty planned paths refuse either apply while unrelated dirt remains allowed; receipts bind preflight HEAD and sorted paths. +- In the final F11 engine, 0.2+old is `relocation_required`: read/diagnose/relocate only, profiles unresolved. 0.10.0 defers that enforcement and keeps 0.2+old supported. Both paths conflict; an active journal is recovery-only. +- Crash recovery is byte-exact or finishes the recorded transaction; exact-path VCS restore is the escape, and a second successful apply is zero-diff. +- The F7 self-migration proves preview-on-0.1, human resolution, one atomic apply, post-switch `clad done`, and pure-0.2 v3 output; F8 begins from that real 0.2 tree. + +### Binding and proof + +- Adapter fixtures restore and prove source carrier → normalized selector → runner/JUnit testcase → composite criterion round trips; a parser defect (including dropped Vitest `ancestorTitles`) cannot be baseline-laundered. +- Bare IDs produce no bindings; unknown addresses block. +- Unrelated same-file passes, skipped-only cases, mixed pass/fail, and multiple valid bindings follow D11 exactly. +- A fresh preregistered benchmark contains nine valid bindings plus unbound, unknown, unrelated, skipped, and failing injections. Do not call it a reproduction of the old 34-feature run without its raw fixture. +- A verified criterion Audit receipt satisfies only its matching Audit obligation. One verified feature UAT receipt may satisfy all matching UAT obligations only when its signed matrix contains every current composite criterion and every row plus both feature checks passes; a verified blind receipt may satisfy independence but never UAT. +- A generic MCP `blind: true`, a free-form human claim, same-author review, and receipt-free legacy evidence do not gain verified 0.2 status. +- With project scenario policy `required`, every scenario referencing the parent feature contributes its ID and intent fields to every criterion subject in that feature. Changing that set or intent stales those receipts; `off | advisory`, unrelated scenarios, and sibling criteria do not. No receipt transfers to another address or hash. +- Receipt fixtures verify RFC 8785 serialization, the `cladding.receipt/1` length-prefixed domain frame, detached Ed25519 signatures offline with a pinned out-of-workspace key, full-digest filenames, subject-derived feature directories, create-only writes, and exact revocation. Missing trust or a network-only verifier is unresolved/asserted and never GREEN proof. +- Bare TTY and pseudo-TTY signoff, hand-written receipt YAML, caller strings, and OS/git identity remain asserted. A terminal prompt or host elicitation form in which a human re-enters the feature id produces a portable verified human receipt; absent that confirmation, a registered issuer, or a local signing key, verified signoff returns `HUMAN_REQUIRED`. +- A human receipt becomes stale when its subject, reviewed inputs, complete runtime-dependency byte/sentinel closure, implementation-author set, trust snapshot, or signature changes. A direct feature-module edit is only one member of that closure. Two branches adding different content-addressed receipts merge with both files preserved; deleting one is possible only through explicit revocation. +- A blind receipt contributes independence only with a current matching testcase pass and never clears UAT. A past pass, skipped-only observation, or unexecuted generated test is insufficient. + +### Transactions and attestation + +- `feature.begin` covers `planned | blocked | done → in_progress`, idempotent `in_progress`, archived/unknown refusal, and a begin-plus-intent-edit batch. Every successful transition has exactly one recoverable pre-batch checkpoint; every refusal or interrupted rollback leaves the shard, inventory, and event stream at the specified boundary. +- Schema 0.2 `clad done` rejects every source status except `in_progress` without running a completion transition; the 0.1 compatibility fixture preserves shipped behavior. +- Schema 0.2 completion gates an in-memory prospective `done` state and has no durable pending marker. A successful final journal atomically contains the feature, its required projections, v3 receipt, and successful completion event; every non-success path leaves those canonical artifacts unchanged. +- Parallel different-shard edits both succeed; same-shard second edit is stale; lock timeout is BUSY and writes nothing. +- A matching `context_revision` cannot authorize a write with stale `input_revisions`; same-session delta reuse and region write concurrency are tested independently. +- Inventory-region writes do not stale project-region revisions. +- Attestation matrix covers contract, implementation module, out-of-module test, runner configuration, oracle, evidence, capability outcome, architecture constraint, notes, and required/advisory scenario changes. +- Only the intended feature set becomes stale for a shared rule/outcome/scenario change. +- F6's pre-migration v3 fixture serializes exact schema-0.1 contract nodes without invented purpose/kind; F7 migration intentionally stales them and rewrites pure-0.2 hashes. +- v3 fixtures prove baseline-basis hashing, required/pass/na/migration-baseline counts, receipt/resolution/authorization identity sealing, current-observation-only identities, passing scope Unit/Coverage authority, freshness/retention, and public count disclosure. +- Lifecycle operations cover block reasons, terminal archive/no-unarchive policy, proof-ref edits, exact receipt revocation, and `set_links` omitted-versus-empty semantics. Both bulk link replacement and dependency promotion reject self, duplicate, unresolved, and cyclic dependency states. + +### Assurance profiles and cadence + +- The same compiled obligations yield identical authoritative verdicts through legacy stage projection, profile execution, and split/merged runner adapters. +- Fixtures distinguish upstream `hard | report` strictness from effective Cladding blocking: a reporting failure completes the standard report but remains RED under the default strict profile, while a missing report is unresolved in both. Shipped `advisory` remains a distinct blocking disposition. +- Feedback is non-authoritative and bounded to pure checks; completion is feature/impact scoped; push is branch-integration scoped; release is whole-repository. Required unobserved, timeout, pending environment, or stale results never become GREEN. +- Authored and observed dependency edges both invalidate proof. Ambiguous edges fan out to every candidate; dynamic, unresolved, unowned, or otherwise incomplete scope escalates the affected layer to whole-repository verification. +- A/B/C replay compares every-edit full execution, tiered foreground execution, and tiered plus background execution. Authoritative verdicts must match, stale background PASS promotion is zero, injected required defects are caught before completion, and active wait falls by at least 50% without increasing foreground p95 by more than 10%. +- Background adapters require isolated outputs and cooperative cancellation, run single-flight per worktree, yield to foreground, and publish only exact-digest cache entries. CI/release ignores local background cache. +- Cladding persists L2 after migration and its self release attestation remains L2. Legacy history grants no L3/L4 waiver; a stronger one-run feature completion requires a compiler-proven bounded closure. +- Each applicable required scope Unit/Coverage family needs current pass; compiler-proven non-applicability is NA. A baseline-backed family is RED on fail and unresolved on skip/missing/stale. Baseline resolves only unchanged authorized L2 Unit/Coverage criterion rows, never Oracle, L3/L4, or human/system-quality obligations; legacy projection maps it to unobserved, never pass/NA. + +### Graph validity and bounded retrieval + +- Every authored Spec 0.1/0.2 fact round-trips through GraphIR without changing its owner, address, selector, or provenance. +- The independent scanner and GraphIR return identical prerequisite, dependent, artifact-owner, criterion-proof, and regression record sets across the self corpus and generated fixtures. +- A path with several roles is one artifact node; a path with several feature owners never chooses one owner silently. +- Unknown, unresolved, stale, skipped, and unobserved are explicit states, never empty-success aliases. +- Impact fixtures seed traversal from predicted paths before editing and observed diff paths afterward. Unknown scope remains incomplete; expanding every declared feature module is a negative control and must not become the default. +- Fixture, command, file, test, oracle, and evidence references preserve their raw authored spelling as well as their normalized target and resolution state. No missing target is silently aliased to a nearby artifact. +- The `clad_get_graph` payload measures the final serialized response, including schema metadata and omission counts. It never defaults to an unbounded walk. +- Context fixtures independently account for payload, resident, and total UTF-8 bytes, prove `total = payload + resident`, label cold/warm/unknown cache state honestly, and remeasure after budget metadata reaches a fixed point. +- The sorted full MCP list surface and each task-profile challenger have separate reviewed byte ratchets and explicit serialization scope. A task payload ceiling cannot be reported as a total-context ceiling, and an unproven host cache cannot be reported as warm. +- Task-profile ceilings are enforced on fixed-point serialized bytes: 16 KiB for spec-edit/verify/observe and 24 KiB for implement/blind-oracle. Spec-edit fixtures derive required content from the typed operation; no global migration corpus is sent as a task packet. Every self-corpus case has `required_overflow: false` without truncation. +- Verification packets retain criterion, state, selector, and locator/digest before optional failure-first diagnostics. A `diagnostic_cursor` works only in the same session/revision and is neither a public graph cursor nor a `clad_get_context` v1 change. +- Removing criterion nodes, selectors, provenance, direction-aware traversal, purpose, or rationale must make its corresponding ablation fixture fail. +- A 5,000-feature synthetic graph remains linear in nodes plus edges and completes within the repository's existing 15-second CI scale ceiling. Reference targets are at most 500 ms for a cold self-corpus compile plus graph build and 50 ms for a warm focused projection; report these as environment-specific benchmarks, not portable guarantees. + +### Preregistered 37-case contract matrix + +These are new test obligations, not evidence that an earlier session ran “37/37.” Each ID maps to exactly one test title: + +- **P01–P10 parser:** ubiquitous, event, state, optional, unwanted+then, compound order, negation, protected modal, multiple-modal rejection, fragment/unbalanced rejection. +- **L01–L04 legacy:** parsed, opaque, conflict, arbitrary-input no-throw. +- **B01–B06 baseline:** title/purpose trigger, criterion add/remove, statement/kind trigger, rationale/constraint trigger, non-trigger fields, sibling-exemption/live-baseline exclusivity. +- **C01–C06 covers:** bracket token, bare ID ignored, unknown address, unrelated same-file, skipped-only, failure dominance/pass verification. +- **T01–T04 transaction:** different shards, same-shard stale, BUSY no-write, crash recovery. +- **U01–U04 upgrade:** unresolved no-write, `L = N`, atomic apply/zero-diff, interrupted restore-or-finish. + +At the F6 boundary, the active fixture ledger names P01–P10, L01–L04, B01–B06, C01–C06, T01–T04, U01–U04, and A01–A03. These are executable obligations, not a runtime pass count; F7 scenarios, F8 public GraphIR cutover, relocation, and reference-host cycles were pending, the F9 scheduler/cache paths are deferred to 0.10.x; the F9d issuer path is validation-active. +- **A01–A03 attestation:** selective contract stale, proof-input stale, target-versus-sibling receipt freshness. + +### Repository gates + +- Run `npm run validate:spec-0.2`; a `fail` blocks immediately, while each feature/release boundary explicitly promotes the pending/not-run scenarios it owns to required pass conditions. +- Keep the D24 MCP scenarios distinct: deterministic wire/semantic/mutation parity plus Codex and Claude Code MCP11 full L4 cycles block 0.10.0; adoption and efficiency do not. +- AB01–AB12 is a Codex-only, at-most-24-call, non-blocking efficiency comparison. +- Keep J01–J13 and AB01–AB12 unique in the executable ledger. A passing model simulation may challenge a design alternative but cannot satisfy a journey labelled implementation-pending or not-run. +- Commit the full preregistered fixture matrix before claiming it as evidence; self-consistency rejects missing, duplicate, or unmapped IDs. +- Build the committed plugin mirrors before F1 completion and require the build to produce no uncommitted mirror drift after regeneration. +- Use `clad done` as the one authoritative feature-completion strict gate and attestation refresh; do not duplicate the same full gate on an unchanged tree. +- Cover legacy profile aliases with fixtures. Run the final release gate exactly once: `node bin/clad check --profile release --strict`; do not repeat the full gate through an alias. +- Register newly shipped public terms in the glossary and keep detector-count/self-consistency checks green. +- Run the D19 A–E topology/context suite as F9 acceptance and prove that removing general persona prompts changes neither contract, deterministic gate, verdict, nor stale scope. F5 fixtures must accept valid portable receipts and reject bad signatures/trust; F9 adds the real signed human production path while preserving the asserted fallback; the blind capability adapter is deferred. +- F9–F11 minimally fixture the issuer, L4 closure, and relocation mechanisms. Live human evidence is only a real human-signed receipt in each Codex and Claude Code MCP11 cycle; deterministic trust snapshots are protocol/mechanism evidence. +- Release notes make the public README decision explicit: Cladding is self profile-complete at persisted L2; L4 product mechanism and host evidence is reported separately. This design does not change current README assurance claims. + +### Supersession, documentation, and test gates + +- Compare the post-cutover source graph with artifact-registry entrypoints, package/bin/hooks, runtime lookups, generated consumers, and spec-owned paths. A production orphan is either removed in the same cycle or has an explicit contract owner and retirement boundary; it never enters an anonymous permanent allowlist. +- Prove that no consumer imports or reconstructs the superseded authority. Compatibility readers may remain, but compatibility must not preserve a second writer, closure, graph identity, or traversal implementation. +- Replace tests of retired internals with contract, oracle, property, or adapter tests before deleting them. Test count and line count may decrease; preserved behavior and fault discrimination may not. +- When the reported public test total changes, regenerate its canonical claims through `scripts/test-count.mjs --write` instead of hand-editing copies. +- Keep this continuation router at or below the 8 KiB hard ceiling and each routed design owner at or below 24 KiB. Maintain a 7.5 KiB operational router ratchet for editing headroom. D01–D24 each have exactly one normative owner, former router anchors remain navigable, and repository-relative links resolve. +- Measure fresh-session context as exact UTF-8 bytes for `AGENTS.md` + router + current task owner documents. Evidence and decision history are on-demand inputs, not a default payload; compare this routed baseline with the former monolith before claiming token savings. +- If `_doc-links.yaml` changes shape, its writer, extractor, GraphIR reader, `DOC_REFERENCE_INTEGRITY`, sync idempotence, and downgrade/regeneration fixture cut over together. + + + +D18 moved to [Implementation hygiene](hygiene.md#d18--implementation-hygiene-and-documentation-surface); this pointer is non-normative and preserves the former owner-document anchor. diff --git a/docs/design/spec-0.2/evidence.md b/docs/design/spec-0.2/evidence.md new file mode 100644 index 00000000..2d1fd6a6 --- /dev/null +++ b/docs/design/spec-0.2/evidence.md @@ -0,0 +1,237 @@ + + +# Spec 0.2 — evidence snapshot + +> Canonical measurement record supporting the accepted design. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## Evidence snapshot + +All values below are **verified measurements** of the repository on 2026-08-28 unless labelled otherwise. Re-run them at implementation start; they are a design snapshot, not permanent invariants. + +### Reproduction rules + +- Corpus counts parse the sorted YAML shards and count typed records, never filenames or grep hits as semantic objects. F1 replaces the ad-hoc script with its committed independent scanner snapshot. +- Source `@see` counts use the exact pattern `@see\s+spec/features/` over `src/**/*.ts`; broader `spec/features/` searches intentionally find unrelated compiler references. +- A legacy test ref is resolvable only when its normalized repository path exists; occurrences and unique targets remain separate measures. +- Module fan-out parses each feature's `modules` list, normalizes paths, and counts distinct feature owners per path. +- Role-brief measurements include the six role Markdown files under `src/agents/` and exclude `src/agents/README.md`. + +Any implementation-start difference is reviewed as a sorted record diff with a per-record cause; do not reconcile it by changing a literal expected total. + +### Intent and AC representation + +| Measurement | Value | Design consequence | +|---|---:|---| +| Feature shards | 281 | Migration and compatibility corpus. | +| Acceptance criteria | 1,118 | Migration and grammar corpus. | +| Feature `purpose` | 0/281 | A typed WHY home is genuinely absent. | +| ACs with `notes` | 306/1,118 (27.4%) | WHY leaks into an optional non-normative field. | +| Features with `design_impact` | 20 | Keep governance metadata but do not confuse it with default WHY. | +| Scenarios | 2 | Both lack actor in the 0.1 model. | +| ACs with `text` | 1,118 | `text` is the only universal migration source. | +| ACs with `action` | 830 | Structured fields are incomplete. | +| ACs with `response` | 839 | Structured fields are incomplete. | +| ACs with `condition` | 543 | Structured fields are incomplete. | +| Text-only ACs | 130 | Deriving text from structured data would lose contracts. | +| Current structured rendering matching text | 44/830 | Do not regenerate legacy statements from the triplet. | +| One `shall` modal | 1,023 | Most current text is close to atomic surface grammar. | +| Multiple `shall` modals | 95 | Strict-new must reject; legacy remains grandfathered. | +| Mixed-polarity multi-modal | 21 | The earlier 98.2% acceptance figure mainly tolerated positive compound modals and is not the strict-new target. | +| Simple pattern/leading-keyword conflicts | 22 | Do not freeze a claimed 19 without explicit per-case opaque exclusions. | + +The current [`src/spec/ears.ts`](../../../src/spec/ears.ts) validates legacy `condition` fields and uses a different complex ordering from the upstream grammar. It is evidence for version dispatch, not the implementation to reuse unchanged. + +### Identity and sharding + +| Measurement | Value | Design consequence | +|---|---:|---| +| Distinct AC ID strings | 742 across 1,118 ACs | AC IDs are feature-scoped. | +| AC occurrences using a duplicated ID | 402 | External binding requires the composite address. | +| `AC-001` occurrences | 72 | Bare-AC test binding would be unsafe. | +| Feature body slugs | 201 | All 201 match their filename slug. The redundant body field can be removed mechanically when the filename is valid. | +| Legacy `F-NNN.yaml` shards | 80 | Continue 0.1 reading. | +| Six-hex filename shards | 95 | Continue 0.1 reading. | +| Eight-hex filename shards | 106 | Production already emits the target form. | + +Current production emits eight hex characters in [`src/spec/new.ts`](../../../src/spec/new.ts). Historical compatibility material may name hash6; the executable ID registry owns current reader and writer wording. + +### Compiler bootstrap and reference resolution + +Dependency counts below use Madge's resolved import graph. “Production” scans `src`; “repository TypeScript” scans `src`, `tests`, and `conformance`. They measure dependency centrality, not a prediction that every dependent file must be edited. + +| Measurement | Value | Design consequence | +|---|---:|---| +| `src/spec/types.ts` production dependents | 56 direct; 95 transitive | Replacing the central type surface before parity has a wide production blast radius. | +| `src/spec/load.ts` production dependents | 33 direct; 58 transitive | Keep the first compiler additive instead of cutting over the loader. | +| `src/spec/types.ts` repository-TypeScript dependents | 85 direct; 265 transitive | Tests and conformance substantially enlarge the validation surface. | +| `src/spec/load.ts` repository-TypeScript dependents | 52 direct; 189 transitive | Loader replacement belongs after compiler parity, not before it. | +| Registered default drift detectors | 41 | Count entries in `allDetectors`. The directory has 44 TypeScript files: 41 detector modules, `index.ts`, and the two shared helpers `with-spec.ts` and `spec-first-window.ts`; file count is not catalog authority. | +| Source-locator prototype | 281/281 features; 1,118/1,118 criteria; zero parse errors; 60.96 ms | A provenance-bearing envelope is feasible over Spec 0.1 without changing `loadSpec`. | +| Evidence-reference occurrences | 349 total: 281 file-style, 52 `fixture:`, 16 `self-dogfood:` | Keep channel and raw spelling; one generic path counter is insufficient. | +| Fixture addresses | 52 occurrences; 45 unique; all registry-resolved | `conformance/fixtures.yaml` can supply stable anchors without inventing proof observations. | +| Self-dogfood addresses | 16 occurrences; 14 unique; 13 exact package-script targets; one unresolved unique target | Missing commands remain explicit; nearby command names are not aliases. | +| File-style evidence addresses | 281 occurrences; 279 resolve; `agents/` and the ignored local audit report are unresolved | Existing paths and unresolved declarations must both survive compilation. | + +These totals are dated observations. Acceptance derives them from the sorted record snapshot, where occurrence, unique address, and resolution status cannot be conflated by grep strategy. + +### Iron Law cadence and assurance invalidation + +The dated cadence, invalidation, and A/B/C fault-equivalence measurements moved to [Assurance evidence](assurance-evidence.md#iron-law-cadence-and-assurance-invalidation). This heading preserves the former evidence anchor; normative profile behavior remains in D21–D23. + +### Test binding and attestation gap + +| Measurement | Value | Design consequence | +|---|---:|---| +| Non-pseudo legacy test refs | 1,208 | Migration population. | +| Refs without `#selector` | 803 | A testcase cannot be selected honestly by automation. | +| Refs with selector | 405 | Candidate population for exact adapter migration. | +| Simple exact source-title matches | 372 | Upper-bound candidate under a literal Vitest/Jest scan, not proof of framework round-trip. | +| Resolvable legacy test-ref occurrences | 1,202 | Six of 1,208 occurrences currently do not resolve. | +| Existing refs outside owner `modules` | 1,025 | Current module-only attestation misses most test changes. | +| Features with an outside-module test ref | 190 | Verification digest must be feature-specific. | +| Resolved file-style evidence refs | 279 of 281 occurrences | Evidence content needs its own freshness closure; unresolved refs remain visible rather than disappearing from the graph. | +| Resolved file evidence outside owner modules | 58 | Module hashing does not protect it. | +| Done features with a declared proof address on every AC | 277/277 | Declaration completeness only. | +| Current attestation feature markers | 277 | Last-GREEN module signature only, not case-level proof. | + +The current [`src/spec/attestation.ts`](../../../src/spec/attestation.ts) hashes module bytes, and [`src/stages/junit-report.ts`](../../../src/stages/junit-report.ts) aggregates results per file rather than selector. D11 and D13 close both gaps. + +### Knowledge graph fidelity, query, and token simulation + +The following audit used the same 281-feature/1,118-criterion corpus. “Prototype” means an in-memory read-only model of the proposed identities and relations, not shipped GraphIR v2 behavior. + +| Measurement | Value | Classification / consequence | +|---|---:|---| +| v1 dependency facts represented | 249/249 | Verified measurement; coarse forward links work. | +| v1 affected-path facts represented | 1,071/1,071 | Verified measurement; `touches` works at feature level. | +| v1 criterion facts represented | 0/1,118 | Verified measurement; v1 is not a contract graph. | +| v1 criterion-proof facts represented | 0/1,557 | Verified measurement; file-level feature edges lose proof ownership. | +| Existing source `@see` references | 47 total; 41 resolve, 6 break | Verified measurement; strict provenance resolution detects real drift. | +| Prototype prerequisite queries | 281/281 exact | Prototype result. | +| Prototype impact queries | 281/281 exact | Prototype result. | +| Prototype criterion-proof queries | 281/281 exact | Prototype result. | +| Prototype regression queries | 281/281 exact | Prototype result. | +| Prototype artifact-owner queries | 427/427 exact | Prototype result. | +| Compact semantic manifest | median 503; p95 871; max 2,702 estimated tokens | Projection with simulated one-sentence project/feature purposes; not a migrated-corpus measurement. | +| v1 raw depth-2 neighborhood | 124/281 above 3,000 estimated tokens | Verified simulation; generic BFS is not a safe LLM default. | +| v1 unbounded neighborhood | median about 72k estimated tokens | Verified simulation and consistent with the shipped server's ~285 KB/~70k note. | +| Prototype v2 lower bound | 2,086 nodes; 4,200 edges | Projection before every future anchor/rule is present. | +| Prototype build | 98.39 ms cold graph phase; 27.07 ms warm median after a 134.9 ms spec load | Environment-specific projection over about 7.9 MB of readable tracked input. | + +The token simulation found a concrete packing failure before correction: content fitted under the limit, then per-path omission metadata raised a packet above it. The accepted packer therefore aggregates omissions and remeasures the final response, including its own budget fields, until the estimate is stable. + +Ablations justify the model rather than merely decorating it: removing criterion nodes loses all 1,118 criterion identities; reducing test selectors to paths loses 405 selector citations; undirected depth-2 traversal creates the measured token overflow. The implementation must turn these into committed fixtures before treating the prototype results as product evidence. + +### Role contract, cycle context, and evidence ingress + +The role-contract architecture is shipped, while task-keyed projection and full-envelope accounting are not. Measurements below use exact UTF-8 bytes and a named `characters / 4` token estimator. They include the current role prompt plus serialized feature packet but exclude provider-owned hidden instructions and later tool traffic unless stated otherwise. + +| Measurement | Value | Classification / consequence | +|---|---:|---| +| Canonical role-brief Markdown | 6 files; 27,420 bytes; 406 lines | Verified measurement; excludes the directory README. Preserve unique role contracts, but remove repeated choreography only through canonical-source edits. | +| Current developer role body | 4,969 bytes; about 1,232 estimated tokens | Verified measurement; stable prompt prefix is a material cold-input component. | +| Current reviewer role body | 4,521 bytes; about 1,118 estimated tokens | Verified measurement. | +| Current per-dispatch wire across 281 features | p50 7,977 bytes; p95 11,392; max 27,848 | Verified measurement; developer and reviewer receive the same full feature JSON rather than task-specific projections. | +| Current two-dispatch headless cycle | p50 15,836 bytes; p95 22,460; max 55,286 | Verified measurement; excludes subsequent tool results and MCP catalog residence, so it is a lower bound on physical cycle context. | +| Current serialized feature body | p50 about 704; p95 1,507; max 5,454 estimated tokens | Verified measurement under the `characters / 4` estimator. | +| Conservative full-feature `spec-edit` envelope | max 12,186 bytes (`F-0f4dd6`) | Read-only projection including feature contract, parsed architecture, project intent, relevant capabilities, revisions, write scope, and budget metadata; below the 16 KiB class limit. | +| Criterion-target `spec-edit` envelope | max 1,473 bytes | Read-only operation-scoped projection; supports deriving required content from the write set rather than shipping a whole feature unnecessarily. | +| Focused independence/oracle regression suite | 46/46 tests passed | Verified run over independence, done-policy, oracle recording, and spec-conformance contracts. | + +The two `spec-edit` projections enumerate every feature and criterion target, construct a fixed-key compact JSON envelope from the operation read/write set, include all fields named in the table, and measure `Buffer.byteLength(JSON.stringify(envelope), 'utf8')`; the reported value is the maximum record. F9 converts this read-only method into a committed fixture before treating the ceiling as a product result. + +#### Cycle context envelope (self corpus, 2026-09-03) + +Measured by `buildCycleContextEnvelope` over the live GraphIR workspace with no host-supplied runtime facts. Each figure is the final `payload_utf8_bytes` after budget and omission metadata, and every profile reached its byte fixed point in three remeasure rounds. + +| Feature | `spec-edit` | `implement` | `verify` | `observe` | `blind-oracle` | Omissions | +|---|---:|---:|---:|---:|---:|---| +| `F-208eaa79` (56 modules, 23 criteria) | 7,247 | 20,757 | 16,160 | 1,184 | 23,544 | 0 | +| `F-001` (4 modules, 2 criteria) | 1,773 | 2,401 | 2,881 | 1,147 | 2,313 | 0 | + +The `implement` column is the default packet, which does not carry `ownership-fan-out`: D19 keeps that summary available lazily, so it travels only when a request names it in `include`. Asked for explicitly the hub packet is 20,828 bytes and sheds the block it asked for, reporting `ownership-fan-out` omitted at 17,460 bytes — the expansion does not fit under 24 KiB alongside the hub's own contract. The small feature's included packet is 4,558 bytes with nothing omitted. The F9b census reads that difference across the whole corpus. + +`required_overflow` is zero on both. Two figures sit close to their class limit and are the ones to watch: hub `verify` holds 224 bytes under the 16 KiB limit with no optional section left to shed, and hub `blind-oracle` holds 1,032 bytes under 24 KiB carrying declaration-only signatures for 56 modules. + +#### A–E simulation (self corpus, 2026-09-03) + +Measured by `tests/optimizer/topology-suite.test.ts` over 295 features; exact UTF-8 bytes. Arm A is the shipped dispatch (persona body plus the `ctxFor` packet), arm B one general agent's task envelope, arm E the legacy read set the projection replaces. These two rows replace the retired prototype two-task aggregates, which were lower bounds over an incomplete projection. + +| Arm and measurement | p50 | p95 | max | +|---|---:|---:|---:| +| A developer dispatch, persona-inclusive | 7,570 | 10,834 | 30,050 | +| A reviewer dispatch, persona-inclusive | 7,122 | 10,386 | 29,602 | +| A shard JSON only, persona removed | 2,601 | 5,865 | 25,081 | +| A two-dispatch no-retry cycle | 14,692 | 21,220 | 59,652 | +| B `implement`, default | 3,753 | 7,002 | 20,757 | +| B `verify` | 3,849 | 5,819 | 16,160 | +| B `spec-edit` | 2,186 | 3,311 | 9,896 | +| B `observe` | 1,173 | 1,194 | 1,278 | +| B `blind-oracle` | 2,294 | 8,283 | 29,172 | +| B implement+verify cycle, default | 7,572 | 12,542 | 36,917 | +| B `implement` follow-up carrying the fan-out | 7,462 | 20,371 | 23,805 | +| B ownership fan-out block itself | 5,699 | 22,340 | 33,774 | +| B cycle including the fan-out follow-up | 15,948 | 29,901 | 57,745 | +| E reconstruction floor, matched lines | 5,369 | 12,074 | 32,668 | +| E reconstruction ceiling, whole files with attestation read by row | 68,291 | 292,479 | 582,354 | + +The fan-out rows are what changed the shipped packer. F9a packed `ownership-fan-out` resident whenever it fitted under the 24 KiB `implement` ceiling, and that one block put the cycle p95 at 25,092 bytes against arm A's 21,220 on 94 of 295 features — the projection cost more than the two-dispatch path it replaces. D19 calls the same summary available lazily, and the profile now says so structurally: a lazy section is never packed by default, a caller that needs it names it in `include`, and the follow-up is a second whole packet. The default cycle is 12,542 bytes at p95 and exceeds arm A on no feature, which is the figure AC-397aac78 asserts. The follow-up cycle is recorded and deliberately not asserted: asking for the expansion costs 29,901 bytes at p95 and exceeds arm A on 142 of 295 features. That is the honest price of a second query, and it is paid by the operation that wants the fan-out rather than by every implement packet. This is a physical-input record only: no host ran a task, so it supports no efficiency-when-used or adoption claim. + +All 295 features project a blind packet, and none of the 174,677 candidate implementation lines of their `src/` modules appeared in one. A candidate is a non-blank, non-comment, non-import line that is neither an `export` declaration header nor a continuation of one nor a `name: Type` field, at least 12 characters long and carrying two or more word characters. Fourteen declared modules are directories rather than files, with and without a trailing slash; a directory has no declaration lines, so it contributes none and is still recorded in the read manifest as a path that was offered. Before F9b swept the corpus the declaration-only extractor tested for existence and then read bytes, which a directory answers only halfway, so three features could not project at all. The census reads `.cladding/test-report.junit.xml` when it is present, and a vitest run truncates that file to zero bytes before the census reaches it, so the two arm E rows are the no-report figures `npm test` prints. Measured out of band with the full-suite report on disk — 997,786 bytes at this commit — every ceiling quantile rises by exactly that size and the floor rows become p50 8,622, p95 29,051, and max 128,282 matched report lines. The AB11 independence half and the AB12 adoption half are computed from the fixture receipts and event log in every arm, because the envelope carries no per-receipt assurance section and no adoption-telemetry section by design; adding one would be the production growth D19's internal measurement contract forbids. The twelve-item A/B/C matrix, both byte censuses, the leakage sweep, and the 5,000-feature hub add 6.1 s to a full suite run; the 5,000-feature hub packet is 5,692 bytes at its fixed point in about 7 ms. + +I-4 closure width, measured the same day by `effectiveFeatureScope` over the compiled workspace for the `completion` L2 profile seeded at `feature:F-001`: the completion closure spans 287 of 294 features (complete, not repository-escalated) through shared-module hubs, so the closure-scoped test filter is recorded rather than built. + +### Single-cycle simulation: working-set assembler + +The read-only design simulation used the live `F-06dfdad6` working-set feature because it combines six legacy criteria, two prerequisites, three affected paths, eleven legacy test references across three test files, shared-module ownership, and no authored capability edge. The proposed 0.2 delta added purpose `Give an implementation agent the smallest complete, impact-aware context needed to change a feature safely.` and criterion `F-06dfdad6/AC-1b7e4a2c`: `When a task context envelope is serialized, the system shall report its exact UTF-8 byte length after budget and omission metadata are included.` Its test carrier was `[covers:F-06dfdad6/AC-1b7e4a2c] reports final UTF-8 bytes after omission metadata`. These values are fixture inputs, not authored corpus changes. + +| Observation | Value | Classification / consequence | +|---|---:|---| +| Spec only | RED | Prototype lifecycle result; no proof declaration exists. | +| Source `[covers:]` without observation | RED / unverified | Declaration is not execution. | +| Matching JUnit pass plus tool evidence | Normal strict GREEN; `independence_policy: require` remains RED; UAT remains RED | Same-author proof is self-certified. | +| Verified blind receipt added | `require` GREEN; UAT remains RED | Isolation can establish independence but cannot impersonate a human channel. | +| Verified human receipt added | Full GREEN | Human ingress closes the human-only boundary. | +| Bound JUnit failure injected | RED in every topology | Explicit failure dominates positive independent evidence. | +| Current developer+reviewer reconstructed task payload | 22,476 bytes | Verified serialization of the selected current fixture; excludes resident catalogs. | +| One general-agent same-session task payload | 5,099 bytes | Prototype lower bound, not product efficiency evidence. | +| Separate general implement+verify task payloads | 7,652 bytes | Prototype lower bound. | +| Restricted blind packet | 580 bytes | Prototype; implementation content leakage was zero. | +| Related-file reconstruction upper bound | 57,849 bytes | Prototype legacy-reconstruction comparator. | +| Historical generic-MCP tool subset | 22 tools; 27,928 bytes | Earlier in-memory serializer; retain as dated evidence, not as the current full list-surface cost. | +| Historical generic-MCP prompt subset | 7 prompts; 1,938 bytes | Earlier serializer; tool+prompt subset was 29,866 bytes before server instructions. | +| Current full MCP list surface | 27 tools + 3 resources + 7 prompts; 140,498 bytes | Verified 2026-09-08 by `npm run validate:spec-0.2` (140,308 bytes on 2026-09-04, before the schema 0.2 test-binding guidance was added to three descriptions); a 2026-08-31 description-budget cut had taken this surface to 137,898 bytes, the GraphIR v2 cutover grew it past that figure through `clad_get_graph`'s bounded-projection schema, and F9d added `clad_signoff`'s `verified`/`issuer` fields and rewrote its title and description. Canonical JSON includes schemas and annotations, but excludes server instructions and host framing. The F9d verified-signoff path is L4 MECHANISM evidence only until real human signing runs through MCP11. | +| Task-profile MCP challenger | 7,879–88,313 bytes | Controlled tools-only projections are 37.1–94.4% smaller than that full list bundle; host discovery, retries, and provider tokens remain unmeasured. | +| Graph projection model | directed 375 bytes; undirected 610; avoidable 235 | Same required synthetic task output; validates projection mechanics, not GraphIR v2 product efficiency. | +| Assurance cadence model | every-edit 36 units; tiered 15 | Same completion obligations and GREEN reduction; deterministic relative units, not wall-time evidence. | +| V0 validation state (2026-09-03) | 14 pass; 2 implementation-pending; 3 not-run; 2 inconclusive; 0 fail | Infrastructure and model state only. Pending runtime and host evidence are not promoted. | +| Feature-only impact seed | 3 direct dependents | Verified current graph relation. | +| Predicted write path `src/optimizer/working-set.ts` | 4 owners + 2 downstream | Prototype write-scope projection. | +| Expanding all three declared modules | 23 owner seeds + 73 downstream | Negative control; feature modules are too broad as default impact seeds. | +| Historical pre-F5 focused tests | 53/53 passed | Dated V0 run of working-set, code-excerpt, and server tests; not current F5 evidence. | + +The stale matrix exposed one granularity defect: a receipt tied to feature `contract_sha256` becomes stale when an unrelated sibling criterion changes. The accepted `subject_sha256` repair preserves that receipt while still staling on the target criterion, referenced capability outcome, architecture constraint, or required-scenario intent. The grammar audit also found a 471-character, one-modal multi-obligation criterion and a separate long statement that a naive conjunction/length rule falsely flags. This is why one modal remains the hard grammar floor while `ATOMICITY_RISK` stays advisory. + +Repository source confirms: + +- the orchestrator and managed AGENTS text already state that the host owns execution form and that role briefs are not a permitted-agent roster; +- `computeIndependence` and `independence_policy: label | require` already derive the feature label from evidence rather than persona membership; +- the packaged `blind-author` role omits read/search/edit capabilities, but generic `clad_author_oracle` accepts caller-supplied `blind: true` and stores it directly; +- production evidence writers emit LLM/tool entries and oracle entries, but no public CLI/MCP path records an actual human criterion sign-off; +- the cycle guide still prescribes separate planner/developer/test-author/reviewer/observability steps, and the experimental headless loop still hard-codes developer and reviewer dispatches with the same feature payload. + +Existing feature rationales record that role-brief wording changed live-agent interpretation, but the raw A/B/C session transcript is not a durable repository fixture. D20 therefore retains briefs conservatively and requires the new committed persona-removal ablation before making a topology-invariance product claim. + +### Supersession and document surface + +The current production orphan scan (`npx madge --extensions ts --orphans src`) resolves four real entrypoints — `src/cli/benchmark.ts`, `src/cli/clad.ts`, `src/graph/viewer/main.ts`, and `src/spec/cli.ts` — plus `src/spec/compiler/corpus-snapshot.ts` and `src/optimizer/envelope.ts`, which scripts and tests reach but no product path calls yet. It also resolved `src/optimizer/preamble.ts` and `src/optimizer/tail.ts` until F9a: they survived only because F-041 and F-063 owned their behavior, and revising those contracts onto the envelope is what made both files and their tests deletable. That is the worked control case for contract-aware retirement rather than grep-only deletion. + +The measured F8/D19 supersession candidate surface is 788 source lines and 820 directly coupled test lines across graph v1, reverse-index, reverse/iterative slice, preamble, and tail files: 1,608 lines total. This is a candidate authority surface, not a promised net deletion. GraphIR, serializers, envelope code, and replacement contract/property tests will remain, so the acceptance signal is removal of duplicate models and traversals rather than a line-count target. + +Before semantic routing, this design occupied 92,189 UTF-8 bytes in one Markdown file, about 23k tokens under the deliberately named `characters / 4` estimator. The 2026-09-05 refresh measures a 7,521-byte router, eight canonical decision owners inside the 24 KiB ceiling (4,366–24,548 bytes), and five supporting evidence, validation, and log documents (5,595–28,633 bytes); this evidence snapshot is the one routed document above 24 KiB, because it accumulates dated measurements rather than normative text and no owner loads it to read a decision. A default fresh session containing the 5,288-byte `AGENTS.md`, router, and one canonical decision owner is 17,175–37,357 bytes instead of 97,477 bytes for `AGENTS.md` plus the monolith: a 61.7–82.4% physical-input reduction before host-owned instructions and tool traffic. The complete routed design set is 229,474 bytes (224.1 KiB); selective loading is the gain, not disappearance of authority. Reproduce session figures from `AGENTS.md` + the router + one canonical owner; reproduce the complete routed-design total from the router plus all `docs/design/spec-0.2/*.md` owners, excluding `AGENTS.md`; the separate unsubmitted upstream RFC is not part of the routed target set. + +### Orphan and low-value fields + +- Corpus `adr_refs`: 0. [`REFERENCE_INTEGRITY`](../../../src/stages/detectors/reference-integrity.ts) explicitly scopes ADRs out until an ADR subsystem exists. Remove the field from new 0.2 authoring. +- Capability `surface` is parsed and written but has no material downstream decision consumer. Remove it from 0.2 rather than preserving a taxonomy for its own sake. +- Preserve `modules` and `depends_on`; their established consumers and meaning justify them, and renaming would create avoidable long-lived dual vocabulary. diff --git a/docs/design/spec-0.2/graph.md b/docs/design/spec-0.2/graph.md new file mode 100644 index 00000000..6780baf0 --- /dev/null +++ b/docs/design/spec-0.2/graph.md @@ -0,0 +1,92 @@ + + +# Spec 0.2 — GraphIR and bounded retrieval + +> Canonical owner of D17. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## D17 — Knowledge Graph v2 as compiler IR + +> Implementation-cycle trace: `feature:F-208eaa79` is the F8 implementation shard for this accepted D17 contract; D17 remains the normative authority. + +### Primary justification and guarantee boundary + +Knowledge Graph v2 is first an internal compiler representation, not an LLM feature. The Spec compiler builds one live graph that supplies: + +- `contractClosure` for attestation v3 and contract freshness; +- `subjectClosure` for criterion/feature evidence-receipt freshness without sibling over-invalidation; +- `verificationClosure` for binding, observation, oracle, evidence, and proof freshness; +- direction-aware dependency and predicted/observed write-scope impact queries; +- document and source reference resolution; +- graph export and optional bounded LLM projections. + +The closures are single implementations, not parallel graph consumers that reproduce the same joins. GraphIR, attestation, `UNTESTED_AC`/`UNVERIFIED_AC`, impact analysis, and working-set assembly must call those implementations. This is the release justification even if no agent ever invokes an MCP retrieval tool. + +The graph guarantees structural fidelity, address resolution, provenance separation, freshness inputs, and deterministic query results. It does not prove that a requirement is true, that the implementation satisfies unstated intent, that an LLM uses the graph, or that using it improves implementation correctness. + +### Why v1 cannot remain the compiler model + +| v1 defect | Verified self-corpus consequence | v2 correction | +|---|---|---| +| No criterion node | 1,118 criteria and 1,557 criterion-proof relationships cannot be represented. | Composite-address criterion nodes and criterion-level proof edges. | +| One path becomes kind twins | 95 paths materialise as more than one module/test/doc node, giving one artifact several identities. | One artifact node with several roles. | +| Undirected generic BFS | Depth 2 exceeds 3,000 estimated tokens for 124/281 feature queries; an unbounded feature query reaches about 72k estimated tokens. | Relation-specific directions, no project-hub expansion, and projection-first reads. | + +v1 remains a historical shipped design, not a compatibility target. GraphIR v2 replaces its node/edge model and graph wire representation in 0.10.0. No v2-to-v1 graph serializer is retained. + +### Canonical identities + +Semantic addresses are: + +- `project`; +- `capability:`; +- `feature:`; +- `criterion:/`; +- `scenario:`; +- `architecture_rule:`. + +Physical addresses are `artifact:` and `anchor:#`. Bare AC ids are never externally resolvable. A source line is a navigation hint, not identity. + +An artifact has any applicable roles from `spec | doc | source | test | oracle | evidence | skill | generated`. A canonical signed receipt is one immutable `evidence`-role artifact; the graph exposes its address, provenance, state, and digest rather than duplicating its body. A doc section, source reference, or testcase is an anchor on its artifact. Project membership is artifact metadata rather than a traversal edge, so inventory membership cannot turn the project node into a whole-repository two-hop hub. + +### Edges, ownership, and truth status + +GraphIR uses these relations: + +- structure: `contains`, `defined_in`, `contributes_to`, `depends_on`, `participates_in`; +- implementation boundary: `touches`, `constrained_by`, `traces_to`; +- proof: `covers`, `supports`; +- documents: `explains`, `mentions`, `links_to`. + +Every edge records `provenance: authored | derived | observed` and an owner locator. Where truth is observed, the edge also carries `resolved | unresolved | passed | failed | skipped | stale | unknown`. A test title's `[covers:F-id/AC-id]` is authored; a matching JUnit testcase is observed. They may be joined but never collapsed into one fact. A declaration with no observation is not verified, and absence in an empty ledger is unknown rather than safe. + +F1 materialises only relationships authored inside Spec 0.1 plus their structural targets. A legacy `test_refs`, `oracle_refs`, or `evidence_refs` entry becomes an authored `supports` edge with its channel, raw spelling, selector precision, owner locator, and `resolved | unresolved` state; it does not become `covers`, `passed`, or `verified`. File and registry lookup may resolve an address structurally, but it is not proof observation. Source-comment harvesting, `[covers:]` carriers, framework selectors, case-level JUnit, and executable oracle/evidence adapters land together in F5. + +The structural resolver never guesses an alias for an absent target. In the current corpus, `self-dogfood:stage:commit-postcommit` remains unresolved rather than being silently rebound to the nearby `stage:commit` script. The original reference remains available for diagnosis and later explicit repair. + +Default traversal is relation-aware. Forward prerequisites and reverse dependents are distinct operations; containment may add a parent as orientation without expanding all siblings; an artifact query fans out to every owner. Full graph export remains an explicit CLI operation. + +### Documents and source references + +The artifact registry enumerates canonical documents and classifies design/operational contracts, general/legal material, generated output, mirrors, and fixtures. Every canonical document becomes an artifact even when it has no semantic edge. Tier A/B and design/operational-contract documents require an explicit semantic binding; general/legal/generated documents require link integrity only. + +When the F5 document/source adapters land, explicit `clad-doc-links` declarations compile to `explains`; organic ids compile to non-authoritative `mentions`; tracked repo-local links compile to `links_to`; and existing `@see spec/features/.yaml AC-…` comments compile to `traces_to`. A source reference is optional for each eligible artifact, but every declared carrier is strict after that cutover. Eligibility is limited to a compiler source-role artifact with a non-excluded authority that is a safe regular, non-symlink UTF-8 file. Directory ownership artifacts are inapplicable: the scanner neither reads nor recurses into them, and they do not make the census unknown. Missing, unreadable, invalid-UTF-8, symlinked, and other non-regular non-directory artifacts remain unknown and fail closed. Until then, F1 does not ingest source comments or change Spec 0.1 blocking behavior; the measured broken `@see` set is retained as an F5 negative-control fixture. + +`spec/generated/_doc-links.yaml` is the final generated, greppable projection after F11 relocation. If its format changes to typed addresses, the extractor, writer, `DOC_REFERENCE_INTEGRITY`, GraphIR reader, sync idempotence fixtures, and downgrade/regeneration fixture change in one feature cycle. The file is never a second graph authority. + +### Public wire boundary + +`clad_get_context` is not a graph-v1 adapter. It is a separately accepted, frozen no-code context-slice contract. Keep its exact shape and `schema_version: 1` throughout 0.10; do not revise F-06dfdad6 merely to make it resemble GraphIR. Replace the server-wide version assumption with per-surface constants so `clad_get_graph` can emit graph `schema_version: 2` without changing unrelated tools. + +The 0.10.0 release-blocking outward work is the minimum atomic v2 cutover: focused graph JSON, CLI query/export, and enough renderer/viewer support that existing graph commands are not broken. The default focused graph read is depth 1 and bounded; a no-query MCP call returns statistics, not the graph. + +Richer semantic packets are a tail consumer. If implemented, they present sparse, deterministic sections in the order WHY, WHAT, constraints, affected paths, proof, impact, documents, and health. Human-readable keys remain intact; empty/default fields are omitted; criterion ids may be locally scoped under a feature. Default task projections include receipt summaries only, never signatures or full receipt bodies. Packing measures the complete serialized payload to a fixed point, including context/input revisions and omission metadata. `token` figures must name their estimator and report exact serialized bytes because provider tokenizers differ. + +### Claim ladder and rollout + +Keep three independent claims: + +1. **Structural validity** — permitted after committed fidelity, query-reconstruction, negative-control, freshness, and ablation tests pass. +2. **Retrieval efficiency when used** — permitted only after a preregistered same-host/model/settings benchmark preserves exact-address accuracy while reducing measured input. This says nothing about correctness beyond the benchmark task. +3. **Actual adoption** — permitted only when the existing pull telemetry reaches `confirmed`. A successful retrieval A/B cannot raise adoption; current recorded evidence is `not_confirmed`. + +Therefore the internal IR, closures, detectors, attestation, and minimum graph v2 wire block 0.10.0. D24's AB01–AB12 two-arm run is the bounded first experiment for a task-scoped MCP surface; a pass supports only efficiency-when-used on those tasks. A separately preregistered broader study—40 tasks is the current optional scale candidate—may generalize the GraphIR retrieval claim in 0.10.x, but neither experiment blocks 0.10.0 or proves adoption. Viewer polish, broader MCP projections, and public graph cursor/`not_modified` expansion remain independent tail work. D19's session-bound `diagnostic_cursor` is not a graph-wire exception. diff --git a/docs/design/spec-0.2/hygiene.md b/docs/design/spec-0.2/hygiene.md new file mode 100644 index 00000000..089917a3 --- /dev/null +++ b/docs/design/spec-0.2/hygiene.md @@ -0,0 +1,50 @@ + + +# Spec 0.2 — implementation hygiene + +> Canonical owner of D18. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## D18 — Implementation hygiene and documentation surface + +Spec 0.2 implementation should leave each touched subsystem smaller in authority surface even when the feature adds capability. “Compact” means one owner per fact, direct data flow, low branching, and no adapter or wrapper that exists only to rename an unchanged value. It does not mean compressed names, hidden invariants, or deleting explanation that carries a decision. + +### Same-cycle supersession protocol + +For every non-additive feature cycle: + +1. inventory the code, document paragraphs, generated surfaces, and tests whose authority the feature may replace; +2. implement one replacement owner and prove its parity or intentional behavior delta independently; +3. cut every in-scope consumer to that owner; +4. run the deletion proof below and classify each candidate as `retire` or `retain-with-contract`; +5. delete retired code, forwarding wrappers, duplicate normative prose, and implementation-coupled tests in the same cycle; +6. consolidate the surviving tests around public contracts and failure modes, then run the feature and repository gates. + +Do not optimize toward monotonically rising or falling LOC, file count, or test count. Optimize toward zero duplicate authority, zero unjustified production orphan, and the smallest test set that still distinguishes every governed failure. Record the disposition in the feature rationale or tests rather than creating another lifecycle ledger. + +### Code and comments + +- Keep the first compiler additive under `src/spec/compiler/`; do not mix parity work with an early replacement of `src/spec/types.ts`, `src/spec/load.ts`, graph v1, or detector inputs. +- Extract a helper only when it removes repeated policy or gives a stable test seam. Prefer a local expression over a one-use forwarding abstraction. +- Document exported behavior and non-obvious invariants. Use only applicable `@param`, `@returns`, `@throws`, and `@see` tags; do not add empty or restated tags to satisfy a visual template. +- Comments explain why, ownership, trust boundaries, or failure behavior. Delete comments that merely paraphrase the following code. +- A feature may clean adjacent code that shares its authority or execution path. Broad style rewrites and unrelated renames stay outside the feature cycle. + +### Canonical documents and mirrors + +- A policy has one canonical Markdown source. Entry documents give a compact summary and link to it rather than copying its full rule set. +- The six role-brief Markdown files under `src/agents/` (excluding its README) remain canonical sources; host/plugin copies are generated mirrors and are never edited independently. +- Role briefs retain unique scope, outcome, evidence, capability, and Soft Shell contracts. Repeated choreography and generic coding advice move to the shared cycle/style authority. +- Managed blocks such as the AGENTS persona map are owned by the artifact registry and regenerated through their existing producer. +- A documentation edit must preserve resolvable links, generated-mirror idempotence, glossary coverage, and the semantic edge that explains why the document exists. + +### Deletion proof + +Search results alone never prove dead code. Before deleting a source, export, script, or document, show that it has no: + +1. static or dynamic import; +2. package/bin/hook/host entrypoint; +3. spec `modules`, test, oracle, evidence, or source-reference contract; +4. generated mirror or artifact-registry consumer; +5. runtime string lookup, plugin manifest, or external compatibility obligation. + +Record the proof in the feature test or change rationale. `src/optimizer/preamble.ts` and `src/optimizer/tail.ts` were the completed control case: not production-consumed, yet protected by shipped spec contracts, so F1 left them in place; they were deleted with their tests only after F9a revised F-041 and F-063 onto the context envelope. The duplicated pseudo-reference helper in graph v1 and reverse index stays until the F8 cutover gives it one surviving owner. The measured broken `@see` set stays as an F5 negative-control until the strict source adapter repairs it. diff --git a/docs/design/spec-0.2/mcp.md b/docs/design/spec-0.2/mcp.md new file mode 100644 index 00000000..9662b809 --- /dev/null +++ b/docs/design/spec-0.2/mcp.md @@ -0,0 +1,98 @@ + + +# Spec 0.2 — MCP boundary + +> Canonical owner of D24. Return to the [Spec 0.2 continuation router](../spec-0.2.md). Reproduce the validation projection through [Validation protocol](validation.md), not by copying measurements into this contract. + +## D24 — MCP as optional transport and bounded projection + +MCP is an adapter over the Spec compiler, transaction engine, GraphIR, and assurance reducer. It is not another specification authority, graph implementation, proof reducer, or lifecycle writer. CLI, MCP, and in-process callers must invoke the same domain operations and obtain the same semantic result for the same inputs. Turning MCP off may remove convenience and live projection, but must not change compilation, staleness, gate, or verdict semantics. + +The minimum supported MCP host needs only tools. Resources, prompts, subscriptions, and future sampling are optional accelerators. A host that ignores resource updates or never reads a prompt must still be able to complete a supported cycle through tools. A host that cannot observe `notifications/tools/list_changed` must reconnect or relist after initialization; the server advertises the capability and never assumes that a cached pre-init catalog expanded. + +### Authority and composition + +| Layer | Owns | Must not own | +|---|---|---| +| Spec compiler and GraphIR | identities, normalized contracts, closures, impact, projections | transport framing or host behavior | +| Transaction and assurance kernels | write sets, revisions, recovery, obligations, evidence reduction, verdict | MCP-specific duplicate mutation/proof logic | +| MCP adapter | discovery, schemas, bounded serialization, text/structured compatibility, transport errors | alternate facts, joins, staleness, or GREEN authority | +| Host | when to call, model/context orchestration, optional resource/prompt use | weakening domain preconditions or claiming unobserved evidence | + +Every mutating tool follows prepare/validate/apply semantics where user consent or a multi-file boundary exists. Domain errors are stable structured results and have text-content parity for clients that ignore `structuredContent`. Unknown, stale, malformed, oversized, out-of-root, unsupported, and unverified inputs fail closed without partial writes. + +### Surface roles + +The public catalog is described by operation, not persona: + +| Role | Examples | Context rule | +|---|---|---| +| Bootstrap | prepare, stage, initialize, clarify | Pre-init exposes only bootstrap tools; initialized tools arrive through list-changed/relist. | +| Inspect | feature, context, working set, impact, graph | Return bounded projections with omission and revision metadata. | +| Spec edit | create, link, resolve, future `clad_edit_spec` | Invoke the one transaction engine and declare the smallest write set. | +| Verify | check, gate, verdict, oracle | Invoke the assurance kernel; transport cannot manufacture observation. | +| Observe | events, resources, subscriptions | Optional delivery; a notification is not adoption or proof. | +| Release | changelog and release-scope reductions | Preserve the same profile and closure used by CLI/in-process entry points. | + +A code-owned `McpSurfaceDescriptor[]` with task-profile projections is a candidate consolidation, not an accepted runtime change. It may replace scattered registration only after schema, annotations, handler identity, dynamic discovery, and catalog ordering are parity-tested. Task-scoped catalogs are likewise a challenger: their byte reduction alone cannot justify a cutover if hosts fail to discover required tools. + +### Validation ladder + +The validation suite separates claims that are often conflated: + +1. **Wire conformance:** initialize negotiation, declared capabilities, schemas, list/get/call behavior, error framing, and text/structured parity. +2. **Semantic parity:** MCP, CLI, and in-process callers reach the same compiler/edit/assurance operation and normalized result. +3. **Mutation safety:** consent, path bounds, size bounds, optimistic concurrency, journal recovery, idempotent replay, and rollback. +4. **Reference-host efficacy:** Codex and Claude Code each complete a real Spec 0.2 spec-edit → implementation → verification → L4 attestation cycle using MCP where routed. +5. **Efficiency when used:** an equivalent successful task uses fewer measured input/output tokens or less active time without worse correctness, retries, or omissions. +6. **Observed adoption:** agents voluntarily pull the surface across completed cycles under the existing B1 telemetry thresholds. + +Each rung requires its own evidence. Wire success does not prove efficacy; efficacy does not prove efficiency; forced efficiency does not prove adoption. The 0.10.0 gate is deterministic conformance, semantic/mutation parity, and both MCP11 reference-host cycles. Adoption and token advantage remain reported but non-blocking. The `0.10.0 role` column below states intent; the executable ledger's `release_boundary` list is the authority the validator enforces, and MCP12 and the host A/B stay outside it. + +### Preregistered MCP scenarios + +The executable ledger owns the exact IDs; these groups define their intent: + +| ID | Scenario | 0.10.0 role | +|---|---|---| +| MCP01 | handshake and capability negotiation | blocking | +| MCP02 | pre-init bootstrap, list-changed, relist/reconnect | blocking | +| MCP03 | text and structured-content semantic parity | blocking | +| MCP04 | CLI/kernel/MCP semantic parity | blocking as each 0.2 operation lands | +| MCP05 | prepare/apply replay and rollback | blocking | +| MCP06 | different-write-set concurrency and same-write-set stale rejection | blocking | +| MCP07 | malformed, oversized, traversal, symlink, and out-of-root inputs | blocking | +| MCP08 | graph/context/catalog byte budgets and omission metadata | blocking for hard ceilings; efficiency claim non-blocking | +| MCP09 | F5 receipt ingestion/offline verification and asserted fallback; F9 registered human/blind production paths | blocking at each owning feature boundary | +| MCP10 | tools-only host with resources/prompts/subscriptions absent | blocking | +| MCP11 | Codex and Claude Code full Spec 0.2 L4 cycles | blocking before 0.10.0 release; recorded for both hosts, decided by that evidence rather than by a test reference | +| MCP12 | delivery-versus-pull adoption telemetry | measurement; adoption result non-blocking | + +An unimplemented operation is `implementation_pending`; an available but unexecuted host scenario is `not_run`; missing discriminating evidence is `inconclusive`. None is serialized as pass. + +### Context and token accounting + +Every deterministic measurement reports: + +- the exact controlled UTF-8 bytes after final serialization; +- the estimator name (`characters_div_4_ceiling` in the contributor harness) rather than calling it a tokenizer; +- provider-reported input, output, cached-input, and reasoning tokens when a host exposes them; +- cache state as `cold`, `warm`, or `unknown` without inference; +- payload, resident catalog/instructions, tool results, retries, and total as separate quantities. + +“Waste” is only the positive byte/token difference between two executions that produced the same required semantic output and passed the same fault checks. Large context, an unused field, or a smaller challenger is not waste by inspection. Counterfactual equivalence must be stated in the result. + +The committed deterministic comparison measures the full initialized catalog and task-profile challenger using canonical JSON bytes. It is a lower-level cost input, not provider token use. The executable ledger fixes AB01–AB12 across contract lookup, identity, impact/closure, edits, concurrency, proof, stale failure explanation, independence, and delivery/adoption. A Codex-only live A/B runs the twelve tasks in two arms (full catalog and candidate projection), at most twenty-four host task calls. It records success, retries, recovery, active time, provider usage, cache knowledge, fault-control detection, and contract/verdict parity. It is non-blocking; unavailable provider usage leaves controlled bytes and wall time labelled estimates, never token superiority. + +### Change discipline + +MCP optimizations follow challenger → simulation → acceptance → cutover. The validation command may recommend a challenger but cannot edit this owner or promote a decision. Maintainer acceptance updates this document and the central decision log first; implementation then changes the descriptor/adapter and parity fixtures together. A failed challenger leaves the existing surface intact. + +The reproducible command is: + +```sh +npm run validate:spec-0.2 +npm run --silent validate:spec-0.2 -- --json +``` + +Its passing infrastructure validates the ledger and current wire facts only. D01–D23 remain implementation-pending until their own executable evidence lands. diff --git a/docs/design/spec-0.2/model-and-migration.md b/docs/design/spec-0.2/model-and-migration.md new file mode 100644 index 00000000..eb165263 --- /dev/null +++ b/docs/design/spec-0.2/model-and-migration.md @@ -0,0 +1,367 @@ + + +# Spec 0.2 — model and migration + +> Canonical owner of D01–D10 and D14. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## D01 — Objective and guarantee boundary + +LLMs should be able to maintain the spec continuously without carrying a large authoring burden or creating internal contradictions. + +The governing rule is: + +> Each governed fact and authoritative forward relationship has one canonical owner. The compiler derives inverse edges, projections, observations, and indexes on every run, validates them against their owner, and seals the contract and proof inputs that earned the last GREEN gate. + +Eliminating duplicate authority prevents structural contradiction; it does not prove that a requirement is semantically correct or complete. Cladding separately handles: + +- missing intent or evidence through detectors; +- stale code, tests, or evidence through verification and attestation; +- concurrent edits through optimistic revisions and a journaled commit boundary; +- behavioral truth through executable tests, oracles, and evidence rather than schema shape alone. + +The default authored semantic prose for a new feature is two sentences: + +1. `feature.purpose` — why the feature exists; +2. `criterion.statement` — what observable promise must hold. + +A `constraint` criterion adds one `rationale` sentence unless it references an architecture rule that already carries the rationale. IDs, titles, lifecycle state, paths, and forward links remain structural data, normally supplied or validated by tools. + +## D02 — WHY / WHAT / HOW model and terminology + +Intent is a directed graph, not a `project → scenario → feature` tree. A scenario crosses several features and may cover several capabilities. + +```text +project.purpose + └─ capability.outcome + └─ feature.purpose + └─ criterion.statement + +scenario ── cross-feature user journey +architecture / constraint ── permitted implementation boundary +``` + +| Term | Canonical question | Normative meaning | +|---|---|---| +| `project.description` | WHAT | What the project is, in one line. | +| `project.purpose` | WHY | Why the project exists and which problem it exists to solve. | +| `capability.outcome` | WHAT | The user-visible result supplied by a capability. | +| `feature.title` | WHAT label | Human label; not the requirement body. | +| `feature.purpose` | WHY | Why this feature is needed within the project outcome. | +| `criterion.statement` | WHAT | One observable, testable EARS promise. | +| `criterion.kind` | classification | `behavior`, `quality`, or solution-limiting `constraint`. | +| `criterion.rationale` | WHY | Why a constraint is necessary. | +| `scenario.actor` | WHO | The party performing the journey. | +| `scenario.goal` | user WHY/WHAT | What the actor is trying to achieve. `purpose` is not used here because it ambiguously suggests the reason the scenario document exists. | +| `scenario.success` | observable outcome | The end state that makes the journey successful. | +| `scenario.steps` | journey sequence | User/system interaction order, never an implementation recipe. | +| `architecture.rules` | constrained HOW | Boundaries implementation must not cross. | +| `modules` | WHERE | Affected paths. The field is retained; it is not an implementation narrative. | +| `depends_on` | prerequisite | Authoritative forward dependency. Soft Shell describes it as “prerequisites.” | +| `notes` | non-normative context | Explanation that cannot add a hidden requirement, exception, or proof obligation. | + +There is deliberately no generic `feature.how`. Ordinary implementation detail belongs in code. A HOW is admitted into the spec only when it is a durable constraint, a cross-cutting architecture rule, or a reviewed `design_impact` that points to the relevant design artifact. + +## D03 — Artifact layout and necessity + +### Target layout + +```text +spec.yaml +spec/ +├─ features/-.yaml +├─ scenarios/-.yaml +├─ architecture.yaml +├─ capabilities.yaml +├─ evidence//.yaml +├─ generated/ +│ ├─ README.md +│ ├─ migration-baseline-0.1-to-0.2.yaml +│ ├─ index.yaml +│ ├─ _doc-links.yaml +│ └─ attestation.yaml +``` + +- No tier directories: tier is mutable; feature, scenario, and architecture are semantic domains. +- `generated/` denotes machine-written bytes, not governance Tier C. +- `evidence/` holds externally issued content-addressed receipts: machine-issued but not regenerable, so not generated. +- Name the receipt `migration-baseline-0.1-to-0.2.yaml`, not `schema-upgrade-0.2.yaml`: project baseline, not algorithm. +- Generate `generated/README.md` from the artifact registry; it is never a hand-maintained policy source. +- Final 0.2 paths: `spec/generated/index.yaml`, `spec/generated/_doc-links.yaml`, and `spec/generated/attestation.yaml`. Schema migration and physical relocation are separate. +- Every managed plugin-build write, including a named manifest region, has one + `ArtifactDescriptor`; generated persona/skill mirrors are derived from their + canonical briefs by a pure byte-map policy. The read-only mirror census is an + observation consumer, never a second artifact authority. + +### Why each artifact remains + +| Artifact | Canonical role | Presence | +|---|---|---| +| `spec.yaml` | Schema anchor, project identity, policies, and generated inventory region. | Required. | +| `features/` | One independently mergeable behavior contract per feature. | Scaffolded; shards appear with features. | +| `capabilities.yaml` | Stable catalog of user outcomes. Feature links live in feature shards. | Scaffolded; may be empty during early onboarding. | +| `architecture.yaml` | Enforced layers and solution constraints. | Scaffolded; may be empty until architecture is known. | +| `scenarios/` | Cross-feature user journeys. | Governed by `scenario_policy`. | +| `evidence/` | Immutable, signed proof receipts keyed by feature and receipt digest. | Created only by a registered evidence channel. | +| `generated/migration-baseline-0.1-to-0.2.yaml` | Immutable-by-tool legacy exemption and binding receipt. | Only for upgraded 0.1 projects. | +| `generated/index.yaml` | Committed lookup projection for sharded specs. | Generated when sharded. | +| `generated/_doc-links.yaml` | Committed document-link projection. | Generated when document declarations exist. | +| `generated/attestation.yaml` | Last-GREEN verification signature. | Generated only by a qualifying GREEN gate. | + +`docs/project-context.md` remains outside `spec/`: it explains, never redefines, the normative project purpose. + +## D04 — Identity and sharding + +- New IDs use `F-<8hex>`, `AC-<8hex>`, `S-<8hex>`, and `AR-<8hex>`. +- An AC's complete external address is `F-id/AC-id`. An AC ID alone is feature-scoped and cannot bind a test. +- New feature and scenario files use `-.yaml`. +- The filename is the canonical slug owner. Schema 0.2 removes `slug` from feature/scenario bodies, and the compiler injects it into IR from the source path. +- The body `id` is the logical graph address. Its hash must equal the filename suffix; this is an address checksum, not a second slug owner. +- A title may change without moving the path. The path slug is a stable locator, not a derived copy of the latest title. +- The 0.1 reader continues to accept legacy sequential and six-or-more-hex IDs. New writers emit eight hex characters only. +- Put ID policy, examples, schema descriptions, and MCP tool wording behind one executable ID-policy registry so the current `hash6`/`hash8` documentation split cannot recur. + +## D05 — Project contract + +### New or human-edited 0.2 target + +```yaml +schema: "0.2" +project: + name: cladding + language: typescript + description: Reference implementation of the Ironclad harness. + purpose: Make AI-coupled development measurably safer and more honest. + assurance_level: L2 + scenario_policy: advisory +``` + +- Require `project.purpose` for new 0.2 projects. +- `intent_summary` is a 0.1 source field, not a 0.2 alias. The 0.2 validator rejects it. +- During migration, exact-copy `intent_summary` into a proposed `purpose` when it exists. A project without one receives a node-level legacy exemption until its project intent is edited. +- Exact-copy means the complete current value, including any detector-count or policy suffix. A human may revise the proposed purpose before apply; the example above is such a reviewed target, not a byte-for-byte rendering of this repository's 0.1 value. +- Writers persist `scenario_policy`; they do not rely on an invisible default. +- Writers persist `assurance_level`. New 0.2 projects start at `L2`; the level selects the cumulative proof obligations a completion must satisfy, as defined by [D21–D23](assurance.md#d21--iron-law-assurance-kernel). +- Migration does not infer an assurance claim from the old stage layout. Preview proposes `L2`, the operator confirms or changes it, and unresolved policy writes nothing. +- Retain existing project runtime, oracle, independence, deliverable, smoke, and AI-hint policies unless a dedicated feature changes them. + +`docs/project-context.md` must point to `spec.yaml#project.purpose` as the normative one-line purpose. Its prose may explain the evidence and trade-offs behind that purpose but may not create a competing summary field. + +## D06 — Feature and criterion contract + +### Target + +```yaml +id: F-ab12cd34 +title: Login flow +status: planned +purpose: Allow a customer to begin an authenticated session safely. +modules: + - src/auth/session.ts +depends_on: [] +capability_refs: + - authentication +acceptance_criteria: + - id: AC-12ab34cd + kind: behavior + statement: When valid credentials are submitted, the system shall create a session. +``` + +- Require `purpose` on a new feature. +- Require an explicitly persisted `capability_refs` on a new feature and on the first intent-bearing edit of an exempt legacy feature. An empty list is a deliberate statement that the feature contributes directly to project purpose; it is valid but advisory-visible, never an omitted/unknown alias. +- Require `statement` and a persisted `kind` on a new criterion. Authoring tools may suggest `behavior`, but the schema does not hide the value behind a default. +- Begin with `behavior | quality | constraint`. Add kinds only after a real consumer exists. +- A `constraint` requires either a local `rationale` or one or more `constraint_refs` resolving to architecture rules with rationales. +- Retain `modules`, `depends_on`, `design_impact`, lifecycle state, archive metadata, oracle refs, evidence refs, and free-form `notes`. +- Persist `blocked_reason` exactly when `status: blocked`: it is required and non-empty for blocked features, forbidden otherwise, cleared by `feature.begin` and archive, and excluded from intent triggers and contract hashing. +- Treat `design_impact` as governance state, not default semantic prose. An unresolved structural impact still blocks completion. +- Exclude `notes` from intent-change triggers and canonical contract serialization. A requirement hidden only in notes is invalid authoring. +- Reject `ears`, `condition`, `action`, `response`, `text`, `test_refs`, and `adr_refs` in schema 0.2. + +### Strict statement grammar + +Use the [Ironclad EARS grammar](https://github.com/qwerfunch/ironclad/blob/main/ears.md) without inventing a second dialect. + +- Support five basic patterns plus compound. +- Compound clauses appear at most once and in fixed `When → While → Where → If` order. +- Require the grammar's comma boundaries; an `If` clause requires `then`. +- Require exactly one unprotected `shall` or `shall not` modal. +- Reject multiple modals as a non-atomic AC and instruct the author to split it. +- Treat the response predicate as opaque; do not manufacture structured subfields. +- Ignore modal-looking text inside protected backticks, quotes, and balanced parentheses while scanning. +- Reject unbalanced protected spans and statement fragments in new authoring. +- Apply strict parsing to new or intent-edited 0.2 nodes. Preserve the existing 0.1 gate result for legacy input. + +The single-modal rule is a syntactic floor, not a proof that an AC is semantically atomic. `ATOMICITY_RISK` may report an advisory when a one-modal statement still contains signals such as a top-level obligation list, coordinated independent predicates, excessive length, or several independently selectable outcomes. It must identify the signals it observed, never auto-split prose, and never block authoring or a strict gate by itself. Corpus fixtures include both a genuine multi-obligation statement and a long-but-acceptable false-positive control so this heuristic cannot silently become a second grammar. + +## D07 — Capability contract and edge ownership + +### Target + +```yaml +capabilities: + - id: spec-governance + title: Spec governance + outcome: Teams detect code and specification divergence before release. +``` + +- Keep only `id`, `title`, and required `outcome` on each 0.2 capability. +- Remove top-level `source` and capability `summary`, `surface`, and `features[]` from 0.2. +- Own the forward edge in `feature.capability_refs`; derive capability-to-feature projections live. +- A new or intent-edited 0.2 feature must confirm this edge set explicitly, including the empty set. The existing `CAPABILITIES_FEATURE_MAPPING` surface may advise on an explicit empty set when a capability catalog exists, but emptiness remains valid direct-to-project contribution. +- A 0.1 runtime consumes legacy capability `features[]` only. A 0.2 runtime consumes feature `capability_refs` only. Never use `L ∪ N` at runtime. +- The upgrade planner may compare legacy edge set `L` with candidate edge set `N` in memory and must prove `L = N` before cutover. +- Migration may suggest likely capability links for human review, but it never persists a non-legacy edge by inference. A feature with no legacy edge migrates to an explicit empty `capability_refs` unless a human resolves a different edge before apply. +- Present each exact `summary → outcome` copy as a human-confirmation item because `outcome` makes a stronger semantic promise than `summary`. + +## D08 — Architecture contract + +### Target + +```yaml +layers: + - [spec, core, report] + - [stages, adapters] + - [cli] +rules: + - id: AR-ab12cd34 + kind: forbidden_import + from: spec + to: stages + rationale: The specification compiler must not depend on stage runners. +``` + +- Accept one 0.2 layer spelling: ordered `string[][]`, from foundation to outer entry layers. +- Replace top-level `forbidden_imports` with `rules`; start with `kind: forbidden_import` only. +- Require stable rule `id`, `from`, `to`, and `rationale`. +- Define `from` as the importing layer and `to` as the imported dependency in schema text and Soft Shell output. +- Use `AR-*` as the address space for criterion `constraint_refs`. +- Treat a legacy object-form layer as a human-resolution item unless the upgrade can prove that converting it loses no path or layer meaning. + +## D09 — Scenario contract + +### Target + +```yaml +id: S-ab12cd34 +title: First login +actor: New customer +goal: Begin an authenticated session. +success: The authenticated home screen is visible. +steps: + - Open the login screen. + - Submit valid credentials. +feature_refs: + - F-ab12cd34 +``` + +- Keep the `scenario` concept and `spec/scenarios/` path; do not rename it to journey. +- Use `goal`, not `purpose`, for actor intent. +- Require non-empty `actor`, `goal`, `success`, ordered `steps`, and at least one resolving `feature_ref` for a new scenario. +- `scenario_policy: off` disables coverage demand but retains schema/reference checks. +- `advisory` is the persisted default and emits non-blocking information for absent or hollow scenarios. +- `required` makes scenario presence and structural completeness blocking. In 0.10 it does not claim executable journey verification. +- Only a `required` scenario participates in the referenced feature's contract hash. Executable scenario proof is a later feature. + +## D10 — Artifact registry and compiler boundary + +Create one code-owned `ArtifactDescriptor[]` registry. Each descriptor declares: + +- logical artifact or byte-region ID; +- path matcher and supported schema versions; +- domain and authority class (`canonical`, `generated`, `migration`, `evidence`, `transient`); +- mutability and persistence; +- producer, consumers, inputs, and refresh policy; +- current path and compatibility aliases; +- file or region ownership. + +The registry owns create-only `spec/evidence//.yaml`: directory equals receipt feature, filename equals canonical signed-receipt digest, distinct from regenerable artifacts. + +Model `spec.yaml#project` and `spec.yaml#inventory` as separate logical regions. An inventory refresh must not invalidate a project-purpose revision. + +All spec consumers use one compiler pipeline: + +```text +version dispatch +→ parse with source locations +→ normalize to canonical IR +→ validate identities, references, lifecycle, and ownership +→ derive reverse edges, bindings, and projections +→ expose detector and query inputs +→ optionally cache disposable digests +``` + +- Sort shard paths before loading. +- Preserve provenance and source ranges on IR nodes and edges. +- Make unknown schema versions a hard error. +- Keep 0.1 validation and blocking results compatible. +- Store no committed `traceability.yaml`; reverse edges and authored-edge projections have a live, non-stale home in IR. +- Store only disposable compiler digests under `.cladding/cache/`. +- Require every Cladding-managed write target and every managed region to resolve to exactly one descriptor. +- Generate the prose artifact table and generated-directory notice from the executable registry rather than maintaining another list by hand. + +## D14 — Schema migration + +CLI and MCP use one engine: + +```text +clad migrate --to 0.2 # read-only preview +clad migrate --to 0.2 --apply # explicit transaction +clad relocate-generated # read-only relocation preview +clad relocate-generated --apply # explicit relocation transaction +project.upgrade_schema # MCP operation +``` + +`clad migrate` changes schema only; `clad relocate-generated` moves only the three D03 projections. `clad update` reconciles installed wiring, never authored meaning. + +### Workspace states + +`old` means root `spec/index.yaml`, `spec/_doc-links.yaml`, and `spec/attestation.yaml`; `new` means the three `spec/generated/` destinations. + +Before F11, the F4/F7 engine treats old paths as the then-canonical transitional layout: F7–F10 complete normally. F11 aliases/relocates; its final engine applies this state machine: + +| Detected state | Permitted operation | Result | +|---|---|---| +| 0.1 + old | normal | Ordinary 0.1 operation. | +| 0.2 + old | `relocation_required` | Deferred in 0.10.0: this state stays fully supported and `clad relocate-generated` is opt-in. Enforcement — read/diagnose/relocate only, other mutations and authoritative profiles unresolved — waits until adopters have relocated. | +| 0.2 + new | normal | Ordinary 0.2 operation. | +| both paths | conflict | Refuse mutation until the conflict is resolved. | +| active migration/relocation journal | recovery-only | Finish or restore the recorded transaction before every other operation. | + +### Preview + +Compile 0.1, scan legacy strings as `parsed | opaque | conflict`, and build the candidate in memory. Copy `text → statement` exactly, never reconstruct from structural EARS; propose `intent_summary → purpose` and `summary → outcome`, validate identity, remove redundant child markers, prove inverted capability equality, and classify human/blind evidence as asserted unless receipt-backed. A `require` project reports completed features that lose independence. + +Preview retains raw refs without selectors; safe historic candidates record normalized path, state, and whole-file SHA-256. `CRITERION_STATEMENT_CONFLICT`/`CRITERION_TEXT_UNKNOWN` selects exact refs to `retain`/`drop` with final strict intent; `condition`/`action`/`response` differences alone are not conflicts. Other items cover capability outcomes, architecture rationale/lossy layers, scenario intent, `adr_refs`, and replacement evidence or 0.1 for asserted-only `require`. + +Preview requires `PROJECT_LEGACY_L2_BASELINE: accept | reject`, separate from `PROJECT_ASSURANCE_LEVEL_CONFIRMATION`, with deterministic count+digest of exact-`done` source-feature 0.1 criteria. It infers neither decision nor eligibility from legacy stages, refs, agent claims, or L2 selection. + +### Baseline and enforcement + +The immutable node baseline covers project/feature intent, criterion intent/historic refs, scenario/architecture, and valid `surface` as deterministic `removed_by_schema_0.2` (never live). Unchanged ACs stay `legacy_unclassified`; their first intent edit needs strict statement/kind. Criterion add/remove or statement/kind/rationale/constraint-ref edit revokes only that criterion; feature/non-intent edits do not revoke unchanged siblings. An exempt feature's first intent edit persists `capability_refs`, including confirmed empty. + +On `accept` only, atomic apply resolves every criterion, then writes immutable criterion-local L2 authorizations to `migration-baseline-0.1-to-0.2.yaml`. Each binds composite address, source `done`, exact final 0.2 intent digest (statement, kind, rationale, constraint refs, including explicit absence), exactly Unit `stage_2.1` and Coverage `stage_2.2`, plus deterministic `candidate_sha256` and `resolution_sha256`. `reject` writes none. Strict intent selected during reviewed migration becomes that immutable final target; only a criterion newly authored after migration or whose recorded final target later changes is ineligible/revoked. A source feature not exactly `done` (including F7 before completion) is ineligible. D11/D23 define runtime use. + +Reviewed strict carry-forward is immutable history, not relaxed exemption: it binds final intent and selected raw refs with whole-file hashes. Selection is `live > reviewed carry-forward > unchanged exempt legacy > none`, never a union; changed selected bytes are stale/RED. Historic refs and `identity.author: human`/`blind: true` are not verified receipts. + +### Apply and rollout + +- Abort for unresolved items; recheck preview before journaling, so a selected-byte change is `STALE_INPUT`. Prove feature/criterion identity/count, statement transfer, and `L = N`. +- `spec.yaml#schema` is the sole selector; child/shard markers are forbidden and receipt-local `receipt_schema` only versions its protocol. +- Before F11, one journal writes baseline, conversion, old-path projections, and root switch; 0.10.0 ships `clad relocate-generated --apply` as the separate opt-in move. Relocation moves three projections only and changes neither schema nor F7–F10 acceptance. +- Apply plans exact paths, rejects dirt there, records `HEAD`/sorted paths, and is zero-diff on second success. Failure writes nothing; recovery finishes/restores byte-identical originals or supports exact-path `git restore --source= -- `. +- Continue reading 0.1; reject old 0.2 spellings/unknown versions. Upgrade: install 0.10+, close/rebase branches, preview, resolve, apply once on integration. + +### Cladding self-migration sequence + +F3 proves candidate capability/architecture edges in memory without byte cutover; F4 supplies the journaled apply boundary. At F7 end, Cladding: + +1. implements/tests the 0.2 reader/writer while self remains 0.1; +2. previews and resolves every human item on that tree; +3. performs the one atomic F4-backed apply; +4. completes F7 with `clad done` on the resulting 0.2 workspace; and +5. writes its first pure-0.2 v3. + +The F7 preview separately resolves `PROJECT_ASSURANCE_LEVEL_CONFIRMATION` and +`PROJECT_LEGACY_L2_BASELINE`; F7 is ineligible for the latter while incomplete. +For self, the self release attestation remains L2; legacy L3/L4 is no waiver. +F9–F11 signed fixtures are mechanism/protocol evidence. Only real human-signed Codex and Claude Code MCP11 cycles prove L4. A stronger bounded-closure self completion is optional. Self stays on the pre-relocation layout in 0.10.0; relocation is opt-in and invalidates no F7–F10 work. diff --git a/docs/design/spec-0.2/proof-and-editing.md b/docs/design/spec-0.2/proof-and-editing.md new file mode 100644 index 00000000..96a41f80 --- /dev/null +++ b/docs/design/spec-0.2/proof-and-editing.md @@ -0,0 +1,163 @@ + + +# Spec 0.2 — proof and editing + +> Canonical owner of D11–D13. Return to the [Spec 0.2 continuation router](../spec-0.2.md). + +## D11 — Test binding and observation + +### Source carrier + +Vitest/Jest begins with a title carrier: + +```ts +it('[covers:F-ab12cd34/AC-12ab34cd] creates a session', () => {}); +``` + +- Require the token at the start of the source test title. +- Permit consecutive leading tokens when one test independently covers several atomic ACs. +- Ignore bare IDs and organic ID mentions outside a registered carrier. +- Other frameworks use native metadata or annotation only after an adapter passes committed source→selector→JUnit round-trip fixtures. + +The normalized IR is: + +```ts +interface TestBinding { + criterion: string; // F-id/AC-id + framework: string; + file: string; + selector: string; + carrier: 'title' | 'metadata' | 'annotation'; +} +``` + +Source harvesting establishes a declared binding. A case-level JUnit record establishes observation. + +- Any bound failure makes the AC failed. +- With no failure, at least one observed pass makes it verified. +- Skipped-only or absent results are unverified. +- A passing unrelated test in the same file is never evidence. +- An unknown composite address is a blocking reference error. +- JUnit attribute entities decode before exact selector comparison, and every + emitted `file`/`classname` path carrier is retained for that comparison. +- Schema 0.2 proof sources and legacy test refs reject symlinked roots, + ancestors, files, and realpaths outside the workspace rather than following + outside bytes. +- Test, oracle, and evidence channels retain their distinct provenance. A positive channel cannot hide an explicit failure in another declared channel. + +### Legacy binding fallback + +Migration baseline is a narrow compiler/migration resolution, not a waiver or verified historic proof. D14 records an immutable, criterion-local authorization only after an accepted project decision. + +- A criterion may resolve only its L2 Unit/Coverage rows to `migration_baseline` when that authorization exactly matches its current address and final intent and no current exact proof mechanism exists. +- A live binding, a reviewed/legacy exact selector (pass, fail, skipped, absent, stale, or unsafe), or a registered current static criterion rule takes precedence. Its `pass`/`fail`/`unobserved`/`na` is final for that snapshot; baseline never falls back behind it. +- Baseline never masks a source→selector→runner defect: restore the exact binding round trip first, then reduce its current result. +- Path-only historic refs have no executable selector and may use the baseline when otherwise eligible. A same-file pass is never evidence. +- Strict intent selected during reviewed migration becomes the immutable final target and remains eligible. Only a criterion newly authored after migration or whose recorded final target intent later changes is ineligible/revoked; a feature edit does not revoke an unchanged authorization. Source features not exactly `done` at preview are ineligible. +- Store legacy `test_refs` only in `migration-baseline-0.1-to-0.2.yaml`; hash a retained path-only file because no honest source span is known. +- A blind receipt locator is canonical `path` or `path#exact selector`; its + issuer pass reduces only when that exact live binding has an observed pass. + +## D12 — Transactional spec editing + +Expose `clad_edit_spec` as a typed operation batch, not JSON Patch and not a generic file editor. + +Initial operation set: + +- `project.set_description`, `project.set_purpose`, `project.set_policy`; +- `feature.create`, `feature.begin`, `feature.block`, `feature.archive`, `feature.set_title`, `feature.set_purpose`, `feature.set_links`, `feature.set_design_impact`; +- `criterion.upsert`, `criterion.remove`, `criterion.set_proof_refs`; +- `capability.upsert`, `capability.remove`; +- `architecture.set_layers`, `architecture_rule.upsert`, `architecture_rule.remove`; +- `scenario.upsert`, `scenario.remove`; +- `dependency.promote`; +- `evidence.revoke`; +- `project.upgrade_schema`. + +Existing create, capability-link, oracle, and design-impact surfaces become thin adapters over the same mutation engine. No edit operation may set `status: done`; completion stays exclusive to `clad done`. + +Operation semantics are deliberately narrow: + +- `feature.block(reason)` requires a non-empty reason. It transitions `planned | in_progress → blocked`; an already-blocked feature with the same reason is an idempotent no-change, while a different reason replaces the current reason and records the transition. `done` must pass through `feature.begin` before blocking; archived and unknown features are no-write errors. `feature.begin` clears the reason. +- `feature.archive(reason, superseded_by?)` accepts every non-archived feature, records immutable archive metadata, and clears a blocked reason. Repeating the exact archive metadata is an idempotent no-change; different metadata, an unknown feature, or any attempted unarchive is a no-write error. An erroneous integrated archive must be reverted in version control. +- `feature.set_links` is a typed partial replacement of exactly `modules`, `depends_on`, and `capability_refs`. Omission preserves a field and `[]` clears it. Every replacement validates references, duplicates, self-edges, and the complete dependency graph for cycles. +- `modules` owns implementation and test paths. Structural `design_impact.artifacts` instead names only registered Tier-B `docs/design/**/*.md` documents; it must not double as source ownership or accept project-context, capability, or architecture contracts. +- A new schema 0.2 structural record snapshots every listed design document digest and resolves only after every retained document changes. A migrated schema 0.1 review record with no digest baseline has no automatic approval path: it cannot be overwritten, reclassified, or re-baselined into `review_required`. Only an explicit typed transition to `resolved` may change it, when the current record exactly matches its feature-local immutable `FeatureIntentBaseline.legacyStructuralReview`, after retaining the exact safe regular-file registered design-document set. +- `dependency.promote` accepts only a current unambiguous inferable candidate; an already-authored edge is an idempotent no-change. +- `criterion.set_proof_refs` owns oracle/evidence declarations without making them verified observations. +- `evidence.revoke` removes exactly one content-addressed receipt. Receipts are otherwise create-only and immutable. + +### Lifecycle start contract + +Expose `clad begin ` as the CLI adapter over `feature.begin` so every implementation cycle has an explicit start boundary. + +- Transition `planned | blocked | done` to `in_progress`. Beginning a done feature is a normal reopen, not a hidden contract exception. +- Treat an already-`in_progress` feature as an idempotent no-change success. Reject an archived or unknown feature with no spec, inventory, checkpoint, or event write. +- Capture the pre-batch state as one `feature_checkpoint`, change the status, refresh derived inventory, and apply any companion spec operations under the same journal. Recovery must expose either the complete begin or the byte-exact pre-begin state, never a status flip without its checkpoint. +- A batch may combine `feature.begin` with feature-local intent edits. One checkpoint covers the whole pre-batch state, and the result returns the post-commit context and input revisions. +- For schema 0.2, `clad done` accepts only `in_progress → done`; any other source status returns a no-write lifecycle error. The 0.1 compatibility path retains its shipped behavior. +- A schema 0.2 completion prepares an in-memory `done` view under the F4 lock and writes no pending marker. Done-aware drift, compiler, and assurance work consume that view. Only a GREEN, independent completion with a v3 receipt may publish one F4 journal containing the exact feature replacement, required derived projections, receipt, and successful completion event after rechecking the original root, feature, attestation, and verification-input revisions. RED, refusal, error, stale input, or interruption before that journal leaves canonical completion artifacts byte-exact unchanged. + +### Revision and commit contract + +- Read and projection tools return a `context_revision` for same-session delta reuse plus `input_revisions` keyed by logical artifact/region. These values have different authority and are never interchangeable. +- `context_revision` identifies the compiled projection and packing inputs. It may support `not_modified` or delta delivery only when the same session proves retention; it never authorizes a write. +- `input_revisions` are byte hashes of the canonical write regions derived for the requested operation. They are the only optimistic-concurrency precondition. +- The operation schema and registry derive read/write sets; callers cannot under-declare them. +- A caller supplies `input_revisions` for canonical write regions only. +- A shard-local operation requires only that shard's input revision. `project.upgrade_schema` requires the canonical workspace input revision. +- Prepare and validate patches without the commit lock. +- Acquire a short workspace commit lock with a five-second bounded wait. +- Under the lock, recover any journal, re-read input revisions, reload the latest full compiler inputs, apply the operation in memory, and validate all references. +- Different-shard concurrent edits wait briefly and both succeed against the latest IR. +- The second same-shard edit returns stale with no write. +- A lock timeout returns BUSY with no write; it is not reported as stale. +- Write a journal and before-images before same-directory temp-file replacement. On ordinary errors, write nothing. On process interruption, the next compiler or mutation run completes cleanup or restores byte-exact originals. +- Regenerate derived inventory/index state under the commit lock from the latest IR, but do not include derived regions in caller input revisions. +- The supported filesystem threat boundary is cooperative: every initialized specification or managed-artifact writer takes this lock and journals its replacement; observed/pre-existing symbolic links, out-of-root paths, and preimage mismatches fail closed. Pre-init onboarding and host wiring are outside this boundary. Node's portable APIs cannot provide `openat`/directory-FD compare-and-swap on macOS, Linux, and Windows, so a same-account process that deliberately ignores the lock and races pathname replacement is outside this boundary. +- Journaled domain lifecycle events are canonical; best-effort observer telemetry uses that same lock and is non-authoritative. + +## D13 — Attestation v3 + +Retain the current per-module byte map and replace the feature `ok` marker with compact per-feature closure and assurance seals. [D21–D23](assurance.md#d21--iron-law-assurance-kernel) own profile and obligation semantics; this section owns the persisted freshness boundary. + +### `contract_sha256` + +Canonical serialization includes: + +- feature ID, title, purpose; +- criterion IDs, parsed EARS AST, kind, rationale, and constraint refs; +- modules, dependencies, and capability refs; +- referenced capability outcomes and full architecture rules; +- active `design_impact` governance state; +- required scenarios that reference the feature; +- the applicable legacy-exemption identity for baseline-covered nodes. + +Exclude YAML comments, formatting, ordering where order is non-semantic, and criterion notes. + +### `verification_sha256` + +Canonical serialization includes: + +- binding address, framework, file, selector, and carrier; +- exact testcase source-span bytes, or whole-file bytes when the adapter cannot isolate a span; +- adapter-declared runner configuration that determines whether the testcase executes; +- oracle and evidence declarations plus their resolved bytes or resolver definitions; +- verified evidence receipts by full content address, including their method, issuer, subject and reviewed-input hashes, human runtime-dependency/author-set/criterion-matrix fields, and blind capability-manifest digest where applicable; +- whole-file bytes for baseline legacy test refs. + +This digest must cover tests and evidence outside `feature.modules`; module hashing alone does not protect them. + +### Runtime and assurance seals + +- `runtime_dependency_sha256` seals the sorted implementation roots of every authored or observed prerequisite needed by the feature. Unknown dependency completeness cannot produce a scoped seal; D23 escalates that verification layer to the whole repository. +- `profile_sha256` seals the assurance profile, required level, policy, adapter/catalog, environment, and trust-snapshot identities. +- `obligation_sha256` is a Merkle root over sorted normalized obligation results, including baseline basis. Persist `required`/`pass`/`na`/`migration_baseline` counts; when the last is nonzero, also persist baseline-receipt and resolution digests plus criterion and obligation counts. + +Only an authoritative, profile-complete GREEN run writes v3. Current observed required results seal `observation_set_sha256` — sha256 over the sorted, de-duplicated identity array — plus `observation_count`, never the inline list; the `migration_baseline` summary has no observation identities and instead seals `baseline_receipt_sha256`, `resolution_sha256`, and the set digest `criterion_authorization_set_sha256`, so persisted size is bounded by the feature count rather than by obligations per feature. Reader, retention, and freshness comparisons cover those fields. A feature-completion entry may seal its proven impact closure; push/release entries seal their integration scope. The attestation policy continues to record engine and detector-catalog identity. A shared rule, capability outcome, required scenario, or prerequisite implementation change stales only features whose compiled closure references it; incomplete closure escalates instead of claiming selective freshness. + +While Cladding itself remains schema 0.1 during F6, serialize a schema-tagged legacy contract node containing exact legacy `text`, supported `ears`/`condition`/`action`/`response` values, scanner state (`parsed | opaque | conflict`), `legacy_unclassified`, and the applicable baseline/exemption identity. Do not invent 0.2 purpose or kind. The deliberate F7 self-migration invalidates those transitional hashes and the first post-migration GREEN gate writes a pure-0.2 v3. + +Receipts remain canonical files under `spec/evidence/`; attestation does not embed their bodies. It derives and seals the sorted set of current receipt identities and proof inputs. A stale or revoked receipt cannot be copied forward or automatically reissued merely to make attestation GREEN. + +The feature-level `contract_sha256` remains deliberately broader than an individual proof receipt. Evidence receipts bind to the subject-level hash defined in D20, so editing an unrelated sibling criterion can stale the feature attestation without invalidating proof that never claimed to cover that sibling. diff --git a/docs/design/spec-0.2/validation.md b/docs/design/spec-0.2/validation.md new file mode 100644 index 00000000..dfb5c3df --- /dev/null +++ b/docs/design/spec-0.2/validation.md @@ -0,0 +1,86 @@ + + +# Spec 0.2 validation protocol + +This guide explains how to challenge the accepted design without confusing a sound test harness with a finished Spec 0.2 runtime. Normative decisions remain in the [continuation router](../spec-0.2.md) and its canonical owners; the committed requirement ledger is [`tests/design/spec-0.2/requirements.yaml`](../../../tests/design/spec-0.2/requirements.yaml). + +## Reproduce + +```sh +npm run validate:spec-0.2 +npm run --silent validate:spec-0.2 -- --json +npx vitest run tests/design/spec-0.2 +``` + +The command reads repository state and opens an in-memory MCP client/server pair. It does not mutate the spec, refresh attestation, run a provider, or accept a challenger. The Vitest suite additionally exercises the real pre-init → initialized dynamic-tool transition in a temporary workspace. + +## Status vocabulary + +| Status | Meaning | +|---|---| +| `pass` | The named executable check observed its required result. | +| `fail` | The check observed a contradiction or broken invariant. | +| `implementation_pending` | Accepted target behavior has no runtime implementation yet. | +| `not_run` | The scenario is implementable but this run did not execute it. | +| `inconclusive` | Some evidence exists, but it cannot establish the named claim. | + +Only `fail` makes the contributor command exit non-zero during V0. That lets the validation boundary land before F1 while keeping pending and absent evidence visible. A feature acceptance gate may separately require a particular pending/not-run item to become pass before that feature completes. + +## Current V0 coverage + +The initial harness validates: + +- D01–D24 have one declared canonical owner, one matching owner heading, one + matching router navigation heading, and no normative heading in another + routed document; +- the P/L/B/C/T/U/A matrix contains 37 unique preregistered IDs documented by D16; +- J01–J13 preserve model-simulated, validation-active, implementation-pending, and evidence-decided journeys as different states, and a validation-active journey must name a test reference whose file and title the validator resolves, unless a named `evidence_from` scenario decides its state instead; +- preregistration is not presented as 37 passing runtime cases; +- current MCP identifiers equal the live in-memory tool/resource/prompt catalog; +- dynamic tool discovery is negotiated and the real initialization path emits list-changed; +- every shipped tool belongs to at least one candidate task profile; +- exact catalog and document bytes use a named estimator and unknown cache by default; +- legacy host-smoke evidence is labelled legacy read-surface evidence; +- the live token A/B and unconfirmed adoption remain visibly unproven, and the reference-host Spec 0.2 E2E is decided by recorded host evidence rather than by a local test. The 0.10.0 records were produced through the CLI signing path with the confirmation entered by automation on the maintainer's instruction, so they are registered-issuer wire evidence for both hosts; neither host's confirmation form was exercised, and that remains unverified. + +The model simulations currently compare composite versus bare criterion identity, shared versus feature-local capability writes, proof provenance versus persona topology, directed versus undirected graph projection, required versus advisory scenario freshness, upstream report strictness versus Cladding blocking, and every-edit versus tiered/background assurance cadence. These establish design mechanics and expose token/merge trade-offs; they are not substitutes for the pending production adapters. + +AB01–AB12 is a Codex-only, at-most-24-call, non-blocking comparison for the task-scoped MCP challenger and may support claims only on those tasks. D17 retains a separately preregistered larger retrieval study—40 tasks is the current optional candidate—only for later generalization; it is not a 0.10.0 gate and cannot prove adoption. + +The additive compiler and F6 assurance boundary now validate the F3 project policies, feature-owned capability catalog links, architecture candidates, in-memory `L = N` migration proof, D17 assurance contract/subject/verification/runtime closure slice, D21 registry-owned reducer membership, D22 foreground profile cadence and runner-control seals, and D23 v3 payload, per-feature compatibility, and completion-transaction boundaries. The F9d registered file-key issuer path is validation-active. This is not schema apply, disk cutover, F7 scenario delivery, F8 GraphIR v2 public cutover, or host-runtime evidence; those checks remain pending until their owning features add discriminating fixtures, and the F9 scheduler/cache runtime is deferred to 0.10.x. + +## Independent-oracle rule + +A validation fixture must not calculate its expected answer with the production join, traversal, parser, revision, closure, or reducer it is testing. Small hand-authored records, byte snapshots, property invariants, and independent sorted-record scans are preferred. Do not build a giant shadow compiler: it would become a second authority and could drift in the same direction. + +For each accepted decision, record: + +1. the owner and exact scenario ID; +2. the independent oracle or fault injection; +3. controlled inputs and final serialized outputs; +4. status and evidence location; +5. implementation or environment prerequisites; +6. a negative control that fails when the claimed design element is removed. + +## Challenger comparison + +When simulation suggests a better design, add it as a named challenger. Compare the accepted and challenger variants against the same correctness, failure-injection, concurrency, retrieval, context, and token fixtures. A challenger wins only if it preserves every required invariant and materially improves its preregistered objective. The harness reports the result; it never silently rewrites canonical owners. + +For MCP and LLM context comparisons, measure final UTF-8 bytes, named token estimates, provider usage when available, cache state, retries, and active time. Count avoidable bytes only when both arms produce the same required semantic output. Forced tool use may prove “efficiency when used”; only voluntary pull telemetry across completed cycles can prove adoption. + +## Feature boundary + +V0 is an additive pre-F1 safety boundary. Each later feature: + +1. changes its ledger entries from pending to executable only when fixtures exist; +2. runs the focused design simulation before production edits; +3. implements through the canonical kernel and adapter boundary; +4. runs the negative control and relevant integration journey; +5. updates the owner and decision log only for an accepted design change; +6. completes through the ordinary contributor and `clad done` gates. + +The complete target is not one global “simulation passed” badge. It is a ledger in which every release-required scenario has discriminating evidence and no pending/not-run state remains inside that release boundary. + +That boundary is declared rather than narrated: `release_boundary` in the executable ledger names the release and the scenarios it blocks on, `npm run validate:spec-0.2` reports each blocking row as satisfied or unmet, and `npm run validate:spec-0.2:release` turns any unmet row into a failure and a nonzero exit. A reference-host row is satisfied only when each declared host has a recorded cycle under `docs/dogfood/mcp11-0.10.0//` — a copied receipt, the trust registry snapshot it was checked against, and the attestation row naming its feature — and the copied receipt is signed by an issuer registered in that recorded snapshot. The validator cannot recompute a foreign workspace's digests, so it never calls such a receipt current. Both declared hosts recorded their cycle for 0.10.0, so J13 and the two reference-host checks read that evidence and the boundary reports satisfied. A validation-active MCP row must name a test reference the validator resolves, unless it is the reference-host row carrying recorded evidence; MCP11 is that one row, and its label is bound to that evidence in both directions, so it can neither claim a cycle that is not recorded nor stay silent about one that is. + +A journey that names `evidence_from` is discriminated by that scenario's evidence instead of a test reference. Its promotion to validation-active is bound to that recorded evidence in both directions — active only when the named scenario is satisfied, and never silent when it is — so a second, weaker local witness would add no discrimination. Every other validation-active journey still has to name a test whose file and title the validator resolves. diff --git a/docs/dogfood/e2e-0.10.0-packed-2026-09-07.md b/docs/dogfood/e2e-0.10.0-packed-2026-09-07.md new file mode 100644 index 00000000..64b81303 --- /dev/null +++ b/docs/dogfood/e2e-0.10.0-packed-2026-09-07.md @@ -0,0 +1,194 @@ +# 0.10.0 packed-tarball E2E campaign — 2026-09-07 + +- Engine under test: `cladding-0.10.0.tgz` packed from `feature/spec-0.2-0.10.0` + (485 files, 2,454,459 bytes), installed into an isolated npm prefix. `clad --version` = 0.10.0 + and the installed `dist/clad.js` is sha256-identical to the repo build + (`1bb59b7149663da210d1f74fb57dffdae6f2e3734edf31b20d89c55be2250e3d`). No global `clad` was + invoked. +- Build lineage: the hash above, and the reference-host cycles recorded below, are the build from + `0578818`. Three changes separate it from the build that ships. The first is the adopter binding + guidance of F-6349870d (`56f3cb9`, sha256 + `a679adcc0c7e2d24190a746a7061625510372b6b6a135ac7d458e0bd01ca0b6b`): the managed AGENTS.md and + CLAUDE.md renderers, the gate's note on unbound criteria, the `MISSING_TESTS` remedy text, and the + create-feature refusal text. The second is F-18a5883a (`e32c694`, sha256 + `b34e2755e9b9c891c1799545d17bf8c2ad1a891383bc4e93b74f453e58cd9f09`): two command-line repairs + found by the feature-scenario battery — asking for + a one-run assurance level the project cannot grant now prints the reason and exits nonzero instead + of falling back to a report with no cause, and a receipt imported on the command line is checked + against the project's registered signers the same way a host's request is. The third is F-71da4292 + (`b37d174`, sha256 + `06ec4cabe16e692a7b555cdcd4d71a2bd2f36643549561a2084ed7d88cc6d811`, the build that ships as + 0.10.0): the files a record seals are enumerated from what git tracks, so stray files on one + machine no longer leave the record stale on every other one. No verdict path changed + in any of them — F-6349870d's constraint criterion pins the tool set and the gate verdicts, and its + tests cover the pin, while F-18a5883a touches neither the tool catalog nor any verdict reached + without that flag — and the ledger validator verifies the recorded receipts against their trust + snapshot, not engine bytes, so the MCP11 evidence stands for the shipped build: the verdict path is + unchanged; the validator checks receipts, not the engine hash. The version + comparison in `docs/ab-evaluation/case-version-abc-094-vs-0100.md` ran on the `a679adcc…` build, + not the one that ships. +- Scope: the Spec 0.2 surface as an adopter meets it — a fresh 0.2 project through a full cycle, + a 0.1 project through the reviewed migration and the opt-in relocation, the MCP tool catalog's + declared byte budget, an L4 project through signed audit/UAT receipts to a completion at L4, and + a line-by-line recheck of the claims the reference-host runbook still marked unverified. +- Isolation: every cell ran under a sandbox `HOME` with LLM API keys unset, in a throwaway fixture + directory with its own git history. MCP cells drove the server over stdio with a scripted client, + never through a host UI. +- Two rounds. Round 1 ran against RC `da39cd9` and found three defects; each was fixed on this + branch with a regression test. Round 2 re-ran the whole matrix against the fixed RC `22c1d24`, + which is the tip these results describe. + +## Deterministic cells (sandbox HOME, packed engine) — all passed + +| Cell | Command / path | Expected | Observed | Verdict | +|---|---|---|---|---| +| 0 · Packed-engine identity | install the tarball into a private prefix, `clad --version`, hash `dist/clad.js` | packed engine is the repo build, and the retired surfaces are gone | 0.10.0; dist hash identical to the repo; no `src/drive`, no `skills/run`; `README.ja/zh/html` present (npm always ships `README*` — not a defect); `npm audit` on the installed tree reported the two advisories fixed in ③ below, and 0 after the fix | pass | +| a · Fresh 0.2 cycle | `clad init --schema 0.2` → MCP `initialize` → `clad_create_feature` → `clad_begin` → `clad check --tier=pre-push --strict` → `clad done` | a 0.2 project reaches a clean completion over the MCP surface | `serverInfo.version` 0.10.0 with 27 tools; strict pre-push GREEN with `incomplete_addresses: []`; `clad done` exit 0, reporting `independence: not applicable — this assurance profile asks for no human review`; the `done_attempted` event payload carries `{feature, worst, anyFailed, kept, blockers, identity}` and no independence key; a second pre-push run stayed GREEN | pass | +| b · 0.1 → 0.2 migration | `clad init --schema 0.1` → cycle → `clad migrate --to 0.2` preview/apply → `clad relocate-generated` preview/apply | the reviewed migration converts a completed 0.1 project and the opt-in relocation moves the generated files once | 0.1 cycle GREEN, `clad done` reporting `self-certified — no independent or human review yet`; `clad_begin` correctly refused on 0.1 (typed editing starts at 0.2); preview listed exactly four decisions to review; `--apply` refused with `DIRTY_PLANNED_PATH` until the planned paths were committed, then applied; relocation preview → apply wrote 3 files and reported state `new`, and a second apply wrote 0 | pass | +| b′ · Post-migration strict check | `clad check --tier=pre-push --strict` right after the apply | — | RED: the completed feature's criterion reported `unobserved: stale` for the unit and coverage rows. Root cause established below — the migration decision was answered `reject`, which by design authorizes nothing. Adding a `[covers:F-…/AC-…]` token to the test title turned it GREEN | pass (operator decision, not a defect) | +| c · MCP catalog byte budget | `stableJson({tools, resources, prompts})` over a live `tools/list` | the declared 140,308-byte budget is exact | 140,308 bytes, exact match (the budget moved to 140,498 bytes on 2026-09-08 when the schema 0.2 test-binding guidance entered three tool descriptions) | pass | +| d · L4 completion with signed receipts | `project.set_policy` over MCP → `clad key create` → cycle → strict pre-push → `clad_signoff` audit + UAT through the elicitation form → `clad done` | an L4 project completes only on verified receipts, and the attestation says so | `set_policy` accepted through `clad_prepare_spec_edit`/`clad_edit_spec` (`operations` + `input_revisions`); strict pre-push showed Smoke/Performance/Visual ✓ with Audit/UAT skipped; audit signoff recorded `code_test_review`/`evidence_sufficiency`/`independence` all pass, UAT recorded `no_surprise`/`tradeoff_acceptance` pass; `clad done` exit 0 with an attestation v3 row reading `achieved_assurance_level: L4, profile: completion`; two consecutive strict runs stayed GREEN with no rewrite loop, and pre-push reported the attestation refreshed | failed in round 1 → fixed → passed in round 2 | +| d′ · Independence refusal | second L4 feature signed with `--issuer ` under `independence_policy: require` | a self-signed completion is refused, not labelled away | `self-certified`, completion refused with *"Ask a registered issuer other than the implementation authors for a verified review, then re-run `clad done`."*; `status` unchanged | pass | +| d″ · Poisoned evidence census | a symlink planted under `spec/evidence` | the gate reports it cannot read the evidence safely rather than passing | `STALE_ATTESTATION` warn: *"verification could not be checked — the evidence files under spec/evidence could not all be read safely…"*. It named a different feature than the poisoned one; attribution follows scan order (see below) | pass | +| e · Runbook claim recheck | re-run each claim `docs/dogfood/mcp11-0.10.0.md` §8 marked unverified | the runbook's open claims resolve | completion profile green at L4 with the v3 row confirmed; `self-certified` reproduced (condition: the issuer string equals `git user.name`); a hand-edited `assurance_level: L4` passed `clad sync` with no repair; the §3.3 minimal `package.json` — no `vitest.config.ts`, no JUnit reporter, `@vitest/coverage-v8` only — went GREEN on Unit and Coverage because cladding injects its own reporter | pass | + +Round 1 (`da39cd9`) ran cells 0, a, b, c and d. It failed cell **d** at the completion step — the +defect ① below — and passed everything else. Cell **e** did not exist in round 1; it was added in +round 2 to close the runbook's own open claims, and the same defect would have blocked it. + +## Defects found → fixed on this branch (each with a regression test) + +1. **A workspace holding a signed receipt could not seal what it verified.** At L4 the gate sealed + its record of verification without counting the receipts on disk while the writer counted them, + so the two never agreed: `clad check` finished green and wrote nothing, and `clad done` then + refused with a cause it could not name. Both sides now read the same set, the freshness check + reads it too, and a refusal names the guard that refused. Feature `F-a0bd9c5a`; regression test + `tests/cli/completion-receipt-seal.test.ts`; commits `e5464f1`, `9124178`, `22c1d24`. +2. **The committed plugin bundle mirror was built against a stale dependency tree.** The mirror was + rebuilt from `node_modules` before the lockfile change had been installed, so the committed + bundle did not match the locked tree. Fixed in `7dd4540`. Standing rule: after any lockfile + change, `npm ci` first, then build the mirrors. +3. **Two known-vulnerable transitive dependencies.** The MCP SDK pulled a `fast-uri` (high) and a + `qs` (moderate) advisory. Moved to the patched releases in `782747e`; `npm audit` now reports 0. + +## Behavioral observations (not defects) + +- **A test claims a criterion from its `it()` title only.** A `[covers:F-…/AC-…]` token in a + `describe()` title is not read, and the criterion is reported as having nothing proving it works. + Round 2 hit this in cell a before the title was moved. +- **`clad migrate --apply` refuses a dirty planned path.** The apply plans exact paths and rejects + uncommitted content on any of them with `DIRTY_PLANNED_PATH`. Commit before migrating. +- **The post-migration RED in cell b′ was the operator's own answer, not a defect.** The migration + preview asks `PROJECT_LEGACY_L2_BASELINE: accept | reject` — a decision separate from the + assurance-level confirmation, about whether the completed 0.1 criteria may carry their historic + proof forward as an L2 baseline. The fixture answered `reject`, which writes `authorizations: []`; + the runtime then supplies no baseline candidates (`decision !== 'accept'` returns an empty set in + `migrationBaselineCandidatesFromWorkspace`), so each done criterion's unit and coverage rows fall + to `unobserved: stale` and strict refuses. Re-running the same migration from the same 0.1 commit + with the single answer changed to `accept` wrote one authorization and went GREEN at `L2`, with + those two rows reading `migration_baseline`. This repo's own migration answered `accept`, writing 1144 criterion + authorizations, which is why self never saw the RED. `docs/design/spec-0.2/model-and-migration.md` + states the rule — *"`reject` writes none"* — so the behavior is as designed; what is missing is + any statement of the consequence at the point of decision. Two further facts, both verified: + a 0.1 `test_refs` entry naming a whole file is carried into the baseline as a historic reference + but never satisfies a criterion's unit or coverage row on its own — the accepted receipt is what + does, and a ref carrying an exact testcase selector is treated as a mechanism in its own right, + though no fixture here exercised that case. The reviewed carry-forward path applies only to criteria whose + statement needed a text resolution and were then explicitly answered `retain`. The decision is + also effectively one-way: the baseline file is written once, and re-running the apply on an + already-migrated tree is a no-op rather than a re-decision. +- **The MCP catalog must be measured inside an initialized project.** In an empty directory the + server is in bootstrap mode and lists 3 tools; the 27-tool catalog the budget describes appears + only in a project. +- **Runner scripts must throw, not call `process`.** A bare `process` reference in a smoke, + performance, or visual script trips the runner-controls rule; the runbook's example + `node -e "process.exit(0)"` was replaced with a `throw` on failure. +- **Coverage needs a scope.** Without `coverage.include`, the smoke/performance/visual scripts land + in the denominator; one round-1 fixture measured 25% against a 70% floor for that reason alone. +- **`statement` is silently dropped on 0.1.** Creating a feature on a schema 0.1 workspace with a + `statement` field keeps nothing — the 0.1 field is `text`. A candidate fix for 0.10.x. +- **`test_refs` is rejected on 0.2.** `clad_create_feature` on a 0.2 workspace refuses the field; + binding happens through `[covers:]` in the test title instead. +- **The npm tarball always carries every `README*`.** `README.ja.md`, `README.zh.md` and the HTML + variants ship with the package by rule, not by accident. +- **The two schema versions word completion differently, and correctly.** 0.1 reports + `self-certified — no independent or human review yet`; a 0.2 profile that asks for no human review + reports `not applicable`. +- **The independence label compares strings, and that is its known limit.** The label reads + `independent` whenever the issuer name differs from the git author names credited for the + implementation roots. For one person wearing two hats, registering the issuer under exactly the + `git user.name` is what makes the label honest; any other spelling reads as `independent`. This is + the acknowledged boundary of the asserted author mapping, not a check that can be strengthened by + configuration. +- **The poisoned-census finding names a feature by scan order.** The warning correctly refuses to + vouch for the evidence, but attributes itself to whichever feature the scan reached, not to the + one whose directory was poisoned. Worth tightening in 0.10.x. +- **The release profile is not re-runnable in place, by design.** It rewrites the attestation as + part of running, so an immediate second run sees a dirty tree and fails its own cleanliness row. + Relatedly, the attestation records an observation time, so every passing pre-push rewrites it — + non-idempotent on purpose. + +## Reference-host MCP11 cycles + +Run separately from the matrix above, under `docs/dogfood/mcp11-0.10.0.md`, and recorded under +`docs/dogfood/mcp11-0.10.0//`. Two hosts, one small feature each, taken through a complete +Spec 0.2 cycle to a completion at L4 on verified receipts. + +| | Claude Code | Codex | +|---|---|---| +| Host version | Claude Code 2.1.263, headless | Codex CLI 0.153.0, `codex exec` | +| Engine | 0.10.0 from the RC tree at `0578818` (the build named in the lineage note above), via `.cladding/host/serve.cjs` | same | +| Feature / criterion | `F-3222d1cf` / `AC-24475f69` | `F-032b6453` / `AC-e435a582` | +| Gate before signing | exit 1, `unresolved`, achieved L3 — every executed stage `pass`, Audit and UAT `unobserved` | same shape | +| `clad done` | exit 0, `in_progress → done`, `independence: self-certified` | exit 0, same labels | +| Attestation row | schema 3, `achieved_assurance_level: L4`, `tool_identity: 0.10.0` | same | +| Gate after done | GREEN — exit 0, `green`, achieved L4, Audit and UAT `pass` | same | +| Audit receipt | `b0f8de83…` | `02621118…` | +| UAT receipt | `656c3cd3…` | `507c5963…` | +| Issuer key | `b3b3febf…` | `a237dda8…` | +| Evidence path | `docs/dogfood/mcp11-0.10.0/claude-code/` | `docs/dogfood/mcp11-0.10.0/codex/` | + +**How they were driven.** The implementation half of each cycle was the host itself, through the +MCP tools: Claude Code headless, and Codex through three `codex exec --approve-for-me` runs with +the server passed inline (`-c 'mcp_servers.cladding={…}'`) because Codex ignores a project +`.codex/config.toml` for a directory it has not been trusted with. The bypass flag was never used. +The signing half was **not** the host: both cycles signed through the `clad signoff` CLI, whose +confirmation prompt was answered by an automated pseudo-terminal at the maintainer's explicit +instruction. Neither host's own signoff form was exercised. Each cycle's `cycle.md` carries this +boundary in full, along with the Codex re-sign — its first receipts were discarded because the +`[covers:]` token sat at the end of the test title rather than at its start, where the engine's +carrier is anchored. + +Alongside the cycles, `clad doctor --hosts --yes` was re-run against the live hosts on +2026-09-07: Claude Code, Codex and Cursor verified, Gemini fail (unchanged), and Antigravity +fail — every one of its three checks timed out, where the 0.9.0 matrix had recorded it as +verified. `docs/dogfood/matrix.md` carries the refreshed grades and the README claim for +Antigravity was lowered to match. + +The validation ledger records both cycles as MCP11 evidence, and the release-boundary check +verifies each receipt offline against its own committed trust registry before reporting the +0.10.0 boundary satisfied. + +## Not verified in this campaign + +- The host applications' elicitation UI. Every signoff in cell d was driven by a scripted MCP client + over stdio, so what Codex and Claude Code actually render, and whether a person can answer it, is + untested here. +- Whether Codex `danger-full-access` auto-answers the elicitation form. The runbook forbids running + the cycle in that mode for exactly this reason; the claim itself remains unconfirmed. +- The runbook's time estimates. +- Whether a person, rather than an automation acting on the maintainer's instruction, can answer + the signoff confirmation. That holds for the MCP11 cycles above as well: they signed through the + CLI with a scripted pseudo-terminal. + +## Fixtures and reproduction + +Fixtures live in this session's scratch directory and are not committed: +`clean-room/` (round 1: `a-init02`, `b-migrate`, `d-l4`) and `clean-room2/` (round 2: the tarball, +`a-init02`, `b-migrate`, `c-catalog-isolated`, `d-l4`, `e-runbook-checks`, plus the raw verdict JSON +for every cell). + +To reproduce a cell: pack the branch (`npm pack`), install the tarball into a private prefix, export +a sandbox `HOME`, then run the cell's fixture recipe with that prefix's `clad` on the PATH. The +migration cell is reproducible from its own git history — the 0.1 baseline commit is the migration +input, and the decision file is the only thing that differs between the `reject` and `accept` runs. diff --git a/docs/dogfood/matrix.md b/docs/dogfood/matrix.md index 7d92f647..f36425e3 100644 --- a/docs/dogfood/matrix.md +++ b/docs/dogfood/matrix.md @@ -1,18 +1,18 @@ # Host support matrix - + -- Cladding version: `0.9.0` -- Generated: 2026-07-16T07:48:44.436Z +- Cladding version: `0.10.0` +- Generated: 2026-09-07T13:32:16.883Z | Host | list-features | get-feature | run-check | wiring | Grade | |---|---|---|---|---|---| | claude | pass | pass | pass | — | verified | | gemini | fail | fail | fail | — | fail | -| antigravity | pass | pass | pass | — | verified | +| antigravity | fail | fail | fail | — | fail | | codex | pass | pass | pass | — | verified | -| cursor | fail | fail | fail | pass | fail | +| cursor | pass | pass | pass | pass | verified | **Legend** @@ -23,6 +23,7 @@ **Why not-run / fail** - `gemini`: list-features, get-feature, run-check failed — e:///opt/homebrew/Cellar/gemini-cli/0.42.0/libexec/lib/node_modules/@google/gemini-cli/bundle/chunk-7VVHSNDQ.js:273233:5) at process.processTicksAndRejections (node:internal/process/task_queues:104:5) -- `cursor`: list-features, get-feature, run-check failed — exit 1: ActionRequiredError: You've hit your usage limit Get Cursor Pro for more Agent usage, unlimited Tab, and more. +- `antigravity`: list-features, get-feature failed — timed out after 120s: +- `antigravity`: run-check failed — timed out after 300s: > Live grades land when a human runs `clad doctor --hosts` with consent (`CLAD_HOST_SMOKE=1` or `--yes`). Without consent this baseline records only what is checkable for free — Cursor wiring — and leaves all LLM-driven surfaces `not-run`. diff --git a/docs/dogfood/mcp11-0.10.0.md b/docs/dogfood/mcp11-0.10.0.md new file mode 100644 index 00000000..1b14839b --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0.md @@ -0,0 +1,738 @@ +# MCP11 — reference-host L4 cycles for 0.10.0 + +Runbook for the two live host cycles the 0.10.0 gate requires: Codex and Claude Code each +complete a real Spec 0.2 cycle (spec edit → implementation → verification → L4 attestation) +over MCP, leaving a signed human receipt behind. + +This document is written from the 0.10.0 source in this repository. Every command and +option below was read out of the code that implements it. A packed-tarball dry-run on +2026-09-07 (`docs/dogfood/e2e-0.10.0-packed-2026-09-07.md`) drove the whole mechanism with a +scripted MCP client and confirmed most of what was open; the steps it settled are marked +**confirmed in the RC dry-run**, and §8 lists the three that still are not. Nobody has yet run +this runbook through a real host UI, which is the point of the exercise. + +--- + +## 1. Purpose, and what counts as evidence + +MCP11 is rung 4 of the MCP validation ladder in `docs/design/spec-0.2/mcp.md`: *"Codex and +Claude Code each complete a real Spec 0.2 spec-edit → implementation → verification → L4 +attestation cycle using MCP where routed."* Wire conformance does not prove this, and this +does not prove efficiency or adoption. It is one claim: the surface is usable for a whole +cycle by two independent hosts. + +This repository runs at **L2**, so the cycle cannot be performed here. It is performed in a +separate throwaway **fixture project** configured at L4, one run per host. + +### What the evidence is, and what it is not + +A completed cycle leaves, per host: + +- one or more signed portable receipts at `spec/evidence//.yaml` +- the committed public trust registry `spec/trust/issuers.yaml` +- the feature's attestation v3 row in `spec/attestation.yaml`, carrying + `achieved_assurance_level` and `trust_snapshot_sha256` +- the gate verdict JSON that reports the scope's `independence` label + +Honest limits, all of them structural rather than incidental: + +- **The fixture is not this repository.** The cycles prove the host/MCP path works for a + Spec 0.2 L4 project; they say nothing about cladding's own assurance level. +- **Two different labels both called "independence" — do not conflate them.** + - The *gate verdict's scope label* is the one MCP11 cares about. It reads `independent` + only when a verified audit receipt has `checks.independence: pass` **and** its issuer name + falls outside the git author names credited for the feature's implementation roots + (`isIndependentIssuer` in `src/proof/authors.ts` compares the issuer string against + `git log -1 --format=%an` for each root, case-insensitively). Since you both implement and + sign, this should read `self-certified`. **Register the issuer under exactly the name your + git commits carry**, or the string comparison manufactures an `independent` label for one + person wearing two hats. A self-certified L4 is a legitimate L4; a falsely independent one + is a lie in the ledger. + - On a Spec 0.2 workspace `clad done` prints that same attested scope label, so its + `independence` line reads `self-certified` here too, and under + `independence_policy: require` that label is what refuses or keeps the completion. The + older *evidence-author* label (`computeIndependence` in `src/hitl/independence.ts`) — any + evidence entry whose author is `human` makes the feature `independent` — survives on + schema 0.1 workspaces and in `clad verdict`'s per-feature independence list. That list is + still computed from the evidence ledger, so through 0.10.x it can read `independent` for a + feature whose completion reported `self-certified`; the completion output is the one to + trust. +- **A signature proves an assertion, not a human.** `src/proof/signoff.ts` says so in its own + words: the confirmation prompt is consent friction, not proof of humanity. Any process + running as this user can answer the form and read the private key. The strongest offline + claim the recorded snapshot supports is *"signed by an issuer registered in this trust + registry, over these exact reviewed inputs."* +- **The private key never travels with the evidence.** It lives outside the workspace + (`~/.cladding/keys/`), so copying the fixture copies the ability to *verify*, never the + ability to *sign*. + +--- + +## 2. Preconditions + +### Before you start — check all six + +1. The engine is the RC: this repository's `bin/clad` at tip `22c1d24` or later, or a + `npm pack` tarball installed into a private prefix. Either must print `0.10.0`. +2. No global `clad` on the PATH ahead of it. A stale global 0.9.x silently produces a run that + proves nothing. +3. Two separate fixture directories, one per host. The two ledgers must not mix. +4. Each fixture's `spec.yaml` persists `assurance_level: L4` (§3.2). +5. The issuer name in each fixture equals that fixture's `git config user.name` exactly (§3.4). +6. You know where the three evidence files go afterwards: + `docs/dogfood/mcp11-0.10.0//` with `` being `codex` or `claude-code` (§6). + +### The RC build + +The cycles must run against the release-candidate build in this repository, never a globally +installed `cladding` from npm. + +```bash +npm run build +node bin/clad --version +``` + +`bin/clad` is a bundle: source edits are not live until `npm run build` runs. The version +must print `0.10.0`; if it prints `0.9.x`, the version bump has not landed yet and the run is +not an RC run. + +Keep the absolute path of this repository at hand — the fixture wiring embeds it: + +```bash +pwd # e.g. /Users/you/Developer/work/cladding — referred to below as +``` + +### Host versions + +- Claude Code with elicitation support (form + URL) — the floor is understood to be **2.1.76+** +- Codex with elicitation support (form) — the floor is understood to be **0.119+** + +Those two version floors come from the host release notes, not from this codebase, and are +**unverified until the RC dry-run**. Confirm the installed versions before starting; a host +without an elicitation capability cannot ask anybody anything, and `clad_signoff` will return +`HUMAN_REQUIRED` (`elicitFeatureIdConfirmation` returns no confirmation when the client +declares no elicitation capability). + +### Codex sandbox warning + +**Do not run the Codex cycle in `danger-full-access`.** In a blanket auto-approval mode the +host answers its own elicitation form, so the "human re-typed the feature id" step is +performed by the agent. The receipt would still be signed and would still verify offline — +which is exactly why the run must not happen: the evidence would claim a human confirmation +that never occurred. Run Codex in its normal interactive approval mode and answer every prompt +by hand. (`docs/setup.md` notes the related fact that non-interactive `codex exec` auto-denies +Cladding's write-capable onboarding tools.) + +Codex also loads a project `.codex/config.toml` only for a repository it trusts; accept its +normal project-trust prompt when opening the fixture. That is a Codex security boundary and +setup does not bypass it. + +--- + +## 3. Fixture project setup + +Do this **twice** — one fixture per host, so the two cycles cannot contaminate each other's +ledger. Use a distinct directory per host, e.g. `mcp11-codex` and `mcp11-claude-code`. + +### 3.1 Scaffold + +```bash +mkdir ~/mcp11- && cd ~/mcp11- +node /bin/clad init --schema 0.2 --no-llm --name mcp11- +``` + +`--no-llm` keeps onboarding deterministic; `--schema 0.2` is the current schema (it is also +the default, passed here so the run is explicit). + +### 3.2 Raise the project to L4 + +`clad init` seeds `project.assurance_level: L2` (see `src/cli/init.ts`). Raise it before the +first commit, while `spec.yaml` is still a fresh seed — open `spec.yaml` and change: + +```yaml +project: + assurance_level: L4 +``` + +The alternative is the MCP route once the host is wired: `clad_prepare_spec_edit` to obtain +the current `input_revisions`, then `clad_edit_spec` with the operation +`{"kind": "project.set_policy", "assuranceLevel": "L4"}`. Note the MCP call shape: the +operation goes inside an `operations` array, and the call must carry the `input_revisions` that +`clad_prepare_spec_edit` just returned. Both routes reach the same field; the hand edit is +simpler because nothing has been committed yet. **Confirmed in the RC dry-run:** `clad sync` +accepts the hand-edited seed with no further repair. + +The level must be *persisted* in `spec.yaml`, not passed as a one-run +`--assurance-level=L4`: the completion gate behind `clad done` reads the configured project +level. + +### 3.3 Toolchain + +The fixture must be able to actually run every obligation its level demands, or the gate +reports `unobserved` and refuses to go green. Two facts from the code drive this: + +- A missing runner is a *skip* (exit code 2), and a skipped required obligation reduces to + `unobserved`, which makes the verdict `unresolved` — never green. +- At L3 or L4 the quality obligations become **required**: `requiresQuality` is set from the + level alone (`src/cli/clad.ts`), so Smoke (`stage_3.1`), Performance (`stage_3.2`), and + Visual (`stage_3.3`) all apply. They *are* part of the completion profile that `clad done` + runs, and at L4 they also run inside `--tier=pre-push`. Measured on both 0.10.0 fixtures: + a strict pre-push run before any receipt exists executes the 3.x obligations and passes + them, while `stage_4.1` (Audit) and `stage_4.2` (UAT) report `unobserved` — so the verdict + is `unresolved` and the exit code is 1. **At L4 a strict pre-push run cannot be green until + the human receipts are signed.** That is the expected pre-signing shape, not a defect. + +For a Node/TypeScript fixture, cladding's toolchain detection resolves the gates from +`package.json` and config presence (`src/stages/toolchain/detect.ts`): `npx tsc --noEmit` +for Type, ESLint for Lint when an ESLint config file exists, `npx vitest run` for Unit, and +`npx vitest run --coverage` for Coverage — the Coverage gate is dropped entirely unless a +`coverage` script or `@vitest/coverage-v8` / `@vitest/coverage-istanbul` is present. Smoke, +Performance, and Visual call `npm run --silent smoke|perf|visual`. + +A minimal fixture `package.json` therefore looks like: + +```json +{ + "name": "mcp11-fixture", + "private": true, + "type": "module", + "scripts": { + "test": "vitest run", + "typecheck": "tsc --noEmit", + "lint": "eslint .", + "smoke": "node smoke.mjs", + "perf": "node perf.mjs", + "visual": "node visual.mjs" + }, + "devDependencies": { + "typescript": "^5", + "eslint": "^9", + "vitest": "^3", + "@vitest/coverage-v8": "^3" + } +} +``` + +Keep the script bodies free of `process`. Sealing the runner-control closure parses the script +files the gate's commands reach, and a bare `process` — like `globalThis`, `import.meta`, `Bun` +and `Deno` — reads as an ambient runtime input it cannot seal, which leaves the closure +incomplete. So `node -e "process.exit(0)"` is exactly the wrong placeholder. Signal failure by +throwing instead. This is the `smoke.mjs` the dry-run actually ran: + +```js +// smoke.mjs +import {greet} from './src/greeting.ts'; + +const result = greet('smoke'); +if (result !== 'Hello, smoke!') throw new Error(`smoke failed: ${result}`); +console.log('smoke ok'); +``` + +The dry-run's `perf.mjs` and `visual.mjs` were deliberately empty — a comment and nothing else, +which exits 0 and passes. That is honest for a mechanism dry-run and dishonest for MCP11: write +real checks here, in the same throw-on-failure shape, so the evidence means something. + +Add `tsconfig.json` and `eslint.config.js` so the Type and Lint runners have something to +resolve. + +`vitest.config.ts` is optional. Add one if you want the coverage denominator scoped: + +```ts +import {defineConfig} from 'vitest/config'; + +export default defineConfig({ + test: {coverage: {include: ['src/**']}}, +}); +``` + +Without that scope the `smoke.mjs` / `perf.mjs` / `visual.mjs` files land in the denominator and +drag a small fixture under the floor — a dry-run fixture measured 25% against a 70% floor for +that reason alone, with every test passing. + +No test-report configuration is needed: on a vitest runner cladding injects its own +`--reporter=json --outputFile=…` for the gate run and reads those bytes directly, so the +fixture needs no JUnit reporter. **Confirmed in the RC dry-run:** the minimal `package.json` +above, with `@vitest/coverage-v8` as the only coverage dependency and no reporter +configuration at all, took both Unit and Coverage to green. + +```bash +npm install +``` + +Two drift findings are normal at this stage and both are cheap to clear: + +- `INVENTORY_DRIFT` after adding files — run `node /bin/clad sync`, which recounts and + rewrites the inventory. +- `CONVENTION_DRIFT` on a new source or test file — the fixture's own conventions expect a + one-line header comment at the top of each file. Add one. + +### 3.4 Register the signing issuer + +```bash +git config user.name # copy this string exactly +node /bin/clad key create --issuer "$(git config user.name)" +node /bin/clad key list +``` + +The issuer string must equal `git config user.name` **byte for byte**. That comparison is the +whole independence label: a dry-run cycle signed as `runbook-dryrun` was labelled `independent` +purely because the string differed from the committing author, while the same cycle signed +under the git author name reported the honest `self-certified`. A falsely independent MCP11 +receipt would defeat the purpose of the exercise. + +`key create` writes the private key to `~/.cladding/keys/.ed25519` with owner-only +permissions (`CLADDING_KEYS_DIR` overrides the store) and commits only the public half into +`spec/trust/issuers.yaml` through the normal spec transaction. It requires a schema 0.2 +workspace, and it **refuses to register the same issuer name twice** — there is no rotation +path, so pick the name once. + +As noted in §1, use the name your git commits carry so the independence label stays honest. +Both fixtures can share one issuer identity: the registry entry is per-workspace, but the +private key is machine-wide, so the second fixture's `key create` will mint a *second* key +under the same name. That is fine — each fixture's registry snapshot then names its own key +id. + +### 3.5 First commit + +```bash +git init && git add -A && git commit -m "chore: mcp11 fixture scaffold" +``` + +Committing matters for more than tidiness: the implementation author mapping falls back to +the git author of each implementation root (`gitRootAuthor` in `src/proof/authors.ts`). An +uncommitted implementation maps to `unknown`, which makes the author mapping incomplete and +turns the scope independence label into `unobserved` rather than the honest `self-certified`. + +A gate run at this point — a scaffold with zero features — is expected to be RED, and both +0.10.0 fixtures were: TypeScript reports `TS18003` (no inputs found), the unit run finds no +tests, and the deliverable smoke import fails. None of that is a fixture defect; the first +green-able gate is the one after the first feature has a module and a bound test. + +--- + +## 4. Host wiring + +Run cladding's own setup **from the RC build, inside the fixture**. It writes a launcher at +`.cladding/host/serve.cjs` that hard-codes the engine path of whichever build ran setup, so +running it from `` is exactly what pins the fixture to the RC: + +```bash +cd ~/mcp11- +node /bin/clad setup --host claude # in the Claude Code fixture +node /bin/clad setup --host codex # in the Codex fixture +``` + +`--host` takes one host name (`claude`, `codex`, `gemini`, `antigravity`, `cursor`) or `all`; +with no flag it wires every host detected on the machine. + +What this produces: + +**Claude Code** — project `.mcp.json`: + +```json +{ + "mcpServers": { + "cladding": { + "command": "node", + "args": [".cladding/host/serve.cjs"] + } + } +} +``` + +**Codex** — project `.codex/config.toml` (project-scoped; setup does *not* write +`~/.codex/config.toml` for this path): + +```toml +[mcp_servers.cladding] +command = "node" +args = [".cladding/host/serve.cjs"] +description = "cladding MCP server (project-scoped by `clad setup`)" +default_tools_approval_mode = "writes" +``` + +The launcher itself contains the absolute engine path: + +```js +const engine = "/dist/clad.js"; +``` + +Verify that line before starting the cycle: + +```bash +grep engine .cladding/host/serve.cjs +node .cladding/host/serve.cjs --version # must print 0.10.0 +``` + +If it names a global npm install instead, setup ran from the wrong binary — delete +`.cladding/host/` and re-run setup from `/bin/clad`. + +**Four Codex facts measured on the 0.10.0 cycle**, all of which shape how a headless run has to +be driven: + +- Codex reads a project `.codex/config.toml` only for a directory it already trusts. A fixture + that was never opened interactively is simply run **without** that file — silently, with no + prompt and no warning. Pass the server inline instead: + `-c 'mcp_servers.cladding={command="node",args=[".cladding/host/serve.cjs"]}'`. +- Plain `codex exec` refuses the MCP write tools. `--approve-for-me` routes approval requests + through automatic review inside the workspace-write sandbox and is enough for a full cycle; + `--dangerously-bypass-approvals-and-sandbox` is not needed and was not used. +- `codex exec resume` rejects `--approve-for-me` (`error: unexpected argument`), so a follow-up + instruction has to be a fresh `codex exec` rather than a resumed thread. +- `disabled_tools=[…]` inside the same `-c` override keeps named tools out of the host's reach. + Its effect on the advertised catalog was not independently confirmed; the check that + *is* honest is that `spec/evidence` stayed absent through every implementation run. + +--- + +## 5. The cycle, per host + +Run this checklist once per host, in its own fixture. Open the host in the fixture directory +and let it drive Cladding through MCP; you are the human in the loop, not the operator typing +cladding commands on its behalf. + +### 5.0 Prompt to give the host AI + +> This project uses Cladding at assurance level L4. Using the Cladding MCP tools (not the +> `clad` CLI), take one small feature through a complete cycle: a greeting module with one +> exported function and one test that covers it. +> +> 1. Create the feature spec entry with `clad_create_feature`. Give it one or two acceptance +> criteria and list the module file you will write in `modules`. Every criterion needs a +> `statement`; the call is rejected without one. Do not pass `test_refs` — a Spec 0.2 +> workspace rejects that field; tests claim criteria from their own titles. +> 2. Start the cycle with `clad_begin`. +> 3. Write the module and the test. Each test claims its criterion by carrying a +> `[covers:F-/AC-]` token **at the very start of the `it()` title**, like +> `it('[covers:F-1a2b3c4d/AC-9f8e7d6c] greets by name', …)`. A token placed anywhere else +> in the title — including at the end — is not read as a binding. +> 4. Run the gate with `clad_run_gate` (tier `pre-push`, strict) until every executable stage +> passes and the only unobserved rows are Audit and UAT. At L4 that is as far as the gate +> can go before a human signs, so do not wait for a green verdict. +> 5. Then commit your work and stop, and tell me. I will sign the human receipts myself. +> +> Do not hand-write `status: done`, and do not edit any file after I have signed. + +### 5.1 Spec entry — `clad_create_feature` + +Observe: a new file appears at `spec/features/-.yaml` with an `F-` id, +`modules`, and `acceptance_criteria` each carrying a `statement`. There is no `test_refs` field +on a 0.2 criterion; `clad_create_feature` refuses one if the host tries. + +The binding is not optional bookkeeping — it is what makes the verified signoff possible at +all. A criterion with no readable, bound test leaves its verification closure incomplete, and +the signoff then fails with `INVALID_WORKSPACE` ("The subject closure is not complete…") rather +than anything that mentions tests. On 0.2 that binding lives in the test file: a +`[covers:F-/AC-]` token inside the `it()` title. Two things that look equivalent and +are not: + +- the token must be in the `it()` title, not the enclosing `describe()` title. A dry-run cycle + put it on the `describe()` and the criterion was reported as having nothing proving it works. +- the token must lead the title. The carrier pattern in `src/proof/vitest-jest.ts` is anchored + to the start of the title, so a token that trails the prose is silently not a binding. The + Codex cycle hit exactly this: its first two receipts had to be discarded because `clad done` + refused with `MISSING_TESTS`, and moving the token from the end of the title to the front + fixed it. +- the token names the composite criterion address, not a file path. + +Check this here, not at signing time. + +### 5.2 Cycle start — `clad_begin` + +Observe: the tool reports the cycle started, and `spec/attestation.yaml` / the feature index +record the pre-cycle checkpoint. + +### 5.3 Implementation and tests + +Observe: the module file listed in `modules` exists, and the test file exists with test +titles carrying the criterion's `[covers:…]` token. + +### 5.4 Gate — `clad_run_gate` + +`clad_run_gate` with `tier: "pre-push"` and `strict: true` projects onto +`clad check --tier=pre-push --strict --json`. That tier covers Type, Lint, Drift, +Architecture, Secret, Unit, Coverage, Spec Conformance, and Deliverable Smoke, and at L4 it +also carries the level's own obligations: the 3.x quality rows run, and Audit (`stage_4.1`) +and UAT (`stage_4.2`) apply but cannot be anything but `unobserved` until a human receipt +exists. + +Observe, at L4: every executed stage `pass`, with `stage_4.1` and `stage_4.2` `unobserved`, +an `unresolved` verdict and exit code 1. That is the correct pre-signing state. An +`unobserved` row on any *other* stage almost always means a runner is missing, not that a +check failed. Below L4 the same run is simply green. + +### 5.5 Commit before signing + +```bash +git add -A && git commit -m "feat: greeting module" +``` + +A receipt seals four digests: the subject contract, the reviewed inputs (the bound tests and +their source bytes), the runtime dependency closure, and the implementation author mapping. +Any change to code, tests, or the spec entry after signing makes the receipt stale and forces +a re-sign. Commit first, then sign, then change nothing. + +### 5.6 Audit signoffs — one per acceptance criterion + +Now you, the human, drive the host to call `clad_signoff` — **once for each acceptance +criterion**: + +```json +{ + "feature": "F-", + "claim": "audit", + "criterion": "AC-", + "result": "pass", + "verified": true, + "issuer": "" +} +``` + +An audit receipt's subject is a single criterion (`criterion:F-…/AC-…`), so there is no way +to cover several at once. Its three checks — `evidence_sufficiency`, `code_test_review`, +`independence` — are all recorded as the result you gave. + +Observe, for each call: + +- the host shows an elicitation form asking you to re-enter the feature id; type it exactly +- a new file at `spec/evidence//.yaml` +- the tool result carries `ok: true`, a `digest`, an `issuerKeyId`, and a `verification` + block reading `assurance: verified`, `currentness: current` + +### 5.7 UAT signoff — one per feature + +```json +{ + "feature": "F-", + "claim": "uat", + "result": "pass", + "verified": true, + "issuer": "" +} +``` + +A UAT receipt is feature-scoped and must not name a criterion; cladding fills in a verdict +for **every current criterion** of the feature automatically, because a partial matrix counts +as unobserved rather than a pass. `stage_4.2` (UAT) depends on `stage_4.1` (Audit), so sign +the audits first. + +Observe: a second (or Nth) receipt file, and the same `verified` / `current` verification. + +### 5.8 Completion — `clad done` + +There is no MCP `done` tool. The host must run the CLI: + +```bash +node .cladding/host/serve.cjs done F- +``` + +For a schema 0.2 workspace this evaluates the **completion** profile scoped to the feature at +the project's configured level — which at L4 means the L1/L2 obligations plus Smoke, +Performance, Visual, Audit, and UAT. It only records `status: done` with its attestation +receipt when that profile is green. + +Observe: + +- the command reports the feature done +- `spec/attestation.yaml` carries a v3 row for the feature whose + `achieved_assurance_level` is `L4`, alongside its `trust_snapshot_sha256` +- the `done` output's own `independence` line reads `self-certified` — it is the attested + scope label, and for one person who both implements and signs that is the honest reading + (`unobserved` there means the author mapping is incomplete, usually uncommitted code) +- the gate verdict's **scope** independence label, read from `clad check --json`, says the + same thing; `clad verdict`'s per-feature list still answers from the evidence ledger (§1) +- the fixture leaves the default `independence_policy: label`, so the label annotates only, and + a `self-certified` completion passes. That is deliberate, not a loophole — the label is the + record. Setting `independence_policy: require` instead makes the same label refuse, with + *"Ask a registered issuer other than the implementation authors for a verified review, then + re-run `clad done`"*, leaving `status` untouched. Both behaviors were reproduced in the RC + dry-run. Keep `label` for MCP11: the point is to record an honest self-certified L4, not to + manufacture an independent one + +The attestation row itself carries no independence field. + +The gate does read the fixture's committed trust registry: for a schema 0.2 workspace the +gate plan calls `loadTrustSnapshot('.')` and censuses `spec/evidence/`, so receipts signed by +a registered issuer are what turn `stage_4.1` / `stage_4.2` from `unobserved` into `pass`. + +--- + +## 6. Collecting the evidence + +Per host, copy the artifacts into this repository under +`docs/dogfood/mcp11-0.10.0//`, where `` is `codex` or `claude-code`: + +```bash +HOST=codex # or claude-code +mkdir -p /docs/dogfood/mcp11-0.10.0/$HOST +cp -R spec/evidence/F- /docs/dogfood/mcp11-0.10.0/$HOST/evidence +cp spec/trust/issuers.yaml /docs/dogfood/mcp11-0.10.0/$HOST/issuers.yaml +cp spec/attestation.yaml /docs/dogfood/mcp11-0.10.0/$HOST/attestation.yaml +``` + +Exactly three things are read back, and each `_ref` must resolve to **one file** that sits +under `docs/dogfood/` with the host as a path segment: + +| Ledger field | What it must name | +|---|---| +| `receipt_ref` | one signed receipt yaml — e.g. `docs/dogfood/mcp11-0.10.0//evidence/.yaml` | +| `trust_ref` | the copied `issuers.yaml`, which must register the issuer and key id that signed that receipt | +| `attestation_ref` | the copied `attestation.yaml`, whose text must contain the receipt's own feature id | + +The two hosts must file two *different* receipts: identical digests are read as one cycle filed +twice, and both hosts are then reported unsatisfied. An absolute path, or one that escapes +`docs/dogfood/` through `..`, is refused as "not a host-owned copy". + +If the full attestation file is noisy, an excerpt file holding just the feature's v3 row is +acceptable in its place — but excerpt honestly, and keep every field of the row. + +What must **not** be copied: anything from `~/.cladding/keys/`. The private key is not +evidence, and the evidence is verifiable without it. + +Also worth capturing alongside, as plain text, so the record is readable later: the +`clad done` output (achieved level and independence label) and the host + cladding versions +the cycle ran on. + +Then hand the copied files to the next implementation round. That round — not the person +running this cycle — records them in the executable ledger +(`tests/design/spec-0.2/requirements.yaml`): two MCP11 `evidence` entries, one per host, each +naming `host`, `receipt_ref`, `trust_ref`, `attestation_ref`, and `recorded_at`, plus the MCP11 +and J13 transitions to `validation-active`. Both labels are bound to that evidence in both +directions, so neither may be moved ahead of it or left behind it. + +--- + +## 7. Troubleshooting + +**`HUMAN_REQUIRED` from `clad_signoff`.** Three distinct causes, all reported with the same +code: + +1. *No confirmation.* The host declared no elicitation capability, you declined the form, or + the id you typed did not match the feature id exactly. The asserted history entry is still + written — that is by design, not a partial failure. +2. *Issuer not registered.* The message names `spec/trust/issuers.yaml` and tells you to run + `clad key create --issuer `. You are in the wrong workspace, or the fixture's + registry was never committed. +3. *No private key on this machine.* The registry entry exists but + `~/.cladding/keys/.ed25519` does not — typically after copying a fixture between + machines. Keys do not travel; re-register on the machine that will sign. + +**`HUMAN_REQUIRED` from a plain `clad signoff`.** In a schema 0.2 workspace, an asserted +signoff *always* returns `HUMAN_REQUIRED` and exits 1, by design: 0.2 requires a signed +receipt, so recording only the assertion is an incomplete result rather than a success. This +is not a bug — use `--verified --issuer `. + +**`clad signoff --verified` from inside a host's shell tool.** The CLI path needs a real +terminal so a person can be prompted; a non-TTY stdin has nobody to ask, so it records +asserted history and returns `HUMAN_REQUIRED`. The CLI path is for your own terminal. The +MCP11 evidence path is `clad_signoff` with `verified: true` through the host's elicitation +form. + +**`INVALID_WORKSPACE` — "The subject closure is not complete."** Not a human-channel problem +at all. Something in the feature's closure cannot be enumerated: a criterion with no +`[covers:…]` token in any test title, a token naming a criterion that does not exist, a `modules` +entry naming a missing file, or a `depends_on` naming a feature that is not in the spec. Fix +the binding, re-run the gate, then sign. + +**A stage shows `unobserved` instead of pass or fail.** The runner was skipped, not failed — +usually a missing `package.json` script or an absent tool. At L4 this bites hardest on Smoke, +Performance, and Visual, which only enter the picture at L3+ and therefore pass the pre-push +tier unnoticed until `clad done` runs the completion profile. Add the scripts (§3.3). + +**A receipt that verified yesterday now reads `stale`.** The receipt's sealed digests no +longer match: code, tests, the spec entry, or the author mapping changed after signing. Sign +again after the change, and do not edit between signing and `clad done`. + +**Version confusion.** If anything behaves like 0.9.x, check `node .cladding/host/serve.cjs +--version` — the fixture may be wired to a global npm `clad`. And remember `bin/clad` is a +bundle: after any source change in ``, `npm run build` before the fixture sees it. + +--- + +## 8. Time, and what stays unverified + +Rough estimate for one host, assuming the toolchain choices in §3.3 hold: about 45–60 minutes +for the first fixture (most of it spent on toolchain setup and the first signoff), and 20–30 +minutes for the second. This is an estimate, not a measurement. + +The 2026-09-07 packed-tarball dry-run settled most of the list this section used to carry. What +it confirmed, what it repaired, and what is still open: + +| Claim | State | +|---|---| +| The completion profile goes green in a fixture this small, and the attestation row reads `achieved_assurance_level: L4` | **confirmed** — with `profile: completion`, and two consecutive strict runs after it stayed green | +| The scope independence label reads `self-certified` rather than `unobserved` | **confirmed**, on the condition now spelled out in §3.4: the issuer string must equal `git config user.name` | +| Hand-editing `assurance_level: L4` into the freshly seeded `spec.yaml` passes `clad sync` | **confirmed**, no repair needed | +| The minimal §3.3 `package.json` gives every L4 obligation a live runner, including Coverage's dependency requirement | **confirmed** — `@vitest/coverage-v8` alone, no `vitest.config.ts` and no reporter configuration, took Unit and Coverage green | +| The §3.3 recipe as originally written | **repaired** — the `perf`/`visual` one-liners tripped the bare-`process` rule, and unscoped coverage put the runner scripts in the denominator (25% against a 70% floor). Both fixed above | +| The §5.0/§5.1 spec-entry recipe as originally written | **repaired** — a 0.2 workspace rejects `test_refs`; the binding is a `[covers:]` token in the `it()` title, and only the `it()` title | +| An L4 workspace holding signed receipts could not seal what it verified | **repaired in the engine** — the dry-run found it, and `22c1d24` fixes it with a regression test. A pre-`22c1d24` build cannot complete this runbook | +| The host version floors (Claude Code 2.1.76+, Codex 0.119+) and the actual shape and behavior of each host's elicitation form | **still unverified** — every dry-run signoff went through a scripted MCP client over stdio, not a host UI | +| The Codex project-trust prompt flow in the TUI, and the claim that `danger-full-access` auto-answers the elicitation form | **still unverified** — the 0.10.0 Codex cycle bypassed project trust with an inline `-c` override instead of granting it | +| Either host's own signoff elicitation form | **still unverified** — both 0.10.0 cycles signed through the `clad signoff` CLI, driven by an automated pseudo-terminal at the maintainer's instruction (§9) | +| At L4 a strict pre-push run is green before the human receipts exist | **corrected** — it cannot be. Both cycles measured `unresolved` with `stage_4.1`/`stage_4.2` `unobserved`; §3.3, §5.0 and §5.4 now say so | +| The `[covers:]` token may sit anywhere in the `it()` title | **corrected** — the carrier is anchored to the title start. The Codex cycle lost two receipts to this and had to re-sign (§5.1, §9) | +| A `clad_create_feature` criterion without a `statement` | **corrected** — it is rejected; the §5.0 prompt now says so | +| The time estimate above | **still unverified** | + +--- + +## 9. How the 0.10.0 cycles were actually run + +Both reference-host cycles for 0.10.0 are recorded under +`docs/dogfood/mcp11-0.10.0//`, and each carries its own `cycle.md`. This section states +the boundary of what those records prove, because the runbook above describes a human at a +keyboard and that is not how these two runs happened. + +The honesty boundary, as written into both records: + +> The maintainer instructed the session to run every step; the confirmation prompts of +> `clad signoff --verified` were answered by an automation in a pseudo-terminal at the +> maintainer's explicit instruction, not by a person at a keyboard. The host elicitation forms +> of Claude Code and Codex were not exercised. +> +> Concretely: the receipts were produced by the `clad signoff` **CLI** driven through an +> `expect(1)` pseudo-terminal, which typed the feature id at the prompt +> `Type the feature id to sign a verified receipt:`. The signature, the issuer key and +> the offline verification are genuine; the human confirmation channel was satisfied by +> automation acting on the maintainer's instruction. Nothing in this record should be read as +> evidence that a person re-typed the feature id, or that either host's own signoff elicitation +> form was tested. + +**Claude Code.** The implementation half was carried out by headless Claude Code 2.1.263 +through the Cladding MCP server: it created `F-3222d1cf`, began the cycle, wrote the module and +its bound test, ran the strict pre-push gate and committed. The signing was the CLI, as above. + +**Codex.** Codex CLI 0.153.0 ran headless in three separate `codex exec` invocations, all with +the same flag set and none of them using the bypass flag: + +``` +codex exec --approve-for-me -C ~/mcp11-codex \ + -c 'mcp_servers.cladding={command="node",args=[".cladding/host/serve.cjs"],disabled_tools=["clad_signoff","clad_ingest_receipt"]}' \ + --json -o .mcp11/codex-last-message.txt "$(cat .mcp11/prompt.txt)" +``` + +Three runs rather than one, for two reasons worth keeping: + +- **Run 1 stopped without committing**, correctly. The prompt made the commit conditional on a + green gate, and at L4 the gate cannot be green before a human signs. The defect was in the + prompt, not in Codex and not in the engine; §5.0 is now written so the condition is + reachable. +- **Run 3 fixed a token position.** Codex had written the `[covers:]` token at the end of the + `it()` title. The engine's carrier is anchored to the start of the title, so the criterion + was bound to nothing — and `clad done` refused with `MISSING_TESTS` *after* the receipts had + already been signed. Because a receipt seals the workspace it was signed against, the two + first-attempt receipts could not survive the fix: they were **discarded in a commit** rather + than by rewriting history, so the record still shows they existed, and the cycle was + re-signed on the corrected tree. Only the re-signed receipts are the evidence in this + repository. + +A related product observation, recorded and not acted on: the strict pre-push gate reported +Drift as `pass` with an unbound criterion. `MISSING_TESTS` surfaced only at `clad done`, which +is where the finished-feature rule is evaluated. + +**What is therefore not proven by this evidence.** Neither host's signoff elicitation form was +exercised; the Codex TUI project-trust prompt was bypassed rather than granted; and no signoff +was answered by a person typing at a prompt. What *is* proven is on the wire and in the files: +two independent hosts drove a complete Spec 0.2 cycle through the MCP tools, and each cycle's +receipts verify offline against its own committed trust registry. diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/attestation.yaml b/docs/dogfood/mcp11-0.10.0/claude-code/attestation.yaml new file mode 100644 index 00000000..a7c2ed74 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/attestation.yaml @@ -0,0 +1,23 @@ +# Cladding · Tier C — verification attestation. Legacy module rows retain byte compatibility; +# schema 0.1 feature rows need a GREEN strict pre-push gate; v3 replaces a schema 0.2 feature row only after an authoritative profile-complete GREEN result. +# Do not edit by hand. +# +# policy: verifier identity: Cladding version, strict blocking, +# and SHA-256 of the ordered detector catalog. +# attested_modules: one line per module file across all done features, +# value = sha256 of that file's bytes (16 hex). Editing a +# file moves exactly its own line — not every co-owning +# feature's — so parallel work rarely conflicts here. +# attested_features: legacy constant `ok` markers for done features not +# replaced by a v3 row. STALE_ATTESTATION reads the v3 +# closure seal first, otherwise this marker + modules. +# +# Merge conflict here? NEVER hand-resolve the hashes — 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. +attested_modules: + src/greeting.ts: 6d788135ce988a02 +attested_features: + +attested_v3: + F-3222d1cf: {"attestation_schema":"3","feature":"F-3222d1cf","profile":"push","configured_assurance_level":"L4","achieved_assurance_level":"L4","scope_sha256":"542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04","input_sha256":"d244990509f4114673ae3885f2966539a2d6a06a2e4f7d1de448835d32b9600f","contract_sha256":"2c7eed47f410f4cb07064a6d16345c489c5d58716d740e4aaa5ae8577ec0ae87","subject_sha256":"f63ff0719934ea25ae3fc569e17d3fca21652af916ea90d80a6da3d932fd8a1d","verification_sha256":"e466055f73b04e693cb2847a2adacb84c7bd55a20d39cc45c57a17d18eb9ab01","runtime_dependency_sha256":"2e57c031f4fac0f5b054288b6294dc3c3c2deb818c772292e92983863ab8cf4c","profile_sha256":"05e4420129c5746ed9624906a189b45be86860733537ef14f3018611679a9361","obligation_sha256":"01315d574367b286aa263d9e6f6a9b52ad497749b547cfe04dc4fe82e750d768","registry_sha256":"32cda83a2a4347361363348abb98cca5e1b4cca210f15486d9bc739413c07c0f","detector_catalog_sha256":"133c1ab691da7642223bcfe93ecdf4dc253f1aba08ee4e1bad865e427a2c37db","tool_identity":"0.10.0","environment_class":"foreground","trust_snapshot_sha256":"21ab47df3de5fce8b83965b9dad18b249fcecab6fe6a2426bc670beadf23b622","observation_set_sha256":"da4bc8d0cf46f4354220c185d07847082388231a80efbad7732e0c5336cbe3e8","observation_count":14,"observation_counts":{"required":14,"pass":14,"na":2,"migration_baseline":0}} diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/cycle.md b/docs/dogfood/mcp11-0.10.0/claude-code/cycle.md new file mode 100644 index 00000000..0e7dbe2d --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/cycle.md @@ -0,0 +1,86 @@ +# MCP11 reference-host cycle — Claude Code + +Fixture: `~/mcp11-claude-code` (not part of this repository). +Feature: `F-3222d1cf` "Greeting module", one acceptance criterion `AC-24475f69`. +Engine: cladding 0.10.0 from the RC working tree at commit `0578818`, reached through the +project launcher `.cladding/host/serve.cjs`. + +## Honesty boundary + +The maintainer instructed the session to run every step; the confirmation prompts of +`clad signoff --verified` were answered by an automation in a pseudo-terminal at the +maintainer's explicit instruction, not by a person at a keyboard. The host elicitation forms +of Claude Code and Codex were not exercised. + +Concretely: the receipts below were produced by the `clad signoff` **CLI** driven through an +`expect(1)` pseudo-terminal, which typed the feature id at the prompt +`Type the feature id to sign a verified receipt:`. The signature, the issuer key and +the offline verification are genuine; the human confirmation channel was satisfied by +automation acting on the maintainer's instruction. Nothing in this record should be read as +evidence that a person re-typed the feature id, or that either host's own signoff elicitation +form was tested. + +## Implementation + +The implementation half of this cycle was carried out in an earlier session by headless +Claude Code 2.1.263 through the Cladding MCP server. This round did not re-run it. The +fixture's own event log (`.cladding/events.log.jsonl`) records the sequence it left behind: + +1. `gate_run` (pre-push, strict) — scaffold baseline +2. `feature_created` — `F-3222d1cf`, slug `greeting` (`clad_create_feature`) +3. `feature_checkpoint` — cycle start (`clad_begin`) +4. `gate_run` blocked on `INVENTORY_DRIFT`, then a clean re-run +5. `working_set_served` — `clad_get_context` for `F-3222d1cf` +6. `gate_run` (pre-push, strict) at the implementation commit + +Implementation commit: `c6bbbdb` "feat: greeting module". `spec/evidence` did not exist at +that point: the implementing host signed nothing. + +Gate before signing (`clad check --tier=pre-push --strict`): exit 1, assurance state +`unresolved`, achieved `L3`; every executed stage `pass`, with `stage_4.1` and `stage_4.2` +`unobserved`. That is the expected L4 shape before a human receipt exists. + +## Signing + +Two `clad signoff --verified --issuer qwerfunch` runs through the pseudo-terminal, audit first: + +| Claim | Subject | Digest | Verification | +|---|---|---|---| +| audit | `AC-24475f69` | `b0f8de83282b7c0972baeb21603d6183891d280a5aaadcdf6ae38daf5eb689a2` | `verified` / `current` | +| uat | feature | `656c3cd3c35690b9d0e66c15e5ad5b738a25fb2e45a1543fb7d075580dec5238` | `verified` / `current` | + +Issuer key id: `b3b3febf84aed336596ab5014a5349fb96165a5516f26bc507a568a521bba7bb`. +Trust snapshot digest: `21ab47df3de5fce8b83965b9dad18b249fcecab6fe6a2426bc670beadf23b622`. +Both receipts landed under `spec/evidence/F-3222d1cf/` and nothing else in the tree changed. + +The CLI's `--json` result carries `ok`, `code`, `message`, `evidence`, `path`, `digest`, +`issuerKeyId` and a `verification` block. It carries no `adapter` or `host` field — those +belong to the MCP tool result shape, and this cycle signed through the CLI. + +Receipts commit: `aa1f74f` "chore: sign L4 receipts". + +## Completion + +`node .cladding/host/serve.cjs done F-3222d1cf` exited 0, reported the strict gate GREEN and +moved the feature `in_progress → done`, with `independence: self-certified`. The attestation +row for the feature carries `attestation_schema: 3`, `achieved_assurance_level: L4`, +`tool_identity: 0.10.0` and `trust_snapshot_sha256` +`21ab47df3de5fce8b83965b9dad18b249fcecab6fe6a2426bc670beadf23b622`. + +The re-run gate afterwards was GREEN: exit 0, state `green`, achieved `L4`, +`stage_4.1` and `stage_4.2` both `pass`. + +Completion commit: `7fbaf6d` "chore: complete F-3222d1cf". The fixture was left clean and +untouched after this point, so the receipts stay current. + +## Files in this directory + +- `evidence/` — both signed receipts, byte-for-byte copies of `spec/evidence/F-3222d1cf/` +- `issuers.yaml` — the fixture's committed trust registry +- `attestation.yaml` — the fixture's attestation file, carrying the v3 row for the feature +- `done.txt` — the full `clad done` output +- `gate-after-done.json` — the GREEN strict pre-push gate result +- `signoff-audit.json`, `signoff-uat.json` — the two signoff results as reported by the CLI +- `versions.txt` — host, node, engine and RC identity + +No private key material was copied; `~/.cladding/keys/` is not evidence. diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/done.txt b/docs/dogfood/mcp11-0.10.0/claude-code/done.txt new file mode 100644 index 00000000..d7e3b4f8 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/done.txt @@ -0,0 +1,17 @@ +✓ Type +✓ Lint +✓ Drift +✓ Architecture +✓ Secret +✓ Unit tests +✓ Coverage +· Spec conformance +· Deliverable smoke +✓ Smoke +✓ Performance +✓ Visual +✓ Audit +✓ UAT +✓ done · F-3222d1cf strict gate GREEN — status: in_progress → done +ℹ done · F-3222d1cf independence: self-certified — the implementation author signed, or no verified review exists yet +ℹ done · F-3222d1cf next: run clad check --tier=pre-push to re-attest sibling features, then commit spec/attestation.yaml diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/evidence/656c3cd3c35690b9d0e66c15e5ad5b738a25fb2e45a1543fb7d075580dec5238.yaml b/docs/dogfood/mcp11-0.10.0/claude-code/evidence/656c3cd3c35690b9d0e66c15e5ad5b738a25fb2e45a1543fb7d075580dec5238.yaml new file mode 100644 index 00000000..07ffe561 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/evidence/656c3cd3c35690b9d0e66c15e5ad5b738a25fb2e45a1543fb7d075580dec5238.yaml @@ -0,0 +1 @@ +{"checks":{"no_surprise":"pass","tradeoff_acceptance":"pass"},"claim":"uat","criterion_verdicts":{"criterion:F-3222d1cf/AC-24475f69":"pass"},"implementation_authors_sha256":"7533e0a093246560a3c393355752064400dc1d5e841cce103e511dc1af906f97","issuer":"qwerfunch","issuer_key_id":"b3b3febf84aed336596ab5014a5349fb96165a5516f26bc507a568a521bba7bb","issuer_proof":"lXUXP63wguGJUzNFbfvUfsGAOsFXGLODrIRJw7A-3jZ0BEzzJzVhW4p7m5orWlAuofrG04CEfaE6qQpz9Q8zDw","method":"human_channel","observed_at":"2026-09-07T13:05:49.390Z","receipt_schema":"1","reviewed_inputs_sha256":"f8c8b0d0e94835808196540332a57a8ea18c67ad92182ccfeec040b2588e393c","runtime_dependency_sha256":"2e57c031f4fac0f5b054288b6294dc3c3c2deb818c772292e92983863ab8cf4c","subject":"feature:F-3222d1cf","subject_sha256":"2c7eed47f410f4cb07064a6d16345c489c5d58716d740e4aaa5ae8577ec0ae87"} diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/evidence/b0f8de83282b7c0972baeb21603d6183891d280a5aaadcdf6ae38daf5eb689a2.yaml b/docs/dogfood/mcp11-0.10.0/claude-code/evidence/b0f8de83282b7c0972baeb21603d6183891d280a5aaadcdf6ae38daf5eb689a2.yaml new file mode 100644 index 00000000..0577bc10 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/evidence/b0f8de83282b7c0972baeb21603d6183891d280a5aaadcdf6ae38daf5eb689a2.yaml @@ -0,0 +1 @@ +{"checks":{"code_test_review":"pass","evidence_sufficiency":"pass","independence":"pass"},"claim":"audit","implementation_authors_sha256":"7533e0a093246560a3c393355752064400dc1d5e841cce103e511dc1af906f97","issuer":"qwerfunch","issuer_key_id":"b3b3febf84aed336596ab5014a5349fb96165a5516f26bc507a568a521bba7bb","issuer_proof":"CKnqrcoQEfEf0f8OmH7Ji-0F4AnksCJWT4MxeSQ_csEmwwrMDgL8id7QoBBxoB8GzN9qfOUKyTc9BTmQpI9zCg","method":"human_channel","observed_at":"2026-09-07T13:05:42.324Z","receipt_schema":"1","reviewed_inputs_sha256":"c34e826575bd3f0e89e0d6ad718af52911c8a503a7cbb1c3523eac06a6357b97","runtime_dependency_sha256":"2e57c031f4fac0f5b054288b6294dc3c3c2deb818c772292e92983863ab8cf4c","subject":"criterion:F-3222d1cf/AC-24475f69","subject_sha256":"973fd1dc3e2f14fc478329b40c14d77514de47f511030c4f43df779f898cfe19"} diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/gate-after-done.json b/docs/dogfood/mcp11-0.10.0/claude-code/gate-after-done.json new file mode 100644 index 00000000..8648bfbe --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/gate-after-done.json @@ -0,0 +1,476 @@ +{ + "tier": "pre-push", + "profile": "push", + "requested_assurance_level": "L4", + "configured_assurance_level": "L4", + "achieved_assurance_level": "L4", + "scope_sha256": "542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04", + "input_sha256": "d244990509f4114673ae3885f2966539a2d6a06a2e4f7d1de448835d32b9600f", + "profile_complete": true, + "obligations": [ + { + "obligation": "stage_1.1", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "ce8fdd902ba3ddd4d27c9f20ead1b74511d6c37399f5194655b3dbb0365589b6" + ] + }, + { + "obligation": "stage_1.2", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "a790bd861243f663b15d7f0bfdf321ce0d02bdc34768a84048b8f16234628ee4" + ] + }, + { + "obligation": "stage_1.3", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "323c9f9efd5f3ac91793310d2441f7a817cc44ec64cfe2c46595b2bff1657d44" + ] + }, + { + "obligation": "stage_1.5", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "379ca84afa31b6c4909acd8c440223ffd224f0a5212499487d037f62db542736" + ] + }, + { + "obligation": "stage_1.6", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "6923a557e06c056021eb939b92c3139f5f6bce4e5017c0fc83a7a6d63cbcdf07" + ] + }, + { + "obligation": "stage_2.1", + "subject": "criterion:F-3222d1cf/AC-24475f69", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "27354ea6c79990a43f1f85778503562e81628ce232231f0c339d7c0bd6b56976" + ] + }, + { + "obligation": "stage_2.1", + "subject": "scope:542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "196bde990d4071ef16b599b0bc957af427a57057069654e0eb0f6e80139898fd" + ] + }, + { + "obligation": "stage_2.2", + "subject": "criterion:F-3222d1cf/AC-24475f69", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "ef235b191bcc32387814feaeea60b554335f78baf4fd1239510496b394abd775" + ] + }, + { + "obligation": "stage_2.2", + "subject": "scope:542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "8ac10d11409be2dde3450c74af9b1bb9a5cfdb086aeb2456e584d9f70bf65ab2" + ] + }, + { + "obligation": "stage_2.3", + "subject": "scope:542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04", + "state": "na", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [] + }, + { + "obligation": "stage_2.4", + "subject": "feature:F-3222d1cf", + "state": "na", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [] + }, + { + "obligation": "stage_3.1", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "6db41831dac5c2eade8bd6b9170918ef8a140b7bdf927bef15d1be9965ada06d" + ] + }, + { + "obligation": "stage_3.2", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "22266e25fc6c65a74db6fed79204447362bcc4d30866c472e2a3a20c1cabd98f" + ] + }, + { + "obligation": "stage_3.3", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "c49c20be341673e3a3ad19787ad67fc11931a04e40f66be79c98f7e3f286df50" + ] + }, + { + "obligation": "stage_4.1", + "subject": "criterion:F-3222d1cf/AC-24475f69", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "cbf7219668556436d300513440b8297f24b415a32b7ba64c03636365fc32af05" + ] + }, + { + "obligation": "stage_4.2", + "subject": "criterion:F-3222d1cf/AC-24475f69", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "46ac023f7dad7fdcd4fd3e2b4a2c2ef41f560252878578dfbf4b8b743d0a131a" + ] + } + ], + "incomplete_addresses": [], + "independence": "self-certified", + "attestation_freshness": [ + { + "feature": "F-3222d1cf", + "state": "stale", + "field": "profile" + } + ], + "assurance": { + "profile": "push", + "assurance_level": "L4", + "configured_assurance_level": "L4", + "achieved_assurance_level": "L4", + "scope_sha256": "542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04", + "input_sha256": "d244990509f4114673ae3885f2966539a2d6a06a2e4f7d1de448835d32b9600f", + "state": "green", + "profile_complete": true, + "results": [ + { + "obligation": "stage_1.1", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "ce8fdd902ba3ddd4d27c9f20ead1b74511d6c37399f5194655b3dbb0365589b6" + ] + }, + { + "obligation": "stage_1.2", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "a790bd861243f663b15d7f0bfdf321ce0d02bdc34768a84048b8f16234628ee4" + ] + }, + { + "obligation": "stage_1.3", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "323c9f9efd5f3ac91793310d2441f7a817cc44ec64cfe2c46595b2bff1657d44" + ] + }, + { + "obligation": "stage_1.5", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "379ca84afa31b6c4909acd8c440223ffd224f0a5212499487d037f62db542736" + ] + }, + { + "obligation": "stage_1.6", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "6923a557e06c056021eb939b92c3139f5f6bce4e5017c0fc83a7a6d63cbcdf07" + ] + }, + { + "obligation": "stage_2.1", + "subject": "criterion:F-3222d1cf/AC-24475f69", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "27354ea6c79990a43f1f85778503562e81628ce232231f0c339d7c0bd6b56976" + ] + }, + { + "obligation": "stage_2.1", + "subject": "scope:542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "196bde990d4071ef16b599b0bc957af427a57057069654e0eb0f6e80139898fd" + ] + }, + { + "obligation": "stage_2.2", + "subject": "criterion:F-3222d1cf/AC-24475f69", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "ef235b191bcc32387814feaeea60b554335f78baf4fd1239510496b394abd775" + ] + }, + { + "obligation": "stage_2.2", + "subject": "scope:542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "8ac10d11409be2dde3450c74af9b1bb9a5cfdb086aeb2456e584d9f70bf65ab2" + ] + }, + { + "obligation": "stage_2.3", + "subject": "scope:542860ec5ec019c0a11cd264201eac682d3f37722d9585132330f16058f4dd04", + "state": "na", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [] + }, + { + "obligation": "stage_2.4", + "subject": "feature:F-3222d1cf", + "state": "na", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [] + }, + { + "obligation": "stage_3.1", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "6db41831dac5c2eade8bd6b9170918ef8a140b7bdf927bef15d1be9965ada06d" + ] + }, + { + "obligation": "stage_3.2", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "22266e25fc6c65a74db6fed79204447362bcc4d30866c472e2a3a20c1cabd98f" + ] + }, + { + "obligation": "stage_3.3", + "subject": "feature:F-3222d1cf", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "c49c20be341673e3a3ad19787ad67fc11931a04e40f66be79c98f7e3f286df50" + ] + }, + { + "obligation": "stage_4.1", + "subject": "criterion:F-3222d1cf/AC-24475f69", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "cbf7219668556436d300513440b8297f24b415a32b7ba64c03636365fc32af05" + ] + }, + { + "obligation": "stage_4.2", + "subject": "criterion:F-3222d1cf/AC-24475f69", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "46ac023f7dad7fdcd4fd3e2b4a2c2ef41f560252878578dfbf4b8b743d0a131a" + ] + } + ], + "independence": "self-certified", + "obligation_sha256": "01315d574367b286aa263d9e6f6a9b52ad497749b547cfe04dc4fe82e750d768" + }, + "worst": 0, + "anyFailed": false, + "stages": [ + { + "stage": "stage_1.1", + "label": "Type", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_1.2", + "label": "Lint", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_1.3", + "label": "Drift", + "status": "pass", + "exitCode": 0, + "findings": [ + { + "detector": "HARDCODED_SECRET", + "severity": "info", + "message": "npx could not scan (config/setup gap, not a secret): npm error npx canceled due to missing packages and no YES option: [\"secretlint@13.0.4\"]\nnpm error A complete log of this run can be found in: /Users/qwerfunch/.npm/_logs/2026-09-07T13_06_47_415Z-debug-0.log" + }, + { + "detector": "HARNESS_INTEGRITY", + "severity": "info", + "message": "plugin.json not loaded: ENOENT: no such file or directory, open 'plugins/claude-code/.claude-plugin/plugin.json'" + }, + { + "detector": "COVERAGE_DROP", + "severity": "info", + "message": "coverage/coverage-summary.json not present — run stage_2.2 first" + }, + { + "detector": "PERFORMANCE_DRIFT", + "severity": "info", + "message": "perf baseline or current missing — run stage_3.2 with --record first" + }, + { + "detector": "ABSENCE_OF_GOVERNANCE", + "severity": "info", + "path": "spec/scenarios", + "message": "spec/scenarios is absent — cladding scaffold incomplete (user-journey scenarios (recommended)). Run `clad init --intent \"\"` to populate it." + }, + { + "detector": "SCENARIO_COVERAGE", + "severity": "info", + "path": "spec/scenarios/", + "message": "scenario coverage is absent under the current scenario policy — add a complete user journey with actor, goal, success, steps, and feature references." + }, + { + "detector": "DELIVERABLE_INTEGRITY", + "severity": "info", + "message": "1 done feature(s) ship modules but project.deliverable is not declared — the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4)." + } + ] + }, + { + "stage": "stage_1.5", + "label": "Architecture", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_1.6", + "label": "Secret", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_2.1", + "label": "Unit tests", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_2.2", + "label": "Coverage", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_2.3", + "label": "Spec conformance", + "status": "skip", + "exitCode": 2, + "stderr": "no spec-conformance oracles under tests/oracle/ — skipped" + }, + { + "stage": "stage_2.4", + "label": "Deliverable smoke", + "status": "skip", + "exitCode": 2, + "stderr": "no project.deliverable declared — skipped" + }, + { + "stage": "stage_3.1", + "label": "Smoke", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_3.2", + "label": "Performance", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_3.3", + "label": "Visual", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_4.1", + "label": "Audit", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_4.2", + "label": "UAT", + "status": "pass", + "exitCode": 0 + } + ] +} diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/issuers.yaml b/docs/dogfood/mcp11-0.10.0/claude-code/issuers.yaml new file mode 100644 index 00000000..03156de5 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/issuers.yaml @@ -0,0 +1,5 @@ +schema: "1" +issuers: + - issuer: "qwerfunch" + issuer_key_id: b3b3febf84aed336596ab5014a5349fb96165a5516f26bc507a568a521bba7bb + spki_der: MCowBQYDK2VwAyEA2H94TT+6+Xyn9yWtpn5BqKILPGBQYhGoS2l05Qf3mf0= diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/signoff-audit.json b/docs/dogfood/mcp11-0.10.0/claude-code/signoff-audit.json new file mode 100644 index 00000000..00813efb --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/signoff-audit.json @@ -0,0 +1,28 @@ +{ + "ok": true, + "code": "OK", + "message": "The signed receipt was stored and verified offline. Signed by registered issuer qwerfunch; a signature proves that issuer's assertion, not universal human identity.", + "evidence": { + "featureId": "F-3222d1cf", + "acId": "AC-24475f69", + "stage": "stage_4.1", + "identity": { + "author": "human", + "name": "local-asserted-signoff", + "timestamp": "2026-09-07T13:05:42.250Z" + }, + "kind": "pass", + "assurance": "asserted", + "content": "Local asserted audit: pass.", + "id": "ev-mtr97b6y-1pljxw" + }, + "path": "spec/evidence/F-3222d1cf/b0f8de83282b7c0972baeb21603d6183891d280a5aaadcdf6ae38daf5eb689a2.yaml", + "digest": "b0f8de83282b7c0972baeb21603d6183891d280a5aaadcdf6ae38daf5eb689a2", + "issuerKeyId": "b3b3febf84aed336596ab5014a5349fb96165a5516f26bc507a568a521bba7bb", + "verification": { + "assurance": "verified", + "currentness": "current", + "reason": "verified", + "trustSnapshotDigest": "21ab47df3de5fce8b83965b9dad18b249fcecab6fe6a2426bc670beadf23b622" + } +} diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/signoff-uat.json b/docs/dogfood/mcp11-0.10.0/claude-code/signoff-uat.json new file mode 100644 index 00000000..8d2a74ef --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/signoff-uat.json @@ -0,0 +1,27 @@ +{ + "ok": true, + "code": "OK", + "message": "The signed receipt was stored and verified offline. Signed by registered issuer qwerfunch; a signature proves that issuer's assertion, not universal human identity.", + "evidence": { + "featureId": "F-3222d1cf", + "stage": "stage_4.2", + "identity": { + "author": "human", + "name": "local-asserted-signoff", + "timestamp": "2026-09-07T13:05:49.307Z" + }, + "kind": "pass", + "assurance": "asserted", + "content": "Local asserted UAT signoff.", + "id": "ev-mtr97gn0-mfc4u2" + }, + "path": "spec/evidence/F-3222d1cf/656c3cd3c35690b9d0e66c15e5ad5b738a25fb2e45a1543fb7d075580dec5238.yaml", + "digest": "656c3cd3c35690b9d0e66c15e5ad5b738a25fb2e45a1543fb7d075580dec5238", + "issuerKeyId": "b3b3febf84aed336596ab5014a5349fb96165a5516f26bc507a568a521bba7bb", + "verification": { + "assurance": "verified", + "currentness": "current", + "reason": "verified", + "trustSnapshotDigest": "21ab47df3de5fce8b83965b9dad18b249fcecab6fe6a2426bc670beadf23b622" + } +} diff --git a/docs/dogfood/mcp11-0.10.0/claude-code/versions.txt b/docs/dogfood/mcp11-0.10.0/claude-code/versions.txt new file mode 100644 index 00000000..4bfc3813 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/claude-code/versions.txt @@ -0,0 +1,7 @@ +host: Claude Code 2.1.263 +node: v26.0.0 +cladding engine: 0.10.0 (`clad --version`), run from the RC working tree via `.cladding/host/serve.cjs` +RC commit: 0578818 +dist/clad.js md5: ba348c9b1bddea5c73c1b90c8d39fbb7 +dist/clad.js sha256: 1bb59b7149663da210d1f74fb57dffdae6f2e3734edf31b20d89c55be2250e3d +fixture: ~/mcp11-claude-code diff --git a/docs/dogfood/mcp11-0.10.0/codex/attestation.yaml b/docs/dogfood/mcp11-0.10.0/codex/attestation.yaml new file mode 100644 index 00000000..ed448bd5 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/attestation.yaml @@ -0,0 +1,23 @@ +# Cladding · Tier C — verification attestation. Legacy module rows retain byte compatibility; +# schema 0.1 feature rows need a GREEN strict pre-push gate; v3 replaces a schema 0.2 feature row only after an authoritative profile-complete GREEN result. +# Do not edit by hand. +# +# policy: verifier identity: Cladding version, strict blocking, +# and SHA-256 of the ordered detector catalog. +# attested_modules: one line per module file across all done features, +# value = sha256 of that file's bytes (16 hex). Editing a +# file moves exactly its own line — not every co-owning +# feature's — so parallel work rarely conflicts here. +# attested_features: legacy constant `ok` markers for done features not +# replaced by a v3 row. STALE_ATTESTATION reads the v3 +# closure seal first, otherwise this marker + modules. +# +# Merge conflict here? NEVER hand-resolve the hashes — 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. +attested_modules: + src/greeting.ts: 35988aac2aa6538b +attested_features: + +attested_v3: + F-032b6453: {"attestation_schema":"3","feature":"F-032b6453","profile":"push","configured_assurance_level":"L4","achieved_assurance_level":"L4","scope_sha256":"66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53","input_sha256":"7b228c7c3eb604de04338dc84d67bdc64fc705e82a102f38374b2def51ac0263","contract_sha256":"62b05459b2273bc4e3b21f135669f5f2ae5a85046c4026da44592a3b2ed62578","subject_sha256":"848d40caae20a2a44edf77a0da7ff1bdb5894acfbcd6853f020cb613890514a8","verification_sha256":"c8351ca552f8d082766fd663c3da927fb27ffe128ca9e92155ec7d1678f9a95f","runtime_dependency_sha256":"f540fb51757c1e170c8d0c27ae326b5b7949a713ad27f9280479876e52b6c554","profile_sha256":"4c8648b5a3fcc19c7c7177abf299a2a4cacca7cb17cc73eaa3308b5588779d31","obligation_sha256":"7191cce4bdf2f0264e05cd0e6efe6707b70024418bf303083e7947e9ecd01c29","registry_sha256":"32cda83a2a4347361363348abb98cca5e1b4cca210f15486d9bc739413c07c0f","detector_catalog_sha256":"133c1ab691da7642223bcfe93ecdf4dc253f1aba08ee4e1bad865e427a2c37db","tool_identity":"0.10.0","environment_class":"foreground","trust_snapshot_sha256":"b6d1d70675d772aa109d52c52f594a8127490f5d6d0c5e8fcbb30c6f7b28e77d","observation_set_sha256":"15334fd36639a0a1895c942d6a3956318a450d817e549095c3bc64db4660ed01","observation_count":14,"observation_counts":{"required":14,"pass":14,"na":2,"migration_baseline":0}} diff --git a/docs/dogfood/mcp11-0.10.0/codex/cycle.md b/docs/dogfood/mcp11-0.10.0/codex/cycle.md new file mode 100644 index 00000000..c4d2c6ec --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/cycle.md @@ -0,0 +1,162 @@ +# MCP11 reference-host cycle — Codex + +Fixture: `~/mcp11-codex` (not part of this repository). +Feature: `F-032b6453` "Greeting module", one acceptance criterion `AC-e435a582`. +Host: `codex-cli 0.153.0`. Engine: cladding 0.10.0 from the RC working tree at commit +`0578818`, reached through the project launcher `.cladding/host/serve.cjs`. + +## Honesty boundary + +The maintainer instructed the session to run every step; the confirmation prompts of +`clad signoff --verified` were answered by an automation in a pseudo-terminal at the +maintainer's explicit instruction, not by a person at a keyboard. The host elicitation forms +of Claude Code and Codex were not exercised. + +Concretely: Codex ran headless, and the receipts were produced by the `clad signoff` **CLI** +driven through an `expect(1)` pseudo-terminal, which typed the feature id at the prompt +`Type the feature id to sign a verified receipt:`. Codex itself signed nothing. + +Codex was launched with `--approve-for-me` ("Route approval requests through automatic review +using the workspace-write sandbox"), never with `--dangerously-bypass-approvals-and-sandbox`. +The runbook's warning against a blanket auto-approval mode is about the host answering its own +signoff elicitation form; that path was not used here at all, because the signing was done +outside the host by the CLI. + +## Headless invocation + +Three separate `codex exec` runs, all with the same flags. The full command line of the first: + +``` +codex exec --approve-for-me -C /Users/qwerfunch/mcp11-codex \ + -c 'mcp_servers.cladding={command="node",args=[".cladding/host/serve.cjs"],disabled_tools=["clad_signoff","clad_ingest_receipt"]}' \ + --json -o .mcp11/codex-last-message.txt "$(cat .mcp11/prompt.txt)" +``` + +Notes on the invocation, recorded rather than fixed: + +- the inline `mcp_servers.cladding` override is required because Codex loads a project + `.codex/config.toml` only for a repository it trusts, and this fixture was never opened + interactively to grant that trust +- `disabled_tools` was passed to keep the signing tools out of the host's reach. Its effect on + the advertised tool catalog was **not** independently confirmed; the honest check is that + `spec/evidence` did not exist after the implementation runs, and it did not +- `codex exec resume` rejects `--approve-for-me` (`error: unexpected argument`), so the two + follow-up instructions were issued as fresh `codex exec` runs, not as a resumed thread +- stderr of the backgrounded runs carried `Reading additional input from stdin...`; it had no + visible effect on the run + +## Run 1 — implementation + +Tool and command sequence extracted from `--json` events, in order: + +1. shell — repository reconnaissance (`rg --files`, reading `AGENTS.md`, `spec.yaml`, config) +2. `clad_create_feature` — **failed** once (schema 0.2 requires a `statement` field on the + criterion), then succeeded, creating `F-032b6453` / `AC-e435a582` +3. `clad_begin` — `F-032b6453` +4. `clad_get_feature` — `F-032b6453` +5. file change — added `src/greeting.ts` +6. shell — `git diff --stat && git status --short` +7. shell — `cat tests/greeting.test.ts && npm test` (the test file was written by a second + Codex thread the primary one spawned and waited on) +8. `clad_run_gate` (pre-push, strict) — reported `failed` +9. shell — `node .cladding/host/serve.cjs sync` (the gate had reported `INVENTORY_DRIFT`) +10. `clad_run_gate` (pre-push, strict) — reported `failed` again + +Codex then stopped **without committing**, correctly reasoning that the prompt made the commit +conditional on a green gate and the gate was not green: at L4 the gate cannot be green before a +human signs, so `stage_4.1` / `stage_4.2` stayed `unobserved` and achieved assurance was `L3`. +That is a defect in the fixture prompt (`.mcp11/prompt.txt`, mirroring runbook §5.0), not in +Codex's behaviour, and not in the engine. + +## Run 2 — commit + +A second `codex exec` corrected the instruction ("at L4 the gate cannot report green before a +human signs; 'until it is green' meant the automated stages only") and asked only for the +commit. Codex ran `git add -A && git commit -m "feat: greeting module"` — one shell call, no +edits — producing `50c35c6`. `spec/evidence` still did not exist. + +## First signing attempt, discarded + +The two receipts signed at `50c35c6` +(`5c1398ac6f15ad7c06099feed731b6cf97af6cf28439a35d511231adb8824eb0` audit, +`e3a0f914a1cde29234e978da3747f836564465c2d37ec763bb52116bba220bef` uat, commit `10283e8`) +were **discarded** in commit `e16d73d` and never used as evidence, because `clad done` then +refused: + +``` +✗ Drift + A finished feature has an acceptance criterion with nothing proving it works [MISSING_TESTS] + F-032b6453.AC-e435a582 declares no test_refs or evidence_refs — AC is unverified +``` + +Cause: Codex had written the coverage token at the **end** of the `it()` title. The engine's +carrier is anchored (`/^((?:\[covers:…\])+)/` in `src/proof/vitest-jest.ts`), so a token that +does not start the title binds nothing. The fixture prompt shows the token at the start in its +example but never states that the position is load-bearing. + +Two product observations worth carrying forward, recorded here and not acted on in this round: + +- the strict pre-push gate reported `stage_1.3` (Drift) as `pass` with an unbound criterion; + `MISSING_TESTS` surfaced only at `clad done`, which evaluates the finished-feature rule +- the fixture prompt and runbook §5.0 should state the anchoring rule, not only show it + +Because the fix changes the workspace, the earlier receipts could not stay: a receipt binds the +workspace it was signed against. They were dropped in a commit rather than by rewriting +history, so the record shows they existed. + +## Run 3 — fix + +A third `codex exec`, with the same flags, asked only for the token to be moved to the front of +the existing `it()` title. Codex changed exactly that one line, re-ran the gate, and committed +`1ae29bd` "test: anchor the covers token at the title start". `git diff 50c35c6..HEAD --stat` +over the source tree shows a single file, one insertion, one deletion. + +Contract check after the fix: `npm run smoke`, `npm run perf` and `npm run visual` all pass, +`src/greeting.ts` exports `greet(name: string): string` returning `Hello, !`. + +Gate before signing: exit 1, state `unresolved`, achieved `L3`; every executed stage `pass` +with `stage_4.1` / `stage_4.2` `unobserved` — the expected L4 pre-signature shape. + +## Signing + +Two `clad signoff --verified --issuer qwerfunch` runs through the pseudo-terminal, audit first, +on a clean tree at `1ae29bd`: + +| Claim | Subject | Digest | Verification | +|---|---|---|---| +| audit | `AC-e435a582` | `026211187c93449bd6a7e16de6de2982f5378f09efe843aaaa9bcdb061ba11e2` | `verified` / `current` | +| uat | feature | `507c59639825394dee9ca51f5ae911e8ee84ac227538181bee7fe5ef7baf47c7` | `verified` / `current` | + +Issuer key id: `a237dda876e9159e8bc9106684206f6cde5639369b967c9b943b305d301ee5f3`. +Trust snapshot digest: `b6d1d70675d772aa109d52c52f594a8127490f5d6d0c5e8fcbb30c6f7b28e77d`. + +The CLI's `--json` result carries `ok`, `code`, `message`, `evidence`, `path`, `digest`, +`issuerKeyId` and a `verification` block. It carries no `adapter` or `host` field — those +belong to the MCP tool result shape, and this cycle signed through the CLI. + +Receipts commit: `45a4267` "chore: sign L4 receipts". + +## Completion + +`node .cladding/host/serve.cjs done F-032b6453` exited 0, reported the strict gate GREEN and +moved the feature `in_progress → done`, with `independence: self-certified`. The attestation +row carries `attestation_schema: 3`, `achieved_assurance_level: L4`, `tool_identity: 0.10.0` +and the trust snapshot digest above. + +The re-run gate afterwards was GREEN: exit 0, state `green`, achieved `L4`, `stage_4.1` and +`stage_4.2` both `pass`. + +Completion commit: `40107c2` "chore: complete F-032b6453". The fixture was left clean and +untouched after this point, so the receipts stay current. + +## Files in this directory + +- `evidence/` — both signed receipts, byte-for-byte copies of `spec/evidence/F-032b6453/` +- `issuers.yaml` — the fixture's committed trust registry +- `attestation.yaml` — the fixture's attestation file, carrying the v3 row for the feature +- `done.txt` — the full `clad done` output +- `gate-after-done.json` — the GREEN strict pre-push gate result +- `signoff-audit.json`, `signoff-uat.json` — the two signoff results as reported by the CLI +- `versions.txt` — host, node, engine and RC identity + +No private key material was copied; `~/.cladding/keys/` is not evidence. diff --git a/docs/dogfood/mcp11-0.10.0/codex/done.txt b/docs/dogfood/mcp11-0.10.0/codex/done.txt new file mode 100644 index 00000000..963e11b9 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/done.txt @@ -0,0 +1,17 @@ +✓ Type +✓ Lint +✓ Drift +✓ Architecture +✓ Secret +✓ Unit tests +✓ Coverage +· Spec conformance +· Deliverable smoke +✓ Smoke +✓ Performance +✓ Visual +✓ Audit +✓ UAT +✓ done · F-032b6453 strict gate GREEN — status: in_progress → done +ℹ done · F-032b6453 independence: self-certified — the implementation author signed, or no verified review exists yet +ℹ done · F-032b6453 next: run clad check --tier=pre-push to re-attest sibling features, then commit spec/attestation.yaml diff --git a/docs/dogfood/mcp11-0.10.0/codex/evidence/026211187c93449bd6a7e16de6de2982f5378f09efe843aaaa9bcdb061ba11e2.yaml b/docs/dogfood/mcp11-0.10.0/codex/evidence/026211187c93449bd6a7e16de6de2982f5378f09efe843aaaa9bcdb061ba11e2.yaml new file mode 100644 index 00000000..22ac6f76 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/evidence/026211187c93449bd6a7e16de6de2982f5378f09efe843aaaa9bcdb061ba11e2.yaml @@ -0,0 +1 @@ +{"checks":{"code_test_review":"pass","evidence_sufficiency":"pass","independence":"pass"},"claim":"audit","implementation_authors_sha256":"7533e0a093246560a3c393355752064400dc1d5e841cce103e511dc1af906f97","issuer":"qwerfunch","issuer_key_id":"a237dda876e9159e8bc9106684206f6cde5639369b967c9b943b305d301ee5f3","issuer_proof":"kHQb8BcrJxMCa0f2cvHN4ja3TqNbr3VRfcnkeg3OFiHi_YX3Jhb9hoeRpuisA7x-uNHch_qvuG4cwmDf3VN_BQ","method":"human_channel","observed_at":"2026-09-07T13:14:22.118Z","receipt_schema":"1","reviewed_inputs_sha256":"0ba72090010dbae97b1fea1b567f10803b261c30428b98789724b980fb34d681","runtime_dependency_sha256":"f540fb51757c1e170c8d0c27ae326b5b7949a713ad27f9280479876e52b6c554","subject":"criterion:F-032b6453/AC-e435a582","subject_sha256":"03fb1349cf3a982e707f2a03a54635c4e22afee28dee566310b9859bd3758a4d"} diff --git a/docs/dogfood/mcp11-0.10.0/codex/evidence/507c59639825394dee9ca51f5ae911e8ee84ac227538181bee7fe5ef7baf47c7.yaml b/docs/dogfood/mcp11-0.10.0/codex/evidence/507c59639825394dee9ca51f5ae911e8ee84ac227538181bee7fe5ef7baf47c7.yaml new file mode 100644 index 00000000..44d83f9d --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/evidence/507c59639825394dee9ca51f5ae911e8ee84ac227538181bee7fe5ef7baf47c7.yaml @@ -0,0 +1 @@ +{"checks":{"no_surprise":"pass","tradeoff_acceptance":"pass"},"claim":"uat","criterion_verdicts":{"criterion:F-032b6453/AC-e435a582":"pass"},"implementation_authors_sha256":"7533e0a093246560a3c393355752064400dc1d5e841cce103e511dc1af906f97","issuer":"qwerfunch","issuer_key_id":"a237dda876e9159e8bc9106684206f6cde5639369b967c9b943b305d301ee5f3","issuer_proof":"Nw8g8sAYMutogeHJ2QNeTEkoGyR_YndGUCkoPo0S2Rsq6LQMrjfBbuozenrf2whPx-HApeP5SSremH2YFpw3Bw","method":"human_channel","observed_at":"2026-09-07T13:14:22.466Z","receipt_schema":"1","reviewed_inputs_sha256":"b8cf0c7e4582c2618efe0279dc448bb6e025ffaf12045a14bd134f3eca79d59c","runtime_dependency_sha256":"f540fb51757c1e170c8d0c27ae326b5b7949a713ad27f9280479876e52b6c554","subject":"feature:F-032b6453","subject_sha256":"62b05459b2273bc4e3b21f135669f5f2ae5a85046c4026da44592a3b2ed62578"} diff --git a/docs/dogfood/mcp11-0.10.0/codex/gate-after-done.json b/docs/dogfood/mcp11-0.10.0/codex/gate-after-done.json new file mode 100644 index 00000000..56460a97 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/gate-after-done.json @@ -0,0 +1,476 @@ +{ + "tier": "pre-push", + "profile": "push", + "requested_assurance_level": "L4", + "configured_assurance_level": "L4", + "achieved_assurance_level": "L4", + "scope_sha256": "66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53", + "input_sha256": "7b228c7c3eb604de04338dc84d67bdc64fc705e82a102f38374b2def51ac0263", + "profile_complete": true, + "obligations": [ + { + "obligation": "stage_1.1", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "360dc8475fd73ca108234082d4305cd87b087f87d717cbdc47a8ad2b3bfb5c32" + ] + }, + { + "obligation": "stage_1.2", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "e9c3ae842eca1f194514d581cb29c4411b9bf77171abecdee0d0e9a75b4f833a" + ] + }, + { + "obligation": "stage_1.3", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "93d3624ddc17ddd32606678d18a70b28bea7994d04151183093d092bff95359e" + ] + }, + { + "obligation": "stage_1.5", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "c764f377abb9781c13a4b0487542758ec1f78186fa17e49f63ad4ad985322a8d" + ] + }, + { + "obligation": "stage_1.6", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "9dcb8a6b0d7978fd2934738b58699456a99e09bdcf25e27c73c00ac70f59ef41" + ] + }, + { + "obligation": "stage_2.1", + "subject": "criterion:F-032b6453/AC-e435a582", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "f0a201def13f24ad09746d98aaeb1b6e3dbfa3a100f1957a4514b87a20b8a860" + ] + }, + { + "obligation": "stage_2.1", + "subject": "scope:66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "7aa7f5695d512af328f84893f42c4ef46b933ec7eeb7bef441788cff17d4d634" + ] + }, + { + "obligation": "stage_2.2", + "subject": "criterion:F-032b6453/AC-e435a582", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "850c0a90f18e31f89a9627af1c8805b3ddf6d4599b93573ba882f69305526f8b" + ] + }, + { + "obligation": "stage_2.2", + "subject": "scope:66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "b5551bcd631922d73f5f206cfb8a79821e846633dc78cab7fce004a443969c3d" + ] + }, + { + "obligation": "stage_2.3", + "subject": "scope:66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53", + "state": "na", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [] + }, + { + "obligation": "stage_2.4", + "subject": "feature:F-032b6453", + "state": "na", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [] + }, + { + "obligation": "stage_3.1", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "90ab9e5d7abab049f21152e87dd9c1630ccd805a08ccf3929be50d240b41bac1" + ] + }, + { + "obligation": "stage_3.2", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "381ba8d992988381c8dad05c666b85ef8a742d214a99bbcea4705d66002bb576" + ] + }, + { + "obligation": "stage_3.3", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "e8096384ff49e2722d487875dffeb7bf24e4f9e3a850bec9fb8ea834d9f8c513" + ] + }, + { + "obligation": "stage_4.1", + "subject": "criterion:F-032b6453/AC-e435a582", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "3739dbbca519907c0a5b967250adbc3f6001a087a4c8f882ed4ba344942e37e3" + ] + }, + { + "obligation": "stage_4.2", + "subject": "criterion:F-032b6453/AC-e435a582", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "930fe3d340e6d2078406d5a403e811e9c6cff8772c0197f8436d01aef2a88537" + ] + } + ], + "incomplete_addresses": [], + "independence": "self-certified", + "attestation_freshness": [ + { + "feature": "F-032b6453", + "state": "stale", + "field": "profile" + } + ], + "assurance": { + "profile": "push", + "assurance_level": "L4", + "configured_assurance_level": "L4", + "achieved_assurance_level": "L4", + "scope_sha256": "66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53", + "input_sha256": "7b228c7c3eb604de04338dc84d67bdc64fc705e82a102f38374b2def51ac0263", + "state": "green", + "profile_complete": true, + "results": [ + { + "obligation": "stage_1.1", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "360dc8475fd73ca108234082d4305cd87b087f87d717cbdc47a8ad2b3bfb5c32" + ] + }, + { + "obligation": "stage_1.2", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "e9c3ae842eca1f194514d581cb29c4411b9bf77171abecdee0d0e9a75b4f833a" + ] + }, + { + "obligation": "stage_1.3", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "93d3624ddc17ddd32606678d18a70b28bea7994d04151183093d092bff95359e" + ] + }, + { + "obligation": "stage_1.5", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "c764f377abb9781c13a4b0487542758ec1f78186fa17e49f63ad4ad985322a8d" + ] + }, + { + "obligation": "stage_1.6", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "9dcb8a6b0d7978fd2934738b58699456a99e09bdcf25e27c73c00ac70f59ef41" + ] + }, + { + "obligation": "stage_2.1", + "subject": "criterion:F-032b6453/AC-e435a582", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "f0a201def13f24ad09746d98aaeb1b6e3dbfa3a100f1957a4514b87a20b8a860" + ] + }, + { + "obligation": "stage_2.1", + "subject": "scope:66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "7aa7f5695d512af328f84893f42c4ef46b933ec7eeb7bef441788cff17d4d634" + ] + }, + { + "obligation": "stage_2.2", + "subject": "criterion:F-032b6453/AC-e435a582", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "850c0a90f18e31f89a9627af1c8805b3ddf6d4599b93573ba882f69305526f8b" + ] + }, + { + "obligation": "stage_2.2", + "subject": "scope:66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "b5551bcd631922d73f5f206cfb8a79821e846633dc78cab7fce004a443969c3d" + ] + }, + { + "obligation": "stage_2.3", + "subject": "scope:66f7f6301ab195d5cedf5c27b000c3b05a521bb494e9862612ece2c837aefc53", + "state": "na", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [] + }, + { + "obligation": "stage_2.4", + "subject": "feature:F-032b6453", + "state": "na", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [] + }, + { + "obligation": "stage_3.1", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "90ab9e5d7abab049f21152e87dd9c1630ccd805a08ccf3929be50d240b41bac1" + ] + }, + { + "obligation": "stage_3.2", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "report", + "blocking": "hard", + "observation_identities": [ + "381ba8d992988381c8dad05c666b85ef8a742d214a99bbcea4705d66002bb576" + ] + }, + { + "obligation": "stage_3.3", + "subject": "feature:F-032b6453", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "e8096384ff49e2722d487875dffeb7bf24e4f9e3a850bec9fb8ea834d9f8c513" + ] + }, + { + "obligation": "stage_4.1", + "subject": "criterion:F-032b6453/AC-e435a582", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "3739dbbca519907c0a5b967250adbc3f6001a087a4c8f882ed4ba344942e37e3" + ] + }, + { + "obligation": "stage_4.2", + "subject": "criterion:F-032b6453/AC-e435a582", + "state": "pass", + "source_strictness": "hard", + "blocking": "hard", + "observation_identities": [ + "930fe3d340e6d2078406d5a403e811e9c6cff8772c0197f8436d01aef2a88537" + ] + } + ], + "independence": "self-certified", + "obligation_sha256": "7191cce4bdf2f0264e05cd0e6efe6707b70024418bf303083e7947e9ecd01c29" + }, + "worst": 0, + "anyFailed": false, + "stages": [ + { + "stage": "stage_1.1", + "label": "Type", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_1.2", + "label": "Lint", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_1.3", + "label": "Drift", + "status": "pass", + "exitCode": 0, + "findings": [ + { + "detector": "HARDCODED_SECRET", + "severity": "info", + "message": "npx could not scan (config/setup gap, not a secret): npm error npx canceled due to missing packages and no YES option: [\"secretlint@13.0.4\"]\nnpm error A complete log of this run can be found in: /Users/qwerfunch/.npm/_logs/2026-09-07T13_14_41_091Z-debug-0.log" + }, + { + "detector": "HARNESS_INTEGRITY", + "severity": "info", + "message": "plugin.json not loaded: ENOENT: no such file or directory, open 'plugins/claude-code/.claude-plugin/plugin.json'" + }, + { + "detector": "COVERAGE_DROP", + "severity": "info", + "message": "coverage/coverage-summary.json not present — run stage_2.2 first" + }, + { + "detector": "PERFORMANCE_DRIFT", + "severity": "info", + "message": "perf baseline or current missing — run stage_3.2 with --record first" + }, + { + "detector": "ABSENCE_OF_GOVERNANCE", + "severity": "info", + "path": "spec/scenarios", + "message": "spec/scenarios is absent — cladding scaffold incomplete (user-journey scenarios (recommended)). Run `clad init --intent \"\"` to populate it." + }, + { + "detector": "SCENARIO_COVERAGE", + "severity": "info", + "path": "spec/scenarios/", + "message": "scenario coverage is absent under the current scenario policy — add a complete user journey with actor, goal, success, steps, and feature references." + }, + { + "detector": "DELIVERABLE_INTEGRITY", + "severity": "info", + "message": "1 done feature(s) ship modules but project.deliverable is not declared — the gate cannot smoke-test the shipped entry, so a broken entry point could ship green. Declare project.deliverable {path, is_safe_to_smoke: true} to enable DELIVERABLE_SMOKE (stage_2.4)." + } + ] + }, + { + "stage": "stage_1.5", + "label": "Architecture", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_1.6", + "label": "Secret", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_2.1", + "label": "Unit tests", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_2.2", + "label": "Coverage", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_2.3", + "label": "Spec conformance", + "status": "skip", + "exitCode": 2, + "stderr": "no spec-conformance oracles under tests/oracle/ — skipped" + }, + { + "stage": "stage_2.4", + "label": "Deliverable smoke", + "status": "skip", + "exitCode": 2, + "stderr": "no project.deliverable declared — skipped" + }, + { + "stage": "stage_3.1", + "label": "Smoke", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_3.2", + "label": "Performance", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_3.3", + "label": "Visual", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_4.1", + "label": "Audit", + "status": "pass", + "exitCode": 0 + }, + { + "stage": "stage_4.2", + "label": "UAT", + "status": "pass", + "exitCode": 0 + } + ] +} diff --git a/docs/dogfood/mcp11-0.10.0/codex/issuers.yaml b/docs/dogfood/mcp11-0.10.0/codex/issuers.yaml new file mode 100644 index 00000000..7c01a49a --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/issuers.yaml @@ -0,0 +1,5 @@ +schema: "1" +issuers: + - issuer: "qwerfunch" + issuer_key_id: a237dda876e9159e8bc9106684206f6cde5639369b967c9b943b305d301ee5f3 + spki_der: MCowBQYDK2VwAyEAZ1HjN95355SlwWlE+MDjvOf9AY6jo0L8/UXKireCRu4= diff --git a/docs/dogfood/mcp11-0.10.0/codex/signoff-audit.json b/docs/dogfood/mcp11-0.10.0/codex/signoff-audit.json new file mode 100644 index 00000000..18456b39 --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/signoff-audit.json @@ -0,0 +1,28 @@ +{ + "ok": true, + "code": "OK", + "message": "The signed receipt was stored and verified offline. Signed by registered issuer qwerfunch; a signature proves that issuer's assertion, not universal human identity.", + "evidence": { + "featureId": "F-032b6453", + "acId": "AC-e435a582", + "stage": "stage_4.1", + "identity": { + "author": "human", + "name": "local-asserted-signoff", + "timestamp": "2026-09-07T13:14:22.045Z" + }, + "kind": "pass", + "assurance": "asserted", + "content": "Local asserted audit: pass.", + "id": "ev-mtr9ig9p-tq8g4g" + }, + "path": "spec/evidence/F-032b6453/026211187c93449bd6a7e16de6de2982f5378f09efe843aaaa9bcdb061ba11e2.yaml", + "digest": "026211187c93449bd6a7e16de6de2982f5378f09efe843aaaa9bcdb061ba11e2", + "issuerKeyId": "a237dda876e9159e8bc9106684206f6cde5639369b967c9b943b305d301ee5f3", + "verification": { + "assurance": "verified", + "currentness": "current", + "reason": "verified", + "trustSnapshotDigest": "b6d1d70675d772aa109d52c52f594a8127490f5d6d0c5e8fcbb30c6f7b28e77d" + } +} diff --git a/docs/dogfood/mcp11-0.10.0/codex/signoff-uat.json b/docs/dogfood/mcp11-0.10.0/codex/signoff-uat.json new file mode 100644 index 00000000..029d9c2f --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/signoff-uat.json @@ -0,0 +1,27 @@ +{ + "ok": true, + "code": "OK", + "message": "The signed receipt was stored and verified offline. Signed by registered issuer qwerfunch; a signature proves that issuer's assertion, not universal human identity.", + "evidence": { + "featureId": "F-032b6453", + "stage": "stage_4.2", + "identity": { + "author": "human", + "name": "local-asserted-signoff", + "timestamp": "2026-09-07T13:14:22.393Z" + }, + "kind": "pass", + "assurance": "asserted", + "content": "Local asserted UAT signoff.", + "id": "ev-mtr9igje-e97vjc" + }, + "path": "spec/evidence/F-032b6453/507c59639825394dee9ca51f5ae911e8ee84ac227538181bee7fe5ef7baf47c7.yaml", + "digest": "507c59639825394dee9ca51f5ae911e8ee84ac227538181bee7fe5ef7baf47c7", + "issuerKeyId": "a237dda876e9159e8bc9106684206f6cde5639369b967c9b943b305d301ee5f3", + "verification": { + "assurance": "verified", + "currentness": "current", + "reason": "verified", + "trustSnapshotDigest": "b6d1d70675d772aa109d52c52f594a8127490f5d6d0c5e8fcbb30c6f7b28e77d" + } +} diff --git a/docs/dogfood/mcp11-0.10.0/codex/versions.txt b/docs/dogfood/mcp11-0.10.0/codex/versions.txt new file mode 100644 index 00000000..ce33ad4f --- /dev/null +++ b/docs/dogfood/mcp11-0.10.0/codex/versions.txt @@ -0,0 +1,7 @@ +host: codex-cli 0.153.0 +node: v26.0.0 +cladding engine: 0.10.0 (`clad --version`), run from the RC working tree via `.cladding/host/serve.cjs` +RC commit: 0578818 +dist/clad.js md5: ba348c9b1bddea5c73c1b90c8d39fbb7 +dist/clad.js sha256: 1bb59b7149663da210d1f74fb57dffdae6f2e3734edf31b20d89c55be2250e3d +fixture: ~/mcp11-codex diff --git a/docs/feature-cycle.md b/docs/feature-cycle.md index aaa36dc1..79e74ad0 100644 --- a/docs/feature-cycle.md +++ b/docs/feature-cycle.md @@ -19,7 +19,8 @@ say-so alone, never skip a `▣`. ## The cycle (one feature; repeat) 1. **SPEC — `planner` (formerly `librarian`).** Author *this* feature's shard now: `acceptance_criteria` (with - `test_refs`) + the `modules` you're about to build + any scenario it needs — in one + `test_refs` on schema 0.1; on schema 0.2 a test claims a criterion by its title instead — see + step 3) + the `modules` you're about to build + any scenario it needs — in one `clad_create_feature` call (the tool takes ACs/modules). Not the whole backlog; just the feature you're about to build. Classify its design impact in the same call: `none` for a genuinely internal change, @@ -38,6 +39,9 @@ say-so alone, never skip a `▣`. 2. **IMPLEMENT — `developer` (code; formerly `specialists`).** One implementer writes the production code for this feature in its own worktree. `clad checkpoint ` first so a failed cycle rolls back. + On a schema 0.2 workspace, open the cycle with `clad begin `: it marks the start, + moving the feature from `planned` to `in_progress` and recording one durable checkpoint. `clad + done` accepts only an in-progress feature, so a cycle that never began cannot be completed. 3. **TEST — independent author.** A *separate* `developer` dispatch — handed the feature's `acceptance_criteria` **plus the module signatures (types / API surface) only, never the @@ -52,6 +56,14 @@ say-so alone, never skip a `▣`. drive loop halts when reviewer identity equals the implementer's — not a guarantee that the test-author never peeked. An A/B run found test-authors reading repository files in 4/4 features despite the instruction; the reviewer remains the backstop.) + - On a schema 0.2 workspace a test claims a criterion **by its title**, not by a file list: + start the test's title with `[covers:/]`, e.g. + `it('[covers:F-…/AC-…] rejects an expired token', …)` with the feature's and criterion's own + ids in place of the ellipses. The token has to be the + first thing in a plain string title; a `describe()` title is never read, and several tokens + may follow one another when one test proves several criteria. `test_refs` is the older + schema 0.1 form and is not accepted on 0.2. Until a criterion has a test whose title claims + it, the gate reports that criterion as unobserved and the feature cannot finish. - ▣ **Barrier:** `clad check --tier=pre-push --strict` — type / lint / unit / cov **and** drift (MISSING_IMPLEMENTATION, UNTESTED_AC, MISSING_TESTS, STATUS_DRIFT). Zero error-severity ⇒ proceed; else loop back to 2/3 until green. @@ -68,7 +80,10 @@ say-so alone, never skip a `▣`. otherwise. Do not hand-write `status: done`: the verb is what keeps "done" from claiming more than the gate verifies. An unresolved structural design impact is refused before the gate runs. `clad sync` keeps the inventory honest. Sign-off identity ≠ any implementer - (independent agent, or a human at L4 / UAT). **Then start the next feature's cycle.** + (independent agent, or a human at L4 / UAT). On a schema 0.2 workspace the verb closes by + telling you to run `clad check --tier=pre-push` once more before committing: sealing this + feature moves the state every sibling's receipt was written against, so they need re-attesting + and `spec/attestation.yaml` is committed after that run. **Then start the next feature's cycle.** ## Parallelism = N concurrent instances of this same cycle @@ -85,7 +100,7 @@ its dependency's code. | conversational → multi-feature | 1 (wider only across *independent* DAG units) | host; user between cycles | | prompt → ONE feature | 1 | single pass | | `/goal` → autonomous | 1 (N for independent units) | host self-loops to the goal | -| headless `clad run` | 1 (`nextReady` already does this) | the loop | +| headless / unattended | 1 (one ready feature at a time) | the CI script that calls the host | The cycle steps are **byte-identical across modes** — no mode-specific control-flow. The always-loaded CLAUDE.md states the cadence so the host structures its own plan around it, and the @@ -111,10 +126,11 @@ gate still blocks a too-wide batch (fails safe). supported default: the host (Claude Code) authors files with its own Write/Edit when it embodies `cladding:developer`; cladding owns the cycle + the gates, the host owns the parallel execution engine. -- **Headless `clad run` (formerly `drive`) — the CI/SDK lane.** A sequential reference loop for - unattended runs (CI pipelines, SDK-driven automation) — `nextReady` already drives ONE feature at - a time. Its transports do **not** yet author code (the tool-use/mutation protocol is unbuilt), so - a no-real-dispatch run is honestly degraded, never reported as success. +- **Unattended runs — the CI/SDK lane.** For CI pipelines and SDK-driven automation, the same + cycle runs with no human in the room: the automation starts `clad serve`, its AI host takes ONE + ready feature at a time, and the gate decides completion exactly as it does in-session. 0.10.0 + retired the built-in headless loop that used to own this lane — it shipped without a code-authoring + transport and no recorded session ever ran it, so the host owns execution here too. ## Gate economy — one authoritative full gate per feature diff --git a/docs/glossary.md b/docs/glossary.md index 61f7a13f..21b37fa4 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -1,60 +1,71 @@ # Cladding · Tier C — Glossary (terminology SSoT) + tests/self-consistency.test.ts fails when a CLI verb, persona, MCP tool, + event type, or detector id ships without a fully populated row here. + States: stable | alias | deprecated | removed | frozen (wire identifier — + never renamed, display label may improve) | versioned (wire identifier that + carries its own schema_version, which may advance independently of the other + surfaces). KO column = 한국어 대응 표현 (식별자는 영문 유지). --> ## Brand / model terms (frozen — definitions locked) -| Term | Definition | KO | -|---|---|---| -| `cladding` | The harness that wraps an AI coding model with spec governance — like cladding on a building: the structure (model) does the work, the cladding keeps it weatherproof. | 클래딩 (하네스 본체) | -| `Ironclad` | The standard cladding implements (spec format + stage contract + detector semantics). | 아이언클래드 표준 | -| `Iron Law` | The 4-phase stage pipeline (code quality → tests/conformance → QA → human evidence). Deterministic stages decide; agents only propose. | 철칙 게이트 파이프라인 | -| `Iron Core` | Machine-facing identifiers and structured data (F-ids, stage codes, detector IDs). | 기계용 내부 식별자 층 | -| `Soft Shell` | Human-facing rendering layer — business-language labels over Iron Core ids (`src/ui/softShell.ts`). | 사용자용 표현 층 | -| `Vacuous Green` | A gate that reports PASS while verifying nothing (skip counted as pass, empty suite, broken entry untested). Cladding's central failure class. | 공허한 초록불 (검증 없는 통과) | -| `drift` | Any divergence between spec, code, tests, and docs that the detectors catch. | 표류 (스펙↔코드 어긋남) | -| `shard` | One feature/scenario YAML file under `spec/features/` or `spec/scenarios/`. | 스펙 조각 파일 | -| `EARS` | Easy Approach to Requirements Syntax — AC patterns: ubiquitous / event / state / optional / unwanted. | 요구사항 구문 표준 | -| `Tier A/B/C/D` | SSoT layers: A=sealed spec, B=design (capabilities/architecture/context), C=derived (conventions/index/glossary), D=transient evidence (events/audit logs). | SSoT 4계층 | -| `AC` | Acceptance criterion — one verifiable behavior inside a feature. | 인수 기준 | -| `oracle` | An impl-blind conformance test authored from the spec brief alone (`tests/oracle/`). | 구현-맹검 검증 테스트 | -| `deliverable` | The shipped entry point the gate smoke-runs (stage_2.4). | 출하 진입점 | -| `attestation` | The verification signature (`spec/attestation.yaml`) a GREEN strict pre-push gate writes: module tree-hashes per done feature — the clone-portable answer to "when was this last verified?" (0.6.0). | 검증 서명 | -| `adoption verdict` | Whether an agent CHOSE to **pull** context (a resolved `clad_get_working_set` / `clad_get_context` / `clad_get_impact` read-serve — the only adoption signal) vs what cladding merely **pushed** (impact / session / prompt cards — delivery, never adoption). Three values: `confirmed` \| `not_confirmed` \| `insufficient_data`. Gates the B1 cleanup — see docs/b1-adoption-protocol.md. | 채택 판정 (풀 대 푸시) | +| Term | State | English definition | KO | +|---|---|---|---| +| `cladding` | stable | The harness that wraps an AI coding model with spec governance — like cladding on a building: the structure (model) does the work, the cladding keeps it weatherproof. | 클래딩 (하네스 본체) | +| `Ironclad` | stable | The standard cladding implements (spec format + stage contract + detector semantics). | 아이언클래드 표준 | +| `Iron Law` | stable | The 4-phase stage pipeline (code quality → tests/conformance → QA → human evidence). Deterministic stages decide; agents only propose. | 철칙 게이트 파이프라인 | +| `Iron Core` | stable | Machine-facing identifiers and structured data (F-ids, stage codes, detector IDs). | 기계용 내부 식별자 층 | +| `Soft Shell` | stable | Human-facing rendering layer — business-language labels over Iron Core ids (`src/ui/softShell.ts`). | 사용자용 표현 층 | +| `Vacuous Green` | stable | A gate that reports PASS while verifying nothing (skip counted as pass, empty suite, broken entry untested). Cladding's central failure class. | 공허한 초록불 (검증 없는 통과) | +| `drift` | stable | Any divergence between spec, code, tests, and docs that the detectors catch. | 표류 (스펙↔코드 어긋남) | +| `shard` | stable | One feature/scenario YAML file under `spec/features/` or `spec/scenarios/`. | 스펙 조각 파일 | +| `EARS` | stable | Easy Approach to Requirements Syntax — AC patterns: ubiquitous / event / state / optional / unwanted. | 요구사항 구문 표준 | +| `Tier A/B/C/D` | stable | SSoT layers: A=sealed spec, B=design (capabilities/architecture/context), C=derived (conventions/index/glossary), D=transient evidence (events/audit logs). | SSoT 4계층 | +| `AC` | stable | Acceptance criterion — one verifiable behavior inside a feature. | 인수 기준 | +| `oracle` | stable | An impl-blind conformance test authored from the spec brief alone (`tests/oracle/`). | 구현-맹검 검증 테스트 | +| `deliverable` | stable | The shipped entry point the gate smoke-runs (stage_2.4). | 출하 진입점 | +| `attestation` | stable | The verification signature (`spec/attestation.yaml`). v1/v2 retain module-hash compatibility; v3 seals current contract, subject, verification, runtime-dependency, profile, and obligation inputs only after a profile-complete authoritative GREEN result. | 검증 서명 | +| `assurance profile` | stable | A named verification cadence: `feedback`, `checkpoint`, `completion`, `push`, or `release`. Legacy `pre-commit`, `pre-push`, and `all` are aliases for checkpoint, push, and release. | 보증 프로필 | +| `adoption verdict` | stable | Whether an agent CHOSE to **pull** context (a resolved `clad_get_working_set` / `clad_get_context` / `clad_get_impact` read-serve — the only adoption signal) vs what cladding merely **pushed** (impact / session / prompt cards — delivery, never adoption). Three values: `confirmed` \| `not_confirmed` \| `insufficient_data`. Gates the B1 cleanup — see docs/b1-adoption-protocol.md. | 채택 판정 (풀 대 푸시) | ## Personas (alias-and-deprecate bucket) -| Name | State | Role | KO | +| Name | State | English definition | KO | |---|---|---|---| | `orchestrator` | stable | Routes user intent to the right persona; never edits files. | 작업 분배자 | | `planner` | stable (0.6.0) | Spec author-custodian — owns Tier A, writes EARS ACs, manages archive lifecycle. | 스펙 설계자 | -| `librarian` | alias → `planner` | Old name. Collides with the ecosystem's read-only external-docs researcher role; removal in 0.7. | (구명) | +| `librarian` | alias → `planner` | Old name for `planner`. Collides with the ecosystem's read-only external-docs researcher role; removal in 0.7. | (구명) | | `developer` | stable (0.6.0) | Implements production code and tests; reads only the focus feature's slice; never edits spec. | 구현 담당 | -| `specialists` | alias → `developer` | Old name (plural form for a single persona); removal in 0.7. | (구명) | +| `specialists` | alias → `developer` | Old name for `developer` (plural form for a single persona); removal in 0.7. | (구명) | | `reviewer` | stable | Independent read-only auditor — anti-self-cert barrier; the most replicated community agent name, kept as-is. | 독립 감사자 | | `observability` | stable | Tier-D analyst over events/audit/perf logs (Anthropic Cookbook's own term for this role). | 로그·지표 분석자 | | `blind-author` | stable (0.6.0) | Impl-blind test/oracle author — tool-restricted (no Read/Grep/Glob/Edit), so blindness is structural, not promised. Input = the `clad oracle` brief only. | 맹검 작성자 | ## CLI verbs (alias-and-deprecate bucket) -| Verb | State | Meaning | KO | +| Verb | State | English definition | KO | |---|---|---|---| | `init` | stable | Scaffold a cladding workspace (intent-aware onboarding). | 작업공간 생성 | | `sync` | stable | Validate spec + refresh generated state (inventory, deliverable, index). | 스펙 동기화 | -| `check` | stable | Run the Iron Law stages; `--tier`, `--strict`, `--json`. | 게이트 검사 | -| `done` | stable | Gated completion flip: status→done only if the strict pre-push gate is GREEN. | 검증된 완료 처리 | +| `migrate` | stable (0.10.0) | Preview a schema 0.1 → 0.2 migration, or apply explicit human-confirmed choices as one recoverable transaction. | 스키마 마이그레이션 미리보기 | +| `relocate-generated` | stable (0.10.0) | Preview moving the generated index, document-link, and attestation projections into `spec/generated/`, or apply that move as one recoverable transaction. Opt-in: the pre-relocation layout stays fully supported. | 생성물 위치 이전 | +| `begin` | stable (0.10.0) | Start a schema 0.2 implementation cycle, saving its pre-cycle checkpoint with the status update. | 구현 사이클 시작 | +| `check` | stable | Run the Iron Law stages; `--tier` aliases or `--profile`, optional bounded `--assurance-level`, `--strict`, `--json`. | 게이트 검사 | +| `done` | stable | Gated completion flip: schema 0.2 invokes the completion profile; schema 0.1 retains strict pre-push compatibility. | 검증된 완료 처리 | | `clarify` | stable (0.6.0) | Continue the onboarding Q&A (spec-kit `/clarify` precedent). | 온보딩 질의 진행 | | `refine` | removed (0.8.0) | Old alias → `clarify` (no CLI precedent); removed — `clarify` is the only spelling now. | (제거됨) | | `status` | stable (0.6.0) | Render the feature × stage integrity matrix (`git status` convention). | 상태 매트릭스 | | `panel` | removed (0.8.0) | Old alias → `status` (no CLI precedent); removed — `status` is the only spelling now. | (제거됨) | -| `run` | stable (0.6.0) | Autonomous feature loop (EXPERIMENTAL; host-delegated path preferred). | 자율 루프 실행 | -| `drive` | removed (0.8.0) | Old alias → `run` (no CLI precedent); removed — `run` is the only spelling now. | (제거됨) | -| `work` | removed (0.6.0) | Was a permanently not-implemented reserved stub (always exit 2) — dishonest surface; `run` owns the slot. | (제거됨) | +| `run` | removed (0.10.0) | Was the experimental headless loop; retired because no recorded session ever ran it — start `clad serve` and let your AI host drive the cycle instead. | (제거됨) | +| `drive` | removed (0.8.0) | Old alias → `run`; both spellings are gone now that the headless loop is retired. | (제거됨) | +| `work` | removed (0.6.0) | Was a permanently not-implemented reserved stub (always exit 2) — dishonest surface; the retired `run` verb owned the slot. | (제거됨) | | `serve` | stable | Start the MCP server over stdio. | MCP 서버 | +| `signoff` | stable (0.10.0) | Record local audit or UAT history. Asserted by default; with `--verified --issuer ` a human re-types the feature id at the terminal and cladding signs a portable receipt with the registered key. Without that confirmation, a registered issuer, or a local signing key it records asserted history only. | 로컬 감사·UAT 기록 (사람이 확인하면 검증된 영수증 서명) | +| `key` | stable (0.10.0) | Manage the issuer signing keys and the committed public trust registry: `create` → one owner-only Ed25519 signing key outside the workspace plus its public half in `spec/trust/issuers.yaml`; `list` → the registered issuers and whether this machine holds their signing keys. | 발행자 키 관리 | +| `create` | stable (0.10.0) | Key subcommand that writes one owner-only Ed25519 signing key outside the workspace (`clad key create --issuer `) and registers its public key in `spec/trust/issuers.yaml` through the spec transaction. | 발행자 키 생성 | +| `list` | stable (0.10.0) | Key subcommand that shows the registered issuers and whether the local signing key is present (`clad key list`). | 발행자 목록 | +| `ingest-receipt` | stable (0.10.0) | Create-only storage for one portable receipt under its subject feature. The CLI accepts no trust, public-key, private-key, or destination authority. | 주체 기능 아래 이식 가능한 영수증을 생성 전용으로 저장 (CLI 신뢰·키·대상 경로 권한 없음) | | `oracle` | stable | Print the impl-blind authoring brief for a feature/AC. | 오라클 브리프 | | `setup` | stable | Wire cladding into detected AI hosts (Claude/Codex/Gemini/Antigravity/Cursor). | 호스트 연결 | | `update` | stable | Post-upgrade reconciliation (re-wire, sync, report-only drift). | 업그레이드 정리 | @@ -66,48 +77,55 @@ | `impact` | stable (0.7.0) | Print the blast radius for a change — the transitive dependents of a feature/file plus the scenarios and the regression test set to re-run. The backward complement of `context` (what depends on this, vs what this needs). | 영향 반경(blast radius) | | `verdict` | stable (0.8.x) | One-poll loop decision: reduces the pre-push strict gate + feature statuses to ONE of `DONE` \| `ITERATE` \| `ESCALATE` \| `BLOCKED` \| `BOOTSTRAP` with a `next_action` pointer + `remaining` list. Runs the SAME gate once per poll (never a re-implementation); `DONE` requires a green gate AND every feature done AND ≥1 non-liveness behavioral proof. A read-only poll — never stamps attestation. | 루프 판정(1회 폴) | | `measure` | stable (0.7.0) | Report the search + context efficiency the graph provides per feature — working-set tokens vs the naive (shard + all module files) baseline, dependency depth/edges resolved, regression-set coverage. Deterministic; measures what the graph CAN provide, not agent adoption. | 효율 측정 | -| `infer`-deps | stable (0.7.0) | Suggest feature `depends_on` edges from the code import graph — the dependency edges cladding never auto-produced. Resolves each module's imports to the owning feature; prints reviewable suggestions (a human merges them — anti-self-cert). | 의존 추론 | +| `infer-deps` | stable (0.7.0) | Suggest feature `depends_on` edges from the code import graph — the dependency edges cladding never auto-produced. Resolves each module's imports to the owning feature; prints reviewable suggestions (a human merges them — anti-self-cert). | 의존 추론 | | `graph` | stable (0.7.0) | Render the spec↔code↔doc knowledge graph: `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. | 지식 그래프 | +| `export` | stable | Graph subcommand that exports the knowledge graph as Mermaid, DOT, JSON, an Obsidian vault, or offline HTML. | 그래프 내보내기 | +| `stats` | stable | Graph subcommand that reports graph counts and the highest-degree 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 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 -> *drive loop* (`src/drive/loop.ts`), and its evidence identity is `clad-drive`, -> frozen for audit-log compatibility — so `drive` persists in code paths and event -> provenance even though the user-facing verb is `run` (never as a CLI verb: `drive` -> was removed in 0.8.0). -> KO: `run` 루프의 내부 이름은 *drive loop*(`src/drive/loop.ts`)이며, 증거 식별자 -> `clad-drive`는 감사 로그 호환을 위해 동결되어 있다 — 사용자 표면 verb는 `run`이지만 -> 코드 경로와 이벤트 기록에는 여전히 `drive`가 남는다. +> **Internal name — the drive loop.** The headless loop was internally the +> *drive loop*, and its evidence identity `clad-drive` stays reserved, frozen for +> audit-log compatibility, so old audit entries keep replaying after the loop +> itself was retired in 0.10.0 (never as a CLI verb: `drive` was removed in +> 0.8.0, `run` in 0.10.0). +> KO: 헤드리스 루프의 내부 이름은 *drive loop*였고, 증거 식별자 `clad-drive`는 감사 로그 +> 호환을 위해 동결된 채 예약되어 있다 — 루프 자체는 0.10.0에서 은퇴했지만 과거 감사 기록은 +> 그대로 재생된다. ## MCP tools (frozen wire identifiers) -| Tool | Meaning | -|---|---| -| `clad_prepare_init` | Read the project and return a bounded briefing plus one-time token; never writes files. | -| `clad_stage_init` | Validate the host-model onboarding draft and cache it only as ignored project runtime state for a later approval turn. | -| `clad_init` | Validate and apply the host model's structured onboarding draft. | -| `clad_prepare_clarify` | Read current onboarding state and prepare a real user answer for host-model refinement. | -| `clad_clarify` | Validate and apply the host model's structured refinement draft. | -| `clad_resolve_onboarding_review` | Apply only the onboarding proposal targets the user explicitly reviewed and approved. | -| `clad_list_features` | Query features by status/slug. | -| `clad_get_feature` | Fetch one feature + ACs by id or slug. | -| `clad_run_check` | Run drift detection in-process (terse by default). | -| `clad_get_events` | Tail the lifecycle event log. | -| `clad_create_feature` | Author a feature shard with hash id + ACs + a durable design-impact decision. | -| `clad_resolve_design_impact` | Mark structural design impact resolved after every listed Tier-B artifact actually changed. | -| `clad_create_scenario` | Author a scenario shard with hash id. | -| `clad_link_capability` | Upsert a capability ↔ feature binding (Tier B). | -| `clad_author_oracle` | Record a host-authored impl-blind oracle + provenance. | -| `clad_run_gate` | Run the real Iron Law gate for a tier in-session (0.6.0; strict by default). Payloads carry `schema_version`. | -| `clad_verdict` | One-poll loop decision (0.8.x) — runs the real pre-push strict gate ONCE and reduces it to `{verdict, next_action, remaining}` (`DONE` \| `ITERATE` \| `ESCALATE` \| `BLOCKED` \| `BOOTSTRAP`). Call INSTEAD OF `clad_run_gate` per loop turn (it subsumes the gate touch); a poll that answers ITERATE/ESCALATE is a success, not an error. | -| `clad_get_context` | The context slice for one feature by id/slug/module path (0.6.0) — dispatch the slice, never the whole spec. | -| `clad_get_working_set` | The token-budgeted working set for one feature/module (0.7.0) — focus + module CODE excerpts + forward needs + backward breaks + verify + budget, fused in one call; the code-bearing superset of `clad_get_context` (which stays frozen). | -| `clad_get_impact` | The blast-radius slice for a change by feature id/slug/module path (0.7.0) — transitive dependents + scenarios at risk + the regression test set; the backward complement of `clad_get_context`. | -| `clad_get_graph` | The live spec↔code↔doc knowledge graph (0.7.0) — tier-classified nodes (A/B/C/D) + typed edges, optionally a focused neighborhood; recomputed from the current spec so it is never stale. | -| `clad_changelog` | The deterministic shipped-changes manifest since a git ref (0.6.0) — the host renders human release notes FROM it, sourcing every claim from a feature title/AC sentence; `format: markdown \| audit \| catalog` for the deterministic renders. | +| Tool | State | English definition | KO | +|---|---|---|---| +| `clad_prepare_init` | frozen | Read the project and return a bounded briefing plus one-time token; never writes files. | 초기화 준비 정보 조회 | +| `clad_stage_init` | frozen | Validate the host-model onboarding draft and cache it only as ignored project runtime state for a later approval turn. | 초기화 초안 검증·임시 저장 | +| `clad_init` | frozen | Validate and apply the host model's structured onboarding draft. | 초기화 초안 적용 | +| `clad_prepare_clarify` | frozen | Read current onboarding state and prepare a real user answer for host-model refinement. | 온보딩 보완 준비 | +| `clad_clarify` | frozen | Validate and apply the host model's structured refinement draft. | 온보딩 보완 적용 | +| `clad_resolve_onboarding_review` | frozen | Apply only onboarding proposal targets that the user explicitly reviewed and approved. | 검토된 온보딩 제안 반영 | +| `clad_list_features` | frozen | Query features by status or slug. | 기능 목록 조회 | +| `clad_get_feature` | frozen | Fetch one feature and its acceptance criteria by id or slug. | 기능·인수 기준 조회 | +| `clad_run_check` | frozen | Run the in-process drift-detector subset, terse by default. | 경량 드리프트 검사 실행 | +| `clad_run_gate` | frozen | Run the real Iron Law gate in-session with tier/profile and assurance-level parity; strict is the default. | 전체 게이트 실행 | +| `clad_verdict` | frozen | Reduce one real pre-push strict-gate poll to a verdict, next action, and remaining work. | 반복 루프 판정 | +| `clad_get_context` | frozen | Return the no-code context slice for one feature by id, slug, or module path. | 컨텍스트 슬라이스 조회 | +| `clad_get_working_set` | frozen | Return the token-budgeted code-bearing working set for one feature or module. | 워킹셋 조회 | +| `clad_get_impact` | frozen | Return the blast-radius slice for a proposed change. | 영향 범위 조회 | +| `clad_get_graph` | versioned (schema_version 2) | Return a bounded projection of the spec-to-code-to-doc knowledge graph, or its corpus statistics when no query is given. | 지식 그래프 조회 | +| `clad_changelog` | frozen | Return the deterministic shipped-changes manifest since a git ref. | 변경 이력 조회 | +| `clad_get_events` | frozen | Return a bounded tail of the lifecycle event log. | 수명주기 이벤트 조회 | +| `clad_prepare_spec_edit` | frozen | Return a typed edit projection and canonical input revisions without writing. | 스펙 편집 준비 | +| `clad_edit_spec` | frozen | Apply a typed schema edit batch with optimistic input revisions. | 스펙 편집 적용 | +| `clad_begin` | frozen | Start a feature cycle through the recoverable typed edit boundary. | 기능 사이클 시작 | +| `clad_create_feature` | frozen | Author a feature shard with a hash id, acceptance criteria, and design-impact decision. | 기능 샤드 생성 | +| `clad_resolve_design_impact` | frozen | Mark a structural design impact resolved after all listed Tier-B artifacts changed. | 설계 영향 해결 처리 | +| `clad_author_oracle` | frozen | Record a host-authored implementation-blind oracle and its provenance. | 맹검 오라클 기록 | +| `clad_create_scenario` | frozen | Author a scenario shard with a hash id. | 시나리오 샤드 생성 | +| `clad_link_capability` | frozen | Upsert a capability-to-feature binding in Tier B. | 역량-기능 연결 | +| `clad_ingest_receipt` | frozen | Create-only store one portable evidence receipt; trust comes from the registered host. | 이식 가능한 증거 영수증 수집 | +| `clad_signoff` | frozen | Record local audit or UAT history; with `verified` and a registered issuer, a human confirmation in the host's elicitation form signs a portable receipt. | 감사·UAT 서명 기록 (사람 확인 시 검증된 영수증) | ## Context surfaces (push vs pull) @@ -152,13 +170,33 @@ four distinct Korean words too, so the conflation cannot survive translation: ## Event types (frozen) -`stage_started` · `stage_completed` · `feature_activated` · `feature_completed` · `evidence_recorded` · `drift_detected` · `feature_checkpoint` · `feature_rolled_back` · `sentinel_miss` - -Added 0.6.0 (F-b84c38 — payloads carry `identity` + `head`): `feature_created` (spec shard authored) · `scenario_created` · `done_attempted` (gated flip, kept or reverted) · `gate_run` (tier verification outcome; deduped per identical HEAD/tier/strict/worst and, since 0.9.4, blocker evidence) · `stop_blocked` (F-1d23a6 — the Stop host hook blocked a session end on a fresh failure fingerprint; identical fingerprints demote). `design_impact_resolved` records that a structural feature's reviewed Tier-B changes were applied. - -Added 0.9.4 (F-1aab1bba — Stop outcome counters): `stop_exit_recorded` records the existing identical-fingerprint demotion as a known-failing exit. `stop_blocked`, `gate_run`, and `done_attempted` carry additive compact blocker evidence so `clad doctor` can derive whether a blocked fingerprint appeared in a later gate without a second correlation state file. +Every EventType wire id is frozen. `stop_blocked`, `gate_run`, and +`done_attempted` carry compact blocker evidence; value-delivery rows distinguish +an unwired surface from a surface that deliberately produced nothing. -Added 0.8.0 (F-6ba22c5c — value-delivery telemetry, so a silent surface is distinguishable from an unwired one): `impact_card_fired` (a PostToolUse impact card produced output — payload file/feature/impacted/tests/unledgered) · `impact_card_skipped` (the card was skipped — `reason` ∈ a closed enum, one per degrade branch; the two high-frequency reasons are aggregated to one event per debounce window) · `session_card_rendered` (a non-empty SessionStart card — payload bytes) · `prompt_suggestion_served` (a non-empty UserPromptSubmit suggestion — payload kind) · `working_set_served` (an MCP read serve of `clad_get_working_set` / `clad_get_context` / `clad_get_impact` — payload tool/query/resolved). Summarized by `clad measure --sessions` as DELIVERY (did the surfaces fire), never adoption. +| Event type | State | English definition | KO | +|---|---|---|---| +| `stage_started` | frozen | A gate stage began execution. | 게이트 단계 시작 | +| `stage_completed` | frozen | A gate stage completed with its outcome. | 게이트 단계 완료 | +| `feature_activated` | frozen | A feature became active. | 기능 활성화 | +| `feature_completed` | frozen | A feature completed its lifecycle. | 기능 완료 | +| `evidence_recorded` | frozen | Evidence was recorded in the lifecycle ledger. | 증거 기록 | +| `drift_detected` | frozen | Drift detection produced a finding. | 드리프트 감지 | +| `feature_checkpoint` | frozen | A feature checkpoint pinned its state. | 기능 체크포인트 | +| `feature_rolled_back` | frozen | A feature rollback was recorded. | 기능 롤백 | +| `sentinel_miss` | frozen | A dispatcher response missed a required sentinel and used deterministic fallback. | 센티널 누락 | +| `feature_created` | frozen | A new feature shard was authored. | 기능 샤드 생성 | +| `design_impact_resolved` | frozen | Reviewed Tier-B design impact was resolved. | 설계 영향 해결 | +| `scenario_created` | frozen | A new scenario shard was authored. | 시나리오 샤드 생성 | +| `done_attempted` | frozen | A gated attempt to mark a feature done was kept or reverted. | 완료 전환 시도 | +| `gate_run` | frozen | A tier verification gate completed. | 게이트 실행 결과 | +| `stop_blocked` | frozen | A Stop hook blocked a session end on a fresh failure fingerprint. | 세션 종료 차단 | +| `stop_exit_recorded` | frozen | An identical Stop failure fingerprint took the known-failing exit path. | 알려진 실패 종료 기록 | +| `impact_card_fired` | frozen | A PostToolUse impact card produced output. | 영향 카드 제공 | +| `impact_card_skipped` | frozen | An impact card was deliberately suppressed with a closed reason. | 영향 카드 생략 | +| `session_card_rendered` | frozen | A non-empty SessionStart card was rendered. | 세션 카드 렌더링 | +| `prompt_suggestion_served` | frozen | A non-empty UserPromptSubmit suggestion was served. | 프롬프트 제안 제공 | +| `working_set_served` | frozen | An MCP context, working-set, or impact read was served. | 워킹셋 읽기 제공 | ## Spec schema fields (frozen) @@ -166,19 +204,67 @@ Added 0.8.0 (F-6ba22c5c — value-delivery telemetry, so a silent surface is dis Ref prefixes: `self-dogfood:` (verified by cladding running on itself) · `fixture:` (conformance registry anchor) · `derived:` (machine-suggested, not author-confirmed — never satisfies a verification mandate; planned 0.6.0). +### Additive Spec 0.2 compiler terms + +These fields are validated and projected by the additive compiler and migration preview. They do not switch this repository's current schema or enable migration apply. + +- `project.purpose` — required project WHY; `intent_summary` remains schema 0.1 source data, never a 0.2 alias. +- `project.assurance_level` — explicitly persisted `L1` | `L2` | `L3` | `L4`; preview proposes `L2` for human confirmation and never infers it from stage layout. +- `project.scenario_policy` — explicitly persisted `off` | `advisory` | `required`; preview proposes `advisory` for human confirmation rather than applying a default. +- `capability.outcome` — required user-visible result for a catalog capability. Capability `summary`, `surface`, and `features` are legacy source fields. +- `feature.capability_refs` — the sole authored feature-to-capability edge set. `[]` deliberately means direct contribution to project purpose. +- `architecture.layers` — ordered foundation-to-entry `string[][]`; object-form layers require migration review. +- `architecture.rules` — `AR-<8 lowercase hex>` `forbidden_import` records. `from` is the importing layer and `to` is the imported dependency layer; every rule has a non-empty rationale. +- `criterion.constraint_refs` — architecture-rule addresses that may supply a constraint rationale. Unknown rules block the contract. +- `L = N` — the sorted migration proof that legacy capability-owned pairs (`L`) exactly equal the feature-owned candidate pairs (`N`) before any future cutover. + ## Detector IDs (frozen — display labels may improve) -IDs stay exactly as registered in `src/stages/detectors/index.ts` (audit-log stability). Confusable pairs, disambiguated by label: - -| ID | Display label clarification | -|---|---| -| `ABSENCE_OF_GOVERNANCE` | governance file **missing** | -| `HOLLOW_GOVERNANCE` | governance file present but **empty** | -| `EVIDENCE_MISMATCH` | evidence file **gone from disk** | -| `STALE_EVIDENCE` | evidence **older than 90 days** | -| `MISSING_IMPLEMENTATION` | spec declares a module the disk **doesn't have** | -| `UNMAPPED_ARTIFACT` | disk has a source file **no feature claims** | -| `STALE_ATTESTATION` | shipped (done) modules **changed since the last attested verification** (0.6.0; vs the committed `spec/attestation.yaml` verification signature) | +IDs stay exactly as registered in `src/stages/detectors/index.ts` for audit-log stability. + +| Detector ID | State | English definition | KO | +|---|---|---|---| +| `HARDCODED_SECRET` | frozen | Detects secrets committed in source through the configured secret scanner. | 하드코딩된 비밀 탐지 | +| `ARCHITECTURE_VIOLATION` | frozen | Detects imports that violate declared architecture boundaries. | 아키텍처 위반 탐지 | +| `MISSING_IMPLEMENTATION` | frozen | Detects a spec-declared module that is absent from disk. | 구현 파일 누락 탐지 | +| `UNMAPPED_ARTIFACT` | frozen | Detects a source artifact that no feature claims. | 미연결 산출물 탐지 | +| `TECH_STACK_MISMATCH` | frozen | Detects disagreement between declared and observed technology stack. | 기술 스택 불일치 탐지 | +| `STATUS_DRIFT` | frozen | Detects feature status that conflicts with implementation evidence. | 상태 표류 탐지 | +| `STALE_SPECIFICATION` | frozen | Detects specification entries that have become stale. | 오래된 스펙 탐지 | +| `REFERENCE_INTEGRITY` | frozen | Detects invalid references between governed artifacts. | 참조 무결성 탐지 | +| `DOC_LINK_INTEGRITY` | frozen | Detects broken or invalid documentation links. | 문서 링크 무결성 탐지 | +| `HARNESS_INTEGRITY` | frozen | Detects integrity drift in cladding harness wiring. | 하네스 무결성 탐지 | +| `META_INTEGRITY` | frozen | Detects invalid or inconsistent governance metadata. | 메타데이터 무결성 탐지 | +| `AC_DRIFT` | frozen | Detects acceptance criteria whose implementation evidence drifted. | 인수 기준 표류 탐지 | +| `MISSING_TESTS` | frozen | Detects implementation without declared test coverage. | 테스트 누락 탐지 | +| `STALE_TESTS` | frozen | Detects tests that no longer match their implementation contract. | 오래된 테스트 탐지 | +| `COVERAGE_DROP` | frozen | Detects a regression in reported test coverage. | 테스트 커버리지 하락 탐지 | +| `PERFORMANCE_DRIFT` | frozen | Detects performance evidence that diverges from its declared contract. | 성능 표류 탐지 | +| `EVIDENCE_MISMATCH` | frozen | Detects evidence that names a file no longer present on disk. | 증거 파일 불일치 탐지 | +| `STALE_EVIDENCE` | frozen | Detects evidence older than the accepted freshness window. | 오래된 증거 탐지 | +| `UNTESTED_AC` | frozen | Detects an acceptance criterion without a test reference. | 테스트 없는 인수 기준 탐지 | +| `UNVERIFIED_AC` | frozen | Detects an acceptance criterion without verification evidence. | 검증되지 않은 인수 기준 탐지 | +| `CONVENTION_DRIFT` | frozen | Detects naming or repository conventions that were not followed. | 명명 규칙 표류 탐지 | +| `FIXTURE_REFERENCE_INVALID` | frozen | Detects an evidence reference to an unregistered conformance fixture. | 유효하지 않은 픽스처 참조 탐지 | +| `SLUG_CONFLICT` | frozen | Detects two governed records that share a slug. | 슬러그 충돌 탐지 | +| `ID_COLLISION` | frozen | Detects duplicate governed identifiers. | 식별자 충돌 탐지 | +| `INVENTORY_DRIFT` | frozen | Detects disagreement between source inventory and the workspace. | 인벤토리 표류 탐지 | +| `AC_DUPLICATE_WITHIN_FEATURE` | frozen | Detects duplicate acceptance-criterion identifiers within one feature. | 기능 내부 인수 기준 중복 탐지 | +| `ARCHITECTURE_FROM_SPEC` | frozen | Detects architecture documentation that no longer matches the spec. | 스펙 기반 아키텍처 표류 탐지 | +| `CAPABILITIES_FEATURE_MAPPING` | frozen | Detects inconsistent capability-to-feature mappings. | 역량-기능 매핑 불일치 탐지 | +| `ABSENCE_OF_GOVERNANCE` | frozen | Detects a missing governance file. | 거버넌스 파일 부재 탐지 | +| `AI_HINTS_FORBIDDEN_PATTERN` | frozen | Detects forbidden patterns in AI behavior hints. | AI 힌트 금지 패턴 탐지 | +| `PLANNED_BACKLOG` | frozen | Detects planned backlog that breaches its governance policy. | 계획 백로그 위반 탐지 | +| `HOLLOW_GOVERNANCE` | frozen | Detects a governance file that exists but is empty. | 빈 거버넌스 탐지 | +| `DEPENDENCY_CYCLE` | frozen | Detects a cycle in feature dependencies. | 기능 의존성 순환 탐지 | +| `SCENARIO_COVERAGE` | frozen | Detects missing scenario coverage for governed behavior. | 시나리오 커버리지 누락 탐지 | +| `PROJECT_CONTEXT_DRIFT` | frozen | Detects project-context documentation that no longer matches the workspace. | 프로젝트 컨텍스트 표류 탐지 | +| `SPEC_CONFORMANCE` | frozen | Detects lifecycle evidence that fails the specification conformance contract. | 스펙 적합성 위반 탐지 | +| `DELIVERABLE_INTEGRITY` | frozen | Detects a declared deliverable that is missing or invalid. | 출하 진입점 무결성 탐지 | +| `SMOKE_PROBE_DEMAND` | frozen | Owns the safe-deliverable precondition for the stage_2.4 smoke probe. | 스모크 프로브 요구 조건 탐지 | +| `STALE_ATTESTATION` | frozen | Detects done modules changed since authoritative attested verification. | 오래된 검증 서명 탐지 | +| `INFERABLE_DEPENDS_ON` | frozen | Detects feature dependencies that the import graph can infer but the spec omits. | 추론 가능한 의존성 누락 탐지 | +| `HOST_CLAIM_DRIFT` | frozen | Detects host capability claims that diverge from actual host integration. | 호스트 주장 표류 탐지 | ## Naming conventions (enforced by review; see docs/code-style.md) diff --git a/docs/knowledge-graph/design.md b/docs/knowledge-graph/design.md index ec81ec94..359d949e 100644 --- a/docs/knowledge-graph/design.md +++ b/docs/knowledge-graph/design.md @@ -1,7 +1,13 @@ -# Cladding Knowledge Graph — design & cost model + -> Status: design (v0.7.0 track), with a **post-ship addendum (§8)** recording where -> the shipped capability deliberately departed from this document. Honest framing: +# Cladding Knowledge Graph v1 — historical design & cost model + +> **Historical status.** This document records the v0.7.0 design and its post-ship +> addendum (§8). It is evidence for why the shipped v1 looks as it does, not the +> target graph contract. The accepted 0.10.0 replacement is +> [`Spec 0.2` D17](../design/spec-0.2/graph.md#d17--knowledge-graph-v2-as-compiler-ir). +> Do not carry this document's seven node kinds, kind twins, or undirected +> neighborhood semantics into new implementation. Honest v1 framing: > this layer improves **traceability completeness** and **context-selection > efficiency (retrieval)**. It does **not** improve LLM correctness or "reasoning > depth" — cladding's own A/B record shows conformance is orthogonal to the spec @@ -27,7 +33,7 @@ already largely exists (`REFERENCE_INTEGRITY`, `UNMAPPED_ARTIFACT`, `CAPABILITIES_FEATURE_MAPPING`, `ARCHITECTURE_FROM_SPEC`). We add the *reverse* direction, the *doc* axis, and a *view*. -**The realized model** (`src/graph/model.ts`, since v0.7.0) — seven node kinds: +**The realized model** (`src/graph/presentation.ts`, since v0.7.0) — seven node kinds: `feature` · `module` · `skill` · `test` · `scenario` · `capability` · `doc`, each tier-classified A/B/C/D (features labeled by slug); and seven typed edges: `depends_on` (feature→feature) · `touches` (feature→module) · `covers` (feature→test) · diff --git a/docs/multi-provider-roadmap.md b/docs/multi-provider-roadmap.md index 00822e3a..c8f2b772 100644 --- a/docs/multi-provider-roadmap.md +++ b/docs/multi-provider-roadmap.md @@ -9,6 +9,8 @@ related_spec: spec/features/F-049.yaml LLM access today splits into two modes. cladding treats both as first-class but defaults to the one that does not require users to manage API keys. +> **0.10.0 note.** The headless agent loop is retired, and the adapters that existed only to serve it — the SDK adapter, the two host adapters, and the adapter registry — went with it. What survives is the host transport plus the sampling context the onboarding scan uses. Rows and code paths below that name the retired files are kept as history, not as a description of the current tree. + ## Two modes | Mode | Who calls the LLM | API key | Examples | cladding adapter directory | @@ -55,13 +57,13 @@ The `AgentResult` and the audit-log evidence shape are invariant across adapters | `openai` | sdk | reserved | `OPENAI_API_KEY` | Slot exists in `SDK_REGISTRY`; not implemented yet. | | `gemini` | sdk | reserved | `GOOGLE_API_KEY` | Slot exists in `SDK_REGISTRY`; not implemented yet. | -v0.2.26 closes the host-mode loop: `clad serve` boots the MCP server, `setHostMcpServer` registers it, and both host adapters route LLM dispatch through `McpSamplingTransport` automatically. Standalone `clad run` (no `clad serve`) keeps the Mock fallback so unit-test paths are unchanged. +v0.2.26 closes the host-mode loop: `clad serve` boots the MCP server, `setHostMcpServer` registers it, and both host adapters route LLM dispatch through `McpSamplingTransport` automatically. A standalone CLI invocation (no `clad serve`) kept the Mock fallback so unit-test paths were unchanged. ## How to add a new adapter 1. Pick a directory: `src/adapters/host/.ts` or `src/adapters/sdk/.ts`. 2. Implement `AgentAdapter`. The `invokeAgent` body translates `PersonaSpec` (parsed from `src/agents/.md`) plus `AgentContext` (current feature shard + tagged guardrails) into whatever the underlying transport expects. -3. Register the adapter in `src/adapters/index.ts` under the right mode. +3. Wire the adapter into whatever selects it. The mode-keyed registry this step once named retired with the headless loop in 0.10.0, so a future adapter needs a new selection point rather than that file. 4. Add a row to the adapter matrix above and to F-049 if you're introducing a new failure mode (AC-088 covers `host-unavailable`, `auth`, `rate-limit`, `network`, `context-window`, `safety-filter`; new modes need a new bullet). 5. Add a fixture under `tests/adapters/-parity.test.ts` that runs the synthetic single-feature project through your adapter and asserts identical `AgentResult` shape vs. an existing adapter. @@ -76,14 +78,14 @@ The two host adapters originally shipped as **mock implementations** that satisf ### The mismatch -Cladding's `clad` CLI is a **single-shot process**. Every invocation parses arguments, runs to completion, exits. The host's agent-invocation machinery — Claude Code's Task/Agent tools, Cursor's agent API, an MCP transport — is **session-bound**: it lives inside a long-running editor/agent session and is not reachable from a separate process. So a short-running `clad run` cannot directly call those session-bound APIs. +Cladding's `clad` CLI is a **single-shot process**. Every invocation parses arguments, runs to completion, exits. The host's agent-invocation machinery — Claude Code's Task/Agent tools, Cursor's agent API, an MCP transport — is **session-bound**: it lives inside a long-running editor/agent session and is not reachable from a separate process. So a short-running CLI process cannot directly call those session-bound APIs. Three plausible bridges, and why two of them don't fit cladding's current shape: | Bridge | Sketch | Why it (does not) work | |---|---|---| -| Direct SDK call (Anthropic / OpenAI / Gemini) | `clad run` reads `*_API_KEY` and calls the SDK | Breaks F-049 AC-091 (host adapters require no API key); breaks the host-bound default policy v0.1.2 baked in. SDK adapters stay opt-in. | -| Slash command output | `clad run` prints a "do this" instruction and the host's user runs it | Surrenders autonomy back to the user. Cladding's drive loop becomes a glorified `status`, not an autonomous orchestrator. | +| Direct SDK call (Anthropic / OpenAI / Gemini) | the CLI reads `*_API_KEY` and calls the SDK | Breaks F-049 AC-091 (host adapters require no API key); breaks the host-bound default policy v0.1.2 baked in. SDK adapters stay opt-in. | +| Slash command output | the CLI prints a "do this" instruction and the host's user runs it | Surrenders autonomy back to the user. Cladding's drive loop becomes a glorified `status`, not an autonomous orchestrator. | | Two-process bridge | Cladding runs as a server, the host calls in | Fits — but requires picking how cladding becomes a server. See below. | ### The two server options for v0.3.0 diff --git a/docs/project-context.md b/docs/project-context.md index 78454aa5..a516168c 100644 --- a/docs/project-context.md +++ b/docs/project-context.md @@ -12,7 +12,7 @@ Specifically, cladding closes three gaps in AI-coupled development: - **Spec ↔ code traceability**: Every feature has an id, modules, ACs, and a status. Every source file maps to a feature (or trips `UNMAPPED_ARTIFACT`). - **Architecture invariants**: `spec/architecture.yaml` declares layers + forbidden imports; `ARCHITECTURE_FROM_SPEC` enforces them. -- **Multi-developer safety**: Hash-based feature ids (`F-`) prevent collisions when multiple developers concurrently invoke `clad_create_feature`. +- **Multi-developer safety**: Eight-hex hash-based feature ids (`F-`) prevent collisions when multiple developers concurrently invoke `clad_create_feature`. The 4-tier SSoT model (Tier A spec sealed → Tier B design editable → Tier C derived → Tier D audit/transient) gives every artifact an explicit refresh authority. Cladding's own scaffold is itself measured (via the A/B evaluation framework, F-4db939 + F-ba2e05) against vanilla Claude Code on the same intent. diff --git a/docs/setup.md b/docs/setup.md index 994aa4be..6766eca6 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -61,6 +61,11 @@ machine-readable claim lives in the README's `clad:host-claims` fence, which `HO polices against `docs/dogfood/matrix.md`; its `verified` grade covers the doctor surfaces listed in that matrix, not every release-specific onboarding campaign.) +At the 0.10.0 release the live host check was rerun. Cursor passed every +probed surface end-to-end this time, so its model replay is no longer absent. Antigravity timed out +on every probe in that run and is recorded as failing rather than verified. The current table, +with the reason recorded beside each grade, is in `docs/dogfood/matrix.md`. + ## About the MCP server All 5 hosts wire cladding as an MCP server — only the wire *location* differs. MCP is not diff --git a/docs/spec-ids-multi-dev.md b/docs/spec-ids-multi-dev.md index 237b9993..7922a711 100644 --- a/docs/spec-ids-multi-dev.md +++ b/docs/spec-ids-multi-dev.md @@ -8,11 +8,11 @@ Two or more contributors can add new features or scenarios to a cladding-applied | Layer | Identifier | Scope | Multi-dev safety | |---|---|---|---| -| **Filename** | `-.yaml` (8 hex since 0.6.0, legacy 6 hex valid; e.g. `login-flow-a3f9c2e1.yaml`) | one per feature or scenario | ✅ Two contributors with the same slug get different hashes → different file paths → no `git merge` collision | -| **Feature id** | `F-` (e.g. `F-a3f9c2e1`) — same hash as filename | globally unique by construction | ✅ < 1/4.3B per-pair collision at 8 hex (6-hex birthday bound neared 50% at ~5k features); `ID_COLLISION` detector catches the rest | -| **Scenario id** | `S-` (e.g. `S-c4d108e9`) — full feature-symmetric model since v0.3.12 | globally unique by construction | ✅ Same guarantees as features; `F-*` and `S-*` are separate id namespaces | +| **Filename** | `-.yaml` (8 hex since 0.6.0, legacy 6 hex valid; e.g. `login-flow-a3f9c2e1.yaml`) | one per feature or scenario | ✅ Two contributors with the same slug get different hashes → different file paths → no `git merge` collision | +| **Feature id** | `F-` (e.g. `F-a3f9c2e1`) — same hash as filename | globally unique by construction | ✅ < 1/4.3B per-pair collision at 8 hex (6-hex birthday bound neared 50% at ~5k features); `ID_COLLISION` detector catches the rest | +| **Scenario id** | `S-` (e.g. `S-c4d108e9`) — full feature-symmetric model since v0.3.12 | globally unique by construction | ✅ Same guarantees as features; `F-*` and `S-*` are separate id namespaces | | **Slug** (yaml field) | `login-flow` | human-readable anchor, separate namespaces for features vs scenarios | ⚠️ Two contributors picking the same slug within the same namespace is *expected* if they have the same intent; `SLUG_CONFLICT` detector raises this as an error so a human resolves it | -| **AC id** | `AC-001` ~ `AC-NNN` | **feature-scoped sequential** | ✅ `F-001.AC-001` and `F-002.AC-001` coexist freely; `AC_DUPLICATE_WITHIN_FEATURE` catches intra-feature duplicates | +| **AC id** | `AC-` for new records; legacy `AC-NNN` and six-or-more-hex forms remain readable | **feature-scoped; canonical address `criterion:/`** | ✅ Same AC spelling may coexist under different features; `AC_DUPLICATE_WITHIN_FEATURE` catches only an intra-feature duplicate | | **Legacy `F-NNN` / `S-NNN`** | `F-001` ~ `F-083`, `S-001`, `S-002` | global sequential (pre-v0.3.9 / pre-v0.3.12) | ✅ Coexists with the new model forever — no migration required | ## How features and scenarios get created @@ -42,16 +42,16 @@ The host LLM calls cladding's `clad_create_feature` or `clad_create_scenario` MC ### Scenario 1: Different slugs, simultaneous -- Alice on `feat/login`: `createFeature(slug='login-flow')` → `login-flow-a3f9c2.yaml` -- Bob on `feat/checkout`: `createFeature(slug='checkout-cart')` → `checkout-cart-d29f1a.yaml` +- Alice on `feat/login`: `createFeature(slug='login-flow')` → `login-flow-a3f9c2e1.yaml` +- Bob on `feat/checkout`: `createFeature(slug='checkout-cart')` → `checkout-cart-d29f1a7b.yaml` - main merge → both files land cleanly. **No conflict.** ### Scenario 2: Same slug, simultaneous -- Alice on `feat/auth-1`: `createFeature(slug='auth-bypass')` → `auth-bypass-c4d108.yaml` -- Bob on `feat/auth-2`: `createFeature(slug='auth-bypass')` → `auth-bypass-e7f201.yaml` +- Alice on `feat/auth-1`: `createFeature(slug='auth-bypass')` → `auth-bypass-c4d108e9.yaml` +- Bob on `feat/auth-2`: `createFeature(slug='auth-bypass')` → `auth-bypass-e7f201ab.yaml` - main merge → both files land cleanly (different hashes → different paths). -- `clad check --strict` → `SLUG_CONFLICT` error: *"slug 'auth-bypass' is used by both F-c4d108 and F-e7f201"*. +- `clad check --strict` → `SLUG_CONFLICT` error: *"slug 'auth-bypass' is used by both F-c4d108e9 and F-e7f201ab"*. - Human resolves: either (a) the two features are *the same intent* — archive one (`status: archived`); (b) the two features are *different intents* that picked the same name — rename one slug. The detector reports the conflict; the human decides what was meant. cladding does not silently merge or auto-rename because semantic intent is not something the tool can guess. @@ -59,7 +59,7 @@ The detector reports the conflict; the human decides what was meant. cladding do ### Scenario 3: Same contributor, same cwd, repeated call - One developer calls `createFeature(slug='login-flow')` twice in a row. -- Both files written: `login-flow-a3f9c2.yaml`, `login-flow-b7e102.yaml`. +- Both files written: `login-flow-a3f9c2e1.yaml`, `login-flow-b7e102cd.yaml`. - Same outcome as Scenario 2 — `SLUG_CONFLICT` raises it on the next `clad check --strict`. Almost always indicates a mistake; the developer archives one. ## Merging: derived files heal, never hand-resolve @@ -124,15 +124,23 @@ This table is pinned to the real repository state: if `.gitattributes` ever chan Existing features (`F-001` through `F-083` at the time v0.3.9 shipped) keep their sequential ids and their `F-NNN.yaml` filenames forever. New features use the slug + hash model. The two models coexist: - Spec loader: handles both filename layouts indiscriminately. -- `clad_get_feature`: accepts `F-049` (legacy) and `F-a3f9c2` (new) equivalently. +- `clad_get_feature`: accepts `F-049` (legacy) and `F-a3f9c2e1` (new) equivalently. - `clad_list_features`: returns both in a single list. - `ID_COLLISION` detector: catches a legacy hand-typed duplicate (`F-049` accidentally reused) just as it catches a hash collision. There is no migration tool because there is no migration need. The legacy ids are stable identifiers in audit logs and external references; rewriting them would break that trail. +## Moving the generated files into spec/generated/ (optional) + +Three files under `spec/` are written for you, never by hand: the feature index, the document-link list, and the verification signature. Newer projects can keep them together in a `spec/generated/` folder instead of loose in `spec/`. Nothing forces you to move — both arrangements are fully supported, and cladding reads whichever one your project actually has. + +If you want the tidier arrangement, run `clad relocate-generated`. On its own it only shows you the plan and changes nothing. Add `--apply` and it performs the move in a single step that can be undone if it is interrupted, then updates the merge setting in `.gitattributes` to point at the new location of the index. A second run afterwards does nothing, because there is nothing left to move. If a file somehow exists in both places, the command stops and tells you which two copies to reconcile rather than picking one for you. + +The move only rearranges files; it does not change your specification, and it does not re-run any verification. This repository itself still uses the original arrangement. + ## When to override the auto-generated id -You shouldn't. The internal `createFeature` accepts a slug only; the host LLM gives you no way to pin a specific `F-`. The hash is built from inputs (slug + user + hostname + ms + hrtime) specifically so two developers cannot collude on the same hash by accident or design — that property is what makes git merges safe by construction. +You shouldn't. The internal `createFeature` accepts a slug only; the host LLM gives you no way to pin a specific `F-`. The hash is built from inputs (slug + user + hostname + ms + hrtime) specifically so two developers cannot collude on the same hash by accident or design — that property is what makes git merges safe by construction. If you genuinely need to reuse a specific id (e.g. to restore a deleted feature with its original identifier), edit the yaml file's `id:` field directly. Schema accepts both `F-\d{3,}` and `F-[a-f0-9]{6,}`; `ID_COLLISION` will catch any duplicate. diff --git a/docs/ssot-model.md b/docs/ssot-model.md index 8d064616..bcfc4b1f 100644 --- a/docs/ssot-model.md +++ b/docs/ssot-model.md @@ -44,8 +44,8 @@ Orphan artifacts get demoted (move to Tier D as historical reference) or removed | Artifact | Producer | Consumer | Refresh trigger | |---|---|---|---| | `spec.yaml` | `clad_create_feature` / hand-edit | `spec/load.ts` → every detector + MCP server + CLI verbs | manual edit; `clad sync` validates | -| `spec/features/-.yaml` | `clad_create_feature` | merged into `Spec.features[]` on load | manual edit + validation | -| `spec/scenarios/-.yaml` | `clad init ` onboarding (NEW v0.3.45) OR `clad_create_scenario` OR hand-edit | `REFERENCE_INTEGRITY` / `SLUG_CONFLICT` / `ID_COLLISION` / `SCENARIO_COVERAGE` detectors | onboarding 7th sentinel emits; clarify refreshes; `clad_create_scenario` adds. *(`clad_create_feature` does NOT bind scenarios — corrected v0.4.x.)* | +| `spec/features/-.yaml` | `clad_create_feature` | merged into `Spec.features[]` on load | manual edit + validation | +| `spec/scenarios/-.yaml` | `clad init ` onboarding (NEW v0.3.45) OR `clad_create_scenario` OR hand-edit | `REFERENCE_INTEGRITY` / `SLUG_CONFLICT` / `ID_COLLISION` / `SCENARIO_COVERAGE` detectors | onboarding 7th sentinel emits; clarify refreshes; `clad_create_scenario` adds. *(`clad_create_feature` does NOT bind scenarios — corrected v0.4.x.)* | ### Tier B — Design SSoT @@ -66,8 +66,8 @@ Orphan artifacts get demoted (move to Tier D as historical reference) or removed | Artifact | Producer | Consumer | Refresh trigger | |---|---|---|---| -| `.cladding/events.log.jsonl` | every stage runner, checkpoint, drive loop, sentinel-miss emitter | `observability` persona + `clad doctor` + MCP resource subscriptions | append-only | -| `.cladding/audit.log.jsonl` | evidence recorders (checkpoint, postmortem, manual signoff) | anti-self-cert validator + `clad rollback` | append-only | +| `.cladding/events.log.jsonl` | every stage runner, checkpoint, sentinel-miss emitter | `observability` persona + `clad doctor` + MCP resource subscriptions | append-only | +| `.cladding/audit.log.jsonl` | evidence recorders (checkpoint, manual signoff) | anti-self-cert validator + `clad rollback` | append-only | | `.cladding/onboarding/state.yaml` | `clad init ` + `clad clarify` | `orchestrator` (drives Q&A loop) + `clad clarify` itself | mutated on each clarify; persists post-`status: done` as audit | | `.cladding/scan/*.proposal` | `writeArtifact` divert when target file already exists | humans review + manually accept/reject | one-shot per scan run | @@ -134,7 +134,7 @@ For YAML files, use `# ` comments. For JSON/TOML, the convention defers to the f | `spec.yaml` | `# Cladding · Tier A · SSoT — Iron Law sealed · Refreshed by: clad_create_feature / manual` | | `spec/architecture.yaml` | `# Cladding · Tier B · SSoT — editable, cross-validated · Refreshed by: clad init / clad clarify` | | `spec/capabilities.yaml` | `# Cladding · Tier B · SSoT — editable, cross-validated · Refreshed by: clad init / clad clarify` | -| `spec/scenarios/-.yaml` | `# Cladding · Tier A · SSoT — onboarding output, edit-friendly · Refreshed by: clad init / clad clarify` | +| `spec/scenarios/-.yaml` | `# Cladding · Tier A · SSoT — onboarding output, edit-friendly · Refreshed by: clad init / clad clarify` | | `docs/project-context.md` | `` | | `docs/conventions.md` | `` | | `.cladding/onboarding/state.yaml` | `# Cladding · Tier D · transient — Q&A audit · Refreshed by: clad init / clad clarify` | @@ -214,7 +214,7 @@ Conflict resolution (when same information lives in multiple tiers): | `clad init ` (onboarding) | + project-context.md (LLM-refined), capabilities.yaml (LLM-inferred), architecture.yaml (LLM-inferred), spec.yaml F-001 title, **scenarios stubs (NEW v0.3.45)**, onboarding state.yaml | existing files divert to `.cladding/scan/*.proposal` | | `clad init --scan` (existing-project) | conventions.md (observed), architecture.yaml (observed), capabilities.yaml (README headings), project-context.md (LLM-refined) | existing files divert to proposal | | `clad clarify ` | project-context.md, capabilities.yaml, architecture.yaml, scenarios stubs (refined Q-A history) | untouched generated design updates in place; user-edited design diverts to proposal and remains `needs_review` until explicitly accepted | -| `clad_create_feature` MCP tool | spec/features/-.yaml + durable design-impact decision; additive capability/scenario links | structural impact remains review-required and blocks `clad done` | +| `clad_create_feature` MCP tool | spec/features/-.yaml + durable design-impact decision; additive capability/scenario links | structural impact remains review-required and blocks `clad done` | | append-only (Tier D) | events.log, audit.log entries | no divert — strict append | ## Quick decision flowchart for adding a new artifact diff --git a/docs/ux-routing-coverage.md b/docs/ux-routing-coverage.md index 36df28ee..975dda8a 100644 --- a/docs/ux-routing-coverage.md +++ b/docs/ux-routing-coverage.md @@ -14,10 +14,10 @@ upstream_ssot: https://github.com/qwerfunch/harness-boot/blob/main/ironclad-desi | # | Prescription | Status | Where (cladding) | Notes | |---|---|---|---|---| | P-01 | Iron Core (internal strict IDs / commands) vs Soft Shell (external business language) boundary | partial | `src/ui/softShell.ts` (formatter), `src/router/intent.ts:3` (boundary comment) | The split now exists as a code layer, not just an aspiration. | -| P-02 | Ban on user-facing `F-NNN` / `AC-N` | partial | `src/ui/panel.ts` default view (`renderPanel(spec)` hides ids), `src/cli/clad.ts run` default (`haltMessage` instead of JSON) | `--internal` / `--json` flags surface the raw view; agents/*.md carry the "user-facing language" guideline. Audit log keeps raw ids. | -| P-03 | 3-path intent (Contextual Inquiry · Implementation Loop · Strategic Orchestration) | not yet | `src/router/intent.ts` maps to 4 verbs (init/run/sync/check), not 3 paths | Requires a mode state machine; queued for v0.2.0+. | +| P-02 | Ban on user-facing `F-NNN` / `AC-N` | partial | `src/ui/panel.ts` default view (`renderPanel(spec)` hides ids), `src/ui/softShell.ts` plain-language leads | `--internal` / `--json` flags surface the raw view; agents/*.md carry the "user-facing language" guideline. Audit log keeps raw ids. The headless loop's own default sentence retired with it in 0.10.0. | +| P-03 | 3-path intent (Contextual Inquiry · Implementation Loop · Strategic Orchestration) | not yet | `src/router/intent.ts` resolves four intents, not three paths | Requires a mode state machine; queued for v0.2.0+. One of those four intents is named `run`, a frozen classification id kept as telemetry vocabulary after the same-named verb retired in 0.10.0; the hook renders it to the user as "feature work". | | P-04 | JIT reverse sync (only at intentional breakpoints) | not yet | — | Requires a watcher and a confirmation gate; v0.2.0+. | -| P-05 | Natural-language choice-based remediation | partial | `src/ui/softShell.ts` `haltMessage` returns a sentence; user can read and decide | Full choice menus (e.g. "sync code to spec / replan to match code / approve as intentional") land with the L4 remediation flow in v0.2.0+. | +| P-05 | Natural-language choice-based remediation | partial | `src/ui/softShell.ts` `driftNudge` / `stopBlockMessage` return a sentence; user can read and decide | The loop-era halt sentence retired in 0.10.0; what remains is the gate's own plain-language nudge. Full choice menus (e.g. "sync code to spec / replan to match code / approve as intentional") land with the L4 remediation flow in v0.2.0+. | | P-06 | Soft Shell choice → Iron Core command deterministic mapping | partial | `src/router/intent.ts` (NL → verb) is deterministic; choice-based mapping pending P-05 | — | | P-07 | Pulse UI silent-success status bar | partial | `src/ui/pulse.ts` exists, line-by-line emission | The animated single-line `[●○○] Analyzing...` form is queued; current shape is functional but not yet that compact dynamic bar. | | P-08 | Manual mode → Supervised routing demotion | not yet | — | Manual/Auto mode itself does not exist yet. v0.2.0+. | @@ -30,7 +30,7 @@ upstream_ssot: https://github.com/qwerfunch/harness-boot/blob/main/ironclad-desi ## What unblocks the remaining items -- **P-03 · P-08 · P-09 · P-10** all depend on cladding gaining an explicit Manual vs Autonomous mode state machine. Once `clad run` (which absorbed the removed `work` verb in 0.6.0) enters Manual mode, drift-check cadence tightens (P-09), file writes pass a confirmation gate (P-10), and the agent's routing posture demotes from proactive to approval-waiting (P-08). The 3-path intent model (P-03) then layers on top, distinguishing inquiry from execution. +- **P-03 · P-08 · P-09 · P-10** all depend on cladding gaining an explicit Manual vs Autonomous mode state machine. Once an explicit execution mode is entered, drift-check cadence tightens (P-09), file writes pass a confirmation gate (P-10), and the agent's routing posture demotes from proactive to approval-waiting (P-08). The 3-path intent model (P-03) then layers on top, distinguishing inquiry from execution. - **P-04** (JIT reverse sync) requires a side watcher that surfaces spec/code drift only at task boundaries — different from the always-on drift detectors which run inside the Iron Law gates. The implementation is small but the trigger heuristics deserve a dedicated patch. - **P-05** (choice-based remediation) becomes meaningful once a gate failure is paired with one or more candidate remedy commands. The shapes (`sync --reverse` / `replan` / `heal --refs` / `prune --spec`) already exist as Iron Core verbs; what's missing is the user-facing decision menu. - **P-07** Pulse UI animated bar — a small UI polish using `process.stdout.write` carriage returns. Worth bundling with the next user-visible patch. diff --git a/package-lock.json b/package-lock.json index 9d727103..3b2b6822 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cladding", - "version": "0.9.4", + "version": "0.10.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cladding", - "version": "0.9.4", + "version": "0.10.0", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.96.0", @@ -17,6 +17,7 @@ "clad": "bin/clad" }, "devDependencies": { + "@babel/parser": "^7.29.3", "@secretlint/secretlint-rule-preset-recommend": "^13.0.2", "@types/node": "^22.0.0", "@typescript-eslint/eslint-plugin": "^8.0.0", @@ -1000,19 +1001,36 @@ } }, "node_modules/@oxc-project/types": { - "version": "0.143.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.143.0.tgz", - "integrity": "sha512-u6JZdLBTLotrNC9Vd6vPssINdzcCzleKAH6EJKImQb7GtYvX5keN2dxkoK44stCc4tffE6QQRtZTXVSzsLUlWA==", + "version": "0.148.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.148.0.tgz", + "integrity": "sha512-Nm4s/jB+4FpFsPhWGEC4h7rzksesmtnMXomo6rCMcg/b8zLQuOziRgkCS1fxDCXOlJB/6Q8oABOZ/OP6RIPj9A==", "dev": true, "license": "MIT", "funding": { - "url": "https://github.com/sponsors/Boshen" + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.7.tgz", + "integrity": "sha512-EypzgnYCwyVY4NDHKzGmNJT5b+XaQEBniHxsMdeIQLB/tcCzZnhqrzHpZFbX9iaxx+5RiB8caATBtfvZP7zVxQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, "node_modules/@rolldown/binding-android-arm64": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.3.tgz", - "integrity": "sha512-zrJtHDcaZJ1Fp7xf4hNl+7seH9Cn/N5TwLYkhgXREtBwAd/jaqW3uqeHxpDugJLVICWg4eW44kOQEGJ1r6jCGw==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.7.tgz", + "integrity": "sha512-l17HE9EweWaqJZhuUuNBN/FzM62xw+DECVnJyvMsxn8vJFAGLy5QfLDoYAcronkAN8VxKZHezDpulHDPx95vFw==", "cpu": [ "arm64" ], @@ -1027,9 +1045,9 @@ } }, "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.3.tgz", - "integrity": "sha512-ieIiibVCp0tX7TLu2cafoNPv8wJyYi01ekXpbf8q2j7F4rGAhhXb/eQh7ge9DRBY78GwmRQtvjZDux7EDbA8kA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.7.tgz", + "integrity": "sha512-8ED8ELFvHXc6OCETIn4gXObPiaR6bckM/ipXtbzlPVDRMBfEGjCKgO90F9YtfdpDatVx/ZQw7aZ1vUMf/+T3Mw==", "cpu": [ "arm64" ], @@ -1044,9 +1062,9 @@ } }, "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.3.tgz", - "integrity": "sha512-Zh9tCon19eDXJoihx0rqKhMUlMYqzwj3aPsSuHmI4RWZh62dWUL+DJN4C5YQya5TcQBJU/Fe8+rY0jhXTQITqA==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.7.tgz", + "integrity": "sha512-/WPripjtiAIZ2tWY7ddijORT0Ujg87wxWW/qcoFVCKAWVDPhtY0xr7Dj0M3GyNGz60jGwTElhro/mkF9dT7dDQ==", "cpu": [ "x64" ], @@ -1061,9 +1079,9 @@ } }, "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.3.tgz", - "integrity": "sha512-nGbJWewA1wrXXZiQhjAT5rhibGfns5ZNkDVqxsO6zJ3f3YvpoDNNmGMSbbhLuXKjNScaBJVOAboztAWVespQMg==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.7.tgz", + "integrity": "sha512-14DI4NcqpvbICxSnGLx3PmtDaWqRP/KGSGb6C+JLLVPeZRl6dKdHba3pGsqT3vpdTqhEYIPG0MMQ8c0xYqoJxA==", "cpu": [ "x64" ], @@ -1078,9 +1096,9 @@ } }, "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.3.tgz", - "integrity": "sha512-QNniJr5Kml0kDEB98jiDOJjXNroxIIi0IXIbdYzY26Xt1pVbeP62+KnoIZLwirOymX/0jDk/2gI/bNUv7A7OIw==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.7.tgz", + "integrity": "sha512-bxrWIRvHWQvbJwi+VIie/kDJmQxcNE6xxWwZdqF/ExVAigtHkv54WTLQPb+QsZdnFy18fg7JPfWGL0RH6vwIlQ==", "cpu": [ "arm" ], @@ -1095,9 +1113,9 @@ } }, "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.3.tgz", - "integrity": "sha512-TkqEAcmmvH3I/q4114NB4RVt6241Dao48pF45uLcFGrwAaIn0iITgTAKP/dLjbN0R4buJjGb91+UHSoFmpgIWw==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.7.tgz", + "integrity": "sha512-toOY2BChBZyuxU7OYX6Tn389di4IzAqPTycVcci0O7FSfBqzRB3RZn+K5Is6ANf4tmgRd/K1yZTsNTXbkXsnLg==", "cpu": [ "arm64" ], @@ -1115,9 +1133,9 @@ } }, "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.3.tgz", - "integrity": "sha512-NHqjnxpsndf4MPymxteFAWHHfkTL8HjWh1KB7z23ofZ6QO2euONuxDXjat69dKZRALnGypg8k8SsK8vZJoXv1Q==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.7.tgz", + "integrity": "sha512-lAIXTH/aiLRLxsTgQvfhjo4K1ydWIp00+V0voOr9beb/9ZmkUFrSIb03dXNFRgMNvkE6oGsF10ioQ6UsI+vS5Q==", "cpu": [ "arm64" ], @@ -1135,9 +1153,9 @@ } }, "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.3.tgz", - "integrity": "sha512-6tbrbwfz5GB9DQ4Jwo6hy9v+vR31xZlvzZ6n5Xut6Hhx5PvrA9q/HsK8KMaYQp063iqZGXwNvZtYNLD7EM/x0w==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.7.tgz", + "integrity": "sha512-kdnwS28Pkenp/mZMRwjXXXwxQ7pIsm+bF919LUK93BOyhcLsrVKdP2p9fxpiPNPAbNuch8ypQt0pm2P2LYCAGg==", "cpu": [ "ppc64" ], @@ -1155,9 +1173,9 @@ } }, "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.3.tgz", - "integrity": "sha512-oyuXxXmoZHjXC917IAPFAAv4wWAa0cM9afk8nx1+9/jNNOX1uPf8yDA6p7G0RypOfw/X0PQt5IfoquY1um+zSg==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.7.tgz", + "integrity": "sha512-516OdsyLdr5E65paF3yBF55t8mfm9+gmtCsK3xI7XKXIT7EfRlHhxL8K/NR6Hu8BWSgF5+1w74lTL0+nxcc8Qw==", "cpu": [ "s390x" ], @@ -1175,9 +1193,9 @@ } }, "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.3.tgz", - "integrity": "sha512-TytMwF2KVGqP2tgd0I1OY0PAv78dZRAYcF5ssDzjM34SUXCED3uXvSd5+lHoC0bTD6eEdFz7LdQNCO1y0oVk9w==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.7.tgz", + "integrity": "sha512-r8/z8n7GFaYRln3xmP1Cxy0HH/HLM0uBUPkEuSVEfKGDA89M0FsZRZJRSwe/tJjRx+fpH/gjorfhB8tmEbSFLA==", "cpu": [ "x64" ], @@ -1195,9 +1213,9 @@ } }, "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.3.tgz", - "integrity": "sha512-/E9m3qstrJFVPoULV25mVQblSNExY2+kBsYe4sy0Tn0yOOgJ8wZbZt3KnRbF/XeU2Gl1STKUQnDNTqhIE5MD4A==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.7.tgz", + "integrity": "sha512-pAsE8iiDxUg1xBqdhrTfg45AVDVpirjz00sblEYClGNNcMnDb+e8beQgqIAw6LvauX/APvgxUnwrgun/YYGBhw==", "cpu": [ "x64" ], @@ -1215,9 +1233,9 @@ } }, "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.3.tgz", - "integrity": "sha512-Kr0OcsoQI816i6HOl3vFHpd1K0eZyh76zgfj4c1nTyaTsd5r2Mj1lwM4R90y/qaCfmTn9eHy0SKwi98eitRxug==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.7.tgz", + "integrity": "sha512-lTcIYmmnQQA8Or/2DatS6oSqcdLHvendjS+zLu+FwgToynWMRSmQdpM65fTANJgIS4mjbMOo5KT2lnT9SAb96w==", "cpu": [ "arm64" ], @@ -1232,9 +1250,9 @@ } }, "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.3.tgz", - "integrity": "sha512-hOtMwTqnME+/gJcH/PCZ0wn0zPUjiWOgkHpxbSJpfGKMezHltx1S7/k1SitzVa7Ww2cqrDDaFbZEhcJZO8o+Jw==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.7.tgz", + "integrity": "sha512-e3Gu3WxbNk/UqQhxqU7YIYO+9ZBvWNz3U+h/qRFosscMFzdRPbXYSaSWgSnklv2fz1TgzBTcti2z35c/7irsHw==", "cpu": [ "arm64" ], @@ -1249,9 +1267,9 @@ } }, "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.3.tgz", - "integrity": "sha512-ekcqMMkI2PlhYnfzQnB/cEdYUVVJViWvoUyLrbzgDoi3Snfc1mVBwdnc306ufA5ejy8JSPjT2RlW1nQSjW7efg==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.7.tgz", + "integrity": "sha512-W/jg5qoRSqjsEv0+dZi4e687mcHqmVuU0P4fK6qS/xjetW2Gmc1W8j//z5nAeNcC8Ttm0hV46IjcYeuVwYhuiw==", "cpu": [ "x64" ], @@ -1927,14 +1945,14 @@ } }, "node_modules/@vitest/coverage-v8": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.1.6.tgz", - "integrity": "sha512-36l628fQ/9a/8ihy97eOtEnvWQEdqULQOJtcaxtoNq0G1w3Mxd4szSahOaMM9/NGyZ+hyKcMtIW/WIxq0XQViQ==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-4.1.11.tgz", + "integrity": "sha512-8MVGEFnJIcdGjcbfKmeq8z0pZHH0JlVtoVZH9Q/qwUp6wyFnEJUBMrw9DCaj+ra3vShGmhavjalMIhPNxZAUcw==", "dev": true, "license": "MIT", "dependencies": { "@bcoe/v8-coverage": "^1.0.2", - "@vitest/utils": "4.1.6", + "@vitest/utils": "4.1.11", "ast-v8-to-istanbul": "^1.0.0", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", @@ -1948,8 +1966,8 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "@vitest/browser": "4.1.6", - "vitest": "4.1.6" + "@vitest/browser": "4.1.11", + "vitest": "4.1.11" }, "peerDependenciesMeta": { "@vitest/browser": { @@ -1958,16 +1976,16 @@ } }, "node_modules/@vitest/expect": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.6.tgz", - "integrity": "sha512-7EHDquPthALSV0jhhjgEW8FXaviMx7rSqu8W6oqCoAuOhKov814P99QDV1pxMA3QPv21YudvJngIhjrNI4opLg==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.11.tgz", + "integrity": "sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==", "dev": true, "license": "MIT", "dependencies": { "@standard-schema/spec": "^1.1.0", "@types/chai": "^5.2.2", - "@vitest/spy": "4.1.6", - "@vitest/utils": "4.1.6", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", "chai": "^6.2.2", "tinyrainbow": "^3.1.0" }, @@ -1976,13 +1994,13 @@ } }, "node_modules/@vitest/mocker": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.6.tgz", - "integrity": "sha512-MCFc63czMjEInOlcY2cpQCvCN+KgbAn+60xu9cMgP4sKaLC5JNAKw7JH8QdAnoAC88hW1IiSNZ+GgVXlN1UcMQ==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.11.tgz", + "integrity": "sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "4.1.6", + "@vitest/spy": "4.1.11", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, @@ -2013,9 +2031,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.6.tgz", - "integrity": "sha512-h5SxD/IzNhZYnrSZRsUZQIC+vD0GY8cUvq0iwsmkFKixRCKLLWqCXa/FIQ4S1R+sI+PGoojkHsdNrbZiM9Qpgw==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.11.tgz", + "integrity": "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==", "dev": true, "license": "MIT", "dependencies": { @@ -2026,13 +2044,13 @@ } }, "node_modules/@vitest/runner": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.6.tgz", - "integrity": "sha512-nOPCmn2+yD0ZNmKdsXGv/UxMMWbMuKeD6GyYncNwdkYDxpQvrPSKYj2rWuDjC2Y4b6w6hjip5dBKFzEUuZe3vA==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.11.tgz", + "integrity": "sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "4.1.6", + "@vitest/utils": "4.1.11", "pathe": "^2.0.3" }, "funding": { @@ -2040,14 +2058,14 @@ } }, "node_modules/@vitest/snapshot": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.6.tgz", - "integrity": "sha512-YhsdE6xAVfTDmzjxL2ZDUvjj+ZsgyOKe+TdQzqkD72wIOmHka8NuGQ6NpTNZv9D2Z63fbwWKJPeVpEw4EQgYxw==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.11.tgz", + "integrity": "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.1.6", - "@vitest/utils": "4.1.6", + "@vitest/pretty-format": "4.1.11", + "@vitest/utils": "4.1.11", "magic-string": "^0.30.21", "pathe": "^2.0.3" }, @@ -2056,9 +2074,9 @@ } }, "node_modules/@vitest/spy": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.6.tgz", - "integrity": "sha512-JFKxMx6udhwKh/Ldo270e17QX710vgunMkuPAvXjHSvC6oqLWAHhVhjg/I71q0u0CBSErIODV1Kjv0FQNSWjdg==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.11.tgz", + "integrity": "sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==", "dev": true, "license": "MIT", "funding": { @@ -2066,13 +2084,13 @@ } }, "node_modules/@vitest/utils": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.6.tgz", - "integrity": "sha512-FxIY+U81R3LGKCxaHHFRQ5+g6/iRgGLmeHWdp2Amj4ljQRrEIWHmZyDfDYBRZlpyqA7qKxtS9DD1dhk8RnRIVQ==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.11.tgz", + "integrity": "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.1.6", + "@vitest/pretty-format": "4.1.11", "convert-source-map": "^2.0.0", "tinyrainbow": "^3.1.0" }, @@ -3058,16 +3076,16 @@ } }, "node_modules/es-module-lexer": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.1.0.tgz", - "integrity": "sha512-n27zTYMjYu1aj4MjCWzSP7G9r75utsaoc8m61weK+W8JMBGGQybd43GstCXZ3WNmSFtGT9wi59qQTW6mhTR5LQ==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", "dev": true, "license": "MIT" }, "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0" @@ -3483,9 +3501,9 @@ } }, "node_modules/expect-type": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", - "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -3580,9 +3598,9 @@ "license": "Unlicense" }, "node_modules/fast-uri": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz", - "integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.7.tgz", + "integrity": "sha512-dOvZVzjdZdz7phd9v6jCbwxrBW3fK6n8Rc0CtdmM4bumzMnxywBYhuph6J819RRw/ku+rLbelwfMunktuzVVHg==", "funding": [ { "type": "github", @@ -3950,9 +3968,9 @@ } }, "node_modules/hono": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.1.tgz", - "integrity": "sha512-kdJoFVv2xmayw6cY09H7AbMJMt8Jn5jdlEdXsP7AGBdF2DIptVlKlOLKXP41yPip4/a3yQPv9gVcJYI8YY04dw==", + "version": "4.13.7", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.13.7.tgz", + "integrity": "sha512-c8/gF9ac8Y78/agExVocyLevgR+JlpNB444Py0FSX8pJoPdYUfUzRcXtYEYGwt6l19qIlVZPN5Mfsw9jFShmQQ==", "license": "MIT", "engines": { "node": ">=16.9.0" @@ -4343,9 +4361,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", - "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", "dev": true, "funding": [ { @@ -5171,15 +5189,18 @@ } }, "node_modules/obug": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", - "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", "dev": true, "funding": [ "https://github.com/sponsors/sxzz", "https://opencollective.com/debug" ], - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } }, "node_modules/on-finished": { "version": "2.4.1", @@ -5626,12 +5647,13 @@ } }, "node_modules/qs": { - "version": "6.15.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz", - "integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==", + "version": "6.16.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.16.0.tgz", + "integrity": "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA==", "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.1.0" + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" }, "engines": { "node": ">=0.6" @@ -5859,13 +5881,13 @@ "license": "ISC" }, "node_modules/rolldown": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.3.tgz", - "integrity": "sha512-rn9wpmxplLf7NLNyCk9FyWh3FM43DbY8jOzCdEPzH7uflhTftRbCEpqi6Ly2osgoU8OwObtmavMbWLaWy4LX7A==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.7.tgz", + "integrity": "sha512-g0EtLvBjTUB7jhyV0S/TCup3v/XSVl45vUIGbOGU4QPiyjTenCe4mKuFvW9fEgYmS2Fo42AUssRmNuMziXdrig==", "dev": true, "license": "MIT", "dependencies": { - "@oxc-project/types": "=0.143.0", + "@oxc-project/types": "=0.148.0", "@rolldown/pluginutils": "^1.0.0" }, "bin": { @@ -5875,20 +5897,21 @@ "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@rolldown/binding-android-arm64": "1.2.3", - "@rolldown/binding-darwin-arm64": "1.2.3", - "@rolldown/binding-darwin-x64": "1.2.3", - "@rolldown/binding-freebsd-x64": "1.2.3", - "@rolldown/binding-linux-arm-gnueabihf": "1.2.3", - "@rolldown/binding-linux-arm64-gnu": "1.2.3", - "@rolldown/binding-linux-arm64-musl": "1.2.3", - "@rolldown/binding-linux-ppc64-gnu": "1.2.3", - "@rolldown/binding-linux-s390x-gnu": "1.2.3", - "@rolldown/binding-linux-x64-gnu": "1.2.3", - "@rolldown/binding-linux-x64-musl": "1.2.3", - "@rolldown/binding-openharmony-arm64": "1.2.3", - "@rolldown/binding-win32-arm64-msvc": "1.2.3", - "@rolldown/binding-win32-x64-msvc": "1.2.3" + "@rolldown/binding-android-arm-eabi": "1.2.7", + "@rolldown/binding-android-arm64": "1.2.7", + "@rolldown/binding-darwin-arm64": "1.2.7", + "@rolldown/binding-darwin-x64": "1.2.7", + "@rolldown/binding-freebsd-x64": "1.2.7", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.7", + "@rolldown/binding-linux-arm64-gnu": "1.2.7", + "@rolldown/binding-linux-arm64-musl": "1.2.7", + "@rolldown/binding-linux-ppc64-gnu": "1.2.7", + "@rolldown/binding-linux-s390x-gnu": "1.2.7", + "@rolldown/binding-linux-x64-gnu": "1.2.7", + "@rolldown/binding-linux-x64-musl": "1.2.7", + "@rolldown/binding-openharmony-arm64": "1.2.7", + "@rolldown/binding-win32-arm64-msvc": "1.2.7", + "@rolldown/binding-win32-x64-msvc": "1.2.7" } }, "node_modules/router": { @@ -6070,14 +6093,14 @@ } }, "node_modules/side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", "license": "MIT", "dependencies": { "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" }, @@ -6275,9 +6298,9 @@ } }, "node_modules/std-env": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.1.0.tgz", - "integrity": "sha512-Rq7ybcX2RuC55r9oaPVEW7/xu3tj8u4GeBYHBWCychFtzMIr86A7e3PPEBPT37sHStKX3+TiX/Fr/ACmJLVlLQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz", + "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==", "dev": true, "license": "MIT" }, @@ -6633,9 +6656,9 @@ "license": "MIT" }, "node_modules/tinyexec": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.1.2.tgz", - "integrity": "sha512-dAqSqE/RabpBKI8+h26GfLq6Vb3JVXs30XYQjdMjaj/c2tS8IYYMbIzP599KtRj7c57/wYApb3QjgRgXmrCukA==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", "dev": true, "license": "MIT", "engines": { @@ -6660,9 +6683,9 @@ } }, "node_modules/tinyrainbow": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz", - "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.1.tgz", + "integrity": "sha512-yau8yJdTt989Mm0Bd/236QnzEiPf2xLLTqUZRUJOo/3CB078LSwzei343DgtJVmfJKJE3TMINY1u42SQsP6mXw==", "dev": true, "license": "MIT", "engines": { @@ -6935,16 +6958,16 @@ } }, "node_modules/vite": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.1.tgz", - "integrity": "sha512-EU/eS7BH3XROHh2YnBefjM6DBKA6ZeMZEYQbj7NLWg5wHYlhB8B/Mayd5XsgWq+NFYccDOTemRpdETWR6Ka/lw==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.2.2.tgz", + "integrity": "sha512-cFKLV/PRgAUlIRm5WjMjJ86jrftzpqcgH+Us+DS8mI3CDNiH30Whrz8uHL3+MOLPAgqbMBAqWdAHAphOAM+z/Q==", "dev": true, "license": "MIT", "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.5", - "postcss": "^8.5.25", - "rolldown": "~1.2.1", + "postcss": "^8.5.26", + "rolldown": "~1.2.4", "tinyglobby": "^0.2.17" }, "bin": { @@ -6961,7 +6984,7 @@ }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", - "@vitejs/devtools": "^0.4.0", + "@vitejs/devtools": "^0.4.0 || ^0.5.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", @@ -7013,19 +7036,19 @@ } }, "node_modules/vitest": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.6.tgz", - "integrity": "sha512-6lvjbS3p9b4CrdCmguzbh2/4uoXhGE2q71R4OX5sqF9R1bo9Xd6fGrMAfvp5wnCzlBnFVdCOp6onuTQVbo8iUQ==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.11.tgz", + "integrity": "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/expect": "4.1.6", - "@vitest/mocker": "4.1.6", - "@vitest/pretty-format": "4.1.6", - "@vitest/runner": "4.1.6", - "@vitest/snapshot": "4.1.6", - "@vitest/spy": "4.1.6", - "@vitest/utils": "4.1.6", + "@vitest/expect": "4.1.11", + "@vitest/mocker": "4.1.11", + "@vitest/pretty-format": "4.1.11", + "@vitest/runner": "4.1.11", + "@vitest/snapshot": "4.1.11", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", "es-module-lexer": "^2.0.0", "expect-type": "^1.3.0", "magic-string": "^0.30.21", @@ -7053,12 +7076,12 @@ "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "4.1.6", - "@vitest/browser-preview": "4.1.6", - "@vitest/browser-webdriverio": "4.1.6", - "@vitest/coverage-istanbul": "4.1.6", - "@vitest/coverage-v8": "4.1.6", - "@vitest/ui": "4.1.6", + "@vitest/browser-playwright": "4.1.11", + "@vitest/browser-preview": "4.1.11", + "@vitest/browser-webdriverio": "4.1.11", + "@vitest/coverage-istanbul": "4.1.11", + "@vitest/coverage-v8": "4.1.11", + "@vitest/ui": "4.1.11", "happy-dom": "*", "jsdom": "*", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" diff --git a/package.json b/package.json index de91477a..43974b84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.4", + "version": "0.10.0", "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", @@ -54,6 +54,8 @@ "stage:audit": "tsx src/stages/audit.ts", "stage:uat": "tsx src/stages/uat.ts", "spec:validate": "tsx src/spec/cli.ts", + "validate:spec-0.2": "tsx scripts/spec-0.2-validate.ts", + "validate:spec-0.2:release": "tsx scripts/spec-0.2-validate.ts --release", "conformance": "tsx conformance/runner.ts", "benchmark": "tsx src/cli/benchmark.ts", "clad": "node bin/clad", @@ -69,6 +71,7 @@ "prepublishOnly": "npm run build" }, "devDependencies": { + "@babel/parser": "^7.29.3", "@secretlint/secretlint-rule-preset-recommend": "^13.0.2", "@types/node": "^22.0.0", "@typescript-eslint/eslint-plugin": "^8.0.0", diff --git a/plugins/antigravity/skills/checkpoint/SKILL.md b/plugins/antigravity/skills/checkpoint/SKILL.md index fd5cec9c..be3cdd11 100644 --- a/plugins/antigravity/skills/checkpoint/SKILL.md +++ b/plugins/antigravity/skills/checkpoint/SKILL.md @@ -8,21 +8,21 @@ Run `clad checkpoint ` from the project root. Iron Law backbone Phase The checkpoint event payload carries: -- `featureId` — the spec id, accepts both `F-NNN` legacy and `F-` (v0.3.9+) shapes. +- `featureId` — the spec id, accepts both `F-NNN` legacy and six-or-more-hex hash shapes; newly authored records emit `F-`. - `gitHead` — full 40-char commit sha at the time of the call (or `null` when the project is not a git repository). - `specDigest` — sha-256 over the merged spec for replay verification. - `timestamp` — ISO 8601. ``` clad checkpoint F-001 -clad checkpoint F-a3f9c2 +clad checkpoint F-a3f9c2e1 ``` The output is a single Pulse line: `✓ checkpoint · head= digest=`. The event lands in `.cladding/events.log.jsonl` as `type: "feature_checkpoint"` and can be inspected with `clad doctor --json` or `clad_get_events` over MCP. ## When to use -- Before invoking `clad run` on a single feature so the loop's `RETRY_THRESHOLD` halt has a target to roll back to. +- Before starting a feature with your AI host so a failed attempt has a known-good target to roll back to. - Before a manual refactor large enough that `git stash` is unwieldy. - Right after `clad sync` reports the spec is valid, so the checkpoint pins exactly the validated spec digest the implementation will start from. diff --git a/plugins/antigravity/skills/developer/SKILL.md b/plugins/antigravity/skills/developer/SKILL.md index 97e3a870..32ab7053 100644 --- a/plugins/antigravity/skills/developer/SKILL.md +++ b/plugins/antigravity/skills/developer/SKILL.md @@ -36,8 +36,8 @@ You do NOT read Tier D (audit — observability's concern). Follow `docs/conventions.md` — `clad init` always writes it. The auto-generated header at the top of the file tells you which mode is active: -- **Greenfield seed**: toolchain-default 14-signal table (per-language defaults) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. -- **Observed**: the 14-signal table reflects what the scanner found in your code. Follow it verbatim. +- **Greenfield seed**: toolchain-default conventions table (per-language defaults) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. +- **Observed**: the conventions table reflects what the scanner found in your code. Follow it verbatim. One cladding-specific addition on top of either mode: @@ -82,4 +82,4 @@ Advisory (no detector enforces it) — but after your edits the hook auto-surfac ## User-facing language (Soft Shell) -Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for v0.3.9+ features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for current generated features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/antigravity/skills/doctor/SKILL.md b/plugins/antigravity/skills/doctor/SKILL.md index 5425d651..34975c99 100644 --- a/plugins/antigravity/skills/doctor/SKILL.md +++ b/plugins/antigravity/skills/doctor/SKILL.md @@ -31,7 +31,7 @@ The text surface prints: - After `clad init --scan` to confirm the scan refinement ran with full LLM coverage (no `sentinel_miss` events). - After installing or updating the Claude Code plugin to confirm a new session actually fired the shipped hooks and loaded the current engine. -- After `clad run` to confirm the autonomous loop received refined replies from the configured host. +- After a `clad serve` session to confirm the host returned refined replies through the configured dispatcher. - Periodically in CI to track miss rate across sampling-policy changes. - Before reporting "the LLM seems off" to a host (Claude Code / Cursor / Continue) — the breakdown tells you whether the issue is dispatcher transport (`cause: dispatcher_error`) or model output quality (`cause: blank_section`). diff --git a/plugins/antigravity/skills/observability/SKILL.md b/plugins/antigravity/skills/observability/SKILL.md index 0b317e03..81c90d67 100644 --- a/plugins/antigravity/skills/observability/SKILL.md +++ b/plugins/antigravity/skills/observability/SKILL.md @@ -47,4 +47,4 @@ When summarising or labelling reports, also read `spec.yaml::project.ai_hints`: ## User-facing language (Soft Shell) -The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/antigravity/skills/orchestrator/SKILL.md b/plugins/antigravity/skills/orchestrator/SKILL.md index ad4940fa..80ba02a9 100644 --- a/plugins/antigravity/skills/orchestrator/SKILL.md +++ b/plugins/antigravity/skills/orchestrator/SKILL.md @@ -70,4 +70,4 @@ Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad ## User-facing language (Soft Shell) -Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — attestation = sign-off, finding = what drifted and why; never lead with ids. +Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2e1`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — attestation = sign-off, finding = what drifted and why; never lead with ids. diff --git a/plugins/antigravity/skills/planner/SKILL.md b/plugins/antigravity/skills/planner/SKILL.md index f3cacac9..d2085ab4 100644 --- a/plugins/antigravity/skills/planner/SKILL.md +++ b/plugins/antigravity/skills/planner/SKILL.md @@ -7,40 +7,41 @@ capabilities: [read, write, edit, exec] # Planner -The **Planner** is a selectable role brief (formerly `librarian`) — a scope plus outcome conditions and evidence obligations the host may embody with any agent shape, not an agent cladding mandates spawning. It owns the Tier A spec SSoT — `spec.yaml` + per-feature spec files in `spec/features/` + `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier model. +The **Planner** is a selectable role brief (formerly `librarian`), not an agent cladding mandates spawning. It owns the Tier A spec SSoT — `spec.yaml`, `spec/features/`, and `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full model. ## Sources (what you read, by Tier) | Tier | Artifacts | Why you read it | |---|---|---| -| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | +| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | | **B** | `spec/architecture.yaml`, `spec/capabilities.yaml`, `docs/project-context.md` | cross-validate when editing A; e.g., new `features[]` binding in capabilities.yaml ↔ feature you just added | You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — observability owns it). ## What you do -- Add new features with hash-based id `F-` (v0.3.9+): filename `-.yaml`, `id: F-`, `slug: `. Legacy `F-NNN` files stay sequential — never migrate. -- Author EARS-compliant ACs (`AC-N`); every feature ships at least one. -- For **load-bearing** decisions (non-obvious ordering, invariant, trade-off a future editor could undo), record WHY in that AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. +- Add `F-` features as `-.yaml`. Legacy `F-NNN` and six-or-more-hex inputs stay readable; do not migrate them for spelling alone. +- Author EARS-compliant `AC-` records; legacy sequential and six-or-more-hex ids remain readable. Every feature needs one. +- For a load-bearing decision, record WHY in the AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. - Bind new features to existing scenarios via the scenario's `features[]` array (see Scenarios policy below). - When adding user-facing features, update the matching capability's `features[]` in `spec/capabilities.yaml` so `CAPABILITIES_FEATURE_MAPPING` stays clean. - Mark features as `archived` (with `archived_at` + `archive_reason`). - Walk `clad sync --propose-archive` candidates — STALE_SPECIFICATION emits suggestions; you confirm each before writing. +- Treat `clad clarify` as answer collection, not design-impact resolution. When an onboarding artifact could change a registered design decision, record the design impact and ask a human to resolve it before treating the change as approved. - Split `spec.yaml` into per-feature spec files (`spec/features/*.yaml`) when the master crosses ~1k lines. - Edit `spec/architecture.yaml` and `spec/capabilities.yaml` between scans — Tier B, edit-friendly; next scan diverts new body to `.cladding/scan/*.proposal`. - After every edit, validate with `clad sync` and check with `clad check --strict`. ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). +Scenarios are **onboarding output**, not a feature-creation side effect. Onboarding (host MCP flow or `clad init `) writes 1–3 journeys to `spec/scenarios/-.yaml` with `features: []`. Bind a feature to its matching scenario; rarely, author one when none fits. ## Project policy — `spec.yaml::project.ai_hints` When authoring a new feature or scenario, also check `spec.yaml::project.ai_hints`: -- `preferred_patterns` `{when, prefer, over?}` triples — name them in AC notes when relevant (e.g. an AC about a new detector should restate "synchronous + deterministic" if the project's `ai_hints` says so) -- `forbidden_patterns` — never copy one into example code in AC text or scenario flow descriptions (detector #27 still scans those) +- `preferred_patterns` `{when, prefer, over?}` triples — name relevant ones in AC notes +- `forbidden_patterns` — never copy one into AC examples or scenario flows - `preferred_persona` — informational; names the role that will implement what you author `ai_hints` is the project-scoped SSoT for AI behavior policy and overrides this prompt for the specific project. @@ -68,6 +69,10 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read Touching `src/stages/`, `src/hitl/`, or production code is **out of scope**. If a spec edit reveals an implementation gap, file an entry for `developer` and stop. +Design-impact resolution remains human-owned. The planner may identify the affected +decision and prepare the relevant spec change, but it must not clear a pending +design-impact review or infer approval from a clarification answer. + ## User-facing language (Soft Shell) -The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/antigravity/skills/reviewer/SKILL.md b/plugins/antigravity/skills/reviewer/SKILL.md index a953dc36..9ac9b38e 100644 --- a/plugins/antigravity/skills/reviewer/SKILL.md +++ b/plugins/antigravity/skills/reviewer/SKILL.md @@ -78,4 +78,4 @@ You also own the **advisory half no gate enforces**: confirm the test-author wro ## User-facing language (Soft Shell) -The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/antigravity/skills/rollback/SKILL.md b/plugins/antigravity/skills/rollback/SKILL.md index 80cfe7b4..aa1656f4 100644 --- a/plugins/antigravity/skills/rollback/SKILL.md +++ b/plugins/antigravity/skills/rollback/SKILL.md @@ -10,13 +10,13 @@ Run `clad rollback ` from the project root. The verb is the partner o ``` clad rollback F-001 -clad rollback F-a3f9c2 --reason "specialist dispatched a regression on the L1 lint gate" +clad rollback F-a3f9c2e1 --reason "specialist dispatched a regression on the L1 lint gate" ``` The output is a single Pulse line plus the restoration command: ``` -✓ rollback · F-a3f9c2 target head= ts= +✓ rollback · F-a3f9c2e1 target head= ts= Run: git checkout ``` @@ -30,9 +30,9 @@ When the latest checkpoint has no `gitHead` (the project is not a git repo), the ## When to use -- After an autonomous drive iteration that ended in `RETRY_THRESHOLD`, `GATE_NO_PROGRESS`, or `UNCAUGHT_ERROR`. +- After an attempt that ended with the gate stuck, failing repeatedly, or erroring out. - After a manual implementation attempt that introduced a regression you don't want to bisect. -- Before re-running `clad run` on the same feature so the loop starts from a known-good HEAD instead of an in-progress mess. +- Before retrying the same feature so the next attempt starts from a known-good HEAD instead of an in-progress mess. ## Pair with diff --git a/plugins/antigravity/skills/run/SKILL.md b/plugins/antigravity/skills/run/SKILL.md deleted file mode 100644 index 28684de2..00000000 --- a/plugins/antigravity/skills/run/SKILL.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: Run cladding's autonomous loop — iterate ready features, dispatch the developer + reviewer personas through the active host adapter, run L1 gates, halt on HUMAN_REQUIRED or transport failure. Use only when the user explicitly asks for autonomous progress; the loop will modify files. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. ---- - -# Cladding run (formerly `drive`) - -Run `clad run` from the project root. The autonomous loop: - -1. Pre-flight `adapter.healthCheck()` — fails fast on missing credentials or unreachable host. -2. For each ready feature (status `planned`, `depends_on` satisfied): - - Specialist dispatch authors the implementation. - - Apply mutations to the working tree. - - L1 gates: Type / Lint / Arch. - - Reviewer dispatch — `HUMAN_REQUIRED` halt if reviewer identity equals specialist (anti-self-cert barrier). - - UAT requires a human-pass evidence entry; missing → `HUMAN_REQUIRED` halt. -3. Halt class is one of the 13 enumerated reasons (`ALL_FEATURES_DONE`, `MAX_ITERATIONS`, `WALL_CLOCK`, `BUDGET_EXCEEDED`, `BLOCKED_FEATURE`, `RETRY_THRESHOLD`, `GATE_NO_PROGRESS`, `HUMAN_REQUIRED`, `TRANSPORT_AUTH_FAILED`, `TRANSPORT_RATE_LIMITED`, `TRANSPORT_NETWORK`, `LLM_UNAVAILABLE`, `UNCAUGHT_ERROR`). - -Budget flags: `--max-iterations`, `--max-wall-clock-ms`, `--max-retries`. `--cwd ` targets a project directory other than the current one. `--json` emits the raw Iron Core result; default is the plain Soft Shell summary. - -``` -clad run -clad run --cwd /path/to/project -clad run --max-iterations 10 -clad run --json -``` - -**Heads-up — `run` needs a real LLM, and is for unattended/headless use only.** The host AI (Claude Code, Cursor, …) drives work *naturally in-session*; `clad run` is the entry point for the **opposite** case — autonomous, no-human-in-the-loop progress (CI/cron/SDK). Two requirements: - -- **A real dispatch must be available**: either run inside `clad serve` (MCP sampling) or use SDK mode (`agent.mode = sdk` + an API key). With **neither**, the loop falls back to the **Mock transport** and produces empty module *stubs*, not real implementations — yet still reports a normal halt. Treat a standalone `clad run` with no MCP server and no SDK key as **not doing real work**; verify with `clad doctor` afterward (a deterministic/Mock run is a red flag, not success). -- `run` modifies the working tree. - -> Known gap (tracked): standalone `run` on the Mock fallback should hard-fail with `LLM_UNAVAILABLE` rather than silently stubbing. That change reconciles the adapter `healthCheck` parity contract (F-049 AC-089, which currently treats the Mock fallback as "ready") and is a deliberate follow-up, not yet shipped. - -After a run session, run `clad doctor` over the same `--cwd` to confirm the LLM dispatcher behaved — any `sentinel_miss` events surface as a health summary so you can tell whether the loop ran with full LLM refinement or fell back to deterministic per-artifact. diff --git a/plugins/antigravity/skills/status/SKILL.md b/plugins/antigravity/skills/status/SKILL.md index 3544f4e5..6d0b102b 100644 --- a/plugins/antigravity/skills/status/SKILL.md +++ b/plugins/antigravity/skills/status/SKILL.md @@ -6,7 +6,7 @@ description: Render the feature × stage integrity matrix — every feature vs e Run `clad status` from the project root. Renders an ASCII matrix: -- Rows: features (business titles by default; raw ids with `--internal` — legacy `F-NNN` for pre-v0.3.9 features, `F-` for v0.3.9+). +- Rows: features (business titles by default; raw ids with `--internal` — legacy `F-NNN` for historical features, and current generated `F-` identifiers). - Columns: 15 Iron Law stages. - Cells: pass · skip · fail · not-yet-attempted. diff --git a/plugins/antigravity/skills/sync/SKILL.md b/plugins/antigravity/skills/sync/SKILL.md index 963f625d..eae5c6aa 100644 --- a/plugins/antigravity/skills/sync/SKILL.md +++ b/plugins/antigravity/skills/sync/SKILL.md @@ -11,7 +11,7 @@ Run `clad sync` from the project root. The command: - Reports the feature count and any validation failures. - Exits non-zero when the spec is invalid so CI can gate on it. -Spec must be valid before `clad check`, `clad run`, or any stage runner produces meaningful output. If `sync` fails, fix the reported issues first. +Spec must be valid before `clad check` or any stage runner produces meaningful output. If `sync` fails, fix the reported issues first. ``` clad sync diff --git a/plugins/claude-code/.claude-plugin/plugin.json b/plugins/claude-code/.claude-plugin/plugin.json index 041ffa2b..f2997464 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.4", + "version": "0.10.0", "description": "Reference implementation of the Ironclad standard — multi-agent dev harness for Claude Code.", "author": { "name": "qwerfunch" @@ -49,7 +49,7 @@ "ears": "syntactic", "phase": "L21.12 — Territory → Integrity Panel rename (vocab anchored to Trinity of Integrity)", "stages-implemented": ["stage_1.1", "stage_1.2", "stage_1.3", "stage_1.4", "stage_1.5", "stage_1.6", "stage_2.1", "stage_2.2", "stage_2.3", "stage_2.4", "stage_3.1", "stage_3.2", "stage_3.3", "stage_4.1", "stage_4.2"], - "spec-schema-version": "0.1", + "spec-schema-version": "0.2", "conformance": { "level-1": {"declared-at": "2026-05-18", "fixtures": "12/12"}, "level-2": {"declared-at": "2026-05-18", "fixtures": "4/4"}, diff --git a/plugins/claude-code/agents/developer.md b/plugins/claude-code/agents/developer.md index 97e3a870..32ab7053 100644 --- a/plugins/claude-code/agents/developer.md +++ b/plugins/claude-code/agents/developer.md @@ -36,8 +36,8 @@ You do NOT read Tier D (audit — observability's concern). Follow `docs/conventions.md` — `clad init` always writes it. The auto-generated header at the top of the file tells you which mode is active: -- **Greenfield seed**: toolchain-default 14-signal table (per-language defaults) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. -- **Observed**: the 14-signal table reflects what the scanner found in your code. Follow it verbatim. +- **Greenfield seed**: toolchain-default conventions table (per-language defaults) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. +- **Observed**: the conventions table reflects what the scanner found in your code. Follow it verbatim. One cladding-specific addition on top of either mode: @@ -82,4 +82,4 @@ Advisory (no detector enforces it) — but after your edits the hook auto-surfac ## User-facing language (Soft Shell) -Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for v0.3.9+ features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for current generated features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/claude-code/agents/observability.md b/plugins/claude-code/agents/observability.md index 0b317e03..81c90d67 100644 --- a/plugins/claude-code/agents/observability.md +++ b/plugins/claude-code/agents/observability.md @@ -47,4 +47,4 @@ When summarising or labelling reports, also read `spec.yaml::project.ai_hints`: ## User-facing language (Soft Shell) -The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/claude-code/agents/orchestrator.md b/plugins/claude-code/agents/orchestrator.md index ad4940fa..80ba02a9 100644 --- a/plugins/claude-code/agents/orchestrator.md +++ b/plugins/claude-code/agents/orchestrator.md @@ -70,4 +70,4 @@ Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad ## User-facing language (Soft Shell) -Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — attestation = sign-off, finding = what drifted and why; never lead with ids. +Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2e1`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — attestation = sign-off, finding = what drifted and why; never lead with ids. diff --git a/plugins/claude-code/agents/planner.md b/plugins/claude-code/agents/planner.md index f3cacac9..d2085ab4 100644 --- a/plugins/claude-code/agents/planner.md +++ b/plugins/claude-code/agents/planner.md @@ -7,40 +7,41 @@ capabilities: [read, write, edit, exec] # Planner -The **Planner** is a selectable role brief (formerly `librarian`) — a scope plus outcome conditions and evidence obligations the host may embody with any agent shape, not an agent cladding mandates spawning. It owns the Tier A spec SSoT — `spec.yaml` + per-feature spec files in `spec/features/` + `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier model. +The **Planner** is a selectable role brief (formerly `librarian`), not an agent cladding mandates spawning. It owns the Tier A spec SSoT — `spec.yaml`, `spec/features/`, and `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full model. ## Sources (what you read, by Tier) | Tier | Artifacts | Why you read it | |---|---|---| -| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | +| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | | **B** | `spec/architecture.yaml`, `spec/capabilities.yaml`, `docs/project-context.md` | cross-validate when editing A; e.g., new `features[]` binding in capabilities.yaml ↔ feature you just added | You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — observability owns it). ## What you do -- Add new features with hash-based id `F-` (v0.3.9+): filename `-.yaml`, `id: F-`, `slug: `. Legacy `F-NNN` files stay sequential — never migrate. -- Author EARS-compliant ACs (`AC-N`); every feature ships at least one. -- For **load-bearing** decisions (non-obvious ordering, invariant, trade-off a future editor could undo), record WHY in that AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. +- Add `F-` features as `-.yaml`. Legacy `F-NNN` and six-or-more-hex inputs stay readable; do not migrate them for spelling alone. +- Author EARS-compliant `AC-` records; legacy sequential and six-or-more-hex ids remain readable. Every feature needs one. +- For a load-bearing decision, record WHY in the AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. - Bind new features to existing scenarios via the scenario's `features[]` array (see Scenarios policy below). - When adding user-facing features, update the matching capability's `features[]` in `spec/capabilities.yaml` so `CAPABILITIES_FEATURE_MAPPING` stays clean. - Mark features as `archived` (with `archived_at` + `archive_reason`). - Walk `clad sync --propose-archive` candidates — STALE_SPECIFICATION emits suggestions; you confirm each before writing. +- Treat `clad clarify` as answer collection, not design-impact resolution. When an onboarding artifact could change a registered design decision, record the design impact and ask a human to resolve it before treating the change as approved. - Split `spec.yaml` into per-feature spec files (`spec/features/*.yaml`) when the master crosses ~1k lines. - Edit `spec/architecture.yaml` and `spec/capabilities.yaml` between scans — Tier B, edit-friendly; next scan diverts new body to `.cladding/scan/*.proposal`. - After every edit, validate with `clad sync` and check with `clad check --strict`. ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). +Scenarios are **onboarding output**, not a feature-creation side effect. Onboarding (host MCP flow or `clad init `) writes 1–3 journeys to `spec/scenarios/-.yaml` with `features: []`. Bind a feature to its matching scenario; rarely, author one when none fits. ## Project policy — `spec.yaml::project.ai_hints` When authoring a new feature or scenario, also check `spec.yaml::project.ai_hints`: -- `preferred_patterns` `{when, prefer, over?}` triples — name them in AC notes when relevant (e.g. an AC about a new detector should restate "synchronous + deterministic" if the project's `ai_hints` says so) -- `forbidden_patterns` — never copy one into example code in AC text or scenario flow descriptions (detector #27 still scans those) +- `preferred_patterns` `{when, prefer, over?}` triples — name relevant ones in AC notes +- `forbidden_patterns` — never copy one into AC examples or scenario flows - `preferred_persona` — informational; names the role that will implement what you author `ai_hints` is the project-scoped SSoT for AI behavior policy and overrides this prompt for the specific project. @@ -68,6 +69,10 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read Touching `src/stages/`, `src/hitl/`, or production code is **out of scope**. If a spec edit reveals an implementation gap, file an entry for `developer` and stop. +Design-impact resolution remains human-owned. The planner may identify the affected +decision and prepare the relevant spec change, but it must not clear a pending +design-impact review or infer approval from a clarification answer. + ## User-facing language (Soft Shell) -The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/claude-code/agents/reviewer.md b/plugins/claude-code/agents/reviewer.md index a953dc36..9ac9b38e 100644 --- a/plugins/claude-code/agents/reviewer.md +++ b/plugins/claude-code/agents/reviewer.md @@ -78,4 +78,4 @@ You also own the **advisory half no gate enforces**: confirm the test-author wro ## User-facing language (Soft Shell) -The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/claude-code/dist/agents/README.md b/plugins/claude-code/dist/agents/README.md index 5b8c01c5..ac190d73 100644 --- a/plugins/claude-code/dist/agents/README.md +++ b/plugins/claude-code/dist/agents/README.md @@ -8,7 +8,7 @@ ironclad-track: T9 (multi-agent orchestrator) ## [CLAIM] -The 6 agent personas — orchestrator · planner (formerly `librarian`) · reviewer · observability · developer (formerly `specialists`) · blind-author — each shipped as a Claude Code subagent (frontmatter + system prompt). Their canonical source lives in this directory; `npm run build:plugin` mirrors them into `plugins/claude-code/agents/`, `plugins/codex/skills/`, and `plugins/antigravity/skills/`. +The shipped persona catalog is derived from the canonical role briefs in this directory. `npm run build:plugin` mirrors those briefs into `plugins/claude-code/agents/`, `plugins/codex/skills/`, and `plugins/antigravity/skills/`; no fixed roster is a separate authority. `librarian` and `specialists` are compatibility history, not current catalog identities. ## [PERSONAS] diff --git a/plugins/claude-code/dist/agents/developer.md b/plugins/claude-code/dist/agents/developer.md index 97e3a870..32ab7053 100644 --- a/plugins/claude-code/dist/agents/developer.md +++ b/plugins/claude-code/dist/agents/developer.md @@ -36,8 +36,8 @@ You do NOT read Tier D (audit — observability's concern). Follow `docs/conventions.md` — `clad init` always writes it. The auto-generated header at the top of the file tells you which mode is active: -- **Greenfield seed**: toolchain-default 14-signal table (per-language defaults) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. -- **Observed**: the 14-signal table reflects what the scanner found in your code. Follow it verbatim. +- **Greenfield seed**: toolchain-default conventions table (per-language defaults) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. +- **Observed**: the conventions table reflects what the scanner found in your code. Follow it verbatim. One cladding-specific addition on top of either mode: @@ -82,4 +82,4 @@ Advisory (no detector enforces it) — but after your edits the hook auto-surfac ## User-facing language (Soft Shell) -Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for v0.3.9+ features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for current generated features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/claude-code/dist/agents/observability.md b/plugins/claude-code/dist/agents/observability.md index 0b317e03..81c90d67 100644 --- a/plugins/claude-code/dist/agents/observability.md +++ b/plugins/claude-code/dist/agents/observability.md @@ -47,4 +47,4 @@ When summarising or labelling reports, also read `spec.yaml::project.ai_hints`: ## User-facing language (Soft Shell) -The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/claude-code/dist/agents/orchestrator.md b/plugins/claude-code/dist/agents/orchestrator.md index ad4940fa..80ba02a9 100644 --- a/plugins/claude-code/dist/agents/orchestrator.md +++ b/plugins/claude-code/dist/agents/orchestrator.md @@ -70,4 +70,4 @@ Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad ## User-facing language (Soft Shell) -Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — attestation = sign-off, finding = what drifted and why; never lead with ids. +Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2e1`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — attestation = sign-off, finding = what drifted and why; never lead with ids. diff --git a/plugins/claude-code/dist/agents/planner.md b/plugins/claude-code/dist/agents/planner.md index f3cacac9..d2085ab4 100644 --- a/plugins/claude-code/dist/agents/planner.md +++ b/plugins/claude-code/dist/agents/planner.md @@ -7,40 +7,41 @@ capabilities: [read, write, edit, exec] # Planner -The **Planner** is a selectable role brief (formerly `librarian`) — a scope plus outcome conditions and evidence obligations the host may embody with any agent shape, not an agent cladding mandates spawning. It owns the Tier A spec SSoT — `spec.yaml` + per-feature spec files in `spec/features/` + `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier model. +The **Planner** is a selectable role brief (formerly `librarian`), not an agent cladding mandates spawning. It owns the Tier A spec SSoT — `spec.yaml`, `spec/features/`, and `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full model. ## Sources (what you read, by Tier) | Tier | Artifacts | Why you read it | |---|---|---| -| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | +| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | | **B** | `spec/architecture.yaml`, `spec/capabilities.yaml`, `docs/project-context.md` | cross-validate when editing A; e.g., new `features[]` binding in capabilities.yaml ↔ feature you just added | You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — observability owns it). ## What you do -- Add new features with hash-based id `F-` (v0.3.9+): filename `-.yaml`, `id: F-`, `slug: `. Legacy `F-NNN` files stay sequential — never migrate. -- Author EARS-compliant ACs (`AC-N`); every feature ships at least one. -- For **load-bearing** decisions (non-obvious ordering, invariant, trade-off a future editor could undo), record WHY in that AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. +- Add `F-` features as `-.yaml`. Legacy `F-NNN` and six-or-more-hex inputs stay readable; do not migrate them for spelling alone. +- Author EARS-compliant `AC-` records; legacy sequential and six-or-more-hex ids remain readable. Every feature needs one. +- For a load-bearing decision, record WHY in the AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. - Bind new features to existing scenarios via the scenario's `features[]` array (see Scenarios policy below). - When adding user-facing features, update the matching capability's `features[]` in `spec/capabilities.yaml` so `CAPABILITIES_FEATURE_MAPPING` stays clean. - Mark features as `archived` (with `archived_at` + `archive_reason`). - Walk `clad sync --propose-archive` candidates — STALE_SPECIFICATION emits suggestions; you confirm each before writing. +- Treat `clad clarify` as answer collection, not design-impact resolution. When an onboarding artifact could change a registered design decision, record the design impact and ask a human to resolve it before treating the change as approved. - Split `spec.yaml` into per-feature spec files (`spec/features/*.yaml`) when the master crosses ~1k lines. - Edit `spec/architecture.yaml` and `spec/capabilities.yaml` between scans — Tier B, edit-friendly; next scan diverts new body to `.cladding/scan/*.proposal`. - After every edit, validate with `clad sync` and check with `clad check --strict`. ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). +Scenarios are **onboarding output**, not a feature-creation side effect. Onboarding (host MCP flow or `clad init `) writes 1–3 journeys to `spec/scenarios/-.yaml` with `features: []`. Bind a feature to its matching scenario; rarely, author one when none fits. ## Project policy — `spec.yaml::project.ai_hints` When authoring a new feature or scenario, also check `spec.yaml::project.ai_hints`: -- `preferred_patterns` `{when, prefer, over?}` triples — name them in AC notes when relevant (e.g. an AC about a new detector should restate "synchronous + deterministic" if the project's `ai_hints` says so) -- `forbidden_patterns` — never copy one into example code in AC text or scenario flow descriptions (detector #27 still scans those) +- `preferred_patterns` `{when, prefer, over?}` triples — name relevant ones in AC notes +- `forbidden_patterns` — never copy one into AC examples or scenario flows - `preferred_persona` — informational; names the role that will implement what you author `ai_hints` is the project-scoped SSoT for AI behavior policy and overrides this prompt for the specific project. @@ -68,6 +69,10 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read Touching `src/stages/`, `src/hitl/`, or production code is **out of scope**. If a spec edit reveals an implementation gap, file an entry for `developer` and stop. +Design-impact resolution remains human-owned. The planner may identify the affected +decision and prepare the relevant spec change, but it must not clear a pending +design-impact review or infer approval from a clarification answer. + ## User-facing language (Soft Shell) -The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/claude-code/dist/agents/reviewer.md b/plugins/claude-code/dist/agents/reviewer.md index a953dc36..9ac9b38e 100644 --- a/plugins/claude-code/dist/agents/reviewer.md +++ b/plugins/claude-code/dist/agents/reviewer.md @@ -78,4 +78,4 @@ You also own the **advisory half no gate enforces**: confirm the test-author wro ## User-facing language (Soft Shell) -The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 4460b1e9..4e79625b 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,206 +4,346 @@ 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 jfe=Object.create;var zA=Object.defineProperty;var Mfe=Object.getOwnPropertyDescriptor;var Ffe=Object.getOwnPropertyNames;var Lfe=Object.getPrototypeOf,zfe=Object.prototype.hasOwnProperty;var Ze=(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,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Nr=(t,e)=>{for(var r in e)zA(t,r,{get:e[r],enumerable:!0})},Ufe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ffe(e))!zfe.call(t,i)&&i!==r&&zA(t,i,{get:()=>e[i],enumerable:!(n=Mfe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?jfe(Lfe(t)):{},Ufe(e||!t||!t.__esModule?zA(r,"default",{value:t,enumerable:!0}):r,t));var ff=v(qA=>{var Oy=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}},UA=class extends Oy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};qA.CommanderError=Oy;qA.InvalidArgumentError=UA});var Ty=v(BA=>{var{InvalidArgumentError:qfe}=ff(),HA=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 qfe(`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 Hfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}BA.Argument=HA;BA.humanReadableArgName=Hfe});var VA=v(ZA=>{var{humanReadableArgName:Bfe}=Ty(),GA=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=>Bfe(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 C4(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 C4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}ZA.Help=GA;ZA.stripColor=C4});var YA=v(JA=>{var{InvalidArgumentError:Gfe}=ff(),WA=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=Zfe(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 Gfe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?D4(this.name().replace(/^no-/,"")):D4(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},KA=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,o=i!==void 0?i:!1;return r.negate===(o===e)}};function D4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Zfe(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} +var IPe=Object.create;var FN=Object.defineProperty;var PPe=Object.getOwnPropertyDescriptor;var RPe=Object.getOwnPropertyNames;var CPe=Object.getPrototypeOf,TPe=Object.prototype.hasOwnProperty;var Ot=(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 S=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var k=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Di=(t,e)=>{for(var r in e)FN(t,r,{get:e[r],enumerable:!0})},OPe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of RPe(e))!TPe.call(t,i)&&i!==r&&FN(t,i,{get:()=>e[i],enumerable:!(n=PPe(e,i))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?IPe(CPe(t)):{},OPe(e||!t||!t.__esModule?FN(r,"default",{value:t,enumerable:!0}):r,t));var py=k(UN=>{var jx=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}},zN=class extends jx{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};UN.CommanderError=jx;UN.InvalidArgumentError=zN});var Lx=k(qN=>{var{InvalidArgumentError:NPe}=py(),BN=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 NPe(`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 DPe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}qN.Argument=BN;qN.humanReadableArgName=DPe});var HN=k(GN=>{var{humanReadableArgName:jPe}=Lx(),VN=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,s)=>i.name().localeCompare(s.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),s=n.long&&e._findOption(n.long);!i&&!s?r.push(n):n.long&&!s?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(s=>!s.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=>jPe(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(s=>{let o=n(s);i.has(o)||i.set(o,[])}),r.forEach(s=>{let o=n(s);i.has(o)||i.set(o,[]),i.get(o).push(s)}),i}formatHelp(e,r){let n=r.padWidth(e,r),i=r.helpWidth??80;function s(d,p){return r.formatItem(d,n,p,r)}let o=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(e))}`,""],a=r.commandDescription(e);a.length>0&&(o=o.concat([r.boxWrap(r.styleCommandDescription(a),i),""]));let c=r.visibleArguments(e).map(d=>s(r.styleArgumentTerm(r.argumentTerm(d)),r.styleArgumentDescription(r.argumentDescription(d))));if(o=o.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(e.options,r.visibleOptions(e),d=>d.helpGroupHeading??"Options:").forEach((d,p)=>{let f=d.map(h=>s(r.styleOptionTerm(r.optionTerm(h)),r.styleOptionDescription(r.optionDescription(h))));o=o.concat(this.formatItemList(p,f,r))}),r.showGlobalOptions){let d=r.visibleGlobalOptions(e).map(p=>s(r.styleOptionTerm(r.optionTerm(p)),r.styleOptionDescription(r.optionDescription(p))));o=o.concat(this.formatItemList("Global Options:",d,r))}return this.groupItems(e.commands,r.visibleCommands(e),d=>d.helpGroup()||"Commands:").forEach((d,p)=>{let f=d.map(h=>s(r.styleSubcommandTerm(r.subcommandTerm(h)),r.styleSubcommandDescription(r.subcommandDescription(h))));o=o.concat(this.formatItemList(p,f,r))}),o.join(` +`)}displayWidth(e){return jZ(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 o=" ".repeat(2);if(!n)return o+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=o.match(i);if(a===null){s.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}s.push(c.join(""));let p=u.trimStart();c=[p],l=this.displayWidth(p)}),s.push(c.join(""))}),s.join(` +`)}};function jZ(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}GN.Help=VN;GN.stripColor=jZ});var KN=k(JN=>{var{InvalidArgumentError:LPe}=py(),WN=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=MPe(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 LPe(`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?LZ(this.name().replace(/^no-/,"")):LZ(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}},ZN=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,s=i!==void 0?i:!1;return r.negate===(s===e)}};function LZ(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function MPe(t){let e,r,n=/^-[^-]$/,i=/^--[^-]/,s=t.split(/[ |,]+/).concat("guard");if(n.test(s[0])&&(e=s.shift()),i.test(s[0])&&(r=s.shift()),!e&&n.test(s[0])&&(e=s.shift()),!e&&i.test(s[0])&&(e=r,r=s.shift()),s[0].startsWith("-")){let o=s[0],a=`option creation failed due to '${o}' in option flags '${t}'`;throw/^-[^-][^-]/.test(o)?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} + - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(o)?new Error(`${a} +- too many short flags`):i.test(o)?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=WA;JA.DualOptions=KA});var j4=v(N4=>{function Vfe(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 Wfe(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=Vfe(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}}JN.Option=WN;JN.DualOptions=ZN});var FZ=k(MZ=>{function FPe(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 s=1;t[i-1]===e[n-1]?s=0:s=1,r[i][n]=Math.min(r[i-1][n]+1,r[i][n-1]+1,r[i-1][n-1]+s),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 zPe(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(o=>o.slice(2)));let n=[],i=3,s=.4;return e.forEach(o=>{if(o.length<=1)return;let a=FPe(t,o),c=Math.max(t.length,o.length);(c-a)/c>s&&(ao.localeCompare(a)),r&&(n=n.map(o=>`--${o}`)),n.length>1?` (Did you mean one of ${n.join(", ")}?)`:n.length===1?` -(Did you mean ${n[0]}?)`:""}N4.suggestSimilar=Wfe});var z4=v(rO=>{var Kfe=Ze("node:events").EventEmitter,XA=Ze("node:child_process"),mo=Ze("node:path"),Ry=Ze("node:fs"),He=Ze("node:process"),{Argument:Jfe,humanReadableArgName:Yfe}=Ty(),{CommanderError:QA}=ff(),{Help:Xfe,stripColor:Qfe}=VA(),{Option:M4,DualOptions:epe}=YA(),{suggestSimilar:F4}=j4(),eO=class t extends Kfe{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=>He.stdout.write(r),writeErr:r=>He.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>He.stdout.isTTY?He.stdout.columns:void 0,getErrHelpWidth:()=>He.stderr.isTTY?He.stderr.columns:void 0,getOutHasColors:()=>tO()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>tO()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>Qfe(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 Xfe,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 Jfe(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 QA(e,r,n)),He.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,o=n.slice(0,i);return this._storeOptionsAsProperties?o[i]=this:o[i]=this.opts(),o.push(this),e.apply(this,o)};return this._actionHandler=r,this}createOption(e,r){return new M4(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(o){if(o.code==="commander.invalidArgument"){let s=`${i} ${o.message}`;this.error(s,{exitCode:o.exitCode,code:o.code})}throw o}}_registerOption(e){let r=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(r){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}' -- already used by option '${r.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let r=i=>[i.name()].concat(i.aliases()),n=r(e).find(i=>this._findCommand(i));if(n){let i=r(this._findCommand(n)).join("|"),o=r(e).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let r=e.name(),n=e.attributeName();if(e.negate){let o=e.long.replace(/^--no-/,"--");this._findOption(o)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(o,s,a)=>{o==null&&e.presetArg!==void 0&&(o=e.presetArg);let c=this.getOptionValue(n);o!==null&&e.parseArg?o=this._callParseArg(e,o,c,s):o!==null&&e.variadic&&(o=e._collectValue(o,c)),o==null&&(e.negate?o=!1:e.isBoolean()||e.optional?o=!0:o=""),this.setOptionValueWithSource(n,o,a)};return this.on("option:"+r,o=>{let s=`error: option '${e.flags}' argument '${o}' is invalid.`;i(o,s,"cli")}),e.envVar&&this.on("optionEnv:"+r,o=>{let s=`error: option '${e.flags}' value '${o}' from env '${e.envVar}' is invalid.`;i(o,s,"env")}),this}_optionEx(e,r,n,i,o){if(typeof r=="object"&&r instanceof M4)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(o).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},s.default(o).argParser(i)}else s.default(i);return this.addOption(s)}option(e,r,n,i){return this._optionEx({},e,r,n,i)}requiredOption(e,r,n,i){return this._optionEx({mandatory:!0},e,r,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,r){return this.setOptionValueWithSource(e,r,void 0)}setOptionValueWithSource(e,r,n){return this._storeOptionsAsProperties?this[e]=r:this._optionValues[e]=r,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(r=n.getOptionValueSource(e))}),r}_prepareUserArgs(e,r){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},e===void 0&&r.from===void 0){He.versions?.electron&&(r.from="electron");let i=He.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=He.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":He.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(Ry.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]}?)`:""}MZ.suggestSimilar=zPe});var qZ=k(tD=>{var UPe=Ot("node:events").EventEmitter,YN=Ot("node:child_process"),Pa=Ot("node:path"),Mx=Ot("node:fs"),At=Ot("node:process"),{Argument:BPe,humanReadableArgName:qPe}=Lx(),{CommanderError:XN}=py(),{Help:VPe,stripColor:GPe}=HN(),{Option:zZ,DualOptions:HPe}=KN(),{suggestSimilar:UZ}=FZ(),QN=class t extends UPe{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=>At.stdout.write(r),writeErr:r=>At.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>At.stdout.isTTY?At.stdout.columns:void 0,getErrHelpWidth:()=>At.stderr.isTTY?At.stderr.columns:void 0,getOutHasColors:()=>eD()??(At.stdout.isTTY&&At.stdout.hasColors?.()),getErrHasColors:()=>eD()??(At.stderr.isTTY&&At.stderr.hasColors?.()),stripColor:r=>GPe(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,s=n;typeof i=="object"&&i!==null&&(s=i,i=null),s=s||{};let[,o,a]=e.match(/([^ ]+) *(.*)/),c=this.createCommand(o);return i&&(c.description(i),c._executableHandler=!0),s.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(s.noHelp||s.hidden),c._executableFile=s.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 VPe,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 BPe(e,r)}argument(e,r,n,i){let s=this.createArgument(e,r);return typeof n=="function"?s.default(i).argParser(n):s.default(n),this.addArgument(s),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,s]=n.match(/([^ ]+) *(.*)/),o=r??"display help for command",a=this.createCommand(i);return a.helpOption(!1),s&&a.arguments(s),o&&a.description(o),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 XN(e,r,n)),At.exit(e)}action(e){let r=n=>{let i=this.registeredArguments.length,s=n.slice(0,i);return this._storeOptionsAsProperties?s[i]=this:s[i]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=r,this}createOption(e,r){return new zZ(e,r)}_callParseArg(e,r,n,i){try{return e.parseArg(r,n)}catch(s){if(s.code==="commander.invalidArgument"){let o=`${i} ${s.message}`;this.error(o,{exitCode:s.exitCode,code:s.code})}throw s}}_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("|"),s=r(e).join("|");throw new Error(`cannot add command '${s}' 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 s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");let i=(s,o,a)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let c=this.getOptionValue(n);s!==null&&e.parseArg?s=this._callParseArg(e,s,c,o):s!==null&&e.variadic&&(s=e._collectValue(s,c)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(n,s,a)};return this.on("option:"+r,s=>{let o=`error: option '${e.flags}' argument '${s}' is invalid.`;i(s,o,"cli")}),e.envVar&&this.on("optionEnv:"+r,s=>{let o=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;i(s,o,"env")}),this}_optionEx(e,r,n,i,s){if(typeof r=="object"&&r instanceof zZ)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let o=this.createOption(r,n);if(o.makeOptionMandatory(!!e.mandatory),typeof i=="function")o.default(s).argParser(i);else if(i instanceof RegExp){let a=i;i=(c,l)=>{let u=a.exec(c);return u?u[0]:l},o.default(s).argParser(i)}else o.default(i);return this.addOption(o)}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){At.versions?.electron&&(r.from="electron");let i=At.execArgv??[];(i.includes("-e")||i.includes("--eval")||i.includes("-p")||i.includes("--print"))&&(r.from="eval")}e===void 0&&(e=At.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":At.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(Mx.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",s=`'${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=mo.resolve(u,d);if(Ry.existsSync(f))return f;if(i.includes(mo.extname(d)))return;let p=i.find(m=>Ry.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=Ry.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=mo.resolve(mo.dirname(u),a)}if(a){let u=o(a,s);if(!u&&!e._executableFile&&this._scriptPath){let d=mo.basename(this._scriptPath,mo.extname(this._scriptPath));d!==this._name&&(u=o(a,`${d}-${e._name}`))}s=u||s}n=i.includes(mo.extname(s));let c;He.platform!=="win32"?n?(r.unshift(s),r=L4(He.execArgv).concat(r),c=XA.spawn(He.argv[0],r,{stdio:"inherit"})):c=XA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=L4(He.execArgv).concat(r),c=XA.spawn(He.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{He.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 QA(u,"commander.executeSubCommandAsync","(close)")):He.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)He.exit(1);else{let d=new QA(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(s)}_executeSubCommand(e,r){r=r.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,d){let p=Pa.resolve(u,d);if(Mx.existsSync(p))return p;if(i.includes(Pa.extname(d)))return;let f=i.find(h=>Mx.existsSync(`${p}${h}`));if(f)return`${p}${f}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let u;try{u=Mx.realpathSync(this._scriptPath)}catch{u=this._scriptPath}a=Pa.resolve(Pa.dirname(u),a)}if(a){let u=s(a,o);if(!u&&!e._executableFile&&this._scriptPath){let d=Pa.basename(this._scriptPath,Pa.extname(this._scriptPath));d!==this._name&&(u=s(a,`${d}-${e._name}`))}o=u||o}n=i.includes(Pa.extname(o));let c;At.platform!=="win32"?n?(r.unshift(o),r=BZ(At.execArgv).concat(r),c=YN.spawn(At.argv[0],r,{stdio:"inherit"})):c=YN.spawn(o,r,{stdio:"inherit"}):(this._checkForMissingExecutable(o,a,e._name),r.unshift(o),r=BZ(At.execArgv).concat(r),c=YN.spawn(At.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(d=>{At.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 XN(u,"commander.executeSubCommandAsync","(close)")):At.exit(u)}),c.on("error",u=>{if(u.code==="ENOENT")this._checkForMissingExecutable(o,a,e._name);else if(u.code==="EACCES")throw new Error(`'${o}' not executable`);if(!l)At.exit(1);else{let d=new XN(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 s;return s=this._chainOrCallSubCommandHook(s,i,"preSubcommand"),s=this._chainOrCall(s,()=>{if(i._executableHandler)this._executeSubCommand(i,r.concat(n));else return i._parseCommand(r,n)}),s}_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,s)=>{let o=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;o=this._callParseArg(n,i,s,a)}return o};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,i)=>{let s=n.defaultValue;n.variadic?ie(n,a,o),n.defaultValue))):s===void 0&&(s=[]):ir()):r()}_chainOrCallHooks(e,r){let n=e,i=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[r]!==void 0).forEach(s=>{s._lifeCycleHooks[r].forEach(o=>{i.push({hookedCommand:s,callback:o})})}),r==="postAction"&&i.reverse(),i.forEach(s=>{n=this._chainOrCall(n,()=>s.callback(s.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,r,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(s=>{i=this._chainOrCall(i,()=>s(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])},s=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let o;return o=this._chainOrCallHooks(o,"preAction"),o=this._chainOrCall(o,()=>this._actionHandler(this.processedArgs)),this.parent&&(o=this._chainOrCall(o,()=>{this.parent.emit(s,e,r)})),o=this._chainOrCallHooks(o,"postAction"),o}if(this.parent?.listenerCount(s))i(),this._processArguments(),this.parent.emit(s,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(s=>n.conflictsWith.includes(s.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let r=[],n=[],i=r;function s(u){return u.length>1&&u[0]==="-"}let o=u=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(u)?!this._getCommandAndAncestors().some(d=>d.options.map(p=>p.short).some(p=>/^-\d$/.test(p))):!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("="),p=this._findOption(u.slice(0,d));if(p&&(p.required||p.optional)){this.emit(`option:${p.name()}`,u.slice(d+1));continue}}if(i===r&&s(u)&&!(this.commands.length===0&&o(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 He.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()}`,He.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new epe(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=F4(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=F4(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=>Yfe(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=mo.basename(e,mo.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(He.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 L4(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 tO(){if(He.env.NO_COLOR||He.env.FORCE_COLOR==="0"||He.env.FORCE_COLOR==="false")return!1;if(He.env.FORCE_COLOR||He.env.CLICOLOR_FORCE!==void 0)return!0}rO.Command=eO;rO.useColor=tO});var B4=v(Tn=>{var{Argument:U4}=Ty(),{Command:nO}=z4(),{CommanderError:tpe,InvalidArgumentError:q4}=ff(),{Help:rpe}=VA(),{Option:H4}=YA();Tn.program=new nO;Tn.createCommand=t=>new nO(t);Tn.createOption=(t,e)=>new H4(t,e);Tn.createArgument=(t,e)=>new U4(t,e);Tn.Command=nO;Tn.Option=H4;Tn.Argument=U4;Tn.Help=rpe;Tn.CommanderError=tpe;Tn.InvalidArgumentError=q4;Tn.InvalidOptionArgumentError=q4});var De=v(er=>{"use strict";var oO=Symbol.for("yaml.alias"),W4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),K4=Symbol.for("yaml.pair"),sO=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),cpe=t=>!!t&&typeof t=="object"&&t[ho]===oO,lpe=t=>!!t&&typeof t=="object"&&t[ho]===W4,upe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,dpe=t=>!!t&&typeof t=="object"&&t[ho]===K4,J4=t=>!!t&&typeof t=="object"&&t[ho]===sO,fpe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function Y4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function ppe(t){if(t&&typeof t=="object")switch(t[ho]){case oO:case Iy:case sO:case Py:return!0}return!1}var mpe=t=>(J4(t)||Y4(t))&&!!t.anchor;er.ALIAS=oO;er.DOC=W4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=K4;er.SCALAR=sO;er.SEQ=Py;er.hasAnchor=mpe;er.isAlias=cpe;er.isCollection=Y4;er.isDocument=lpe;er.isMap=upe;er.isNode=ppe;er.isPair=dpe;er.isScalar=J4;er.isSeq=fpe});var pf=v(aO=>{"use strict";var Ut=De(),jr=Symbol("break visit"),X4=Symbol("skip children"),Oi=Symbol("remove node");function Cy(t,e){let r=Q4(e);Ut.isDocument(t)?il(null,t.contents,r,Object.freeze([t]))===Oi&&(t.contents=null):il(null,t,r,Object.freeze([]))}Cy.BREAK=jr;Cy.SKIP=X4;Cy.REMOVE=Oi;function il(t,e,r,n){let i=eH(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return tH(t,n,i),il(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 rH=De(),hpe=pf(),gpe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ype=t=>t.replace(/[!,[\]{}]/g,e=>gpe[e]),mf=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+ype(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&&rH.isNode(e.contents)){let o={};hpe.visit(e.contents,(s,a)=>{rH.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(` -`)}};mf.defaultYaml={explicit:!1,version:"1.2"};mf.defaultTags={"!!":"tag:yaml.org,2002:"};nH.Directives=mf});var Ny=v(hf=>{"use strict";var iH=De(),_pe=pf();function bpe(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 oH(t){let e=new Set;return _pe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function sH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function vpe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=oH(t));let s=sH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(iH.isScalar(s.node)||iH.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}}hf.anchorIsValid=bpe;hf.anchorNames=oH;hf.createNodeAnchors=vpe;hf.findNewAnchor=sH});var lO=v(aH=>{"use strict";function gf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var Spe=De();function cH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>cH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Spe.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}lH.toJS=cH});var jy=v(dH=>{"use strict";var wpe=lO(),uH=De(),xpe=Wo(),uO=class{constructor(e){Object.defineProperty(this,uH.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(!uH.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=xpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?wpe.applyReviver(o,{"":a},"",a):a}};dH.NodeBase=uO});var yf=v(fH=>{"use strict";var $pe=Ny(),kpe=pf(),sl=De(),Epe=jy(),Ape=Wo(),dO=class extends Epe.NodeBase{constructor(e){super(sl.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=[],kpe.visit(e,{Node:(o,s)=>{(sl.isAlias(s)||sl.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||(Ape.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=My(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($pe.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 My(t,e,r){if(sl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(sl.isCollection(e)){let n=0;for(let i of e.items){let o=My(t,i,r);o>n&&(n=o)}return n}else if(sl.isPair(e)){let n=My(t,e.key,r),i=My(t,e.value,r);return Math.max(n,i)}return 1}fH.Alias=dO});var Dt=v(fO=>{"use strict";var Ope=De(),Tpe=jy(),Rpe=Wo(),Ipe=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends Tpe.NodeBase{constructor(e){super(Ope.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Rpe.toJS(this.value,e,r)}toString(){return String(this.value)}};Ko.BLOCK_FOLDED="BLOCK_FOLDED";Ko.BLOCK_LITERAL="BLOCK_LITERAL";Ko.PLAIN="PLAIN";Ko.QUOTE_DOUBLE="QUOTE_DOUBLE";Ko.QUOTE_SINGLE="QUOTE_SINGLE";fO.Scalar=Ko;fO.isScalarValue=Ipe});var _f=v(mH=>{"use strict";var Ppe=yf(),ha=De(),pH=Dt(),Cpe="tag:yaml.org,2002:";function Dpe(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 Npe(t,e,r){if(ha.isDocument(t)&&(t=t.contents),ha.isNode(t))return t;if(ha.isPair(t)){let d=r.schema[ha.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 Ppe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Cpe+e.slice(2));let l=Dpe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new pH.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?s[ha.MAP]:Symbol.iterator in Object(t)?s[ha.SEQ]:s[ha.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 pH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}mH.createNode=Npe});var Ly=v(Fy=>{"use strict";var jpe=_f(),Ti=De(),Mpe=jy();function pO(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 jpe.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 hH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,mO=class extends Mpe.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(hH(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,pO(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,pO(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=mO;Fy.collectionFromPath=pO;Fy.isEmptyPath=hH});var bf=v(zy=>{"use strict";var Fpe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function hO(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Lpe=(t,e,r)=>t.endsWith(` -`)?hO(r,e):r.includes(` +`),this.outputHelp({error:!0}));let n=r||{},i=n.exitCode||1,s=n.code||"commander.error";this._exit(i,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in At.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()}`,At.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new HPe(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=o=>{let a=o.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||o},i=o=>{let a=n(o),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},s=`error: ${i(e)} cannot be used with ${i(r)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let r="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],s=this;do{let o=s.createHelp().visibleOptions(s).filter(a=>a.long).map(a=>a.long);i=i.concat(o),s=s.parent}while(s&&!s._enablePositionalOptions);r=UZ(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",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],r="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(s=>{i.push(s.name()),s.alias()&&i.push(s.alias())}),r=UZ(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=>qPe(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=Pa.basename(e,Pa.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,s;return r?(n=a=>this._outputConfiguration.writeErr(a),i=this._outputConfiguration.getErrHasColors(),s=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),i=this._outputConfiguration.getOutHasColors(),s=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(i||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:i,helpWidth:s}}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(o=>o.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let s=this.helpInformation({error:n.error});if(r&&(s=r(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(o=>o.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(At.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,s=>{let o;typeof r=="function"?o=r({error:s.error,command:s.command}):o=r,o&&s.write(`${o} +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function BZ(t){return t.map(e=>{if(!e.startsWith("--inspect"))return e;let r,n="127.0.0.1",i="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?r=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=s[1],/^\d+$/.test(s[3])?i=s[3]:n=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=s[1],n=s[3],i=s[4]),r&&i!=="0"?`${r}=${n}:${parseInt(i)+1}`:e})}function eD(){if(At.env.NO_COLOR||At.env.FORCE_COLOR==="0"||At.env.FORCE_COLOR==="false")return!1;if(At.env.FORCE_COLOR||At.env.CLICOLOR_FORCE!==void 0)return!0}tD.Command=QN;tD.useColor=eD});var WZ=k(cs=>{var{Argument:VZ}=Lx(),{Command:rD}=qZ(),{CommanderError:WPe,InvalidArgumentError:GZ}=py(),{Help:ZPe}=HN(),{Option:HZ}=KN();cs.program=new rD;cs.createCommand=t=>new rD(t);cs.createOption=(t,e)=>new HZ(t,e);cs.createArgument=(t,e)=>new VZ(t,e);cs.Command=rD;cs.Option=HZ;cs.Argument=VZ;cs.Help=ZPe;cs.CommanderError=WPe;cs.InvalidArgumentError=GZ;cs.InvalidOptionArgumentError=GZ});var pt=k(on=>{"use strict";var sD=Symbol.for("yaml.alias"),YZ=Symbol.for("yaml.document"),Fx=Symbol.for("yaml.map"),XZ=Symbol.for("yaml.pair"),oD=Symbol.for("yaml.scalar"),zx=Symbol.for("yaml.seq"),Ra=Symbol.for("yaml.node.type"),eRe=t=>!!t&&typeof t=="object"&&t[Ra]===sD,tRe=t=>!!t&&typeof t=="object"&&t[Ra]===YZ,rRe=t=>!!t&&typeof t=="object"&&t[Ra]===Fx,nRe=t=>!!t&&typeof t=="object"&&t[Ra]===XZ,QZ=t=>!!t&&typeof t=="object"&&t[Ra]===oD,iRe=t=>!!t&&typeof t=="object"&&t[Ra]===zx;function eJ(t){if(t&&typeof t=="object")switch(t[Ra]){case Fx:case zx:return!0}return!1}function sRe(t){if(t&&typeof t=="object")switch(t[Ra]){case sD:case Fx:case oD:case zx:return!0}return!1}var oRe=t=>(QZ(t)||eJ(t))&&!!t.anchor;on.ALIAS=sD;on.DOC=YZ;on.MAP=Fx;on.NODE_TYPE=Ra;on.PAIR=XZ;on.SCALAR=oD;on.SEQ=zx;on.hasAnchor=oRe;on.isAlias=eRe;on.isCollection=eJ;on.isDocument=tRe;on.isMap=rRe;on.isNode=sRe;on.isPair=nRe;on.isScalar=QZ;on.isSeq=iRe});var fy=k(aD=>{"use strict";var qr=pt(),li=Symbol("break visit"),tJ=Symbol("skip children"),Io=Symbol("remove node");function Ux(t,e){let r=rJ(e);qr.isDocument(t)?Jp(null,t.contents,r,Object.freeze([t]))===Io&&(t.contents=null):Jp(null,t,r,Object.freeze([]))}Ux.BREAK=li;Ux.SKIP=tJ;Ux.REMOVE=Io;function Jp(t,e,r,n){let i=nJ(t,e,r,n);if(qr.isNode(i)||qr.isPair(i))return iJ(t,n,i),Jp(t,i,r,n);if(typeof i!="symbol"){if(qr.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s{"use strict";var sJ=pt(),aRe=fy(),cRe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lRe=t=>t.replace(/[!,[\]{}]/g,e=>cRe[e]),hy=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[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!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 o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),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+lRe(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&&sJ.isNode(e.contents)){let s={};aRe.visit(e.contents,(o,a)=>{sJ.isNode(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(` +`)}};hy.defaultYaml={explicit:!1,version:"1.2"};hy.defaultTags={"!!":"tag:yaml.org,2002:"};oJ.Directives=hy});var qx=k(my=>{"use strict";var aJ=pt(),uRe=fy();function dRe(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 cJ(t){let e=new Set;return uRe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function lJ(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function pRe(t,e){let r=[],n=new Map,i=null;return{onAnchor:s=>{r.push(s),i??(i=cJ(t));let o=lJ(e,i);return i.add(o),o},setAnchors:()=>{for(let s of r){let o=n.get(s);if(typeof o=="object"&&o.anchor&&(aJ.isScalar(o.node)||aJ.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:n}}my.anchorIsValid=dRe;my.anchorNames=cJ;my.createNodeAnchors=pRe;my.findNewAnchor=lJ});var lD=k(uJ=>{"use strict";function gy(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,s=n.length;i{"use strict";var fRe=pt();function dJ(t,e,r){if(Array.isArray(t))return t.map((n,i)=>dJ(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!fRe.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=s=>{n.res=s,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}pJ.toJS=dJ});var Vx=k(hJ=>{"use strict";var hRe=lD(),fJ=pt(),mRe=Oc(),uD=class{constructor(e){Object.defineProperty(this,fJ.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:s}={}){if(!fJ.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=mRe.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:l}of o.anchors.values())i(l,c);return typeof s=="function"?hRe.applyReviver(s,{"":a},"",a):a}};hJ.NodeBase=uD});var yy=k(mJ=>{"use strict";var gRe=qx(),yRe=fy(),Yp=pt(),bRe=Vx(),vRe=Oc(),dD=class extends bRe.NodeBase{constructor(e){super(Yp.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=[],yRe.visit(e,{Node:(s,o)=>{(Yp.isAlias(o)||Yp.hasAnchor(o))&&n.push(o)}}),r&&(r.aliasResolveCache=n));let i;for(let s of n){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:s}=r,o=this.resolve(i,r);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(o);if(a||(vRe.toJS(o,null,r),a=n.get(o)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Gx(i,o,n)),a.count*a.aliasCount>s)){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(gRe.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${i} `}return i}};function Gx(t,e,r){if(Yp.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Yp.isCollection(e)){let n=0;for(let i of e.items){let s=Gx(t,i,r);s>n&&(n=s)}return n}else if(Yp.isPair(e)){let n=Gx(t,e.key,r),i=Gx(t,e.value,r);return Math.max(n,i)}return 1}mJ.Alias=dD});var Rr=k(pD=>{"use strict";var _Re=pt(),SRe=Vx(),wRe=Oc(),xRe=t=>!t||typeof t!="function"&&typeof t!="object",Nc=class extends SRe.NodeBase{constructor(e){super(_Re.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:wRe.toJS(this.value,e,r)}toString(){return String(this.value)}};Nc.BLOCK_FOLDED="BLOCK_FOLDED";Nc.BLOCK_LITERAL="BLOCK_LITERAL";Nc.PLAIN="PLAIN";Nc.QUOTE_DOUBLE="QUOTE_DOUBLE";Nc.QUOTE_SINGLE="QUOTE_SINGLE";pD.Scalar=Nc;pD.isScalarValue=xRe});var by=k(yJ=>{"use strict";var kRe=yy(),xu=pt(),gJ=Rr(),ERe="tag:yaml.org,2002:";function ARe(t,e,r){if(e){let n=r.filter(s=>s.tag===e),i=n.find(s=>!s.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function $Re(t,e,r){if(xu.isDocument(t)&&(t=t.contents),xu.isNode(t))return t;if(xu.isPair(t)){let d=r.schema[xu.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:s,schema:o,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=i(t)),new kRe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=ERe+e.slice(2));let l=ARe(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new gJ.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?o[xu.MAP]:Symbol.iterator in Object(t)?o[xu.SEQ]:o[xu.MAP]}s&&(s(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 gJ.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}yJ.createNode=$Re});var Wx=k(Hx=>{"use strict";var IRe=by(),Po=pt(),PRe=Vx();function fD(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let s=e[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=n,n=o}else n=new Map([[s,n]])}return IRe.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 bJ=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,hD=class extends PRe.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=>Po.isNode(n)||Po.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(bJ(e))this.add(r);else{let[n,...i]=e,s=this.get(n,!0);if(Po.isCollection(s))s.addIn(i,r);else if(s===void 0&&this.schema)this.set(n,fD(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(Po.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,s=this.get(n,!0);return i.length===0?!r&&Po.isScalar(s)?s.value:s:Po.isCollection(s)?s.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Po.isPair(r))return!1;let n=r.value;return n==null||e&&Po.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 Po.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let s=this.get(n,!0);if(Po.isCollection(s))s.setIn(i,r);else if(s===void 0&&this.schema)this.set(n,fD(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Hx.Collection=hD;Hx.collectionFromPath=fD;Hx.isEmptyPath=bJ});var vy=k(Zx=>{"use strict";var RRe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function mD(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var CRe=(t,e,r)=>t.endsWith(` +`)?mD(r,e):r.includes(` `)?` -`+hO(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=hO;zy.lineComment=Lpe;zy.stringifyComment=Fpe});var yH=v(vf=>{"use strict";var zpe="flow",gO="block",Uy="quoted";function Upe(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===gO&&(h=gH(t,h,e.length),h!==-1&&(d=h+c));for(let S;S=t[h+=1];){if(r===Uy&&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===gO&&(h=gH(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===Uy){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 Xn=Dt(),Jo=yH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function qpe(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 Sf(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(By(t)?" ":""),s="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(s+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{s+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:u.substr(0,2)==="00"?s+="\\x"+u.substr(2):s+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length{"use strict";var TRe="flow",gD="block",Jx="quoted";function ORe(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,s)?l.push(0):d=i-n);let p,f,h=!1,m=-1,y=-1,v=-1;r===gD&&(m=vJ(t,m,e.length),m!==-1&&(d=m+c));for(let b;b=t[m+=1];){if(r===Jx&&b==="\\"){switch(y=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}v=m}if(b===` +`)r===gD&&(m=vJ(t,m,e.length)),d=m+e.length+c,p=void 0;else{if(b===" "&&f&&f!==" "&&f!==` +`&&f!==" "){let w=t[m+1];w&&w!==" "&&w!==` +`&&w!==" "&&(p=m)}if(m>=d)if(p)l.push(p),d=p+c,p=void 0;else if(r===Jx){for(;f===" "||f===" ";)f=b,b=t[m+=1],h=!0;let w=m>v+1?m-2:y-1;if(u[w])return t;l.push(w),u[w]=!0,d=w+c,p=void 0}else h=!0}f=b}if(h&&a&&a(),l.length===0)return t;o&&o();let g=t.slice(0,l[0]);for(let b=0;b{"use strict";var zs=Rr(),Dc=_J(),Yx=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Xx=t=>/^(%|---|\.\.\.)/m.test(t);function NRe(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let s=0,o=0;sn)return!0;if(o=s+1,i-o<=n)return!1}return!0}function Sy(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(Xx(t)?" ":""),o="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{o+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=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(_O,`$&${l}`));let h=!1,g,b=-1;for(g=0;g{R=!0});let O=Jo.foldFlowLines(`${_}${w}${p}`,l,Jo.FOLD_BLOCK,A);if(!R)return`>${x} -${l}${O}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function Hpe(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 al(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` -`)?al(o,e):qy(t,e,r,n);if(!a&&!u&&i!==Xn.Scalar.PLAIN&&o.includes(` -`))return qy(t,e,r,n);if(By(o)){if(c==="")return e.forceBlockIndent=!0,qy(t,e,r,n);if(a&&c===l)return al(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 al(o,e)}return a?d:Jo.foldFlowLines(d,c,Jo.FOLD_FLOW,Hy(e,!1))}function Bpe(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!==Xn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=Xn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Xn.Scalar.BLOCK_FOLDED:case Xn.Scalar.BLOCK_LITERAL:return i||o?al(s.value,e):qy(s,e,r,n);case Xn.Scalar.QUOTE_DOUBLE:return Sf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return yO(s.value,e);case Xn.Scalar.PLAIN:return Hpe(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}_H.stringifyString=Bpe});var xf=v(bO=>{"use strict";var Gpe=Ny(),Yo=De(),Zpe=bf(),Vpe=wf();function Wpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Zpe.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 Kpe(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(Yo.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 Jpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Yo.isScalar(t)||Yo.isCollection(t))&&t.anchor;o&&Gpe.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 Ype(t,e,r,n){if(Yo.isPair(t))return t.toString(e,r,n);if(Yo.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=Yo.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=Kpe(e.doc.schema.tags,o));let s=Jpe(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):Yo.isScalar(o)?Vpe.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Yo.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s} -${e.indent}${a}`:a}bO.createStringifyContext=Wpe;bO.stringify=Ype});var wH=v(SH=>{"use strict";var go=De(),bH=Dt(),vH=xf(),$f=bf();function Xpe({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=go.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(go.isCollection(t)||!go.isNode(t)&&typeof t=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||go.isCollection(t)||(go.isScalar(t)?t.type===bH.Scalar.BLOCK_FOLDED||t.type===bH.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=vH.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+=$f.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=$f.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=$f.lineComment(g,r.indent,l(f))));let b,_,S;go.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&&go.isScalar(e)&&(r.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&go.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let x=!1,w=vH.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` -`:"",_){let A=l(_);R+=` -${$f.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` -`&&S&&(R=` - -`):R+=` -${r.indent}`}else if(!p&&go.isCollection(e)){let A=w[0],O=w.indexOf(` -`),D=O!==-1,E=r.inFlow??e.flow??e.items.length===0;if(D||!E){let ae=!1;if(D&&(A==="&"||A==="!")){let X=w.indexOf(" ");A==="&"&&X!==-1&&X{"use strict";var xH=Ze("process");function Qpe(t,...e){t==="debug"&&console.log(...e)}function eme(t,e){(t==="debug"||t==="warn")&&(typeof xH.emitWarning=="function"?xH.emitWarning(e):console.warn(e))}vO.debug=Qpe;vO.warn=eme});var Ky=v(Wy=>{"use strict";var Vy=De(),$H=Dt(),Gy="<<",Zy={identify:t=>t===Gy||typeof t=="symbol"&&t.description===Gy,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new $H.Scalar(Symbol(Gy)),{addToJSMap:kH}),stringify:()=>Gy},tme=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===$H.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function kH(t,e,r){let n=EH(t,r);if(Vy.isSeq(n))for(let i of n.items)wO(t,e,i);else if(Array.isArray(n))for(let i of n)wO(t,e,i);else wO(t,e,n)}function wO(t,e,r){let n=EH(t,r);if(!Vy.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 EH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=kH;Wy.isMergeKey=tme;Wy.merge=Zy});var $O=v(TH=>{"use strict";var rme=SO(),AH=Ky(),nme=xf(),OH=De(),xO=Wo();function ime(t,e,{key:r,value:n}){if(OH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(AH.isMergeKey(t,r))AH.addMergeToJSMap(t,e,n);else{let i=xO.toJS(r,"",t);if(e instanceof Map)e.set(i,xO.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=ome(r,i,t),s=xO.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 ome(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(OH.isNode(t)&&r?.doc){let n=nme.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)+'..."'),rme.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)}TH.addPairToJSMap=ime});var Xo=v(kO=>{"use strict";var RH=_f(),sme=wH(),ame=$O(),Jy=De();function cme(t,e,r){let n=RH.createNode(t,void 0,r),i=RH.createNode(e,void 0,r);return new Yy(n,i)}var Yy=class t{constructor(e,r=null){Object.defineProperty(this,Jy.NODE_TYPE,{value:Jy.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Jy.isNode(r)&&(r=r.clone(e)),Jy.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return ame.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?sme.stringifyPair(this,e,r,n):JSON.stringify(this)}};kO.Pair=Yy;kO.createPair=cme});var EO=v(PH=>{"use strict";var ga=De(),IH=xf(),Xy=bf();function lme(t,e,r){return(e.inFlow??t.flow?dme:ume)(t,e,r)}function ume({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+=Xy.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+=Xy.lineComment(b,n,a(g))),d.push(b),u=d.length}let{start:f,end:p}=r;if(d.length===0)return f+p;if(!l){let m=d.reduce((h,g)=>h+g.length+2,2);l=e.options.lineWidth>0&&m>e.options.lineWidth}if(l){let m=f;for(let h of d)m+=h?` -${o}${i}${h}`:` -`;return`${m} -${i}${p}`}else return`${f}${s}${d.join(" ")}${s}${p}`}function Qy({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=Xy.indentComment(e(n),t);r.push(o.trimStart())}}PH.stringifyCollection=lme});var es=v(OO=>{"use strict";var fme=EO(),pme=$O(),mme=Ly(),Qo=De(),e_=Xo(),hme=Dt();function kf(t,e){let r=Qo.isScalar(e)?e.value:e;for(let n of t)if(Qo.isPair(n)&&(n.key===e||n.key===r||Qo.isScalar(n.key)&&n.key.value===r))return n}var AO=class extends mme.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Qo.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(e_.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;Qo.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new e_.Pair(e,e?.value):n=new e_.Pair(e.key,e.value);let i=kf(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Qo.isScalar(i.value)&&hme.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=kf(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=kf(this.items,e)?.value;return(!r&&Qo.isScalar(i)?i.value:i)??void 0}has(e){return!!kf(this.items,e)}set(e,r){this.add(new e_.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)pme.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Qo.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})),fme.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};OO.YAMLMap=AO;OO.findPair=kf});var cl=v(DH=>{"use strict";var gme=De(),CH=es(),yme={collection:"map",default:!0,nodeClass:CH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return gme.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>CH.YAMLMap.from(t,e,r)};DH.map=yme});var ts=v(NH=>{"use strict";var _me=_f(),bme=EO(),vme=Ly(),r_=De(),Sme=Dt(),wme=Wo(),TO=class extends vme.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(r_.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=t_(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=t_(e);if(typeof n!="number")return;let i=this.items[n];return!r&&r_.isScalar(i)?i.value:i}has(e){let r=t_(e);return typeof r=="number"&&r=0?e:null}NH.YAMLSeq=TO});var ll=v(MH=>{"use strict";var xme=De(),jH=ts(),$me={collection:"seq",default:!0,nodeClass:jH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return xme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>jH.YAMLSeq.from(t,e,r)};MH.seq=$me});var Ef=v(FH=>{"use strict";var kme=wf(),Eme={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),kme.stringifyString(t,e,r,n)}};FH.string=Eme});var n_=v(UH=>{"use strict";var LH=Dt(),zH={identify:t=>t==null,createNode:()=>new LH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new LH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&zH.test.test(t)?t:e.options.nullStr};UH.nullTag=zH});var RO=v(HH=>{"use strict";var Ame=Dt(),qH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ame.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&qH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};HH.boolTag=qH});var ul=v(BH=>{"use strict";function Ome({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}BH.stringifyNumber=Ome});var PO=v(i_=>{"use strict";var Tme=Dt(),IO=ul(),Rme={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:IO.stringifyNumber},Ime={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():IO.stringifyNumber(t)}},Pme={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 Tme.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:IO.stringifyNumber};i_.float=Pme;i_.floatExp=Ime;i_.floatNaN=Rme});var DO=v(s_=>{"use strict";var GH=ul(),o_=t=>typeof t=="bigint"||Number.isInteger(t),CO=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function ZH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):GH.stringifyNumber(t)}var Cme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>CO(t,2,8,r),stringify:t=>ZH(t,8,"0o")},Dme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>CO(t,0,10,r),stringify:GH.stringifyNumber},Nme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>CO(t,2,16,r),stringify:t=>ZH(t,16,"0x")};s_.int=Dme;s_.intHex=Nme;s_.intOct=Cme});var WH=v(VH=>{"use strict";var jme=cl(),Mme=n_(),Fme=ll(),Lme=Ef(),zme=RO(),NO=PO(),jO=DO(),Ume=[jme.map,Fme.seq,Lme.string,Mme.nullTag,zme.boolTag,jO.intOct,jO.int,jO.intHex,NO.floatNaN,NO.floatExp,NO.float];VH.schema=Ume});var YH=v(JH=>{"use strict";var qme=Dt(),Hme=cl(),Bme=ll();function KH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Gme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new qme.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:a_},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:a_},{identify:KH,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})=>KH(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:a_}],Zme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Vme=[Hme.map,Bme.seq].concat(Gme,Zme);JH.schema=Vme});var FO=v(XH=>{"use strict";var Af=Ze("buffer"),MO=Dt(),Wme=wf(),Kme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Af.Buffer=="function")return Af.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 c_=De(),LO=Xo(),Jme=Dt(),Yme=ts();function QH(t,e){if(c_.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new LO.Pair(new Jme.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]=c_.isPair(n)?n:new LO.Pair(n)}}else e("Expected a sequence for this tag");return t}function e6(t,e,r){let{replacer:n}=r,i=new Yme.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(LO.createPair(a,c,r))}return i}var Xme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:QH,createNode:e6};l_.createPairs=e6;l_.pairs=Xme;l_.resolvePairs=QH});var qO=v(UO=>{"use strict";var t6=De(),zO=Wo(),Of=es(),Qme=ts(),r6=u_(),ya=class t extends Qme.YAMLSeq{constructor(){super(),this.add=Of.YAMLMap.prototype.add.bind(this),this.delete=Of.YAMLMap.prototype.delete.bind(this),this.get=Of.YAMLMap.prototype.get.bind(this),this.has=Of.YAMLMap.prototype.has.bind(this),this.set=Of.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(t6.isPair(i)?(o=zO.toJS(i.key,"",r),s=zO.toJS(i.value,o,r)):o=zO.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=r6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ya.tag="tag:yaml.org,2002:omap";var ehe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ya,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=r6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)t6.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new ya,r)},createNode:(t,e,r)=>ya.from(t,e,r)};UO.YAMLOMap=ya;UO.omap=ehe});var a6=v(HO=>{"use strict";var n6=Dt();function i6({value:t,source:e},r){return e&&(t?o6:s6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var o6={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:i6},s6={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:i6};HO.falseTag=s6;HO.trueTag=o6});var c6=v(d_=>{"use strict";var the=Dt(),BO=ul(),rhe={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:BO.stringifyNumber},nhe={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():BO.stringifyNumber(t)}},ihe={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 the.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:BO.stringifyNumber};d_.float=ihe;d_.floatExp=nhe;d_.floatNaN=rhe});var u6=v(Rf=>{"use strict";var l6=ul(),Tf=t=>typeof t=="bigint"||Number.isInteger(t);function f_(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 GO(t,e,r){let{value:n}=t;if(Tf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return l6.stringifyNumber(t)}var ohe={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>f_(t,2,2,r),stringify:t=>GO(t,2,"0b")},she={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>f_(t,1,8,r),stringify:t=>GO(t,8,"0")},ahe={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>f_(t,0,10,r),stringify:l6.stringifyNumber},che={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>f_(t,2,16,r),stringify:t=>GO(t,16,"0x")};Rf.int=ahe;Rf.intBin=ohe;Rf.intHex=che;Rf.intOct=she});var VO=v(ZO=>{"use strict";var h_=De(),p_=Xo(),m_=es(),_a=class t extends m_.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;h_.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new p_.Pair(e.key,null):r=new p_.Pair(e,null),m_.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=m_.findPair(this.items,e);return!r&&h_.isPair(n)?h_.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=m_.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new p_.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(p_.createPair(s,null,n));return o}};_a.tag="tag:yaml.org,2002:set";var lhe={collection:"map",identify:t=>t instanceof Set,nodeClass:_a,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>_a.from(t,e,r),resolve(t,e){if(h_.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new _a,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};ZO.YAMLSet=_a;ZO.set=lhe});var KO=v(g_=>{"use strict";var uhe=ul();function WO(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 d6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return uhe.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 dhe={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})=>WO(t,r),stringify:d6},fhe={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=>WO(t,!1),stringify:d6},f6={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(f6.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=WO(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$/,"")??""};g_.floatTime=fhe;g_.intTime=dhe;g_.timestamp=f6});var h6=v(m6=>{"use strict";var phe=cl(),mhe=n_(),hhe=ll(),ghe=Ef(),yhe=FO(),p6=a6(),JO=c6(),y_=u6(),_he=Ky(),bhe=qO(),vhe=u_(),She=VO(),YO=KO(),whe=[phe.map,hhe.seq,ghe.string,mhe.nullTag,p6.trueTag,p6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,JO.floatNaN,JO.floatExp,JO.float,yhe.binary,_he.merge,bhe.omap,vhe.pairs,She.set,YO.intTime,YO.floatTime,YO.timestamp];m6.schema=whe});var k6=v(eT=>{"use strict";var b6=cl(),xhe=n_(),v6=ll(),$he=Ef(),khe=RO(),XO=PO(),QO=DO(),Ehe=WH(),Ahe=YH(),S6=FO(),If=Ky(),w6=qO(),x6=u_(),g6=h6(),$6=VO(),__=KO(),y6=new Map([["core",Ehe.schema],["failsafe",[b6.map,v6.seq,$he.string]],["json",Ahe.schema],["yaml11",g6.schema],["yaml-1.1",g6.schema]]),_6={binary:S6.binary,bool:khe.boolTag,float:XO.float,floatExp:XO.floatExp,floatNaN:XO.floatNaN,floatTime:__.floatTime,int:QO.int,intHex:QO.intHex,intOct:QO.intOct,intTime:__.intTime,map:b6.map,merge:If.merge,null:xhe.nullTag,omap:w6.omap,pairs:x6.pairs,seq:v6.seq,set:$6.set,timestamp:__.timestamp},Ohe={"tag:yaml.org,2002:binary":S6.binary,"tag:yaml.org,2002:merge":If.merge,"tag:yaml.org,2002:omap":w6.omap,"tag:yaml.org,2002:pairs":x6.pairs,"tag:yaml.org,2002:set":$6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function The(t,e,r){let n=y6.get(e);if(n&&!t)return r&&!n.includes(If.merge)?n.concat(If.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(y6.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(If.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?_6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(_6).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},[])}eT.coreKnownTags=Ohe;eT.getTags=The});var nT=v(E6=>{"use strict";var tT=De(),Rhe=cl(),Ihe=ll(),Phe=Ef(),b_=k6(),Che=(t,e)=>t.keye.key?1:0,rT=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?b_.getTags(e,"compat"):e?b_.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?b_.coreKnownTags:{},this.tags=b_.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,tT.MAP,{value:Rhe.map}),Object.defineProperty(this,tT.SCALAR,{value:Phe.string}),Object.defineProperty(this,tT.SEQ,{value:Ihe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Che:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};E6.Schema=rT});var O6=v(A6=>{"use strict";var Dhe=De(),iT=xf(),Pf=bf();function Nhe(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=iT.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Pf.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Dhe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Pf.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=iT.stringify(t.contents,i,()=>a=null,c);a&&(l+=Pf.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(iT.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(Pf.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(Pf.indentComment(o(c),"")))}return r.join(` +`;let d,p;for(p=r.length;p>0;--p){let x=r[p-1];if(x!==` +`&&x!==" "&&x!==" ")break}let f=r.substring(p),h=f.indexOf(` +`);h===-1?d="-":r===f||h!==f.length-1?(d="+",s&&s()):d="",f&&(r=r.slice(0,-f.length),f[f.length-1]===` +`&&(f=f.slice(0,-1)),f=f.replace(bD,`$&${l}`));let m=!1,y,v=-1;for(y=0;y{$=!0});let E=Dc.foldFlowLines(`${g}${x}${f}`,l,Dc.FOLD_BLOCK,I);if(!$)return`>${w} +${l}${E}`}return r=r.replace(/\n+/g,`$&${l}`),`|${w} +${l}${g}${r}${f}`}function DRe(t,e,r,n){let{type:i,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&s.includes(` +`)||u&&/[[\]{},]/.test(s))return Xp(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||u||!s.includes(` +`)?Xp(s,e):Kx(t,e,r,n);if(!a&&!u&&i!==zs.Scalar.PLAIN&&s.includes(` +`))return Kx(t,e,r,n);if(Xx(s)){if(c==="")return e.forceBlockIndent=!0,Kx(t,e,r,n);if(a&&c===l)return Xp(s,e)}let d=s.replace(/\n+/g,`$& +${c}`);if(o){let p=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(d),{compat:f,tags:h}=e.doc.schema;if(h.some(p)||f?.some(p))return Xp(s,e)}return a?d:Dc.foldFlowLines(d,c,Dc.FOLD_FLOW,Yx(e,!1))}function jRe(t,e,r,n){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==zs.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=zs.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case zs.Scalar.BLOCK_FOLDED:case zs.Scalar.BLOCK_LITERAL:return i||s?Xp(o.value,e):Kx(o,e,r,n);case zs.Scalar.QUOTE_DOUBLE:return Sy(o.value,e);case zs.Scalar.QUOTE_SINGLE:return yD(o.value,e);case zs.Scalar.PLAIN:return DRe(o,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,p=i&&u||d;if(l=c(p),l===null)throw new Error(`Unsupported default string type ${p}`)}return l}SJ.stringifyString=jRe});var xy=k(vD=>{"use strict";var LRe=qx(),jc=pt(),MRe=vy(),FRe=wy();function zRe(t,e){let r=Object.assign({blockQuote:!0,commentString:MRe.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 URe(t,e){if(e.tag){let i=t.filter(s=>s.tag===e.tag);if(i.length>0)return i.find(s=>s.format===e.format)??i[0]}let r,n;if(jc.isScalar(e)){n=e.value;let i=t.filter(s=>s.identify?.(n));if(i.length>1){let s=i.filter(o=>o.test);s.length>0&&(i=s)}r=i.find(s=>s.format===e.format)??i.find(s=>!s.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 BRe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],s=(jc.isScalar(t)||jc.isCollection(t))&&t.anchor;s&&LRe.anchorIsValid(s)&&(r.add(s),i.push(`&${s}`));let o=t.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function qRe(t,e,r,n){if(jc.isPair(t))return t.toString(e,r,n);if(jc.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,s=jc.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=URe(e.doc.schema.tags,s));let o=BRe(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(s,e,r,n):jc.isScalar(s)?FRe.stringifyString(s,e,r,n):s.toString(e,r,n);return o?jc.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} +${e.indent}${a}`:a}vD.createStringifyContext=zRe;vD.stringify=qRe});var EJ=k(kJ=>{"use strict";var Ca=pt(),wJ=Rr(),xJ=xy(),ky=vy();function VRe({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,p=Ca.isNode(t)&&t.comment||null;if(d){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(Ca.isCollection(t)||!Ca.isNode(t)&&typeof t=="object"){let I="With simple keys, collection cannot be used as a key value";throw new Error(I)}}let f=!d&&(!t||p&&e==null&&!r.inFlow||Ca.isCollection(t)||(Ca.isScalar(t)?t.type===wJ.Scalar.BLOCK_FOLDED||t.type===wJ.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!f&&(d||!s),indent:a+c});let h=!1,m=!1,y=xJ.stringify(t,r,()=>h=!0,()=>m=!0);if(!f&&!r.inFlow&&y.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");f=!0}if(r.inFlow){if(s||e==null)return h&&n&&n(),y===""?"?":f?`? ${y}`:y}else if(s&&!d||e==null&&f)return y=`? ${y}`,p&&!h?y+=ky.lineComment(y,r.indent,l(p)):m&&i&&i(),y;h&&(p=null),f?(p&&(y+=ky.lineComment(y,r.indent,l(p))),y=`? ${y} +${a}:`):(y=`${y}:`,p&&(y+=ky.lineComment(y,r.indent,l(p))));let v,g,b;Ca.isNode(e)?(v=!!e.spaceBefore,g=e.commentBefore,b=e.comment):(v=!1,g=null,b=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!f&&!p&&Ca.isScalar(e)&&(r.indentAtStart=y.length+1),m=!1,!u&&c.length>=2&&!r.inFlow&&!f&&Ca.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let w=!1,x=xJ.stringify(e,r,()=>w=!0,()=>m=!0),$=" ";if(p||v||g){if($=v?` +`:"",g){let I=l(g);$+=` +${ky.indentComment(I,r.indent)}`}x===""&&!r.inFlow?$===` +`&&b&&($=` + +`):$+=` +${r.indent}`}else if(!f&&Ca.isCollection(e)){let I=x[0],E=x.indexOf(` +`),R=E!==-1,A=r.inFlow??e.flow??e.items.length===0;if(R||!A){let B=!1;if(R&&(I==="&"||I==="!")){let Z=x.indexOf(" ");I==="&"&&Z!==-1&&Z{"use strict";var AJ=Ot("process");function GRe(t,...e){t==="debug"&&console.log(...e)}function HRe(t,e){(t==="debug"||t==="warn")&&(typeof AJ.emitWarning=="function"?AJ.emitWarning(e):console.warn(e))}_D.debug=GRe;_D.warn=HRe});var n0=k(r0=>{"use strict";var t0=pt(),$J=Rr(),Qx="<<",e0={identify:t=>t===Qx||typeof t=="symbol"&&t.description===Qx,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new $J.Scalar(Symbol(Qx)),{addToJSMap:IJ}),stringify:()=>Qx},WRe=(t,e)=>(e0.identify(e)||t0.isScalar(e)&&(!e.type||e.type===$J.Scalar.PLAIN)&&e0.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===e0.tag&&r.default);function IJ(t,e,r){let n=PJ(t,r);if(t0.isSeq(n))for(let i of n.items)wD(t,e,i);else if(Array.isArray(n))for(let i of n)wD(t,e,i);else wD(t,e,n)}function wD(t,e,r){let n=PJ(t,r);if(!t0.isMap(n))throw new Error("Merge sources must be maps or map aliases");let i=n.toJSON(null,t,Map);for(let[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function PJ(t,e){return t&&t0.isAlias(e)?e.resolve(t.doc,t):e}r0.addMergeToJSMap=IJ;r0.isMergeKey=WRe;r0.merge=e0});var kD=k(TJ=>{"use strict";var ZRe=SD(),RJ=n0(),JRe=xy(),CJ=pt(),xD=Oc();function KRe(t,e,{key:r,value:n}){if(CJ.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(RJ.isMergeKey(t,r))RJ.addMergeToJSMap(t,e,n);else{let i=xD.toJS(r,"",t);if(e instanceof Map)e.set(i,xD.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let s=YRe(r,i,t),o=xD.toJS(n,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function YRe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(CJ.isNode(t)&&r?.doc){let n=JRe.createStringifyContext(r.doc,{});n.anchors=new Set;for(let s of r.anchors.keys())n.anchors.add(s.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=t.toString(n);if(!r.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),ZRe.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return i}return JSON.stringify(e)}TJ.addPairToJSMap=KRe});var Lc=k(ED=>{"use strict";var OJ=by(),XRe=EJ(),QRe=kD(),i0=pt();function eCe(t,e,r){let n=OJ.createNode(t,void 0,r),i=OJ.createNode(e,void 0,r);return new s0(n,i)}var s0=class t{constructor(e,r=null){Object.defineProperty(this,i0.NODE_TYPE,{value:i0.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return i0.isNode(r)&&(r=r.clone(e)),i0.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return QRe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?XRe.stringifyPair(this,e,r,n):JSON.stringify(this)}};ED.Pair=s0;ED.createPair=eCe});var AD=k(DJ=>{"use strict";var ku=pt(),NJ=xy(),o0=vy();function tCe(t,e,r){return(e.inFlow??t.flow?nCe:rCe)(t,e,r)}function rCe({comment:t,items:e},r,{blockItemPrefix:n,flowChars:i,itemIndent:s,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:l}}=r,u=Object.assign({},r,{indent:s,type:null}),d=!1,p=[];for(let h=0;hy=null,()=>d=!0);y&&(v+=o0.lineComment(v,s,l(y))),d&&y&&(d=!1),p.push(n+v)}let f;if(p.length===0)f=i.start+i.end;else{f=p[0];for(let h=1;hy=null);l||(l=d.length>u||v.includes(` +`)),h0&&(l||(l=d.reduce((g,b)=>g+b.length+2,2)+(v.length+2)>e.options.lineWidth)),l&&(v+=",")),y&&(v+=o0.lineComment(v,n,a(y))),d.push(v),u=d.length}let{start:p,end:f}=r;if(d.length===0)return p+f;if(!l){let h=d.reduce((m,y)=>m+y.length+2,2);l=e.options.lineWidth>0&&h>e.options.lineWidth}if(l){let h=p;for(let m of d)h+=m?` +${s}${i}${m}`:` +`;return`${h} +${i}${f}`}else return`${p}${o}${d.join(" ")}${o}${f}`}function a0({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let s=o0.indentComment(e(n),t);r.push(s.trimStart())}}DJ.stringifyCollection=tCe});var Fc=k(ID=>{"use strict";var iCe=AD(),sCe=kD(),oCe=Wx(),Mc=pt(),c0=Lc(),aCe=Rr();function Ey(t,e){let r=Mc.isScalar(e)?e.value:e;for(let n of t)if(Mc.isPair(n)&&(n.key===e||n.key===r||Mc.isScalar(n.key)&&n.key.value===r))return n}var $D=class extends oCe.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Mc.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:i,replacer:s}=n,o=new this(e),a=(c,l)=>{if(typeof s=="function")l=s.call(r,c,l);else if(Array.isArray(s)&&!s.includes(c))return;(l!==void 0||i)&&o.items.push(c0.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"&&o.items.sort(e.sortMapEntries),o}add(e,r){let n;Mc.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new c0.Pair(e,e?.value):n=new c0.Pair(e.key,e.value);let i=Ey(this.items,n.key),s=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Mc.isScalar(i.value)&&aCe.isScalarValue(n.value)?i.value.value=n.value:i.value=n.value}else if(s){let o=this.items.findIndex(a=>s(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){let r=Ey(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Ey(this.items,e)?.value;return(!r&&Mc.isScalar(i)?i.value:i)??void 0}has(e){return!!Ey(this.items,e)}set(e,r){this.add(new c0.Pair(e,r),!0)}toJSON(e,r,n){let i=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(i);for(let s of this.items)sCe.addPairToJSMap(r,i,s);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Mc.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})),iCe.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};ID.YAMLMap=$D;ID.findPair=Ey});var Qp=k(LJ=>{"use strict";var cCe=pt(),jJ=Fc(),lCe={collection:"map",default:!0,nodeClass:jJ.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return cCe.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>jJ.YAMLMap.from(t,e,r)};LJ.map=lCe});var zc=k(MJ=>{"use strict";var uCe=by(),dCe=AD(),pCe=Wx(),u0=pt(),fCe=Rr(),hCe=Oc(),PD=class extends pCe.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(u0.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=l0(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=l0(e);if(typeof n!="number")return;let i=this.items[n];return!r&&u0.isScalar(i)?i.value:i}has(e){let r=l0(e);return typeof r=="number"&&r=0?e:null}MJ.YAMLSeq=PD});var ef=k(zJ=>{"use strict";var mCe=pt(),FJ=zc(),gCe={collection:"seq",default:!0,nodeClass:FJ.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return mCe.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>FJ.YAMLSeq.from(t,e,r)};zJ.seq=gCe});var Ay=k(UJ=>{"use strict";var yCe=wy(),bCe={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),yCe.stringifyString(t,e,r,n)}};UJ.string=bCe});var d0=k(VJ=>{"use strict";var BJ=Rr(),qJ={identify:t=>t==null,createNode:()=>new BJ.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new BJ.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&qJ.test.test(t)?t:e.options.nullStr};VJ.nullTag=qJ});var RD=k(HJ=>{"use strict";var vCe=Rr(),GJ={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new vCe.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&GJ.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};HJ.boolTag=GJ});var tf=k(WJ=>{"use strict";function _Ce({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 s=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}WJ.stringifyNumber=_Ce});var TD=k(p0=>{"use strict";var SCe=Rr(),CD=tf(),wCe={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:CD.stringifyNumber},xCe={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():CD.stringifyNumber(t)}},kCe={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 SCe.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:CD.stringifyNumber};p0.float=kCe;p0.floatExp=xCe;p0.floatNaN=wCe});var ND=k(h0=>{"use strict";var ZJ=tf(),f0=t=>typeof t=="bigint"||Number.isInteger(t),OD=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function JJ(t,e,r){let{value:n}=t;return f0(n)&&n>=0?r+n.toString(e):ZJ.stringifyNumber(t)}var ECe={identify:t=>f0(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>OD(t,2,8,r),stringify:t=>JJ(t,8,"0o")},ACe={identify:f0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>OD(t,0,10,r),stringify:ZJ.stringifyNumber},$Ce={identify:t=>f0(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>OD(t,2,16,r),stringify:t=>JJ(t,16,"0x")};h0.int=ACe;h0.intHex=$Ce;h0.intOct=ECe});var YJ=k(KJ=>{"use strict";var ICe=Qp(),PCe=d0(),RCe=ef(),CCe=Ay(),TCe=RD(),DD=TD(),jD=ND(),OCe=[ICe.map,RCe.seq,CCe.string,PCe.nullTag,TCe.boolTag,jD.intOct,jD.int,jD.intHex,DD.floatNaN,DD.floatExp,DD.float];KJ.schema=OCe});var eK=k(QJ=>{"use strict";var NCe=Rr(),DCe=Qp(),jCe=ef();function XJ(t){return typeof t=="bigint"||Number.isInteger(t)}var m0=({value:t})=>JSON.stringify(t),LCe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:m0},{identify:t=>t==null,createNode:()=>new NCe.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:m0},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:m0},{identify:XJ,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})=>XJ(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:m0}],MCe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},FCe=[DCe.map,jCe.seq].concat(LCe,MCe);QJ.schema=FCe});var MD=k(tK=>{"use strict";var $y=Ot("buffer"),LD=Rr(),zCe=wy(),UCe={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof $y.Buffer=="function")return $y.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 g0=pt(),FD=Lc(),BCe=Rr(),qCe=zc();function rK(t,e){if(g0.isSeq(t))for(let r=0;r1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new FD.Pair(new BCe.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore} +${i.key.commentBefore}`:n.commentBefore),n.comment){let s=i.value??i.key;s.comment=s.comment?`${n.comment} +${s.comment}`:n.comment}n=i}t.items[r]=g0.isPair(n)?n:new FD.Pair(n)}}else e("Expected a sequence for this tag");return t}function nK(t,e,r){let{replacer:n}=r,i=new qCe.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;i.items.push(FD.createPair(a,c,r))}return i}var VCe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:rK,createNode:nK};y0.createPairs=nK;y0.pairs=VCe;y0.resolvePairs=rK});var BD=k(UD=>{"use strict";var iK=pt(),zD=Oc(),Iy=Fc(),GCe=zc(),sK=b0(),Eu=class t extends GCe.YAMLSeq{constructor(){super(),this.add=Iy.YAMLMap.prototype.add.bind(this),this.delete=Iy.YAMLMap.prototype.delete.bind(this),this.get=Iy.YAMLMap.prototype.get.bind(this),this.has=Iy.YAMLMap.prototype.has.bind(this),this.set=Iy.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 s,o;if(iK.isPair(i)?(s=zD.toJS(i.key,"",r),o=zD.toJS(i.value,s,r)):s=zD.toJS(i,"",r),n.has(s))throw new Error("Ordered maps must not include duplicate keys");n.set(s,o)}return n}static from(e,r,n){let i=sK.createPairs(e,r,n),s=new this;return s.items=i.items,s}};Eu.tag="tag:yaml.org,2002:omap";var HCe={collection:"seq",identify:t=>t instanceof Map,nodeClass:Eu,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=sK.resolvePairs(t,e),n=[];for(let{key:i}of r.items)iK.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Eu,r)},createNode:(t,e,r)=>Eu.from(t,e,r)};UD.YAMLOMap=Eu;UD.omap=HCe});var uK=k(qD=>{"use strict";var oK=Rr();function aK({value:t,source:e},r){return e&&(t?cK:lK).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var cK={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 oK.Scalar(!0),stringify:aK},lK={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 oK.Scalar(!1),stringify:aK};qD.falseTag=lK;qD.trueTag=cK});var dK=k(v0=>{"use strict";var WCe=Rr(),VD=tf(),ZCe={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:VD.stringifyNumber},JCe={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():VD.stringifyNumber(t)}},KCe={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 WCe.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:VD.stringifyNumber};v0.float=KCe;v0.floatExp=JCe;v0.floatNaN=ZCe});var fK=k(Ry=>{"use strict";var pK=tf(),Py=t=>typeof t=="bigint"||Number.isInteger(t);function _0(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 o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let s=parseInt(t,r);return i==="-"?-1*s:s}function GD(t,e,r){let{value:n}=t;if(Py(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return pK.stringifyNumber(t)}var YCe={identify:Py,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>_0(t,2,2,r),stringify:t=>GD(t,2,"0b")},XCe={identify:Py,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>_0(t,1,8,r),stringify:t=>GD(t,8,"0")},QCe={identify:Py,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>_0(t,0,10,r),stringify:pK.stringifyNumber},eTe={identify:Py,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>_0(t,2,16,r),stringify:t=>GD(t,16,"0x")};Ry.int=QCe;Ry.intBin=YCe;Ry.intHex=eTe;Ry.intOct=XCe});var WD=k(HD=>{"use strict";var x0=pt(),S0=Lc(),w0=Fc(),Au=class t extends w0.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;x0.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new S0.Pair(e.key,null):r=new S0.Pair(e,null),w0.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=w0.findPair(this.items,e);return!r&&x0.isPair(n)?x0.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=w0.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new S0.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,s=new this(e);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof i=="function"&&(o=i.call(r,o,o)),s.items.push(S0.createPair(o,null,n));return s}};Au.tag="tag:yaml.org,2002:set";var tTe={collection:"map",identify:t=>t instanceof Set,nodeClass:Au,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Au.from(t,e,r),resolve(t,e){if(x0.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Au,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};HD.YAMLSet=Au;HD.set=tTe});var JD=k(k0=>{"use strict";var rTe=tf();function ZD(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return r==="-"?i(-1)*s:s}function hK(t){let{value:e}=t,r=o=>o;if(typeof e=="bigint")r=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return rTe.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),n+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var nTe={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})=>ZD(t,r),stringify:hK},iTe={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=>ZD(t,!1),stringify:hK},mK={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(mK.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,s||0,o||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=ZD(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$/,"")??""};k0.floatTime=iTe;k0.intTime=nTe;k0.timestamp=mK});var bK=k(yK=>{"use strict";var sTe=Qp(),oTe=d0(),aTe=ef(),cTe=Ay(),lTe=MD(),gK=uK(),KD=dK(),E0=fK(),uTe=n0(),dTe=BD(),pTe=b0(),fTe=WD(),YD=JD(),hTe=[sTe.map,aTe.seq,cTe.string,oTe.nullTag,gK.trueTag,gK.falseTag,E0.intBin,E0.intOct,E0.int,E0.intHex,KD.floatNaN,KD.floatExp,KD.float,lTe.binary,uTe.merge,dTe.omap,pTe.pairs,fTe.set,YD.intTime,YD.floatTime,YD.timestamp];yK.schema=hTe});var IK=k(ej=>{"use strict";var wK=Qp(),mTe=d0(),xK=ef(),gTe=Ay(),yTe=RD(),XD=TD(),QD=ND(),bTe=YJ(),vTe=eK(),kK=MD(),Cy=n0(),EK=BD(),AK=b0(),vK=bK(),$K=WD(),A0=JD(),_K=new Map([["core",bTe.schema],["failsafe",[wK.map,xK.seq,gTe.string]],["json",vTe.schema],["yaml11",vK.schema],["yaml-1.1",vK.schema]]),SK={binary:kK.binary,bool:yTe.boolTag,float:XD.float,floatExp:XD.floatExp,floatNaN:XD.floatNaN,floatTime:A0.floatTime,int:QD.int,intHex:QD.intHex,intOct:QD.intOct,intTime:A0.intTime,map:wK.map,merge:Cy.merge,null:mTe.nullTag,omap:EK.omap,pairs:AK.pairs,seq:xK.seq,set:$K.set,timestamp:A0.timestamp},_Te={"tag:yaml.org,2002:binary":kK.binary,"tag:yaml.org,2002:merge":Cy.merge,"tag:yaml.org,2002:omap":EK.omap,"tag:yaml.org,2002:pairs":AK.pairs,"tag:yaml.org,2002:set":$K.set,"tag:yaml.org,2002:timestamp":A0.timestamp};function STe(t,e,r){let n=_K.get(e);if(n&&!t)return r&&!n.includes(Cy.merge)?n.concat(Cy.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(_K.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Cy.merge)),i.reduce((s,o)=>{let a=typeof o=="string"?SK[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(SK).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}ej.coreKnownTags=_Te;ej.getTags=STe});var nj=k(PK=>{"use strict";var tj=pt(),wTe=Qp(),xTe=ef(),kTe=Ay(),$0=IK(),ETe=(t,e)=>t.keye.key?1:0,rj=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?$0.getTags(e,"compat"):e?$0.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?$0.coreKnownTags:{},this.tags=$0.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,tj.MAP,{value:wTe.map}),Object.defineProperty(this,tj.SCALAR,{value:kTe.string}),Object.defineProperty(this,tj.SEQ,{value:xTe.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?ETe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};PK.Schema=rj});var CK=k(RK=>{"use strict";var ATe=pt(),ij=xy(),Ty=vy();function $Te(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=ij.createStringifyContext(t,e),{commentString:s}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=s(t.commentBefore);r.unshift(Ty.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(ATe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);r.push(Ty.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=ij.stringify(t.contents,i,()=>a=null,c);a&&(l+=Ty.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(ij.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(` +`)?(r.push("..."),r.push(Ty.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&r[r.length-1]!==""&&r.push(""),r.push(Ty.indentComment(s(c),"")))}return r.join(` `)+` -`}A6.stringifyDocument=Nhe});var Cf=v(T6=>{"use strict";var jhe=yf(),dl=Ly(),Rn=De(),Mhe=Xo(),Fhe=Wo(),Lhe=nT(),zhe=O6(),oT=Ny(),Uhe=lO(),qhe=_f(),sT=cO(),aT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.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 sT.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,{[Rn.NODE_TYPE]:{value:Rn.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=Rn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){fl(this.contents)&&this.contents.add(e)}addIn(e,r){fl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=oT.anchorNames(this);e.anchor=!r||n.has(r)?oT.findNewAnchor(r||"a",n):r}return new jhe.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}=oT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=qhe.createNode(e,u,m);return a&&Rn.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 Mhe.Pair(i,o)}delete(e){return fl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return dl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):fl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return dl.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return dl.isEmptyPath(e)?this.contents!==void 0:Rn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=dl.collectionFromPath(this.schema,[e],r):fl(this.contents)&&this.contents.set(e,r)}setIn(e,r){dl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=dl.collectionFromPath(this.schema,Array.from(e),r):fl(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 sT.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 sT.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 Lhe.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=Fhe.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"?Uhe.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 zhe.stringifyDocument(this,e)}};function fl(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}T6.Document=aT});var jf=v(Nf=>{"use strict";var Df=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},cT=class extends Df{constructor(e,r,n){super("YAMLParseError",e,r,n)}},lT=class extends Df{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Hhe=(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+=`: +`}RK.stringifyDocument=$Te});var Oy=k(TK=>{"use strict";var ITe=yy(),rf=Wx(),ls=pt(),PTe=Lc(),RTe=Oc(),CTe=nj(),TTe=CK(),sj=qx(),OTe=lD(),NTe=by(),oj=cD(),aj=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ls.NODE_TYPE,{value:ls.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:o}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new oj.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[ls.NODE_TYPE]:{value:ls.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=ls.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){nf(this.contents)&&this.contents.add(e)}addIn(e,r){nf(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=sj.anchorNames(this);e.anchor=!r||n.has(r)?sj.findNewAnchor(r||"a",n):r}return new ITe.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 y=g=>typeof g=="number"||g instanceof String||g instanceof Number,v=r.filter(y).map(String);v.length>0&&(r=r.concat(v)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:p,sourceObjects:f}=sj.createNodeAnchors(this,o||"a"),h={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:f},m=NTe.createNode(e,u,h);return a&&ls.isCollection(m)&&(m.flow=!0),p(),m}createPair(e,r,n={}){let i=this.createNode(e,null,n),s=this.createNode(r,null,n);return new PTe.Pair(i,s)}delete(e){return nf(this.contents)?this.contents.delete(e):!1}deleteIn(e){return rf.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):nf(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return ls.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return rf.isEmptyPath(e)?!r&&ls.isScalar(this.contents)?this.contents.value:this.contents:ls.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return ls.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return rf.isEmptyPath(e)?this.contents!==void 0:ls.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=rf.collectionFromPath(this.schema,[e],r):nf(this.contents)&&this.contents.set(e,r)}setIn(e,r){rf.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=rf.collectionFromPath(this.schema,Array.from(e),r):nf(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 oj.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 oj.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 CTe.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:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=RTe.toJS(this.contents,r??"",a);if(typeof s=="function")for(let{count:l,res:u}of a.anchors.values())s(u,l);return typeof o=="function"?OTe.applyReviver(o,{"":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 TTe.stringifyDocument(this,e)}};function nf(t){if(ls.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}TK.Document=aj});var jy=k(Dy=>{"use strict";var Ny=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},cj=class extends Ny{constructor(e,r,n){super("YAMLParseError",e,r,n)}},lj=class extends Ny{constructor(e,r,n){super("YAMLWarning",e,r,n)}},DTe=(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 s=i-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="\u2026"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 +`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=r.linePos[1];c?.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-s)));let l=" ".repeat(s)+"^".repeat(a);r.message+=`: -${s} +${o} ${l} -`}};Nf.YAMLError=Df;Nf.YAMLParseError=cT;Nf.YAMLWarning=lT;Nf.prettifyError=Hhe});var Mf=v(R6=>{"use strict";function Bhe(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 O of t)switch(m&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&o(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&O.type!=="comment"&&O.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),O.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&O.source.includes(" ")&&(h=O),u=!0;break;case"comment":{u||o(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=O.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=O.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=O.source,l=!0,p=!0,(g||b)&&(_=O),u=!0;break;case"anchor":g&&o(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&o(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=O,w??(w=O.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(O,"MULTIPLE_TAGS","A node can have at most one tag"),b=O,w??(w=O.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),x&&o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${e??"collection"}`),x=O,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(O,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=O,l=!1,u=!1;break}default:o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),l=!1,u=!1}let R=t[t.length-1],A=R?R.offset+R.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(l&&h.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:x,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:b,newlineAfterProp:_,end:A,start:w??A}}R6.resolveProps=Bhe});var v_=v(I6=>{"use strict";function uT(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(uT(e.key)||uT(e.value))return!0}return!1;default:return!0}}I6.containsNewline=uT});var dT=v(P6=>{"use strict";var Ghe=v_();function Zhe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Ghe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}P6.flowIndentCheck=Zhe});var fT=v(D6=>{"use strict";var C6=De();function Vhe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||C6.isScalar(o)&&C6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}D6.mapIncludes=Vhe});var z6=v(L6=>{"use strict";var N6=Xo(),Whe=es(),j6=Mf(),Khe=v_(),M6=dT(),Jhe=fT(),F6="All mapping items must start at the same column";function Yhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Whe.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=j6.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",F6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Khe.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",F6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&M6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Jhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=j6.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 Xhe=ts(),Qhe=Mf(),ege=dT();function tge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Xhe.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=Qhe.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&&ege.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}U6.resolveBlockSeq=tge});var pl=v(H6=>{"use strict";function rge(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}}H6.resolveEnd=rge});var V6=v(Z6=>{"use strict";var nge=De(),ige=Xo(),B6=es(),oge=ts(),sge=pl(),G6=Mf(),age=v_(),cge=fT(),pT="Block collections are not allowed within flow collections",mT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function lge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?B6.YAMLMap:oge.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=sge.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}Z6.resolveFlowCollection=lge});var K6=v(W6=>{"use strict";var uge=De(),dge=Dt(),fge=es(),pge=ts(),mge=z6(),hge=q6(),gge=V6();function hT(t,e,r,n,i,o){let s=r.type==="block-map"?mge.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?hge.resolveBlockSeq(t,e,r,n,o):gge.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 yge(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),hT(t,e,r,i,s)}let l=hT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=uge.isNode(u)?u:new dge.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}W6.composeCollection=yge});var yT=v(J6=>{"use strict";var gT=Dt();function _ge(t,e,r){let n=e.offset,i=bge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?gT.Scalar.BLOCK_FOLDED:gT.Scalar.BLOCK_LITERAL,s=e.source?vge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` -`.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` -`:!p&&f===` -`&&(f=` - -`),d+=f+g.slice(c)+b,f=` -`,p=!0):b===""?f===` +`}};Dy.YAMLError=Ny;Dy.YAMLParseError=cj;Dy.YAMLWarning=lj;Dy.prettifyError=DTe});var Ly=k(OK=>{"use strict";function jTe(t,{flow:e,indicator:r,next:n,offset:i,onError:s,parentIndent:o,startOnNewline:a}){let c=!1,l=a,u=a,d="",p="",f=!1,h=!1,m=null,y=null,v=null,g=null,b=null,w=null,x=null;for(let E of t)switch(h&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&s(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(l&&E.type!=="comment"&&E.type!=="newline"&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),E.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&E.source.includes(" ")&&(m=E),u=!0;break;case"comment":{u||s(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let R=E.source.substring(1)||" ";d?d+=p+R:d=R,p="",l=!1;break}case"newline":l?d?d+=E.source:(!w||r!=="seq-item-ind")&&(c=!0):p+=E.source,l=!0,f=!0,(y||v)&&(g=E),u=!0;break;case"anchor":y&&s(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&s(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=E,x??(x=E.offset),l=!1,u=!1,h=!0;break;case"tag":{v&&s(E,"MULTIPLE_TAGS","A node can have at most one tag"),v=E,x??(x=E.offset),l=!1,u=!1,h=!0;break}case r:(y||v)&&s(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),w&&s(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),w=E,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){b&&s(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=E,l=!1,u=!1;break}default:s(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),l=!1,u=!1}let $=t[t.length-1],I=$?$.offset+$.source.length:i;return h&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&s(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:w,spaceBefore:c,comment:d,hasNewline:f,anchor:y,tag:v,newlineAfterProp:g,end:I,start:x??I}}OK.resolveProps=jTe});var I0=k(NK=>{"use strict";function uj(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(uj(e.key)||uj(e.value))return!0}return!1;default:return!0}}NK.containsNewline=uj});var dj=k(DK=>{"use strict";var LTe=I0();function MTe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&<e.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}DK.flowIndentCheck=MTe});var pj=k(LK=>{"use strict";var jK=pt();function FTe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(s,o)=>s===o||jK.isScalar(s)&&jK.isScalar(o)&&s.value===o.value;return e.some(s=>i(s.key,r))}LK.mapIncludes=FTe});var qK=k(BK=>{"use strict";var MK=Lc(),zTe=Fc(),FK=Ly(),UTe=I0(),zK=dj(),BTe=pj(),UK="All mapping items must start at the same column";function qTe({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??zTe.YAMLMap,a=new o(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,l=null;for(let u of n.items){let{start:d,key:p,sep:f,value:h}=u,m=FK.resolveProps(d,{indicator:"explicit-key-ind",next:p??f?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),y=!m.found;if(y){if(p&&(p.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==n.indent&&i(c,"BAD_INDENT",UK)),!m.anchor&&!m.tag&&!f){l=m.end,m.comment&&(a.comment?a.comment+=` +`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||UTe.containsNewline(p))&&i(p??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==n.indent&&i(c,"BAD_INDENT",UK);r.atKey=!0;let v=m.end,g=p?t(r,p,m,i):e(r,v,d,null,m,i);r.schema.compat&&zK.flowIndentCheck(n.indent,p,i),r.atKey=!1,BTe.mapIncludes(r,a.items,g)&&i(v,"DUPLICATE_KEY","Map keys must be unique");let b=FK.resolveProps(f??[],{indicator:"map-value-ind",next:h,offset:g.range[2],onError:i,parentIndent:n.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=b.end,b.found){y&&(h?.type==="block-map"&&!b.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&m.start{"use strict";var VTe=zc(),GTe=Ly(),HTe=dj();function WTe({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=s?.nodeClass??VTe.YAMLSeq,a=new o(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 p=GTe.resolveProps(u,{indicator:"seq-item-ind",next:d,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||d)d?.type==="block-seq"?i(p.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=p.end,p.comment&&(a.comment=p.comment);continue}let f=d?t(r,d,p,i):e(r,p.end,u,null,p,i);r.schema.compat&&HTe.flowIndentCheck(n.indent,d,i),c=f.range[2],a.items.push(f)}return a.range=[n.offset,c,l??c],a}VK.resolveBlockSeq=WTe});var sf=k(HK=>{"use strict";function ZTe(t,e,r,n){let i="";if(t){let s=!1,o="";for(let a of t){let{source:c,type:l}=a;switch(l){case"space":s=!0;break;case"comment":{r&&!s&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let u=c.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=c),s=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}e+=c.length}}return{comment:i,offset:e}}HK.resolveEnd=ZTe});var KK=k(JK=>{"use strict";var JTe=pt(),KTe=Lc(),WK=Fc(),YTe=zc(),XTe=sf(),ZK=Ly(),QTe=I0(),eOe=pj(),fj="Block collections are not allowed within flow collections",hj=t=>t&&(t.type==="block-map"||t.type==="block-seq");function tOe({composeNode:t,composeEmptyNode:e},r,n,i,s){let o=n.start.source==="{",a=o?"flow map":"flow sequence",c=s?.nodeClass??(o?WK.YAMLMap:YTe.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 y=0;y0){let y=XTe.resolveEnd(h,m,r.options.strict,i);y.comment&&(l.comment?l.comment+=` +`+y.comment:l.comment=y.comment),l.range=[n.offset,m,y.offset]}else l.range=[n.offset,m,m];return l}JK.resolveFlowCollection=tOe});var XK=k(YK=>{"use strict";var rOe=pt(),nOe=Rr(),iOe=Fc(),sOe=zc(),oOe=qK(),aOe=GK(),cOe=KK();function mj(t,e,r,n,i,s){let o=r.type==="block-map"?oOe.resolveBlockMap(t,e,r,n,s):r.type==="block-seq"?aOe.resolveBlockSeq(t,e,r,n,s):cOe.resolveFlowCollection(t,e,r,n,s),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function lOe(t,e,r,n,i){let s=n.tag,o=s?e.directives.tagName(s.source,p=>i(s,"TAG_RESOLVE_FAILED",p)):null;if(r.type==="block-seq"){let{anchor:p,newlineAfterProp:f}=n,h=p&&s?p.offset>s.offset?p:s:p??s;h&&(!f||f.offsetp.tag===o&&p.collection===a);if(!c){let p=e.schema.knownTags[o];if(p?.collection===a)e.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?i(s,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),mj(t,e,r,i,o)}let l=mj(t,e,r,i,o,c),u=c.resolve?.(l,p=>i(s,"TAG_RESOLVE_FAILED",p),e.options)??l,d=rOe.isNode(u)?u:new nOe.Scalar(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}YK.composeCollection=lOe});var yj=k(QK=>{"use strict";var gj=Rr();function uOe(t,e,r){let n=e.offset,i=dOe(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let s=i.mode===">"?gj.Scalar.BLOCK_FOLDED:gj.Scalar.BLOCK_LITERAL,o=e.source?pOe(e.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let y=o[m][1];if(y===""||y==="\r")a=m;else break}if(a===0){let m=i.chomp==="+"&&o.length>0?` +`.repeat(Math.max(1,o.length-1)):"",y=n+i.length;return e.source&&(y+=e.source.length),{value:m,type:s,comment:i.comment,range:[n,y,y]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let m=0;mc&&(c=y.length);else{y.length=a;--m)o[m][0].length>c&&(a=m+1);let d="",p="",f=!1;for(let m=0;mc||v[0]===" "?(p===" "?p=` +`:!f&&p===` +`&&(p=` + +`),d+=p+y.slice(c)+v,p=` +`,f=!0):v===""?p===` `?d+=` -`:f=` -`:(d+=f+b,f=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h{"use strict";var _T=Dt(),Sge=pl();function wge(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=_T.Scalar.PLAIN,c=xge(o,l);break;case"single-quoted-scalar":a=_T.Scalar.QUOTE_SINGLE,c=$ge(o,l);break;case"double-quoted-scalar":a=_T.Scalar.QUOTE_DOUBLE,c=kge(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=Sge.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function xge(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}`),Y6(t)}function $ge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Y6(t.slice(1,-1)).replace(/''/g,"'")}function Y6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var bj=Rr(),fOe=sf();function hOe(t,e,r){let{offset:n,type:i,source:s,end:o}=t,a,c,l=(p,f,h)=>r(n+p,f,h);switch(i){case"scalar":a=bj.Scalar.PLAIN,c=mOe(s,l);break;case"single-quoted-scalar":a=bj.Scalar.QUOTE_SINGLE,c=gOe(s,l);break;case"double-quoted-scalar":a=bj.Scalar.QUOTE_DOUBLE,c=yOe(s,l);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+s.length,n+s.length]}}let u=n+s.length,d=fOe.resolveEnd(o,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function mOe(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}`),e7(t)}function gOe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),e7(t.slice(1,-1)).replace(/''/g,"'")}function e7(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 Ege(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`){let{fold:s,offset:o}=bOe(t,n);r+=s,n=o}else if(i==="\\"){let s=t[++n],o=vOe[s];if(o)r+=o;else if(s===` +`)for(s=t[n+1];s===" "||s===" ";)s=t[++n+1];else if(s==="\r"&&t[n+1]===` +`)for(s=t[++n+1];s===" "||s===" ";)s=t[++n+1];else if(s==="x"||s==="u"||s==="U"){let a=s==="x"?2:s==="u"?4:8;r+=_Oe(t,n+1,a,e),n+=a}else{let a=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(i===" "||i===" "){let s=n,o=t[n+1];for(;o===" "||o===" ";)o=t[++n+1];o!==` +`&&!(o==="\r"&&t[n+2]===` +`)&&(r+=n>s?t.slice(s,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function bOe(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 Age={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Oge(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}}X6.resolveFlowScalar=wge});var tB=v(eB=>{"use strict";var ba=De(),Q6=Dt(),Tge=yT(),Rge=bT();function Ige(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Tge.resolveBlockScalar(t,e,n):Rge.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[ba.SCALAR]:c?l=Pge(t.schema,i,c,r,n):e.type==="scalar"?l=Cge(t,i,e,n):l=t.schema[ba.SCALAR];let u;try{let d=l.resolve(i,f=>n(r??e,"TAG_RESOLVE_FAILED",f),t.options);u=ba.isScalar(d)?d:new Q6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new Q6.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 Pge(t,e,r,n,i){if(r==="!")return t[ba.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[ba.SCALAR])}function Cge({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[ba.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ba.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}eB.composeScalar=Ige});var nB=v(rB=>{"use strict";function Dge(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}rB.emptyScalarPosition=Dge});var sB=v(ST=>{"use strict";var Nge=yf(),jge=De(),Mge=K6(),iB=tB(),Fge=pl(),Lge=nB(),zge={composeNode:oB,composeEmptyNode:vT};function oB(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=Uge(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=iB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Mge.composeCollection(zge,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=vT(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&&(!jge.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 vT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Lge.emptyScalarPosition(e,r,n),indent:-1,source:""},d=iB.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 Uge({options:t},{offset:e,source:r,end:n},i){let o=new Nge.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=Fge.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ST.composeEmptyNode=vT;ST.composeNode=oB});var lB=v(cB=>{"use strict";var qge=Cf(),aB=sB(),Hge=pl(),Bge=Mf();function Gge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new qge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Bge.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?aB.composeNode(l,i,u,s):aB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Hge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}cB.composeDoc=Gge});var xT=v(fB=>{"use strict";var Zge=Ze("process"),Vge=cO(),Wge=Cf(),Ff=jf(),uB=De(),Kge=lB(),Jge=pl();function Lf(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 dB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var $u=pt(),r7=Rr(),SOe=yj(),wOe=vj();function xOe(t,e,r,n){let{value:i,type:s,comment:o,range:a}=e.type==="block-scalar"?SOe.resolveBlockScalar(t,e,n):wOe.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[$u.SCALAR]:c?l=kOe(t.schema,i,c,r,n):e.type==="scalar"?l=EOe(t,i,e,n):l=t.schema[$u.SCALAR];let u;try{let d=l.resolve(i,p=>n(r??e,"TAG_RESOLVE_FAILED",p),t.options);u=$u.isScalar(d)?d:new r7.Scalar(d)}catch(d){let p=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",p),u=new r7.Scalar(i)}return u.range=a,u.source=i,s&&(u.type=s),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function kOe(t,e,r,n,i){if(r==="!")return t[$u.SCALAR];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let o=t.knownTags[r];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[$u.SCALAR])}function EOe({atKey:t,directives:e,schema:r},n,i,s){let o=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[$u.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[$u.SCALAR];if(o.tag!==a.tag){let c=e.tagString(o.tag),l=e.tagString(a.tag),u=`Value may be parsed as either ${c} or ${l}`;s(i,"TAG_RESOLVE_FAILED",u,!0)}}return o}n7.composeScalar=xOe});var o7=k(s7=>{"use strict";function AOe(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}s7.emptyScalarPosition=AOe});var l7=k(Sj=>{"use strict";var $Oe=yy(),IOe=pt(),POe=XK(),a7=i7(),ROe=sf(),COe=o7(),TOe={composeNode:c7,composeEmptyNode:_j};function c7(t,e,r,n){let i=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:c}=r,l,u=!0;switch(e.type){case"alias":l=OOe(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=a7.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=POe.composeCollection(TOe,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(d){let p=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",p)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),u=!1}}return l??(l=_j(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&&(!IOe.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"),s&&(l.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?l.comment=o:l.commentBefore=o),t.options.keepSourceTokens&&u&&(l.srcToken=e),l}function _j(t,e,r,n,{spaceBefore:i,comment:s,anchor:o,tag:a,end:c},l){let u={type:"scalar",offset:COe.emptyScalarPosition(e,r,n),indent:-1,source:""},d=a7.composeScalar(t,u,a,l);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&l(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),s&&(d.comment=s,d.range[2]=c),d}function OOe({options:t},{offset:e,source:r,end:n},i){let s=new $Oe.Alias(r.substring(1));s.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+r.length,a=ROe.resolveEnd(n,o,t.strict,i);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}Sj.composeEmptyNode=_j;Sj.composeNode=c7});var p7=k(d7=>{"use strict";var NOe=Oy(),u7=l7(),DOe=sf(),jOe=Ly();function LOe(t,e,{offset:r,start:n,value:i,end:s},o){let a=Object.assign({_directives:e},t),c=new NOe.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=jOe.resolveProps(n,{indicator:"doc-start",next:i??s?.[0],offset:r,onError:o,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?u7.composeNode(l,i,u,o):u7.composeEmptyNode(l,u.end,n,null,u,o);let d=c.contents.range[2],p=DOe.resolveEnd(s,d,!1,o);return p.comment&&(c.comment=p.comment),c.range=[r,d,p.offset],c}d7.composeDoc=LOe});var xj=k(m7=>{"use strict";var MOe=Ot("process"),FOe=cD(),zOe=Oy(),My=jy(),f7=pt(),UOe=p7(),BOe=sf();function Fy(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 h7(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Lf(r);o?this.warnings.push(new Ff.YAMLWarning(s,n,i)):this.errors.push(new Ff.YAMLParseError(s,n,i))},this.directives=new Vge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=dB(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment} -${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(uB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];uB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} -${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n} -${s}`:n}}if(r){for(let o=0;o{let o=Lf(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Kge.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 Ff.YAMLParseError(Lf(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 Ff.YAMLParseError(Lf(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Jge.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 Ff.YAMLParseError(Lf(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 Wge.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}}};fB.Composer=wT});var hB=v(S_=>{"use strict";var Yge=yT(),Xge=bT(),Qge=jf(),pB=wf();function eye(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 Qge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Xge.resolveFlowScalar(t,e,n);case"block-scalar":return Yge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function tye(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=pB.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.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 wj=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,s)=>{let o=Fy(r);s?this.warnings.push(new My.YAMLWarning(o,n,i)):this.errors.push(new My.YAMLParseError(o,n,i))},this.directives=new FOe.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=h7(this.prelude);if(n){let s=e.contents;if(r)e.comment=e.comment?`${e.comment} +${n}`:n;else if(i||e.directives.docStart||!s)e.commentBefore=n;else if(f7.isCollection(s)&&!s.flow&&s.items.length>0){let o=s.items[0];f7.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${n} +${a}`:n}else{let o=s.commentBefore;s.commentBefore=o?`${n} +${o}`:n}}if(r){for(let s=0;s{let s=Fy(e);s[0]+=r,this.onError(s,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=UOe.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 My.YAMLParseError(Fy(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 My.YAMLParseError(Fy(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=BOe.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 My.YAMLParseError(Fy(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 zOe.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}}};m7.Composer=wj});var b7=k(P0=>{"use strict";var qOe=yj(),VOe=vj(),GOe=jy(),g7=wy();function HOe(t,e=!0,r){if(t){let n=(i,s,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(r)r(a,s,o);else throw new GOe.YAMLParseError([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return VOe.resolveFlowScalar(t,e,n);case"block-scalar":return qOe.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function WOe(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:s=-1,type:o="PLAIN"}=e,a=g7.stringifyString({type:o,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 mB(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 rye(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=pB.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">":nye(t,c);break;case'"':$T(t,c,"double-quoted-scalar");break;case"'":$T(t,c,"single-quoted-scalar");break;default:$T(t,c,"scalar")}}function nye(t,e){let r=e.indexOf(` +`,p=[{type:"block-scalar-header",offset:s,indent:n,source:u}];return y7(p,c)||p.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:s,indent:n,props:p,source:d}}case'"':return{type:"double-quoted-scalar",offset:s,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:s,indent:n,source:a,end:c};default:return{type:"scalar",offset:s,indent:n,source:a,end:c}}}function ZOe(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:s=!1,type:o}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=g7.stringifyString({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":JOe(t,c);break;case'"':kj(t,c,"double-quoted-scalar");break;case"'":kj(t,c,"single-quoted-scalar");break;default:kj(t,c,"scalar")}}function JOe(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}];mB(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 mB(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 $T(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})}}}S_.createScalarToken=tye;S_.resolveAsScalar=eye;S_.setScalarValue=rye});var yB=v(gB=>{"use strict";var iye=t=>"type"in t?x_(t):w_(t);function x_(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=x_(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=w_(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=w_(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=w_(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 w_({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=x_(e)),r)for(let o of r)i+=o.source;return n&&(i+=x_(n)),i}gB.stringify=iye});var SB=v(vB=>{"use strict";var kT=Symbol("break visit"),oye=Symbol("skip children"),_B=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),bB(Object.freeze([]),t,e)}va.BREAK=kT;va.SKIP=oye;va.REMOVE=_B;va.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};va.parentCollection=(t,e)=>{let r=va.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 bB(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 ET=hB(),sye=yB(),aye=SB(),AT="\uFEFF",OT="",TT="",RT="",cye=t=>!!t&&"items"in t,lye=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function uye(t){switch(t){case AT:return"";case OT:return"";case TT:return"";case RT:return"";default:return JSON.stringify(t)}}function dye(t){switch(t){case AT:return"byte-order-mark";case OT:return"doc-mode";case TT:return"flow-error-end";case RT:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`;if(t.type==="block-scalar"){let s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=n,t.source=i}else{let{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:n}];y7(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` +`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function y7(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 kj(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 s of n)s.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(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}P0.createScalarToken=WOe;P0.resolveAsScalar=HOe;P0.setScalarValue=ZOe});var _7=k(v7=>{"use strict";var KOe=t=>"type"in t?C0(t):R0(t);function C0(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=C0(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=R0(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=R0(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=R0(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 R0({start:t,key:e,sep:r,value:n}){let i="";for(let s of t)i+=s.source;if(e&&(i+=C0(e)),r)for(let s of r)i+=s.source;return n&&(i+=C0(n)),i}v7.stringify=KOe});var k7=k(x7=>{"use strict";var Ej=Symbol("break visit"),YOe=Symbol("skip children"),S7=Symbol("remove item");function Iu(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),w7(Object.freeze([]),t,e)}Iu.BREAK=Ej;Iu.SKIP=YOe;Iu.REMOVE=S7;Iu.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let s=r?.[n];if(s&&"items"in s)r=s.items[i];else return}return r};Iu.parentCollection=(t,e)=>{let r=Iu.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 w7(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let s=e[i];if(s&&"items"in s){for(let o=0;o{"use strict";var Aj=b7(),XOe=_7(),QOe=k7(),$j="\uFEFF",Ij="",Pj="",Rj="",e1e=t=>!!t&&"items"in t,t1e=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function r1e(t){switch(t){case $j:return"";case Ij:return"";case Pj:return"";case Rj:return"";default:return JSON.stringify(t)}}function n1e(t){switch(t){case $j:return"byte-order-mark";case Ij:return"doc-mode";case Pj:return"flow-error-end";case Rj: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}Mr.createScalarToken=ET.createScalarToken;Mr.resolveAsScalar=ET.resolveAsScalar;Mr.setScalarValue=ET.setScalarValue;Mr.stringify=sye.stringify;Mr.visit=aye.visit;Mr.BOM=AT;Mr.DOCUMENT=OT;Mr.FLOW_END=TT;Mr.SCALAR=RT;Mr.isCollection=cye;Mr.isScalar=lye;Mr.prettyToken=uye;Mr.tokenType=dye});var CT=v(xB=>{"use strict";var zf=$_();function Qn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var wB=new Set("0123456789ABCDEFabcdef"),fye=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),k_=new Set(",[]{}"),pye=new Set(` ,[]{} -\r `),IT=t=>!t||pye.has(t),PT=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}ui.createScalarToken=Aj.createScalarToken;ui.resolveAsScalar=Aj.resolveAsScalar;ui.setScalarValue=Aj.setScalarValue;ui.stringify=XOe.stringify;ui.visit=QOe.visit;ui.BOM=$j;ui.DOCUMENT=Ij;ui.FLOW_END=Pj;ui.SCALAR=Rj;ui.isCollection=e1e;ui.isScalar=t1e;ui.prettyToken=r1e;ui.tokenType=n1e});var Oj=k(A7=>{"use strict";var zy=T0();function Us(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var E7=new Set("0123456789ABCDEFabcdef"),i1e=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),O0=new Set(",[]{}"),s1e=new Set(` ,[]{} +\r `),Cj=t=>!t||s1e.has(t),Tj=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==="...")&&Qn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Qn(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===":")&&Qn(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(IT),"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=>Qn(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 zf.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(Qn(o)||e&&k_.has(o))break;r=n}else if(Qn(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===` +`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Us(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!Us(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===":")&&Us(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(Cj),"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=>Us(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let s=this.pos;n=this.buffer[s];++s)switch(n){case" ":r+=1;break;case` +`:e=s,r=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` +`)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 s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(` +`,s)}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 s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===` +`&&s>=this.pos&&s+1+r>a)e=s;else break}while(!0);return yield zy.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 s=this.buffer[n+1];if(Us(s)||e&&O0.has(s))break;r=n}else if(Us(i)){let s=this.buffer[n+1];if(i==="\r"&&(s===` `?(n+=1,i=` -`,o=this.buffer[n+1]):r=n),o==="#"||e&&k_.has(o))break;if(i===` -`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&k_.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield zf.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(IT),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Qn(n)||r&&k_.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(;!Qn(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(fye.has(r))r=this.buffer[++e];else if(r==="%"&&wB.has(this.buffer[e+1])&&wB.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===` +`,s=this.buffer[n+1]):r=n),s==="#"||e&&O0.has(s))break;if(i===` +`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&O0.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield zy.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(Cj),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(Us(n)||r&&O0.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(;!Us(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(i1e.has(r))r=this.buffer[++e];else if(r==="%"&&E7.has(this.buffer[e+1])&&E7.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)}};xB.Lexer=PT});var NT=v($B=>{"use strict";var DT=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 mye=Ze("process"),kB=$_(),hye=CT();function rs(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 A_(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"&&AB(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&&EB(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)}};A7.Lexer=Tj});var Dj=k($7=>{"use strict";var Nj=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[s]{"use strict";var o1e=Ot("process"),I7=T0(),a1e=Oj();function Uc(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 D0(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"&&R7(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&&P7(i.start)===-1&&(r.indent===0||i.start.every(s=>s.type!=="comment"||s.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(rs(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(OB(r.key)&&!rs(r.sep,"newline")){let s=ml(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(rs(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=ml(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]}):rs(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&&!rs(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)){A_(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||rs(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=E_(n),o=ml(i);AB(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)){D0(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",s=[];if(i&&r.sep&&!r.value){let o=[];for(let a=0;ae.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(s.push(this.sourceToken),e.items.push({start:s}),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?(s.push(this.sourceToken),e.items.push({start:s,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(Uc(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(C7(r.key)&&!Uc(r.sep,"newline")){let o=of(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:o,key:a,sep:c}]})}else s.length>0?r.sep=r.sep.concat(s,this.sourceToken):r.sep.push(this.sourceToken);else if(Uc(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=of(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):Uc(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 o=this.flowScalar(this.type);i||r.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!r.explicitKey&&r.sep&&!Uc(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:s});this.stack.push(o);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)){D0(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||Uc(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=N0(n),s=of(i);R7(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};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=E_(e),n=ml(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=E_(e),n=ml(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())}}};TB.Parser=jT});var DB=v(qf=>{"use strict";var RB=xT(),gye=Cf(),Uf=jf(),yye=SO(),_ye=De(),bye=NT(),IB=MT();function PB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new bye.LineCounter||null,prettyErrors:e}}function vye(t,e={}){let{lineCounter:r,prettyErrors:n}=PB(e),i=new IB.Parser(r?.addNewLine),o=new RB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Uf.prettifyError(t,r)),a.warnings.forEach(Uf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function CB(t,e={}){let{lineCounter:r,prettyErrors:n}=PB(e),i=new IB.Parser(r?.addNewLine),o=new RB.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 Uf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Uf.prettifyError(t,r)),s.warnings.forEach(Uf.prettifyError(t,r))),s}function Sye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=CB(t,r);if(!i)return null;if(i.warnings.forEach(o=>yye.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 wye(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 _ye.isDocument(t)&&!n?t.toString(r):new gye.Document(t,n,r).toString(r)}qf.parse=Sye;qf.parseAllDocuments=vye;qf.parseDocument=CB;qf.stringify=wye});var tr=v(Ve=>{"use strict";var xye=xT(),$ye=Cf(),kye=nT(),FT=jf(),Eye=yf(),ns=De(),Aye=Xo(),Oye=Dt(),Tye=es(),Rye=ts(),Iye=$_(),Pye=CT(),Cye=NT(),Dye=MT(),O_=DB(),NB=pf();Ve.Composer=xye.Composer;Ve.Document=$ye.Document;Ve.Schema=kye.Schema;Ve.YAMLError=FT.YAMLError;Ve.YAMLParseError=FT.YAMLParseError;Ve.YAMLWarning=FT.YAMLWarning;Ve.Alias=Eye.Alias;Ve.isAlias=ns.isAlias;Ve.isCollection=ns.isCollection;Ve.isDocument=ns.isDocument;Ve.isMap=ns.isMap;Ve.isNode=ns.isNode;Ve.isPair=ns.isPair;Ve.isScalar=ns.isScalar;Ve.isSeq=ns.isSeq;Ve.Pair=Aye.Pair;Ve.Scalar=Oye.Scalar;Ve.YAMLMap=Tye.YAMLMap;Ve.YAMLSeq=Rye.YAMLSeq;Ve.CST=Iye;Ve.Lexer=Pye.Lexer;Ve.LineCounter=Cye.LineCounter;Ve.Parser=Dye.Parser;Ve.parse=O_.parse;Ve.parseAllDocuments=O_.parseAllDocuments;Ve.parseDocument=O_.parseDocument;Ve.stringify=O_.stringify;Ve.visit=NB.visit;Ve.visitAsync=NB.visitAsync});import{execFileSync as LT}from"node:child_process";import{existsSync as T_}from"node:fs";import{join as R_,resolve as Nye}from"node:path";function jye(t){try{let e=LT("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Nye(t,e):null}catch{return null}}function zT(t){let e=jye(t);if(!e)return null;try{if(T_(R_(e,"MERGE_HEAD")))return"merge";if(T_(R_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(T_(R_(e,"rebase-merge"))||T_(R_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function Sa(t){return zT(t)!==null}function Hf(t,e){try{let r=LT("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 I_(t,e){return Hf(t,e)!==null}function jB(t,e){try{let r=LT("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var wa=y(()=>{"use strict"});import{execFileSync as Mye}from"node:child_process";import{existsSync as Fye,readFileSync as Lye}from"node:fs";import{join as FB}from"node:path";function yl(t,e){return Mye("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function is(t){try{let e=yl(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 os(t,e){LB(t,e);let r=yl(t,["rev-parse","HEAD"]).trim(),n=zye(t,e);return{groups:Uye(t,n),head:r,inventory:{after:MB(C_(t,"spec.yaml")),before:MB(Bf(t,e,"spec.yaml"))},since:e,unsharded_commits:Gye(t,e)}}function UT(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 LB(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!I_(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 zye(t,e){let r=yl(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(!(!P_(c)&&!P_(a)))if(s.startsWith("A")){let l=gl(C_(t,c));if(!l)continue;l.status==="done"?n.push(hl(l,"added-as-done")):l.status==="archived"&&n.push(hl(l,"archived"))}else if(s.startsWith("D")){let l=gl(Bf(t,e,a));l&&n.push(hl(l,"archived"))}else{let l=gl(C_(t,c));if(!l)continue;let d=gl(Bf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(hl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(hl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(hl(l,"archived"))}}return n.sort((i,o)=>i.id.localeCompare(o.id)),n}function P_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function zB(t,e){LB(t,e);let r=yl(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(!P_(c)&&!P_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?gl(Bf(t,"HEAD",c)):null,f=l?null:gl(Bf(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 hl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>UT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function gl(t){if(t===null)return null;let e;try{e=(0,D_.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 C_(t,e){let r=FB(t,e);if(!Fye(r))return null;try{return Lye(r,"utf8")}catch{return null}}function Bf(t,e,r){try{return yl(t,["show",`${e}:${r}`])}catch{return null}}function Uye(t,e){let r=qye(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 qye(t){let e=C_(t,FB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function MB(t){let e={};if(t!==null)try{let n=(0,D_.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 Gye(t,e){let r=yl(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);Hye.test(a)&&(Bye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Hye,Bye,_l=y(()=>{"use strict";D_=wt(tr(),1);wa();Hye=/^(feat|fix)(\([^)]*\))?!?:/,Bye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as UB}from"node:child_process";import{appendFileSync as Zye,existsSync as qT,mkdirSync as Vye,readFileSync as Wye,renameSync as Kye,statSync as Jye}from"node:fs";import{userInfo as Yye}from"node:os";import{dirname as Xye,join as BT}from"node:path";function GT(t){return BT(t,qB,Qye)}function rn(t,e){let r=GT(t),n=Xye(r);qT(n)||Vye(n,{recursive:!0});try{qT(r)&&Jye(r).size>e_e&&Kye(r,BT(n,HB))}catch{}Zye(r,`${JSON.stringify(e)} -`,"utf8")}function HT(t){if(!qT(t))return[];let e=Wye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return HT(GT(t))}function N_(t){return[...HT(BT(t,qB,HB)),...HT(GT(t))]}function nn(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 t_e(t){let e;try{e=UB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Yye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function r_e(t){try{return UB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Gf(t,e){try{let r=ss(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function Jt(t,e,r){try{let n=r_e(t),i=t_e(t),o={...r,head:n,identity:i};if(e==="gate_run"){let s=ss(t),a=-1;for(let u=s.length-1;u>=0;u--)if(s[u].type==="gate_run"){a=u;break}let c=a>=0?s[a]:void 0,l=a>=0&&s.slice(a+1).some(u=>u.type==="stop_blocked");if(c&&!l&&c.payload.head===n&&c.payload.tier===r.tier&&c.payload.strict===r.strict&&c.payload.worst===r.worst&&c.payload.stopFingerprint===r.stopFingerprint&&JSON.stringify(c.payload.blockers??[])===JSON.stringify(r.blockers??[]))return}rn(t,nn(e,o))}catch{}}var qB,Qye,HB,e_e,Fr=y(()=>{"use strict";qB=".cladding",Qye="events.log.jsonl",HB="events.log.1.jsonl",e_e=5*1024*1024});import{execFileSync as n_e}from"node:child_process";import{existsSync as BB,readdirSync as i_e,readFileSync as o_e,statSync as GB}from"node:fs";import{createHash as s_e}from"node:crypto";import{join as ZT}from"node:path";function xa(t){try{return n_e("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function VT(t){let e=[],r=ZT(t,"spec.yaml");BB(r)&&GB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=ZT(t,"spec",i);if(!(!BB(o)||!GB(o).isDirectory()))for(let s of i_e(o))s.endsWith(".yaml")&&e.push(ZT(o,s))}e.sort();let n=s_e("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(o_e(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:VT(t),timestamp:new Date().toISOString()};return rn(t,nn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function M_(t,e){let r=ss(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 F_(t,e,r,n){let i=nn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return rn(t,i),i}var Zf=y(()=>{"use strict";Fr()});import{readFileSync as a_e,statSync as c_e}from"node:fs";import{extname as l_e,resolve as WT,sep as u_e}from"node:path";function on(t){return Math.ceil(t.length/4)}function p_e(t,e){let r=WT(e),n=WT(r,t);return n===r||n.startsWith(r+u_e)}function VB(t,e,r,n){if(!p_e(t,e))return{path:t,omitted:"unsafe-path"};if(!d_e.has(l_e(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>ZB)return{path:t,omitted:"too-large",bytes:o}}else{let l=WT(e,t);try{o=c_e(l).size}catch{return{path:t,omitted:"missing"}}if(o>ZB)return{path:t,omitted:"too-large",bytes:o};try{i=a_e(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(f_e))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 d_e,ZB,f_e,L_=y(()=>{"use strict";d_e=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"]),ZB=2e6,f_e="\0"});function Vf(t){for(let i of m_e)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 KT(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function h_e(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??[])KT(e,s,o);for(let s of i.modules??[])KT(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vf(a);c&&KT(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function In(t){let e=WB.get(t);return e||(e=h_e(t),WB.set(t,e)),e}var m_e,WB,as=y(()=>{"use strict";m_e=["derived:","fixture:","script:","self-dogfood:"];WB=new WeakMap});function JT(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 xr(t,e,r={}){let n=r.depth??1/0,i=In(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=g_e(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=JT(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:YT(i)}}var $a=y(()=>{"use strict";as()});function KB(t){return t.impacted.length}function U_(t,e,r={}){let n=r.initialDepth??z_.initialDepth,i=r.maxDepth??z_.maxDepth,o=r.coverageThreshold??z_.coverageThreshold,s=r.marginYieldThreshold??z_.marginYieldThreshold,a=In(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=xr(t,e,{depth:1});return"not_found"in b,b}let d=JT(l,a.dependents,1/0).size;if(d===0){let b=xr(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 _=xr(t,e,{depth:b});if("not_found"in _)return _;m=_;let S=KB(_),x=S-p,w=S>0?x/S:0;f.push(w);let R=d>0?S/d:1,A=x===0&&b>n,O={frontierExhausted:A,coverage:R,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:O};if(R>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:O};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var z_,XT=y(()=>{"use strict";$a();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function y_e(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 JB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=y_e(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 YB=y(()=>{"use strict"});function __e(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 bl(t,e){let r=__e(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=JB(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 q_=y(()=>{"use strict";YB()});import{existsSync as QB,readdirSync as b_e,readFileSync as v_e}from"node:fs";import{join as eR}from"node:path";function tR(t,e=w_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function x_e(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:tR(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:tR(`done reverted \u2014 pre-push strict gate red${r}`)}}function XB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function $_e(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 tR(n)}function k_e(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)=>XB(m)-XB(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(-S_e).map(x_e),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?$_e(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 QT(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function E_e(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 A_e(t,e,r){let n=QT(t,/_Rolled back at_\s*`([^`]+)`/),i=QT(t,/Last failed gate:\s*`([^`]+)`/),o=QT(t,/Retry attempts:\s*(\d+)/),s=E_e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function O_e(t,e){let r=eR(t,".cladding","post-mortems");if(!QB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of b_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(A_e(v_e(eR(r,o),"utf8"),e,o))}catch{}return i}function eG(t,e){try{let r=N_(t),n=O_e(t,e),i=QB(eR(t,".cladding","events.log.1.jsonl"));return k_e(r,n,e,{truncated:i})}catch{return}}var S_e,w_e,tG=y(()=>{"use strict";Fr();S_e=5,w_e=120});function H_(t,e,r){return on(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function ka(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:T_e,o=e,s,a=In(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=bl(t,o);if("not_found"in c)return c;let l=c.focus,u=eG(n,l.id),d=a&&a.size>0?e:l.id,f=U_(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}},R=[...c.ancestors];for(;R.length>R_e&&H_(w,R,[])>i;)R.pop();R.lengthi){x.push(`code: omitted ${se} (budget)`);continue}O.push(Kt),Kt.truncated&&x.push(`code: clipped ${se}`)}A>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}:{}}),E=(se,Ce,Kt,fr)=>{let Qt=Kt+fr>0?[`breaks: omitted ${Kt} feature(s) / ${fr} test(s)`]:[],fo={...w,needs:R,must_edit:{...w.must_edit,code:O},breaks_if_changed:D(se,Ce),budget:{...w.budget,truncated:[...x,...Qt]}};return on(JSON.stringify(fo))>i},ae=m,X=h;if(E(ae,X,0,0)){let se=xr(t,d,{depth:1}),Ce=new Set("not_found"in se?[]:se.impacted.map(fe=>fe.id)),Kt=new Set("not_found"in se?[]:se.test_refs),Qt=[...m.filter(fe=>Ce.has(fe.id)),...m.filter(fe=>!Ce.has(fe.id))],fo=0;for(;Qt.length>Ce.size&&E(Qt,X,fo,0);)Qt=Qt.slice(0,-1),fo++;let ki=[...h],tn=0;for(;E(Qt,ki,fo,tn);){let fe=-1;for(let po=ki.length-1;po>=0;po--)if(!Kt.has(ki[po])){fe=po;break}if(fe<0)break;ki.splice(fe,1),tn++}ae=Qt,X=ki,fo+tn>0&&x.push(`breaks: omitted ${fo} feature(s) / ${tn} test(s)`),E(ae,X,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let J=D(ae,X),P={...w,needs:R,must_edit:{...w.must_edit,code:O},breaks_if_changed:J},C=P;if(u){let se={...P,prior_attempts:u};on(JSON.stringify(se))<=i?C=se:x.push("prior_attempts: omitted (budget)")}let dr=on(JSON.stringify(C));return{...C,budget:{max_tokens:i,used_tokens:dr,truncated:x}}}var T_e,R_e,B_=y(()=>{"use strict";L_();q_();XT();tG();$a();as();T_e=3e3,R_e=3});function ei(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 I_e(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 rG(t,e,r="."){let n=In(t),i=t.features??[],o=[];for(let f of i){let p=ka(t,f.id,{cwd:r,read:e});if("not_found"in p)continue;let m=ka(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER}),h=U_(t,f.id),g=!("not_found"in h),b=on(JSON.stringify(p)),_="not_found"in m?b:on(JSON.stringify(m)),S=on(JSON.stringify(f));for(let R of f.modules??[]){let A=e(R);A&&(S+=on(A))}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(ei(s)*1e3)/1e3,medianShrinkFactor:Math.round(ei(a(o))*10)/10,fitsCount:c.length,truncatedCount:l.length,medianShrinkFit:Math.round(ei(a(c))*10)/10,medianShrinkTruncated:Math.round(ei(a(l))*10)/10,medianStructuralRatio:Math.round(ei(u)*100)/100,medianSliceTokens:Math.round(ei(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(ei(o.map(f=>f.naiveTokens)))},search:{medianDepth:ei(o.map(f=>f.searchDepth)),p95Depth:I_e(o.map(f=>f.searchDepth),95),medianEdges:ei(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,p)=>Math.max(f,p.edgesResolved),0)},stability:{byStopReason:d,medianCoverage:Math.round(ei(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:ei(o.map(f=>f.regressionTests))},features:o}}var vl,G_=y(()=>{"use strict";L_();XT();B_();as();vl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as P_e,existsSync as rR,mkdirSync as C_e,readFileSync as nG}from"node:fs";import{dirname as D_e,join as N_e}from"node:path";function nR(t){return N_e(t,j_e,M_e)}function F_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:VT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function iG(t,e){try{let r=F_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=iR(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=nR(t),s=D_e(o);return rR(s)||C_e(s,{recursive:!0}),P_e(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function oG(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 iR(t,e){let r=nR(t);if(!rR(r))return[];let n;try{n=nG(r,"utf8")}catch{return[]}let i=oG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function sG(t){let e=nR(t);if(!rR(e))return{snapshots:[],unreadable:!1};let r;try{r=nG(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=oG(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Wf(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 aG(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?` (${Wf(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(` ${vl}`),i.join(` -`)}var j_e,M_e,Kf=y(()=>{"use strict";Zf();G_();j_e=".cladding",M_e="measure.jsonl"});import{existsSync as L_e}from"node:fs";import{join as z_e}from"node:path";function Sl(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}** (${U_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 lG(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 ${Wf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Wf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Wf(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`,"",vl),r.join(` -`)}function wl(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"} | ${H_e(l,r)} |`)}return n.join(` -`)}function H_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 q_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${L_e(z_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function xl(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),cG(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)cG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function cG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=UT(r);n&&t.push(`- ${n}`)}t.push("")}var U_e,q_e,Z_=y(()=>{"use strict";Kf();G_();_l();U_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};q_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 B_e}from"node:fs";function Ri(t="./spec.yaml"){let e=B_e(t,"utf8");return(0,uG.parse)(e)}var uG,V_=y(()=>{"use strict";uG=wt(tr(),1)});var cs=v((Lr,cR)=>{"use strict";var oR=Lr.ValidationError=function(e,r,n,i,o,s){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+fG(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()};oR.prototype.toString=function(){return this.property+" "+this.message};var W_=Lr.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};W_.prototype.addError=function(e){var r;if(typeof e=="string")r=new oR(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 oR(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new Ea(this);if(this.throwError)throw r;return r};W_.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function G_e(t,e){return e+": "+t.toString()+` -`}W_.prototype.toString=function(e){return this.errors.map(G_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});cR.exports.ValidatorResultError=Ea;function Ea(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ea),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}Ea.prototype=new Error;Ea.prototype.constructor=Ea;Ea.prototype.name="Validation Error";var dG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};dG.prototype=Object.create(Error.prototype,{constructor:{value:dG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var sR=Lr.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+fG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};sR.prototype.resolve=function(e){return pG(this.base,e)};sR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=pG(this.base,i||"");var s=new sR(e,this.options,n,o,Object.create(this.schemas));return i&&!s.schemas[o]&&(s.schemas[o]=e),s};var ti=Lr.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]+$/};ti.regexp=ti.regex;ti.pattern=ti.regex;ti.ipv4=ti["ip-address"];Lr.isFormat=function(e,r,n){if(typeof e=="string"&&ti[r]!==void 0){if(ti[r]instanceof RegExp)return ti[r].test(e);if(typeof ti[r]=="function")return ti[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var fG=Lr.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};Lr.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 Z_e(t,e,r,n){typeof r=="object"?e[n]=aR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function V_e(t,e,r){e[r]=t[r]}function W_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=aR(t[n],e[n]):r[n]=e[n]}function aR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Z_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(V_e.bind(null,t,n)),Object.keys(e).forEach(W_e.bind(null,t,e,n))),n}cR.exports.deepMerge=aR;Lr.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 K_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(K_e).join("")};Lr.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};Lr.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var pG=Lr.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 yG=v(($et,gG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,lR={};lR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=lR.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 uR(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 ls("anyOf must be an array");if(!r.anyOf.some(uR.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 ls("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 ls("oneOf must be an array");var o=new Le(e,r,n,i),s=new Le(e,r,n,i),a=r.oneOf.filter(uR.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(!sn.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var o=uR.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(!sn.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(!sn.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 dR(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(!sn.isSchema(s))throw new ls('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(dR(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 ls('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=dR(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 mG(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 ls('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&&mG.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)mG.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(!sn.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 J_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var fR=cs();pR.exports.SchemaScanResult=_G;function _G(t,e){this.id=t,this.ref=e}pR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=fR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=fR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!fR.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 bG=yG(),us=cs(),vG=K_().scan,SG=us.ValidatorResult,Y_e=us.ValidatorResultError,Jf=us.SchemaError,wG=us.SchemaContext,X_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(bG.validators)};Yt.prototype.customFormats={};Yt.prototype.schemas=null;Yt.prototype.types=null;Yt.prototype.attributes=null;Yt.prototype.unresolvedRefs=null;Yt.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=vG(r||X_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]};Yt.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=us.objectGetPath(n.schemas[s],o.substr(1));if(a===void 0)throw new Jf("no such schema "+o+" located in <"+s+">",e);return{subschema:a,switchSchema:r}};Yt.prototype.testType=function(e,r,n,i,o){if(o!==void 0){if(o===null)throw new Jf('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=Yt.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)};$G.exports=Yt});var EG=v((Aet,yo)=>{"use strict";var Q_e=yo.exports.Validator=kG();yo.exports.ValidatorResult=cs().ValidatorResult;yo.exports.ValidatorResultError=cs().ValidatorResultError;yo.exports.ValidationError=cs().ValidationError;yo.exports.SchemaError=cs().SchemaError;yo.exports.SchemaScanResult=K_().SchemaScanResult;yo.exports.scan=K_().scan;yo.exports.validate=function(t,e,r){var n=new Q_e;return n.validate(t,e,r)}});import{readFileSync as ebe}from"node:fs";import{dirname as tbe,join as rbe}from"node:path";import{fileURLToPath as nbe}from"node:url";function cbe(t){let e=abe.validate(t,sbe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function OG(t){let e=cbe(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=N0(e),n=of(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=N0(e),n=of(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())}}};T7.Parser=jj});var L7=k(By=>{"use strict";var O7=xj(),c1e=Oy(),Uy=jy(),l1e=SD(),u1e=pt(),d1e=Dj(),N7=Lj();function D7(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new d1e.LineCounter||null,prettyErrors:e}}function p1e(t,e={}){let{lineCounter:r,prettyErrors:n}=D7(e),i=new N7.Parser(r?.addNewLine),s=new O7.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let a of o)a.errors.forEach(Uy.prettifyError(t,r)),a.warnings.forEach(Uy.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function j7(t,e={}){let{lineCounter:r,prettyErrors:n}=D7(e),i=new N7.Parser(r?.addNewLine),s=new O7.Composer(e),o=null;for(let a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Uy.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(Uy.prettifyError(t,r)),o.warnings.forEach(Uy.prettifyError(t,r))),o}function f1e(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=j7(t,r);if(!i)return null;if(i.warnings.forEach(s=>l1e.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function h1e(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 u1e.isDocument(t)&&!n?t.toString(r):new c1e.Document(t,n,r).toString(r)}By.parse=f1e;By.parseAllDocuments=p1e;By.parseDocument=j7;By.stringify=h1e});var cr=k(Nt=>{"use strict";var m1e=xj(),g1e=Oy(),y1e=nj(),Mj=jy(),b1e=yy(),Bc=pt(),v1e=Lc(),_1e=Rr(),S1e=Fc(),w1e=zc(),x1e=T0(),k1e=Oj(),E1e=Dj(),A1e=Lj(),j0=L7(),M7=fy();Nt.Composer=m1e.Composer;Nt.Document=g1e.Document;Nt.Schema=y1e.Schema;Nt.YAMLError=Mj.YAMLError;Nt.YAMLParseError=Mj.YAMLParseError;Nt.YAMLWarning=Mj.YAMLWarning;Nt.Alias=b1e.Alias;Nt.isAlias=Bc.isAlias;Nt.isCollection=Bc.isCollection;Nt.isDocument=Bc.isDocument;Nt.isMap=Bc.isMap;Nt.isNode=Bc.isNode;Nt.isPair=Bc.isPair;Nt.isScalar=Bc.isScalar;Nt.isSeq=Bc.isSeq;Nt.Pair=v1e.Pair;Nt.Scalar=_1e.Scalar;Nt.YAMLMap=S1e.YAMLMap;Nt.YAMLSeq=w1e.YAMLSeq;Nt.CST=x1e;Nt.Lexer=k1e.Lexer;Nt.LineCounter=E1e.LineCounter;Nt.Parser=A1e.Parser;Nt.parse=j0.parse;Nt.parseAllDocuments=j0.parseAllDocuments;Nt.parseDocument=j0.parseDocument;Nt.stringify=j0.stringify;Nt.visit=M7.visit;Nt.visitAsync=M7.visitAsync});import{execFileSync as Fj}from"node:child_process";import{existsSync as L0}from"node:fs";import{join as M0,resolve as $1e}from"node:path";function I1e(t){try{let e=Fj("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?$1e(t,e):null}catch{return null}}function zj(t){let e=I1e(t);if(!e)return null;try{if(L0(M0(e,"MERGE_HEAD")))return"merge";if(L0(M0(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(L0(M0(e,"rebase-merge"))||L0(M0(e,"rebase-apply")))return"rebase"}catch{return null}return null}function af(t){return zj(t)!==null}function qy(t,e){try{let r=Fj("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 F0(t,e){return qy(t,e)!==null}function F7(t,e){try{let r=Fj("git",["merge-base",e,"HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return r.length>0?r:e}catch{return e}}var cf=S(()=>{"use strict"});import{execFileSync as P1e}from"node:child_process";import{existsSync as R1e,readFileSync as C1e}from"node:fs";import{join as U7}from"node:path";function df(t,e){return P1e("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function qc(t){try{let e=df(t,["describe","--tags","--abbrev=0"]).trim();if(e.length>0)return e}catch{}throw new Error("changelog: no git tag found to anchor the default range \u2014 pass --since explicitly (e.g. clad changelog --since v1.0.0)")}function Vc(t,e){B7(t,e);let r=df(t,["rev-parse","HEAD"]).trim(),n=T1e(t,e);return{groups:O1e(t,n),head:r,inventory:{after:z7(U0(t,"spec.yaml")),before:z7(Vy(t,e,"spec.yaml"))},since:e,unsharded_commits:L1e(t,e)}}function Uj(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 B7(t,e){let r=(e??"").trim();if(r.length===0)throw new Error("changelog: empty since ref \u2014 pass --since ");if(!F0(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 T1e(t,e){let r=df(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let s=i.split(" "),o=s[0]??"",a=s[1]??"",c=s.length>2?s[2]:a;if(!(!z0(c)&&!z0(a)))if(o.startsWith("A")){let l=uf(U0(t,c));if(!l)continue;l.status==="done"?n.push(lf(l,"added-as-done")):l.status==="archived"&&n.push(lf(l,"archived"))}else if(o.startsWith("D")){let l=uf(Vy(t,e,a));l&&n.push(lf(l,"archived"))}else{let l=uf(U0(t,c));if(!l)continue;let d=uf(Vy(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(lf(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(lf(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(lf(l,"archived"))}}return n.sort((i,s)=>i.id.localeCompare(s.id)),n}function z0(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function q7(t,e){B7(t,e);let r=df(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let s=i.split(" "),o=s[0]??"",a=s[1]??"",c=s.length>2?s[2]??"":a;if(!z0(c)&&!z0(a))continue;let l=o.startsWith("A"),u=o.startsWith("D"),d=l||!u?uf(Vy(t,"HEAD",c)):null,p=l?null:uf(Vy(t,e,a)),f=d??p;f&&n.push({path:u?a:c,id:f.id,...f.slug?{slug:f.slug}:{},title:f.title,statusBefore:p?p.status:null,statusAfter:d?d.status:null,baseAcs:p?.acceptance_criteria??[],headAcs:d?.acceptance_criteria??[]})}return n.sort((i,s)=>i.id.localeCompare(s.id)),n}function lf(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>Uj(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function uf(t){if(t===null)return null;let e;try{e=(0,B0.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 U0(t,e){let r=U7(t,e);if(!R1e(r))return null;try{return C1e(r,"utf8")}catch{return null}}function Vy(t,e,r){try{return df(t,["show",`${e}:${r}`])}catch{return null}}function O1e(t,e){let r=N1e(t).filter(o=>typeof o.id=="string"&&o.id.length>0).sort((o,a)=>o.id.localeCompare(a.id)),n=[],i=new Set;for(let o of r){let a=new Set(o.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:o.id,features:c,title:o.title??o.id})}}let s=e.filter(o=>!i.has(o.id));return s.length>0&&n.push({capability:"uncategorized",features:s,title:"Uncategorized"}),n}function N1e(t){let e=U0(t,U7("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,B0.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function z7(t){let e={};if(t!==null)try{let n=(0,B0.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 L1e(t,e){let r=df(t,["log",`${e}..HEAD`,"--format=%h%x09%s","--","src/"]),n=[];for(let i of r.split(` +`)){if(i.trim().length===0)continue;let s=i.indexOf(" ");if(s<0)continue;let o=i.slice(0,s),a=i.slice(s+1);D1e.test(a)&&(j1e.test(a)||n.push({hash:o,subject:a}))}return n}var B0,D1e,j1e,pf=S(()=>{"use strict";B0=Et(cr(),1);cf();D1e=/^(feat|fix)(\([^)]*\))?!?:/,j1e=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as V7}from"node:child_process";import{randomBytes as Gj}from"node:crypto";import{appendFileSync as M1e,closeSync as Hj,existsSync as Wj,fsyncSync as Zj,linkSync as F1e,lstatSync as Cu,mkdirSync as z1e,openSync as Jj,readFileSync as Gc,renameSync as Kj,statSync as U1e,unlinkSync as Ru,writeFileSync as G7,realpathSync as Bj}from"node:fs";import{userInfo as B1e}from"node:os";import{dirname as Gy,isAbsolute as q1e,join as Pu,relative as V1e,resolve as G1e,sep as H1e}from"node:path";function V0(t,e){try{let r=G1e(t),n=Cu(r);if(n.isSymbolicLink()||!n.isDirectory())return;let i=Bj(r),s=Pu(i,W1e),o=Hy(s);if(!o&&e){try{z1e(s)}catch(l){if(l.code!=="EEXIST")return}o=Hy(s)}if(!o||o.isSymbolicLink()||!o.isDirectory())return;let a=Bj(s);if(!q0(i,a))return;let c={root:i,directory:a,eventPath:Pu(a,Z1e),rollPath:Pu(a,J1e),lockPath:Pu(a,qj),reclaimPath:Pu(a,`${qj}.reclaim`),journalPath:Pu(a,K1e)};return us(c)?c:void 0}catch{return}}function Hy(t){try{return Cu(t)}catch(e){if(e.code==="ENOENT")return;throw e}}function us(t){if(!q0(t.root,t.directory))return!1;for(let e of[t.eventPath,t.rollPath,t.lockPath,t.reclaimPath,t.journalPath]){if(!q0(t.root,e))return!1;let r=Hy(e);if(r){if(r.isSymbolicLink()||!r.isFile())return!1;try{if(!q0(t.root,Bj(e)))return!1}catch{return!1}}}return!0}function q0(t,e){let r=V1e(t,e);return r===""||r!==".."&&!r.startsWith(`..${H1e}`)&&!q1e(r)}function Wc(t,e){try{let r=V0(t,!0);if(!r)return;let n=Z7(r);if(!n)return;try{if(W7(r))return;H7(r,e)}finally{n()}}catch{}}function H7(t,e){if(!us(t))return;let r=t.eventPath;try{if(Wj(r)&&U1e(r).size>Y1e){if(!us(t))return;Kj(r,t.rollPath)}}catch{}us(t)&&M1e(r,`${JSON.stringify(e)} +`,"utf8")}function W7(t){return us(t)&&Hy(t.journalPath)!==void 0}function Z7(t){let e=t.directory,r=t.lockPath,n=Date.now()+5e3;for(;Date.now(){try{if(!us(t))return;JSON.parse(Gc(r,"utf8")).nonce===i&&(Ru(r),Hc(e))}catch{}}}catch(a){try{Wj(s)&&Ru(s)}catch{}if(o){try{JSON.parse(Gc(r,"utf8")).nonce===i&&(Ru(r),Hc(e))}catch{}return}if(a.code!=="EEXIST")return;X1e(t)}Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25)}}function X1e(t){if(!us(t))return;let e=t.lockPath,r="",n;try{r=Gc(e,"utf8"),n=Cu(e).ino}catch{return}let i=Gj(12).toString("hex"),s=t.reclaimPath;try{let c=Jj(s,"wx");try{G7(c,`${JSON.stringify({pid:process.pid,nonce:i})} +`),Zj(c)}finally{Hj(c)}}catch(c){c.code==="EEXIST"&&Q1e(t);return}let o=()=>{try{if(!us(t))return;JSON.parse(Gc(s,"utf8")).nonce===i&&(Ru(s),Hc(Gy(s)))}catch{}},a=()=>{try{if(!us(t)||Cu(e).ino!==n||Gc(e,"utf8")!==r)return;let c=`${e}.retired-${i}`;Kj(e,c),Hc(Gy(e)),Ru(c),Hc(Gy(e))}catch{}};try{let c=JSON.parse(r);if(!Number.isInteger(c.pid)||c.pid<=0){Date.now()-Cu(e).mtimeMs>3e4&&a();return}try{process.kill(c.pid,0)}catch(l){l.code==="ESRCH"&&a()}}catch{}finally{o()}}function Q1e(t){if(!us(t))return;let e=t.reclaimPath,r,n,i;try{r=Gc(e,"utf8");let o=Cu(e);n=o.ino,i=Date.now()-o.mtimeMs}catch{return}if(i<=3e4)return;let s=`${e}.retired-${Gj(12).toString("hex")}`;try{if(Cu(e).ino!==n||Gc(e,"utf8")!==r)return;Kj(e,s),Hc(Gy(e)),Ru(s),Hc(Gy(e))}catch{}}function Hc(t){try{let e=Jj(t,"r");try{Zj(e)}finally{Hj(e)}}catch{}}function Vj(t){return J7(t).map(e=>JSON.parse(e))}function J7(t){if(!Wj(t))return[];let e=Gc(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0)}function Yj(t){let e=V0(t,!1);return e&&Hy(e.eventPath)?J7(e.eventPath):void 0}function Tu(t){let e=Yj(t);return e?e.map(r=>JSON.parse(r)):[]}function G0(t){let e=V0(t,!1);return e?[...Vj(e.rollPath),...Vj(e.eventPath)]:[]}function vn(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 Zc(t,e){return{...e,head:tNe(t),identity:eNe(t)}}function eNe(t){let e;try{e=V7("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=B1e().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function tNe(t){try{return V7("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Wy(t,e){try{let r=Tu(t);for(let n=r.length-1;n>=0;n--)if(r[n].type===e)return r[n]}catch{}return null}function _n(t,e,r){try{let n=Zc(t,r);if(e==="gate_run"){rNe(t,n,r);return}Wc(t,vn(e,n))}catch{}}function rNe(t,e,r){let n=V0(t,!0);if(!n)return;let i=Z7(n);if(i)try{if(W7(n)||!us(n))return;let s=Vj(n.eventPath),o=-1;for(let l=s.length-1;l>=0;l--)if(s[l].type==="gate_run"){o=l;break}let a=o>=0?s[o]:void 0,c=o>=0&&s.slice(o+1).some(l=>l.type==="stop_blocked");if(a&&!c&&a.payload.head===e.head&&a.payload.tier===r.tier&&a.payload.strict===r.strict&&a.payload.worst===r.worst&&a.payload.stopFingerprint===r.stopFingerprint&&JSON.stringify(a.payload.blockers??[])===JSON.stringify(r.blockers??[]))return;H7(n,vn("gate_run",e))}finally{i()}}var W1e,Z1e,J1e,qj,K1e,Y1e,ji=S(()=>{"use strict";W1e=".cladding",Z1e="events.log.jsonl",J1e="events.log.1.jsonl",qj="spec-transaction.lock",K1e="spec-transaction.json",Y1e=5*1024*1024});import{execFileSync as nNe}from"node:child_process";import{existsSync as K7,readdirSync as iNe,readFileSync as sNe,statSync as Y7}from"node:fs";import{createHash as oNe}from"node:crypto";import{join as Xj}from"node:path";function Bs(t){try{return nNe("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function Zy(t){let e=[],r=Xj(t,"spec.yaml");K7(r)&&Y7(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let s=Xj(t,"spec",i);if(!(!K7(s)||!Y7(s).isDirectory()))for(let o of iNe(s))o.endsWith(".yaml")&&e.push(Xj(s,o))}e.sort();let n=oNe("sha256");for(let i of e){let s=i.slice(t.length+1);n.update(`${s}\0`),n.update(sNe(i)),n.update("\0")}return n.digest("hex")}function X7(t,e){let r={featureId:e,gitHead:Bs(t),specDigest:Zy(t),timestamp:new Date().toISOString()};return Wc(t,vn("feature_checkpoint",{feature:e,git_head:r.gitHead,spec_digest:r.specDigest})),r}function Q7(t,e){let r=Tu(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 eY(t,e,r,n){let i=vn("feature_rolled_back",{feature:e,to_git_head:r.gitHead,to_spec_digest:r.specDigest,to_checkpoint_at:r.timestamp,reason:n??null});return Wc(t,i),i}var ff=S(()=>{"use strict";ji()});import{readFileSync as aNe,statSync as cNe}from"node:fs";import{extname as lNe,resolve as Qj,sep as uNe}from"node:path";function ds(t){return Math.ceil(t.length/4)}function fNe(t,e){let r=Qj(e),n=Qj(r,t);return n===r||n.startsWith(r+uNe)}function rY(t,e,r,n){if(!fNe(t,e))return{path:t,omitted:"unsafe-path"};if(!dNe.has(lNe(t).toLowerCase()))return{path:t,omitted:"unsupported"};let i,s;if(n){let l=n(t);if(l==null)return{path:t,omitted:"missing"};if(i=l,s=Buffer.byteLength(l,"utf8"),s>tY)return{path:t,omitted:"too-large",bytes:s}}else{let l=Qj(e,t);try{s=cNe(l).size}catch{return{path:t,omitted:"missing"}}if(s>tY)return{path:t,omitted:"too-large",bytes:s};try{i=aNe(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:s}}}if(i.includes(pNe))return{path:t,omitted:"binary",bytes:s};let o=Math.max(0,Math.floor(r));if(i.length<=o)return{path:t,text:i,bytes:s};let a=` +/* ... clipped (${s} bytes total) ... */ +`,c=Math.max(0,o-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:s}}var dNe,tY,pNe,H0=S(()=>{"use strict";dNe=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"]),tY=2e6,pNe="\0"});function hf(t){let e=t.replaceAll("\\","/").replace(/^\.\//,"");if(!e||e.startsWith("/")||e.split("/").some(r=>r===".."))throw new Error(`GraphIR artifact path must be repository-relative: ${t}`);return e}function Sn(t,e){if(t==="project")return"project";if(!e)throw new Error(`${t} address requires an identifier`);return`${t}:${e}`}function ct(t){return`artifact:${hf(t)}`}function an(t,e){if(!e)throw new Error("GraphIR anchors require an exact selector");return`anchor:${hf(t)}#${e}`}function Jc(t){if(!t.startsWith("anchor:"))return;let e=t.slice(7),r=e.indexOf("#");if(!(r<=0||r===e.length-1))try{return{path:hf(e.slice(0,r)),selector:e.slice(r+1)}}catch{return}}var qs=S(()=>{"use strict"});function Kc(t){for(let i of hNe)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}var hNe,Jy=S(()=>{"use strict";hNe=["derived:","fixture:","script:","self-dogfood:"]});function Ky(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function mNe(t){let e=new Map,r=new Map,n=new Map,i=new Map,s=new Map;for(let a of t.features??[]){let c=a.id;i.has(c)||i.set(c,a),Ky(s,c,c);let l=a.slug;l&&Ky(s,l,c);for(let u of a.depends_on??[])Ky(e,u,c);for(let u of a.modules??[])Ky(r,u,c);for(let u of a.acceptance_criteria??[])for(let d of u.test_refs??[]){let p=Kc(d);p&&Ky(n,p,c)}}let o=new Map;for(let[a,c]of s){let l=c.size===1?i.get([...c][0]):void 0;o.set(a,l??null)}return{dependents:e,moduleOwners:r,testRefCitations:n,featureById:i,featureBySpelling:o}}function t2(t){let e=nY.get(t);return e||(e=mNe(t),nY.set(t,e)),e}function sY(t){return Number.isNaN(t)?0:Number.isFinite(t)?Math.max(0,Math.trunc(t)):t>0?"saturate":0}function gNe(t,e,r){let n=new Set,i=new Set(t),s=[...i],o=0,a=r<=0;for(;s.length>0&&on.reasons.map(i=>`${n.id}: ${i}`)));return new r2(t.kernel,t.spec,e,r)}function cY(t,e){let r=oY(t);return Object.freeze({authority:"spec-structural",reasons:Object.freeze([e]),owners:n=>r.owners(n),dependents:(n,i)=>r.dependents(n,i),citations:n=>r.citations(n),ledger:()=>r.ledger(),resolveFeature:n=>r.resolveFeature(n)})}function Ro(t,e={}){return e.graph??oY(t)}var nY,iY,W0,r2,Ou=S(()=>{"use strict";qs();Jy();nY=new WeakMap;iY=new WeakMap;W0="feature:";r2=class{constructor(e,r,n,i){this.kernel=e;this.reasons=i;let s=t2(r);this.citationsByPath=new Map([...s.testRefCitations].map(([c,l])=>[c,Object.freeze([...l].sort())])),this.featureById=t2(n).featureById,this.saturatingDepth=e.nodes().filter(c=>c.address.startsWith(W0)).length+1;let o=0;for(let c of s.testRefCitations.values())o+=c.size;let a=new Set;for(let c of e.edges())c.relation==="depends_on"&&c.provenance==="authored"&&a.add(`${c.from}\0${c.to}`);this.ledgerCounts=Object.freeze({depends_on_edges:a.size,test_ref_edges:o})}kernel;reasons;authority="graph-ir";ownersByPath=new Map;reachedBySeed=new Map;citationsByPath;featureById;resolvedIds=new Map;saturatingDepth;ledgerCounts;owners(e){let r=this.ownersByPath.get(e);if(r)return r;let n=[],i;try{i=ct(e)}catch{i=void 0}if(i!==void 0){let s=this.kernel.project({seeds:[i],rules:[{relation:"touches",direction:"inbound"}],maxHops:1,maxNodes:this.kernel.nodes().length,maxEdges:this.kernel.edges().length});n=Object.freeze([...new Set(s.edges.filter(o=>o.relation==="touches"&&o.to===i).map(o=>e2(o.from)).filter(o=>o!==void 0))].sort())}return this.ownersByPath.set(e,n),n}dependents(e,r){let n=sY(r),i=n==="saturate"?this.saturatingDepth:n,s=new Set(e),o=l=>{let u=new Set;if(l<=0)return u;for(let d of s)for(let p of this.reachedAt(d,l))u.add(p);for(let d of s)u.delete(d);return u},a=o(i),c=i>=this.saturatingDepth||a.size===o(i-1).size;return{ids:a,completeness:c?"complete":"bounded"}}citations(e){return this.citationsByPath.get(e)??[]}ledger(){return this.ledgerCounts}resolveFeature(e){let r=this.resolvedIds.get(e);if(r===void 0&&!this.resolvedIds.has(e)){let n=this.kernel.resolveAddress(e);r=n.state==="resolved"?e2(n.canonical):void 0,this.resolvedIds.set(e,r)}return r===void 0?void 0:this.featureById.get(r)}reachedAt(e,r){let n=`${e}\0${r}`,i=this.reachedBySeed.get(n);if(i)return i;let s=this.kernel.dependents(`${W0}${e}`,r),o=new Set;for(let a of s.records){let c=e2(a.dependent);c!==void 0&&o.add(c)}return o.delete(e),this.reachedBySeed.set(n,o),o}}});function bNe(t){return t.startsWith("feature:")?Yy([["contains","outbound"],["depends_on","outbound"],["depends_on","inbound"],["touches","outbound"],["contributes_to","outbound"],["participates_in","inbound"]]):t.startsWith("criterion:")?Yy([["contains","inbound"],["constrained_by","outbound"],["supports","outbound"],["covers","inbound"],["traces_to","inbound"]]):t.startsWith("artifact:")?Yy([["touches","inbound"],["defined_in","inbound"],["supports","inbound"]]):t.startsWith("anchor:")?Yy([["covers","outbound"],["supports","inbound"],["traces_to","outbound"]]):Yy([["contributes_to","inbound"],["participates_in","outbound"],["constrained_by","inbound"],["defined_in","outbound"]])}function X0(t,e,r={}){let n=r.byteCeiling===void 0?16384:r.byteCeiling,i=i2(t.layers),s=vNe(e);if(s.length>0)return Xy({kind:"rejected",workspace:t,layers:i,completeness:"unknown",reasons:s,seeds:[],rules:[],bounds:uY(e)},void 0,n);let o=t.kernel.resolveAddress(e.query);if(o.state!=="resolved")return Xy({kind:"unresolved",workspace:t,layers:i,completeness:"unresolved",reasons:[o.reason],seeds:[],rules:[],bounds:uY(e),resolution:_Ne(o)},void 0,n);let a=o.canonical,c=e.max_depth??1,l=e.max_nodes??64,u=e.max_edges??128,d=bNe(a),p=t.kernel.project({seeds:[a],rules:d,maxHops:c,maxNodes:l,maxEdges:u}),f=hY(t,p,new Set([a]),c);return Xy({kind:"projection",workspace:t,layers:i,completeness:p.completeness,reasons:[...p.reasons],seeds:[a],rules:d.map(h=>({relation:h.relation,direction:h.direction})),bounds:{max_depth:c,max_nodes:l,max_edges:u}},{selection:f,view:e.view??"compact"},n)}function pY(t){let e=fY(t),r=hY(t,e,new Set,1);return Xy({kind:"export",workspace:t,layers:i2(t.layers),completeness:e.completeness,reasons:[...e.reasons],seeds:[],rules:[],bounds:{max_depth:null,max_nodes:null,max_edges:null}},{selection:r,view:"full"},null)}function Q0(t){let e=fY(t);return Xy({kind:"statistics",workspace:t,layers:i2(t.layers),completeness:e.completeness,reasons:[...e.reasons],seeds:[],rules:[],bounds:{max_depth:null,max_nodes:null,max_edges:null},statistics:RNe(t,e)},void 0,null)}function Yy(t){return Object.freeze(t.map(([e,r])=>Object.freeze({relation:e,direction:r})))}function i2(t){return t.map(e=>({id:e.id,completeness:e.completeness,reasons:[...e.reasons]}))}function uY(t){return{max_depth:t.max_depth??1,max_nodes:t.max_nodes??64,max_edges:t.max_edges??128}}function vNe(t){return[n2("max_depth",t.max_depth,3),n2("max_nodes",t.max_nodes,200),n2("max_edges",t.max_edges,400)].filter(e=>e!==void 0)}function n2(t,e,r){if(e!==void 0&&!(Number.isInteger(e)&&e>=1&&e<=r))return`${t} must be an integer between 1 and ${r}`}function _Ne(t){return t.state==="ambiguous"?{state:"ambiguous",input:t.input,reason:t.reason,candidates:[...t.candidates],accepted_forms:lY,discovery:K0}:{state:"unresolved",input:t.input,reason:t.state==="resolved"?"address resolved":t.reason,accepted_forms:lY,discovery:K0}}function fY(t){let e=t.kernel.nodes(),r=t.kernel.edges(),n=new Set(e.map(s=>s.address)),i=[...t.layers.filter(s=>s.completeness==="unknown").flatMap(s=>s.reasons.map(o=>`${s.id}: ${o}`)),...r.filter(s=>!n.has(s.from)||!n.has(s.to)).map(s=>`edge endpoint is absent: ${Y0(s)}`)];return Object.freeze({nodes:e,edges:r,completeness:i.length===0?"complete":"unknown",reasons:Object.freeze([...new Set(i)].sort()),resolutions:Object.freeze([])})}function hY(t,e,r,n){let i=new Set(e.nodes.map(l=>l.address)),s=e.edges.filter(l=>i.has(l.from)&&i.has(l.to)&&(n>1||r.size===0||r.has(l.from)||r.has(l.to))),o=SNe(r,s,i),a=e.nodes.map(l=>({address:l.address,seed:r.has(l.address),hops:o.get(l.address)??Number.MAX_SAFE_INTEGER,node:l})).sort(wNe),c=new Map;for(let l of t.kernel.presentationRecords())i.has(l.address)&&c.set(l.address,l);return{nodes:a,edges:[...s].sort((l,u)=>Y0(l).localeCompare(Y0(u))),presentations:c}}function SNe(t,e,r){let n=new Map;for(let a of e)!r.has(a.from)||!r.has(a.to)||((n.get(a.from)??n.set(a.from,[]).get(a.from)).push(a.to),(n.get(a.to)??n.set(a.to,[]).get(a.to)).push(a.from));let i=new Map,s=[...t].filter(a=>r.has(a));for(let a of s)i.set(a,0);let o=0;for(;s.length>0;){o+=1;let a=[];for(let c of s)for(let l of n.get(c)??[])i.has(l)||(i.set(l,o),a.push(l));s=a}return i}function wNe(t,e){return t.seed!==e.seed?t.seed?-1:1:t.address.localeCompare(e.address)}function Xy(t,e,r){let n=e?.selection,i={kept:new Set(n?.nodes.map(a=>a.address)??[]),fieldsTrimmed:!1,requiredOverflow:!1},s=(n?.nodes??[]).filter(a=>!a.seed).sort((a,c)=>c.hops-a.hops||c.address.localeCompare(a.address)).map(a=>a.address),o=0;for(;;){let a=dY(t,e,i,r);if(r===null||a.bytes<=r)return a.envelope;if(!i.fieldsTrimmed&&e!==void 0){i={...i,fieldsTrimmed:!0};continue}if(o0&&o.push(`packer: dropped ${s.omittedNodes} node(s) and ${s.omittedEdges} edge(s) to fit the byte ceiling`),s&&s.omittedFields>0&&o.push(`packer: dropped ${s.omittedFields} optional field value(s) to fit the byte ceiling`),r.requiredOverflow&&o.push("packer: required seed facts exceed the byte ceiling and were retained in full");let a=[...o,...t.reasons],c=kNe(t.completeness,s);return{schema_version:2,kind:t.kind,workspace_schema:t.workspace.compilation.schemaVersion,layers:t.layers,completeness:c,reasons:a.slice(0,8),...s?{nodes:s.nodes,edges:s.edges}:{},...t.statistics?{statistics:t.statistics}:{},...t.resolution?{resolution:t.resolution}:{},meta:{seeds:t.seeds,rules:t.rules,bounds:t.bounds,counts:{nodes:s?.nodes.length??0,edges:s?.edges.length??0},omitted:{nodes:s?.omittedNodes??0,edges:s?.omittedEdges??0,reasons:Math.max(0,a.length-8),fields:s?.omittedFields??0},required_overflow:r.requiredOverflow,payload_utf8_bytes:i,byte_ceiling:n,token_estimate:{estimator:yNe,tokens:Math.ceil(i/4)}}}}function kNe(t,e){return t==="unknown"||t==="unresolved"?t:e&&(e.omittedNodes>0||e.omittedEdges>0)?"bounded":t}function ENe(t,e){let{selection:r,view:n}=t,i=0,s=[];for(let a of r.nodes){if(!e.kept.has(a.address))continue;let c=e.fieldsTrimmed&&!a.seed,l=ANe(a,r.presentations.get(a.address),n,c);i+=l.omitted,s.push(l.node)}let o=[];for(let a of r.edges){if(!e.kept.has(a.from)||!e.kept.has(a.to))continue;let c=$Ne(a,e.fieldsTrimmed);i+=c.omitted,o.push(c.edge)}return{nodes:s,edges:o,omittedNodes:r.nodes.length-s.length,omittedEdges:r.edges.length-o.length,omittedFields:i}}function ANe(t,e,r,n){let i=t.node,s=INe(i),o=PNe(i),a=e?.title,c=e?.slug,l=e?.status,u=r==="full"?e?.purpose:void 0,d=n?[s,a,c,l,u].filter(p=>p!==void 0).length:0;return{node:{address:i.address,type:i.nodeType,...i.nodeType==="semantic"?{kind:i.kind}:{},...i.nodeType==="artifact"?{roles:[...i.roles]}:{},...i.nodeType==="anchor"?{artifact:i.artifact,selector:i.selector}:{},provenance:i.provenance,...o===void 0?{}:{state:o},...n||s===void 0?{}:{owner:s},...n||a===void 0?{}:{title:a},...n||c===void 0?{}:{slug:c},...n||l===void 0?{}:{status:l},...n||u===void 0?{}:{purpose:u}},omitted:d}}function $Ne(t,e){let r="channel"in t?t.channel:void 0,n=t.selector?.value,i=t.raw,s=e?[r,i,n].filter(o=>o!==void 0).length:0;return{edge:{id:Y0(t),from:t.from,to:t.to,relation:t.relation,provenance:t.provenance,...t.state===void 0?{}:{state:t.state},...e||r===void 0?{}:{channel:r},...e||i===void 0?{}:{raw:i},...e||n===void 0?{}:{selector:n}},omitted:s}}function Y0(t){return"address"in t?t.address:t.identity}function INe(t){if("source"in t&&t.source)return`${t.source.path}:${t.source.range.line}`;if("locator"in t)return t.locator.kind==="text_source"?t.locator.path:`${t.locator.adapter}:${t.locator.reference}`}function PNe(t){let e=t.state;return typeof e=="string"?e:void 0}function RNe(t,e){let r=new Map,n=new Map;for(let a of e.nodes)Z0(r,a.nodeType),a.nodeType==="semantic"&&Z0(n,a.kind);let i=new Map,s=new Map;for(let a of e.edges)Z0(i,a.relation),Z0(s,a.state??"none");let o=[...t.kernel.corpusRecords().artifactOwners].map(a=>({artifact:a.artifact,owners:a.owners.length})).sort((a,c)=>c.owners-a.owners||a.artifact.localeCompare(c.artifact)).slice(0,10);return{nodes:{total:e.nodes.length,by_type:J0(r),by_kind:J0(n)},edges:{total:e.edges.length,by_relation:J0(i),by_state:J0(s)},artifact_hubs:o}}function Z0(t,e){t.set(e,(t.get(e)??0)+1)}function J0(t){let e={};for(let r of[...t.keys()].sort())e[r]=t.get(r);return e}var yNe,lY,K0,Qy=S(()=>{"use strict";yNe="characters/4",lY=Object.freeze(["canonical address (feature:F-\u2026, criterion:F-\u2026/AC-\u2026, artifact:, anchor:#)","feature id (F-\u2026)","feature slug","repository path"]),K0="grep spec/index.yaml \u2014 one line per feature (run clad sync if missing); if the query is a file, fall back to normal code search"});function s2(t,e,r=1/0){return new Set(e.dependents([...t],r).ids)}function o2(t){let{depends_on_edges:e,test_ref_edges:r}=t.ledger();return{depends_on_edges:e,test_ref_edges:r,...e===0?{fallback_hint:"dependency ledger is empty \u2014 impacted: [] means unknown, not safe; fall back to grep/imports"}:{},...r===0?{regression_hint:"no test_refs declared project-wide \u2014 the regression set is unknown; run the full suite"}:{}}}function Mn(t,e,r={}){let n=r.depth??1/0,i=Ro(t,{graph:r.graph}),s=new Map((t.features??[]).map(g=>[g.id,g])),o=[],a,c=i.resolveFeature(e);if(c)o=[c];else{let g=i.owners(e);g.length>0&&(a=e,o=g.map(b=>s.get(b)).filter(b=>!!b))}if(o.length===0)return{not_found:e,accepted_forms:["feature id (F-\u2026)","slug","module path (e.g. src/spec/load.ts)"],discovery:`${K0} \u2014 the graph only knows declared modules; module paths live in each shard\u2019s modules:`};let l=o.map(g=>g.id),u=s2(l,i,n),d=[...u].map(g=>s.get(g)).filter(g=>!!g).map(g=>({id:g.id,title:g.title,status:g.status})).sort((g,b)=>g.id.localeCompare(b.id)),p=new Set([...l,...u]),f=[...p].map(g=>s.get(g)).filter(g=>!!g),h=[...new Set(f.flatMap(g=>g.modules??[]))].sort(),m=(t.scenarios??[]).filter(g=>(g.features??[]).some(b=>p.has(b))).map(g=>({id:g.id,title:g.title})).sort((g,b)=>g.id.localeCompare(b.id)),y=[...new Set(f.flatMap(g=>(g.acceptance_criteria??[]).flatMap(b=>b.test_refs??[])))].sort();return{focus:a?{module:a,owners:[...l].sort()}:{id:o[0].id,title:o[0].title,status:o[0].status},impacted:d,impacted_modules:h,scenarios:m,test_refs:y,ledger:o2(i),authority:i.authority}}var Nu=S(()=>{"use strict";Ou();Qy()});function mY(t){return t.impacted.length}function tk(t,e,r={}){let n=r.initialDepth??ek.initialDepth,i=r.maxDepth??ek.maxDepth,s=r.coverageThreshold??ek.coverageThreshold,o=r.marginYieldThreshold??ek.marginYieldThreshold,a=Ro(t,{graph:r.graph}),c=new Map((t.features??[]).map(v=>[v.id,v])),l=[],u=a.resolveFeature(e);if(u?l=[u.id]:l=a.owners(e).filter(v=>c.has(v)),l.length===0){let v=Mn(t,e,{depth:1,graph:a});return"not_found"in v,v}let d=s2(l,a,1/0).size;if(d===0){let v=Mn(t,e,{depth:n,graph:a});return"not_found"in v?v:{slice:v,depthUsed:n,stoppedBy:"no-known-dependents",analysis:{frontierExhausted:!0,coverage:null,marginalYields:[0],totalKnownDependents:0}}}let p=[],f=0,h=null;for(let v=n;v<=i;v++){let g=Mn(t,e,{depth:v,graph:a});if("not_found"in g)return g;h=g;let b=mY(g),w=b-f,x=b>0?w/b:0;p.push(x);let $=d>0?b/d:1,I=w===0&&v>n,E={frontierExhausted:I,coverage:$,marginalYields:[...p],totalKnownDependents:d};if(I)return{slice:g,depthUsed:v,stoppedBy:"exhaustion",analysis:E};if($>=s)return{slice:g,depthUsed:v,stoppedBy:"coverage",analysis:E};if(p.length>=2&&p[p.length-1]0?y/d:1,marginalYields:[...p],totalKnownDependents:d}}}var ek,a2=S(()=>{"use strict";Nu();Ou();ek={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function CNe(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 s=e.get(i);for(let o of s?.depends_on??[])n.push(o)}return r}function gY(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=CNe(e,r),i=t.features.filter(a=>n.has(a.id)),s=(t.scenarios??[]).filter(a=>(a.features??[]).some(c=>n.has(c)));return{...t,features:i,scenarios:s}}var yY=S(()=>{"use strict"});function TNe(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 mf(t,e){let r=TNe(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=gY(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)),s=(n.scenarios??[]).map(c=>({id:c.id,title:c.title})).sort((c,l)=>c.id.localeCompare(l.id)),o=(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:s,preferred_patterns:o,test_refs:a}}var rk=S(()=>{"use strict";yY()});import{existsSync as vY,readdirSync as ONe,readFileSync as NNe}from"node:fs";import{join as l2}from"node:path";function u2(t,e=jNe){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function LNe(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:u2(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:u2(`done reverted \u2014 pre-push strict gate red${r}`)}}function bY(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function MNe(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 u2(n)}function FNe(t,e,r,n={}){let i=t.filter(h=>h&&h.payload&&h.payload.feature===r),s=e.filter(h=>h&&h.featureId===r).slice().sort((h,m)=>bY(h)-bY(m)),o=i.filter(h=>h.type==="drift_detected"||h.type==="done_attempted"&&h.payload.kept===!1),a=i.filter(h=>h.type==="feature_rolled_back");if(o.length===0&&a.length===0&&s.length===0)return;let c=s.length?s[s.length-1]:void 0,l;for(let h=o.length-1;h>=0;h--){let m=o[h].payload.gate;if(o[h].type==="drift_detected"&&typeof m=="string"&&m){l=m;break}}!l&&c?.lastFailedGate&&(l=c.lastFailedGate);let u=o.slice(-DNe).map(LNe),d;for(let h=a.length-1;h>=0;h--){let m=a[h].payload.to_git_head;if(typeof m=="string"&&m){d=m;break}}let p=typeof c?.retryCount=="number"?c.retryCount:void 0,f=c?MNe(c):void 0;return{attempts:o.length,...l?{last_failed_gate:l}:{},...p!==void 0?{retry_count:p}:{},...u.length?{drift_history:u}:{},...d?{rolled_back_at:d}:{},...f?{recovery_hint:f}:{},...n.truncated?{truncated_history:!0}:{}}}function c2(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function zNe(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 UNe(t,e,r){let n=c2(t,/_Rolled back at_\s*`([^`]+)`/),i=c2(t,/Last failed gate:\s*`([^`]+)`/),s=c2(t,/Retry attempts:\s*(\d+)/),o=zNe(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...s?{retryCount:Number(s)}:{},...o?{recovery:o}:{}}}function BNe(t,e){let r=l2(t,".cladding","post-mortems");if(!vY(r))return[];let n=`post-mortem-${e}-`,i=[];for(let s of ONe(r))if(!(!s.startsWith(n)||!s.endsWith(".md")))try{i.push(UNe(NNe(l2(r,s),"utf8"),e,s))}catch{}return i}function _Y(t,e){try{let r=G0(t),n=BNe(t,e),i=vY(l2(t,".cladding","events.log.1.jsonl"));return FNe(r,n,e,{truncated:i})}catch{return}}var DNe,jNe,SY=S(()=>{"use strict";ji();DNe=5,jNe=120});function nk(t,e,r){return ds(JSON.stringify({...t,needs:e,must_edit:{...t.must_edit,code:r}}))}function Du(t,e,r={}){let n=r.cwd??".",i=r.maxTokens&&r.maxTokens>0?r.maxTokens:qNe,s=Ro(t,{graph:r.graph}),o=e,a,c=s.owners(e);c.length>0&&(o=c[0],c.length>1&&(a=c));let l=mf(t,o);if("not_found"in l)return l;let u=l.focus,d=_Y(n,u.id),p=c.length>0?e:u.id,f=tk(t,p,{graph:s}),h="not_found"in f?null:f.slice,m=h?h.impacted:[],y=h?h.test_refs:[],v="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},g=u.acceptance_criteria??[],b=g.filter(H=>H.ears==="unwanted"||H.ears==="state").map(H=>({id:H.id,ears:String(H.ears)})),w=[...new Set(g.flatMap(H=>H.oracle_refs??[]))].sort(),x=[],$={must_edit:{id:u.id,title:u.title,status:u.status,modules:u.modules??[],acceptance_criteria:g,code:[],...a?{co_owners:a}:{}},needs:l.ancestors,breaks_if_changed:{impacted:m,regression_tests:y,...v?{radius:v}:{}},verify:{scenarios:l.scenarios,test_refs:l.test_refs,oracle_refs:w,high_risk_acs:b},guidance:{preferred_patterns:l.preferred_patterns},budget:{max_tokens:i,used_tokens:0,truncated:x}},I=[...l.ancestors];for(;I.length>VNe&&nk($,I,[])>i;)I.pop();I.lengthi){x.push(`code: omitted ${H} (budget)`);continue}R.push(F),F.truncated&&x.push(`code: clipped ${H}`)}E>i&&x.push("must-edit exceeds budget \u2014 retained in full (focus is never dropped)");let A=(H,Oe)=>({impacted:H,regression_tests:Oe,...v?{radius:v}:{},...h?.ledger?{ledger:h.ledger}:{}}),B=(H,Oe,F,de)=>{let Ft=F+de>0?[`breaks: omitted ${F} feature(s) / ${de} test(s)`]:[],Se={...$,needs:I,must_edit:{...$.must_edit,code:R},breaks_if_changed:A(H,Oe),budget:{...$.budget,truncated:[...x,...Ft]}};return ds(JSON.stringify(Se))>i},Z=m,ee=y;if(B(Z,ee,0,0)){let H=Mn(t,p,{depth:1,graph:s}),Oe=new Set("not_found"in H?[]:H.impacted.map(sr=>sr.id)),F=new Set("not_found"in H?[]:H.test_refs),Ft=[...m.filter(sr=>Oe.has(sr.id)),...m.filter(sr=>!Oe.has(sr.id))],Se=0;for(;Ft.length>Oe.size&&B(Ft,ee,Se,0);)Ft=Ft.slice(0,-1),Se++;let Jt=[...y],xe=0;for(;B(Ft,Jt,Se,xe);){let sr=-1;for(let D=Jt.length-1;D>=0;D--)if(!F.has(Jt[D])){sr=D;break}if(sr<0)break;Jt.splice(sr,1),xe++}Z=Ft,ee=Jt,Se+xe>0&&x.push(`breaks: omitted ${Se} feature(s) / ${xe} test(s)`),B(Z,ee,0,0)&&x.push("breaks: direct set retained in full \u2014 exceeds budget")}let T=A(Z,ee),j={...$,needs:I,must_edit:{...$.must_edit,code:R},breaks_if_changed:T},Ne=j;if(d){let H={...j,prior_attempts:d};ds(JSON.stringify(H))<=i?Ne=H:x.push("prior_attempts: omitted (budget)")}let U=ds(JSON.stringify(Ne));return{...Ne,budget:{max_tokens:i,used_tokens:U,truncated:x},authority:s.authority}}var qNe,VNe,ik=S(()=>{"use strict";H0();rk();a2();SY();Nu();Ou();qNe=3e3,VNe=3});function wY(t){return ds(JSON.stringify({...t,authority:void 0}))}function Vs(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 GNe(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 xY(t,e,r=".",n){let i=Ro(t,{graph:n}),s=t.features??[],o=[];for(let f of s){let h=Du(t,f.id,{cwd:r,read:e,graph:i});if("not_found"in h)continue;let m=Du(t,f.id,{cwd:r,read:e,maxTokens:Number.MAX_SAFE_INTEGER,graph:i}),y=tk(t,f.id,{graph:i}),v=!("not_found"in y),g=wY(h),b="not_found"in m?g:wY(m),w=ds(JSON.stringify(f));for(let I of f.modules??[]){let E=e(I);E&&(w+=ds(E))}let x=(f.depends_on??[]).length,$=i.dependents([f.id],1).ids.size;o.push({id:f.id,sliceTokens:g,structuralTokens:b,naiveTokens:w,contextRatio:w>0?g/w:1,budgetSaturated:h.budget.truncated.length>0,searchDepth:v?y.depthUsed:1,edgesResolved:x+$,stoppedBy:v?y.stoppedBy:"n/a",coverage:v?y.analysis.coverage:1,regressionTests:h.breaks_if_changed.regression_tests.length})}o.sort((f,h)=>f.id.localeCompare(h.id));let a=o.map(f=>f.contextRatio),c=f=>f.filter(h=>h.sliceTokens>0).map(h=>h.naiveTokens/h.sliceTokens),l=o.filter(f=>!f.budgetSaturated),u=o.filter(f=>f.budgetSaturated),d=o.filter(f=>f.naiveTokens>0).map(f=>f.structuralTokens/f.naiveTokens),p={};for(let f of o)p[f.stoppedBy]=(p[f.stoppedBy]??0)+1;return{featureCount:s.length,measured:o.length,context:{medianContextRatio:Math.round(Vs(a)*1e3)/1e3,medianShrinkFactor:Math.round(Vs(c(o))*10)/10,fitsCount:l.length,truncatedCount:u.length,medianShrinkFit:Math.round(Vs(c(l))*10)/10,medianShrinkTruncated:Math.round(Vs(c(u))*10)/10,medianStructuralRatio:Math.round(Vs(d)*100)/100,medianSliceTokens:Math.round(Vs(o.map(f=>f.sliceTokens))),medianNaiveTokens:Math.round(Vs(o.map(f=>f.naiveTokens)))},search:{medianDepth:Vs(o.map(f=>f.searchDepth)),p95Depth:GNe(o.map(f=>f.searchDepth),95),medianEdges:Vs(o.map(f=>f.edgesResolved)),maxEdges:o.reduce((f,h)=>Math.max(f,h.edgesResolved),0)},stability:{byStopReason:p,medianCoverage:Math.round(Vs(o.map(f=>f.coverage).filter(f=>f!==null))*100)/100,medianRegressionTests:Vs(o.map(f=>f.regressionTests))},features:o}}var gf,sk=S(()=>{"use strict";H0();a2();ik();Ou();gf="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as HNe,existsSync as d2,mkdirSync as WNe,readFileSync as kY}from"node:fs";import{dirname as ZNe,join as JNe}from"node:path";function p2(t){return JNe(t,KNe,YNe)}function XNe(t,e){return{timestamp:new Date().toISOString(),head:Bs(t),spec_digest:Zy(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function EY(t,e){try{let r=XNe(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=f2(t),i=n[n.length-1];if(i&&i.head===r.head&&i.spec_digest===r.spec_digest)return{appended:!1,reason:"deduped"};let s=p2(t),o=ZNe(s);return d2(o)||WNe(o,{recursive:!0}),HNe(s,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function AY(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 f2(t,e){let r=p2(t);if(!d2(r))return[];let n;try{n=kY(r,"utf8")}catch{return[]}let i=AY(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function $Y(t){let e=p2(t);if(!d2(e))return{snapshots:[],unreadable:!1};let r;try{r=kY(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=AY(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function eb(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 IY(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 s=r;s0?t[s-1]:null,c=(d,p=0)=>a?` (${eb(d(o)-d(a),p)})`:"",l=o.timestamp.slice(0,19),u=o.head?o.head.slice(0,7):"nogit";i.push(` ${l} ${u} \xB7 ${o.featureCount} feat \xB7 slice ${o.context.medianSliceTokens}${c(d=>d.context.medianSliceTokens)} \xB7 struct ${o.context.medianStructuralRatio.toFixed(2)}${c(d=>d.context.medianStructuralRatio,2)} \xB7 cov ${o.stability.medianCoverage.toFixed(2)}${c(d=>d.stability.medianCoverage,2)} \xB7 p95depth ${o.search.p95Depth}${c(d=>d.search.p95Depth)} \xB7 trunc ${o.context.truncatedCount}${c(d=>d.context.truncatedCount)}`)}return i.push(` ${gf}`),i.join(` +`)}var KNe,YNe,tb=S(()=>{"use strict";ff();sk();KNe=".cladding",YNe="measure.jsonl"});import{existsSync as QNe}from"node:fs";import{join as eDe}from"node:path";function yf(t){if(t.groups.reduce((i,s)=>i+s.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 s of i.features){r.push(`- **${s.title}** (${tDe[s.change]})`);for(let o of s.acceptance)r.push(` - ${o}`)}r.push("")}if(t.unsharded_commits.length>0){r.push("## Other changes (not yet spec-tracked)","");for(let i of t.unsharded_commits)r.push(`- ${i.subject}`);r.push("")}let n=t.inventory;for((n.before.features!==n.after.features||n.before.scenarios!==n.after.scenarios)&&r.push(`_Spec inventory: ${n.before.features} \u2192 ${n.after.features} features, ${n.before.scenarios} \u2192 ${n.after.scenarios} scenarios._`,"");r[r.length-1]==="";)r.pop();return r.join(` +`)}function RY(t){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 s=t.sinceSnapshot;if(s){let o=t.sinceRef??(s.head?s.head.slice(0,7):"previous");r.push(`- since ${o}: slice ${eb(n.medianSliceTokens-s.context.medianSliceTokens)} \xB7 struct ${eb(n.medianStructuralRatio-s.context.medianStructuralRatio,2)} \xB7 cov ${eb(i.medianCoverage-s.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`,"",gf),r.join(` +`)}function bf(t,e,r){let n=[`# Audit \u2014 shipped changes since ${t.since}`,"","| feature | AC | EARS | verification refs |","|---|---|---|---|"],i=new Map(e.features.map(s=>[s.id,s]));for(let s of t.groups)for(let o of s.features){let a=i.get(o.id);if(!a){n.push(`| ${o.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"} | ${nDe(l,r)} |`)}return n.join(` +`)}function nDe(t,e){let r=[...t.test_refs??[],...t.oracle_refs??[],...t.evidence_refs??[]];return r.length===0?"(none)":r.map(n=>{for(let[s,o]of rDe)if(n.startsWith(s))return`${n} (${o})`;let i=n.split("#",1)[0]??n;return`${QNe(eDe(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function vf(t){let e=[`# ${t.project.name} \u2014 capability catalog`,""],r=[...t.capabilities??[]].filter(o=>typeof o.id=="string"&&o.id.length>0).sort((o,a)=>o.id.localeCompare(a.id)),n=new Map(t.features.map(o=>[o.id,o])),i=new Set;for(let o of r){e.push(`## ${o.title??o.id}`,""),o.summary&&e.push(o.summary,"");for(let a of o.features??[]){let c=n.get(a);!c||c.status==="archived"||(i.add(a),PY(e,c))}}let s=t.features.filter(o=>!i.has(o.id)&&o.status!=="archived").sort((o,a)=>o.id.localeCompare(a.id));if(s.length>0){e.push("## Uncategorized","");for(let o of s)PY(e,o)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function PY(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=Uj(r);n&&t.push(`- ${n}`)}t.push("")}var tDe,rDe,ok=S(()=>{"use strict";tb();sk();pf();tDe={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};rDe=[["derived:","machine-suggested \u2014 not author-confirmed"],["self-dogfood:","verified by cladding running on itself"],["fixture:","conformance fixture"],["script:","npm script"]]});import{readFileSync as iDe}from"node:fs";function ju(t="./spec.yaml"){let e=iDe(t,"utf8");return(0,CY.parse)(e)}var CY,ak=S(()=>{"use strict";CY=Et(cr(),1)});function lk(t){let e=t.replaceAll("\\","/").replace(/^\.\//,"");if(!e||e.startsWith("/")||e.split("/").some(r=>r===".."))throw new Error(`managed artifact path must be repository-relative: ${t}`);return e}function Lu(t,e){let r=lk(t);return ck.filter(n=>n.compatibilityAliases.includes(r)||(n.matcher.kind==="exact"?n.matcher.value===r:n.matcher.value.test(r))?e===void 0||n.ownership.region===e:!1)}function rb(t){let e=Lu(t.path,t.region);if(t.region===void 0&&e.some(n=>n.ownership.kind==="region"))throw new Error(`managed region write for ${t.path} requires an explicit region`);if(e.length!==1){let n=e.length===0?"no descriptor":e.map(i=>i.id).join(", ");throw new Error(`managed write ownership for ${t.path}${t.region?`#${t.region}`:""} is not unique: ${n}`)}let r=e[0];if(t.operation==="delete"){if(r.mutability!=="mutable"&&!r.revocable)throw new Error(`${r.id} does not permit delete writes`);return r}if(r.mutability==="immutable"||r.mutability==="create-only"&&t.operation!=="create")throw new Error(`${r.id} does not permit ${t.operation} writes`);return r}function sDe(t){return[t.currentPath,...t.compatibilityAliases].some(e=>e.startsWith("spec/generated/"))}function TY(t=new Map){return["# Generated artifacts","","This notice is projected from the executable artifact registry. Do not edit.","",...ck.filter(r=>(r.authority==="generated"||r.authority==="migration")&&sDe(r)).sort((r,n)=>r.id.localeCompare(n.id)).map(r=>{let n=r.compatibilityAliases[0],i=t.get(r.id)??r.currentPath,s=n===void 0?"":n===i?" Relocated.":` Current location; relocation target \`${n}\`.`;return`- \`${i}\` \u2014 ${r.id}; ${r.refresh}.${s}`}),""].join(` +`)}var en,Yc,ck,_f=S(()=>{"use strict";en=t=>({kind:"exact",value:t}),Yc=t=>({kind:"pattern",value:t}),ck=[{id:"spec-schema-region",currentPath:"spec.yaml",compatibilityAliases:[],matcher:en("spec.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"schema",authority:"migration",mutability:"mutable",persistence:"committed",producer:"F4 migration transaction",consumers:["spec compiler","legacy loader"],inputs:["approved root-schema transition"],refresh:"only during an approved transactional schema switch",ownership:{kind:"region",region:"schema"}},{id:"spec-project-region",currentPath:"spec.yaml",compatibilityAliases:[],matcher:en("spec.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"project",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"authoring transaction",consumers:["spec compiler","legacy loader"],inputs:["project contract"],refresh:"human or transactional edit",ownership:{kind:"region",region:"project"}},{id:"spec-inventory-region",currentPath:"spec.yaml",compatibilityAliases:[],matcher:en("spec.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"inventory",authority:"generated",mutability:"mutable",persistence:"committed",producer:"clad sync",consumers:["spec compiler","onboarding"],inputs:["shard census"],refresh:"after inventory-affecting sync",ownership:{kind:"region",region:"inventory"}},{id:"feature-shard",currentPath:"spec/features/-.yaml",compatibilityAliases:["spec/features/F-NNN.yaml"],matcher:Yc(/^spec\/features\/[^/]+\.ya?ml$/),supportedSchemaVersions:["0.1","0.2"],domain:"feature",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"feature authoring transaction",consumers:["spec compiler","legacy loader","detectors"],inputs:["feature contract"],refresh:"on feature authoring",ownership:{kind:"file"}},{id:"scenario-shard",currentPath:"spec/scenarios/-.yaml",compatibilityAliases:["spec/scenarios/S-NNN.yaml"],matcher:Yc(/^spec\/scenarios\/[^/]+\.ya?ml$/),supportedSchemaVersions:["0.1","0.2"],domain:"scenario",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"scenario authoring transaction",consumers:["spec compiler","legacy loader"],inputs:["scenario contract"],refresh:"on scenario authoring",ownership:{kind:"file"}},{id:"architecture-contract",currentPath:"spec/architecture.yaml",compatibilityAliases:[],matcher:en("spec/architecture.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"architecture",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"authoring transaction",consumers:["spec compiler","architecture detector"],inputs:["architecture rules"],refresh:"on architecture edit",ownership:{kind:"file"}},{id:"capability-catalog",currentPath:"spec/capabilities.yaml",compatibilityAliases:[],matcher:en("spec/capabilities.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"capability",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"capability authoring transaction",consumers:["spec compiler","legacy loader"],inputs:["capability catalog"],refresh:"on capability edit",ownership:{kind:"file"}},{id:"conformance-fixture-registry",currentPath:"conformance/fixtures.yaml",compatibilityAliases:[],matcher:en("conformance/fixtures.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"fixture-registry",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"conformance fixture authors",consumers:["spec compiler","fixture-reference detector"],inputs:["fixture declarations"],refresh:"on fixture registration edit",ownership:{kind:"file"}},{id:"package-scripts-region",currentPath:"package.json",compatibilityAliases:[],matcher:en("package.json"),supportedSchemaVersions:["0.1","0.2"],domain:"package-scripts",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"package authoring transaction",consumers:["spec compiler","script runners"],inputs:["package scripts"],refresh:"on package-script edit",ownership:{kind:"region",region:"scripts"}},{id:"trust-registry",currentPath:"spec/trust/issuers.yaml",compatibilityAliases:[],matcher:en("spec/trust/issuers.yaml"),supportedSchemaVersions:["0.2"],domain:"trust",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"issuer registration transaction",consumers:["assurance gate","receipt verifier","MCP receipt ingest"],inputs:["registered issuer public keys"],refresh:"on reviewed issuer registration",ownership:{kind:"file"}},{id:"evidence-receipt",currentPath:"spec/evidence//.yaml",compatibilityAliases:[],matcher:Yc(/^spec\/evidence\/F-[^/]+\/[a-f0-9]{64}\.yaml$/),supportedSchemaVersions:["0.2"],domain:"evidence",authority:"evidence",mutability:"create-only",persistence:"committed",producer:"registered evidence channel",consumers:["proof compiler","attestation"],inputs:["signed receipt digest and subject"],refresh:"create once; revoke through an explicit future operation",revocable:!0,ownership:{kind:"file"}},{id:"migration-baseline",currentPath:"spec/generated/migration-baseline-0.1-to-0.2.yaml",compatibilityAliases:[],matcher:en("spec/generated/migration-baseline-0.1-to-0.2.yaml"),supportedSchemaVersions:["0.2"],domain:"migration",authority:"migration",mutability:"create-only",persistence:"committed",producer:"F4 migration transaction",consumers:["migration validator","spec compiler"],inputs:["schema 0.1 source corpus"],refresh:"one immutable upgrade receipt",ownership:{kind:"file"}},{id:"generated-index",currentPath:"spec/index.yaml",compatibilityAliases:["spec/generated/index.yaml"],matcher:en("spec/index.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"index",authority:"generated",mutability:"mutable",persistence:"committed",producer:"clad sync",consumers:["lookup tools"],inputs:["sharded spec"],refresh:"on sync",ownership:{kind:"file"}},{id:"generated-doc-links",currentPath:"spec/_doc-links.yaml",compatibilityAliases:["spec/generated/_doc-links.yaml"],matcher:en("spec/_doc-links.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"documentation",authority:"generated",mutability:"mutable",persistence:"committed",producer:"document-link extractor",consumers:["document integrity detector"],inputs:["document declarations"],refresh:"on sync",ownership:{kind:"file"}},{id:"project-context",currentPath:"docs/project-context.md",compatibilityAliases:[],matcher:en("docs/project-context.md"),supportedSchemaVersions:["0.1","0.2"],domain:"project-context",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"project maintainers",consumers:["design-impact review","context readers"],inputs:["project architecture context"],refresh:"on reviewed project-context change",ownership:{kind:"file"}},{id:"spec-02-design-document",currentPath:"docs/design/**/*.md",compatibilityAliases:[],matcher:Yc(/^docs\/design\/(?:[^/]+\/)*[^/]+\.md$/),supportedSchemaVersions:["0.1","0.2"],domain:"design",authority:"canonical",mutability:"mutable",persistence:"committed",producer:"design maintainers",consumers:["design-impact review","spec compiler"],inputs:["accepted target-design decisions"],refresh:"on reviewed design decision change",ownership:{kind:"file"}},{id:"generated-attestation",currentPath:"spec/attestation.yaml",compatibilityAliases:["spec/generated/attestation.yaml"],matcher:en("spec/attestation.yaml"),supportedSchemaVersions:["0.1","0.2"],domain:"attestation",authority:"generated",mutability:"mutable",persistence:"committed",producer:"qualifying completion gate",consumers:["attestation reader"],inputs:["green verification closure"],refresh:"only after a qualifying green gate",ownership:{kind:"file"}},{id:"generated-directory-notice",currentPath:"spec/generated/README.md",compatibilityAliases:[],matcher:en("spec/generated/README.md"),supportedSchemaVersions:["0.2"],domain:"generated-directory",authority:"generated",mutability:"mutable",persistence:"committed",producer:"artifact registry projection",consumers:["repository readers"],inputs:["ARTIFACT_DESCRIPTORS"],refresh:"on artifact registry change",ownership:{kind:"file"}},{id:"plugin-persona-skill-mirrors",currentPath:"plugins//managed-persona-skill-mirror",compatibilityAliases:[],matcher:Yc(/^plugins\/(?:claude-code\/(?:agents|commands|dist\/agents)|codex\/skills|antigravity\/skills|gemini-cli\/commands)(?:\/.*)?$/),supportedSchemaVersions:["0.1","0.2"],domain:"plugin-mirror",authority:"generated",mutability:"mutable",persistence:"committed",producer:"scripts/build-plugin.mjs mirror policy",consumers:["plugin hosts","criterion static adapter"],inputs:["src/agents persona briefs","skills SKILL.md inputs","plugin mirror policy"],refresh:"on canonical persona or skill change",ownership:{kind:"file"}},{id:"claude-bundled-engine",currentPath:"plugins/claude-code/dist/",compatibilityAliases:[],matcher:Yc(/^plugins\/claude-code\/dist\/(?:clad\.js|schema\.json)$/),supportedSchemaVersions:["0.1","0.2"],domain:"plugin-engine",authority:"generated",mutability:"mutable",persistence:"committed",producer:"scripts/build-plugin.mjs",consumers:["Claude Code plugin host"],inputs:["dist/clad.js","dist/schema.json"],refresh:"after engine build",ownership:{kind:"file"}},{id:"claude-plugin-detector-region",currentPath:"plugins/claude-code/.claude-plugin/plugin.json",compatibilityAliases:[],matcher:en("plugins/claude-code/.claude-plugin/plugin.json"),supportedSchemaVersions:["0.1","0.2"],domain:"plugin-manifest",authority:"generated",mutability:"mutable",persistence:"committed",producer:"scripts/build-plugin.mjs",consumers:["Claude Code plugin host","harness integrity detector"],inputs:["src/stages/detectors filesystem"],refresh:"on plugin build",ownership:{kind:"region",region:"ironclad.detectors"}},{id:"claude-plugin-stages-region",currentPath:"plugins/claude-code/.claude-plugin/plugin.json",compatibilityAliases:[],matcher:en("plugins/claude-code/.claude-plugin/plugin.json"),supportedSchemaVersions:["0.1","0.2"],domain:"plugin-manifest",authority:"generated",mutability:"mutable",persistence:"committed",producer:"scripts/build-plugin.mjs",consumers:["Claude Code plugin host","harness integrity detector"],inputs:["src/cli/clad.ts TIER_STAGES.all"],refresh:"on plugin build",ownership:{kind:"region",region:"stages-implemented"}},{id:"compiler-cache",currentPath:".cladding/cache/spec-compiler",compatibilityAliases:[],matcher:Yc(/^\.cladding\/cache\/spec-compiler(?:\/[^/]+)*$/),supportedSchemaVersions:["0.1","0.2"],domain:"compiler",authority:"transient",mutability:"mutable",persistence:"workspace-cache",producer:"spec compiler",consumers:["spec compiler"],inputs:["disposable input digests"],refresh:"disposable cache refresh",ownership:{kind:"file"}},{id:"workspace-audit",currentPath:".cladding/audit",compatibilityAliases:[],matcher:Yc(/^\.cladding\/audit(?:\/[^/]+)*$/),supportedSchemaVersions:["0.1","0.2"],domain:"workspace-audit",authority:"transient",mutability:"mutable",persistence:"workspace-cache",producer:"local audit commands",consumers:["local audit readers"],inputs:["local command output"],refresh:"replaceable local diagnostics",ownership:{kind:"file"}},{id:"event-ledger",currentPath:".cladding/events.log.jsonl",compatibilityAliases:[],matcher:en(".cladding/events.log.jsonl"),supportedSchemaVersions:["0.1","0.2"],domain:"event-ledger",authority:"transient",mutability:"mutable",persistence:"workspace-cache",producer:"event ledger and F4 transaction",consumers:["MCP event reader","lifecycle reports"],inputs:["committed lifecycle transitions"],refresh:"append under the workspace transaction lock",ownership:{kind:"file"}},{id:"asserted-audit-ledger",currentPath:".cladding/audit.log.jsonl",compatibilityAliases:[],matcher:en(".cladding/audit.log.jsonl"),supportedSchemaVersions:["0.1","0.2"],domain:"evidence-history",authority:"transient",mutability:"mutable",persistence:"workspace-cache",producer:"asserted signoff and legacy audit commands",consumers:["HITL readers","MCP audit resource"],inputs:["asserted evidence entries"],refresh:"append under the F4 workspace transaction lock",ownership:{kind:"file"}}]});function sb(t,e=[]){let r=OY.get(t);return r||(r=new h2(t.nodes,t.edges,t.presentations,t.aliases,[]),OY.set(t,r)),e.length===0?r:r.withAugmentations(e)}function zY(t){if(t==="project"||/^(?:capability|scenario|architecture_rule):[A-Za-z0-9][A-Za-z0-9._-]*$/.test(t)||/^feature:F-[A-Za-z0-9][A-Za-z0-9._-]*$/.test(t)||/^criterion:F-[A-Za-z0-9][A-Za-z0-9._-]*\/AC-[A-Za-z0-9][A-Za-z0-9._-]*$/.test(t))return{address:t,via:"canonical",form:"canonical"};if(t.startsWith("artifact:"))try{return{address:ct(t.slice(9)),via:"canonical",form:"canonical"}}catch{return}let e=Jc(t);return e?{address:an(e.path,e.selector),via:"anchor",form:"anchor"}:void 0}function uDe(t){if(/^(?:artifact|anchor|capability|feature|criterion|scenario|architecture_rule):/.test(t)||t==="project")return;let e=t.indexOf("#");try{if(e>=0){let r=t.slice(0,e),n=t.slice(e+1);return n?{address:an(r,n),via:"anchor",form:"anchor"}:void 0}return{address:ct(t),via:"path",form:"path"}}catch{return}}function dDe(t){if(!Array.isArray(t.seeds)||t.seeds.length===0)throw new Error("GraphIR projection requires at least one explicit seed");if(!Array.isArray(t.rules)||t.rules.length===0)throw new Error("GraphIR projection requires at least one explicit relation-direction rule");for(let e of t.rules)if(!lDe.has(e.relation)||e.direction!=="outbound"&&e.direction!=="inbound")throw new Error("GraphIR projection rules require a known relation and explicit inbound or outbound direction");if(nb("maxHops",t.maxHops),nb("maxNodes",t.maxNodes),nb("maxEdges",t.maxEdges),t.maxNodes===0)throw new Error("GraphIR maxNodes must retain at least one required seed");if(t.maxEdges===0&&t.maxHops>0)throw new Error("GraphIR maxEdges can be zero only for a depth-zero seed projection")}function nb(t,e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`GraphIR ${t} must be a finite non-negative integer`)}function ib(t){if(!Gs(t)||zY(t)?.address!==t)throw new Error(`GraphIR augmentation address is not canonical: ${String(t)}`)}function pDe(t){if(!Gs(t.layerId))throw new Error("GraphIR augmentation layer id must be nonblank");if(!Array.isArray(t.nodes)||!Array.isArray(t.edges)||!Array.isArray(t.unknownReasons))throw new Error(`GraphIR augmentation layer has an invalid structural shape: ${t.layerId}`);if(t.completeness!=="complete"&&t.completeness!=="unknown")throw new Error(`GraphIR augmentation layer has an invalid completeness state: ${t.layerId}`);if(t.unknownReasons.some(e=>!Gs(e)))throw new Error(`GraphIR augmentation layer has a blank unknown reason: ${t.layerId}`);if(t.completeness==="unknown"&&t.unknownReasons.length===0)throw new Error(`GraphIR unknown augmentation layer requires a reason: ${t.layerId}`);if(t.completeness==="complete"&&t.unknownReasons.length>0)throw new Error(`GraphIR complete augmentation layer cannot retain unknown reasons: ${t.layerId}`)}function fDe(t){if(!t||typeof t!="object"||t.provenance!=="authored"&&t.provenance!=="derived"&&t.provenance!=="observed")throw new Error("GraphIR augmentation node must retain explicit provenance");if(ib(t.address),yDe(t.provenance,t.locator,`GraphIR augmentation node ${t.address}`),t.nodeType==="artifact"){if(!t.address.startsWith("artifact:"))throw new Error(`GraphIR augmentation artifact fact has a non-artifact address: ${t.address}`);if(!Array.isArray(t.roles)||t.roles.length===0||t.roles.some(r=>!oDe.has(r)))throw new Error(`GraphIR augmentation artifact fact has invalid roles: ${t.address}`);if(new Set(t.roles).size!==t.roles.length)throw new Error(`GraphIR augmentation artifact fact repeats a role: ${t.address}`);if(!Array.isArray(t.owners))throw new Error(`GraphIR augmentation artifact fact has invalid owners: ${t.address}`);return}if(t.nodeType!=="anchor")throw new Error(`GraphIR augmentation node has an unsupported taxonomy: ${t.address}`);let e=Jc(t.address);if(!e||!Gs(t.selector)||t.artifact!==ct(e.path)||t.selector!==e.selector||t.selectorProvenance!=="authored"&&t.selectorProvenance!=="derived")throw new Error(`GraphIR augmentation anchor fact does not match its canonical address: ${t.address}`)}function hDe(t,e){if(t.nodeType==="artifact"){for(let r of t.owners)if(xf(r,e,`GraphIR augmentation artifact owner for ${t.address}`),kf(e.get(r))!=="feature")throw new Error(`GraphIR augmentation artifact owner must be a feature: ${r}`);return}if(xf(t.artifact,e,`GraphIR augmentation anchor artifact for ${t.address}`),kf(e.get(t.artifact))!=="artifact")throw new Error(`GraphIR augmentation anchor artifact must be an artifact node: ${t.artifact}`)}function mDe(t,e){t.provenance==="observed"?gDe(t,e):bDe(t,e)}function gDe(t,e){if(!t||typeof t!="object"||t.provenance!=="observed")throw new Error("GraphIR observation edge must retain observed provenance");if(!Gs(t.identity))throw new Error("GraphIR observation edge identity must be nonblank");if(UY(t.owner,`GraphIR observation edge ${t.identity}`),xf(t.from,e,`GraphIR observation edge source for ${t.identity}`),xf(t.to,e,`GraphIR observation edge target for ${t.identity}`),!cDe.has(t.state))throw new Error(`GraphIR observation edge has an invalid state: ${t.identity}`);if(t.channel!==void 0&&!aDe.has(t.channel))throw new Error(`GraphIR observation edge has an invalid channel: ${t.identity}`);if(t.raw!==void 0&&typeof t.raw!="string")throw new Error(`GraphIR observation edge has an invalid raw detail: ${t.identity}`);if(t.normalizedTarget!==void 0&&(ib(t.normalizedTarget),t.state!=="unresolved"&&!e.has(t.normalizedTarget)))throw new Error(`GraphIR observation edge normalized target for ${t.identity} is absent from the combined GraphIR node set: ${t.normalizedTarget}`);t.selector!==void 0&&qY(t.selector,t.identity),vDe(t,e)}function UY(t,e){if(!t||typeof t!="object"||t.kind!=="runtime_observation"||!Gs(t.adapter)||!Gs(t.reference))throw new Error(`${e} requires a nonblank runtime observation adapter and reference`)}function BY(t,e){if(!t||typeof t!="object"||t.kind!=="text_source"||!Gs(t.path))throw new Error(`${e} requires a nonblank text source path`);try{if(ct(t.path).slice(9)!==t.path)throw new Error("noncanonical path")}catch{throw new Error(`${e} requires a canonical repository-relative text source path`)}if(t.selector!==void 0&&!Gs(t.selector))throw new Error(`${e} has a blank text source selector`)}function yDe(t,e,r){t==="observed"?UY(e,r):BY(e,r)}function bDe(t,e){if(!t||typeof t!="object"||t.provenance!=="authored"&&t.provenance!=="derived")throw new Error("GraphIR structural edge must retain authored or derived provenance");if(!Gs(t.identity))throw new Error("GraphIR structural edge identity must be nonblank");if(BY(t.owner,`GraphIR structural edge ${t.identity}`),xf(t.from,e,`GraphIR structural edge source for ${t.identity}`),t.state!=="resolved"&&t.state!=="unresolved")throw new Error(`GraphIR structural edge has a non-structural state: ${t.identity}`);if(ib(t.to),t.state==="resolved"&&xf(t.to,e,`GraphIR structural edge target for ${t.identity}`),t.raw!==void 0&&typeof t.raw!="string")throw new Error(`GraphIR structural edge has an invalid raw detail: ${t.identity}`);if(t.normalizedTarget!==void 0&&(ib(t.normalizedTarget),t.state==="resolved"&&!e.has(t.normalizedTarget)))throw new Error(`GraphIR structural edge normalized target for ${t.identity} is absent from the combined GraphIR node set: ${t.normalizedTarget}`);t.selector!==void 0&&qY(t.selector,t.identity),_De(t,e)}function xf(t,e,r){if(ib(t),!e.has(t))throw new Error(`${r} is absent from the combined GraphIR node set: ${t}`)}function qY(t,e){if(!(t.precision==="none"&&t.value===void 0)&&!(t.precision==="fragment"&&Gs(t.value)))throw new Error(`GraphIR augmentation edge has an invalid selector: ${e}`)}function vDe(t,e){let r=y2.get(t.relation);if(!r)throw new Error(`GraphIR augmentation edge has an unknown relation: ${t.relation}`);let n=kf(e.get(t.from)),i=kf(e.get(t.to));if(!r[0].includes(n)||!r[1].includes(i))throw new Error(`GraphIR augmentation edge has invalid ${t.relation} endpoint taxonomy: ${n} -> ${i}`)}function _De(t,e){let r=y2.get(t.relation);if(!r)throw new Error(`GraphIR augmentation edge has an unknown relation: ${t.relation}`);let n=kf(e.get(t.from)),i=e.get(t.to),s=i===void 0?SDe(t.to):kf(i);if(!r[0].includes(n)||!r[1].includes(s))throw new Error(`GraphIR augmentation edge has invalid ${t.relation} endpoint taxonomy: ${n} -> ${s}`)}function kf(t){return t.nodeType==="artifact"||t.nodeType==="anchor"?t.nodeType:t.kind}function SDe(t){return t.startsWith("artifact:")?"artifact":t.startsWith("anchor:")?"anchor":t==="project"?"project":t.slice(0,t.indexOf(":"))}function wDe(t,e){let r=new Map(t);for(let n of e){let i=r.get(n.address);if(!i){r.set(n.address,n);continue}if(i.nodeType!==n.nodeType)throw new Error(`GraphIR incompatible node taxonomy collision: ${n.address}`);if(n.nodeType!=="artifact"||i.nodeType!=="artifact"){if(Ta(i)!==Ta(n))throw new Error(`GraphIR incompatible node collision: ${n.address}`);continue}r.set(n.address,xDe(i,n))}return new Map([...r.entries()].sort(([n],[i])=>n.localeCompare(i)))}function xDe(t,e){let r=mt([...new Set([...t.roles,...e.roles])].sort()),n=mt([...new Set([...t.owners,...e.owners])].sort());if(VY(t))return Fn({...t,roles:r,owners:n});let i=kDe(t,e);return Fn({address:i.address,nodeType:"artifact",roles:r,owners:n,provenance:i.provenance,locator:EDe(i.locator)})}function kDe(t,e){return NY(t)<=NY(e)?t:e}function NY(t){return`${t.provenance==="authored"?"0":t.provenance==="derived"?"1":"2"}:${Ta(t.locator)}`}function EDe(t){return t.kind==="text_source"?Fn({kind:"text_source",path:t.path,...t.selector===void 0?{}:{selector:t.selector}}):Fn({kind:"runtime_observation",adapter:t.adapter,reference:t.reference})}function Gs(t){return typeof t=="string"&&t.trim().length>0}function uk(t,e,r){let n=new Map;for(let i of t){let s=e(i),o=n.get(s);if(o===void 0)n.set(s,i);else if(Ta(o)!==Ta(i))throw new Error(`GraphIR conflicting duplicate ${r}: ${s}`)}return n}function DY(t,e){let r=new Map;for(let n of t){let i=r.get(n[e])??[];i.push(n),r.set(n[e],i)}return new Map([...r.entries()].map(([n,i])=>[n,mt(ps(i,Xc))]))}function ADe(t){let e=new Map;for(let r of t){let n=e.get(r.alias)??[];n.push(r),e.set(r.alias,n)}return new Map([...e.entries()].map(([r,n])=>[r,mt(ps(n,m2))]))}function VY(t){return!("locator"in t)}function Fu(t){return"address"in t}function jY(t){return t.relation==="supports"&&t.provenance==="authored"&&t.channel!==void 0&&t.raw!==void 0&&t.normalizedTarget!==void 0&&t.selector!==void 0&&(t.state==="resolved"||t.state==="unresolved")}function LY(t){return{owner:t.from,channel:t.channel,raw:t.raw,normalizedTarget:t.normalizedTarget,selector:t.selector,resolution:t.state,source:t.owner}}function Xc(t){return Fu(t)?t.address:`${t.provenance}:${t.identity}`}function Sf(t){return mt(ps([...uk(t,Xc,"edge identity").values()],Xc))}function Mu(t){return t.state==="resolved"?t.canonical:void 0}function MY(t){return t.state==="resolved"?"":t.state==="ambiguous"?`${t.reason}: ${t.candidates.join(", ")}`:t.reason}function FY(t,e,r){return r.length>0||t.length>0?"unknown":e?"bounded":"complete"}function m2(t){return Ta(t)}function ps(t,e){return[...t].sort((r,n)=>e(r).localeCompare(e(n)))}function $De(t){return ps(t,e=>Ta(e))}function wf(t){return ps(t,e=>JSON.stringify(e))}function mt(t){return Object.freeze([...t])}function Fn(t){return Object.freeze(t)}function g2(t){if(Array.isArray(t))return Object.freeze(t.map(e=>g2(e)));if(t!==null&&typeof t=="object"){let e=Object.fromEntries(Object.entries(t).map(([r,n])=>[r,g2(n)]));return Object.freeze(e)}return t}function Ta(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(Ta).join(",")}]`;let e=t;return`{${Object.keys(e).sort().filter(r=>e[r]!==void 0).map(r=>`${JSON.stringify(r)}:${Ta(e[r])}`).join(",")}}`}var OY,oDe,aDe,cDe,y2,lDe,h2,b2=S(()=>{"use strict";qs();OY=new WeakMap,oDe=new Set(["spec","doc","source","test","oracle","evidence","skill","generated"]),aDe=new Set(["test","oracle","evidence"]),cDe=new Set(["resolved","unresolved","passed","failed","skipped","stale","unknown","unobserved"]),y2=new Map([["contains",[["feature"],["criterion"]]],["defined_in",[["feature","criterion","capability","scenario","architecture_rule","project"],["artifact"]]],["contributes_to",[["feature"],["capability"]]],["depends_on",[["feature"],["feature"]]],["participates_in",[["scenario"],["feature"]]],["touches",[["feature"],["artifact"]]],["constrained_by",[["criterion"],["architecture_rule"]]],["covers",[["anchor"],["criterion"]]],["supports",[["criterion"],["artifact","anchor"]]],["traces_to",[["anchor"],["criterion"]]],["explains",[["artifact","anchor"],["feature","criterion","capability","scenario","architecture_rule","project"]]],["mentions",[["artifact","anchor"],["feature","criterion","capability","scenario","architecture_rule","project"]]],["links_to",[["artifact","anchor"],["artifact","anchor"]]]]),lDe=new Set(y2.keys());h2=class t{nodeByAddress;allNodes;allEdges;baseNodes;baseEdges;outbound;inbound;presentations;aliases;aliasTargets;layerUnknownReasons;constructor(e,r,n,i,s,o=e.filter(VY),a=r.filter(Fu)){this.nodeByAddress=uk(e,c=>c.address,"node address"),this.allNodes=mt(ps([...this.nodeByAddress.values()],c=>c.address)),this.allEdges=Sf(r),this.baseNodes=mt(ps([...uk(o,c=>c.address,"base node address").values()],c=>c.address)),this.baseEdges=mt(ps([...uk(a,c=>c.address,"base edge identity").values()],c=>c.address)),this.outbound=DY(this.allEdges,"from"),this.inbound=DY(this.allEdges,"to"),this.presentations=mt(ps(n,m2)),this.aliases=mt(ps(i,m2)),this.aliasTargets=ADe(this.aliases),this.layerUnknownReasons=mt([...new Set(s)].sort()),Object.freeze(this)}withAugmentations(e){let r=new Set,n=[],i=[],s=[];for(let a of e){let c=g2(a);if(pDe(c),r.has(c.layerId))throw new Error(`GraphIR augmentation layer id is not unique: ${c.layerId}`);r.add(c.layerId),n.push(...c.nodes),i.push(...c.edges),c.completeness==="unknown"&&s.push(...c.unknownReasons.map(l=>`${c.layerId}: ${l}`))}for(let a of n)fDe(a);let o=wDe(this.nodeByAddress,n);for(let a of n)hDe(a,o);for(let a of i)mDe(a,o);return new t([...o.values()],[...this.allEdges,...i],this.presentations,this.aliases,[...this.layerUnknownReasons,...s],this.baseNodes,this.baseEdges)}nodes(){return this.allNodes}edges(){return this.allEdges}presentationRecords(){return this.presentations}aliasRecords(){return this.aliases}resolveAddress(e){let r=e;if(/^AC-[^\s/]+$/.test(r))return Fn({state:"unresolved",input:e,form:"noncanonical",reason:"bare criterion ids are noncanonical and are never guessed"});let n=new Map,i=(c,l)=>{this.nodeByAddress.has(c)&&n.set(c,l)},s=zY(r);s&&i(s.address,s.via);for(let c of this.aliasTargets.get(r)??[])i(c.address,c.kind);let o=uDe(r);o&&i(o.address,o.via);let a=[...n.keys()].sort();if(a.length===1){let c=a[0];return Fn({state:"resolved",input:e,canonical:c,via:n.get(c)??"canonical"})}return a.length>1?Fn({state:"ambiguous",input:e,candidates:mt(a),reason:"more than one canonical address matches this spelling"}):Fn(s?{state:"unresolved",input:e,form:s.form,canonical:s.address,reason:"canonical address is absent from this compilation"}:o?{state:"unresolved",input:e,form:o.form,canonical:o.address,reason:"normalized physical address is absent from this compilation"}:{state:"unresolved",input:e,form:"noncanonical",reason:"input is not a canonical address, feature id, feature slug, path, or exact anchor"})}prerequisites(e,r=1){nb("maxHops",r);let n=this.resolveAddress(e),i=Mu(n);if(!i)return this.unresolvedResult(n);let s=this.directedWalk(i,[{relation:"depends_on",direction:"outbound"}],r),o=s.edges.filter(Fu).filter(a=>a.provenance==="authored").map(a=>({feature:a.from,prerequisite:a.to,source:a.owner}));return this.result(o,[n],s.unknownReasons)}dependents(e,r=1){nb("maxHops",r);let n=this.resolveAddress(e),i=Mu(n);if(!i)return this.unresolvedResult(n);let s=this.directedWalk(i,[{relation:"depends_on",direction:"inbound"}],r),o=s.edges.filter(Fu).filter(a=>a.provenance==="authored").map(a=>({feature:a.to,dependent:a.from,source:a.owner}));return this.result(o,[n],s.unknownReasons)}artifactOwners(e){let r=this.resolveAddress(e),n=Mu(r);if(!n)return this.unresolvedResult(r);let i=this.nodeByAddress.get(n);return!i||i.nodeType!=="artifact"?this.result([],[r],["resolved input is not an artifact"]):i.owners.length===0?this.result([],[r],[`artifact has no known owner: ${n}`]):this.result([{artifact:n,owners:i.owners}],[r],[])}criterionProofs(e){let r=this.resolveAddress(e),n=Mu(r);if(!n)return this.unresolvedResult(r);let i=this.outboundRecords(n,"supports"),s=this.inboundRecords(n,"covers"),o=Sf([...i,...s]),a=this.edgeReasons(o);return o.length===0&&a.push(`criterion has no authored supports or covers: ${n}`),o.some(c=>c.provenance!=="observed")&&!o.some(c=>c.provenance==="observed"&&(c.relation==="covers"||c.relation==="supports"))&&a.push(`criterion has authored proof declarations but no observed proof fact: ${n}`),this.result(o,[r],a)}regressions(e){let r=this.resolveAddress(e),n=Mu(r);if(!n)return this.unresolvedResult(r);let i=this.nodeByAddress.get(n),s=i?.nodeType==="semantic"&&i.kind==="feature"?this.outboundRecords(n,"contains").map(l=>l.to):i?.nodeType==="semantic"&&i.kind==="criterion"?[n]:[];if(s.length===0)return this.result([],[r],[`resolved input has no contained criteria: ${n}`]);let o=s.flatMap(l=>this.outboundRecords(l,"supports")),a=o.filter(Fu).filter(jY).filter(l=>l.channel==="test").map(LY),c=this.edgeReasons(o);return a.length===0&&c.push(`input has no authored test regression references: ${n}`),this.result(a,[r],c)}project(e){dDe(e);let r=e.seeds.map(p=>this.resolveAddress(p)),n=r.filter(p=>p.state!=="resolved");if(n.length>0)return Fn({nodes:mt([]),edges:mt([]),completeness:"unresolved",reasons:mt(n.map(MY).sort()),resolutions:mt(r)});let i=[...new Set(r.map(p=>Mu(p)).filter(p=>p!==void 0))];if(e.maxNodes=e.maxNodes){u=!0,c.push(`node bound reached before seed: ${f}`);continue}s.set(f,h),a.push({address:f,hops:0})}}for(let p=0;p=e.maxHops))for(let h of this.nextEdges(f.address,e.rules)){let m=e.rules.find(b=>b.relation!==h.relation?!1:b.direction==="outbound"?h.from===f.address:h.to===f.address);if(!m)continue;let y=Xc(h);if(o.has(y))continue;if(o.size>=e.maxEdges){u=!0,c.push(`edge bound reached at ${y}`);continue}let v=m.direction==="outbound"?h.to:h.from,g=this.nodeByAddress.get(v);if(!g){l.push(`edge endpoint is absent: ${y}`);continue}if(!s.has(v)){if(s.size>=e.maxNodes){u=!0,c.push(`node bound reached at ${v}`);continue}s.set(v,g),a.push({address:v,hops:f.hops+1})}o.set(y,h)}}let d=FY(l,u,this.layerUnknownReasons);return Fn({nodes:mt(ps([...s.values()],p=>p.address)),edges:mt(ps([...o.values()],Xc)),completeness:d,reasons:mt([...new Set([...c,...l,...this.layerUnknownReasons])].sort()),resolutions:mt(r)})}corpusRecords(){let e=this.baseNodes.filter(l=>l.nodeType==="semantic").map(l=>({address:l.address,owner:l.kind==="criterion"?`feature:${l.address.slice(10).split("/")[0]}`:l.address,source:l.source})),r=this.baseNodes.filter(l=>l.nodeType==="semantic"&&l.kind==="feature").map(l=>l.address),n=Sf(r.flatMap(l=>this.directedWalk(l,[{relation:"depends_on",direction:"outbound"}],1).edges)).filter(Fu),i=Sf(r.flatMap(l=>this.directedWalk(l,[{relation:"depends_on",direction:"inbound"}],1).edges)).filter(Fu),s=n.filter(l=>l.provenance==="authored").map(l=>({feature:l.from,prerequisite:l.to,source:l.owner})),o=i.filter(l=>l.provenance==="authored").map(l=>({feature:l.to,dependent:l.from,source:l.owner})),a=this.baseNodes.filter(l=>l.nodeType==="artifact"&&l.owners.length>0).map(l=>({artifact:l.address,owners:l.owners})),c=this.baseEdges.filter(jY).map(LY);return Fn({semanticOwners:mt(wf(e)),prerequisites:mt(wf(s)),dependents:mt(wf(o)),artifactOwners:mt(wf(a)),proofs:mt(wf(c)),regressions:mt(wf(c.filter(l=>l.channel==="test")))})}unresolvedResult(e){return Fn({records:mt([]),completeness:"unresolved",reasons:mt([MY(e)]),resolutions:mt([e])})}result(e,r,n){let i=[...new Set([...n,...this.layerUnknownReasons])].sort();return Fn({records:mt($De(e)),completeness:FY(n,!1,this.layerUnknownReasons),reasons:mt(i),resolutions:mt(r)})}edgeReasons(e){return e.filter(r=>!this.nodeByAddress.has(r.from)||!this.nodeByAddress.has(r.to)).map(r=>`edge endpoint is absent: ${Xc(r)}`)}directedWalk(e,r,n){let i=[{address:e,hops:0}],s=new Set([e]),o=new Map,a=[];for(let c=0;c=n))for(let u of this.nextEdges(l.address,r)){o.set(Xc(u),u);let d=r.find(f=>f.relation===u.relation&&(f.direction==="outbound"?u.from===l.address:u.to===l.address));if(!d)continue;let p=d.direction==="outbound"?u.to:u.from;this.nodeByAddress.has(p)?s.has(p)||(s.add(p),i.push({address:p,hops:l.hops+1})):a.push(`edge endpoint is absent: ${Xc(u)}`)}}return{edges:Sf([...o.values()]),unknownReasons:mt([...new Set(a)].sort())}}nextEdges(e,r){return Sf(r.flatMap(n=>n.direction==="outbound"?this.outboundRecords(e,n.relation):this.inboundRecords(e,n.relation)))}outboundRecords(e,r){return(this.outbound.get(e)??[]).filter(n=>n.relation===r)}inboundRecords(e,r){return(this.inbound.get(e)??[]).filter(n=>n.relation===r)}}});function zu(t){return IDe[t]}function PDe(t){let e=zu(t);return`^${e.prefix}-(\\d{${e.legacySequentialMinimumDigits},}|[a-f0-9]{${e.legacyHashMinimumLength},})$`}function Ef(t){return new RegExp(PDe(t))}function GY(t){let e=zu(t);return String.raw`\b${e.prefix}-(?:\d{${e.legacySequentialMinimumDigits},}|[0-9a-f]{${e.legacyHashMinimumLength},})\b`}function zn(t,e){return Ef(t).test(e)}function Oa(t,e){let r=zu(t);return new RegExp(`^${r.prefix}-[a-f0-9]{${r.emittedHashLength}}$`).test(e)}function Qc(t,e){let r=zu(t),n=e.toLowerCase();if(!/^[a-f0-9]+$/.test(n)||n.length for new records; legacy ${e.prefix}-<${e.legacySequentialMinimumDigits}+ digits> and ${e.prefix}-<${e.legacyHashMinimumLength}+ lowercase hex> remain readable.`}var IDe,Li=S(()=>{"use strict";IDe={feature:{kind:"feature",prefix:"F",legacySequentialMinimumDigits:3,legacyHashMinimumLength:6,emittedHashLength:8,shardFilename:!0},criterion:{kind:"criterion",prefix:"AC",legacySequentialMinimumDigits:3,legacyHashMinimumLength:6,emittedHashLength:8,shardFilename:!1},scenario:{kind:"scenario",prefix:"S",legacySequentialMinimumDigits:3,legacyHashMinimumLength:6,emittedHashLength:8,shardFilename:!0},architecture_rule:{kind:"architecture_rule",prefix:"AR",legacySequentialMinimumDigits:3,legacyHashMinimumLength:6,emittedHashLength:8,shardFilename:!1}}});import{createHash as eX,randomBytes as ab}from"node:crypto";import{closeSync as S2,existsSync as wn,fsyncSync as tX,linkSync as RDe,lstatSync as Un,mkdirSync as w2,openSync as x2,readFileSync as fs,readdirSync as rX,realpathSync as WY,renameSync as hk,readlinkSync as CDe,rmdirSync as k2,unlinkSync as Mi,writeFileSync as TDe}from"node:fs";import{basename as nX,dirname as zt,isAbsolute as ODe,join as Cr,relative as ZY,resolve as Co}from"node:path";function rr(t,e){let r=Co(t),n=Cr(r,".cladding");if(wn(n)&&Un(n).isFile())return e();let i=cX(r);if(i===null)throw new q("BUSY","A specification transaction is still committing; try again shortly.");let s=!1;try{return s=I2(r),e()}finally{lX(i),s&&dX(n)}}function To(t,e){let r=Co(t),n=Date.now()+NDe;for(;Date.now()"),r.update("\0"),r.update(n.target)),r.update("\0");return r.digest("hex")}function Rf(t="."){let e=Co(t),r=cX(e);if(r===null)throw new q("BUSY","A specification transaction is still committing; try again shortly.");let n=!1;try{return n=I2(e),n}finally{lX(r),n&&dX(Cr(e,".cladding"))}}function Gr(t,e,r,n,i){let s=[...e].sort((l,u)=>l.pathu.path?1:0);for(let l of s)GDe(l);let o=ab(16).toString("hex"),a={format:1,id:o,phase:"prepared",paths:s.map(l=>l.path),preflight:{head:Bs(t),paths:s.map(l=>l.path)},files:s.map(l=>({path:l.path,before:l.before===null?null:Buffer.from(l.before).toString("base64"),after:l.after===null?null:Buffer.from(l.after).toString("base64"),...l.rootRegions===void 0?{}:{rootRegions:l.rootRegions}})),createdDirs:VDe(t,s)};UDe(t,a);let c=0;try{for(let l of s){if(i?.(l.path),sX(t,l,!1,o),c++,r!==void 0&&c>=r)throw new Error("InjectedTransactionFault");if(n!==void 0&&c>=n)throw new Error("InjectedTransactionIoError")}}catch(l){throw l.message==="InjectedTransactionFault"||I2(t),l}oX(t,a.createdDirs),Mi(Pf(t)),Vr(zt(Pf(t)))}function Tr(t,e){Fi(t,e);let r=Cr(t,e);if(!wn(r))return null;if(Un(r).isSymbolicLink())throw tl(`Managed path may not be a symbolic link: ${e}.`);return fs(r,"utf8")}function vt(t){let e=Tr(t,"spec.yaml");if(e===null)throw tl('An initialized specification needs spec.yaml with schema "0.1" or "0.2" before it can be mutated.');let r;try{r=_2(fk.default.parse(e)).schema}catch{throw tl("spec.yaml must be valid YAML with an exact supported schema.")}if(r!=="0.1"&&r!=="0.2")throw tl('spec.yaml must declare an exact supported schema ("0.1" or "0.2").');return r}function jDe(t){let e=Co(t);return Fi(e,`.cladding/${Uu}`),wn(Pf(e))}function LDe(t){let e=Co(t);return Fi(e,`.cladding/${If}`),wn(Cr(e,".cladding",If))}function MDe(t){return iX(`${E2(t)}\0${XY(t,Uu)}\0${XY(t,If)}`)}function KY(t){try{return MDe(t)}catch(e){if(A2(e))return;throw e}}function YY(t){try{return{pending:jDe(t),locked:LDe(t)}}catch(e){if(A2(e))return;throw e}}function A2(t){if(!t||typeof t!="object")return!1;let e=t.code;return e==="ENOENT"||e==="ENOTDIR"}function XY(t,e){let r=Cr(t,".cladding",e);try{return wn(r)?Un(r).isSymbolicLink()?"":iX(fs(r,"utf8")):JY}catch(n){return n.code==="ENOENT"?JY:``}}function FDe(t){let e=[],r=n=>{let i=Cr(t,n),s;try{s=Un(i)}catch(o){if(o.code==="ENOENT")return;throw o}if(s.isSymbolicLink()){if(zDe(n)){e.push({path:n,kind:"evidence-symlink",target:CDe(i,"utf8")});return}throw new q("INVALID_OPERATION",`Managed workspace path may not be a symbolic link: ${n}`)}if(s.isDirectory()){for(let o of rX(i).sort())r(`${n}/${o}`);return}s.isFile()&&(n==="spec.yaml"||n.startsWith("spec/"))&&e.push({path:n,kind:"file"})};return r("spec.yaml"),r("spec"),e.sort((n,i)=>n.path.localeCompare(i.path))}function zDe(t){return t==="spec/evidence"||t.startsWith("spec/evidence/")}function ob(){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,DDe)}function iX(t){return eX("sha256").update(t).digest("hex")}function $2(t="."){let e=Co(t);Fi(e,`.cladding/${Uu}`);let r=Pf(e);if(!wn(r))return null;let n;try{n=JSON.parse(fs(r,"utf8"))}catch{throw new q("RECOVERY_FAILED","The pending specification transaction journal is unreadable.")}if(n.format!==1||n.phase!=="prepared"||!Array.isArray(n.files))throw new q("RECOVERY_FAILED","The pending specification transaction journal has an unsupported format.");return aX(e,n),{head:n.preflight.head,paths:[...n.preflight.paths]}}function I2(t){let e=Co(t);Fi(e,`.cladding/${Uu}`);let r=Pf(e);if(!wn(r))return BDe(e),!1;let n;try{n=JSON.parse(fs(r,"utf8"))}catch{throw new q("RECOVERY_FAILED","The pending specification transaction journal is unreadable.")}if(n.format!==1||n.phase!=="prepared"||!Array.isArray(n.files))throw new q("RECOVERY_FAILED","The pending specification transaction journal has an unsupported format.");try{aX(e,n);for(let i of n.files){let s=Tr(e,i.path),o=i.before===null?null:Buffer.from(i.before,"base64").toString("utf8"),a=i.after===null?null:Buffer.from(i.after,"base64").toString("utf8");if(s!==o&&s!==a)throw new q("RECOVERY_FAILED",`The pending transaction target ${i.path} changed outside the transaction.`)}for(let i of n.files){qDe(e,i.path,n.id);let s=Tr(e,i.path);sX(e,{path:i.path,before:s===null?null:Buffer.from(s).toString("base64"),after:i.before},!0,n.id)}return oX(e,n.createdDirs),Mi(r),Vr(zt(r)),!0}catch(i){throw new q("RECOVERY_FAILED",`Unable to restore the pending specification transaction: ${i.message}`)}}function sX(t,e,r,n){Fi(t,e.path);let i=Cr(t,e.path),s=r&&e.before!==null?Buffer.from(e.before,"base64").toString("utf8"):e.before;if(Tr(t,e.path)!==s)throw new q("RECOVERY_FAILED",`Transaction preimage changed before replacement: ${e.path}.`);if(e.after===null){wn(i)&&(Mi(i),Vr(zt(i)));return}let o=r?Buffer.from(e.after,"base64").toString("utf8"):e.after;w2(zt(i),{recursive:!0});let a=Cr(zt(i),`.${nX(i)}.cladding-txn-${n??ab(16).toString("hex")}.tmp`);if(mk(a,o),Fi(t,e.path),Tr(t,e.path)!==s){try{Mi(a),Vr(zt(a))}catch{}throw new q("RECOVERY_FAILED",`Transaction preimage changed before replacement: ${e.path}.`)}hk(a,i),Vr(zt(i))}function UDe(t,e){let r=Pf(t);Fi(t,`.cladding/${Uu}`);let n=Cr(zt(r),`.${Uu}.cladding-txn-${e.id}.tmp`);mk(n,`${JSON.stringify(e)} +`),hk(n,r),Vr(zt(r))}function BDe(t){let e=Cr(t,".cladding");if(wn(e)){for(let r of rX(e)){if(!/^\.spec-transaction\.json\.cladding-txn-[a-f0-9]{32}\.tmp$/.test(r))continue;let n=`.cladding/${r}`;Fi(t,n),Mi(Cr(t,n))}Vr(e)}}function qDe(t,e,r){let n=Cr(t,e),i=Cr(zt(n),`.${nX(n)}.cladding-txn-${r}.tmp`);wn(i)&&(Mi(i),Vr(zt(i)))}function VDe(t,e){let r=new Set;for(let n of e){if(n.after===null)continue;let i=zt(n.path);for(;i!=="."&&i!==""&&(Fi(t,`${i}/.cladding-directory-probe`),!wn(Cr(t,i)));){if(!pX(i))throw tl(`Transaction would create an unmanaged directory ${i}.`);r.add(i),i=zt(i)}}return[...r].sort()}function oX(t,e){for(let r of[...e].sort((n,i)=>i.length-n.length||i.localeCompare(n))){let n=Cr(t,r);try{Fi(t,`${r}/.cladding-directory-probe`),wn(n)&&Un(n).isDirectory()&&(k2(n),Vr(zt(n)))}catch{}}}function aX(t,e){if(!/^[a-f0-9]{32}$/.test(e.id))throw new q("RECOVERY_FAILED","The pending specification transaction journal has an invalid identity.");if(!Array.isArray(e.paths)||!e.preflight||!Array.isArray(e.preflight.paths)||!Array.isArray(e.files)||!Array.isArray(e.createdDirs)||e.paths.length===0||e.preflight.paths.length===0||e.files.length===0||!pk(e.paths)||!pk(e.preflight.paths))throw new q("RECOVERY_FAILED","The pending specification transaction journal has an invalid path manifest.");let r=e.files.map(n=>n?.path);if(!pk(r)||$f(r)!==$f(e.paths)||$f(r)!==$f(e.preflight.paths))throw new q("RECOVERY_FAILED","The pending specification transaction journal path sets disagree.");if(e.preflight.head!==null&&(typeof e.preflight.head!="string"||!/^[a-f0-9]{40}(?:[a-f0-9]{24})?$/.test(e.preflight.head)))throw new q("RECOVERY_FAILED","The pending specification transaction journal has an invalid preflight.");if(!pk(e.createdDirs)||e.createdDirs.some(n=>!pX(n)))throw new q("RECOVERY_FAILED","The pending specification transaction journal has an invalid created-directory manifest.");for(let n of e.files){if(!n||typeof n.path!="string"||!JDe(n.path))throw new q("RECOVERY_FAILED","The pending specification transaction journal names an unmanaged path.");if(Fi(t,n.path),!QY(n.before)||!QY(n.after))throw new q("RECOVERY_FAILED","The pending specification transaction journal has invalid before-images.");if(n.path==="spec.yaml"){if(!Array.isArray(n.rootRegions)||n.rootRegions.length===0||new Set(n.rootRegions).size!==n.rootRegions.length||n.rootRegions.some(i=>i!=="schema"&&i!=="project"&&i!=="inventory"))throw new q("RECOVERY_FAILED","The pending specification transaction journal has invalid root ownership metadata.");for(let i of n.rootRegions)rb({path:n.path,region:i,operation:n.after===null?"delete":n.before===null?"create":"update"})}else if(n.rootRegions!==void 0)throw new q("RECOVERY_FAILED","The pending specification transaction journal assigns root ownership to a non-root artifact.")}}function GDe(t){let e=t.after===null?"delete":t.before===null?"create":"update";if(t.path===".cladding/events.log.jsonl"||t.path===".cladding/audit.log.jsonl"){rb({path:t.path,operation:e});return}if(t.path.startsWith(".cladding/"))throw tl(`Transaction may not write unmanaged workspace state ${t.path}.`);if(t.path==="spec.yaml"){if(!t.rootRegions||t.rootRegions.length===0||new Set(t.rootRegions).size!==t.rootRegions.length)throw tl("A spec.yaml transaction write must declare one or more exact owned regions.");for(let r of t.rootRegions)rb({path:t.path,region:r,operation:e});HDe(t.before,t.after,t.rootRegions);return}rb({path:t.path,operation:e})}function HDe(t,e,r){let n=t===null?{}:_2(fk.default.parse(t)),i=e===null?{}:_2(fk.default.parse(e)),s=new Set([...Object.keys(n),...Object.keys(i)]),o={schema:"schema",project:"project",inventory:"inventory",features:"schema",scenarios:"schema",capabilities:"schema",architecture:"schema"};for(let a of s){if($f(n[a])===$f(i[a]))continue;let c=o[a];if(!c||!r.includes(c))throw tl(`spec.yaml semantic change to ${a} is outside its declared transaction ownership.`)}}function cX(t){Fi(t,`.cladding/${If}`);let e=Cr(t,".cladding",If),r=zt(e),n=!wn(r);w2(r,{recursive:!0});let i=Un(r).ino,s=Date.now()+5e3;for(;Date.now(){try{JSON.parse(fs(s,"utf8")).nonce===i&&(Mi(s),Vr(zt(s)))}catch{}},a=()=>{try{if(e?.(),Un(t).ino!==n||fs(t,"utf8")!==r)return;let c=`${t}.retired-${i}`;hk(t,c),Vr(zt(t)),Mi(c),Vr(zt(t))}catch{}};try{let c;try{c=JSON.parse(r).pid}catch{try{Date.now()-Un(t).mtimeMs>3e4&&a()}catch{}return}if(!Number.isInteger(c)||c<=0){try{Date.now()-Un(t).mtimeMs>3e4&&a()}catch{}return}try{process.kill(c,0)}catch(l){l.code==="ESRCH"&&a()}}finally{o()}}function ZDe(t){let e,r,n;try{e=fs(t,"utf8");let s=Un(t);r=s.ino,n=Date.now()-s.mtimeMs}catch{return}if(n<=3e4)return;let i=`${t}.retired-${ab(12).toString("hex")}`;try{if(Un(t).ino!==r||fs(t,"utf8")!==e)return;hk(t,i),Vr(zt(t)),Mi(i),Vr(zt(t))}catch{}}function dX(t){try{Un(t).isDirectory()&&(k2(t),Vr(zt(t)))}catch{}}function Pf(t){return Cr(t,".cladding",Uu)}function Fi(t,e){if(!e||ODe(e)||e.split("/").some(c=>!c||c==="."||c===".."))throw new Error(`Unsafe transaction path ${e}.`);let r=Co(t),n=Co(r,e);if(ZY(r,n).startsWith(".."))throw new Error(`Transaction path escapes workspace: ${e}.`);let i=r;for(let c of e.split("/"))if(i=Cr(i,c),wn(i)&&Un(i).isSymbolicLink())throw new Error(`Transaction path has a symbolic-link ancestor: ${e}.`);let s=zt(n);for(;!wn(s)&&s!==zt(s);)s=zt(s);let o=WY(r),a=WY(s);if(a!==o&&ZY(o,a).startsWith(".."))throw new Error(`Transaction path escapes workspace through its parent: ${e}.`)}function mk(t,e){w2(zt(t),{recursive:!0});let r=x2(t,"wx");try{TDe(r,e,"utf8"),tX(r)}finally{S2(r)}}function Vr(t){try{let e=x2(t,"r");try{tX(e)}finally{S2(e)}}catch{}}function JDe(t){return t==="spec.yaml"||t==="spec/capabilities.yaml"||t==="spec/architecture.yaml"||t==="spec/index.yaml"||t==="spec/_doc-links.yaml"||t==="spec/attestation.yaml"||t==="spec/generated/index.yaml"||t==="spec/generated/_doc-links.yaml"||t==="spec/generated/attestation.yaml"||t==="spec/generated/README.md"||t==="spec/trust/issuers.yaml"||t==="docs/project-context.md"||t==="spec/generated/migration-baseline-0.1-to-0.2.yaml"||t===".cladding/events.log.jsonl"||t===".cladding/audit.log.jsonl"||/^spec\/(?:features|scenarios)\/[^/]+\.ya?ml$/.test(t)||KDe(t)}function pX(t){return t===".cladding"||t==="docs"||t==="spec"||t==="spec/features"||t==="spec/scenarios"||t==="spec/evidence"||t==="spec/generated"||t==="spec/trust"||/^spec\/evidence\/F-[^/]+$/.test(t)}function KDe(t){let e=/^spec\/evidence\/(F-[^/]+)\/([a-f0-9]{64})\.yaml$/.exec(t);return e!==null&&zn("feature",e[1])}function pk(t){return t.every(e=>typeof e=="string")&&t.every((e,r)=>r===0||t[r-1]e.localeCompare(r)).map(([e,r])=>[e,v2(r)])):t}function _2(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function tl(t){return new q("INVALID_OPERATION",t)}var fk,If,Uu,JY,NDe,DDe,q,kr=S(()=>{"use strict";fk=Et(cr(),1);ff();Li();_f();If="spec-transaction.lock",Uu="spec-transaction.json",JY="",NDe=5e3,DDe=25,q=class extends Error{constructor(r,n){super(n);this.code=r;this.name="SpecEditError"}code}});import{resolve as fX}from"node:path";function cb(t){return gX(hX,t)}function lb(t){return gX(mX,t)}function P2(t,e,r){return yX(hX,t,e,r)}function R2(t,e,r){return yX(mX,t,e,r)}function Bu(t,e){return Object.freeze({...t,features:Object.freeze((t.features??[]).map(r=>r.id===e?Object.freeze({...r,status:"done"}):r))})}function rl(t,e){return t.schemaVersion!=="0.2"||!t.contract?t:Object.freeze({...t,presentations:Object.freeze(t.presentations.map(r=>r.kind==="feature"&&r.address===`feature:${e}`?Object.freeze({...r,status:"done"}):r)),contract:Object.freeze({...t.contract,features:Object.freeze(t.contract.features.map(r=>r.id===e?Object.freeze({...r,status:"done"}):r))})})}function gX(t,e){let r=fX(e);for(let n=t.length-1;n>=0;n--){let i=t[n];if(i.cwd===r)return i.value}}function yX(t,e,r,n){let i=Object.freeze({cwd:fX(e),value:r});t.push(i);try{return n()}finally{let s=t.lastIndexOf(i);s!==-1&&t.splice(s,1)}}var hX,mX,Cf=S(()=>{"use strict";hX=[],mX=[]});import{createHash as YDe}from"node:crypto";function Na(t,e){return te?1:0}function XDe(t){let e=vk(t);if(e!==void 0)throw new TypeError(`Canonical JSON requires JSON-safe values: ${e}`);return JSON.stringify(C2(t))}function Tf(t){return YDe("sha256").update(XDe(t)).digest("hex")}function gk(t){return Tf({domain:"cladding.criterion-final-intent/1",statement:t.statement,kind:t.kind,rationale:t.rationale,constraint_refs:t.constraintRefs===null?null:[...t.constraintRefs].sort(Na)})}function yk(t){if(!t||Array.isArray(t))return;let e=t;if(typeof e.statement!="string")return;let r=e.kind,n=r===void 0||r===Oo?Oo:r;if(!["behavior","quality","constraint",Oo].includes(n))return;let i=e.rationale===void 0?null:typeof e.rationale=="string"?e.rationale:void 0;if(i===void 0)return;let s=e.constraint_refs,o=s===void 0?null:Array.isArray(s)&&s.every(a=>typeof a=="string")?[...s]:void 0;if(o!==void 0)return{statement:e.statement,kind:n,rationale:i,constraintRefs:o}}function N2(t){return Tf({domain:"cladding.migration-l2-candidate/1",criterion:t.criterion,source_status:t.sourceStatus,final_intent_sha256:t.finalIntentSha256,obligations:[...t.obligations]})}function db(t){return Tf({domain:"cladding.migration-l2-candidate-census/1",criteria:[...t].sort(Na)})}function D2(t){return Tf({domain:"cladding.migration-l2-resolution/1",preview_sha256:t.previewSha256,decision:t.decision,candidate_count:t.candidateCount,candidate_census_sha256:t.candidateCensusSha256})}function _X(t){return Tf(t)}function j2(t){return Tf(t)}function Bn(t,e,r){if(!t||!r)return!1;let n=r;if(e==="project")return t.project.exemption!==void 0&&(typeof n.purpose!="string"||n.purpose.trim().length===0);if(e.startsWith("feature:")){let i=t.features.find(s=>s.address===e);return i?.exemption!==void 0&&n.title===i.title&&(typeof n.purpose!="string"||n.purpose.trim().length===0)}if(e.startsWith("criterion:")){let i=t.criteria.find(s=>s.address===e);return!i?.exemption||n.statement!==i.legacyIntent.text||n.kind!==void 0&&n.kind!==Oo?!1:bX(n,"rationale",i.legacyIntent.rationale)&&bX(n,"constraint_refs",i.legacyIntent.constraint_refs)}return!1}function bk(t,e,r){let n=t?.features.find(o=>o.address===`feature:${e}`)?.legacyStructuralReview;if(!n||!r)return!1;let i=r,s=["artifacts","classification","rationale","status"];return Object.keys(i).sort().join(",")!==s.join(",")?!1:i.classification===n.classification&&i.rationale===n.rationale&&i.status===n.status&&Array.isArray(i.artifacts)&&i.artifacts.length===n.artifacts.length&&i.artifacts.every((o,a)=>o===n.artifacts[a])}function SX(t,e,r){if(!t||!r)return!1;let n=t.reviewedCarryForwards?.find(a=>a.criterion===`criterion:${e}`);if(!n)return!1;let i=r;if(i.statement!==n.intent.statement||i.kind!==n.intent.kind||i.rationale!==n.intent.rationale)return!1;let s=i.constraint_refs,o=n.intent.constraintRefs;return o===void 0?s===void 0:Array.isArray(s)&&s.every(a=>typeof a=="string")&&s.length===o.length&&s.every((a,c)=>a===o[c])}function bX(t,e,r){let n=t[e];return r===void 0?n===void 0||Array.isArray(n)&&n.length===0:Array.isArray(n)?n.join(",")===r:n===r}function qu(t){let e=[],r=vk(t);r!==void 0&&e.push(`baseline must contain only JSON-safe values: ${r}`);let n=eje(t);(t.schema!==O2||t.sourceSchema!=="0.1")&&e.push("baseline must identify schema 1 sourced from schema 0.1");let i=new Set,s=new Set;for(let l of n)(!l.id||i.has(l.id))&&e.push(`duplicate exemption identity: ${l.id}`),(!l.subject||s.has(l.subject))&&e.push(`duplicate exemption subject: ${l.subject}`),i.add(l.id),s.add(l.subject);for(let l of t.criteria)l.classification!==Oo&&e.push(`${l.address} must remain legacy_unclassified`),l.exemption.subject!==l.address&&e.push(`${l.address} exemption must be node-local`),l.adrReview&&(!l.adrReview.rationale||!["retain_external","superseded","not_applicable"].includes(l.adrReview.disposition))&&e.push(`${l.address} has an invalid ADR review disposition`);for(let l of t.features){let u=l.legacyStructuralReview;if(u===void 0)continue;if(u===null||typeof u!="object"||Array.isArray(u)){e.push(`${l.address} has an invalid legacy structural review`);continue}(Object.keys(u).sort().join(",")!=="artifacts,classification,rationale,status"||u.classification!=="structural"||u.status!=="review_required"||typeof u.rationale!="string"||u.rationale.length===0||!Array.isArray(u.artifacts)||u.artifacts.some(p=>typeof p!="string"||p.length===0)||new Set(u.artifacts).size!==u.artifacts.length)&&e.push(`${l.address} has an invalid legacy structural review`)}let o=new Set;for(let l of t.reviewedCarryForwards??[]){let u=t.criteria.find(p=>p.address===l?.criterion);if(!l||!/^criterion:[^/]+\/[^/]+$/.test(l.criterion)||o.has(l.criterion)||!u||!l.intent||!l.intent.statement||!["behavior","quality","constraint"].includes(l.intent.kind)||l.intent.rationale!==void 0&&(typeof l.intent.rationale!="string"||!l.intent.rationale.trim())||l.intent.constraintRefs!==void 0&&(!Array.isArray(l.intent.constraintRefs)||l.intent.constraintRefs.some(p=>typeof p!="string"||!p))||!Array.isArray(l.bindings)||l.bindings.length===0){e.push("reviewed carry-forwards must bind one known criterion to a non-empty strict selection");break}o.add(l.criterion);let d=new Set;for(let p of l.bindings){if(!p||typeof p.raw!="string"||!p.raw||typeof p.file!="string"||!p.file||p.selector!==void 0&&typeof p.selector!="string"||typeof p.sha256!="string"||!/^[a-f0-9]{64}$/.test(p.sha256)||d.has(p.raw)||!u.bindings.some(f=>f.channel==="test"&&f.raw===p.raw&&f.selector===p.selector)){e.push(`${l.criterion} has an invalid reviewed test binding`);break}d.add(p.raw)}}let a=t.capabilitySurfaceDispositions??[],c=new Set;for(let l of a){if(!l||typeof l.id!="string"||!["feature","platform","tool","infrastructure"].includes(l.legacySurface)||l.disposition!=="removed_by_schema_0.2"||c.has(l.id)){e.push("baseline capability surface dispositions must be unique valid D08 removals");break}c.add(l.id)}return QDe(t,e),e}function QDe(t,e){let r=t.legacyL2Baseline;if(r===void 0)return;if(!T2(r)||!vX(r,["authorizations","candidateCount","candidateCensusSha256","decision","previewSha256","resolutionSha256"])||r.decision!=="accept"&&r.decision!=="reject"||typeof r.candidateCount!="number"||!Number.isSafeInteger(r.candidateCount)||r.candidateCount<0||!ub(r.previewSha256)||!ub(r.candidateCensusSha256)||!ub(r.resolutionSha256)||!Array.isArray(r.authorizations)){e.push("legacy L2 baseline decision has an invalid shape");return}let n=r,i=D2({previewSha256:n.previewSha256,decision:n.decision,candidateCount:n.candidateCount,candidateCensusSha256:n.candidateCensusSha256});n.resolutionSha256!==i&&e.push("legacy L2 baseline resolution digest does not match its decision");let s=new Set(t.criteria.map(a=>a.address)),o=new Set;for(let a of n.authorizations){if(!T2(a)||!vX(a,["candidateSha256","criterion","finalIntentSha256","obligations","resolutionSha256","sourceStatus"])||typeof a.criterion!="string"||!s.has(a.criterion)||o.has(a.criterion)||a.sourceStatus!=="done"||!ub(a.finalIntentSha256)||!ub(a.candidateSha256)||a.resolutionSha256!==n.resolutionSha256||!Array.isArray(a.obligations)||a.obligations.length!==nl.length||a.obligations.some((l,u)=>l!==nl[u])){e.push("legacy L2 authorization has an invalid or duplicate criterion-local shape");continue}let c=a;c.candidateSha256!==N2(c)&&e.push(`legacy L2 authorization candidate digest does not match ${c.criterion}`),o.add(c.criterion)}if(n.decision==="reject"&&n.authorizations.length!==0&&e.push("rejected legacy L2 baseline must persist zero authorizations"),n.decision==="accept"){let a=db([...o]);(n.authorizations.length!==n.candidateCount||o.size!==n.candidateCount||a!==n.candidateCensusSha256)&&e.push("accepted legacy L2 baseline must authorize its complete candidate census")}}function eje(t){return[...t.project.exemption?[t.project.exemption]:[],...t.features.flatMap(e=>e.exemption?[e.exemption]:[]),...t.criteria.map(e=>e.exemption),...t.scenarios.map(e=>e.exemption),...t.architecture?[t.architecture.exemption]:[]]}function C2(t){return Array.isArray(t)?t.map(C2):T2(t)?Object.fromEntries(Object.entries(t).sort(([e],[r])=>Na(e,r)).map(([e,r])=>[e,C2(r)])):t}function vk(t,e="$",r=new Set){if(!(t===null||typeof t=="string"||typeof t=="boolean")){if(typeof t=="number")return Number.isFinite(t)?void 0:`${e} must be a finite number`;if(typeof t>"u"||typeof t=="bigint"||typeof t=="function"||typeof t=="symbol")return`${e} has unsupported ${typeof t} content`;if(typeof t!="object")return`${e} has unsupported content`;if(r.has(t))return`${e} contains a cycle`;r.add(t);try{if(Array.isArray(t))return tje(t,e,r);if(!nje(t))return`${e} must be a plain record`;for(let n of Object.keys(t)){let i=Object.getOwnPropertyDescriptor(t,n);if(!i||!Object.hasOwn(i,"value"))return`${e}.${n} must be a data property`;let s=vk(t[n],`${e}.${n}`,r);if(s!==void 0)return s}return}finally{r.delete(t)}}}function tje(t,e,r){if(Object.getPrototypeOf(t)!==Array.prototype||Object.getOwnPropertySymbols(t).length>0)return`${e} must be a plain array`;if(Object.getOwnPropertyNames(t).some(i=>i!=="length"&&!rje(i)))return`${e} has non-element array content`;for(let i=0;i=0&&e<2**32-1&&String(e)===t}function nje(t){let e=Object.getPrototypeOf(t);return(e===Object.prototype||e===null)&&Object.getOwnPropertySymbols(t).length===0&&Object.getOwnPropertyNames(t).length===Object.keys(t).length}function T2(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function vX(t,e){let r=Object.keys(t).sort(Na),n=[...e].sort(Na);return r.length===n.length&&r.every((i,s)=>i===n[s])}function ub(t){return typeof t=="string"&&/^[a-f0-9]{64}$/.test(t)}var O2,Oo,nl,Vu=S(()=>{"use strict";O2=1,Oo="legacy_unclassified",nl=["stage_2.1","stage_2.2"]});import{createHash as ije}from"node:crypto";function kX(t){let e=AX(t),r=e.value;return r&&!("baselineIdentity"in r)?{value:r,issues:e.issues}:{issues:e.issues}}function EX(t,e){return AX(t,e)}function AX(t,e){let r=Da(t);if(!r)return{issues:[Re("INVALID_ROOT",[],"spec.yaml project must be an object")]};let n=[];il(r,new Set(["name","language","description","version","repository","onboarding_seeded","purpose","assurance_level","scenario_policy","require_oracles","oracle_policy","independence_policy","deliverable","smoke","ai_hints"]),n,"project");let i=Or(r.name),s=Or(r.language),o=Or(r.purpose),a=r.purpose===void 0||typeof r.purpose=="string";i||n.push(Re("INVALID_SCHEMA_02",["name"],"project.name must remain a non-empty string")),s||n.push(Re("INVALID_SCHEMA_02",["language"],"project.language must remain a non-empty string")),!o&&(!e||!a)&&n.push(Re("INVALID_SCHEMA_02",["purpose"],"project.purpose must be a non-empty string in schema 0.2")),Sk(r,"description","string",n),Sk(r,"version","string",n),Sk(r,"repository","string",n),Sk(r,"onboarding_seeded","boolean",n);let c=r.assurance_level;c!=="L1"&&c!=="L2"&&c!=="L3"&&c!=="L4"&&n.push(Re("INVALID_SCHEMA_02",["assurance_level"],"project.assurance_level must explicitly be L1, L2, L3, or L4"));let l=r.scenario_policy;if(l!=="off"&&l!=="advisory"&&l!=="required"&&n.push(Re("INVALID_SCHEMA_02",["scenario_policy"],"project.scenario_policy must explicitly be off, advisory, or required")),n.length>0||!i||!s||!o&&(!e||!a)||!lje(c)||!uje(l))return{issues:n};let u={name:i,language:s,...typeof r.description=="string"?{description:r.description}:{},...typeof r.version=="string"?{version:r.version}:{},...typeof r.repository=="string"?{repository:r.repository}:{},...typeof r.onboarding_seeded=="boolean"?{onboardingSeeded:r.onboarding_seeded}:{},assuranceLevel:c,scenarioPolicy:l,retainedPolicies:cje(r)};return o?{value:{...u,purpose:o},issues:n}:e?{value:{...u,baselineIdentity:e},issues:n}:{issues:n}}function wk(t){let e=Da(t);if(!e)return{issues:[Re("INVALID_SCHEMA_02",[],"spec/capabilities.yaml must contain an object")]};let r=[];if(il(e,new Set(["capabilities","schema","source"]),r,"capability catalog"),!Array.isArray(e.capabilities))return r.push(Re("INVALID_SCHEMA_02",["capabilities"],"spec/capabilities.yaml requires a capabilities array")),{issues:r};let n=[],i=new Set;return e.capabilities.forEach((s,o)=>{let a=Da(s),c=["capabilities",o];if(!a){r.push(Re("INVALID_SCHEMA_02",c,"each schema 0.2 capability must be an object"));return}il(a,new Set(["id","title","outcome"]),r,`capability at index ${o}`,c);let l=Or(a.id),u=Or(a.title),d=Or(a.outcome);l||r.push(Re("INVALID_SCHEMA_02",[...c,"id"],"capability.id must be a non-empty string")),u||r.push(Re("INVALID_SCHEMA_02",[...c,"title"],"capability.title must be a non-empty string")),d||r.push(Re("INVALID_SCHEMA_02",[...c,"outcome"],"capability.outcome must be a non-empty string")),l&&i.has(l)&&r.push(Re("DUPLICATE_IDENTIFIER",[...c,"id"],`duplicate capability id ${l}`)),l&&i.add(l),l&&u&&d&&n.push({id:l,title:u,outcome:d})}),r.length>0?{issues:r}:{value:n.sort((s,o)=>s.id.localeCompare(o.id)),issues:r}}function $X(t){let e=IX(t),r=e.value;return r&&!("baselineIdentity"in r)?{value:r,issues:e.issues}:{issues:e.issues}}function z2(t,e={}){return IX(t,e)}function IX(t,e={}){let r=Da(t);if(!r)return{issues:[Re("INVALID_FEATURE",[],"feature shard must contain an object")]};let n=[];il(r,new Set(["id","title","status","purpose","modules","depends_on","capability_refs","acceptance_criteria","design_impact","archived_at","archive_reason","superseded_by","blocked_reason","notes","schema","source","slug"]),n,"feature");let i=Or(r.id),s=Or(r.title),o=r.status,a=dje(o)?o:void 0,c=Or(r.purpose),l=e.featureBaselineIdentity,u=r.purpose===void 0||typeof r.purpose=="string";!c&&(!l||!u)&&n.push(Re("INVALID_SCHEMA_02",["purpose"],"feature.purpose must be a non-empty string in schema 0.2"));let d=_k(r,"modules",[],n,"feature.modules"),p=_k(r,"depends_on",[],n,"feature.depends_on"),f=aje(r,"design_impact",n,"feature.design_impact"),h=pb(r,"archived_at",[],n,"feature.archived_at"),m=pb(r,"archive_reason",[],n,"feature.archive_reason"),y=pb(r,"superseded_by",[],n,"feature.superseded_by"),v=pb(r,"blocked_reason",[],n,"feature.blocked_reason",!0);a||n.push(Re("INVALID_SCHEMA_02",["status"],"feature.status must be planned, in_progress, done, blocked, or archived")),a==="blocked"&&!v&&n.push(Re("INVALID_SCHEMA_02",["blocked_reason"],"feature.blocked_reason must be a non-empty string when status is blocked")),a!==void 0&&a!=="blocked"&&Object.hasOwn(r,"blocked_reason")&&n.push(Re("INVALID_SCHEMA_02",["blocked_reason"],"feature.blocked_reason is allowed only when status is blocked"));let g=F2(r,"capability_refs",[],n,"feature.capability_refs"),b=[];if(!Array.isArray(r.acceptance_criteria))n.push(Re("INVALID_SCHEMA_02",["acceptance_criteria"],"feature.acceptance_criteria must be an array in schema 0.2"));else{let x=new Set;r.acceptance_criteria.forEach(($,I)=>{let E=Da($),R=["acceptance_criteria",I];if(!E){n.push(Re("INVALID_SCHEMA_02",R,"each acceptance criterion must be an object"));return}il(E,new Set(["id","kind","statement","rationale","constraint_refs","oracle_refs","evidence_refs","notes","ears","condition","action","response","text","test_refs","adr_refs"]),n,`criterion at index ${I}`,R);let A=Or(E.id),B=E.kind,Z=Or(E.statement),ee=A===void 0?void 0:e.criterionBaselineIdentities?.get(A),T=E.rationale===void 0?void 0:Or(E.rationale);E.rationale!==void 0&&!T&&n.push(Re("INVALID_SCHEMA_02",[...R,"rationale"],"criterion.rationale must be a non-empty string when supplied"));let j=F2(E,"constraint_refs",R,n,"criterion.constraint_refs",!1)??[],Ne=_k(E,"oracle_refs",R,n,"criterion.oracle_refs"),U=_k(E,"evidence_refs",R,n,"criterion.evidence_refs"),H=pb(E,"notes",R,n,"criterion.notes");if(A||n.push(Re("INVALID_SCHEMA_02",[...R,"id"],"criterion.id must be a non-empty string")),A&&x.has(A)&&n.push(Re("DUPLICATE_IDENTIFIER",[...R,"id"],`duplicate criterion id ${A}`)),A&&x.add(A),!M2(B)&&!ee&&n.push(Re("INVALID_SCHEMA_02",[...R,"kind"],"criterion.kind must be behavior, quality, or constraint")),ee&&B!==void 0&&B!=="legacy_unclassified"&&n.push(Re("INVALID_SCHEMA_02",[...R,"kind"],"a receipt-backed criterion may retain only an omitted or legacy_unclassified kind")),Z||n.push(Re("INVALID_SCHEMA_02",[...R,"statement"],"criterion.statement must be a non-empty string")),B==="constraint"&&!T&&j.length===0&&n.push(Re("INVALID_SCHEMA_02",R,"a constraint criterion requires a non-empty local rationale or resolving constraint_refs")),!A||!M2(B)&&!ee||!Z)return;let Oe={id:A,statement:Z,...T?{rationale:T}:{},constraintRefs:[...j].sort(),...Ne===void 0?{}:{oracleRefs:Ne},...U===void 0?{}:{evidenceRefs:U},...H===void 0?{}:{notes:H}};ee?b.push({...Oe,kind:"legacy_unclassified",baselineIdentity:ee}):M2(B)&&b.push({...Oe,kind:B})})}if(!i||!s||!a||!c&&(!l||!u)||!g||n.length>0||b.length!==r.acceptance_criteria?.length)return{issues:n};let w={id:i,title:s,status:a,...d===void 0?{}:{modules:d},...p===void 0?{}:{dependsOn:p},...f===void 0?{}:{designImpact:f},...h===void 0?{}:{archivedAt:h},...m===void 0?{}:{archiveReason:m},...y===void 0?{}:{supersededBy:y},...v===void 0?{}:{blockedReason:v},capabilityRefs:[...g].sort(),acceptanceCriteria:b.sort((x,$)=>x.id.localeCompare($.id))};return c?{value:{...w,purpose:c},issues:n}:l?{value:{...w,baselineIdentity:l},issues:n}:{issues:n}}function PX(t){let e=Da(t);if(!e)return{completeness:"malformed",issues:[Re("INVALID_SCHEMA_02",[],"schema 0.2 scenario must contain an object")]};let r=[];il(e,new Set(["id","title","actor","goal","success","steps","feature_refs"]),r,"scenario");let n=Or(e.id),i=Or(e.title),s=L2(e,"actor",r,"scenario.actor"),o=L2(e,"goal",r,"scenario.goal"),a=L2(e,"success",r,"scenario.success"),c=wX(e,"steps",r,"scenario.steps"),l=wX(e,"feature_refs",r,"scenario.feature_refs");return n||r.push(Re("INVALID_SCHEMA_02",["id"],"scenario.id must be a non-empty string")),i||r.push(Re("INVALID_SCHEMA_02",["title"],"scenario.title must be a non-empty string")),r.length>0||!n||!i?{completeness:"malformed",issues:r}:!s||!s.trim()||!o||!o.trim()||!a||!a.trim()||!c||c.length===0||c.some(u=>!u.trim())||!l||l.length===0||l.some(u=>!u.trim())?{completeness:"hollow",issues:r}:{completeness:"complete",value:{id:n,title:i,actor:s,goal:o,success:a,steps:c,featureRefs:l},issues:r}}function xk(t){let e=Da(t);if(!e)return{issues:[Re("INVALID_SCHEMA_02",[],"spec/architecture.yaml must contain an object")]};let r=[];il(e,new Set(["layers","rules","schema","source","forbidden_imports"]),r,"architecture");let n=sje(e.layers,r),i=oje(e.rules,r);return!n||!i||r.length>0?{issues:r}:{value:{layers:n,rules:i},issues:r}}function RX(t,e,r=0){let n=`forbidden_import\0${t}\0${e}\0${r}`;return Qc("architecture_rule",ije("sha256").update(n).digest("hex"))}function sje(t,e){if(!Array.isArray(t)){e.push(Re("INVALID_SCHEMA_02",["layers"],"architecture.layers must be an ordered string[][] value"));return}let r=[];return t.forEach((n,i)=>{if(!Array.isArray(n)||n.length===0){e.push(Re("INVALID_SCHEMA_02",["layers",i],"each architecture layer must be a non-empty string[]"));return}let s=[];n.forEach((o,a)=>{let c=Or(o);if(!c){e.push(Re("INVALID_SCHEMA_02",["layers",i,a],"architecture layer names must be non-empty strings"));return}s.push(c)}),r.push(s)}),r}function oje(t,e){if(!Array.isArray(t)){e.push(Re("INVALID_SCHEMA_02",["rules"],"architecture.rules must be an array"));return}let r=new Set,n=new Set,i=[];return t.forEach((s,o)=>{let a=Da(s),c=["rules",o];if(!a){e.push(Re("INVALID_SCHEMA_02",c,"each architecture rule must be an object"));return}il(a,new Set(["id","kind","from","to","rationale"]),e,`architecture rule at index ${o}`,c);let l=Or(a.id),u=Or(a.from),d=Or(a.to),p=Or(a.rationale);(!l||!Oa("architecture_rule",l))&&e.push(Re("INVALID_SCHEMA_02",[...c,"id"],"architecture rule ids must use the executable AR-<8 lowercase hex> policy")),a.kind!=="forbidden_import"&&e.push(Re("INVALID_SCHEMA_02",[...c,"kind"],"architecture rule kind must be forbidden_import")),u||e.push(Re("INVALID_SCHEMA_02",[...c,"from"],"architecture rule from must name the importing layer")),d||e.push(Re("INVALID_SCHEMA_02",[...c,"to"],"architecture rule to must name the imported dependency layer")),p||e.push(Re("INVALID_SCHEMA_02",[...c,"rationale"],"architecture rule rationale must be a non-empty string")),l&&r.has(l)&&e.push(Re("DUPLICATE_IDENTIFIER",[...c,"id"],`duplicate architecture rule id ${l}`)),l&&r.add(l);let f=u&&d?`forbidden_import\0${u}\0${d}`:void 0;f&&n.has(f)&&e.push(Re("DUPLICATE_IDENTIFIER",c,`duplicate forbidden import from ${u} to ${d}`)),f&&n.add(f),l&&u&&d&&p&&a.kind==="forbidden_import"&&i.push({id:l,kind:"forbidden_import",from:u,to:d,rationale:p})}),i.sort((s,o)=>s.id.localeCompare(o.id))}function F2(t,e,r,n,i,s=!0){if(!Object.hasOwn(t,e))return s&&n.push(Re("INVALID_SCHEMA_02",[...r,e],`${i} must be explicitly persisted as an array`)),s?void 0:[];let o=t[e];if(!Array.isArray(o)){n.push(Re("INVALID_SCHEMA_02",[...r,e],`${i} must be an array of non-empty strings`));return}let a=[],c=new Set;return o.forEach((l,u)=>{let d=Or(l);if(!d){n.push(Re("INVALID_SCHEMA_02",[...r,e,u],`${i} entries must be non-empty strings`));return}c.has(d)&&n.push(Re("DUPLICATE_IDENTIFIER",[...r,e,u],`${i} must not repeat ${d}`)),c.add(d),a.push(d)}),a}function _k(t,e,r,n,i){if(Object.hasOwn(t,e))return F2(t,e,r,n,i,!1)}function pb(t,e,r,n,i,s=!1){if(!Object.hasOwn(t,e))return;let o=t[e];if(typeof o!="string"||s&&o.trim().length===0){n.push(Re("INVALID_SCHEMA_02",[...r,e],`${i} must be ${s?"a non-empty ":"a "}string when supplied`));return}return o}function L2(t,e,r,n){if(Object.hasOwn(t,e)){if(typeof t[e]!="string"){r.push(Re("INVALID_SCHEMA_02",[e],`${n} must be a string`));return}return t[e]}}function wX(t,e,r,n){if(!Object.hasOwn(t,e))return;let i=t[e];if(!Array.isArray(i)){r.push(Re("INVALID_SCHEMA_02",[e],`${n} must be an array of strings`));return}let s=[],o=new Set;return i.forEach((a,c)=>{if(typeof a!="string"){r.push(Re("INVALID_SCHEMA_02",[e,c],`${n} entries must be strings`));return}a.trim()&&o.has(a)&&r.push(Re("DUPLICATE_IDENTIFIER",[e,c],`${n} must not repeat ${a}`)),a.trim()&&o.add(a),s.push(a)}),s}function aje(t,e,r,n){if(!Object.hasOwn(t,e))return;let i=Da(t[e]);if(!i){r.push(Re("INVALID_SCHEMA_02",[e],`${n} must be an object when supplied`));return}return i}function il(t,e,r,n,i=[]){Object.keys(t).sort().forEach(s=>{if(e.has(s)&&!xX(s))return;let o=xX(s)?"LEGACY_FIELD":"INVALID_SCHEMA_02";r.push(Re(o,[...i,s],`${n} must not contain ${s} in schema 0.2`))})}function cje(t){let e=["require_oracles","oracle_policy","independence_policy","deliverable","smoke","ai_hints"].filter(r=>Object.hasOwn(t,r)).sort();return Object.fromEntries(e.map(r=>[r,t[r]]))}function xX(t){return new Set(["schema","source","summary","surface","features","forbidden_imports","intent_summary","slug","flow","ears","condition","action","response","text","test_refs","adr_refs"]).has(t)}function Sk(t,e,r,n){Object.hasOwn(t,e)&&typeof t[e]!==r&&n.push(Re("INVALID_SCHEMA_02",[e],`project.${e} must be a ${r} when supplied`))}function lje(t){return t==="L1"||t==="L2"||t==="L3"||t==="L4"}function uje(t){return t==="off"||t==="advisory"||t==="required"}function M2(t){return t==="behavior"||t==="quality"||t==="constraint"}function dje(t){return t==="planned"||t==="in_progress"||t==="done"||t==="blocked"||t==="archived"}function Re(t,e,r){return{code:t,path:e,message:r}}function Da(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0}function Or(t){return typeof t=="string"&&t.trim().length>0?t:void 0}var kk=S(()=>{"use strict";Li()});function Gu(t){if(typeof t!="string")return cn("INVALID_INPUT","Statement must be a string.");let e=B2(t);if(!e.balanced)return cn("UNBALANCED_PROTECTED_SPAN","Statement contains an unbalanced quote, code span, or parenthesis.");let r=FX(e.masked),n=_je(e.masked);if(r===-1||n===-1)return cn("EMPTY_STATEMENT","Statement must not be empty.");if(e.masked[n]!==".")return cn("MISSING_TERMINAL_PERIOD","Statement must end with one unprotected period.");let i=e.masked.slice(r,n),s=t.slice(r,n);if([...i.matchAll(pje)].length>0)return cn("DISALLOWED_MODAL","Use exactly one shall or shall not modal; should, must, and will are not conformant.");let a=[...i.matchAll(fje)];if(a.length!==1)return cn("MODAL_COUNT","Statement must contain exactly one unprotected shall or shall not modal.");let c=a[0],l=c.index??-1,u=i.slice(0,l),d=s.slice(0,l),p=s.slice((c.index??0)+c[0].length).trim();if(p.length===0)return cn("EMPTY_RESPONSE","Statement must include a response after its modal.");let f=mje(d,u);return f.status==="invalid"?f:f.system.length===0?cn("EMPTY_SYSTEM","Statement must name a non-empty system before its modal."):{status:"valid",pattern:f.pattern,clauses:f.clauses,system:f.system,modal:/^shall\s+not$/i.test(c[0])?"shall not":"shall",response:p,statement:t}}function jX(t){let e=B2(t.response).masked,r=[];return/,[\s]*(?:and|or)\s+\S+/i.test(e)&&r.push({code:"TOP_LEVEL_OBLIGATION_LIST",detail:"response contains a top-level comma-separated obligation list"}),hje.test(e)&&r.push({code:"COORDINATED_INDEPENDENT_PREDICATES",detail:"response coordinates independently actionable predicates"}),/\b(?:either|one of|any of|select from|choose from)\b/i.test(e)&&r.push({code:"SEVERAL_SELECTABLE_OUTCOMES",detail:"response offers several independently selectable outcomes"}),t.statement.length>240&&r.push({code:"EXCESSIVE_LENGTH",detail:`statement is ${t.statement.length} characters long`}),{advisory:!0,signals:r}}function LX(t){if(typeof t!="string")return!1;let e=B2(t);return e.balanced&&/\b(?:shall|must|should|will)\b/i.test(e.masked)}function mje(t,e){let r=FX(e);if(r===-1)return cn("EMPTY_SYSTEM","Statement must name a non-empty system before its modal.");let n=[],i=-1;for(;;){let s=Ek(e,r);if(s==="the"){let u=U2(e,r+3),d=t.slice(u).trim();return d.includes(",")&&vje(e.slice(u))?cn("INVALID_PREFIX","System phrase must end before the modal and cannot introduce another structural comma."):{status:"valid",pattern:n.length===0?"ubiquitous":n.length===1?yje(n[0].keyword):"compound",clauses:n,system:d}}if(!OX(s))return cn("INVALID_PREFIX","Statement must begin with The, When, While, Where, or If and place The before the system.");let o=DX.indexOf(s);if(o<=i)return cn("OUT_OF_ORDER_CLAUSE","Compound clauses must appear once in When, While, Where, If order.");let a=bje(e,r+s.length);if(a===-1)return cn("MISSING_COMMA",`${NX(s)} clause must end at an unprotected comma.`);let c=t.slice(r+s.length,a).trim();if(c.length===0)return cn("EMPTY_CLAUSE",`${NX(s)} clause must not be empty.`);if(n.push({keyword:s,value:c}),i=o,r=U2(e,a+1),s==="if"){if(Ek(e,r)!=="then")return cn("MISSING_THEN","If clause must use \u201Cthen\u201D after its comma.");if(r=U2(e,r+4),Ek(e,r)!=="the")return cn("INVALID_PREFIX","If clause must continue with \u201Cthen the shall \u2026\u201D.");continue}let l=Ek(e,r);if(l!=="the"&&!OX(l))return cn("INVALID_PREFIX","Every non-If clause comma must be followed by the next clause or \u201Cthe \u201D.")}}function B2(t){let e=t.split(""),r=t.split(""),n=(s,o)=>{for(let a=s;a=0;e-=1)if(!/\s/.test(t[e]))return e;return-1}function U2(t,e){let r=e;for(;r{"use strict";DX=["when","while","where","if"],pje=/\b(?:should|must|will)\b/gi,fje=/\bshall\b(?:\s+not\b)?/gi,hje=/\b(?:create|update|delete|send|emit|record|render|display|persist|store|queue|validate|reject|allow|deny|log|notify|start|stop|retry|write|read|calculate|schedule|run|return)\b[\s\S]{0,80}\b(?:and|or)\b\s+(?:the\s+)?\b(?:create|update|delete|send|emit|record|render|display|persist|store|queue|validate|reject|allow|deny|log|notify|start|stop|retry|write|read|calculate|schedule|run|return)\b/i});import{existsSync as Wu,readFileSync as BX,readdirSync as Sje}from"node:fs";import{join as ja,relative as wje,resolve as qX}from"node:path";function VX(t){if(t==="0.1"||t==="0.2")return t;throw new Error(`Spec compiler does not recognize workspace schema ${JSON.stringify(t)}`)}function Nr(t="."){let e=lb(t);return e||To(t,()=>Nf(t))}function di(t){let e=lb(t);return e||Nf(t)}function Nf(t){let e=qX(t),r=Hu(e,"spec.yaml"),n=ZX(r.value,"spec.yaml must contain an object");return VX(n.schema)==="0.1"?xje(e,r,n):kje(e,r,n)}function GX(t="."){let e=qX(t),r=Hu(e,"spec.yaml"),n=ZX(r.value,"spec.yaml must contain an object");if(VX(n.schema)!=="0.1")throw new Error("Schema migration preview currently accepts only schema 0.1 workspaces");let i=s=>{if(Wu(ja(e,s)))return gr(Hu(e,s).value)??void 0};return{schemaVersion:"0.1",root:n,features:Of(e,r,n.features,"features").map(s=>({path:s.path,value:s.value})),capabilities:Object.hasOwn(n,"capabilities")?n.capabilities:i("spec/capabilities.yaml"),architecture:Object.hasOwn(n,"architecture")?gr(n.architecture)??void 0:i("spec/architecture.yaml"),scenarios:Of(e,r,n.scenarios,"scenarios").map(s=>({path:s.path,value:s.value}))}}function HX(t){return sb(t).corpusRecords()}function xje(t,e,r){let n={semanticNodes:new Map,artifactNodes:new Map,anchorNodes:new Map,edges:[],presentations:[],aliases:[],diagnostics:[]},i=r.project;!i||typeof i!="object"||Array.isArray(i)?n.diagnostics.push({code:"INVALID_ROOT",message:"spec.yaml project must be an object",source:Ae(e,["project"])}):(No(n,{address:"project",nodeType:"semantic",kind:"project",provenance:"authored",source:Ae(e,["project"])}),Do(n,{schemaVersion:"0.1",address:"project",kind:"project",source:Ae(e,["project"])})),hs(n,ct("spec.yaml"),["spec"],[],Ae(e,[])),n.semanticNodes.has("project")&&Er(n,"project",ct("spec.yaml"),"defined_in","authored",Ae(e,["project"]));let s=Of(t,e,r.features,"features");for(let c of s)Ije(n,t,c);let o=Of(t,e,r.scenarios,"scenarios");for(let c of o)Oje(n,c);return{schemaVersion:"0.1",nodes:[...n.semanticNodes.values(),...[...n.artifactNodes.values()].map(c=>({address:c.address,nodeType:"artifact",roles:[...c.roles].sort(),owners:[...c.owners].sort(),provenance:"derived",...c.source?{source:c.source}:{}})),...n.anchorNodes.values()].sort((c,l)=>c.address.localeCompare(l.address)),edges:[...n.edges].sort((c,l)=>c.address.localeCompare(l.address)),diagnostics:[...n.diagnostics].sort((c,l)=>c.message.localeCompare(l.message)),presentations:Ik(n.presentations),aliases:Ik(n.aliases)}}function kje(t,e,r){let n={semanticNodes:new Map,artifactNodes:new Map,anchorNodes:new Map,edges:[],presentations:[],aliases:[],diagnostics:[]},i=r.project,s=gr(i);!i||typeof i!="object"||Array.isArray(i)?n.diagnostics.push({code:"INVALID_ROOT",severity:"blocking",message:"spec.yaml project must be an object",source:Ae(e,["project"])}):(No(n,{address:"project",nodeType:"semantic",kind:"project",provenance:"authored",source:Ae(e,["project"])}),Do(n,{schemaVersion:"0.2",address:"project",kind:"project",...typeof s?.purpose=="string"?{purpose:s.purpose}:{},source:Ae(e,["project"])})),hs(n,ct("spec.yaml"),["spec"],[],Ae(e,[])),n.semanticNodes.has("project")&&Er(n,"project",ct("spec.yaml"),"defined_in","authored",Ae(e,["project"]));let o=$je(t),a=o.baseline;o.document&&hs(n,ct(o.document.path),["generated"],[],Ae(o.document,[]));for(let R of o.issues)n.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:`Invalid migration baseline: ${R}`,source:Ae(e,[])});let c=Bn(a,"project",s??void 0)&&(s?.purpose===void 0||typeof s.purpose=="string")?a?.project.exemption?.id:void 0,l=EX(i,c);fb(n,e,l.issues);let u=Object.hasOwn(r,"inventory")?Eje(r.inventory,n,e):void 0;for(let R of["capabilities","architecture"])Object.hasOwn(r,R)&&n.diagnostics.push({code:"LEGACY_FIELD",severity:"blocking",message:`spec.yaml#${R} is not a schema 0.2 source; use spec/${R}.yaml`,source:Ae(e,[R])});let d=zX(t,"spec/capabilities.yaml");d||n.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:"schema 0.2 requires the canonical capability catalog spec/capabilities.yaml",source:Ae(e,[])});let p=d?wk(d.value):void 0;d&&p&&fb(n,d,p.issues);let f=p?.value??[],h=new Set(f.map(R=>R.id));if(d){let R=ct(d.path);hs(n,R,["spec"],[],Ae(d,[]));for(let A of f){let B=Sn("capability",A.id),Z=Ae(d,["capabilities",UX(d.value,"capabilities",A.id),"id"]);No(n,{address:B,nodeType:"semantic",kind:"capability",provenance:"authored",source:Z}),Do(n,{schemaVersion:"0.2",address:B,kind:"capability",title:A.title,source:Z}),Er(n,B,R,"defined_in","authored",Z)}}let m=zX(t,"spec/architecture.yaml");m||n.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:"schema 0.2 requires the canonical architecture contract spec/architecture.yaml",source:Ae(e,[])});let y=m?xk(m.value):void 0;m&&y&&fb(n,m,y.issues);let v=y?.value,g=new Map((v?.rules??[]).map(R=>[R.id,R]));if(m){let R=ct(m.path);hs(n,R,["spec"],[],Ae(m,[]));for(let A of v?.rules??[]){let B=Sn("architecture_rule",A.id),Z=Ae(m,["rules",UX(m.value,"rules",A.id),"id"]);No(n,{address:B,nodeType:"semantic",kind:"architecture_rule",provenance:"authored",source:Z}),Do(n,{schemaVersion:"0.2",address:B,kind:"architecture_rule",rationale:A.rationale,source:Z}),Er(n,B,R,"defined_in","authored",Z)}}let b=[],w=0;if(Array.isArray(r.features)&&r.features.length>0)n.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:"schema 0.2 requires feature shards under spec/features; inline root features are not accepted",source:Ae(e,["features"])});else{let R=Of(t,e,void 0,"features");w=R.length;let A=new Set;for(let B of R)Pje(n,t,B,h,g,b,a,A)}let x=[],$=Of(t,e,void 0,"scenarios");Array.isArray(r.scenarios)&&r.scenarios.length>0?n.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:"schema 0.2 requires scenario shards under spec/scenarios; inline root scenarios are not accepted",source:Ae(e,["scenarios"])}):Tje(n,$,new Set([...n.semanticNodes.values()].filter(R=>R.kind==="feature").map(R=>R.address.slice(8))),x,l.value?.scenarioPolicy);let I=l.value&&p?.value&&v&&b.length===w&&!n.diagnostics.some(R=>R.severity!=="advisory")?{project:l.value,capabilities:f,features:b.sort((R,A)=>R.id.localeCompare(A.id)),scenarios:x.sort((R,A)=>R.id.localeCompare(A.id)),architecture:v,...u===void 0?{}:{inventory:u}}:void 0,E=a&&o.document?Nje(t,o.document,a):void 0;return Aje("0.2",n,I,a,E)}function Eje(t,e,r){let n=gr(t),i=["features","scenarios","capabilities","test_files"];if(!n||Object.keys(n).length!==i.length||Object.keys(n).some(o=>!i.includes(o))){e.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:"spec.yaml inventory must contain exactly features, scenarios, capabilities, and test_files",source:Ae(r,["inventory"])});return}if(i.map(o=>n[o]).some(o=>typeof o!="number"||!Number.isSafeInteger(o)||o<0)){e.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:"spec.yaml inventory counts must be non-negative safe integers",source:Ae(r,["inventory"])});return}return{features:n.features,scenarios:n.scenarios,capabilities:n.capabilities,testFiles:n.test_files}}function Aje(t,e,r,n,i){let s=[...e.semanticNodes.values(),...[...e.artifactNodes.values()].map(o=>({address:o.address,nodeType:"artifact",roles:[...o.roles].sort(),owners:[...o.owners].sort(),provenance:"derived",...o.source?{source:o.source}:{}})),...e.anchorNodes.values()].sort((o,a)=>o.address.localeCompare(a.address));return{schemaVersion:t,nodes:s,edges:[...e.edges].sort((o,a)=>o.address.localeCompare(a.address)),diagnostics:[...e.diagnostics].sort((o,a)=>o.message.localeCompare(a.message)),presentations:Ik(e.presentations),aliases:Ik(e.aliases),...r?{contract:r}:{},...n?{migrationBaseline:n}:{},...i?{migrationProofs:i}:{}}}function Of(t,e,r,n){if(Array.isArray(r)&&r.length>0)return[e];let i=ja(t,"spec",n);return Wu(i)?Sje(i).filter(s=>s.endsWith(".yaml")||s.endsWith(".yml")).sort().map(s=>Hu(t,ja("spec",n,s))):[]}function zX(t,e){return Wu(ja(t,e))?Hu(t,e):void 0}function $je(t){let e=ja(t,"spec/generated/migration-baseline-0.1-to-0.2.yaml");if(!Wu(e))return{issues:[]};let r=Hu(t,"spec/generated/migration-baseline-0.1-to-0.2.yaml"),n=r.value;if(!gr(n))return{document:r,issues:["baseline must be an object"]};try{let i=n,s=qu(i);return s.length===0?{baseline:i,document:r,issues:s}:{document:r,issues:s}}catch{return{document:r,issues:["baseline has an invalid structural shape"]}}}function fb(t,e,r){for(let n of r)t.diagnostics.push({code:n.code,severity:"blocking",message:n.message,source:Ae(e,n.path)})}function UX(t,e,r){let i=jo(gr(t)?.[e]).findIndex(s=>gr(s)?.id===r);return i<0?0:i}function Ije(t,e,r){let n=gr(r.value),i=r.path==="spec.yaml"?["features"]:[];(r.path==="spec.yaml"?jo(n?.features):[n]).forEach((o,a)=>{let c=gr(o),l=r.path==="spec.yaml"?[...i,a]:[];if(!c||typeof c.id!="string"||typeof c.title!="string"||typeof c.status!="string"){t.diagnostics.push({code:"INVALID_FEATURE",message:`feature in ${r.path} lacks id, title, or status`,source:Ae(r,l)});return}let u=Sn("feature",c.id),d=Ae(r,[...l,"id"]);No(t,{address:u,nodeType:"semantic",kind:"feature",provenance:"authored",source:d}),Do(t,{schemaVersion:"0.1",address:u,kind:"feature",title:c.title,status:c.status,...typeof c.slug=="string"?{slug:c.slug}:{},source:d}),$k(t,{alias:c.id,address:u,kind:"feature_id",source:d}),typeof c.slug=="string"&&$k(t,{alias:c.slug,address:u,kind:"feature_slug",source:Ae(r,[...l,"slug"])});let p=ct(r.path);hs(t,p,["spec"],[u],Ae(r,l)),Er(t,u,p,"defined_in","authored",d);for(let[h,m]of sl(c.depends_on).entries())Er(t,u,Sn("feature",m),"depends_on","authored",Ae(r,[...l,"depends_on",h]));for(let[h,m]of sl(c.modules).entries()){let y=ct(m);hs(t,y,[JX(m)],[u],Ae(r,[...l,"modules",h])),Er(t,u,y,"touches","authored",Ae(r,[...l,"modules",h]))}jo(c.acceptance_criteria).forEach((h,m)=>{let y=gr(h),v=[...l,"acceptance_criteria",m];if(!y||typeof y.id!="string"){t.diagnostics.push({code:"INVALID_FEATURE",message:`${c.id} has a criterion without an id`,source:Ae(r,v)});return}let g=Sn("criterion",`${c.id}/${y.id}`),b=Ae(r,[...v,"id"]);No(t,{address:g,nodeType:"semantic",kind:"criterion",provenance:"authored",source:b}),Do(t,{schemaVersion:"0.1",address:g,kind:"criterion",...typeof y.text=="string"?{statement:y.text}:{},source:b}),Er(t,u,g,"contains","authored",b),Er(t,g,p,"defined_in","authored",b),hb(t,e,r,v,g,"test",y.test_refs),hb(t,e,r,v,g,"oracle",y.oracle_refs),hb(t,e,r,v,g,"evidence",y.evidence_refs)})})}function Pje(t,e,r,n,i,s,o,a){let c=gr(r.value);if(!c||typeof c.id!="string"||typeof c.title!="string"||typeof c.status!="string"){t.diagnostics.push({code:"INVALID_FEATURE",severity:"blocking",message:`feature in ${r.path} lacks id, title, or status`,source:Ae(r,[])});return}if(a.has(c.id)){t.diagnostics.push({code:"DUPLICATE_IDENTIFIER",severity:"blocking",message:`duplicate feature id ${c.id}`,source:Ae(r,["id"])});return}a.add(c.id);let l=Bn(o,`feature:${c.id}`,c)&&(c.purpose===void 0||typeof c.purpose=="string")?o?.features.find(b=>b.address===`feature:${c.id}`)?.exemption?.id:void 0,u=new Map;for(let b of jo(c.acceptance_criteria)){let w=gr(b),x=w?.id;if(typeof x!="string"||!Bn(o,`criterion:${c.id}/${x}`,w??void 0)||!o)continue;let $=o.criteria.find(I=>I.address===`criterion:${c.id}/${x}`)?.exemption.id;$&&u.set(x,$)}let d=z2(c,{...l?{featureBaselineIdentity:l}:{},...u.size>0?{criterionBaselineIdentities:u}:{}});fb(t,r,d.issues),d.value&&s.push(d.value);let p=Rje(c,o),f=Sn("feature",c.id),h=Ae(r,["id"]),m=Ae(r,[]),y=el(r.path,c.id);No(t,{address:f,nodeType:"semantic",kind:"feature",provenance:"authored",source:h}),Do(t,{schemaVersion:"0.2",address:f,kind:"feature",title:c.title,status:c.status,slug:y,...typeof c.purpose=="string"?{purpose:c.purpose}:{},source:m}),$k(t,{alias:c.id,address:f,kind:"feature_id",source:h}),$k(t,{alias:y,address:f,kind:"feature_slug",source:m});let v=ct(r.path);hs(t,v,["spec"],[f],Ae(r,[])),Er(t,f,v,"defined_in","authored",h);for(let[b,w]of sl(c.depends_on).entries())Er(t,f,Sn("feature",w),"depends_on","authored",Ae(r,["depends_on",b]));for(let[b,w]of sl(c.modules).entries()){let x=ct(w);hs(t,x,[JX(w)],[f],Ae(r,["modules",b])),Er(t,f,x,"touches","authored",Ae(r,["modules",b]))}for(let[b,w]of sl(c.capability_refs).entries()){let x=Ae(r,["capability_refs",b]);if(!n.has(w)){t.diagnostics.push({code:"UNKNOWN_REFERENCE",severity:"blocking",message:`${c.id} capability_refs contains unknown capability ${w}`,source:x});continue}Er(t,f,Sn("capability",w),"contributes_to","authored",x)}let g=new Set;for(let[b,w]of jo(c.acceptance_criteria).entries()){let x=gr(w),$=typeof x?.id=="string"&&g.has(x.id);typeof x?.id=="string"&&g.add(x.id),!$&&Cje(t,e,r,c.id,f,v,b,x,typeof x?.id=="string"?p.get(x.id):void 0,i,Bn(o,`criterion:${c.id}/${typeof x?.id=="string"?x.id:""}`,x??void 0))}}function Rje(t,e){let r=new Map,n=new Set;for(let i of jo(t.acceptance_criteria)){let s=gr(i);if(!s||typeof s.id!="string"||n.has(s.id))continue;n.add(s.id);let o=`criterion:${t.id}/${s.id}`,a=Bn(e,o,s)?e?.criteria.find(u=>u.address===o)?.exemption.id:void 0,l=z2({id:t.id,title:"Criterion structural projection",status:"planned",purpose:"Retain independently valid authored criterion facts.",capability_refs:[],acceptance_criteria:[s]},{...a?{criterionBaselineIdentities:new Map([[s.id,a]])}:{}}).value?.acceptanceCriteria[0];l&&r.set(l.id,l)}return r}function Cje(t,e,r,n,i,s,o,a,c,l,u){let d=["acceptance_criteria",o];if(!a||typeof a.id!="string"){t.diagnostics.push({code:"INVALID_FEATURE",severity:"blocking",message:`${n} has a criterion without an id`,source:Ae(r,d)});return}a.kind!=="behavior"&&a.kind!=="quality"&&a.kind!=="constraint"&&!u&&t.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:`${n}/${a.id} requires kind behavior, quality, or constraint`,source:Ae(r,[...d,"kind"])});let p=Gu(a.statement);if(p.status==="invalid"&&!u)t.diagnostics.push({code:"INVALID_STATEMENT",severity:"blocking",message:`${n}/${a.id} statement is invalid: ${p.issues.map(y=>y.message).join(" ")}`,source:Ae(r,[...d,"statement"]),details:p.issues.map(y=>y.code)});else if(p.status!=="invalid"){let y=jX(p);y.signals.length>0&&t.diagnostics.push({code:"ATOMICITY_RISK",severity:"advisory",message:`${n}/${a.id} has advisory atomicity signals`,source:Ae(r,[...d,"statement"]),details:y.signals.map(v=>`${v.code}:${v.detail}`)})}let f=Sn("criterion",`${n}/${a.id}`),h=Ae(r,[...d,"id"]);if(No(t,{address:f,nodeType:"semantic",kind:"criterion",provenance:"authored",source:h}),Do(t,{schemaVersion:"0.2",address:f,kind:"criterion",...typeof a.statement=="string"?{statement:a.statement}:{},...typeof a.rationale=="string"?{rationale:a.rationale}:{},source:h}),Er(t,i,f,"contains","authored",h),Er(t,f,s,"defined_in","authored",h),c&&(hb(t,e,r,d,f,"oracle",a.oracle_refs),hb(t,e,r,d,f,"evidence",a.evidence_refs)),c?.kind!=="constraint")return;let m=sl(a.constraint_refs);for(let[y,v]of m.entries()){let g=Ae(r,[...d,"constraint_refs",y]),b=l.get(v);if(!b){t.diagnostics.push({code:"UNKNOWN_REFERENCE",severity:"blocking",message:`${n}/${a.id} constraint_refs contains unknown architecture rule ${v}`,source:g});continue}if(!b.rationale.trim()){t.diagnostics.push({code:"INVALID_SCHEMA_02",severity:"blocking",message:`${n}/${a.id} constraint_refs must resolve to rules with non-empty rationales`,source:g});continue}Er(t,f,Sn("architecture_rule",v),"constrained_by","authored",g)}}function Tje(t,e,r,n,i){let s=new Set,o=0;for(let a of e){let c=gr(a.value),l=PX(a.value);fb(t,a,l.issues);let u=typeof c?.id=="string"&&c.id.trim().length>0?c.id:void 0,d=typeof c?.title=="string"&&c.title.trim().length>0?c.title:void 0,p=u!==void 0&&s.has(u);if(u!==void 0&&(p&&t.diagnostics.push({code:"DUPLICATE_IDENTIFIER",severity:"blocking",message:`duplicate scenario id ${u}`,source:Ae(a,["id"])}),s.add(u)),u!==void 0&&d!==void 0){let f=Sn("scenario",u),h=Ae(a,["id"]);No(t,{address:f,nodeType:"semantic",kind:"scenario",provenance:"authored",source:h}),Do(t,{schemaVersion:"0.2",address:f,kind:"scenario",title:d,source:h});let m=ct(a.path);hs(t,m,["spec"],[f],Ae(a,[])),Er(t,f,m,"defined_in","authored",h);let y=!0;for(let[v,g]of jo(c?.feature_refs).entries()){if(typeof g!="string")continue;let b=g;if(!b.trim())continue;let w=Ae(a,["feature_refs",v]);if(!r.has(b)){y=!1,t.diagnostics.push({code:"UNKNOWN_REFERENCE",severity:"blocking",message:`${u} feature_refs contains unknown feature ${b}`,source:w});continue}Er(t,f,Sn("feature",b),"participates_in","authored",w)}l.completeness==="complete"&&l.value&&!p&&y&&n.push(l.value)}l.completeness==="hollow"&&o++}i!=="off"&&(e.length===0||o>0)&&t.diagnostics.push({code:"INVALID_SCENARIO",severity:i==="required"?"blocking":"advisory",message:e.length===0?"scenario coverage is absent under the current scenario policy":"scenario coverage contains a hollow journey"})}function Oje(t,e){let r=gr(e.value);(e.path==="spec.yaml"?jo(r?.scenarios):[r]).forEach((i,s)=>{let o=gr(i),a=e.path==="spec.yaml"?["scenarios",s]:[];if(!o||typeof o.id!="string"||typeof o.title!="string"){t.diagnostics.push({code:"INVALID_SCENARIO",message:`scenario in ${e.path} lacks id or title`,source:Ae(e,a)});return}let c=Sn("scenario",o.id),l=Ae(e,[...a,"id"]);No(t,{address:c,nodeType:"semantic",kind:"scenario",provenance:"authored",source:l}),Do(t,{schemaVersion:"0.1",address:c,kind:"scenario",title:o.title,source:l});let u=ct(e.path);hs(t,u,["spec"],[c],Ae(e,a)),Er(t,c,u,"defined_in","authored",l);for(let[d,p]of sl(o.features).entries())Er(t,c,Sn("feature",p),"participates_in","authored",Ae(e,[...a,"features",d]))})}function hb(t,e,r,n,i,s,o){for(let[a,c]of sl(o).entries()){let l=Ae(r,[...n,`${s}_refs`,a]),u=WX(e,c),d=s==="test"?["test"]:s==="oracle"?["oracle"]:["evidence"];hs(t,u.artifact,d,[],l),u.anchor&&t.anchorNodes.set(u.target,{address:u.target,nodeType:"anchor",artifact:u.artifact,selector:u.anchor.selector,selectorProvenance:u.anchor.selectorProvenance,source:l,provenance:"authored"}),Er(t,i,u.target,"supports","authored",l,{state:u.resolution,channel:s,raw:c,normalizedTarget:u.target,selector:u.selector})}}function Nje(t,e,r){let n=[];for(let[i,s]of r.criteria.entries())for(let[o,a]of s.bindings.entries()){if(a.channel!=="test"&&a.channel!=="oracle"&&a.channel!=="evidence"||typeof a.raw!="string")continue;let c=WX(t,a.raw);n.push({owner:s.address,channel:a.channel,raw:a.raw,normalizedTarget:c.target,selector:c.selector,resolution:c.resolution,source:Ae(e,["criteria",i,"bindings",o,"raw"])})}return n.sort((i,s)=>JSON.stringify(i).localeCompare(JSON.stringify(s)))}function WX(t,e){let r=e.indexOf("#"),n=(r<0?e:e.slice(0,r)).trim(),i=r<0?void 0:e.slice(r+1),s=i===void 0||i.length===0?{precision:"none"}:{precision:"fragment",value:i};if(n.startsWith("fixture:")){let l=n.slice(8);if(jje(t).has(l)){let d=ct("conformance/fixtures.yaml");return{target:an("conformance/fixtures.yaml",l),artifact:d,selector:s,resolution:"resolved",anchor:{selector:l,selectorProvenance:"derived"}}}let u=`artifact:${n}`;return{target:u,artifact:u,selector:s,resolution:"unresolved"}}if(n.startsWith("script:")||n.startsWith("self-dogfood:")){let l=n.startsWith("script:")?"script:":"self-dogfood:",u=n.slice(l.length);if(Lje(t).has(u)){let p=ct("package.json");return{target:an("package.json",`scripts.${u}`),artifact:p,selector:s,resolution:"resolved",anchor:{selector:`scripts.${u}`,selectorProvenance:"derived"}}}let d=`artifact:${n}`;return{target:d,artifact:d,selector:s,resolution:"unresolved"}}if(n.startsWith("derived:")){let l=`artifact:${n}`;return{target:l,artifact:l,selector:s,resolution:"unresolved"}}let o=hf(n),a=ct(o);return{target:s.precision==="fragment"?an(o,s.value??""):a,artifact:a,selector:s,resolution:Dje(o)&&Wu(ja(t,o))?"resolved":"unresolved",...s.precision==="fragment"?{anchor:{selector:s.value??"",selectorProvenance:"authored"}}:{}}}function Dje(t){return!Lu(t).some(e=>e.authority==="transient")}function No(t,e){t.semanticNodes.set(e.address,e)}function Do(t,e){t.presentations.push(e)}function $k(t,e){t.aliases.push(e)}function hs(t,e,r,n,i){let s=t.artifactNodes.get(e);if(s){r.forEach(o=>s.roles.add(o)),n.forEach(o=>s.owners.add(o));return}t.artifactNodes.set(e,{address:e,roles:new Set(r),owners:new Set(n),...i?{source:i}:{}})}function Er(t,e,r,n,i,s,o={}){let a=`${e}|${n}|${r}|${s.path}:${s.yamlPath}`;t.edges.push({address:a,from:e,to:r,relation:n,provenance:i,owner:s,...o})}function Hu(t,e){let r=ja(t,e),n=BX(r,"utf8"),i=new Pk.LineCounter,s=(0,Pk.parseDocument)(n,{lineCounter:i});return{path:hf(wje(t,r)),document:s,lineCounter:i,value:s.toJS()}}function jje(t){let e="conformance/fixtures.yaml";if(!Wu(ja(t,e)))return new Set;let r=gr(Hu(t,e).value);return new Set(jo(r?.fixtures).map(n=>gr(n)?.name).filter(n=>typeof n=="string"))}function Lje(t){let e=ja(t,"package.json");if(!Wu(e))return new Set;let r=gr(JSON.parse(BX(e,"utf8"))),n=gr(r?.scripts);return new Set(Object.entries(n??{}).filter(([,i])=>typeof i=="string").map(([i])=>i))}function Ae(t,e){let n=t.document.getIn(e,!0)?.range,i=n?.[0]??0,s=n?.[1]??i,o=t.lineCounter.linePos(i),a={start:i,end:s,line:o.line,column:o.col},c=e.length===0?"$":`$${e.map(l=>typeof l=="number"?`[${l}]`:`.${l}`).join("")}`;return{path:t.path,yamlPath:c,range:a}}function ZX(t,e){let r=gr(t);if(!r)throw new Error(e);return r}function gr(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null}function jo(t){return Array.isArray(t)?t:[]}function sl(t){return jo(t).filter(e=>typeof e=="string")}function JX(t){return/\.(?:test|spec)\.[cm]?[jt]sx?$/.test(t)||t.includes("/tests/")?"test":/\.(?:md|mdx)$/.test(t)?"doc":t.startsWith("spec/generated/")?"generated":"source"}function Ik(t){return[...t].sort((e,r)=>JSON.stringify(e).localeCompare(JSON.stringify(r)))}var Pk,qn=S(()=>{"use strict";Pk=Et(cr(),1);_f();qs();b2();Li();kr();Cf();Vu();kk();Ak();qs()});import{existsSync as q2,lstatSync as KX,realpathSync as YX}from"node:fs";import{isAbsolute as Mje,join as Fje,relative as XX,resolve as QX}from"node:path";function xn(t,e){if(!e||Mje(e)||e.split(/[\\/]/).some(o=>!o||o==="."||o===".."))throw new Hs(`Unsafe proof path ${e}.`);let r=QX(t);if(!q2(r)||KX(r).isSymbolicLink())throw new Hs("Proof workspace root may not be a symbolic link.");let n=YX(r),i=QX(r,e);if(XX(r,i).startsWith(".."))throw new Hs(`Proof path escapes workspace: ${e}.`);let s=r;for(let o of e.split(/[\\/]/))if(s=Fje(s,o),q2(s)&&KX(s).isSymbolicLink())throw new Hs(`Proof path has a symbolic-link ancestor: ${e}.`);if(q2(i)){let o=YX(i);if(o!==n&&XX(n,o).startsWith(".."))throw new Hs(`Proof path resolves outside workspace: ${e}.`)}return i}function Rk(t,e){return xn(t,e)}var Hs,Zu=S(()=>{"use strict";Hs=class extends Error{}});var AL=k(kb=>{"use strict";Object.defineProperty(kb,"__esModule",{value:!0});function zje(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}var zo=class{constructor(e,r,n){this.line=void 0,this.column=void 0,this.index=void 0,this.line=e,this.column=r,this.index=n}},Mf=class{constructor(e,r){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=e,this.end=r}};function Gn(t,e){let{line:r,column:n,index:i}=t;return new zo(r,n+e,i+e)}var eQ="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",Uje={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:eQ},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:eQ}},tQ={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},Ok=t=>t.type==="UpdateExpression"?tQ.UpdateExpression[`${t.prefix}`]:tQ[t.type],Bje={AccessorIsGenerator:({kind:t})=>`A ${t}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:t})=>`Missing initializer in ${t} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:t})=>`\`${t}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:t,exportName:e})=>`A string literal cannot be used as an exported binding without \`from\`. +- Did you mean \`export { '${t}' as '${e}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:t})=>`'${t==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:t})=>`Unsyntactic ${t==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:t})=>`A string literal cannot be used as an imported binding. +- Did you mean \`import { "${t}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:t})=>`Expected number in radix ${t}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:t})=>`Escape sequence in keyword ${t}.`,InvalidIdentifier:({identifierName:t})=>`Invalid identifier ${t}.`,InvalidLhs:({ancestor:t})=>`Invalid left-hand side in ${Ok(t)}.`,InvalidLhsBinding:({ancestor:t})=>`Binding invalid left-hand side in ${Ok(t)}.`,InvalidLhsOptionalChaining:({ancestor:t})=>`Invalid optional chaining in the left-hand side of ${Ok(t)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:t})=>`Unexpected character '${t}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:t})=>`Private name #${t} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:t})=>`Label '${t}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:t})=>`This experimental syntax requires enabling the parser plugin: ${t.map(e=>JSON.stringify(e)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:t})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${t.map(e=>JSON.stringify(e)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:t})=>`Duplicate key "${t}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:t})=>`An export name cannot include a lone surrogate, found '\\u${t.toString(16)}'.`,ModuleExportUndefined:({localName:t})=>`Export '${t}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:t})=>`Private names are only allowed in property accesses (\`obj.#${t}\`) or in \`in\` expressions (\`#${t} in obj\`).`,PrivateNameRedeclaration:({identifierName:t})=>`Duplicate private name #${t}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:t})=>`Unexpected keyword '${t}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:t})=>`Unexpected reserved word '${t}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:t,unexpected:e})=>`Unexpected token${e?` '${e}'.`:""}${t?`, expected "${t}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:t,onlyValidPropertyName:e})=>`The only valid meta property for ${t} is ${t}.${e}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:t})=>`Identifier '${t}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},qje={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:t})=>`Assigning to '${t}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:t})=>`Binding '${t}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},Vje={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:t})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(t)}\`.`},Gje=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),Hje=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:t})=>`Invalid topic token ${t}. In order to use ${t} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${t}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:t})=>`Hack-style pipe body cannot be an unparenthesized ${Ok({type:t})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'}),Wje=["message"];function rQ(t,e,r){Object.defineProperty(t,e,{enumerable:!1,configurable:!0,value:r})}function Zje({toMessage:t,code:e,reasonCode:r,syntaxPlugin:n}){let i=r==="MissingPlugin"||r==="MissingOneOfPlugins",s={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};return s[r]&&(r=s[r]),function o(a,c){let l=new SyntaxError;return l.code=e,l.reasonCode=r,l.loc=a,l.pos=a.index,l.syntaxPlugin=n,i&&(l.missingPlugin=c.missingPlugin),rQ(l,"clone",function(d={}){var p;let{line:f,column:h,index:m}=(p=d.loc)!=null?p:a;return o(new zo(f,h,m),Object.assign({},c,d.details))}),rQ(l,"details",c),Object.defineProperty(l,"message",{configurable:!0,get(){let u=`${t(c)} (${a.line}:${a.column})`;return this.message=u,u},set(u){Object.defineProperty(this,"message",{value:u,writable:!0})}}),l}}function Mo(t,e){if(Array.isArray(t))return n=>Mo(n,t[0]);let r={};for(let n of Object.keys(t)){let i=t[n],s=typeof i=="string"?{message:()=>i}:typeof i=="function"?{message:i}:i,{message:o}=s,a=zje(s,Wje),c=typeof o=="string"?()=>o:o;r[n]=Zje(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:n,toMessage:c},e?{syntaxPlugin:e}:{},a))}return r}var P=Object.assign({},Mo(Uje),Mo(Bje),Mo(qje),Mo(Vje),Mo`pipelineOperator`(Hje));function Jje(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function Kje(t){let e=Jje();if(t==null)return e;if(t.annexB!=null&&t.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(let r of Object.keys(e))t[r]!=null&&(e[r]=t[r]);if(e.startLine===1)t.startIndex==null&&e.startColumn>0?e.startIndex=e.startColumn:t.startColumn==null&&e.startIndex>0&&(e.startColumn=e.startIndex);else if((t.startColumn==null||t.startIndex==null)&&t.startIndex!=null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(e.sourceType==="commonjs"){if(t.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(t.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(t.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return e}var{defineProperty:Yje}=Object,nQ=(t,e)=>{t&&Yje(t,e,{enumerable:!1,value:t[e]})};function mb(t){return nQ(t.loc.start,"index"),nQ(t.loc.end,"index"),t}var Xje=t=>class extends t{parse(){let r=mb(super.parse());return this.optionFlags&256&&(r.tokens=r.tokens.map(mb)),r}parseRegExpLiteral({pattern:r,flags:n}){let i=null;try{i=new RegExp(r,n)}catch{}let s=this.estreeParseLiteral(i);return s.regex={pattern:r,flags:n},s}parseBigIntLiteral(r){let n;try{n=BigInt(r)}catch{n=null}let i=this.estreeParseLiteral(n);return i.bigint=String(i.value||r),i}parseDecimalLiteral(r){let i=this.estreeParseLiteral(null);return i.decimal=String(i.value||r),i}estreeParseLiteral(r){return this.parseLiteral(r,"Literal")}parseStringLiteral(r){return this.estreeParseLiteral(r)}parseNumericLiteral(r){return this.estreeParseLiteral(r)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(r){return this.estreeParseLiteral(r)}estreeParseChainExpression(r,n){let i=this.startNodeAtNode(r);return i.expression=r,this.finishNodeAt(i,"ChainExpression",n)}directiveToStmt(r){let n=r.value;delete r.value,this.castNodeTo(n,"Literal"),n.raw=n.extra.raw,n.value=n.extra.expressionValue;let i=this.castNodeTo(r,"ExpressionStatement");return i.expression=n,i.directive=n.extra.rawValue,delete n.extra,i}fillOptionalPropertiesForTSESLint(r){}cloneEstreeStringLiteral(r){let{start:n,end:i,loc:s,range:o,raw:a,value:c}=r,l=Object.create(r.constructor.prototype);return l.type="Literal",l.start=n,l.end=i,l.loc=s,l.range=o,l.raw=a,l.value=c,l}initFunction(r,n){super.initFunction(r,n),r.expression=!1}checkDeclaration(r){r!=null&&this.isObjectProperty(r)?this.checkDeclaration(r.value):super.checkDeclaration(r)}getObjectOrClassMethodParams(r){return r.value.params}isValidDirective(r){var n;return r.type==="ExpressionStatement"&&r.expression.type==="Literal"&&typeof r.expression.value=="string"&&!((n=r.expression.extra)!=null&&n.parenthesized)}parseBlockBody(r,n,i,s,o){super.parseBlockBody(r,n,i,s,o);let a=r.directives.map(c=>this.directiveToStmt(c));r.body=a.concat(r.body),delete r.directives}parsePrivateName(){let r=super.parsePrivateName();return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(r):r}convertPrivateNameToPrivateIdentifier(r){let n=super.getPrivateNameSV(r);return delete r.id,r.name=n,this.castNodeTo(r,"PrivateIdentifier")}isPrivateName(r){return this.getPluginOption("estree","classFeatures")?r.type==="PrivateIdentifier":super.isPrivateName(r)}getPrivateNameSV(r){return this.getPluginOption("estree","classFeatures")?r.name:super.getPrivateNameSV(r)}parseLiteral(r,n){let i=super.parseLiteral(r,n);return i.raw=i.extra.raw,delete i.extra,i}parseFunctionBody(r,n,i=!1){super.parseFunctionBody(r,n,i),r.expression=r.body.type!=="BlockStatement"}parseMethod(r,n,i,s,o,a,c=!1){let l=this.startNode();l.kind=r.kind,l=super.parseMethod(l,n,i,s,o,a,c),delete l.kind;let{typeParameters:u}=r;u&&(delete r.typeParameters,l.typeParameters=u,this.resetStartLocationFromNode(l,u));let d=this.castNodeTo(l,"FunctionExpression");return r.value=d,a==="ClassPrivateMethod"&&(r.computed=!1),a==="ObjectMethod"?(r.kind==="method"&&(r.kind="init"),r.shorthand=!1,this.finishNode(r,"Property")):this.finishNode(r,"MethodDefinition")}nameIsConstructor(r){return r.type==="Literal"?r.value==="constructor":super.nameIsConstructor(r)}parseClassProperty(...r){let n=super.parseClassProperty(...r);return this.getPluginOption("estree","classFeatures")&&this.castNodeTo(n,"PropertyDefinition"),n}parseClassPrivateProperty(...r){let n=super.parseClassPrivateProperty(...r);return this.getPluginOption("estree","classFeatures")&&(this.castNodeTo(n,"PropertyDefinition"),n.computed=!1),n}parseClassAccessorProperty(r){let n=super.parseClassAccessorProperty(r);return this.getPluginOption("estree","classFeatures")&&(n.abstract&&this.hasPlugin("typescript")?(delete n.abstract,this.castNodeTo(n,"TSAbstractAccessorProperty")):this.castNodeTo(n,"AccessorProperty")),n}parseObjectProperty(r,n,i,s){let o=super.parseObjectProperty(r,n,i,s);return o&&(o.kind="init",this.castNodeTo(o,"Property")),o}finishObjectProperty(r){return r.kind="init",this.finishNode(r,"Property")}isValidLVal(r,n,i,s){return r==="Property"?"value":super.isValidLVal(r,n,i,s)}isAssignable(r,n){return r!=null&&this.isObjectProperty(r)?this.isAssignable(r.value,n):super.isAssignable(r,n)}toAssignable(r,n=!1){if(r!=null&&this.isObjectProperty(r)){let{key:i,value:s}=r;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.loc.start),this.toAssignable(s,n)}else super.toAssignable(r,n)}toAssignableObjectExpressionProp(r,n,i){r.type==="Property"&&(r.kind==="get"||r.kind==="set")?this.raise(P.PatternHasAccessor,r.key):r.type==="Property"&&r.method?this.raise(P.PatternHasMethod,r.key):super.toAssignableObjectExpressionProp(r,n,i)}finishCallExpression(r,n){let i=super.finishCallExpression(r,n);if(i.callee.type==="Import"){var s,o;this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=(s=i.arguments[1])!=null?s:null,i.attributes=(o=i.arguments[1])!=null?o:null,delete i.arguments,delete i.callee}else i.type==="OptionalCallExpression"?this.castNodeTo(i,"CallExpression"):i.optional=!1;return i}toReferencedArguments(r){r.type!=="ImportExpression"&&super.toReferencedArguments(r)}parseExport(r,n){let i=this.state.lastTokStartLoc,s=super.parseExport(r,n);switch(s.type){case"ExportAllDeclaration":s.exported=null;break;case"ExportNamedDeclaration":s.specifiers.length===1&&s.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(s,"ExportAllDeclaration"),s.exported=s.specifiers[0].exported,delete s.specifiers);case"ExportDefaultDeclaration":{var o;let{declaration:a}=s;a?.type==="ClassDeclaration"&&((o=a.decorators)==null?void 0:o.length)>0&&a.start===s.start&&this.resetStartLocation(s,i)}break}return s}stopParseSubscript(r,n){let i=super.stopParseSubscript(r,n);return n.optionalChainMember?this.estreeParseChainExpression(i,r.loc.end):i}parseMember(r,n,i,s,o){let a=super.parseMember(r,n,i,s,o);return a.type==="OptionalMemberExpression"?this.castNodeTo(a,"MemberExpression"):a.optional=!1,a}isOptionalMemberExpression(r){return r.type==="ChainExpression"?r.expression.type==="MemberExpression":super.isOptionalMemberExpression(r)}hasPropertyAsPrivateName(r){return r.type==="ChainExpression"&&(r=r.expression),super.hasPropertyAsPrivateName(r)}isObjectProperty(r){return r.type==="Property"&&r.kind==="init"&&!r.method}isObjectMethod(r){return r.type==="Property"&&(r.method||r.kind==="get"||r.kind==="set")}castNodeTo(r,n){let i=super.castNodeTo(r,n);return this.fillOptionalPropertiesForTSESLint(i),i}cloneIdentifier(r){let n=super.cloneIdentifier(r);return this.fillOptionalPropertiesForTSESLint(n),n}cloneStringLiteral(r){return r.type==="Literal"?this.cloneEstreeStringLiteral(r):super.cloneStringLiteral(r)}finishNodeAt(r,n,i){return mb(super.finishNodeAt(r,n,i))}finishNode(r,n){let i=super.finishNode(r,n);return this.fillOptionalPropertiesForTSESLint(i),i}resetStartLocation(r,n){super.resetStartLocation(r,n),mb(r)}resetEndLocation(r,n=this.state.lastTokEndLoc){super.resetEndLocation(r,n),mb(r)}},Ku=class{constructor(e,r){this.token=void 0,this.preserveSpace=void 0,this.token=e,this.preserveSpace=!!r}},_t={brace:new Ku("{"),j_oTag:new Ku("...",!0)};_t.template=new Ku("`",!0);var Ke=!0,ae=!0,V2=!0,gb=!0,ol=!0,Qje=!0,jk=class{constructor(e,r={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=e,this.keyword=r.keyword,this.beforeExpr=!!r.beforeExpr,this.startsExpr=!!r.startsExpr,this.rightAssociative=!!r.rightAssociative,this.isLoop=!!r.isLoop,this.isAssign=!!r.isAssign,this.prefix=!!r.prefix,this.postfix=!!r.postfix,this.binop=r.binop!=null?r.binop:null,this.updateContext=null}},yL=new Map;function lt(t,e={}){e.keyword=t;let r=$e(t,e);return yL.set(t,r),r}function Vn(t,e){return $e(t,{beforeExpr:Ke,binop:e})}var _b=-1,Ma=[],bL=[],vL=[],_L=[],SL=[],wL=[];function $e(t,e={}){var r,n,i,s;return++_b,bL.push(t),vL.push((r=e.binop)!=null?r:-1),_L.push((n=e.beforeExpr)!=null?n:!1),SL.push((i=e.startsExpr)!=null?i:!1),wL.push((s=e.prefix)!=null?s:!1),Ma.push(new jk(t,e)),_b}function Xe(t,e={}){var r,n,i,s;return++_b,yL.set(t,_b),bL.push(t),vL.push((r=e.binop)!=null?r:-1),_L.push((n=e.beforeExpr)!=null?n:!1),SL.push((i=e.startsExpr)!=null?i:!1),wL.push((s=e.prefix)!=null?s:!1),Ma.push(new jk("name",e)),_b}var e2e={bracketL:$e("[",{beforeExpr:Ke,startsExpr:ae}),bracketHashL:$e("#[",{beforeExpr:Ke,startsExpr:ae}),bracketBarL:$e("[|",{beforeExpr:Ke,startsExpr:ae}),bracketR:$e("]"),bracketBarR:$e("|]"),braceL:$e("{",{beforeExpr:Ke,startsExpr:ae}),braceBarL:$e("{|",{beforeExpr:Ke,startsExpr:ae}),braceHashL:$e("#{",{beforeExpr:Ke,startsExpr:ae}),braceR:$e("}"),braceBarR:$e("|}"),parenL:$e("(",{beforeExpr:Ke,startsExpr:ae}),parenR:$e(")"),comma:$e(",",{beforeExpr:Ke}),semi:$e(";",{beforeExpr:Ke}),colon:$e(":",{beforeExpr:Ke}),doubleColon:$e("::",{beforeExpr:Ke}),dot:$e("."),question:$e("?",{beforeExpr:Ke}),questionDot:$e("?."),arrow:$e("=>",{beforeExpr:Ke}),template:$e("template"),ellipsis:$e("...",{beforeExpr:Ke}),backQuote:$e("`",{startsExpr:ae}),dollarBraceL:$e("${",{beforeExpr:Ke,startsExpr:ae}),templateTail:$e("...`",{startsExpr:ae}),templateNonTail:$e("...${",{beforeExpr:Ke,startsExpr:ae}),at:$e("@"),hash:$e("#",{startsExpr:ae}),interpreterDirective:$e("#!..."),eq:$e("=",{beforeExpr:Ke,isAssign:gb}),assign:$e("_=",{beforeExpr:Ke,isAssign:gb}),slashAssign:$e("_=",{beforeExpr:Ke,isAssign:gb}),xorAssign:$e("_=",{beforeExpr:Ke,isAssign:gb}),moduloAssign:$e("_=",{beforeExpr:Ke,isAssign:gb}),incDec:$e("++/--",{prefix:ol,postfix:Qje,startsExpr:ae}),bang:$e("!",{beforeExpr:Ke,prefix:ol,startsExpr:ae}),tilde:$e("~",{beforeExpr:Ke,prefix:ol,startsExpr:ae}),doubleCaret:$e("^^",{startsExpr:ae}),doubleAt:$e("@@",{startsExpr:ae}),pipeline:Vn("|>",0),nullishCoalescing:Vn("??",1),logicalOR:Vn("||",1),logicalAND:Vn("&&",2),bitwiseOR:Vn("|",3),bitwiseXOR:Vn("^",4),bitwiseAND:Vn("&",5),equality:Vn("==/!=/===/!==",6),lt:Vn("/<=/>=",7),gt:Vn("/<=/>=",7),relational:Vn("/<=/>=",7),bitShift:Vn("<>/>>>",8),bitShiftL:Vn("<>/>>>",8),bitShiftR:Vn("<>/>>>",8),plusMin:$e("+/-",{beforeExpr:Ke,binop:9,prefix:ol,startsExpr:ae}),modulo:$e("%",{binop:10,startsExpr:ae}),star:$e("*",{binop:10}),slash:Vn("/",10),exponent:$e("**",{beforeExpr:Ke,binop:11,rightAssociative:!0}),_in:lt("in",{beforeExpr:Ke,binop:7}),_instanceof:lt("instanceof",{beforeExpr:Ke,binop:7}),_break:lt("break"),_case:lt("case",{beforeExpr:Ke}),_catch:lt("catch"),_continue:lt("continue"),_debugger:lt("debugger"),_default:lt("default",{beforeExpr:Ke}),_else:lt("else",{beforeExpr:Ke}),_finally:lt("finally"),_function:lt("function",{startsExpr:ae}),_if:lt("if"),_return:lt("return",{beforeExpr:Ke}),_switch:lt("switch"),_throw:lt("throw",{beforeExpr:Ke,prefix:ol,startsExpr:ae}),_try:lt("try"),_var:lt("var"),_const:lt("const"),_with:lt("with"),_new:lt("new",{beforeExpr:Ke,startsExpr:ae}),_this:lt("this",{startsExpr:ae}),_super:lt("super",{startsExpr:ae}),_class:lt("class",{startsExpr:ae}),_extends:lt("extends",{beforeExpr:Ke}),_export:lt("export"),_import:lt("import",{startsExpr:ae}),_null:lt("null",{startsExpr:ae}),_true:lt("true",{startsExpr:ae}),_false:lt("false",{startsExpr:ae}),_typeof:lt("typeof",{beforeExpr:Ke,prefix:ol,startsExpr:ae}),_void:lt("void",{beforeExpr:Ke,prefix:ol,startsExpr:ae}),_delete:lt("delete",{beforeExpr:Ke,prefix:ol,startsExpr:ae}),_do:lt("do",{isLoop:V2,beforeExpr:Ke}),_for:lt("for",{isLoop:V2}),_while:lt("while",{isLoop:V2}),_as:Xe("as",{startsExpr:ae}),_assert:Xe("assert",{startsExpr:ae}),_async:Xe("async",{startsExpr:ae}),_await:Xe("await",{startsExpr:ae}),_defer:Xe("defer",{startsExpr:ae}),_from:Xe("from",{startsExpr:ae}),_get:Xe("get",{startsExpr:ae}),_let:Xe("let",{startsExpr:ae}),_meta:Xe("meta",{startsExpr:ae}),_of:Xe("of",{startsExpr:ae}),_sent:Xe("sent",{startsExpr:ae}),_set:Xe("set",{startsExpr:ae}),_source:Xe("source",{startsExpr:ae}),_static:Xe("static",{startsExpr:ae}),_using:Xe("using",{startsExpr:ae}),_yield:Xe("yield",{startsExpr:ae}),_asserts:Xe("asserts",{startsExpr:ae}),_checks:Xe("checks",{startsExpr:ae}),_exports:Xe("exports",{startsExpr:ae}),_global:Xe("global",{startsExpr:ae}),_implements:Xe("implements",{startsExpr:ae}),_intrinsic:Xe("intrinsic",{startsExpr:ae}),_infer:Xe("infer",{startsExpr:ae}),_is:Xe("is",{startsExpr:ae}),_mixins:Xe("mixins",{startsExpr:ae}),_proto:Xe("proto",{startsExpr:ae}),_require:Xe("require",{startsExpr:ae}),_satisfies:Xe("satisfies",{startsExpr:ae}),_keyof:Xe("keyof",{startsExpr:ae}),_readonly:Xe("readonly",{startsExpr:ae}),_unique:Xe("unique",{startsExpr:ae}),_abstract:Xe("abstract",{startsExpr:ae}),_declare:Xe("declare",{startsExpr:ae}),_enum:Xe("enum",{startsExpr:ae}),_module:Xe("module",{startsExpr:ae}),_namespace:Xe("namespace",{startsExpr:ae}),_interface:Xe("interface",{startsExpr:ae}),_type:Xe("type",{startsExpr:ae}),_opaque:Xe("opaque",{startsExpr:ae}),name:$e("name",{startsExpr:ae}),placeholder:$e("%%",{startsExpr:ae}),string:$e("string",{startsExpr:ae}),num:$e("num",{startsExpr:ae}),bigint:$e("bigint",{startsExpr:ae}),decimal:$e("decimal",{startsExpr:ae}),regexp:$e("regexp",{startsExpr:ae}),privateName:$e("#name",{startsExpr:ae}),eof:$e("eof"),jsxName:$e("jsxName"),jsxText:$e("jsxText",{beforeExpr:Ke}),jsxTagStart:$e("jsxTagStart",{startsExpr:ae}),jsxTagEnd:$e("jsxTagEnd")};function $t(t){return t>=93&&t<=133}function t2e(t){return t<=92}function Zs(t){return t>=58&&t<=133}function mQ(t){return t>=58&&t<=137}function r2e(t){return _L[t]}function bb(t){return SL[t]}function n2e(t){return t>=29&&t<=33}function iQ(t){return t>=129&&t<=131}function i2e(t){return t>=90&&t<=92}function xL(t){return t>=58&&t<=92}function s2e(t){return t>=39&&t<=59}function o2e(t){return t===34}function a2e(t){return wL[t]}function c2e(t){return t>=121&&t<=123}function l2e(t){return t>=124&&t<=130}function cl(t){return bL[t]}function Nk(t){return vL[t]}function u2e(t){return t===57}function Lk(t){return t>=24&&t<=25}function La(t){return Ma[t]}Ma[8].updateContext=t=>{t.pop()};Ma[5].updateContext=Ma[7].updateContext=Ma[23].updateContext=t=>{t.push(_t.brace)};Ma[22].updateContext=t=>{t[t.length-1]===_t.template?t.pop():t.push(_t.template)};Ma[143].updateContext=t=>{t.push(_t.j_expr,_t.j_oTag)};var kL="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",gQ="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",d2e=new RegExp("["+kL+"]"),p2e=new RegExp("["+kL+gQ+"]");kL=gQ=null;var yQ=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],f2e=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function K2(t,e){let r=65536;for(let n=0,i=e.length;nt)return!1;if(r+=e[n+1],r>=t)return!0}return!1}function Fo(t){return t<65?t===36:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&d2e.test(String.fromCharCode(t)):K2(t,yQ)}function Yu(t){return t<48?t===36:t<58?!0:t<65?!1:t<=90?!0:t<97?t===95:t<=122?!0:t<=65535?t>=170&&p2e.test(String.fromCharCode(t)):K2(t,yQ)||K2(t,f2e)}var EL={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},h2e=new Set(EL.keyword),m2e=new Set(EL.strict),g2e=new Set(EL.strictBind);function bQ(t,e){return e&&t==="await"||t==="enum"}function vQ(t,e){return bQ(t,e)||m2e.has(t)}function _Q(t){return g2e.has(t)}function SQ(t,e){return vQ(t,e)||_Q(t)}function y2e(t){return h2e.has(t)}function b2e(t,e,r){return t===64&&e===64&&Fo(r)}var v2e=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function _2e(t){return v2e.has(t)}var Sb=class{constructor(e){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=e}},wb=class{constructor(e,r){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=e,this.inModule=r}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){let e=this.currentThisScopeFlags();return(e&64)>0&&(e&2)===0}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&128)return!0;if(r&1731)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new Sb(e)}enter(e){this.scopeStack.push(this.createScope(e))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(e){return!!(e.flags&130||!this.parser.inModule&&e.flags&1)}declareName(e,r,n){let i=this.currentScope();if(r&8||r&16){this.checkRedeclarationInScope(i,e,r,n);let s=i.names.get(e)||0;r&16?s=s|4:(i.firstLexicalName||(i.firstLexicalName=e),s=s|2),i.names.set(e,s),r&8&&this.maybeExportDefined(i,e)}else if(r&4)for(let s=this.scopeStack.length-1;s>=0&&(i=this.scopeStack[s],this.checkRedeclarationInScope(i,e,r,n),i.names.set(e,(i.names.get(e)||0)|1),this.maybeExportDefined(i,e),!(i.flags&1667));--s);this.parser.inModule&&i.flags&1&&this.undefinedExports.delete(e)}maybeExportDefined(e,r){this.parser.inModule&&e.flags&1&&this.undefinedExports.delete(r)}checkRedeclarationInScope(e,r,n,i){this.isRedeclaredInScope(e,r,n)&&this.parser.raise(P.VarRedeclaration,i,{identifierName:r})}isRedeclaredInScope(e,r,n){if(!(n&1))return!1;if(n&8)return e.names.has(r);let i=e.names.get(r)||0;return n&16?(i&2)>0||!this.treatFunctionsAsVarInScope(e)&&(i&1)>0:(i&2)>0&&!(e.flags&8&&e.firstLexicalName===r)||!this.treatFunctionsAsVarInScope(e)&&(i&4)>0}checkLocalExport(e){let{name:r}=e;this.scopeStack[0].names.has(r)||this.undefinedExports.set(r,e.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&1667)return r}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:r}=this.scopeStack[e];if(r&1731&&!(r&4))return r}}},Y2=class extends Sb{constructor(...e){super(...e),this.declareFunctions=new Set}},X2=class extends wb{createScope(e){return new Y2(e)}declareName(e,r,n){let i=this.currentScope();if(r&2048){this.checkRedeclarationInScope(i,e,r,n),this.maybeExportDefined(i,e),i.declareFunctions.add(e);return}super.declareName(e,r,n)}isRedeclaredInScope(e,r,n){if(super.isRedeclaredInScope(e,r,n))return!0;if(n&2048&&!e.declareFunctions.has(r)){let i=e.names.get(r);return(i&4)>0||(i&2)>0}return!1}checkLocalExport(e){this.scopeStack[0].declareFunctions.has(e.name)||super.checkLocalExport(e)}},S2e=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),Ce=Mo`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:t})=>`Cannot overwrite reserved type ${t}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:t,enumName:e})=>`Boolean enum members need to be initialized. Use either \`${t} = true,\` or \`${t} = false,\` in enum \`${e}\`.`,EnumDuplicateMemberName:({memberName:t,enumName:e})=>`Enum member names need to be unique, but the name \`${t}\` has already been used before in enum \`${e}\`.`,EnumInconsistentMemberValues:({enumName:t})=>`Enum \`${t}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:t,enumName:e})=>`Enum type \`${t}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:t})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:t,memberName:e,explicitType:r})=>`Enum \`${t}\` has type \`${r}\`, so the initializer of \`${e}\` needs to be a ${r} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:t,memberName:e})=>`Symbol enum members cannot be initialized. Use \`${e},\` in enum \`${t}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:t,memberName:e})=>`The enum member initializer for \`${e}\` needs to be a literal (either a boolean, number, or string) in enum \`${t}\`.`,EnumInvalidMemberName:({enumName:t,memberName:e,suggestion:r})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${e}\`, consider using \`${r}\`, in enum \`${t}\`.`,EnumNumberMemberNotInitialized:({enumName:t,memberName:e})=>`Number enum members need to be initialized, e.g. \`${e} = 1\` in enum \`${t}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:t})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${t}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:t})=>`Unexpected reserved type ${t}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of ` async () => {}`, use `async () => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:t,suggestion:e})=>`\`declare export ${t}\` is not supported. Use \`${e}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function w2e(t){return t.type==="DeclareExportAllDeclaration"||t.type==="DeclareExportDeclaration"&&(!t.declaration||t.declaration.type!=="TypeAlias"&&t.declaration.type!=="InterfaceDeclaration")}function sQ(t){return t.importKind==="type"||t.importKind==="typeof"}var x2e={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function k2e(t,e){let r=[],n=[];for(let i=0;iclass extends t{constructor(...r){super(...r),this.flowPragma=void 0}getScopeHandler(){return X2}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(r,n){r!==134&&r!==13&&r!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(r,n)}addComment(r){if(this.flowPragma===void 0){let n=E2e.exec(r.value);if(n)if(n[1]==="flow")this.flowPragma="flow";else if(n[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(r)}flowParseTypeInitialiser(r){let n=this.state.inType;this.state.inType=!0,this.expect(r||14);let i=this.flowParseType();return this.state.inType=n,i}flowParsePredicate(){let r=this.startNode(),n=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>n.index+1&&this.raise(Ce.UnexpectedSpaceBetweenModuloChecks,n),this.eat(10)?(r.value=super.parseExpression(),this.expect(11),this.finishNode(r,"DeclaredPredicate")):this.finishNode(r,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){let r=this.state.inType;this.state.inType=!0,this.expect(14);let n=null,i=null;return this.match(54)?(this.state.inType=r,i=this.flowParsePredicate()):(n=this.flowParseType(),this.state.inType=r,this.match(54)&&(i=this.flowParsePredicate())),[n,i]}flowParseDeclareClass(r){return this.next(),this.flowParseInterfaceish(r,!0),this.finishNode(r,"DeclareClass")}flowParseDeclareFunction(r){this.next();let n=r.id=this.parseIdentifier(),i=this.startNode(),s=this.startNode();this.match(47)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(10);let o=this.flowParseFunctionTypeParams();return i.params=o.params,i.rest=o.rest,i.this=o._this,this.expect(11),[i.returnType,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),s.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),n.typeAnnotation=this.finishNode(s,"TypeAnnotation"),this.resetEndLocation(n),this.semicolon(),this.scope.declareName(r.id.name,2048,r.id.loc.start),this.finishNode(r,"DeclareFunction")}flowParseDeclare(r,n){if(this.match(80))return this.flowParseDeclareClass(r);if(this.match(68))return this.flowParseDeclareFunction(r);if(this.match(74))return this.flowParseDeclareVariable(r);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(r):(n&&this.raise(Ce.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(r));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(r);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(r);if(this.isContextual(129))return this.flowParseDeclareInterface(r);if(this.match(82))return this.flowParseDeclareExportDeclaration(r,n);throw this.unexpected()}flowParseDeclareVariable(r){return this.next(),r.id=this.flowParseTypeAnnotatableIdentifier(),this.scope.declareName(r.id.name,5,r.id.loc.start),this.semicolon(),this.finishNode(r,"DeclareVariable")}flowParseDeclareModule(r){this.scope.enter(0),this.match(134)?r.id=super.parseExprAtom():r.id=this.parseIdentifier();let n=r.body=this.startNode(),i=n.body=[];for(this.expect(5);!this.match(8);){let a=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(Ce.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),i.push(super.parseImport(a))):(this.expectContextual(125,Ce.UnsupportedStatementInDeclareModule),i.push(this.flowParseDeclare(a,!0)))}this.scope.exit(),this.expect(8),this.finishNode(n,"BlockStatement");let s=null,o=!1;return i.forEach(a=>{w2e(a)?(s==="CommonJS"&&this.raise(Ce.AmbiguousDeclareModuleKind,a),s="ES"):a.type==="DeclareModuleExports"&&(o&&this.raise(Ce.DuplicateDeclareModuleExports,a),s==="ES"&&this.raise(Ce.AmbiguousDeclareModuleKind,a),s="CommonJS",o=!0)}),r.kind=s||"CommonJS",this.finishNode(r,"DeclareModule")}flowParseDeclareExportDeclaration(r,n){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?r.declaration=this.flowParseDeclare(this.startNode()):(r.declaration=this.flowParseType(),this.semicolon()),r.default=!0,this.finishNode(r,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!n){let i=this.state.value;throw this.raise(Ce.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:x2e[i]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return r.declaration=this.flowParseDeclare(this.startNode()),r.default=!1,this.finishNode(r,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return r=this.parseExport(r,null),r.type==="ExportNamedDeclaration"?(r.default=!1,delete r.exportKind,this.castNodeTo(r,"DeclareExportDeclaration")):this.castNodeTo(r,"DeclareExportAllDeclaration");throw this.unexpected()}flowParseDeclareModuleExports(r){return this.next(),this.expectContextual(111),r.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(r,"DeclareModuleExports")}flowParseDeclareTypeAlias(r){this.next();let n=this.flowParseTypeAlias(r);return this.castNodeTo(n,"DeclareTypeAlias"),n}flowParseDeclareOpaqueType(r){this.next();let n=this.flowParseOpaqueType(r,!0);return this.castNodeTo(n,"DeclareOpaqueType"),n}flowParseDeclareInterface(r){return this.next(),this.flowParseInterfaceish(r,!1),this.finishNode(r,"DeclareInterface")}flowParseInterfaceish(r,n){if(r.id=this.flowParseRestrictedIdentifier(!n,!0),this.scope.declareName(r.id.name,n?17:8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.extends=[],this.eat(81))do r.extends.push(this.flowParseInterfaceExtends());while(!n&&this.eat(12));if(n){if(r.implements=[],r.mixins=[],this.eatContextual(117))do r.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do r.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}r.body=this.flowParseObjectType({allowStatic:n,allowExact:!1,allowSpread:!1,allowProto:n,allowInexact:!1})}flowParseInterfaceExtends(){let r=this.startNode();return r.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?r.typeParameters=this.flowParseTypeParameterInstantiation():r.typeParameters=null,this.finishNode(r,"InterfaceExtends")}flowParseInterface(r){return this.flowParseInterfaceish(r,!1),this.finishNode(r,"InterfaceDeclaration")}checkNotUnderscore(r){r==="_"&&this.raise(Ce.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(r,n,i){S2e.has(r)&&this.raise(i?Ce.AssignReservedType:Ce.UnexpectedReservedType,n,{reservedType:r})}flowParseRestrictedIdentifierName(r,n){return this.checkReservedType(this.state.value,this.state.startLoc,n),this.parseIdentifierName(r)}flowParseRestrictedIdentifier(r,n){let i=this.startNode(),s=this.flowParseRestrictedIdentifierName(r,n);return this.createIdentifier(i,s)}flowParseTypeAlias(r){return r.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(r.id.name,8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(r,"TypeAlias")}flowParseOpaqueType(r,n){return this.expectContextual(130),r.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(r.id.name,8201,r.id.loc.start),this.match(47)?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,r.supertype=null,this.match(14)&&(r.supertype=this.flowParseTypeInitialiser(14)),r.impltype=null,n||(r.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(r,"OpaqueType")}flowParseTypeParameterBound(){if(this.match(14)||this.isContextual(81)){let r=this.startNode();return this.next(),r.typeAnnotation=this.flowParseType(),this.finishNode(r,"TypeAnnotation")}}flowParseTypeParameter(r=!1){let n=this.state.startLoc,i=this.startNode(),s=this.flowParseVariance();return i.name=this.flowParseRestrictedIdentifierName(),i.variance=s,i.bound=this.flowParseTypeParameterBound(),this.match(29)?(this.eat(29),i.default=this.flowParseType()):r&&this.raise(Ce.MissingTypeParamDefault,n),this.finishNode(i,"TypeParameter")}flowParseTypeParameterDeclaration(){let r=this.state.inType,n=this.startNode();n.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let i=!1;do{let s=this.flowParseTypeParameter(i);n.params.push(s),s.default&&(i=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=r,this.finishNode(n,"TypeParameterDeclaration")}flowInTopLevelContext(r){if(this.curContext()!==_t.brace){let n=this.state.context;this.state.context=[n[0]];try{return r()}finally{this.state.context=n}}else return r()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){let r=this.startNode(),n=this.state.inType;return this.state.inType=!0,r.params=[],this.flowInTopLevelContext(()=>{this.expect(47);let i=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)r.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=i}),this.state.inType=n,!this.state.inType&&this.curContext()===_t.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(r,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return null;let r=this.startNode(),n=this.state.inType;for(r.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)r.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=n,this.finishNode(r,"TypeParameterInstantiation")}flowParseInterfaceType(){let r=this.startNode();if(this.expectContextual(129),r.extends=[],this.eat(81))do r.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return r.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(r,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(r,n,i){return r.static=n,this.lookahead().type===14?(r.id=this.flowParseObjectPropertyKey(),r.key=this.flowParseTypeInitialiser()):(r.id=null,r.key=this.flowParseType()),this.expect(3),r.value=this.flowParseTypeInitialiser(),r.variance=i,this.finishNode(r,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(r,n){return r.static=n,r.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(r.method=!0,r.optional=!1,r.value=this.flowParseObjectTypeMethodish(this.startNodeAt(r.loc.start))):(r.method=!1,this.eat(17)&&(r.optional=!0),r.value=this.flowParseTypeInitialiser()),this.finishNode(r,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(r){for(r.params=[],r.rest=null,r.typeParameters=null,r.this=null,this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(r.this=this.flowParseFunctionTypeParam(!0),r.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)r.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(r.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),r.returnType=this.flowParseTypeInitialiser(),this.finishNode(r,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(r,n){let i=this.startNode();return r.static=n,r.value=this.flowParseObjectTypeMethodish(i),this.finishNode(r,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:r,allowExact:n,allowSpread:i,allowProto:s,allowInexact:o}){let a=this.state.inType;this.state.inType=!0;let c=this.startNode();c.callProperties=[],c.properties=[],c.indexers=[],c.internalSlots=[];let l,u,d=!1;for(n&&this.match(6)?(this.expect(6),l=9,u=!0):(this.expect(5),l=8,u=!1),c.exact=u;!this.match(l);){let f=!1,h=null,m=null,y=this.startNode();if(s&&this.isContextual(118)){let g=this.lookahead();g.type!==14&&g.type!==17&&(this.next(),h=this.state.startLoc,r=!1)}if(r&&this.isContextual(106)){let g=this.lookahead();g.type!==14&&g.type!==17&&(this.next(),f=!0)}let v=this.flowParseVariance();if(this.eat(0))h!=null&&this.unexpected(h),this.eat(0)?(v&&this.unexpected(v.loc.start),c.internalSlots.push(this.flowParseObjectTypeInternalSlot(y,f))):c.indexers.push(this.flowParseObjectTypeIndexer(y,f,v));else if(this.match(10)||this.match(47))h!=null&&this.unexpected(h),v&&this.unexpected(v.loc.start),c.callProperties.push(this.flowParseObjectTypeCallProperty(y,f));else{let g="init";if(this.isContextual(99)||this.isContextual(104)){let w=this.lookahead();mQ(w.type)&&(g=this.state.value,this.next())}let b=this.flowParseObjectTypeProperty(y,f,h,v,g,i,o??!u);b===null?(d=!0,m=this.state.lastTokStartLoc):c.properties.push(b)}this.flowObjectTypeSemicolon(),m&&!this.match(8)&&!this.match(9)&&this.raise(Ce.UnexpectedExplicitInexactInObject,m)}this.expect(l),i&&(c.inexact=d);let p=this.finishNode(c,"ObjectTypeAnnotation");return this.state.inType=a,p}flowParseObjectTypeProperty(r,n,i,s,o,a,c){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(a?c||this.raise(Ce.InexactInsideExact,this.state.lastTokStartLoc):this.raise(Ce.InexactInsideNonObject,this.state.lastTokStartLoc),s&&this.raise(Ce.InexactVariance,s),null):(a||this.raise(Ce.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),s&&this.raise(Ce.SpreadVariance,s),r.argument=this.flowParseType(),this.finishNode(r,"ObjectTypeSpreadProperty"));{r.key=this.flowParseObjectPropertyKey(),r.static=n,r.proto=i!=null,r.kind=o;let l=!1;return this.match(47)||this.match(10)?(r.method=!0,i!=null&&this.unexpected(i),s&&this.unexpected(s.loc.start),r.value=this.flowParseObjectTypeMethodish(this.startNodeAt(r.loc.start)),(o==="get"||o==="set")&&this.flowCheckGetterSetterParams(r),!a&&r.key.name==="constructor"&&r.value.this&&this.raise(Ce.ThisParamBannedInConstructor,r.value.this)):(o!=="init"&&this.unexpected(),r.method=!1,this.eat(17)&&(l=!0),r.value=this.flowParseTypeInitialiser(),r.variance=s),r.optional=l,this.finishNode(r,"ObjectTypeProperty")}}flowCheckGetterSetterParams(r){let n=r.kind==="get"?0:1,i=r.value.params.length+(r.value.rest?1:0);r.value.this&&this.raise(r.kind==="get"?Ce.GetterMayNotHaveThisParam:Ce.SetterMayNotHaveThisParam,r.value.this),i!==n&&this.raise(r.kind==="get"?P.BadGetterArity:P.BadSetterArity,r),r.kind==="set"&&r.value.rest&&this.raise(P.BadSetterRestParameter,r)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(r,n){r??(r=this.state.startLoc);let i=n||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){let s=this.startNodeAt(r);s.qualification=i,s.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(s,"QualifiedTypeIdentifier")}return i}flowParseGenericType(r,n){let i=this.startNodeAt(r);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(r,n),this.match(47)&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){let r=this.startNode();return this.expect(87),r.argument=this.flowParsePrimaryType(),this.finishNode(r,"TypeofTypeAnnotation")}flowParseTupleType(){let r=this.startNode();for(r.types=[],this.expect(0);this.state.possuper.parseFunctionBody(r,!0,i));return}super.parseFunctionBody(r,!1,i)}parseFunctionBodyAndFinish(r,n,i=!1){if(this.match(14)){let s=this.startNode();[s.typeAnnotation,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),r.returnType=s.typeAnnotation?this.finishNode(s,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(r,n,i)}parseStatementLike(r){if(this.state.strict&&this.isContextual(129)){let i=this.lookahead();if(Zs(i.type)){let s=this.startNode();return this.next(),this.flowParseInterface(s)}}else if(this.isContextual(126)){let i=this.startNode();return this.next(),this.flowParseEnumDeclaration(i)}let n=super.parseStatementLike(r);return this.flowPragma===void 0&&!this.isValidDirective(n)&&(this.flowPragma=null),n}parseExpressionStatement(r,n,i){if(n.type==="Identifier"){if(n.name==="declare"){if(this.match(80)||$t(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(r)}else if($t(this.state.type)){if(n.name==="interface")return this.flowParseInterface(r);if(n.name==="type")return this.flowParseTypeAlias(r);if(n.name==="opaque")return this.flowParseOpaqueType(r,!1)}}return super.parseExpressionStatement(r,n,i)}shouldParseExportDeclaration(){let{type:r}=this.state;return r===126||iQ(r)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:r}=this.state;return r===126||iQ(r)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){let r=this.startNode();return this.next(),this.flowParseEnumDeclaration(r)}return super.parseExportDefaultExpression()}parseConditional(r,n,i){if(!this.match(17))return r;if(this.state.maybeInArrowParameters){let p=this.lookaheadCharCode();if(p===44||p===61||p===58||p===41)return this.setOptionalParametersError(i),r}this.expect(17);let s=this.state.clone(),o=this.state.noArrowAt,a=this.startNodeAt(n),{consequent:c,failed:l}=this.tryParseConditionalConsequent(),[u,d]=this.getArrowLikeExpressions(c);if(l||d.length>0){let p=[...o];if(d.length>0){this.state=s,this.state.noArrowAt=p;for(let f=0;f1&&this.raise(Ce.AmbiguousConditionalArrow,s.startLoc),l&&u.length===1&&(this.state=s,p.push(u[0].start),this.state.noArrowAt=p,{consequent:c,failed:l}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(c,!0),this.state.noArrowAt=o,this.expect(14),a.test=r,a.consequent=c,a.alternate=this.forwardNoArrowParamsConversionAt(a,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(a,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let r=this.parseMaybeAssignAllowIn(),n=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:r,failed:n}}getArrowLikeExpressions(r,n){let i=[r],s=[];for(;i.length!==0;){let o=i.pop();o.type==="ArrowFunctionExpression"&&o.body.type!=="BlockStatement"?(o.typeParameters||!o.returnType?this.finishArrowValidation(o):s.push(o),i.push(o.body)):o.type==="ConditionalExpression"&&(i.push(o.consequent),i.push(o.alternate))}return n?(s.forEach(o=>this.finishArrowValidation(o)),[s,[]]):k2e(s,o=>o.params.every(a=>this.isAssignable(a,!0)))}finishArrowValidation(r){var n;this.toAssignableList(r.params,(n=r.extra)==null?void 0:n.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(r,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(r,n){let i;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),i=n(),this.state.noArrowParamsConversionAt.pop()):i=n(),i}parseParenItem(r,n){let i=super.parseParenItem(r,n);if(this.eat(17)&&(i.optional=!0,this.resetEndLocation(r)),this.match(14)){let s=this.startNodeAt(n);return s.expression=i,s.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(s,"TypeCastExpression")}return i}assertModuleNodeAllowed(r){r.type==="ImportDeclaration"&&(r.importKind==="type"||r.importKind==="typeof")||r.type==="ExportNamedDeclaration"&&r.exportKind==="type"||r.type==="ExportAllDeclaration"&&r.exportKind==="type"||super.assertModuleNodeAllowed(r)}parseExportDeclaration(r){if(this.isContextual(130)){r.exportKind="type";let n=this.startNode();return this.next(),this.match(5)?(r.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(r),null):this.flowParseTypeAlias(n)}else if(this.isContextual(131)){r.exportKind="type";let n=this.startNode();return this.next(),this.flowParseOpaqueType(n,!1)}else if(this.isContextual(129)){r.exportKind="type";let n=this.startNode();return this.next(),this.flowParseInterface(n)}else if(this.isContextual(126)){r.exportKind="value";let n=this.startNode();return this.next(),this.flowParseEnumDeclaration(n)}else return super.parseExportDeclaration(r)}eatExportStar(r){return super.eatExportStar(r)?!0:this.isContextual(130)&&this.lookahead().type===55?(r.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(r){let{startLoc:n}=this.state,i=super.maybeParseExportNamespaceSpecifier(r);return i&&r.exportKind==="type"&&this.unexpected(n),i}parseClassId(r,n,i){super.parseClassId(r,n,i),this.match(47)&&(r.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(r,n,i){let{startLoc:s}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(r,n))return;n.declare=!0}super.parseClassMember(r,n,i),n.declare&&(n.type!=="ClassProperty"&&n.type!=="ClassPrivateProperty"&&n.type!=="PropertyDefinition"?this.raise(Ce.DeclareClassElement,s):n.value&&this.raise(Ce.DeclareClassFieldInitializer,n.value))}isIterator(r){return r==="iterator"||r==="asyncIterator"}readIterator(){let r=super.readWord1(),n="@@"+r;(!this.isIterator(r)||!this.state.inType)&&this.raise(P.InvalidIdentifier,this.state.curPosition(),{identifierName:n}),this.finishToken(132,n)}getTokenFromCode(r){let n=this.input.charCodeAt(this.state.pos+1);r===123&&n===124?this.finishOp(6,2):this.state.inType&&(r===62||r===60)?this.finishOp(r===62?48:47,1):this.state.inType&&r===63?n===46?this.finishOp(18,2):this.finishOp(17,1):b2e(r,n,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(r)}isAssignable(r,n){return r.type==="TypeCastExpression"?this.isAssignable(r.expression,n):super.isAssignable(r,n)}toAssignable(r,n=!1){!n&&r.type==="AssignmentExpression"&&r.left.type==="TypeCastExpression"&&(r.left=this.typeCastToParameter(r.left)),super.toAssignable(r,n)}toAssignableList(r,n,i){for(let s=0;s1||!n)&&this.raise(Ce.TypeCastInPattern,o.typeAnnotation)}return r}parseArrayLike(r,n,i){let s=super.parseArrayLike(r,n,i);return i!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(s.elements),s}isValidLVal(r,n,i,s){return r==="TypeCastExpression"||super.isValidLVal(r,n,i,s)}parseClassProperty(r){return this.match(14)&&(r.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(r)}parseClassPrivateProperty(r){return this.match(14)&&(r.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(r)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(r){return!this.match(14)&&super.isNonstaticConstructor(r)}pushClassMethod(r,n,i,s,o,a){if(n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(r,n,i,s,o,a),n.params&&o){let c=n.params;c.length>0&&this.isThisParam(c[0])&&this.raise(Ce.ThisParamBannedInConstructor,n)}else if(n.type==="MethodDefinition"&&o&&n.value.params){let c=n.value.params;c.length>0&&this.isThisParam(c[0])&&this.raise(Ce.ThisParamBannedInConstructor,n)}}pushClassPrivateMethod(r,n,i,s){n.variance&&this.unexpected(n.variance.loc.start),delete n.variance,this.match(47)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(r,n,i,s)}parseClassSuper(r){if(super.parseClassSuper(r),r.superClass&&(this.match(47)||this.match(51))&&(r.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();let n=r.implements=[];do{let i=this.startNode();i.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?i.typeParameters=this.flowParseTypeParameterInstantiation():i.typeParameters=null,n.push(this.finishNode(i,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(r){super.checkGetterSetterParams(r);let n=this.getObjectOrClassMethodParams(r);if(n.length>0){let i=n[0];this.isThisParam(i)&&r.kind==="get"?this.raise(Ce.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(Ce.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(r){r.variance=this.flowParseVariance()}parseObjPropValue(r,n,i,s,o,a,c){r.variance&&this.unexpected(r.variance.loc.start),delete r.variance;let l;this.match(47)&&!a&&(l=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());let u=super.parseObjPropValue(r,n,i,s,o,a,c);return l&&((u.value||u).typeParameters=l),u}parseFunctionParamType(r){return this.eat(17)&&(r.type!=="Identifier"&&this.raise(Ce.PatternIsOptional,r),this.isThisParam(r)&&this.raise(Ce.ThisParamMayNotBeOptional,r),r.optional=!0),this.match(14)?r.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(r)&&this.raise(Ce.ThisParamAnnotationRequired,r),this.match(29)&&this.isThisParam(r)&&this.raise(Ce.ThisParamNoDefault,r),this.resetEndLocation(r),r}parseMaybeDefault(r,n){let i=super.parseMaybeDefault(r,n);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.startsuper.parseMaybeAssign(r,n),s),!o.error)return o.node;let{context:l}=this.state,u=l[l.length-1];(u===_t.j_oTag||u===_t.j_expr)&&l.pop()}if((i=o)!=null&&i.error||this.match(47)){var a,c;s=s||this.state.clone();let l,u=this.tryParse(p=>{var f;l=this.flowParseTypeParameterDeclaration();let h=this.forwardNoArrowParamsConversionAt(l,()=>{let y=super.parseMaybeAssign(r,n);return this.resetStartLocationFromNode(y,l),y});(f=h.extra)!=null&&f.parenthesized&&p();let m=this.maybeUnwrapTypeCastExpression(h);return m.type!=="ArrowFunctionExpression"&&p(),m.typeParameters=l,this.resetStartLocationFromNode(m,l),h},s),d=null;if(u.node&&this.maybeUnwrapTypeCastExpression(u.node).type==="ArrowFunctionExpression"){if(!u.error&&!u.aborted)return u.node.async&&this.raise(Ce.UnexpectedTypeParameterBeforeAsyncArrowFunction,l),u.node;d=u.node}if((a=o)!=null&&a.node)return this.state=o.failState,o.node;if(d)return this.state=u.failState,d;throw(c=o)!=null&&c.thrown?o.error:u.thrown?u.error:this.raise(Ce.UnexpectedTokenAfterTypeParameter,l)}return super.parseMaybeAssign(r,n)}parseArrow(r){if(this.match(14)){let n=this.tryParse(()=>{let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let s=this.startNode();return[s.typeAnnotation,r.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),s});if(n.thrown)return null;n.error&&(this.state=n.failState),r.returnType=n.node.typeAnnotation?this.finishNode(n.node,"TypeAnnotation"):null}return super.parseArrow(r)}shouldParseArrow(r){return this.match(14)||super.shouldParseArrow(r)}setArrowFunctionParameters(r,n){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start))?r.params=n:super.setArrowFunctionParameters(r,n)}checkParams(r,n,i,s=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(r.start)))){for(let o=0;o0&&this.raise(Ce.ThisParamMustBeFirst,r.params[o]);super.checkParams(r,n,i,s)}}parseParenAndDistinguishExpression(r){return super.parseParenAndDistinguishExpression(r&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(r,n,i){if(r.type==="Identifier"&&r.name==="async"&&this.state.noArrowAt.includes(n.index)){this.next();let s=this.startNodeAt(n);s.callee=r,s.arguments=super.parseCallExpressionArguments(),r=this.finishNode(s,"CallExpression")}else if(r.type==="Identifier"&&r.name==="async"&&this.match(47)){let s=this.state.clone(),o=this.tryParse(c=>this.parseAsyncArrowWithTypeParameters(n)||c(),s);if(!o.error&&!o.aborted)return o.node;let a=this.tryParse(()=>super.parseSubscripts(r,n,i),s);if(a.node&&!a.error)return a.node;if(o.node)return this.state=o.failState,o.node;if(a.node)return this.state=a.failState,a.node;throw o.error||a.error}return super.parseSubscripts(r,n,i)}parseSubscript(r,n,i,s){if(this.match(18)&&this.isLookaheadToken_lt()){if(s.optionalChainMember=!0,i)return s.stop=!0,r;this.next();let o=this.startNodeAt(n);return o.callee=r,o.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),o.arguments=this.parseCallExpressionArguments(),o.optional=!0,this.finishCallExpression(o,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){let o=this.startNodeAt(n);o.callee=r;let a=this.tryParse(()=>(o.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),o.arguments=super.parseCallExpressionArguments(),s.optionalChainMember&&(o.optional=!1),this.finishCallExpression(o,s.optionalChainMember)));if(a.node)return a.error&&(this.state=a.failState),a.node}return super.parseSubscript(r,n,i,s)}parseNewCallee(r){super.parseNewCallee(r);let n=null;this.shouldParseTypes()&&this.match(47)&&(n=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),r.typeArguments=n}parseAsyncArrowWithTypeParameters(r){let n=this.startNodeAt(r);if(this.parseFunctionParams(n,!1),!!this.parseArrow(n))return super.parseArrowExpression(n,void 0,!0)}readToken_mult_modulo(r){let n=this.input.charCodeAt(this.state.pos+1);if(r===42&&n===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(r)}readToken_pipe_amp(r){let n=this.input.charCodeAt(this.state.pos+1);if(r===124&&n===125){this.finishOp(9,2);return}super.readToken_pipe_amp(r)}parseTopLevel(r,n){let i=super.parseTopLevel(r,n);return this.state.hasFlowComment&&this.raise(Ce.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(Ce.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();let r=this.skipFlowComment();r&&(this.state.pos+=r,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:r}=this.state,n=2;for(;[32,9].includes(this.input.charCodeAt(r+n));)n++;let i=this.input.charCodeAt(n+r),s=this.input.charCodeAt(n+r+1);return i===58&&s===58?n+2:this.input.slice(n+r,n+r+12)==="flow-include"?n+12:i===58&&s!==58?n:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(P.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(r,{enumName:n,memberName:i}){this.raise(Ce.EnumBooleanMemberNotInitialized,r,{memberName:i,enumName:n})}flowEnumErrorInvalidMemberInitializer(r,n){return this.raise(n.explicitType?n.explicitType==="symbol"?Ce.EnumInvalidMemberInitializerSymbolType:Ce.EnumInvalidMemberInitializerPrimaryType:Ce.EnumInvalidMemberInitializerUnknownType,r,n)}flowEnumErrorNumberMemberNotInitialized(r,n){this.raise(Ce.EnumNumberMemberNotInitialized,r,n)}flowEnumErrorStringMemberInconsistentlyInitialized(r,n){this.raise(Ce.EnumStringMemberInconsistentlyInitialized,r,n)}flowEnumMemberInit(){let r=this.state.startLoc,n=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{let i=this.parseNumericLiteral(this.state.value);return n()?{type:"number",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}case 134:{let i=this.parseStringLiteral(this.state.value);return n()?{type:"string",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}case 85:case 86:{let i=this.parseBooleanLiteral(this.match(85));return n()?{type:"boolean",loc:i.loc.start,value:i}:{type:"invalid",loc:r}}default:return{type:"invalid",loc:r}}}flowEnumMemberRaw(){let r=this.state.startLoc,n=this.parseIdentifier(!0),i=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:r};return{id:n,init:i}}flowEnumCheckExplicitTypeMismatch(r,n,i){let{explicitType:s}=n;s!==null&&s!==i&&this.flowEnumErrorInvalidMemberInitializer(r,n)}flowEnumMembers({enumName:r,explicitType:n}){let i=new Set,s={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},o=!1;for(;!this.match(8);){if(this.eat(21)){o=!0;break}let a=this.startNode(),{id:c,init:l}=this.flowEnumMemberRaw(),u=c.name;if(u==="")continue;/^[a-z]/.test(u)&&this.raise(Ce.EnumInvalidMemberName,c,{memberName:u,suggestion:u[0].toUpperCase()+u.slice(1),enumName:r}),i.has(u)&&this.raise(Ce.EnumDuplicateMemberName,c,{memberName:u,enumName:r}),i.add(u);let d={enumName:r,explicitType:n,memberName:u};switch(a.id=c,l.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(l.loc,d,"boolean"),a.init=l.value,s.booleanMembers.push(this.finishNode(a,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(l.loc,d,"number"),a.init=l.value,s.numberMembers.push(this.finishNode(a,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(l.loc,d,"string"),a.init=l.value,s.stringMembers.push(this.finishNode(a,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(l.loc,d);case"none":switch(n){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(l.loc,d);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(l.loc,d);break;default:s.defaultedMembers.push(this.finishNode(a,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:s,hasUnknownMembers:o}}flowEnumStringMembers(r,n,{enumName:i}){if(r.length===0)return n;if(n.length===0)return r;if(n.length>r.length){for(let s of r)this.flowEnumErrorStringMemberInconsistentlyInitialized(s,{enumName:i});return n}else{for(let s of n)this.flowEnumErrorStringMemberInconsistentlyInitialized(s,{enumName:i});return r}}flowEnumParseExplicitType({enumName:r}){if(!this.eatContextual(102))return null;if(!$t(this.state.type))throw this.raise(Ce.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:r});let{value:n}=this.state;return this.next(),n!=="boolean"&&n!=="number"&&n!=="string"&&n!=="symbol"&&this.raise(Ce.EnumInvalidExplicitType,this.state.startLoc,{enumName:r,invalidEnumType:n}),n}flowEnumBody(r,n){let i=n.name,s=n.loc.start,o=this.flowEnumParseExplicitType({enumName:i});this.expect(5);let{members:a,hasUnknownMembers:c}=this.flowEnumMembers({enumName:i,explicitType:o});switch(r.hasUnknownMembers=c,o){case"boolean":return r.explicitType=!0,r.members=a.booleanMembers,this.expect(8),this.finishNode(r,"EnumBooleanBody");case"number":return r.explicitType=!0,r.members=a.numberMembers,this.expect(8),this.finishNode(r,"EnumNumberBody");case"string":return r.explicitType=!0,r.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(r,"EnumStringBody");case"symbol":return r.members=a.defaultedMembers,this.expect(8),this.finishNode(r,"EnumSymbolBody");default:{let l=()=>(r.members=[],this.expect(8),this.finishNode(r,"EnumStringBody"));r.explicitType=!1;let u=a.booleanMembers.length,d=a.numberMembers.length,p=a.stringMembers.length,f=a.defaultedMembers.length;if(!u&&!d&&!p&&!f)return l();if(!u&&!d)return r.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(r,"EnumStringBody");if(!d&&!p&&u>=f){for(let h of a.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(h.loc.start,{enumName:i,memberName:h.id.name});return r.members=a.booleanMembers,this.expect(8),this.finishNode(r,"EnumBooleanBody")}else if(!u&&!p&&d>=f){for(let h of a.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(h.loc.start,{enumName:i,memberName:h.id.name});return r.members=a.numberMembers,this.expect(8),this.finishNode(r,"EnumNumberBody")}else return this.raise(Ce.EnumInconsistentMemberValues,s,{enumName:i}),l()}}}flowParseEnumDeclaration(r){let n=this.parseIdentifier();return r.id=n,r.body=this.flowEnumBody(this.startNode(),n),this.finishNode(r,"EnumDeclaration")}jsxParseOpeningElementAfterName(r){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(r.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(r)}isLookaheadToken_lt(){let r=this.nextTokenStart();if(this.input.charCodeAt(r)===60){let n=this.input.charCodeAt(r+1);return n!==60&&n!==61}return!1}reScan_lt_gt(){let{type:r}=this.state;r===47?(this.state.pos-=1,this.readToken_lt()):r===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:r}=this.state;return r===51?(this.state.pos-=2,this.finishOp(47,1),47):r}maybeUnwrapTypeCastExpression(r){return r.type==="TypeCastExpression"?r.expression:r}},$2e={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},I2e=/\r\n|[\r\n\u2028\u2029]/,Ck=new RegExp(I2e.source,"g");function jf(t){switch(t){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function oQ(t,e,r){for(let n=e;n`Expected corresponding JSX closing tag for <${t}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:t,HTMLEntity:e})=>`Unexpected token \`${t}\`. Did you mean \`${e}\` or \`{'${t}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...?"});function al(t){return t?t.type==="JSXOpeningFragment"||t.type==="JSXClosingFragment":!1}function Df(t){if(t.type==="JSXIdentifier")return t.name;if(t.type==="JSXNamespacedName")return t.namespace.name+":"+t.name.name;if(t.type==="JSXMemberExpression")return Df(t.object)+"."+Df(t.property);throw new Error("Node had unexpected type: "+t.type)}var R2e=t=>class extends t{jsxReadToken(){let r="",n=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Ju.UnterminatedJsxContent,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);switch(i){case 60:case 123:if(this.state.pos===this.state.start){i===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(i);return}r+=this.input.slice(n,this.state.pos),this.finishToken(142,r);return;case 38:r+=this.input.slice(n,this.state.pos),r+=this.jsxReadEntity(),n=this.state.pos;break;default:jf(i)?(r+=this.input.slice(n,this.state.pos),r+=this.jsxReadNewLine(!0),n=this.state.pos):++this.state.pos}}}jsxReadNewLine(r){let n=this.input.charCodeAt(this.state.pos),i;return++this.state.pos,n===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,i=r?` +`:`\r +`):i=String.fromCharCode(n),++this.state.curLine,this.state.lineStart=this.state.pos,i}jsxReadString(r){let n="",i=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(P.UnterminatedString,this.state.startLoc);let s=this.input.charCodeAt(this.state.pos);if(s===r)break;s===38?(n+=this.input.slice(i,this.state.pos),n+=this.jsxReadEntity(),i=this.state.pos):jf(s)?(n+=this.input.slice(i,this.state.pos),n+=this.jsxReadNewLine(!1),i=this.state.pos):++this.state.pos}n+=this.input.slice(i,this.state.pos++),this.finishToken(134,n)}jsxReadEntity(){let r=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let n=10;this.codePointAtPos(this.state.pos)===120&&(n=16,++this.state.pos);let i=this.readInt(n,void 0,!1,"bail");if(i!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(i)}else{let n=0,i=!1;for(;n++<10&&this.state.pos1){for(let i=0;i0){if(n&256){let s=!!(n&512),o=(i&4)>0;return s!==o}return!0}return n&128&&(i&8)>0?e.names.get(r)&2?!!(n&1):!1:n&2&&(i&1)>0?!0:super.isRedeclaredInScope(e,r,n)}checkLocalExport(e){let{name:r}=e;if(this.hasImport(r))return;let n=this.scopeStack.length;for(let i=n-1;i>=0;i--){let o=this.scopeStack[i].tsNames.get(r);if((o&1)>0||(o&16)>0)return}super.checkLocalExport(e)}},tL=class{constructor(){this.stacks=[]}enter(e){this.stacks.push(e)}exit(){this.stacks.pop()}currentFlags(){return this.stacks[this.stacks.length-1]}get hasAwait(){return(this.currentFlags()&2)>0}get hasYield(){return(this.currentFlags()&1)>0}get hasReturn(){return(this.currentFlags()&4)>0}get hasIn(){return(this.currentFlags()&8)>0}};function Dk(t,e){return(t?2:0)|(e?1:0)}var rL=class{constructor(){this.sawUnambiguousESM=!1,this.ambiguousScriptDifferentAst=!1}sourceToOffsetPos(e){return e+this.startIndex}offsetToSourcePos(e){return e-this.startIndex}hasPlugin(e){if(typeof e=="string")return this.plugins.has(e);{let[r,n]=e;if(!this.hasPlugin(r))return!1;let i=this.plugins.get(r);for(let s of Object.keys(n))if(i?.[s]!==n[s])return!1;return!0}}getPluginOption(e,r){var n;return(n=this.plugins.get(e))==null?void 0:n[r]}};function wQ(t,e){t.trailingComments===void 0?t.trailingComments=e:t.trailingComments.unshift(...e)}function C2e(t,e){t.leadingComments===void 0?t.leadingComments=e:t.leadingComments.unshift(...e)}function xb(t,e){t.innerComments===void 0?t.innerComments=e:t.innerComments.unshift(...e)}function Ws(t,e,r){let n=null,i=e.length;for(;n===null&&i>0;)n=e[--i];n===null||n.start>r.start?xb(t,r.comments):wQ(n,r.comments)}var nL=class extends rL{addComment(e){this.filename&&(e.loc.filename=this.filename);let{commentsLen:r}=this.state;this.comments.length!==r&&(this.comments.length=r),this.comments.push(e),this.state.commentsLen++}processComment(e){let{commentStack:r}=this.state,n=r.length;if(n===0)return;let i=n-1,s=r[i];s.start===e.end&&(s.leadingNode=e,i--);let{start:o}=e;for(;i>=0;i--){let a=r[i],c=a.end;if(c>o)a.containingNode=e,this.finalizeComment(a),r.splice(i,1);else{c===o&&(a.trailingNode=e);break}}}finalizeComment(e){var r;let{comments:n}=e;if(e.leadingNode!==null||e.trailingNode!==null)e.leadingNode!==null&&wQ(e.leadingNode,n),e.trailingNode!==null&&C2e(e.trailingNode,n);else{let i=e.containingNode,s=e.start;if(this.input.charCodeAt(this.offsetToSourcePos(s)-1)===44)switch(i.type){case"ObjectExpression":case"ObjectPattern":Ws(i,i.properties,e);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":Ws(i,i.arguments,e);break;case"ImportExpression":Ws(i,[i.source,(r=i.options)!=null?r:null],e);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":case"TSTypeParameterDeclaration":Ws(i,i.params,e);break;case"ArrayExpression":case"ArrayPattern":Ws(i,i.elements,e);break;case"ExportNamedDeclaration":case"ImportDeclaration":Ws(i,i.specifiers,e);break;case"TSEnumDeclaration":Ws(i,i.members,e);break;case"TSEnumBody":Ws(i,i.members,e);break;case"TSInterfaceBody":Ws(i,i.body,e);break;default:{if(i.type==="RecordExpression"){Ws(i,i.properties,e);break}if(i.type==="TupleExpression"){Ws(i,i.elements,e);break}xb(i,n)}}else xb(i,n)}}finalizeRemainingComments(){let{commentStack:e}=this.state;for(let r=e.length-1;r>=0;r--)this.finalizeComment(e[r]);this.state.commentStack=[]}resetPreviousNodeTrailingComments(e){let{commentStack:r}=this.state,{length:n}=r;if(n===0)return;let i=r[n-1];i.leadingNode===e&&(i.leadingNode=null)}takeSurroundingComments(e,r,n){let{commentStack:i}=this.state,s=i.length;if(s===0)return;let o=s-1;for(;o>=0;o--){let a=i[o],c=a.end;if(a.start===n)a.leadingNode=e;else if(c===r)a.trailingNode=e;else if(c0}set strict(e){e?this.flags|=1:this.flags&=-2}init({strictMode:e,sourceType:r,startIndex:n,startLine:i,startColumn:s}){this.strict=e===!1?!1:e===!0?!0:r==="module",this.startIndex=n,this.curLine=i,this.lineStart=-s,this.startLoc=this.endLoc=new zo(i,s,n)}get maybeInArrowParameters(){return(this.flags&2)>0}set maybeInArrowParameters(e){e?this.flags|=2:this.flags&=-3}get inType(){return(this.flags&4)>0}set inType(e){e?this.flags|=4:this.flags&=-5}get noAnonFunctionType(){return(this.flags&8)>0}set noAnonFunctionType(e){e?this.flags|=8:this.flags&=-9}get hasFlowComment(){return(this.flags&16)>0}set hasFlowComment(e){e?this.flags|=16:this.flags&=-17}get isAmbientContext(){return(this.flags&32)>0}set isAmbientContext(e){e?this.flags|=32:this.flags&=-33}get inAbstractClass(){return(this.flags&64)>0}set inAbstractClass(e){e?this.flags|=64:this.flags&=-65}get inDisallowConditionalTypesContext(){return(this.flags&128)>0}set inDisallowConditionalTypesContext(e){e?this.flags|=128:this.flags&=-129}get soloAwait(){return(this.flags&256)>0}set soloAwait(e){e?this.flags|=256:this.flags&=-257}get inFSharpPipelineDirectBody(){return(this.flags&512)>0}set inFSharpPipelineDirectBody(e){e?this.flags|=512:this.flags&=-513}get canStartJSXElement(){return(this.flags&1024)>0}set canStartJSXElement(e){e?this.flags|=1024:this.flags&=-1025}get containsEsc(){return(this.flags&2048)>0}set containsEsc(e){e?this.flags|=2048:this.flags&=-2049}get hasTopLevelAwait(){return(this.flags&4096)>0}set hasTopLevelAwait(e){e?this.flags|=4096:this.flags&=-4097}curPosition(){return new zo(this.curLine,this.pos-this.lineStart,this.pos+this.startIndex)}clone(){let e=new t;return e.flags=this.flags,e.startIndex=this.startIndex,e.curLine=this.curLine,e.lineStart=this.lineStart,e.startLoc=this.startLoc,e.endLoc=this.endLoc,e.errors=this.errors.slice(),e.potentialArrowAt=this.potentialArrowAt,e.noArrowAt=this.noArrowAt.slice(),e.noArrowParamsConversionAt=this.noArrowParamsConversionAt.slice(),e.topicContext=this.topicContext,e.labels=this.labels.slice(),e.commentsLen=this.commentsLen,e.commentStack=this.commentStack.slice(),e.pos=this.pos,e.type=this.type,e.value=this.value,e.start=this.start,e.end=this.end,e.lastTokEndLoc=this.lastTokEndLoc,e.lastTokStartLoc=this.lastTokStartLoc,e.context=this.context.slice(),e.firstInvalidTemplateEscapePos=this.firstInvalidTemplateEscapePos,e.strictErrors=this.strictErrors,e.tokensLength=this.tokensLength,e}},T2e=function(e){return e>=48&&e<=57},aQ={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},Tk={bin:t=>t===48||t===49,oct:t=>t>=48&&t<=55,dec:t=>t>=48&&t<=57,hex:t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102};function cQ(t,e,r,n,i,s){let o=r,a=n,c=i,l="",u=null,d=r,{length:p}=e;for(;;){if(r>=p){s.unterminated(o,a,c),l+=e.slice(d,r);break}let f=e.charCodeAt(r);if(O2e(t,f,e,r)){l+=e.slice(d,r);break}if(f===92){l+=e.slice(d,r);let h=N2e(e,r,n,i,t==="template",s);h.ch===null&&!u?u={pos:r,lineStart:n,curLine:i}:l+=h.ch,{pos:r,lineStart:n,curLine:i}=h,d=r}else f===8232||f===8233?(++r,++i,n=r):f===10||f===13?t==="template"?(l+=e.slice(d,r)+` +`,++r,f===13&&e.charCodeAt(r)===10&&++r,++i,d=n=r):s.unterminated(o,a,c):++r}return{pos:r,str:l,firstInvalidLoc:u,lineStart:n,curLine:i,containsInvalid:!!u}}function O2e(t,e,r,n){return t==="template"?e===96||e===36&&r.charCodeAt(n+1)===123:e===(t==="double"?34:39)}function N2e(t,e,r,n,i,s){let o=!i;e++;let a=l=>({pos:e,ch:l,lineStart:r,curLine:n}),c=t.charCodeAt(e++);switch(c){case 110:return a(` +`);case 114:return a("\r");case 120:{let l;return{code:l,pos:e}=sL(t,e,r,n,2,!1,o,s),a(l===null?null:String.fromCharCode(l))}case 117:{let l;return{code:l,pos:e}=kQ(t,e,r,n,o,s),a(l===null?null:String.fromCodePoint(l))}case 116:return a(" ");case 98:return a("\b");case 118:return a("\v");case 102:return a("\f");case 13:t.charCodeAt(e)===10&&++e;case 10:r=e,++n;case 8232:case 8233:return a("");case 56:case 57:if(i)return a(null);s.strictNumericEscape(e-1,r,n);default:if(c>=48&&c<=55){let l=e-1,d=/^[0-7]+/.exec(t.slice(l,e+2))[0],p=parseInt(d,8);p>255&&(d=d.slice(0,-1),p=parseInt(d,8)),e+=d.length-1;let f=t.charCodeAt(e);if(d!=="0"||f===56||f===57){if(i)return a(null);s.strictNumericEscape(l,r,n)}return a(String.fromCharCode(p))}return a(String.fromCharCode(c))}}function sL(t,e,r,n,i,s,o,a){let c=e,l;return{n:l,pos:e}=xQ(t,e,r,n,16,i,s,!1,a,!o),l===null&&(o?a.invalidEscapeSequence(c,r,n):e=c-1),{code:l,pos:e}}function xQ(t,e,r,n,i,s,o,a,c,l){let u=e,d=i===16?aQ.hex:aQ.decBinOct,p=i===16?Tk.hex:i===10?Tk.dec:i===8?Tk.oct:Tk.bin,f=!1,h=0;for(let m=0,y=s??1/0;m=97?g=v-97+10:v>=65?g=v-65+10:T2e(v)?g=v-48:g=1/0,g>=i){if(g<=9&&l)return{n:null,pos:e};if(g<=9&&c.invalidDigit(e,r,n,i))g=0;else if(o)g=0,f=!0;else break}++e,h=h*i+g}return e===u||s!=null&&e-u!==s||f?{n:null,pos:e}:{n:h,pos:e}}function kQ(t,e,r,n,i,s){let o=t.charCodeAt(e),a;if(o===123){if(++e,{code:a,pos:e}=sL(t,e,r,n,t.indexOf("}",e)-e,!0,i,s),++e,a!==null&&a>1114111)if(i)s.invalidCodePoint(e,r,n);else return{code:null,pos:e}}else({code:a,pos:e}=sL(t,e,r,n,4,!1,i,s));return{code:a,pos:e}}function yb(t,e,r){return new zo(r,t-e,t)}var D2e=new Set([103,109,115,105,121,117,100,118]),Lo=class{constructor(e){let r=e.startIndex||0;this.type=e.type,this.value=e.value,this.start=r+e.start,this.end=r+e.end,this.loc=new Mf(e.startLoc,e.endLoc)}},oL=class extends nL{constructor(e,r){super(),this.isLookahead=void 0,this.tokens=[],this.errorHandlers_readInt={invalidDigit:(n,i,s,o)=>this.optionFlags&2048?(this.raise(P.InvalidDigit,yb(n,i,s),{radix:o}),!0):!1,numericSeparatorInEscapeSequence:this.errorBuilder(P.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:this.errorBuilder(P.UnexpectedNumericSeparator)},this.errorHandlers_readCodePoint=Object.assign({},this.errorHandlers_readInt,{invalidEscapeSequence:this.errorBuilder(P.InvalidEscapeSequence),invalidCodePoint:this.errorBuilder(P.InvalidCodePoint)}),this.errorHandlers_readStringContents_string=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:(n,i,s)=>{this.recordStrictModeErrors(P.StrictNumericEscape,yb(n,i,s))},unterminated:(n,i,s)=>{throw this.raise(P.UnterminatedString,yb(n-1,i,s))}}),this.errorHandlers_readStringContents_template=Object.assign({},this.errorHandlers_readCodePoint,{strictNumericEscape:this.errorBuilder(P.StrictNumericEscape),unterminated:(n,i,s)=>{throw this.raise(P.UnterminatedTemplate,yb(n,i,s))}}),this.state=new iL,this.state.init(e),this.input=r,this.length=r.length,this.comments=[],this.isLookahead=!1}pushToken(e){this.tokens.length=this.state.tokensLength,this.tokens.push(e),++this.state.tokensLength}next(){this.checkKeywordEscapes(),this.optionFlags&256&&this.pushToken(new Lo(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()}eat(e){return this.match(e)?(this.next(),!0):!1}match(e){return this.state.type===e}createLookaheadState(e){return{pos:e.pos,value:null,type:e.type,start:e.start,end:e.end,context:[this.curContext()],inType:e.inType,startLoc:e.startLoc,lastTokEndLoc:e.lastTokEndLoc,curLine:e.curLine,lineStart:e.lineStart,curPosition:e.curPosition}}lookahead(){let e=this.state;this.state=this.createLookaheadState(e),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;let r=this.state;return this.state=e,r}nextTokenStart(){return this.nextTokenStartSince(this.state.pos)}nextTokenStartSince(e){return G2.lastIndex=e,G2.test(this.input)?G2.lastIndex:e}lookaheadCharCode(){return this.lookaheadCharCodeSince(this.state.pos)}lookaheadCharCodeSince(e){return this.input.charCodeAt(this.nextTokenStartSince(e))}nextTokenInLineStart(){return this.nextTokenInLineStartSince(this.state.pos)}nextTokenInLineStartSince(e){return H2.lastIndex=e,H2.test(this.input)?H2.lastIndex:e}lookaheadInLineCharCode(){return this.input.charCodeAt(this.nextTokenInLineStart())}codePointAtPos(e){let r=this.input.charCodeAt(e);if((r&64512)===55296&&++ethis.raise(r,n)),this.state.strictErrors.clear())}curContext(){return this.state.context[this.state.context.length-1]}nextToken(){if(this.skipSpace(),this.state.start=this.state.pos,this.isLookahead||(this.state.startLoc=this.state.curPosition()),this.state.pos>=this.length){this.finishToken(140);return}this.getTokenFromCode(this.codePointAtPos(this.state.pos))}skipBlockComment(e){let r;this.isLookahead||(r=this.state.curPosition());let n=this.state.pos,i=this.input.indexOf(e,n+2);if(i===-1)throw this.raise(P.UnterminatedComment,this.state.curPosition());for(this.state.pos=i+e.length,Ck.lastIndex=n+2;Ck.test(this.input)&&Ck.lastIndex<=i;)++this.state.curLine,this.state.lineStart=Ck.lastIndex;if(this.isLookahead)return;let s={type:"CommentBlock",value:this.input.slice(n+2,i),start:this.sourceToOffsetPos(n),end:this.sourceToOffsetPos(i+e.length),loc:new Mf(r,this.state.curPosition())};return this.optionFlags&256&&this.pushToken(s),s}skipLineComment(e){let r=this.state.pos,n;this.isLookahead||(n=this.state.curPosition());let i=this.input.charCodeAt(this.state.pos+=e);if(this.state.pose)){let s=this.skipLineComment(3);s!==void 0&&(this.addComment(s),r?.push(s))}else break e}else if(n===60&&!this.inModule&&this.optionFlags&8192){let i=this.state.pos;if(this.input.charCodeAt(i+1)===33&&this.input.charCodeAt(i+2)===45&&this.input.charCodeAt(i+3)===45){let s=this.skipLineComment(4);s!==void 0&&(this.addComment(s),r?.push(s))}else break e}else break e}}if(r?.length>0){let n=this.state.pos,i={start:this.sourceToOffsetPos(e),end:this.sourceToOffsetPos(n),comments:r,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(i)}}finishToken(e,r){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();let n=this.state.type;this.state.type=e,this.state.value=r,this.isLookahead||this.updateContext(n)}replaceToken(e){this.state.type=e,this.updateContext()}readToken_numberSign(){if(this.state.pos===0&&this.readToken_interpreter())return;let e=this.state.pos+1,r=this.codePointAtPos(e);if(r>=48&&r<=57)throw this.raise(P.UnexpectedDigitAfterHash,this.state.curPosition());if(r===123||r===91&&this.hasPlugin("recordAndTuple")){if(this.expectPlugin("recordAndTuple"),this.getPluginOption("recordAndTuple","syntaxType")==="bar")throw this.raise(r===123?P.RecordExpressionHashIncorrectStartSyntaxType:P.TupleExpressionHashIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,r===123?this.finishToken(7):this.finishToken(1)}else Fo(r)?(++this.state.pos,this.finishToken(139,this.readWord1(r))):r===92?(++this.state.pos,this.finishToken(139,this.readWord1())):this.finishOp(27,1)}readToken_dot(){let e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&e<=57){this.readNumber(!0);return}e===46&&this.input.charCodeAt(this.state.pos+2)===46?(this.state.pos+=3,this.finishToken(21)):(++this.state.pos,this.finishToken(16))}readToken_slash(){this.input.charCodeAt(this.state.pos+1)===61?this.finishOp(31,2):this.finishOp(56,1)}readToken_interpreter(){if(this.state.pos!==0||this.length<2)return!1;let e=this.input.charCodeAt(this.state.pos+1);if(e!==33)return!1;let r=this.state.pos;for(this.state.pos+=1;!jf(e)&&++this.state.pos=48&&r<=57)?(this.state.pos+=2,this.finishToken(18)):(++this.state.pos,this.finishToken(17))}getTokenFromCode(e){switch(e){case 46:this.readToken_dot();return;case 40:++this.state.pos,this.finishToken(10);return;case 41:++this.state.pos,this.finishToken(11);return;case 59:++this.state.pos,this.finishToken(13);return;case 44:++this.state.pos,this.finishToken(12);return;case 91:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(P.TupleExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(2)}else++this.state.pos,this.finishToken(0);return;case 93:++this.state.pos,this.finishToken(3);return;case 123:if(this.hasPlugin("recordAndTuple")&&this.input.charCodeAt(this.state.pos+1)===124){if(this.getPluginOption("recordAndTuple","syntaxType")!=="bar")throw this.raise(P.RecordExpressionBarIncorrectStartSyntaxType,this.state.curPosition());this.state.pos+=2,this.finishToken(6)}else++this.state.pos,this.finishToken(5);return;case 125:++this.state.pos,this.finishToken(8);return;case 58:this.hasPlugin("functionBind")&&this.input.charCodeAt(this.state.pos+1)===58?this.finishOp(15,2):(++this.state.pos,this.finishToken(14));return;case 63:this.readToken_question();return;case 96:this.readTemplateToken();return;case 48:{let r=this.input.charCodeAt(this.state.pos+1);if(r===120||r===88){this.readRadixNumber(16);return}if(r===111||r===79){this.readRadixNumber(8);return}if(r===98||r===66){this.readRadixNumber(2);return}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.readNumber(!1);return;case 34:case 39:this.readString(e);return;case 47:this.readToken_slash();return;case 37:case 42:this.readToken_mult_modulo(e);return;case 124:case 38:this.readToken_pipe_amp(e);return;case 94:this.readToken_caret();return;case 43:case 45:this.readToken_plus_min(e);return;case 60:this.readToken_lt();return;case 62:this.readToken_gt();return;case 61:case 33:this.readToken_eq_excl(e);return;case 126:this.finishOp(36,1);return;case 64:this.readToken_atSign();return;case 35:this.readToken_numberSign();return;case 92:this.readWord();return;default:if(Fo(e)){this.readWord(e);return}}throw this.raise(P.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(e)})}finishOp(e,r){let n=this.input.slice(this.state.pos,this.state.pos+r);this.state.pos+=r,this.finishToken(e,n)}readRegexp(){let e=this.state.startLoc,r=this.state.start+1,n,i,{pos:s}=this.state;for(;;++s){if(s>=this.length)throw this.raise(P.UnterminatedRegExp,Gn(e,1));let l=this.input.charCodeAt(s);if(jf(l))throw this.raise(P.UnterminatedRegExp,Gn(e,1));if(n)n=!1;else{if(l===91)i=!0;else if(l===93&&i)i=!1;else if(l===47&&!i)break;n=l===92}}let o=this.input.slice(r,s);++s;let a="",c=()=>Gn(e,s+2-r);for(;s=2&&this.input.charCodeAt(r)===48;if(c){let f=this.input.slice(r,this.state.pos);if(this.recordStrictModeErrors(P.StrictOctalLiteral,n),!this.state.strict){let h=f.indexOf("_");h>0&&this.raise(P.ZeroDigitNumericSeparator,Gn(n,h))}a=c&&!/[89]/.test(f)}let l=this.input.charCodeAt(this.state.pos);if(l===46&&!a&&(++this.state.pos,this.readInt(10),i=!0,l=this.input.charCodeAt(this.state.pos)),(l===69||l===101)&&!a&&(l=this.input.charCodeAt(++this.state.pos),(l===43||l===45)&&++this.state.pos,this.readInt(10)===null&&this.raise(P.InvalidOrMissingExponent,n),i=!0,o=!0,l=this.input.charCodeAt(this.state.pos)),l===110&&((i||c)&&this.raise(P.InvalidBigIntLiteral,n),++this.state.pos,s=!0),l===109){this.expectPlugin("decimal",this.state.curPosition()),(o||c)&&this.raise(P.InvalidDecimal,n),++this.state.pos;var u=!0}if(Fo(this.codePointAtPos(this.state.pos)))throw this.raise(P.NumberIdentifier,this.state.curPosition());let d=this.input.slice(r,this.state.pos).replace(/[_mn]/g,"");if(s){this.finishToken(136,d);return}if(u){this.finishToken(137,d);return}let p=a?parseInt(d,8):parseFloat(d);this.finishToken(135,p)}readCodePoint(e){let{code:r,pos:n}=kQ(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,this.errorHandlers_readCodePoint);return this.state.pos=n,r}readString(e){let{str:r,pos:n,curLine:i,lineStart:s}=cQ(e===34?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string);this.state.pos=n+1,this.state.lineStart=s,this.state.curLine=i,this.finishToken(134,r)}readTemplateContinuation(){this.match(8)||this.unexpected(null,8),this.state.pos--,this.readTemplateToken()}readTemplateToken(){let e=this.input[this.state.pos],{str:r,firstInvalidLoc:n,pos:i,curLine:s,lineStart:o}=cQ("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template);this.state.pos=i+1,this.state.lineStart=o,this.state.curLine=s,n&&(this.state.firstInvalidTemplateEscapePos=new zo(n.curLine,n.pos-n.lineStart,this.sourceToOffsetPos(n.pos))),this.input.codePointAt(i)===96?this.finishToken(24,n?null:e+r+"`"):(this.state.pos++,this.finishToken(25,n?null:e+r+"${"))}recordStrictModeErrors(e,r){let n=r.index;this.state.strict&&!this.state.strictErrors.has(n)?this.raise(e,r):this.state.strictErrors.set(n,[e,r])}readWord1(e){this.state.containsEsc=!1;let r="",n=this.state.pos,i=this.state.pos;for(e!==void 0&&(this.state.pos+=e<=65535?1:2);this.state.pos=0;a--){let c=o[a];if(c.loc.index===s)return o[a]=e(i,n);if(c.loc.indexthis.hasPlugin(r)))throw this.raise(P.MissingOneOfPlugins,this.state.startLoc,{missingPlugin:e})}errorBuilder(e){return(r,n,i)=>{this.raise(e,yb(r,n,i))}}},aL=class{constructor(){this.privateNames=new Set,this.loneAccessors=new Map,this.undefinedPrivateNames=new Map}},cL=class{constructor(e){this.parser=void 0,this.stack=[],this.undefinedPrivateNames=new Map,this.parser=e}current(){return this.stack[this.stack.length-1]}enter(){this.stack.push(new aL)}exit(){let e=this.stack.pop(),r=this.current();for(let[n,i]of Array.from(e.undefinedPrivateNames))r?r.undefinedPrivateNames.has(n)||r.undefinedPrivateNames.set(n,i):this.parser.raise(P.InvalidPrivateFieldResolution,i,{identifierName:n})}declarePrivateName(e,r,n){let{privateNames:i,loneAccessors:s,undefinedPrivateNames:o}=this.current(),a=i.has(e);if(r&3){let c=a&&s.get(e);if(c){let l=c&4,u=r&4,d=c&3,p=r&3;a=d===p||l!==u,a||s.delete(e)}else a||s.set(e,r)}a&&this.parser.raise(P.PrivateNameRedeclaration,n,{identifierName:e}),i.add(e),o.delete(e)}usePrivateName(e,r){let n;for(n of this.stack)if(n.privateNames.has(e))return;n?n.undefinedPrivateNames.set(e,r):this.parser.raise(P.InvalidPrivateFieldResolution,r,{identifierName:e})}},Ff=class{constructor(e=0){this.type=e}canBeArrowParameterDeclaration(){return this.type===2||this.type===1}isCertainlyParameterDeclaration(){return this.type===3}},Mk=class extends Ff{constructor(e){super(e),this.declarationErrors=new Map}recordDeclarationError(e,r){let n=r.index;this.declarationErrors.set(n,[e,r])}clearDeclarationError(e){this.declarationErrors.delete(e)}iterateErrors(e){this.declarationErrors.forEach(e)}},lL=class{constructor(e){this.parser=void 0,this.stack=[new Ff],this.parser=e}enter(e){this.stack.push(e)}exit(){this.stack.pop()}recordParameterInitializerError(e,r){let n=r.loc.start,{stack:i}=this,s=i.length-1,o=i[s];for(;!o.isCertainlyParameterDeclaration();){if(o.canBeArrowParameterDeclaration())o.recordDeclarationError(e,n);else return;o=i[--s]}this.parser.raise(e,n)}recordArrowParameterBindingError(e,r){let{stack:n}=this,i=n[n.length-1],s=r.loc.start;if(i.isCertainlyParameterDeclaration())this.parser.raise(e,s);else if(i.canBeArrowParameterDeclaration())i.recordDeclarationError(e,s);else return}recordAsyncArrowParametersError(e){let{stack:r}=this,n=r.length-1,i=r[n];for(;i.canBeArrowParameterDeclaration();)i.type===2&&i.recordDeclarationError(P.AwaitBindingIdentifier,e),i=r[--n]}validateAsPattern(){let{stack:e}=this,r=e[e.length-1];r.canBeArrowParameterDeclaration()&&r.iterateErrors(([n,i])=>{this.parser.raise(n,i);let s=e.length-2,o=e[s];for(;o.canBeArrowParameterDeclaration();)o.clearDeclarationError(i.index),o=e[--s]})}};function j2e(){return new Ff(3)}function L2e(){return new Mk(1)}function M2e(){return new Mk(2)}function EQ(){return new Ff}var uL=class extends oL{addExtra(e,r,n,i=!0){if(!e)return;let{extra:s}=e;s==null&&(s={},e.extra=s),i?s[r]=n:Object.defineProperty(s,r,{enumerable:i,value:n})}isContextual(e){return this.state.type===e&&!this.state.containsEsc}isUnparsedContextual(e,r){if(this.input.startsWith(r,e)){let n=this.input.charCodeAt(e+r.length);return!(Yu(n)||(n&64512)===55296)}return!1}isLookaheadContextual(e){let r=this.nextTokenStart();return this.isUnparsedContextual(r,e)}eatContextual(e){return this.isContextual(e)?(this.next(),!0):!1}expectContextual(e,r){if(!this.eatContextual(e)){if(r!=null)throw this.raise(r,this.state.startLoc);this.unexpected(null,e)}}canInsertSemicolon(){return this.match(140)||this.match(8)||this.hasPrecedingLineBreak()}hasPrecedingLineBreak(){return oQ(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)}hasFollowingLineBreak(){return oQ(this.input,this.state.end,this.nextTokenStart())}isLineTerminator(){return this.eat(13)||this.canInsertSemicolon()}semicolon(e=!0){(e?this.isLineTerminator():this.eat(13))||this.raise(P.MissingSemicolon,this.state.lastTokEndLoc)}expect(e,r){this.eat(e)||this.unexpected(r,e)}tryParse(e,r=this.state.clone()){let n={node:null};try{let i=e((s=null)=>{throw n.node=s,n});if(this.state.errors.length>r.errors.length){let s=this.state;return this.state=r,this.state.tokensLength=s.tokensLength,{node:i,error:s.errors[r.errors.length],thrown:!1,aborted:!1,failState:s}}return{node:i,error:null,thrown:!1,aborted:!1,failState:null}}catch(i){let s=this.state;if(this.state=r,i instanceof SyntaxError)return{node:null,error:i,thrown:!0,aborted:!1,failState:s};if(i===n)return{node:n.node,error:null,thrown:!1,aborted:!0,failState:s};throw i}}checkExpressionErrors(e,r){if(!e)return!1;let{shorthandAssignLoc:n,doubleProtoLoc:i,privateKeyLoc:s,optionalParametersLoc:o,voidPatternLoc:a}=e,c=!!n||!!i||!!o||!!s||!!a;if(!r)return c;n!=null&&this.raise(P.InvalidCoverInitializedName,n),i!=null&&this.raise(P.DuplicateProto,i),s!=null&&this.raise(P.UnexpectedPrivateField,s),o!=null&&this.unexpected(o),a!=null&&this.raise(P.InvalidCoverDiscardElement,a)}isLiteralPropertyName(){return mQ(this.state.type)}isPrivateName(e){return e.type==="PrivateName"}getPrivateNameSV(e){return e.id.name}hasPropertyAsPrivateName(e){return(e.type==="MemberExpression"||e.type==="OptionalMemberExpression")&&this.isPrivateName(e.property)}isObjectProperty(e){return e.type==="ObjectProperty"}isObjectMethod(e){return e.type==="ObjectMethod"}initializeScopes(e=this.options.sourceType==="module"){let r=this.state.labels;this.state.labels=[];let n=this.exportedIdentifiers;this.exportedIdentifiers=new Set;let i=this.inModule;this.inModule=e;let s=this.scope,o=this.getScopeHandler();this.scope=new o(this,e);let a=this.prodParam;this.prodParam=new tL;let c=this.classScope;this.classScope=new cL(this);let l=this.expressionScope;return this.expressionScope=new lL(this),()=>{this.state.labels=r,this.exportedIdentifiers=n,this.inModule=i,this.scope=s,this.prodParam=a,this.classScope=c,this.expressionScope=l}}enterInitialScopes(){let e=0;(this.inModule||this.optionFlags&1)&&(e|=2),this.optionFlags&32&&(e|=1);let r=!this.inModule&&this.options.sourceType==="commonjs";(r||this.optionFlags&2)&&(e|=4),this.prodParam.enter(e);let n=r?514:1;this.optionFlags&4&&(n|=512),this.scope.enter(n)}checkDestructuringPrivate(e){let{privateKeyLoc:r}=e;r!==null&&this.expectPlugin("destructuringPrivate",r)}},Lf=class{constructor(){this.shorthandAssignLoc=null,this.doubleProtoLoc=null,this.privateKeyLoc=null,this.optionalParametersLoc=null,this.voidPatternLoc=null}},zf=class{constructor(e,r,n){this.type="",this.start=r,this.end=0,this.loc=new Mf(n),e?.optionFlags&128&&(this.range=[r,0]),e!=null&&e.filename&&(this.loc.filename=e.filename)}},dL=zf.prototype;dL.__clone=function(){let t=new zf(void 0,this.start,this.loc.start),e=Object.keys(this);for(let r=0,n=e.length;rt.type==="ParenthesizedExpression"?fL(t.expression):t,hL=class extends pL{toAssignable(e,r=!1){var n,i;let s;switch((e.type==="ParenthesizedExpression"||(n=e.extra)!=null&&n.parenthesized)&&(s=fL(e),r?s.type==="Identifier"?this.expressionScope.recordArrowParameterBindingError(P.InvalidParenthesizedAssignment,e):s.type!=="CallExpression"&&s.type!=="MemberExpression"&&!this.isOptionalMemberExpression(s)&&this.raise(P.InvalidParenthesizedAssignment,e):this.raise(P.InvalidParenthesizedAssignment,e)),e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(e,"ObjectPattern");for(let a=0,c=e.properties.length,l=c-1;ai.type!=="ObjectMethod"&&(s===n||i.type!=="SpreadElement")&&this.isAssignable(i))}case"ObjectProperty":return this.isAssignable(e.value);case"SpreadElement":return this.isAssignable(e.argument);case"ArrayExpression":return e.elements.every(n=>n===null||this.isAssignable(n));case"AssignmentExpression":return e.operator==="=";case"ParenthesizedExpression":return this.isAssignable(e.expression);case"MemberExpression":case"OptionalMemberExpression":return!r;default:return!1}}toReferencedList(e,r){return e}toReferencedListDeep(e,r){this.toReferencedList(e,r);for(let n of e)n?.type==="ArrayExpression"&&this.toReferencedListDeep(n.elements)}parseSpread(e){let r=this.startNode();return this.next(),r.argument=this.parseMaybeAssignAllowIn(e,void 0),this.finishNode(r,"SpreadElement")}parseRestBinding(){let e=this.startNode();this.next();let r=this.parseBindingAtom();return r.type==="VoidPattern"&&this.raise(P.UnexpectedVoidPattern,r),e.argument=r,this.finishNode(e,"RestElement")}parseBindingAtom(){switch(this.state.type){case 0:{let e=this.startNode();return this.next(),e.elements=this.parseBindingList(3,93,1),this.finishNode(e,"ArrayPattern")}case 5:return this.parseObjectLike(8,!0);case 88:return this.parseVoidPattern(null)}return this.parseIdentifier()}parseBindingList(e,r,n){let i=n&1,s=[],o=!0;for(;!this.eat(e);)if(o?o=!1:this.expect(12),i&&this.match(12))s.push(null);else{if(this.eat(e))break;if(this.match(21)){let a=this.parseRestBinding();if((this.hasPlugin("flow")||n&2)&&(a=this.parseFunctionParamType(a)),s.push(a),!this.checkCommaAfterRest(r)){this.expect(e);break}}else{let a=[];if(n&2)for(this.match(26)&&this.hasPlugin("decorators")&&this.raise(P.UnsupportedParameterDecorator,this.state.startLoc);this.match(26);)a.push(this.parseDecorator());s.push(this.parseBindingElement(n,a))}}return s}parseBindingRestProperty(e){return this.next(),this.hasPlugin("discardBinding")&&this.match(88)?(e.argument=this.parseVoidPattern(null),this.raise(P.UnexpectedVoidPattern,e.argument)):e.argument=this.parseIdentifier(),this.checkCommaAfterRest(125),this.finishNode(e,"RestElement")}parseBindingProperty(){let{type:e,startLoc:r}=this.state;if(e===21)return this.parseBindingRestProperty(this.startNode());let n=this.startNode();return e===139?(this.expectPlugin("destructuringPrivate",r),this.classScope.usePrivateName(this.state.value,r),n.key=this.parsePrivateName()):this.parsePropertyName(n),n.method=!1,this.parseObjPropValue(n,r,!1,!1,!0,!1)}parseBindingElement(e,r){let n=this.parseMaybeDefault();return(this.hasPlugin("flow")||e&2)&&this.parseFunctionParamType(n),r.length&&(n.decorators=r,this.resetStartLocationFromNode(n,r[0])),this.parseMaybeDefault(n.loc.start,n)}parseFunctionParamType(e){return e}parseMaybeDefault(e,r){if(e??(e=this.state.startLoc),r=r??this.parseBindingAtom(),!this.eat(29))return r;let n=this.startNodeAt(e);return r.type==="VoidPattern"&&this.raise(P.VoidPatternInitializer,r),n.left=r,n.right=this.parseMaybeAssignAllowIn(),this.finishNode(n,"AssignmentPattern")}isValidLVal(e,r,n,i){switch(e){case"AssignmentPattern":return"left";case"RestElement":return"argument";case"ObjectProperty":return"value";case"ParenthesizedExpression":return"expression";case"ArrayPattern":return"elements";case"ObjectPattern":return"properties";case"VoidPattern":return!0;case"CallExpression":if(!r&&!this.state.strict&&this.optionFlags&8192)return!0}return!1}isOptionalMemberExpression(e){return e.type==="OptionalMemberExpression"}checkLVal(e,r,n=64,i=!1,s=!1,o=!1,a=!1){var c;let l=e.type;if(this.isObjectMethod(e))return;let u=this.isOptionalMemberExpression(e);if(u||l==="MemberExpression"){u&&(this.expectPlugin("optionalChainingAssign",e.loc.start),r.type!=="AssignmentExpression"&&this.raise(P.InvalidLhsOptionalChaining,e,{ancestor:r})),n!==64&&this.raise(P.InvalidPropertyBindingPattern,e);return}if(l==="Identifier"){this.checkIdentifier(e,n,s);let{name:v}=e;i&&(i.has(v)?this.raise(P.ParamDupe,e):i.add(v));return}else l==="VoidPattern"&&r.type==="CatchClause"&&this.raise(P.VoidPatternCatchClauseParam,e);let d=fL(e);a||(a=d.type==="CallExpression"&&(d.callee.type==="Import"||d.callee.type==="Super"));let p=this.isValidLVal(l,a,!(o||(c=e.extra)!=null&&c.parenthesized)&&r.type==="AssignmentExpression",n);if(p===!0)return;if(p===!1){let v=n===64?P.InvalidLhs:P.InvalidLhsBinding;this.raise(v,e,{ancestor:r});return}let f,h;typeof p=="string"?(f=p,h=l==="ParenthesizedExpression"):[f,h]=p;let m=l==="ArrayPattern"||l==="ObjectPattern"?{type:l}:r,y=e[f];if(Array.isArray(y))for(let v of y)v&&this.checkLVal(v,m,n,i,s,h,!0);else y&&this.checkLVal(y,m,n,i,s,h,a)}checkIdentifier(e,r,n=!1){this.state.strict&&(n?SQ(e.name,this.inModule):_Q(e.name))&&(r===64?this.raise(P.StrictEvalArguments,e,{referenceName:e.name}):this.raise(P.StrictEvalArgumentsBinding,e,{bindingName:e.name})),r&8192&&e.name==="let"&&this.raise(P.LetInLexicalBinding,e),r&64||this.declareNameFromIdentifier(e,r)}declareNameFromIdentifier(e,r){this.scope.declareName(e.name,r,e.loc.start)}checkToRestConversion(e,r){switch(e.type){case"ParenthesizedExpression":this.checkToRestConversion(e.expression,r);break;case"Identifier":case"MemberExpression":break;case"ArrayExpression":case"ObjectExpression":if(r)break;default:this.raise(P.InvalidRestAssignmentPattern,e)}}checkCommaAfterRest(e){return this.match(12)?(this.raise(this.lookaheadCharCode()===e?P.RestTrailingComma:P.ElementAfterRest,this.state.startLoc),!0):!1}},W2=/in(?:stanceof)?|as|satisfies/y;function F2e(t){if(t==null)throw new Error(`Unexpected ${t} value.`);return t}function lQ(t){if(!t)throw new Error("Assert fail")}var me=Mo`typescript`({AbstractMethodHasImplementation:({methodName:t})=>`Method '${t}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:t})=>`Property '${t}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclareAccessor:({kind:t})=>`'declare' is not allowed in ${t}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DuplicateAccessibilityModifier:({modifier:t})=>`Accessibility modifier already seen: '${t}'.`,DuplicateModifier:({modifier:t})=>`Duplicate modifier: '${t}'.`,EmptyHeritageClauseType:({token:t})=>`'${t}' list cannot be empty.`,EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` modifier",IncompatibleModifiers:({modifiers:t})=>`'${t[0]}' modifier cannot be used with '${t[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:t})=>`Index signatures cannot have an accessibility modifier ('${t}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InvalidHeritageClauseType:({token:t})=>`'${t}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:t=>`'${t}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:t})=>`'${t}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:t})=>`'${t}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:t})=>`'${t}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:t=>`'${t}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:t})=>`'${t[0]}' modifier must precede '${t[1]}' modifier.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:t})=>`Private elements cannot have an accessibility modifier ('${t}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:t})=>`Single type parameter ${t} should have a trailing comma. Example usage: <${t},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:t})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${t}.`,UsingDeclarationInAmbientContext:t=>`'${t}' declarations are not allowed in ambient contexts.`});function z2e(t){switch(t){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}function uQ(t){return t==="private"||t==="public"||t==="protected"}function U2e(t){return t==="in"||t==="out"}var B2e=t=>class extends t{constructor(...r){super(...r),this.tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:me.InvalidModifierOnTypeParameter}),this.tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:me.InvalidModifierOnTypeParameterPositions}),this.tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:me.InvalidModifierOnTypeParameter})}getScopeHandler(){return eL}tsIsIdentifier(){return $t(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(5)||this.match(55)||this.match(21)||this.match(139)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){return this.next(),this.hasPrecedingLineBreak()?!1:this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){return this.match(106)?(this.next(),this.tsTokenCanFollowModifier()):this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(r,n,i){if(!$t(this.state.type)&&this.state.type!==58&&this.state.type!==75)return;let s=this.state.value;if(r.includes(s)){if(i&&this.match(106)||n&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return s}}tsParseModifiers({allowedModifiers:r,disallowedModifiers:n,stopOnStartOfClassStaticBlock:i,errorTemplate:s=me.InvalidModifierOnTypeMember},o){let a=(l,u,d,p)=>{u===d&&o[p]&&this.raise(me.InvalidModifiersOrder,l,{orderedModifiers:[d,p]})},c=(l,u,d,p)=>{(o[d]&&u===p||o[p]&&u===d)&&this.raise(me.IncompatibleModifiers,l,{modifiers:[d,p]})};for(;;){let{startLoc:l}=this.state,u=this.tsParseModifier(r.concat(n??[]),i,o.static);if(!u)break;uQ(u)?o.accessibility?this.raise(me.DuplicateAccessibilityModifier,l,{modifier:u}):(a(l,u,u,"override"),a(l,u,u,"static"),a(l,u,u,"readonly"),o.accessibility=u):U2e(u)?(o[u]&&this.raise(me.DuplicateModifier,l,{modifier:u}),o[u]=!0,a(l,u,"in","out")):(hasOwnProperty.call(o,u)?this.raise(me.DuplicateModifier,l,{modifier:u}):(a(l,u,"static","readonly"),a(l,u,"static","override"),a(l,u,"override","readonly"),a(l,u,"abstract","override"),c(l,u,"declare","override"),c(l,u,"static","abstract")),o[u]=!0),n!=null&&n.includes(u)&&this.raise(s,l,{modifier:u})}}tsIsListTerminator(r){switch(r){case"EnumMembers":case"TypeMembers":return this.match(8);case"HeritageClauseElement":return this.match(5);case"TupleElementTypes":return this.match(3);case"TypeParametersOrArguments":return this.match(48)}}tsParseList(r,n){let i=[];for(;!this.tsIsListTerminator(r);)i.push(n());return i}tsParseDelimitedList(r,n,i){return F2e(this.tsParseDelimitedListWorker(r,n,!0,i))}tsParseDelimitedListWorker(r,n,i,s){let o=[],a=-1;for(;!this.tsIsListTerminator(r);){a=-1;let c=n();if(c==null)return;if(o.push(c),this.eat(12)){a=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(r))break;i&&this.expect(12);return}return s&&(s.value=a),o}tsParseBracketedList(r,n,i,s,o){s||(i?this.expect(0):this.expect(47));let a=this.tsParseDelimitedList(r,n,o);return i?this.expect(3):this.expect(48),a}tsParseImportType(){let r=this.startNode();return this.expect(83),this.expect(10),this.match(134)?r.argument=this.parseStringLiteral(this.state.value):(this.raise(me.UnsupportedImportTypeArgument,this.state.startLoc),r.argument=super.parseExprAtom()),this.eat(12)?r.options=this.tsParseImportTypeOptions():r.options=null,this.expect(11),this.eat(16)&&(r.qualifier=this.tsParseEntityName(3)),this.match(47)&&(r.typeParameters=this.tsParseTypeArguments()),this.finishNode(r,"TSImportType")}tsParseImportTypeOptions(){let r=this.startNode();this.expect(5);let n=this.startNode();return this.isContextual(76)?(n.method=!1,n.key=this.parseIdentifier(!0),n.computed=!1,n.shorthand=!1):this.unexpected(null,76),this.expect(14),n.value=this.tsParseImportTypeWithPropertyValue(),r.properties=[this.finishObjectProperty(n)],this.eat(12),this.expect(8),this.finishNode(r,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){let r=this.startNode(),n=[];for(this.expect(5);!this.match(8);){let i=this.state.type;$t(i)||i===134?n.push(super.parsePropertyDefinition(null)):this.unexpected(),this.eat(12)}return r.properties=n,this.next(),this.finishNode(r,"ObjectExpression")}tsParseEntityName(r){let n;if(r&1&&this.match(78))if(r&2)n=this.parseIdentifier(!0);else{let i=this.startNode();this.next(),n=this.finishNode(i,"ThisExpression")}else n=this.parseIdentifier(!!(r&1));for(;this.eat(16);){let i=this.startNodeAtNode(n);i.left=n,i.right=this.parseIdentifier(!!(r&1)),n=this.finishNode(i,"TSQualifiedName")}return n}tsParseTypeReference(){let r=this.startNode();return r.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(47)&&(r.typeParameters=this.tsParseTypeArguments()),this.finishNode(r,"TSTypeReference")}tsParseThisTypePredicate(r){this.next();let n=this.startNodeAtNode(r);return n.parameterName=r,n.typeAnnotation=this.tsParseTypeAnnotation(!1),n.asserts=!1,this.finishNode(n,"TSTypePredicate")}tsParseThisTypeNode(){let r=this.startNode();return this.next(),this.finishNode(r,"TSThisType")}tsParseTypeQuery(){let r=this.startNode();return this.expect(87),this.match(83)?r.exprName=this.tsParseImportType():r.exprName=this.tsParseEntityName(3),!this.hasPrecedingLineBreak()&&this.match(47)&&(r.typeParameters=this.tsParseTypeArguments()),this.finishNode(r,"TSTypeQuery")}tsParseTypeParameter(r){let n=this.startNode();return r(n),n.name=this.tsParseTypeParameterName(),n.constraint=this.tsEatThenParseType(81),n.default=this.tsEatThenParseType(29),this.finishNode(n,"TSTypeParameter")}tsTryParseTypeParameters(r){if(this.match(47))return this.tsParseTypeParameters(r)}tsParseTypeParameters(r){let n=this.startNode();this.match(47)||this.match(143)?this.next():this.unexpected();let i={value:-1};return n.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,r),!1,!0,i),n.params.length===0&&this.raise(me.EmptyTypeParameters,n),i.value!==-1&&this.addExtra(n,"trailingComma",i.value),this.finishNode(n,"TSTypeParameterDeclaration")}tsFillSignature(r,n){let i=r===19,s="parameters",o="typeAnnotation";n.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(10),n[s]=this.tsParseBindingListForSignature(),i?n[o]=this.tsParseTypeOrTypePredicateAnnotation(r):this.match(r)&&(n[o]=this.tsParseTypeOrTypePredicateAnnotation(r))}tsParseBindingListForSignature(){let r=super.parseBindingList(11,41,2);for(let n of r){let{type:i}=n;(i==="AssignmentPattern"||i==="TSParameterProperty")&&this.raise(me.UnsupportedSignatureParameterKind,n,{type:i})}return r}tsParseTypeMemberSemicolon(){!this.eat(12)&&!this.isLineTerminator()&&this.expect(13)}tsParseSignatureMember(r,n){return this.tsFillSignature(14,n),this.tsParseTypeMemberSemicolon(),this.finishNode(n,r)}tsIsUnambiguouslyIndexSignature(){return this.next(),$t(this.state.type)?(this.next(),this.match(14)):!1}tsTryParseIndexSignature(r){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);let n=this.parseIdentifier();n.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(n),this.expect(3),r.parameters=[n];let i=this.tsTryParseTypeAnnotation();return i&&(r.typeAnnotation=i),this.tsParseTypeMemberSemicolon(),this.finishNode(r,"TSIndexSignature")}tsParsePropertyOrMethodSignature(r,n){if(this.eat(17)&&(r.optional=!0),this.match(10)||this.match(47)){n&&this.raise(me.ReadonlyForMethodSignature,r);let i=r;i.kind&&this.match(47)&&this.raise(me.AccessorCannotHaveTypeParameters,this.state.curPosition()),this.tsFillSignature(14,i),this.tsParseTypeMemberSemicolon();let s="parameters",o="typeAnnotation";if(i.kind==="get")i[s].length>0&&(this.raise(P.BadGetterArity,this.state.curPosition()),this.isThisParam(i[s][0])&&this.raise(me.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if(i.kind==="set"){if(i[s].length!==1)this.raise(P.BadSetterArity,this.state.curPosition());else{let a=i[s][0];this.isThisParam(a)&&this.raise(me.AccessorCannotDeclareThisParameter,this.state.curPosition()),a.type==="Identifier"&&a.optional&&this.raise(me.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),a.type==="RestElement"&&this.raise(me.SetAccessorCannotHaveRestParameter,this.state.curPosition())}i[o]&&this.raise(me.SetAccessorCannotHaveReturnType,i[o])}else i.kind="method";return this.finishNode(i,"TSMethodSignature")}else{let i=r;n&&(i.readonly=!0);let s=this.tsTryParseTypeAnnotation();return s&&(i.typeAnnotation=s),this.tsParseTypeMemberSemicolon(),this.finishNode(i,"TSPropertySignature")}}tsParseTypeMember(){let r=this.startNode();if(this.match(10)||this.match(47))return this.tsParseSignatureMember("TSCallSignatureDeclaration",r);if(this.match(77)){let i=this.startNode();return this.next(),this.match(10)||this.match(47)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",r):(r.key=this.createIdentifier(i,"new"),this.tsParsePropertyOrMethodSignature(r,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},r);let n=this.tsTryParseIndexSignature(r);return n||(super.parsePropertyName(r),!r.computed&&r.key.type==="Identifier"&&(r.key.name==="get"||r.key.name==="set")&&this.tsTokenCanFollowModifier()&&(r.kind=r.key.name,super.parsePropertyName(r),!this.match(10)&&!this.match(47)&&this.unexpected(null,10)),this.tsParsePropertyOrMethodSignature(r,!!r.readonly))}tsParseTypeLiteral(){let r=this.startNode();return r.members=this.tsParseObjectTypeMembers(),this.finishNode(r,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(5);let r=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(8),r}tsIsStartOfMappedType(){return this.next(),this.eat(53)?this.isContextual(122):(this.isContextual(122)&&this.next(),!this.match(0)||(this.next(),!this.tsIsIdentifier())?!1:(this.next(),this.match(58)))}tsParseMappedType(){let r=this.startNode();this.expect(5),this.match(53)?(r.readonly=this.state.value,this.next(),this.expectContextual(122)):this.eatContextual(122)&&(r.readonly=!0),this.expect(0);let n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsExpectThenParseType(58),r.typeParameter=this.finishNode(n,"TSTypeParameter"),r.nameType=this.eatContextual(93)?this.tsParseType():null,this.expect(3),this.match(53)?(r.optional=this.state.value,this.next(),this.expect(17)):this.eat(17)&&(r.optional=!0),r.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(8),this.finishNode(r,"TSMappedType")}tsParseTupleType(){let r=this.startNode();r.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let n=!1;return r.elementTypes.forEach(i=>{let{type:s}=i;n&&s!=="TSRestType"&&s!=="TSOptionalType"&&!(s==="TSNamedTupleMember"&&i.optional)&&this.raise(me.OptionalTypeBeforeRequired,i),n||(n=s==="TSNamedTupleMember"&&i.optional||s==="TSOptionalType")}),this.finishNode(r,"TSTupleType")}tsParseTupleElementType(){let r=this.state.startLoc,n=this.eat(21),{startLoc:i}=this.state,s,o,a,c,u=Zs(this.state.type)?this.lookaheadCharCode():null;if(u===58)s=!0,a=!1,o=this.parseIdentifier(!0),this.expect(14),c=this.tsParseType();else if(u===63){a=!0;let d=this.state.value,p=this.tsParseNonArrayType();this.lookaheadCharCode()===58?(s=!0,o=this.createIdentifier(this.startNodeAt(i),d),this.expect(17),this.expect(14),c=this.tsParseType()):(s=!1,c=p,this.expect(17))}else c=this.tsParseType(),a=this.eat(17),s=this.eat(14);if(s){let d;o?(d=this.startNodeAt(i),d.optional=a,d.label=o,d.elementType=c,this.eat(17)&&(d.optional=!0,this.raise(me.TupleOptionalAfterType,this.state.lastTokStartLoc))):(d=this.startNodeAt(i),d.optional=a,this.raise(me.InvalidTupleMemberLabel,c),d.label=c,d.elementType=this.tsParseType()),c=this.finishNode(d,"TSNamedTupleMember")}else if(a){let d=this.startNodeAt(i);d.typeAnnotation=c,c=this.finishNode(d,"TSOptionalType")}if(n){let d=this.startNodeAt(r);d.typeAnnotation=c,c=this.finishNode(d,"TSRestType")}return c}tsParseParenthesizedType(){let r=this.startNode();return this.expect(10),r.typeAnnotation=this.tsParseType(),this.expect(11),this.finishNode(r,"TSParenthesizedType")}tsParseFunctionOrConstructorType(r,n){let i=this.startNode();return r==="TSConstructorType"&&(i.abstract=!!n,n&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(19,i)),this.finishNode(i,r)}tsParseLiteralTypeNode(){let r=this.startNode();switch(this.state.type){case 135:case 136:case 134:case 85:case 86:r.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(r,"TSLiteralType")}tsParseTemplateLiteralType(){let r=this.startNode();return r.literal=super.parseTemplate(!1),this.finishNode(r,"TSLiteralType")}parseTemplateSubstitution(){return this.state.inType?this.tsParseType():super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){let r=this.tsParseThisTypeNode();return this.isContextual(116)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(r):r}tsParseNonArrayType(){switch(this.state.type){case 134:case 135:case 136:case 85:case 86:return this.tsParseLiteralTypeNode();case 53:if(this.state.value==="-"){let r=this.startNode(),n=this.lookahead();return n.type!==135&&n.type!==136&&this.unexpected(),r.literal=this.parseMaybeUnary(),this.finishNode(r,"TSLiteralType")}break;case 78:return this.tsParseThisTypeOrThisTypePredicate();case 87:return this.tsParseTypeQuery();case 83:return this.tsParseImportType();case 5:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 10:return this.tsParseParenthesizedType();case 25:case 24:return this.tsParseTemplateLiteralType();default:{let{type:r}=this.state;if($t(r)||r===88||r===84){let n=r===88?"TSVoidKeyword":r===84?"TSNullKeyword":z2e(this.state.value);if(n!==void 0&&this.lookaheadCharCode()!==46){let i=this.startNode();return this.next(),this.finishNode(i,n)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){let{startLoc:r}=this.state,n=this.tsParseNonArrayType();for(;!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(3)){let i=this.startNodeAt(r);i.elementType=n,this.expect(3),n=this.finishNode(i,"TSArrayType")}else{let i=this.startNodeAt(r);i.objectType=n,i.indexType=this.tsParseType(),this.expect(3),n=this.finishNode(i,"TSIndexedAccessType")}return n}tsParseTypeOperator(){let r=this.startNode(),n=this.state.value;return this.next(),r.operator=n,r.typeAnnotation=this.tsParseTypeOperatorOrHigher(),n==="readonly"&&this.tsCheckTypeAnnotationForReadOnly(r),this.finishNode(r,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(r){switch(r.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(me.UnexpectedReadonly,r)}}tsParseInferType(){let r=this.startNode();this.expectContextual(115);let n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),r.typeParameter=this.finishNode(n,"TSTypeParameter"),this.finishNode(r,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(81)){let r=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(17))return r}}tsParseTypeOperatorOrHigher(){return c2e(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(115)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(r,n,i){let s=this.startNode(),o=this.eat(i),a=[];do a.push(n());while(this.eat(i));return a.length===1&&!o?a[0]:(s.types=a,this.finishNode(s,r))}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),45)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),43)}tsIsStartOfFunctionType(){return this.match(47)?!0:this.match(10)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if($t(this.state.type)||this.match(78))return this.next(),!0;if(this.match(5)){let{errors:r}=this.state,n=r.length;try{return this.parseObjectLike(8,!0),r.length===n}catch{return!1}}if(this.match(0)){this.next();let{errors:r}=this.state,n=r.length;try{return super.parseBindingList(3,93,1),r.length===n}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){return this.next(),!!(this.match(11)||this.match(21)||this.tsSkipParameterStart()&&(this.match(14)||this.match(12)||this.match(17)||this.match(29)||this.match(11)&&(this.next(),this.match(19))))}tsParseTypeOrTypePredicateAnnotation(r){return this.tsInType(()=>{let n=this.startNode();this.expect(r);let i=this.startNode(),s=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(s&&this.match(78)){let c=this.tsParseThisTypeOrThisTypePredicate();return c.type==="TSThisType"?(i.parameterName=c,i.asserts=!0,i.typeAnnotation=null,c=this.finishNode(i,"TSTypePredicate")):(this.resetStartLocationFromNode(c,i),c.asserts=!0),n.typeAnnotation=c,this.finishNode(n,"TSTypeAnnotation")}let o=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!o)return s?(i.parameterName=this.parseIdentifier(),i.asserts=s,i.typeAnnotation=null,n.typeAnnotation=this.finishNode(i,"TSTypePredicate"),this.finishNode(n,"TSTypeAnnotation")):this.tsParseTypeAnnotation(!1,n);let a=this.tsParseTypeAnnotation(!1);return i.parameterName=o,i.typeAnnotation=a,i.asserts=s,n.typeAnnotation=this.finishNode(i,"TSTypePredicate"),this.finishNode(n,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(14))return this.tsParseTypeOrTypePredicateAnnotation(14)}tsTryParseTypeAnnotation(){if(this.match(14))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(14)}tsParseTypePredicatePrefix(){let r=this.parseIdentifier();if(this.isContextual(116)&&!this.hasPrecedingLineBreak())return this.next(),r}tsParseTypePredicateAsserts(){if(this.state.type!==109)return!1;let r=this.state.containsEsc;return this.next(),!$t(this.state.type)&&!this.match(78)?!1:(r&&this.raise(P.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)}tsParseTypeAnnotation(r=!0,n=this.startNode()){return this.tsInType(()=>{r&&this.expect(14),n.typeAnnotation=this.tsParseType()}),this.finishNode(n,"TSTypeAnnotation")}tsParseType(){lQ(this.state.inType);let r=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(81))return r;let n=this.startNodeAtNode(r);return n.checkType=r,n.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(17),n.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(14),n.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(n,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(124)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(77)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(me.ReservedTypeAssertion,this.state.startLoc);let r=this.startNode();return r.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?this.tsParseTypeReference():this.tsParseType())),this.expect(48),r.expression=this.parseMaybeUnary(),this.finishNode(r,"TSTypeAssertion")}tsParseHeritageClause(r){let n=this.state.startLoc,i=this.tsParseDelimitedList("HeritageClauseElement",()=>{let s=this.startNode();return s.expression=this.tsParseEntityName(3),this.match(47)&&(s.typeParameters=this.tsParseTypeArguments()),this.finishNode(s,"TSExpressionWithTypeArguments")});return i.length||this.raise(me.EmptyHeritageClauseType,n,{token:r}),i}tsParseInterfaceDeclaration(r,n={}){if(this.hasFollowingLineBreak())return null;this.expectContextual(129),n.declare&&(r.declare=!0),$t(this.state.type)?(r.id=this.parseIdentifier(),this.checkIdentifier(r.id,130)):(r.id=null,this.raise(me.MissingInterfaceName,this.state.startLoc)),r.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(81)&&(r.extends=this.tsParseHeritageClause("extends"));let i=this.startNode();return i.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),r.body=this.finishNode(i,"TSInterfaceBody"),this.finishNode(r,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(r){return r.id=this.parseIdentifier(),this.checkIdentifier(r.id,2),r.typeAnnotation=this.tsInType(()=>{if(r.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(29),this.isContextual(114)&&this.lookaheadCharCode()!==46){let n=this.startNode();return this.next(),this.finishNode(n,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(r,"TSTypeAliasDeclaration")}tsInTopLevelContext(r){if(this.curContext()!==_t.brace){let n=this.state.context;this.state.context=[n[0]];try{return r()}finally{this.state.context=n}}else return r()}tsInType(r){let n=this.state.inType;this.state.inType=!0;try{return r()}finally{this.state.inType=n}}tsInDisallowConditionalTypesContext(r){let n=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return r()}finally{this.state.inDisallowConditionalTypesContext=n}}tsInAllowConditionalTypesContext(r){let n=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return r()}finally{this.state.inDisallowConditionalTypesContext=n}}tsEatThenParseType(r){if(this.match(r))return this.tsNextThenParseType()}tsExpectThenParseType(r){return this.tsInType(()=>(this.expect(r),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){let r=this.startNode();return r.id=this.match(134)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(29)&&(r.initializer=super.parseMaybeAssignAllowIn()),this.finishNode(r,"TSEnumMember")}tsParseEnumDeclaration(r,n={}){return n.const&&(r.const=!0),n.declare&&(r.declare=!0),this.expectContextual(126),r.id=this.parseIdentifier(),this.checkIdentifier(r.id,r.const?8971:8459),this.expect(5),r.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(r,"TSEnumDeclaration")}tsParseEnumBody(){let r=this.startNode();return this.expect(5),r.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(8),this.finishNode(r,"TSEnumBody")}tsParseModuleBlock(){let r=this.startNode();return this.scope.enter(0),this.expect(5),super.parseBlockOrModuleBlockBody(r.body=[],void 0,!0,8),this.scope.exit(),this.finishNode(r,"TSModuleBlock")}tsParseModuleOrNamespaceDeclaration(r,n=!1){if(r.id=this.parseIdentifier(),n||this.checkIdentifier(r.id,1024),this.eat(16)){let i=this.startNode();this.tsParseModuleOrNamespaceDeclaration(i,!0),r.body=i}else this.scope.enter(1024),this.prodParam.enter(0),r.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit();return this.finishNode(r,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(r){return this.isContextual(112)?(r.kind="global",r.global=!0,r.id=this.parseIdentifier()):this.match(134)?(r.kind="module",r.id=super.parseStringLiteral(this.state.value)):this.unexpected(),this.match(5)?(this.scope.enter(1024),this.prodParam.enter(0),r.body=this.tsParseModuleBlock(),this.prodParam.exit(),this.scope.exit()):this.semicolon(),this.finishNode(r,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(r,n,i){r.isExport=i||!1,r.id=n||this.parseIdentifier(),this.checkIdentifier(r.id,4096),this.expect(29);let s=this.tsParseModuleReference();return r.importKind==="type"&&s.type!=="TSExternalModuleReference"&&this.raise(me.ImportAliasHasImportType,s),r.moduleReference=s,this.semicolon(),this.finishNode(r,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(119)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){let r=this.startNode();return this.expectContextual(119),this.expect(10),this.match(134)||this.unexpected(),r.expression=super.parseExprAtom(),this.expect(11),this.sawUnambiguousESM=!0,this.finishNode(r,"TSExternalModuleReference")}tsLookAhead(r){let n=this.state.clone(),i=r();return this.state=n,i}tsTryParseAndCatch(r){let n=this.tryParse(i=>r()||i());if(!(n.aborted||!n.node))return n.error&&(this.state=n.failState),n.node}tsTryParse(r){let n=this.state.clone(),i=r();if(i!==void 0&&i!==!1)return i;this.state=n}tsTryParseDeclare(r){if(this.isLineTerminator())return;let n=this.state.type;return this.tsInAmbientContext(()=>{switch(n){case 68:return r.declare=!0,super.parseFunctionStatement(r,!1,!1);case 80:return r.declare=!0,this.parseClass(r,!0,!1);case 126:return this.tsParseEnumDeclaration(r,{declare:!0});case 112:return this.tsParseAmbientExternalModuleDeclaration(r);case 100:if(this.state.containsEsc)return;case 75:case 74:return!this.match(75)||!this.isLookaheadContextual("enum")?(r.declare=!0,this.parseVarStatement(r,this.state.value,!0)):(this.expect(75),this.tsParseEnumDeclaration(r,{const:!0,declare:!0}));case 107:if(this.isUsing())return this.raise(me.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),r.declare=!0,this.parseVarStatement(r,"using",!0);break;case 96:if(this.isAwaitUsing())return this.raise(me.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),r.declare=!0,this.next(),this.parseVarStatement(r,"await using",!0);break;case 129:{let i=this.tsParseInterfaceDeclaration(r,{declare:!0});if(i)return i}default:if($t(n))return this.tsParseDeclaration(r,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(r,n,i,s){switch(n){case 124:if(this.tsCheckLineTerminator(i)&&(this.match(80)||$t(this.state.type)))return this.tsParseAbstractDeclaration(r,s);break;case 127:if(this.tsCheckLineTerminator(i)){if(this.match(134))return this.tsParseAmbientExternalModuleDeclaration(r);if($t(this.state.type))return r.kind="module",this.tsParseModuleOrNamespaceDeclaration(r)}break;case 128:if(this.tsCheckLineTerminator(i)&&$t(this.state.type))return r.kind="namespace",this.tsParseModuleOrNamespaceDeclaration(r);break;case 130:if(this.tsCheckLineTerminator(i)&&$t(this.state.type))return this.tsParseTypeAliasDeclaration(r);break}}tsCheckLineTerminator(r){return r?this.hasFollowingLineBreak()?!1:(this.next(),!0):!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(r){if(!this.match(47))return;let n=this.state.maybeInArrowParameters;this.state.maybeInArrowParameters=!0;let i=this.tsTryParseAndCatch(()=>{let s=this.startNodeAt(r);return s.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(s),s.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(19),s});if(this.state.maybeInArrowParameters=n,!!i)return super.parseArrowExpression(i,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()===47)return this.tsParseTypeArguments()}tsParseTypeArguments(){let r=this.startNode();return r.params=this.tsInType(()=>this.tsInTopLevelContext(()=>(this.expect(47),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),r.params.length===0?this.raise(me.EmptyTypeArguments,r):!this.state.inType&&this.curContext()===_t.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(r,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return l2e(this.state.type)}isExportDefaultSpecifier(){return this.tsIsDeclarationStart()?!1:super.isExportDefaultSpecifier()}parseBindingElement(r,n){let i=n.length?n[0].loc.start:this.state.startLoc,s={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},s);let o=s.accessibility,a=s.override,c=s.readonly;!(r&4)&&(o||c||a)&&this.raise(me.UnexpectedParameterModifier,i);let l=this.parseMaybeDefault();r&2&&this.parseFunctionParamType(l);let u=this.parseMaybeDefault(l.loc.start,l);if(o||c||a){let d=this.startNodeAt(i);return n.length&&(d.decorators=n),o&&(d.accessibility=o),c&&(d.readonly=c),a&&(d.override=a),u.type!=="Identifier"&&u.type!=="AssignmentPattern"&&this.raise(me.UnsupportedParameterPropertyKind,d),d.parameter=u,this.finishNode(d,"TSParameterProperty")}return n.length&&(l.decorators=n),u}isSimpleParameter(r){return r.type==="TSParameterProperty"&&super.isSimpleParameter(r.parameter)||super.isSimpleParameter(r)}tsDisallowOptionalPattern(r){for(let n of r.params)n.type!=="Identifier"&&n.optional&&!this.state.isAmbientContext&&this.raise(me.PatternIsOptional,n)}setArrowFunctionParameters(r,n,i){super.setArrowFunctionParameters(r,n,i),this.tsDisallowOptionalPattern(r)}parseFunctionBodyAndFinish(r,n,i=!1){this.match(14)&&(r.returnType=this.tsParseTypeOrTypePredicateAnnotation(14));let s=n==="FunctionDeclaration"?"TSDeclareFunction":n==="ClassMethod"||n==="ClassPrivateMethod"?"TSDeclareMethod":void 0;return s&&!this.match(5)&&this.isLineTerminator()?this.finishNode(r,s):s==="TSDeclareFunction"&&this.state.isAmbientContext&&(this.raise(me.DeclareFunctionHasImplementation,r),r.declare)?super.parseFunctionBodyAndFinish(r,s,i):(this.tsDisallowOptionalPattern(r),super.parseFunctionBodyAndFinish(r,n,i))}registerFunctionStatementId(r){!r.body&&r.id?this.checkIdentifier(r.id,1024):super.registerFunctionStatementId(r)}tsCheckForInvalidTypeCasts(r){r.forEach(n=>{n?.type==="TSTypeCastExpression"&&this.raise(me.UnexpectedTypeAnnotation,n.typeAnnotation)})}toReferencedList(r,n){return this.tsCheckForInvalidTypeCasts(r),r}parseArrayLike(r,n,i){let s=super.parseArrayLike(r,n,i);return s.type==="ArrayExpression"&&this.tsCheckForInvalidTypeCasts(s.elements),s}parseSubscript(r,n,i,s){if(!this.hasPrecedingLineBreak()&&this.match(35)){this.state.canStartJSXElement=!1,this.next();let a=this.startNodeAt(n);return a.expression=r,this.finishNode(a,"TSNonNullExpression")}let o=!1;if(this.match(18)&&this.lookaheadCharCode()===60){if(i)return s.stop=!0,r;s.optionalChainMember=o=!0,this.next()}if(this.match(47)||this.match(51)){let a,c=this.tsTryParseAndCatch(()=>{if(!i&&this.atPossibleAsyncArrow(r)){let p=this.tsTryParseGenericAsyncArrowFunction(n);if(p)return s.stop=!0,p}let l=this.tsParseTypeArgumentsInExpression();if(!l)return;if(o&&!this.match(10)){a=this.state.curPosition();return}if(Lk(this.state.type)){let p=super.parseTaggedTemplateExpression(r,n,s);return p.typeParameters=l,p}if(!i&&this.eat(10)){let p=this.startNodeAt(n);return p.callee=r,p.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(p.arguments),p.typeParameters=l,s.optionalChainMember&&(p.optional=o),this.finishCallExpression(p,s.optionalChainMember)}let u=this.state.type;if(u===48||u===52||u!==10&&u!==93&&u!==120&&bb(u)&&!this.hasPrecedingLineBreak())return;let d=this.startNodeAt(n);return d.expression=r,d.typeParameters=l,this.finishNode(d,"TSInstantiationExpression")});if(a&&this.unexpected(a,10),c)return c.type==="TSInstantiationExpression"&&((this.match(16)||this.match(18)&&this.lookaheadCharCode()!==40)&&this.raise(me.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc),!this.match(16)&&!this.match(18)&&(c.expression=super.stopParseSubscript(r,s))),c}return super.parseSubscript(r,n,i,s)}parseNewCallee(r){var n;super.parseNewCallee(r);let{callee:i}=r;i.type==="TSInstantiationExpression"&&!((n=i.extra)!=null&&n.parenthesized)&&(r.typeParameters=i.typeParameters,r.callee=i.expression)}parseExprOp(r,n,i){let s;if(Nk(58)>i&&!this.hasPrecedingLineBreak()&&(this.isContextual(93)||(s=this.isContextual(120)))){let o=this.startNodeAt(n);return o.expression=r,o.typeAnnotation=this.tsInType(()=>(this.next(),this.match(75)?(s&&this.raise(P.UnexpectedKeyword,this.state.startLoc,{keyword:"const"}),this.tsParseTypeReference()):this.tsParseType())),this.finishNode(o,s?"TSSatisfiesExpression":"TSAsExpression"),this.reScan_lt_gt(),this.parseExprOp(o,n,i)}return super.parseExprOp(r,n,i)}checkReservedWord(r,n,i,s){this.state.isAmbientContext||super.checkReservedWord(r,n,i,s)}checkImportReflection(r){super.checkImportReflection(r),r.module&&r.importKind!=="value"&&this.raise(me.ImportReflectionHasImportType,r.specifiers[0].loc.start)}checkDuplicateExports(){}isPotentialImportPhase(r){if(super.isPotentialImportPhase(r))return!0;if(this.isContextual(130)){let n=this.lookaheadCharCode();return r?n===123||n===42:n!==61}return!r&&this.isContextual(87)}applyImportPhase(r,n,i,s){super.applyImportPhase(r,n,i,s),n?r.exportKind=i==="type"?"type":"value":r.importKind=i==="type"||i==="typeof"?i:"value"}parseImport(r){if(this.match(134))return r.importKind="value",super.parseImport(r);let n;if($t(this.state.type)&&this.lookaheadCharCode()===61)return r.importKind="value",this.tsParseImportEqualsDeclaration(r);if(this.isContextual(130)){let i=this.parseMaybeImportPhase(r,!1);if(this.lookaheadCharCode()===61)return this.tsParseImportEqualsDeclaration(r,i);n=super.parseImportSpecifiersAndAfter(r,i)}else n=super.parseImport(r);return n.importKind==="type"&&n.specifiers.length>1&&n.specifiers[0].type==="ImportDefaultSpecifier"&&this.raise(me.TypeImportCannotSpecifyDefaultAndNamed,n),n}parseExport(r,n){if(this.match(83)){let i=r;this.next();let s=null;return this.isContextual(130)&&this.isPotentialImportPhase(!1)?s=this.parseMaybeImportPhase(i,!1):i.importKind="value",this.tsParseImportEqualsDeclaration(i,s,!0)}else if(this.eat(29)){let i=r;return i.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(i,"TSExportAssignment")}else if(this.eatContextual(93)){let i=r;return this.expectContextual(128),i.id=this.parseIdentifier(),this.semicolon(),this.finishNode(i,"TSNamespaceExportDeclaration")}else return super.parseExport(r,n)}isAbstractClass(){return this.isContextual(124)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){let r=this.startNode();return this.next(),r.abstract=!0,this.parseClass(r,!0,!0)}if(this.match(129)){let r=this.tsParseInterfaceDeclaration(this.startNode());if(r)return r}return super.parseExportDefaultExpression()}parseVarStatement(r,n,i=!1){let{isAmbientContext:s}=this.state,o=super.parseVarStatement(r,n,i||s);if(!s)return o;if(!r.declare&&(n==="using"||n==="await using"))return this.raiseOverwrite(me.UsingDeclarationInAmbientContext,r,n),o;for(let{id:a,init:c}of o.declarations)c&&(n==="var"||n==="let"||a.typeAnnotation?this.raise(me.InitializerNotAllowedInAmbientContext,c):V2e(c,this.hasPlugin("estree"))||this.raise(me.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,c));return o}parseStatementContent(r,n){if(!this.state.containsEsc)switch(this.state.type){case 75:{if(this.isLookaheadContextual("enum")){let i=this.startNode();return this.expect(75),this.tsParseEnumDeclaration(i,{const:!0})}break}case 124:case 125:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){let i=this.state.type,s=this.startNode();this.next();let o=i===125?this.tsTryParseDeclare(s):this.tsParseAbstractDeclaration(s,n);return o?(i===125&&(o.declare=!0),o):(s.expression=this.createIdentifier(this.startNodeAt(s.loc.start),i===125?"declare":"abstract"),this.semicolon(!1),this.finishNode(s,"ExpressionStatement"))}break}case 126:return this.tsParseEnumDeclaration(this.startNode());case 112:{if(this.lookaheadCharCode()===123){let s=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(s)}break}case 129:{let i=this.tsParseInterfaceDeclaration(this.startNode());if(i)return i;break}case 127:{if(this.nextTokenIsIdentifierOrStringLiteralOnSameLine()){let i=this.startNode();return this.next(),this.tsParseDeclaration(i,127,!1,n)}break}case 128:{if(this.nextTokenIsIdentifierOnSameLine()){let i=this.startNode();return this.next(),this.tsParseDeclaration(i,128,!1,n)}break}case 130:{if(this.nextTokenIsIdentifierOnSameLine()){let i=this.startNode();return this.next(),this.tsParseTypeAliasDeclaration(i)}break}}return super.parseStatementContent(r,n)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(r,n){return n.some(i=>uQ(i)?r.accessibility===i:!!r[i])}tsIsStartOfStaticBlocks(){return this.isContextual(106)&&this.lookaheadCharCode()===123}parseClassMember(r,n,i){let s=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:s,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:!0,errorTemplate:me.InvalidModifierOnTypeParameterPositions},n);let o=()=>{this.tsIsStartOfStaticBlocks()?(this.next(),this.next(),this.tsHasSomeModifiers(n,s)&&this.raise(me.StaticBlockCannotHaveModifier,this.state.curPosition()),super.parseClassStaticBlock(r,n)):this.parseClassMemberWithIsStatic(r,n,i,!!n.static)};n.declare?this.tsInAmbientContext(o):o()}parseClassMemberWithIsStatic(r,n,i,s){let o=this.tsTryParseIndexSignature(n);if(o){r.body.push(o),n.abstract&&this.raise(me.IndexSignatureHasAbstract,n),n.accessibility&&this.raise(me.IndexSignatureHasAccessibility,n,{modifier:n.accessibility}),n.declare&&this.raise(me.IndexSignatureHasDeclare,n),n.override&&this.raise(me.IndexSignatureHasOverride,n);return}!this.state.inAbstractClass&&n.abstract&&this.raise(me.NonAbstractClassHasAbstractMethod,n),n.override&&(i.hadSuperClass||this.raise(me.OverrideNotInSubClass,n)),super.parseClassMemberWithIsStatic(r,n,i,s)}parsePostMemberNameModifiers(r){this.eat(17)&&(r.optional=!0),r.readonly&&this.match(10)&&this.raise(me.ClassMethodHasReadonly,r),r.declare&&this.match(10)&&this.raise(me.ClassMethodHasDeclare,r)}shouldParseExportDeclaration(){return this.tsIsDeclarationStart()?!0:super.shouldParseExportDeclaration()}parseConditional(r,n,i){if(!this.match(17))return r;if(this.state.maybeInArrowParameters){let s=this.lookaheadCharCode();if(s===44||s===61||s===58||s===41)return this.setOptionalParametersError(i),r}return super.parseConditional(r,n,i)}parseParenItem(r,n){let i=super.parseParenItem(r,n);if(this.eat(17)&&(i.optional=!0,this.resetEndLocation(r)),this.match(14)){let s=this.startNodeAt(n);return s.expression=r,s.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(s,"TSTypeCastExpression")}return r}parseExportDeclaration(r){if(!this.state.isAmbientContext&&this.isContextual(125))return this.tsInAmbientContext(()=>this.parseExportDeclaration(r));let n=this.state.startLoc,i=this.eatContextual(125);if(i&&(this.isContextual(125)||!this.shouldParseExportDeclaration()))throw this.raise(me.ExpectedAmbientAfterExportDeclare,this.state.startLoc);let o=$t(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(r);return o?((o.type==="TSInterfaceDeclaration"||o.type==="TSTypeAliasDeclaration"||i)&&(r.exportKind="type"),i&&o.type!=="TSImportEqualsDeclaration"&&(this.resetStartLocation(o,n),o.declare=!0),o):null}parseClassId(r,n,i,s){if((!n||i)&&this.isContextual(113))return;super.parseClassId(r,n,i,r.declare?1024:8331);let o=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);o&&(r.typeParameters=o)}parseClassPropertyAnnotation(r){r.optional||(this.eat(35)?r.definite=!0:this.eat(17)&&(r.optional=!0));let n=this.tsTryParseTypeAnnotation();n&&(r.typeAnnotation=n)}parseClassProperty(r){if(this.parseClassPropertyAnnotation(r),this.state.isAmbientContext&&!(r.readonly&&!r.typeAnnotation)&&this.match(29)&&this.raise(me.DeclareClassFieldHasInitializer,this.state.startLoc),r.abstract&&this.match(29)){let{key:n}=r;this.raise(me.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:n.type==="Identifier"&&!r.computed?n.name:`[${this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end))}]`})}return super.parseClassProperty(r)}parseClassPrivateProperty(r){return r.abstract&&this.raise(me.PrivateElementHasAbstract,r),r.accessibility&&this.raise(me.PrivateElementHasAccessibility,r,{modifier:r.accessibility}),this.parseClassPropertyAnnotation(r),super.parseClassPrivateProperty(r)}parseClassAccessorProperty(r){return this.parseClassPropertyAnnotation(r),r.optional&&this.raise(me.AccessorCannotBeOptional,r),super.parseClassAccessorProperty(r)}pushClassMethod(r,n,i,s,o,a){let c=this.tsTryParseTypeParameters(this.tsParseConstModifier);c&&o&&this.raise(me.ConstructorHasTypeParameters,c);let{declare:l=!1,kind:u}=n;l&&(u==="get"||u==="set")&&this.raise(me.DeclareAccessor,n,{kind:u}),c&&(n.typeParameters=c),super.pushClassMethod(r,n,i,s,o,a)}pushClassPrivateMethod(r,n,i,s){let o=this.tsTryParseTypeParameters(this.tsParseConstModifier);o&&(n.typeParameters=o),super.pushClassPrivateMethod(r,n,i,s)}declareClassPrivateMethodInScope(r,n){r.type!=="TSDeclareMethod"&&(r.type==="MethodDefinition"&&r.value.body==null||super.declareClassPrivateMethodInScope(r,n))}parseClassSuper(r){if(super.parseClassSuper(r),r.superClass)if(r.superClass.type==="TSInstantiationExpression"){let n=r.superClass,i=n.expression;this.takeSurroundingComments(i,i.start,i.end);let s=n.typeParameters;this.takeSurroundingComments(s,s.start,s.end),r.superClass=i,r.superTypeParameters=s}else(this.match(47)||this.match(51))&&(r.superTypeParameters=this.tsParseTypeArgumentsInExpression());this.eatContextual(113)&&(r.implements=this.tsParseHeritageClause("implements"))}parseObjPropValue(r,n,i,s,o,a,c){let l=this.tsTryParseTypeParameters(this.tsParseConstModifier);return l&&(r.typeParameters=l),super.parseObjPropValue(r,n,i,s,o,a,c)}parseFunctionParams(r,n){let i=this.tsTryParseTypeParameters(this.tsParseConstModifier);i&&(r.typeParameters=i),super.parseFunctionParams(r,n)}parseVarId(r,n){super.parseVarId(r,n),r.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(35)&&(r.definite=!0);let i=this.tsTryParseTypeAnnotation();i&&(r.id.typeAnnotation=i,this.resetEndLocation(r.id))}parseAsyncArrowFromCallExpression(r,n){return this.match(14)&&(r.returnType=this.tsParseTypeAnnotation()),super.parseAsyncArrowFromCallExpression(r,n)}parseMaybeAssign(r,n){var i,s,o,a,c;let l,u,d;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(l=this.state.clone(),u=this.tryParse(()=>super.parseMaybeAssign(r,n),l),!u.error)return u.node;let{context:h}=this.state,m=h[h.length-1];(m===_t.j_oTag||m===_t.j_expr)&&h.pop()}if(!((i=u)!=null&&i.error)&&!this.match(47))return super.parseMaybeAssign(r,n);(!l||l===this.state)&&(l=this.state.clone());let p,f=this.tryParse(h=>{var m,y;p=this.tsParseTypeParameters(this.tsParseConstModifier);let v=super.parseMaybeAssign(r,n);return(v.type!=="ArrowFunctionExpression"||(m=v.extra)!=null&&m.parenthesized)&&h(),((y=p)==null?void 0:y.params.length)!==0&&this.resetStartLocationFromNode(v,p),v.typeParameters=p,v},l);if(!f.error&&!f.aborted)return p&&this.reportReservedArrowTypeParam(p),f.node;if(!u&&(lQ(!this.hasPlugin("jsx")),d=this.tryParse(()=>super.parseMaybeAssign(r,n),l),!d.error))return d.node;if((s=u)!=null&&s.node)return this.state=u.failState,u.node;if(f.node)return this.state=f.failState,p&&this.reportReservedArrowTypeParam(p),f.node;if((o=d)!=null&&o.node)return this.state=d.failState,d.node;throw((a=u)==null?void 0:a.error)||f.error||((c=d)==null?void 0:c.error)}reportReservedArrowTypeParam(r){var n;r.params.length===1&&!r.params[0].constraint&&!((n=r.extra)!=null&&n.trailingComma)&&this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(me.ReservedArrowTypeParam,r)}parseMaybeUnary(r,n){return!this.hasPlugin("jsx")&&this.match(47)?this.tsParseTypeAssertion():super.parseMaybeUnary(r,n)}parseArrow(r){if(this.match(14)){let n=this.tryParse(i=>{let s=this.tsParseTypeOrTypePredicateAnnotation(14);return(this.canInsertSemicolon()||!this.match(19))&&i(),s});if(n.aborted)return;n.thrown||(n.error&&(this.state=n.failState),r.returnType=n.node)}return super.parseArrow(r)}parseFunctionParamType(r){this.eat(17)&&(r.optional=!0);let n=this.tsTryParseTypeAnnotation();return n&&(r.typeAnnotation=n),this.resetEndLocation(r),r}isAssignable(r,n){switch(r.type){case"TSTypeCastExpression":return this.isAssignable(r.expression,n);case"TSParameterProperty":return!0;default:return super.isAssignable(r,n)}}toAssignable(r,n=!1){switch(r.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(r,n);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":n?this.expressionScope.recordArrowParameterBindingError(me.UnexpectedTypeCastInParameter,r):this.raise(me.UnexpectedTypeCastInParameter,r),this.toAssignable(r.expression,n);break;case"AssignmentExpression":!n&&r.left.type==="TSTypeCastExpression"&&(r.left=this.typeCastToParameter(r.left));default:super.toAssignable(r,n)}}toAssignableParenthesizedExpression(r,n){switch(r.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(r.expression,n);break;default:super.toAssignable(r,n)}}checkToRestConversion(r,n){switch(r.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(r.expression,!1);break;default:super.checkToRestConversion(r,n)}}isValidLVal(r,n,i,s){switch(r){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(s!==64||!i)&&["expression",!0];default:return super.isValidLVal(r,n,i,s)}}parseBindingAtom(){return this.state.type===78?this.parseIdentifier(!0):super.parseBindingAtom()}parseMaybeDecoratorArguments(r,n){if(this.match(47)||this.match(51)){let i=this.tsParseTypeArgumentsInExpression();if(this.match(10)){let s=super.parseMaybeDecoratorArguments(r,n);return s.typeParameters=i,s}this.unexpected(null,10)}return super.parseMaybeDecoratorArguments(r,n)}checkCommaAfterRest(r){return this.state.isAmbientContext&&this.match(12)&&this.lookaheadCharCode()===r?(this.next(),!1):super.checkCommaAfterRest(r)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(35)||this.match(14)||super.isClassProperty()}parseMaybeDefault(r,n){let i=super.parseMaybeDefault(r,n);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.startthis.isAssignable(n,!0)):super.shouldParseArrow(r)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(r){if(this.match(47)||this.match(51)){let n=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());n&&(r.typeParameters=n)}return super.jsxParseOpeningElementAfterName(r)}getGetterSetterExpectedParamCount(r){let n=super.getGetterSetterExpectedParamCount(r),s=this.getObjectOrClassMethodParams(r)[0];return s&&this.isThisParam(s)?n+1:n}parseCatchClauseParam(){let r=super.parseCatchClauseParam(),n=this.tsTryParseTypeAnnotation();return n&&(r.typeAnnotation=n,this.resetEndLocation(r)),r}tsInAmbientContext(r){let{isAmbientContext:n,strict:i}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return r()}finally{this.state.isAmbientContext=n,this.state.strict=i}}parseClass(r,n,i){let s=this.state.inAbstractClass;this.state.inAbstractClass=!!r.abstract;try{return super.parseClass(r,n,i)}finally{this.state.inAbstractClass=s}}tsParseAbstractDeclaration(r,n){if(this.match(80))return r.abstract=!0,this.maybeTakeDecorators(n,this.parseClass(r,!0,!1));if(this.isContextual(129))return this.hasFollowingLineBreak()?null:(r.abstract=!0,this.raise(me.NonClassMethodPropertyHasAbstractModifier,r),this.tsParseInterfaceDeclaration(r));throw this.unexpected(null,80)}parseMethod(r,n,i,s,o,a,c){let l=super.parseMethod(r,n,i,s,o,a,c);if((l.abstract||l.type==="TSAbstractMethodDefinition")&&(this.hasPlugin("estree")?l.value:l).body){let{key:p}=l;this.raise(me.AbstractMethodHasImplementation,l,{methodName:p.type==="Identifier"&&!l.computed?p.name:`[${this.input.slice(this.offsetToSourcePos(p.start),this.offsetToSourcePos(p.end))}]`})}return l}tsParseTypeParameterName(){return this.parseIdentifier().name}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.parse()}getExpression(){return this.shouldParseAsAmbientContext()&&(this.state.isAmbientContext=!0),super.getExpression()}parseExportSpecifier(r,n,i,s){return!n&&s?(this.parseTypeOnlyImportExportSpecifier(r,!1,i),this.finishNode(r,"ExportSpecifier")):(r.exportKind="value",super.parseExportSpecifier(r,n,i,s))}parseImportSpecifier(r,n,i,s,o){return!n&&s?(this.parseTypeOnlyImportExportSpecifier(r,!0,i),this.finishNode(r,"ImportSpecifier")):(r.importKind="value",super.parseImportSpecifier(r,n,i,s,i?4098:4096))}parseTypeOnlyImportExportSpecifier(r,n,i){let s=n?"imported":"local",o=n?"local":"exported",a=r[s],c,l=!1,u=!0,d=a.loc.start;if(this.isContextual(93)){let f=this.parseIdentifier();if(this.isContextual(93)){let h=this.parseIdentifier();Zs(this.state.type)?(l=!0,a=f,c=n?this.parseIdentifier():this.parseModuleExportName(),u=!1):(c=h,u=!1)}else Zs(this.state.type)?(u=!1,c=n?this.parseIdentifier():this.parseModuleExportName()):(l=!0,a=f)}else Zs(this.state.type)&&(l=!0,n?(a=this.parseIdentifier(!0),this.isContextual(93)||this.checkReservedWord(a.name,a.loc.start,!0,!0)):a=this.parseModuleExportName());l&&i&&this.raise(n?me.TypeModifierIsUsedInTypeImports:me.TypeModifierIsUsedInTypeExports,d),r[s]=a,r[o]=c;let p=n?"importKind":"exportKind";r[p]=l?"type":"value",u&&this.eatContextual(93)&&(r[o]=n?this.parseIdentifier():this.parseModuleExportName()),r[o]||(r[o]=this.cloneIdentifier(r[s])),n&&this.checkIdentifier(r[o],l?4098:4096)}fillOptionalPropertiesForTSESLint(r){var n,i,s,o,a,c,l,u,d,p,f,h,m,y,v,g,b,w,x,$,I,E,R,A,B,Z,ee,T,j,Ne,U,H,Oe,F,de,Ft,Se,Jt,xe,sr,D,C,z,O,V,re,ge,ue;switch(r.type){case"ExpressionStatement":(n=r.directive)!=null||(r.directive=void 0);return;case"RestElement":r.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":(i=r.decorators)!=null||(r.decorators=[]),(s=r.optional)!=null||(r.optional=!1),(o=r.typeAnnotation)!=null||(r.typeAnnotation=void 0);return;case"TSParameterProperty":(a=r.accessibility)!=null||(r.accessibility=void 0),(c=r.decorators)!=null||(r.decorators=[]),(l=r.override)!=null||(r.override=!1),(u=r.readonly)!=null||(r.readonly=!1),(d=r.static)!=null||(r.static=!1);return;case"TSEmptyBodyFunctionExpression":r.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":(p=r.declare)!=null||(r.declare=!1),(f=r.returnType)!=null||(r.returnType=void 0),(h=r.typeParameters)!=null||(r.typeParameters=void 0);return;case"Property":(m=r.optional)!=null||(r.optional=!1);return;case"TSMethodSignature":case"TSPropertySignature":(y=r.optional)!=null||(r.optional=!1);case"TSIndexSignature":(v=r.accessibility)!=null||(r.accessibility=void 0),(g=r.readonly)!=null||(r.readonly=!1),(b=r.static)!=null||(r.static=!1);return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":(w=r.declare)!=null||(r.declare=!1),(x=r.definite)!=null||(r.definite=!1),($=r.readonly)!=null||(r.readonly=!1),(I=r.typeAnnotation)!=null||(r.typeAnnotation=void 0);case"TSAbstractMethodDefinition":case"MethodDefinition":(E=r.accessibility)!=null||(r.accessibility=void 0),(R=r.decorators)!=null||(r.decorators=[]),(A=r.override)!=null||(r.override=!1),(B=r.optional)!=null||(r.optional=!1);return;case"ClassExpression":(Z=r.id)!=null||(r.id=null);case"ClassDeclaration":(ee=r.abstract)!=null||(r.abstract=!1),(T=r.declare)!=null||(r.declare=!1),(j=r.decorators)!=null||(r.decorators=[]),(Ne=r.implements)!=null||(r.implements=[]),(U=r.superTypeArguments)!=null||(r.superTypeArguments=void 0),(H=r.typeParameters)!=null||(r.typeParameters=void 0);return;case"TSTypeAliasDeclaration":case"VariableDeclaration":(Oe=r.declare)!=null||(r.declare=!1);return;case"VariableDeclarator":(F=r.definite)!=null||(r.definite=!1);return;case"TSEnumDeclaration":(de=r.const)!=null||(r.const=!1),(Ft=r.declare)!=null||(r.declare=!1);return;case"TSEnumMember":(Se=r.computed)!=null||(r.computed=!1);return;case"TSImportType":(Jt=r.qualifier)!=null||(r.qualifier=null),(xe=r.options)!=null||(r.options=null);return;case"TSInterfaceDeclaration":(sr=r.declare)!=null||(r.declare=!1),(D=r.extends)!=null||(r.extends=[]);return;case"TSMappedType":(C=r.optional)!=null||(r.optional=!1),(z=r.readonly)!=null||(r.readonly=void 0);return;case"TSModuleDeclaration":(O=r.declare)!=null||(r.declare=!1),(V=r.global)!=null||(r.global=r.kind==="global");return;case"TSTypeParameter":(re=r.const)!=null||(r.const=!1),(ge=r.in)!=null||(r.in=!1),(ue=r.out)!=null||(r.out=!1);return}}chStartsBindingIdentifierAndNotRelationalOperator(r,n){if(Fo(r)){if(W2.lastIndex=n,W2.test(this.input)){let i=this.codePointAtPos(W2.lastIndex);if(!Yu(i)&&i!==92)return!1}return!0}else return r===92}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){let r=this.nextTokenInLineStart(),n=this.codePointAtPos(r);return this.chStartsBindingIdentifierAndNotRelationalOperator(n,r)}nextTokenIsIdentifierOrStringLiteralOnSameLine(){let r=this.nextTokenInLineStart(),n=this.codePointAtPos(r);return this.chStartsBindingIdentifier(n,r)||n===34||n===39}};function q2e(t){if(t.type!=="MemberExpression")return!1;let{computed:e,property:r}=t;return e&&r.type!=="StringLiteral"&&(r.type!=="TemplateLiteral"||r.expressions.length>0)?!1:$Q(t.object)}function V2e(t,e){var r;let{type:n}=t;if((r=t.extra)!=null&&r.parenthesized)return!1;if(e){if(n==="Literal"){let{value:i}=t;if(typeof i=="string"||typeof i=="boolean")return!0}}else if(n==="StringLiteral"||n==="BooleanLiteral")return!0;return!!(AQ(t,e)||G2e(t,e)||n==="TemplateLiteral"&&t.expressions.length===0||q2e(t))}function AQ(t,e){return e?t.type==="Literal"&&(typeof t.value=="number"||"bigint"in t):t.type==="NumericLiteral"||t.type==="BigIntLiteral"}function G2e(t,e){if(t.type==="UnaryExpression"){let{operator:r,argument:n}=t;if(r==="-"&&AQ(n,e))return!0}return!1}function $Q(t){return t.type==="Identifier"?!0:t.type!=="MemberExpression"||t.computed?!1:$Q(t.object)}var dQ=Mo`placeholders`({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."}),H2e=t=>class extends t{parsePlaceholder(r){if(this.match(133)){let n=this.startNode();return this.next(),this.assertNoSpace(),n.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(133),this.finishPlaceholder(n,r)}}finishPlaceholder(r,n){let i=r;return(!i.expectedNode||!i.type)&&(i=this.finishNode(i,"Placeholder")),i.expectedNode=n,i}getTokenFromCode(r){r===37&&this.input.charCodeAt(this.state.pos+1)===37?this.finishOp(133,2):super.getTokenFromCode(r)}parseExprAtom(r){return this.parsePlaceholder("Expression")||super.parseExprAtom(r)}parseIdentifier(r){return this.parsePlaceholder("Identifier")||super.parseIdentifier(r)}checkReservedWord(r,n,i,s){r!==void 0&&super.checkReservedWord(r,n,i,s)}cloneIdentifier(r){let n=super.cloneIdentifier(r);return n.type==="Placeholder"&&(n.expectedNode=r.expectedNode),n}cloneStringLiteral(r){return r.type==="Placeholder"?this.cloneIdentifier(r):super.cloneStringLiteral(r)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(r,n,i,s){return r==="Placeholder"||super.isValidLVal(r,n,i,s)}toAssignable(r,n){r&&r.type==="Placeholder"&&r.expectedNode==="Expression"?r.expectedNode="Pattern":super.toAssignable(r,n)}chStartsBindingIdentifier(r,n){if(super.chStartsBindingIdentifier(r,n))return!0;let i=this.nextTokenStart();return this.input.charCodeAt(i)===37&&this.input.charCodeAt(i+1)===37}verifyBreakContinue(r,n){var i;((i=r.label)==null?void 0:i.type)!=="Placeholder"&&super.verifyBreakContinue(r,n)}parseExpressionStatement(r,n){var i;if(n.type!=="Placeholder"||(i=n.extra)!=null&&i.parenthesized)return super.parseExpressionStatement(r,n);if(this.match(14)){let o=r;return o.label=this.finishPlaceholder(n,"Identifier"),this.next(),o.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(o,"LabeledStatement")}this.semicolon();let s=r;return s.name=n.name,this.finishPlaceholder(s,"Statement")}parseBlock(r,n,i){return this.parsePlaceholder("BlockStatement")||super.parseBlock(r,n,i)}parseFunctionId(r){return this.parsePlaceholder("Identifier")||super.parseFunctionId(r)}parseClass(r,n,i){let s=n?"ClassDeclaration":"ClassExpression";this.next();let o=this.state.strict,a=this.parsePlaceholder("Identifier");if(a)if(this.match(81)||this.match(133)||this.match(5))r.id=a;else{if(i||!n)return r.id=null,r.body=this.finishPlaceholder(a,"ClassBody"),this.finishNode(r,s);throw this.raise(dQ.ClassNameIsRequired,this.state.startLoc)}else this.parseClassId(r,n,i);return super.parseClassSuper(r),r.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!r.superClass,o),this.finishNode(r,s)}parseExport(r,n){let i=this.parsePlaceholder("Identifier");if(!i)return super.parseExport(r,n);let s=r;if(!this.isContextual(98)&&!this.match(12))return s.specifiers=[],s.source=null,s.declaration=this.finishPlaceholder(i,"Declaration"),this.finishNode(s,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");let o=this.startNode();return o.exported=i,s.specifiers=[this.finishNode(o,"ExportDefaultSpecifier")],super.parseExport(s,n)}isExportDefaultSpecifier(){if(this.match(65)){let r=this.nextTokenStart();if(this.isUnparsedContextual(r,"from")&&this.input.startsWith(cl(133),this.nextTokenStartSince(r+4)))return!0}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(r,n){var i;return(i=r.specifiers)!=null&&i.length?!0:super.maybeParseExportDefaultSpecifier(r,n)}checkExport(r){let{specifiers:n}=r;n!=null&&n.length&&(r.specifiers=n.filter(i=>i.exported.type==="Placeholder")),super.checkExport(r),r.specifiers=n}parseImport(r){let n=this.parsePlaceholder("Identifier");if(!n)return super.parseImport(r);if(r.specifiers=[],!this.isContextual(98)&&!this.match(12))return r.source=this.finishPlaceholder(n,"StringLiteral"),this.semicolon(),this.finishNode(r,"ImportDeclaration");let i=this.startNodeAtNode(n);return i.local=n,r.specifiers.push(this.finishNode(i,"ImportDefaultSpecifier")),this.eat(12)&&(this.maybeParseStarImportSpecifier(r)||this.parseNamedImportSpecifiers(r)),this.expectContextual(98),r.source=this.parseImportSource(),this.semicolon(),this.finishNode(r,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(dQ.UnexpectedSpace,this.state.lastTokEndLoc)}},W2e=t=>class extends t{parseV8Intrinsic(){if(this.match(54)){let r=this.state.startLoc,n=this.startNode();if(this.next(),$t(this.state.type)){let i=this.parseIdentifierName(),s=this.createIdentifier(n,i);if(this.castNodeTo(s,"V8IntrinsicIdentifier"),this.match(10))return s}this.unexpected(r)}}parseExprAtom(r){return this.parseV8Intrinsic()||super.parseExprAtom(r)}},pQ=["minimal","fsharp","hack","smart"],fQ=["^^","@@","^","%","#"];function Z2e(t){if(t.has("decorators")){if(t.has("decorators-legacy"))throw new Error("Cannot use the decorators and decorators-legacy plugin together");let n=t.get("decorators").decoratorsBeforeExport;if(n!=null&&typeof n!="boolean")throw new Error("'decoratorsBeforeExport' must be a boolean, if specified.");let i=t.get("decorators").allowCallParenthesized;if(i!=null&&typeof i!="boolean")throw new Error("'allowCallParenthesized' must be a boolean.")}if(t.has("flow")&&t.has("typescript"))throw new Error("Cannot combine flow and typescript plugins.");if(t.has("placeholders")&&t.has("v8intrinsic"))throw new Error("Cannot combine placeholders and v8intrinsic plugins.");if(t.has("pipelineOperator")){var e;let n=t.get("pipelineOperator").proposal;if(!pQ.includes(n)){let i=pQ.map(s=>`"${s}"`).join(", ");throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${i}.`)}if(n==="hack"){var r;if(t.has("placeholders"))throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");if(t.has("v8intrinsic"))throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");let i=t.get("pipelineOperator").topicToken;if(!fQ.includes(i)){let s=fQ.map(o=>`"${o}"`).join(", ");throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${s}.`)}if(i==="#"&&((r=t.get("recordAndTuple"))==null?void 0:r.syntaxType)==="hash")throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple",t.get("recordAndTuple")])}\`.`)}else if(n==="smart"&&((e=t.get("recordAndTuple"))==null?void 0:e.syntaxType)==="hash")throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple",t.get("recordAndTuple")])}\`.`)}if(t.has("moduleAttributes")){if(t.has("deprecatedImportAssert")||t.has("importAssertions"))throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");if(t.get("moduleAttributes").version!=="may-2020")throw new Error("The 'moduleAttributes' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is 'may-2020'.")}if(t.has("importAssertions")&&t.has("deprecatedImportAssert"))throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");if(t.has("deprecatedImportAssert")||t.has("importAttributes")&&t.get("importAttributes").deprecatedAssertSyntax&&t.set("deprecatedImportAssert",{}),t.has("recordAndTuple")){let n=t.get("recordAndTuple").syntaxType;if(n!=null){let i=["hash","bar"];if(!i.includes(n))throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: "+i.map(s=>`'${s}'`).join(", "))}}if(t.has("asyncDoExpressions")&&!t.has("doExpressions")){let n=new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");throw n.missingPlugins="doExpressions",n}if(t.has("optionalChainingAssign")&&t.get("optionalChainingAssign").version!=="2023-07")throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");if(t.has("discardBinding")&&t.get("discardBinding").syntaxType!=="void")throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.")}var IQ={estree:Xje,jsx:R2e,flow:A2e,typescript:B2e,v8intrinsic:W2e,placeholders:H2e},J2e=Object.keys(IQ),mL=class extends hL{checkProto(e,r,n,i){if(e.type==="SpreadElement"||this.isObjectMethod(e)||e.computed||e.shorthand)return n;let s=e.key;return(s.type==="Identifier"?s.name:s.value)==="__proto__"?r?(this.raise(P.RecordNoProto,s),!0):(n&&(i?i.doubleProtoLoc===null&&(i.doubleProtoLoc=s.loc.start):this.raise(P.DuplicateProto,s)),!0):n}shouldExitDescending(e,r){return e.type==="ArrowFunctionExpression"&&this.offsetToSourcePos(e.start)===r}getExpression(){if(this.enterInitialScopes(),this.nextToken(),this.match(140))throw this.raise(P.ParseExpressionEmptyInput,this.state.startLoc);let e=this.parseExpression();if(!this.match(140))throw this.raise(P.ParseExpressionExpectsEOF,this.state.startLoc,{unexpected:this.input.codePointAt(this.state.start)});return this.finalizeRemainingComments(),e.comments=this.comments,e.errors=this.state.errors,this.optionFlags&256&&(e.tokens=this.tokens),e}parseExpression(e,r){return e?this.disallowInAnd(()=>this.parseExpressionBase(r)):this.allowInAnd(()=>this.parseExpressionBase(r))}parseExpressionBase(e){let r=this.state.startLoc,n=this.parseMaybeAssign(e);if(this.match(12)){let i=this.startNodeAt(r);for(i.expressions=[n];this.eat(12);)i.expressions.push(this.parseMaybeAssign(e));return this.toReferencedList(i.expressions),this.finishNode(i,"SequenceExpression")}return n}parseMaybeAssignDisallowIn(e,r){return this.disallowInAnd(()=>this.parseMaybeAssign(e,r))}parseMaybeAssignAllowIn(e,r){return this.allowInAnd(()=>this.parseMaybeAssign(e,r))}setOptionalParametersError(e){e.optionalParametersLoc=this.state.startLoc}parseMaybeAssign(e,r){let n=this.state.startLoc,i=this.isContextual(108);if(i&&this.prodParam.hasYield){this.next();let c=this.parseYield(n);return r&&(c=r.call(this,c,n)),c}let s;e?s=!1:(e=new Lf,s=!0);let{type:o}=this.state;(o===10||$t(o))&&(this.state.potentialArrowAt=this.state.start);let a=this.parseMaybeConditional(e);if(r&&(a=r.call(this,a,n)),n2e(this.state.type)){let c=this.startNodeAt(n),l=this.state.value;if(c.operator=l,this.match(29)){this.toAssignable(a,!0),c.left=a;let u=n.index;e.doubleProtoLoc!=null&&e.doubleProtoLoc.index>=u&&(e.doubleProtoLoc=null),e.shorthandAssignLoc!=null&&e.shorthandAssignLoc.index>=u&&(e.shorthandAssignLoc=null),e.privateKeyLoc!=null&&e.privateKeyLoc.index>=u&&(this.checkDestructuringPrivate(e),e.privateKeyLoc=null),e.voidPatternLoc!=null&&e.voidPatternLoc.index>=u&&(e.voidPatternLoc=null)}else c.left=a;return this.next(),c.right=this.parseMaybeAssign(),this.checkLVal(a,this.finishNode(c,"AssignmentExpression"),void 0,void 0,void 0,void 0,l==="||="||l==="&&="||l==="??="),c}else s&&this.checkExpressionErrors(e,!0);if(i){let{type:c}=this.state;if((this.hasPlugin("v8intrinsic")?bb(c):bb(c)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(P.YieldNotInGeneratorFunction,n),this.parseYield(n)}return a}parseMaybeConditional(e){let r=this.state.startLoc,n=this.state.potentialArrowAt,i=this.parseExprOps(e);return this.shouldExitDescending(i,n)?i:this.parseConditional(i,r,e)}parseConditional(e,r,n){if(this.eat(17)){let i=this.startNodeAt(r);return i.test=e,i.consequent=this.parseMaybeAssignAllowIn(),this.expect(14),i.alternate=this.parseMaybeAssign(),this.finishNode(i,"ConditionalExpression")}return e}parseMaybeUnaryOrPrivate(e){return this.match(139)?this.parsePrivateName():this.parseMaybeUnary(e)}parseExprOps(e){let r=this.state.startLoc,n=this.state.potentialArrowAt,i=this.parseMaybeUnaryOrPrivate(e);return this.shouldExitDescending(i,n)?i:this.parseExprOp(i,r,-1)}parseExprOp(e,r,n){if(this.isPrivateName(e)){let s=this.getPrivateNameSV(e);(n>=Nk(58)||!this.prodParam.hasIn||!this.match(58))&&this.raise(P.PrivateInExpectedIn,e,{identifierName:s}),this.classScope.usePrivateName(s,e.loc.start)}let i=this.state.type;if(s2e(i)&&(this.prodParam.hasIn||!this.match(58))){let s=Nk(i);if(s>n){if(i===39){if(this.expectPlugin("pipelineOperator"),this.state.inFSharpPipelineDirectBody)return e;this.checkPipelineAtInfixOperator(e,r)}let o=this.startNodeAt(r);o.left=e,o.operator=this.state.value;let a=i===41||i===42,c=i===40;if(c&&(s=Nk(42)),this.next(),i===39&&this.hasPlugin(["pipelineOperator",{proposal:"minimal"}])&&this.state.type===96&&this.prodParam.hasAwait)throw this.raise(P.UnexpectedAwaitAfterPipelineBody,this.state.startLoc);o.right=this.parseExprOpRightExpr(i,s);let l=this.finishNode(o,a||c?"LogicalExpression":"BinaryExpression"),u=this.state.type;if(c&&(u===41||u===42)||a&&u===40)throw this.raise(P.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(l,r,n)}}return e}parseExprOpRightExpr(e,r){let n=this.state.startLoc;switch(e){case 39:switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(()=>this.parseHackPipeBody());case"fsharp":return this.withSoloAwaitPermittingContext(()=>this.parseFSharpPipelineBody(r))}if(this.getPluginOption("pipelineOperator","proposal")==="smart")return this.withTopicBindingContext(()=>{if(this.prodParam.hasYield&&this.isContextual(108))throw this.raise(P.PipeBodyIsTighter,this.state.startLoc);return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(e,r),n)});default:return this.parseExprOpBaseRightExpr(e,r)}}parseExprOpBaseRightExpr(e,r){let n=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),n,u2e(e)?r-1:r)}parseHackPipeBody(){var e;let{startLoc:r}=this.state,n=this.parseMaybeAssign();return Gje.has(n.type)&&!((e=n.extra)!=null&&e.parenthesized)&&this.raise(P.PipeUnparenthesizedBody,r,{type:n.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(P.PipeTopicUnused,r),n}checkExponentialAfterUnary(e){this.match(57)&&this.raise(P.UnexpectedTokenUnaryExponentiation,e.argument)}parseMaybeUnary(e,r){let n=this.state.startLoc,i=this.isContextual(96);if(i&&this.recordAwaitIfAllowed()){this.next();let c=this.parseAwait(n);return r||this.checkExponentialAfterUnary(c),c}let s=this.match(34),o=this.startNode();if(a2e(this.state.type)){o.operator=this.state.value,o.prefix=!0,this.match(72)&&this.expectPlugin("throwExpressions");let c=this.match(89);if(this.next(),o.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),this.state.strict&&c){let l=o.argument;l.type==="Identifier"?this.raise(P.StrictDelete,o):this.hasPropertyAsPrivateName(l)&&this.raise(P.DeletePrivateField,o)}if(!s)return r||this.checkExponentialAfterUnary(o),this.finishNode(o,"UnaryExpression")}let a=this.parseUpdate(o,s,e);if(i){let{type:c}=this.state;if((this.hasPlugin("v8intrinsic")?bb(c):bb(c)&&!this.match(54))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(P.AwaitNotInAsyncContext,n),this.parseAwait(n)}return a}parseUpdate(e,r,n){if(r){let o=e;return this.checkLVal(o.argument,this.finishNode(o,"UpdateExpression")),e}let i=this.state.startLoc,s=this.parseExprSubscripts(n);if(this.checkExpressionErrors(n,!1))return s;for(;o2e(this.state.type)&&!this.canInsertSemicolon();){let o=this.startNodeAt(i);o.operator=this.state.value,o.prefix=!1,o.argument=s,this.next(),this.checkLVal(s,s=this.finishNode(o,"UpdateExpression"))}return s}parseExprSubscripts(e){let r=this.state.startLoc,n=this.state.potentialArrowAt,i=this.parseExprAtom(e);return this.shouldExitDescending(i,n)?i:this.parseSubscripts(i,r)}parseSubscripts(e,r,n){let i={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(e),stop:!1};do e=this.parseSubscript(e,r,n,i),i.maybeAsyncArrow=!1;while(!i.stop);return e}parseSubscript(e,r,n,i){let{type:s}=this.state;if(!n&&s===15)return this.parseBind(e,r,n,i);if(Lk(s))return this.parseTaggedTemplateExpression(e,r,i);let o=!1;if(s===18){if(n&&(this.raise(P.OptionalChainingNoNew,this.state.startLoc),this.lookaheadCharCode()===40))return this.stopParseSubscript(e,i);i.optionalChainMember=o=!0,this.next()}if(!n&&this.match(10))return this.parseCoverCallAndAsyncArrowHead(e,r,i,o);{let a=this.eat(0);return a||o||this.eat(16)?this.parseMember(e,r,i,a,o):this.stopParseSubscript(e,i)}}stopParseSubscript(e,r){return r.stop=!0,e}parseMember(e,r,n,i,s){let o=this.startNodeAt(r);return o.object=e,o.computed=i,i?(o.property=this.parseExpression(),this.expect(3)):this.match(139)?(e.type==="Super"&&this.raise(P.SuperPrivateField,r),this.classScope.usePrivateName(this.state.value,this.state.startLoc),o.property=this.parsePrivateName()):o.property=this.parseIdentifier(!0),n.optionalChainMember?(o.optional=s,this.finishNode(o,"OptionalMemberExpression")):this.finishNode(o,"MemberExpression")}parseBind(e,r,n,i){let s=this.startNodeAt(r);return s.object=e,this.next(),s.callee=this.parseNoCallExpr(),i.stop=!0,this.parseSubscripts(this.finishNode(s,"BindExpression"),r,n)}parseCoverCallAndAsyncArrowHead(e,r,n,i){let s=this.state.maybeInArrowParameters,o=null;this.state.maybeInArrowParameters=!0,this.next();let a=this.startNodeAt(r);a.callee=e;let{maybeAsyncArrow:c,optionalChainMember:l}=n;c&&(this.expressionScope.enter(M2e()),o=new Lf),l&&(a.optional=i),i?a.arguments=this.parseCallExpressionArguments():a.arguments=this.parseCallExpressionArguments(e.type!=="Super",a,o);let u=this.finishCallExpression(a,l);return c&&this.shouldParseAsyncArrow()&&!i?(n.stop=!0,this.checkDestructuringPrivate(o),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),u=this.parseAsyncArrowFromCallExpression(this.startNodeAt(r),u)):(c&&(this.checkExpressionErrors(o,!0),this.expressionScope.exit()),this.toReferencedArguments(u)),this.state.maybeInArrowParameters=s,u}toReferencedArguments(e,r){this.toReferencedListDeep(e.arguments,r)}parseTaggedTemplateExpression(e,r,n){let i=this.startNodeAt(r);return i.tag=e,i.quasi=this.parseTemplate(!0),n.optionalChainMember&&this.raise(P.OptionalChainingNoTemplate,r),this.finishNode(i,"TaggedTemplateExpression")}atPossibleAsyncArrow(e){return e.type==="Identifier"&&e.name==="async"&&this.state.lastTokEndLoc.index===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.offsetToSourcePos(e.start)===this.state.potentialArrowAt}finishCallExpression(e,r){if(e.callee.type==="Import")if(e.arguments.length===0||e.arguments.length>2)this.raise(P.ImportCallArity,e);else for(let n of e.arguments)n.type==="SpreadElement"&&this.raise(P.ImportCallSpreadArgument,n);return this.finishNode(e,r?"OptionalCallExpression":"CallExpression")}parseCallExpressionArguments(e,r,n){let i=[],s=!0,o=this.state.inFSharpPipelineDirectBody;for(this.state.inFSharpPipelineDirectBody=!1;!this.eat(11);){if(s)s=!1;else if(this.expect(12),this.match(11)){r&&this.addTrailingCommaExtraToNode(r),this.next();break}i.push(this.parseExprListItem(11,!1,n,e))}return this.state.inFSharpPipelineDirectBody=o,i}shouldParseAsyncArrow(){return this.match(19)&&!this.canInsertSemicolon()}parseAsyncArrowFromCallExpression(e,r){var n;return this.resetPreviousNodeTrailingComments(r),this.expect(19),this.parseArrowExpression(e,r.arguments,!0,(n=r.extra)==null?void 0:n.trailingCommaLoc),r.innerComments&&xb(e,r.innerComments),r.callee.trailingComments&&xb(e,r.callee.trailingComments),e}parseNoCallExpr(){let e=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,!0)}parseExprAtom(e){let r,n=null,{type:i}=this.state;switch(i){case 79:return this.parseSuper();case 83:return r=this.startNode(),this.next(),this.match(16)?this.parseImportMetaPropertyOrPhaseCall(r):this.match(10)?this.optionFlags&512?this.parseImportCall(r):this.finishNode(r,"Import"):(this.raise(P.UnsupportedImport,this.state.lastTokStartLoc),this.finishNode(r,"Import"));case 78:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case 90:return this.parseDo(this.startNode(),!1);case 56:case 31:return this.readRegexp(),this.parseRegExpLiteral(this.state.value);case 135:return this.parseNumericLiteral(this.state.value);case 136:return this.parseBigIntLiteral(this.state.value);case 134:return this.parseStringLiteral(this.state.value);case 84:return this.parseNullLiteral();case 85:return this.parseBooleanLiteral(!0);case 86:return this.parseBooleanLiteral(!1);case 10:{let s=this.state.potentialArrowAt===this.state.start;return this.parseParenAndDistinguishExpression(s)}case 0:return this.parseArrayLike(3,!1,e);case 5:return this.parseObjectLike(8,!1,!1,e);case 68:return this.parseFunctionOrFunctionSent();case 26:n=this.parseDecorators();case 80:return this.parseClass(this.maybeTakeDecorators(n,this.startNode()),!1);case 77:return this.parseNewOrNewTarget();case 25:case 24:return this.parseTemplate(!1);case 15:{r=this.startNode(),this.next(),r.object=null;let s=r.callee=this.parseNoCallExpr();if(s.type==="MemberExpression")return this.finishNode(r,"BindExpression");throw this.raise(P.UnsupportedBind,s)}case 139:return this.raise(P.PrivateInExpectedIn,this.state.startLoc,{identifierName:this.state.value}),this.parsePrivateName();case 33:return this.parseTopicReferenceThenEqualsSign(54,"%");case 32:return this.parseTopicReferenceThenEqualsSign(44,"^");case 37:case 38:return this.parseTopicReference("hack");case 44:case 54:case 27:{let s=this.getPluginOption("pipelineOperator","proposal");if(s)return this.parseTopicReference(s);throw this.unexpected()}case 47:{let s=this.input.codePointAt(this.nextTokenStart());throw Fo(s)||s===62?this.expectOnePlugin(["jsx","flow","typescript"]):this.unexpected()}default:if(i===137)return this.parseDecimalLiteral(this.state.value);if(i===2||i===1)return this.parseArrayLike(this.state.type===2?4:3,!0);if(i===6||i===7)return this.parseObjectLike(this.state.type===6?9:8,!1,!0);if($t(i)){if(this.isContextual(127)&&this.lookaheadInLineCharCode()===123)return this.parseModuleExpression();let s=this.state.potentialArrowAt===this.state.start,o=this.state.containsEsc,a=this.parseIdentifier();if(!o&&a.name==="async"&&!this.canInsertSemicolon()){let{type:c}=this.state;if(c===68)return this.resetPreviousNodeTrailingComments(a),this.next(),this.parseAsyncFunctionExpression(this.startNodeAtNode(a));if($t(c))return s&&this.lookaheadCharCode()===61?this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(a)):a;if(c===90)return this.resetPreviousNodeTrailingComments(a),this.parseDo(this.startNodeAtNode(a),!0)}return s&&this.match(19)&&!this.canInsertSemicolon()?(this.next(),this.parseArrowExpression(this.startNodeAtNode(a),[a],!1)):a}else throw this.unexpected()}}parseTopicReferenceThenEqualsSign(e,r){let n=this.getPluginOption("pipelineOperator","proposal");if(n)return this.state.type=e,this.state.value=r,this.state.pos--,this.state.end--,this.state.endLoc=Gn(this.state.endLoc,-1),this.parseTopicReference(n);throw this.unexpected()}parseTopicReference(e){let r=this.startNode(),n=this.state.startLoc,i=this.state.type;return this.next(),this.finishTopicReference(r,n,e,i)}finishTopicReference(e,r,n,i){if(this.testTopicReferenceConfiguration(n,r,i))return n==="hack"?(this.topicReferenceIsAllowedInCurrentContext()||this.raise(P.PipeTopicUnbound,r),this.registerTopicReference(),this.finishNode(e,"TopicReference")):(this.topicReferenceIsAllowedInCurrentContext()||this.raise(P.PrimaryTopicNotAllowed,r),this.registerTopicReference(),this.finishNode(e,"PipelinePrimaryTopicReference"));throw this.raise(P.PipeTopicUnconfiguredToken,r,{token:cl(i)})}testTopicReferenceConfiguration(e,r,n){switch(e){case"hack":return this.hasPlugin(["pipelineOperator",{topicToken:cl(n)}]);case"smart":return n===27;default:throw this.raise(P.PipeTopicRequiresHackPipes,r)}}parseAsyncArrowUnaryFunction(e){this.prodParam.enter(Dk(!0,this.prodParam.hasYield));let r=[this.parseIdentifier()];return this.prodParam.exit(),this.hasPrecedingLineBreak()&&this.raise(P.LineTerminatorBeforeArrow,this.state.curPosition()),this.expect(19),this.parseArrowExpression(e,r,!0)}parseDo(e,r){this.expectPlugin("doExpressions"),r&&this.expectPlugin("asyncDoExpressions"),e.async=r,this.next();let n=this.state.labels;return this.state.labels=[],r?(this.prodParam.enter(2),e.body=this.parseBlock(),this.prodParam.exit()):e.body=this.parseBlock(),this.state.labels=n,this.finishNode(e,"DoExpression")}parseSuper(){let e=this.startNode();return this.next(),this.match(10)&&!this.scope.allowDirectSuper?this.optionFlags&16||this.raise(P.SuperNotAllowed,e):this.scope.allowSuper||this.optionFlags&16||this.raise(P.UnexpectedSuper,e),!this.match(10)&&!this.match(0)&&!this.match(16)&&this.raise(P.UnsupportedSuper,e),this.finishNode(e,"Super")}parsePrivateName(){let e=this.startNode(),r=this.startNodeAt(Gn(this.state.startLoc,1)),n=this.state.value;return this.next(),e.id=this.createIdentifier(r,n),this.finishNode(e,"PrivateName")}parseFunctionOrFunctionSent(){let e=this.startNode();if(this.next(),this.prodParam.hasYield&&this.match(16)){let r=this.createIdentifier(this.startNodeAtNode(e),"function");return this.next(),this.match(103)?this.expectPlugin("functionSent"):this.hasPlugin("functionSent")||this.unexpected(),this.parseMetaProperty(e,r,"sent")}return this.parseFunction(e)}parseMetaProperty(e,r,n){e.meta=r;let i=this.state.containsEsc;return e.property=this.parseIdentifier(!0),(e.property.name!==n||i)&&this.raise(P.UnsupportedMetaProperty,e.property,{target:r.name,onlyValidPropertyName:n}),this.finishNode(e,"MetaProperty")}parseImportMetaPropertyOrPhaseCall(e){if(this.next(),this.isContextual(105)||this.isContextual(97)){let r=this.isContextual(105);return this.expectPlugin(r?"sourcePhaseImports":"deferredImportEvaluation"),this.next(),e.phase=r?"source":"defer",this.parseImportCall(e)}else{let r=this.createIdentifierAt(this.startNodeAtNode(e),"import",this.state.lastTokStartLoc);return this.isContextual(101)&&(this.inModule||this.raise(P.ImportMetaOutsideModule,r),this.sawUnambiguousESM=!0),this.parseMetaProperty(e,r,"meta")}}parseLiteralAtNode(e,r,n){return this.addExtra(n,"rawValue",e),this.addExtra(n,"raw",this.input.slice(this.offsetToSourcePos(n.start),this.state.end)),n.value=e,this.next(),this.finishNode(n,r)}parseLiteral(e,r){let n=this.startNode();return this.parseLiteralAtNode(e,r,n)}parseStringLiteral(e){return this.parseLiteral(e,"StringLiteral")}parseNumericLiteral(e){return this.parseLiteral(e,"NumericLiteral")}parseBigIntLiteral(e){return this.parseLiteral(e,"BigIntLiteral")}parseDecimalLiteral(e){return this.parseLiteral(e,"DecimalLiteral")}parseRegExpLiteral(e){let r=this.startNode();return this.addExtra(r,"raw",this.input.slice(this.offsetToSourcePos(r.start),this.state.end)),r.pattern=e.pattern,r.flags=e.flags,this.next(),this.finishNode(r,"RegExpLiteral")}parseBooleanLiteral(e){let r=this.startNode();return r.value=e,this.next(),this.finishNode(r,"BooleanLiteral")}parseNullLiteral(){let e=this.startNode();return this.next(),this.finishNode(e,"NullLiteral")}parseParenAndDistinguishExpression(e){let r=this.state.startLoc,n;this.next(),this.expressionScope.enter(L2e());let i=this.state.maybeInArrowParameters,s=this.state.inFSharpPipelineDirectBody;this.state.maybeInArrowParameters=!0,this.state.inFSharpPipelineDirectBody=!1;let o=this.state.startLoc,a=[],c=new Lf,l=!0,u,d;for(;!this.match(11);){if(l)l=!1;else if(this.expect(12,c.optionalParametersLoc===null?null:c.optionalParametersLoc),this.match(11)){d=this.state.startLoc;break}if(this.match(21)){let h=this.state.startLoc;if(u=this.state.startLoc,a.push(this.parseParenItem(this.parseRestBinding(),h)),!this.checkCommaAfterRest(41))break}else a.push(this.parseMaybeAssignAllowInOrVoidPattern(11,c,this.parseParenItem))}let p=this.state.lastTokEndLoc;this.expect(11),this.state.maybeInArrowParameters=i,this.state.inFSharpPipelineDirectBody=s;let f=this.startNodeAt(r);return e&&this.shouldParseArrow(a)&&(f=this.parseArrow(f))?(this.checkDestructuringPrivate(c),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),this.parseArrowExpression(f,a,!1),f):(this.expressionScope.exit(),a.length||this.unexpected(this.state.lastTokStartLoc),d&&this.unexpected(d),u&&this.unexpected(u),this.checkExpressionErrors(c,!0),this.toReferencedListDeep(a,!0),a.length>1?(n=this.startNodeAt(o),n.expressions=a,this.finishNode(n,"SequenceExpression"),this.resetEndLocation(n,p)):n=a[0],this.wrapParenthesis(r,n))}wrapParenthesis(e,r){if(!(this.optionFlags&1024))return this.addExtra(r,"parenthesized",!0),this.addExtra(r,"parenStart",e.index),this.takeSurroundingComments(r,e.index,this.state.lastTokEndLoc.index),r;let n=this.startNodeAt(e);return n.expression=r,this.finishNode(n,"ParenthesizedExpression")}shouldParseArrow(e){return!this.canInsertSemicolon()}parseArrow(e){if(this.eat(19))return e}parseParenItem(e,r){return e}parseNewOrNewTarget(){let e=this.startNode();if(this.next(),this.match(16)){let r=this.createIdentifier(this.startNodeAtNode(e),"new");this.next();let n=this.parseMetaProperty(e,r,"target");return this.scope.allowNewTarget||this.raise(P.UnexpectedNewTarget,n),n}return this.parseNew(e)}parseNew(e){if(this.parseNewCallee(e),this.eat(10)){let r=this.parseExprList(11);this.toReferencedList(r),e.arguments=r}else e.arguments=[];return this.finishNode(e,"NewExpression")}parseNewCallee(e){let r=this.match(83),n=this.parseNoCallExpr();e.callee=n,r&&(n.type==="Import"||n.type==="ImportExpression")&&this.raise(P.ImportCallNotNewExpression,n)}parseTemplateElement(e){let{start:r,startLoc:n,end:i,value:s}=this.state,o=r+1,a=this.startNodeAt(Gn(n,1));s===null&&(e||this.raise(P.InvalidEscapeSequenceTemplate,Gn(this.state.firstInvalidTemplateEscapePos,1)));let c=this.match(24),l=c?-1:-2,u=i+l;a.value={raw:this.input.slice(o,u).replace(/\r\n?/g,` +`),cooked:s===null?null:s.slice(1,l)},a.tail=c,this.next();let d=this.finishNode(a,"TemplateElement");return this.resetEndLocation(d,Gn(this.state.lastTokEndLoc,l)),d}parseTemplate(e){let r=this.startNode(),n=this.parseTemplateElement(e),i=[n],s=[];for(;!n.tail;)s.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),i.push(n=this.parseTemplateElement(e));return r.expressions=s,r.quasis=i,this.finishNode(r,"TemplateLiteral")}parseTemplateSubstitution(){return this.parseExpression()}parseObjectLike(e,r,n,i){n&&this.expectPlugin("recordAndTuple");let s=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let o=!1,a=!0,c=this.startNode();for(c.properties=[],this.next();!this.match(e);){if(a)a=!1;else if(this.expect(12),this.match(e)){this.addTrailingCommaExtraToNode(c);break}let u;r?u=this.parseBindingProperty():(u=this.parsePropertyDefinition(i),o=this.checkProto(u,n,o,i)),n&&!this.isObjectProperty(u)&&u.type!=="SpreadElement"&&this.raise(P.InvalidRecordProperty,u),u.shorthand&&this.addExtra(u,"shorthand",!0),c.properties.push(u)}this.next(),this.state.inFSharpPipelineDirectBody=s;let l="ObjectExpression";return r?l="ObjectPattern":n&&(l="RecordExpression"),this.finishNode(c,l)}addTrailingCommaExtraToNode(e){this.addExtra(e,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(e,"trailingCommaLoc",this.state.lastTokStartLoc,!1)}maybeAsyncOrAccessorProp(e){return!e.computed&&e.key.type==="Identifier"&&(this.isLiteralPropertyName()||this.match(0)||this.match(55))}parsePropertyDefinition(e){let r=[];if(this.match(26))for(this.hasPlugin("decorators")&&this.raise(P.UnsupportedPropertyDecorator,this.state.startLoc);this.match(26);)r.push(this.parseDecorator());let n=this.startNode(),i=!1,s=!1,o;if(this.match(21))return r.length&&this.unexpected(),this.parseSpread();r.length&&(n.decorators=r,r=[]),n.method=!1,e&&(o=this.state.startLoc);let a=this.eat(55);this.parsePropertyNamePrefixOperator(n);let c=this.state.containsEsc;if(this.parsePropertyName(n,e),!a&&!c&&this.maybeAsyncOrAccessorProp(n)){let{key:l}=n,u=l.name;u==="async"&&!this.hasPrecedingLineBreak()&&(i=!0,this.resetPreviousNodeTrailingComments(l),a=this.eat(55),this.parsePropertyName(n)),(u==="get"||u==="set")&&(s=!0,this.resetPreviousNodeTrailingComments(l),n.kind=u,this.match(55)&&(a=!0,this.raise(P.AccessorIsGenerator,this.state.curPosition(),{kind:u}),this.next()),this.parsePropertyName(n))}return this.parseObjPropValue(n,o,a,i,!1,s,e)}getGetterSetterExpectedParamCount(e){return e.kind==="get"?0:1}getObjectOrClassMethodParams(e){return e.params}checkGetterSetterParams(e){var r;let n=this.getGetterSetterExpectedParamCount(e),i=this.getObjectOrClassMethodParams(e);i.length!==n&&this.raise(e.kind==="get"?P.BadGetterArity:P.BadSetterArity,e),e.kind==="set"&&((r=i[i.length-1])==null?void 0:r.type)==="RestElement"&&this.raise(P.BadSetterRestParameter,e)}parseObjectMethod(e,r,n,i,s){if(s){let o=this.parseMethod(e,r,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(o),o}if(n||r||this.match(10))return i&&this.unexpected(),e.kind="method",e.method=!0,this.parseMethod(e,r,n,!1,!1,"ObjectMethod")}parseObjectProperty(e,r,n,i){if(e.shorthand=!1,this.eat(14))return e.value=n?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(8,i),this.finishObjectProperty(e);if(!e.computed&&e.key.type==="Identifier"){if(this.checkReservedWord(e.key.name,e.key.loc.start,!0,!1),n)e.value=this.parseMaybeDefault(r,this.cloneIdentifier(e.key));else if(this.match(29)){let s=this.state.startLoc;i!=null?i.shorthandAssignLoc===null&&(i.shorthandAssignLoc=s):this.raise(P.InvalidCoverInitializedName,s),e.value=this.parseMaybeDefault(r,this.cloneIdentifier(e.key))}else e.value=this.cloneIdentifier(e.key);return e.shorthand=!0,this.finishObjectProperty(e)}}finishObjectProperty(e){return this.finishNode(e,"ObjectProperty")}parseObjPropValue(e,r,n,i,s,o,a){let c=this.parseObjectMethod(e,n,i,s,o)||this.parseObjectProperty(e,r,s,a);return c||this.unexpected(),c}parsePropertyName(e,r){if(this.eat(0))e.computed=!0,e.key=this.parseMaybeAssignAllowIn(),this.expect(3);else{let{type:n,value:i}=this.state,s;if(Zs(n))s=this.parseIdentifier(!0);else switch(n){case 135:s=this.parseNumericLiteral(i);break;case 134:s=this.parseStringLiteral(i);break;case 136:s=this.parseBigIntLiteral(i);break;case 139:{let o=this.state.startLoc;r!=null?r.privateKeyLoc===null&&(r.privateKeyLoc=o):this.raise(P.UnexpectedPrivateField,o),s=this.parsePrivateName();break}default:if(n===137){s=this.parseDecimalLiteral(i);break}this.unexpected()}e.key=s,n!==139&&(e.computed=!1)}}initFunction(e,r){e.id=null,e.generator=!1,e.async=r}parseMethod(e,r,n,i,s,o,a=!1){this.initFunction(e,n),e.generator=r,this.scope.enter(530|(a?576:0)|(s?32:0)),this.prodParam.enter(Dk(n,e.generator)),this.parseFunctionParams(e,i);let c=this.parseFunctionBodyAndFinish(e,o,!0);return this.prodParam.exit(),this.scope.exit(),c}parseArrayLike(e,r,n){r&&this.expectPlugin("recordAndTuple");let i=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!1;let s=this.startNode();return this.next(),s.elements=this.parseExprList(e,!r,n,s),this.state.inFSharpPipelineDirectBody=i,this.finishNode(s,r?"TupleExpression":"ArrayExpression")}parseArrowExpression(e,r,n,i){this.scope.enter(518);let s=Dk(n,!1);!this.match(5)&&this.prodParam.hasIn&&(s|=8),this.prodParam.enter(s),this.initFunction(e,n);let o=this.state.maybeInArrowParameters;return r&&(this.state.maybeInArrowParameters=!0,this.setArrowFunctionParameters(e,r,i)),this.state.maybeInArrowParameters=!1,this.parseFunctionBody(e,!0),this.prodParam.exit(),this.scope.exit(),this.state.maybeInArrowParameters=o,this.finishNode(e,"ArrowFunctionExpression")}setArrowFunctionParameters(e,r,n){this.toAssignableList(r,n,!1),e.params=r}parseFunctionBodyAndFinish(e,r,n=!1){return this.parseFunctionBody(e,!1,n),this.finishNode(e,r)}parseFunctionBody(e,r,n=!1){let i=r&&!this.match(5);if(this.expressionScope.enter(EQ()),i)e.body=this.parseMaybeAssign(),this.checkParams(e,!1,r,!1);else{let s=this.state.strict,o=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|4),e.body=this.parseBlock(!0,!1,a=>{let c=!this.isSimpleParamList(e.params);a&&c&&this.raise(P.IllegalLanguageModeDirective,(e.kind==="method"||e.kind==="constructor")&&e.key?e.key.loc.end:e);let l=!s&&this.state.strict;this.checkParams(e,!this.state.strict&&!r&&!n&&!c,r,l),this.state.strict&&e.id&&this.checkIdentifier(e.id,65,l)}),this.prodParam.exit(),this.state.labels=o}this.expressionScope.exit()}isSimpleParameter(e){return e.type==="Identifier"}isSimpleParamList(e){for(let r=0,n=e.length;r10||!_2e(e))return;if(n&&y2e(e)){this.raise(P.UnexpectedKeyword,r,{keyword:e});return}if((this.state.strict?i?SQ:vQ:bQ)(e,this.inModule)){this.raise(P.UnexpectedReservedWord,r,{reservedWord:e});return}else if(e==="yield"){if(this.prodParam.hasYield){this.raise(P.YieldBindingIdentifier,r);return}}else if(e==="await"){if(this.prodParam.hasAwait){this.raise(P.AwaitBindingIdentifier,r);return}if(this.scope.inStaticBlock){this.raise(P.AwaitBindingIdentifierInStaticBlock,r);return}this.expressionScope.recordAsyncArrowParametersError(r)}else if(e==="arguments"&&this.scope.inClassAndNotInNonArrowFunction){this.raise(P.ArgumentsInClass,r);return}}recordAwaitIfAllowed(){let e=this.prodParam.hasAwait;return e&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),e}parseAwait(e){let r=this.startNodeAt(e);return this.expressionScope.recordParameterInitializerError(P.AwaitExpressionFormalParameter,r),this.eat(55)&&this.raise(P.ObsoleteAwaitStar,r),!this.scope.inFunction&&!(this.optionFlags&1)&&(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),this.state.soloAwait||(r.argument=this.parseMaybeUnary(null,!0)),this.finishNode(r,"AwaitExpression")}isAmbiguousPrefixOrIdentifier(){if(this.hasPrecedingLineBreak())return!0;let{type:e}=this.state;return e===53||e===10||e===0||Lk(e)||e===102&&!this.state.containsEsc||e===138||e===56||this.hasPlugin("v8intrinsic")&&e===54}parseYield(e){let r=this.startNodeAt(e);this.expressionScope.recordParameterInitializerError(P.YieldInParameter,r);let n=!1,i=null;if(!this.hasPrecedingLineBreak())switch(n=this.eat(55),this.state.type){case 13:case 140:case 8:case 11:case 3:case 9:case 14:case 12:if(!n)break;default:i=this.parseMaybeAssign()}return r.delegate=n,r.argument=i,this.finishNode(r,"YieldExpression")}parseImportCall(e){if(this.next(),e.source=this.parseMaybeAssignAllowIn(),e.options=null,this.eat(12)){if(this.match(11))this.addTrailingCommaExtraToNode(e.source);else if(e.options=this.parseMaybeAssignAllowIn(),this.eat(12)&&(this.addTrailingCommaExtraToNode(e.options),!this.match(11))){do this.parseMaybeAssignAllowIn();while(this.eat(12)&&!this.match(11));this.raise(P.ImportCallArity,e)}}return this.expect(11),this.finishNode(e,"ImportExpression")}checkPipelineAtInfixOperator(e,r){this.hasPlugin(["pipelineOperator",{proposal:"smart"}])&&e.type==="SequenceExpression"&&this.raise(P.PipelineHeadSequenceExpression,r)}parseSmartPipelineBodyInStyle(e,r){if(this.isSimpleReference(e)){let n=this.startNodeAt(r);return n.callee=e,this.finishNode(n,"PipelineBareFunction")}else{let n=this.startNodeAt(r);return this.checkSmartPipeTopicBodyEarlyErrors(r),n.expression=e,this.finishNode(n,"PipelineTopicExpression")}}isSimpleReference(e){switch(e.type){case"MemberExpression":return!e.computed&&this.isSimpleReference(e.object);case"Identifier":return!0;default:return!1}}checkSmartPipeTopicBodyEarlyErrors(e){if(this.match(19))throw this.raise(P.PipelineBodyNoArrow,this.state.startLoc);this.topicReferenceWasUsedInCurrentContext()||this.raise(P.PipelineTopicUnused,e)}withTopicBindingContext(e){let r=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:1,maxTopicIndex:null};try{return e()}finally{this.state.topicContext=r}}withSmartMixTopicForbiddingContext(e){if(this.hasPlugin(["pipelineOperator",{proposal:"smart"}])){let r=this.state.topicContext;this.state.topicContext={maxNumOfResolvableTopics:0,maxTopicIndex:null};try{return e()}finally{this.state.topicContext=r}}else return e()}withSoloAwaitPermittingContext(e){let r=this.state.soloAwait;this.state.soloAwait=!0;try{return e()}finally{this.state.soloAwait=r}}allowInAnd(e){let r=this.prodParam.currentFlags();if(8&~r){this.prodParam.enter(r|8);try{return e()}finally{this.prodParam.exit()}}return e()}disallowInAnd(e){let r=this.prodParam.currentFlags();if(8&r){this.prodParam.enter(r&-9);try{return e()}finally{this.prodParam.exit()}}return e()}registerTopicReference(){this.state.topicContext.maxTopicIndex=0}topicReferenceIsAllowedInCurrentContext(){return this.state.topicContext.maxNumOfResolvableTopics>=1}topicReferenceWasUsedInCurrentContext(){return this.state.topicContext.maxTopicIndex!=null&&this.state.topicContext.maxTopicIndex>=0}parseFSharpPipelineBody(e){let r=this.state.startLoc;this.state.potentialArrowAt=this.state.start;let n=this.state.inFSharpPipelineDirectBody;this.state.inFSharpPipelineDirectBody=!0;let i=this.parseExprOp(this.parseMaybeUnaryOrPrivate(),r,e);return this.state.inFSharpPipelineDirectBody=n,i}parseModuleExpression(){this.expectPlugin("moduleBlocks");let e=this.startNode();this.next(),this.match(5)||this.unexpected(null,5);let r=this.startNodeAt(this.state.endLoc);this.next();let n=this.initializeScopes(!0);this.enterInitialScopes();try{e.body=this.parseProgram(r,8,"module")}finally{n()}return this.finishNode(e,"ModuleExpression")}parseVoidPattern(e){this.expectPlugin("discardBinding");let r=this.startNode();return e!=null&&(e.voidPatternLoc=this.state.startLoc),this.next(),this.finishNode(r,"VoidPattern")}parseMaybeAssignAllowInOrVoidPattern(e,r,n){if(r!=null&&this.match(88)){let i=this.lookaheadCharCode();if(i===44||i===(e===3?93:e===8?125:41)||i===61)return this.parseMaybeDefault(this.state.startLoc,this.parseVoidPattern(r))}return this.parseMaybeAssignAllowIn(r,n)}parsePropertyNamePrefixOperator(e){}},Z2={kind:1},K2e={kind:2},Y2e=/[\uD800-\uDFFF]/u,J2=/in(?:stanceof)?/y;function X2e(t,e,r){for(let n=0;n0)for(let[s,o]of Array.from(this.scope.undefinedExports))this.raise(P.ModuleExportUndefined,o,{localName:s});this.addExtra(e,"topLevelAwait",this.state.hasTopLevelAwait)}let i;return r===140?i=this.finishNode(e,"Program"):i=this.finishNodeAt(e,"Program",Gn(this.state.startLoc,-1)),i}stmtToDirective(e){let r=this.castNodeTo(e,"Directive"),n=this.castNodeTo(e.expression,"DirectiveLiteral"),i=n.value,s=this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end)),o=n.value=s.slice(1,-1);return this.addExtra(n,"raw",s),this.addExtra(n,"rawValue",o),this.addExtra(n,"expressionValue",i),r.value=n,delete e.expression,r}parseInterpreterDirective(){if(!this.match(28))return null;let e=this.startNode();return e.value=this.state.value,this.next(),this.finishNode(e,"InterpreterDirective")}isLet(){return this.isContextual(100)?this.hasFollowingBindingAtom():!1}isUsing(){return this.isContextual(107)?this.nextTokenIsIdentifierOnSameLine():!1}isForUsing(){if(!this.isContextual(107))return!1;let e=this.nextTokenInLineStart(),r=this.codePointAtPos(e);if(this.isUnparsedContextual(e,"of")){let n=this.lookaheadCharCodeSince(e+2);if(n!==61&&n!==58&&n!==59)return!1}return!!(this.chStartsBindingIdentifier(r,e)||this.isUnparsedContextual(e,"void"))}nextTokenIsIdentifierOnSameLine(){let e=this.nextTokenInLineStart(),r=this.codePointAtPos(e);return this.chStartsBindingIdentifier(r,e)}isAwaitUsing(){if(!this.isContextual(96))return!1;let e=this.nextTokenInLineStart();if(this.isUnparsedContextual(e,"using")){e=this.nextTokenInLineStartSince(e+5);let r=this.codePointAtPos(e);if(this.chStartsBindingIdentifier(r,e))return!0}return!1}chStartsBindingIdentifier(e,r){if(Fo(e)){if(J2.lastIndex=r,J2.test(this.input)){let n=this.codePointAtPos(J2.lastIndex);if(!Yu(n)&&n!==92)return!1}return!0}else return e===92}chStartsBindingPattern(e){return e===91||e===123}hasFollowingBindingAtom(){let e=this.nextTokenStart(),r=this.codePointAtPos(e);return this.chStartsBindingPattern(r)||this.chStartsBindingIdentifier(r,e)}hasInLineFollowingBindingIdentifierOrBrace(){let e=this.nextTokenInLineStart(),r=this.codePointAtPos(e);return r===123||this.chStartsBindingIdentifier(r,e)}allowsUsing(){return(this.scope.inModule||!this.scope.inTopLevel)&&!this.scope.inBareCaseStatement}parseModuleItem(){return this.parseStatementLike(15)}parseStatementListItem(){return this.parseStatementLike(6|(!this.options.annexB||this.state.strict?0:8))}parseStatementOrSloppyAnnexBFunctionDeclaration(e=!1){let r=0;return this.options.annexB&&!this.state.strict&&(r|=4,e&&(r|=8)),this.parseStatementLike(r)}parseStatement(){return this.parseStatementLike(0)}parseStatementLike(e){let r=null;return this.match(26)&&(r=this.parseDecorators(!0)),this.parseStatementContent(e,r)}parseStatementContent(e,r){let n=this.state.type,i=this.startNode(),s=!!(e&2),o=!!(e&4),a=e&1;switch(n){case 60:return this.parseBreakContinueStatement(i,!0);case 63:return this.parseBreakContinueStatement(i,!1);case 64:return this.parseDebuggerStatement(i);case 90:return this.parseDoWhileStatement(i);case 91:return this.parseForStatement(i);case 68:if(this.lookaheadCharCode()===46)break;return o||this.raise(this.state.strict?P.StrictFunction:this.options.annexB?P.SloppyFunctionAnnexB:P.SloppyFunction,this.state.startLoc),this.parseFunctionStatement(i,!1,!s&&o);case 80:return s||this.unexpected(),this.parseClass(this.maybeTakeDecorators(r,i),!0);case 69:return this.parseIfStatement(i);case 70:return this.parseReturnStatement(i);case 71:return this.parseSwitchStatement(i);case 72:return this.parseThrowStatement(i);case 73:return this.parseTryStatement(i);case 96:if(this.isAwaitUsing())return this.allowsUsing()?s?this.recordAwaitIfAllowed()||this.raise(P.AwaitUsingNotInAsyncContext,i):this.raise(P.UnexpectedLexicalDeclaration,i):this.raise(P.UnexpectedUsingDeclaration,i),this.next(),this.parseVarStatement(i,"await using");break;case 107:if(this.state.containsEsc||!this.hasInLineFollowingBindingIdentifierOrBrace())break;return this.allowsUsing()?s||this.raise(P.UnexpectedLexicalDeclaration,this.state.startLoc):this.raise(P.UnexpectedUsingDeclaration,this.state.startLoc),this.parseVarStatement(i,"using");case 100:{if(this.state.containsEsc)break;let u=this.nextTokenStart(),d=this.codePointAtPos(u);if(d!==91&&(!s&&this.hasFollowingLineBreak()||!this.chStartsBindingIdentifier(d,u)&&d!==123))break}case 75:s||this.raise(P.UnexpectedLexicalDeclaration,this.state.startLoc);case 74:{let u=this.state.value;return this.parseVarStatement(i,u)}case 92:return this.parseWhileStatement(i);case 76:return this.parseWithStatement(i);case 5:return this.parseBlock();case 13:return this.parseEmptyStatement(i);case 83:{let u=this.lookaheadCharCode();if(u===40||u===46)break}case 82:{!(this.optionFlags&8)&&!a&&this.raise(P.UnexpectedImportExport,this.state.startLoc),this.next();let u;return n===83?u=this.parseImport(i):u=this.parseExport(i,r),this.assertModuleNodeAllowed(u),u}default:if(this.isAsyncFunction())return s||this.raise(P.AsyncFunctionInSingleStatementContext,this.state.startLoc),this.next(),this.parseFunctionStatement(i,!0,!s&&o)}let c=this.state.value,l=this.parseExpression();return $t(n)&&l.type==="Identifier"&&this.eat(14)?this.parseLabeledStatement(i,c,l,e):this.parseExpressionStatement(i,l,r)}assertModuleNodeAllowed(e){!(this.optionFlags&8)&&!this.inModule&&this.raise(P.ImportOutsideModule,e)}decoratorsEnabledBeforeExport(){return this.hasPlugin("decorators-legacy")?!0:this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")!==!1}maybeTakeDecorators(e,r,n){if(e){var i;(i=r.decorators)!=null&&i.length?(typeof this.getPluginOption("decorators","decoratorsBeforeExport")!="boolean"&&this.raise(P.DecoratorsBeforeAfterExport,r.decorators[0]),r.decorators.unshift(...e)):r.decorators=e,this.resetStartLocationFromNode(r,e[0]),n&&this.resetStartLocationFromNode(n,r)}return r}canHaveLeadingDecorator(){return this.match(80)}parseDecorators(e){let r=[];do r.push(this.parseDecorator());while(this.match(26));if(this.match(82))e||this.unexpected(),this.decoratorsEnabledBeforeExport()||this.raise(P.DecoratorExportClass,this.state.startLoc);else if(!this.canHaveLeadingDecorator())throw this.raise(P.UnexpectedLeadingDecorator,this.state.startLoc);return r}parseDecorator(){this.expectOnePlugin(["decorators","decorators-legacy"]);let e=this.startNode();if(this.next(),this.hasPlugin("decorators")){let r=this.state.startLoc,n;if(this.match(10)){let i=this.state.startLoc;this.next(),n=this.parseExpression(),this.expect(11),n=this.wrapParenthesis(i,n);let s=this.state.startLoc;e.expression=this.parseMaybeDecoratorArguments(n,i),this.getPluginOption("decorators","allowCallParenthesized")===!1&&e.expression!==n&&this.raise(P.DecoratorArgumentsOutsideParentheses,s)}else{for(n=this.parseIdentifier(!1);this.eat(16);){let i=this.startNodeAt(r);i.object=n,this.match(139)?(this.classScope.usePrivateName(this.state.value,this.state.startLoc),i.property=this.parsePrivateName()):i.property=this.parseIdentifier(!0),i.computed=!1,n=this.finishNode(i,"MemberExpression")}e.expression=this.parseMaybeDecoratorArguments(n,r)}}else e.expression=this.parseExprSubscripts();return this.finishNode(e,"Decorator")}parseMaybeDecoratorArguments(e,r){if(this.eat(10)){let n=this.startNodeAt(r);return n.callee=e,n.arguments=this.parseCallExpressionArguments(),this.toReferencedList(n.arguments),this.finishNode(n,"CallExpression")}return e}parseBreakContinueStatement(e,r){return this.next(),this.isLineTerminator()?e.label=null:(e.label=this.parseIdentifier(),this.semicolon()),this.verifyBreakContinue(e,r),this.finishNode(e,r?"BreakStatement":"ContinueStatement")}verifyBreakContinue(e,r){let n;for(n=0;nthis.parseStatement()),this.state.labels.pop(),this.expect(92),e.test=this.parseHeaderExpression(),this.eat(13),this.finishNode(e,"DoWhileStatement")}parseForStatement(e){this.next(),this.state.labels.push(Z2);let r=null;if(this.isContextual(96)&&this.recordAwaitIfAllowed()&&(r=this.state.startLoc,this.next()),this.scope.enter(0),this.expect(10),this.match(13))return r!==null&&this.unexpected(r),this.parseFor(e,null);let n=this.isContextual(100);{let c=this.isAwaitUsing(),l=c||this.isForUsing(),u=n&&this.hasFollowingBindingAtom()||l;if(this.match(74)||this.match(75)||u){let d=this.startNode(),p;c?(p="await using",this.recordAwaitIfAllowed()||this.raise(P.AwaitUsingNotInAsyncContext,this.state.startLoc),this.next()):p=this.state.value,this.next(),this.parseVar(d,!0,p);let f=this.finishNode(d,"VariableDeclaration"),h=this.match(58);return h&&l&&this.raise(P.ForInUsing,f),(h||this.isContextual(102))&&f.declarations.length===1?this.parseForIn(e,f,r):(r!==null&&this.unexpected(r),this.parseFor(e,f))}}let i=this.isContextual(95),s=new Lf,o=this.parseExpression(!0,s),a=this.isContextual(102);if(a&&(n&&this.raise(P.ForOfLet,o),r===null&&i&&o.type==="Identifier"&&this.raise(P.ForOfAsync,o)),a||this.match(58)){this.checkDestructuringPrivate(s),this.toAssignable(o,!0);let c=a?"ForOfStatement":"ForInStatement";return this.checkLVal(o,{type:c}),this.parseForIn(e,o,r)}else this.checkExpressionErrors(s,!0);return r!==null&&this.unexpected(r),this.parseFor(e,o)}parseFunctionStatement(e,r,n){return this.next(),this.parseFunction(e,1|(n?2:0)|(r?8:0))}parseIfStatement(e){return this.next(),e.test=this.parseHeaderExpression(),e.consequent=this.parseStatementOrSloppyAnnexBFunctionDeclaration(),e.alternate=this.eat(66)?this.parseStatementOrSloppyAnnexBFunctionDeclaration():null,this.finishNode(e,"IfStatement")}parseReturnStatement(e){return this.prodParam.hasReturn||this.raise(P.IllegalReturn,this.state.startLoc),this.next(),this.isLineTerminator()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")}parseSwitchStatement(e){this.next(),e.discriminant=this.parseHeaderExpression();let r=e.cases=[];this.expect(5),this.state.labels.push(K2e),this.scope.enter(256);let n;for(let i;!this.match(8);)if(this.match(61)||this.match(65)){let s=this.match(61);n&&this.finishNode(n,"SwitchCase"),r.push(n=this.startNode()),n.consequent=[],this.next(),s?n.test=this.parseExpression():(i&&this.raise(P.MultipleDefaultsInSwitch,this.state.lastTokStartLoc),i=!0,n.test=null),this.expect(14)}else n?n.consequent.push(this.parseStatementListItem()):this.unexpected();return this.scope.exit(),n&&this.finishNode(n,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(e,"SwitchStatement")}parseThrowStatement(e){return this.next(),this.hasPrecedingLineBreak()&&this.raise(P.NewlineAfterThrow,this.state.lastTokEndLoc),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")}parseCatchClauseParam(){let e=this.parseBindingAtom();return this.scope.enter(this.options.annexB&&e.type==="Identifier"?8:0),this.checkLVal(e,{type:"CatchClause"},9),e}parseTryStatement(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.match(62)){let r=this.startNode();this.next(),this.match(10)?(this.expect(10),r.param=this.parseCatchClauseParam(),this.expect(11)):(r.param=null,this.scope.enter(0)),r.body=this.withSmartMixTopicForbiddingContext(()=>this.parseBlock(!1,!1)),this.scope.exit(),e.handler=this.finishNode(r,"CatchClause")}return e.finalizer=this.eat(67)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(P.NoCatchOrFinally,e),this.finishNode(e,"TryStatement")}parseVarStatement(e,r,n=!1){return this.next(),this.parseVar(e,!1,r,n),this.semicolon(),this.finishNode(e,"VariableDeclaration")}parseWhileStatement(e){return this.next(),e.test=this.parseHeaderExpression(),this.state.labels.push(Z2),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.state.labels.pop(),this.finishNode(e,"WhileStatement")}parseWithStatement(e){return this.state.strict&&this.raise(P.StrictWith,this.state.startLoc),this.next(),e.object=this.parseHeaderExpression(),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.finishNode(e,"WithStatement")}parseEmptyStatement(e){return this.next(),this.finishNode(e,"EmptyStatement")}parseLabeledStatement(e,r,n,i){for(let o of this.state.labels)o.name===r&&this.raise(P.LabelRedeclaration,n,{labelName:r});let s=i2e(this.state.type)?1:this.match(71)?2:null;for(let o=this.state.labels.length-1;o>=0;o--){let a=this.state.labels[o];if(a.statementStart===e.start)a.statementStart=this.sourceToOffsetPos(this.state.start),a.kind=s;else break}return this.state.labels.push({name:r,kind:s,statementStart:this.sourceToOffsetPos(this.state.start)}),e.body=i&8?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")}parseExpressionStatement(e,r,n){return e.expression=r,this.semicolon(),this.finishNode(e,"ExpressionStatement")}parseBlock(e=!1,r=!0,n){let i=this.startNode();return e&&this.state.strictErrors.clear(),this.expect(5),r&&this.scope.enter(0),this.parseBlockBody(i,e,!1,8,n),r&&this.scope.exit(),this.finishNode(i,"BlockStatement")}isValidDirective(e){return e.type==="ExpressionStatement"&&e.expression.type==="StringLiteral"&&!e.expression.extra.parenthesized}parseBlockBody(e,r,n,i,s){let o=e.body=[],a=e.directives=[];this.parseBlockOrModuleBlockBody(o,r?a:void 0,n,i,s)}parseBlockOrModuleBlockBody(e,r,n,i,s){let o=this.state.strict,a=!1,c=!1;for(;!this.match(i);){let l=n?this.parseModuleItem():this.parseStatementListItem();if(r&&!c){if(this.isValidDirective(l)){let u=this.stmtToDirective(l);r.push(u),!a&&u.value.value==="use strict"&&(a=!0,this.setStrict(!0));continue}c=!0,this.state.strictErrors.clear()}e.push(l)}s?.call(this,a),o||this.setStrict(!1),this.next()}parseFor(e,r){return e.init=r,this.semicolon(!1),e.test=this.match(13)?null:this.parseExpression(),this.semicolon(!1),e.update=this.match(11)?null:this.parseExpression(),this.expect(11),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,"ForStatement")}parseForIn(e,r,n){let i=this.match(58);return this.next(),i?n!==null&&this.unexpected(n):e.await=n!==null,r.type==="VariableDeclaration"&&r.declarations[0].init!=null&&(!i||!this.options.annexB||this.state.strict||r.kind!=="var"||r.declarations[0].id.type!=="Identifier")&&this.raise(P.ForInOfLoopInitializer,r,{type:i?"ForInStatement":"ForOfStatement"}),r.type==="AssignmentPattern"&&this.raise(P.InvalidLhs,r,{ancestor:{type:"ForStatement"}}),e.left=r,e.right=i?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(11),e.body=this.withSmartMixTopicForbiddingContext(()=>this.parseStatement()),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")}parseVar(e,r,n,i=!1){let s=e.declarations=[];for(e.kind=n;;){let o=this.startNode();if(this.parseVarId(o,n),o.init=this.eat(29)?r?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,o.init===null&&!i&&(o.id.type!=="Identifier"&&!(r&&(this.match(58)||this.isContextual(102)))?this.raise(P.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"}):(n==="const"||n==="using"||n==="await using")&&!(this.match(58)||this.isContextual(102))&&this.raise(P.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:n})),s.push(this.finishNode(o,"VariableDeclarator")),!this.eat(12))break}return e}parseVarId(e,r){let n=this.parseBindingAtom();r==="using"||r==="await using"?(n.type==="ArrayPattern"||n.type==="ObjectPattern")&&this.raise(P.UsingDeclarationHasBindingPattern,n.loc.start):n.type==="VoidPattern"&&this.raise(P.UnexpectedVoidPattern,n.loc.start),this.checkLVal(n,{type:"VariableDeclarator"},r==="var"?5:8201),e.id=n}parseAsyncFunctionExpression(e){return this.parseFunction(e,8)}parseFunction(e,r=0){let n=r&2,i=!!(r&1),s=i&&!(r&4),o=!!(r&8);this.initFunction(e,o),this.match(55)&&(n&&this.raise(P.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),e.generator=!0),i&&(e.id=this.parseFunctionId(s));let a=this.state.maybeInArrowParameters;return this.state.maybeInArrowParameters=!1,this.scope.enter(514),this.prodParam.enter(Dk(o,e.generator)),i||(e.id=this.parseFunctionId()),this.parseFunctionParams(e,!1),this.withSmartMixTopicForbiddingContext(()=>{this.parseFunctionBodyAndFinish(e,i?"FunctionDeclaration":"FunctionExpression")}),this.prodParam.exit(),this.scope.exit(),i&&!n&&this.registerFunctionStatementId(e),this.state.maybeInArrowParameters=a,e}parseFunctionId(e){return e||$t(this.state.type)?this.parseIdentifier():null}parseFunctionParams(e,r){this.expect(10),this.expressionScope.enter(j2e()),e.params=this.parseBindingList(11,41,2|(r?4:0)),this.expressionScope.exit()}registerFunctionStatementId(e){e.id&&this.scope.declareName(e.id.name,!this.options.annexB||this.state.strict||e.generator||e.async?this.scope.treatFunctionsAsVar?5:8201:17,e.id.loc.start)}parseClass(e,r,n){this.next();let i=this.state.strict;return this.state.strict=!0,this.parseClassId(e,r,n),this.parseClassSuper(e),e.body=this.parseClassBody(!!e.superClass,i),this.finishNode(e,r?"ClassDeclaration":"ClassExpression")}isClassProperty(){return this.match(29)||this.match(13)||this.match(8)}isClassMethod(){return this.match(10)}nameIsConstructor(e){return e.type==="Identifier"&&e.name==="constructor"||e.type==="StringLiteral"&&e.value==="constructor"}isNonstaticConstructor(e){return!e.computed&&!e.static&&this.nameIsConstructor(e.key)}parseClassBody(e,r){this.classScope.enter();let n={hadConstructor:!1,hadSuperClass:e},i=[],s=this.startNode();if(s.body=[],this.expect(5),this.withSmartMixTopicForbiddingContext(()=>{for(;!this.match(8);){if(this.eat(13)){if(i.length>0)throw this.raise(P.DecoratorSemicolon,this.state.lastTokEndLoc);continue}if(this.match(26)){i.push(this.parseDecorator());continue}let o=this.startNode();i.length&&(o.decorators=i,this.resetStartLocationFromNode(o,i[0]),i=[]),this.parseClassMember(s,o,n),o.kind==="constructor"&&o.decorators&&o.decorators.length>0&&this.raise(P.DecoratorConstructor,o)}}),this.state.strict=r,this.next(),i.length)throw this.raise(P.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(s,"ClassBody")}parseClassMemberFromModifier(e,r){let n=this.parseIdentifier(!0);if(this.isClassMethod()){let i=r;return i.kind="method",i.computed=!1,i.key=n,i.static=!1,this.pushClassMethod(e,i,!1,!1,!1,!1),!0}else if(this.isClassProperty()){let i=r;return i.computed=!1,i.key=n,i.static=!1,e.body.push(this.parseClassProperty(i)),!0}return this.resetPreviousNodeTrailingComments(n),!1}parseClassMember(e,r,n){let i=this.isContextual(106);if(i){if(this.parseClassMemberFromModifier(e,r))return;if(this.eat(5)){this.parseClassStaticBlock(e,r);return}}this.parseClassMemberWithIsStatic(e,r,n,i)}parseClassMemberWithIsStatic(e,r,n,i){let s=r,o=r,a=r,c=r,l=r,u=s,d=s;if(r.static=i,this.parsePropertyNamePrefixOperator(r),this.eat(55)){u.kind="method";let v=this.match(139);if(this.parseClassElementName(u),this.parsePostMemberNameModifiers(u),v){this.pushClassPrivateMethod(e,o,!0,!1);return}this.isNonstaticConstructor(s)&&this.raise(P.ConstructorIsGenerator,s.key),this.pushClassMethod(e,s,!0,!1,!1,!1);return}let p=!this.state.containsEsc&&$t(this.state.type),f=this.parseClassElementName(r),h=p?f.name:null,m=this.isPrivateName(f),y=this.state.startLoc;if(this.parsePostMemberNameModifiers(d),this.isClassMethod()){if(u.kind="method",m){this.pushClassPrivateMethod(e,o,!1,!1);return}let v=this.isNonstaticConstructor(s),g=!1;v&&(s.kind="constructor",n.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(P.DuplicateConstructor,f),v&&this.hasPlugin("typescript")&&r.override&&this.raise(P.OverrideOnConstructor,f),n.hadConstructor=!0,g=n.hadSuperClass),this.pushClassMethod(e,s,!1,!1,v,g)}else if(this.isClassProperty())m?this.pushClassPrivateProperty(e,c):this.pushClassProperty(e,a);else if(h==="async"&&!this.isLineTerminator()){this.resetPreviousNodeTrailingComments(f);let v=this.eat(55);d.optional&&this.unexpected(y),u.kind="method";let g=this.match(139);this.parseClassElementName(u),this.parsePostMemberNameModifiers(d),g?this.pushClassPrivateMethod(e,o,v,!0):(this.isNonstaticConstructor(s)&&this.raise(P.ConstructorIsAsync,s.key),this.pushClassMethod(e,s,v,!0,!1,!1))}else if((h==="get"||h==="set")&&!(this.match(55)&&this.isLineTerminator())){this.resetPreviousNodeTrailingComments(f),u.kind=h;let v=this.match(139);this.parseClassElementName(s),v?this.pushClassPrivateMethod(e,o,!1,!1):(this.isNonstaticConstructor(s)&&this.raise(P.ConstructorIsAccessor,s.key),this.pushClassMethod(e,s,!1,!1,!1,!1)),this.checkGetterSetterParams(s)}else if(h==="accessor"&&!this.isLineTerminator()){this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(f);let v=this.match(139);this.parseClassElementName(a),this.pushClassAccessorProperty(e,l,v)}else this.isLineTerminator()?m?this.pushClassPrivateProperty(e,c):this.pushClassProperty(e,a):this.unexpected()}parseClassElementName(e){let{type:r,value:n}=this.state;if((r===132||r===134)&&e.static&&n==="prototype"&&this.raise(P.StaticPrototype,this.state.startLoc),r===139){n==="constructor"&&this.raise(P.ConstructorClassPrivateField,this.state.startLoc);let i=this.parsePrivateName();return e.key=i,i}return this.parsePropertyName(e),e.key}parseClassStaticBlock(e,r){var n;this.scope.enter(720);let i=this.state.labels;this.state.labels=[],this.prodParam.enter(0);let s=r.body=[];this.parseBlockOrModuleBlockBody(s,void 0,!1,8),this.prodParam.exit(),this.scope.exit(),this.state.labels=i,e.body.push(this.finishNode(r,"StaticBlock")),(n=r.decorators)!=null&&n.length&&this.raise(P.DecoratorStaticBlock,r)}pushClassProperty(e,r){!r.computed&&this.nameIsConstructor(r.key)&&this.raise(P.ConstructorClassField,r.key),e.body.push(this.parseClassProperty(r))}pushClassPrivateProperty(e,r){let n=this.parseClassPrivateProperty(r);e.body.push(n),this.classScope.declarePrivateName(this.getPrivateNameSV(n.key),0,n.key.loc.start)}pushClassAccessorProperty(e,r,n){!n&&!r.computed&&this.nameIsConstructor(r.key)&&this.raise(P.ConstructorClassField,r.key);let i=this.parseClassAccessorProperty(r);e.body.push(i),n&&this.classScope.declarePrivateName(this.getPrivateNameSV(i.key),0,i.key.loc.start)}pushClassMethod(e,r,n,i,s,o){e.body.push(this.parseMethod(r,n,i,s,o,"ClassMethod",!0))}pushClassPrivateMethod(e,r,n,i){let s=this.parseMethod(r,n,i,!1,!1,"ClassPrivateMethod",!0);e.body.push(s);let o=s.kind==="get"?s.static?6:2:s.kind==="set"?s.static?5:1:0;this.declareClassPrivateMethodInScope(s,o)}declareClassPrivateMethodInScope(e,r){this.classScope.declarePrivateName(this.getPrivateNameSV(e.key),r,e.key.loc.start)}parsePostMemberNameModifiers(e){}parseClassPrivateProperty(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassPrivateProperty")}parseClassProperty(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassProperty")}parseClassAccessorProperty(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassAccessorProperty")}parseInitializer(e){this.scope.enter(592),this.expressionScope.enter(EQ()),this.prodParam.enter(0),e.value=this.eat(29)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()}parseClassId(e,r,n,i=8331){if($t(this.state.type))e.id=this.parseIdentifier(),r&&this.declareNameFromIdentifier(e.id,i);else if(n||!r)e.id=null;else throw this.raise(P.MissingClassName,this.state.startLoc)}parseClassSuper(e){e.superClass=this.eat(81)?this.parseExprSubscripts():null}parseExport(e,r){let n=this.parseMaybeImportPhase(e,!0),i=this.maybeParseExportDefaultSpecifier(e,n),s=!i||this.eat(12),o=s&&this.eatExportStar(e),a=o&&this.maybeParseExportNamespaceSpecifier(e),c=s&&(!a||this.eat(12)),l=i||o;if(o&&!a){if(i&&this.unexpected(),r)throw this.raise(P.UnsupportedDecoratorExport,e);return this.parseExportFrom(e,!0),this.sawUnambiguousESM=!0,this.finishNode(e,"ExportAllDeclaration")}let u=this.maybeParseExportNamedSpecifiers(e);i&&s&&!o&&!u&&this.unexpected(null,5),a&&c&&this.unexpected(null,98);let d;if(l||u){if(d=!1,r)throw this.raise(P.UnsupportedDecoratorExport,e);this.parseExportFrom(e,l)}else d=this.maybeParseExportDeclaration(e);if(l||u||d){var p;let f=e;if(this.checkExport(f,!0,!1,!!f.source),((p=f.declaration)==null?void 0:p.type)==="ClassDeclaration")this.maybeTakeDecorators(r,f.declaration,f);else if(r)throw this.raise(P.UnsupportedDecoratorExport,e);return this.sawUnambiguousESM=!0,this.finishNode(f,"ExportNamedDeclaration")}if(this.eat(65)){let f=e,h=this.parseExportDefaultExpression();if(f.declaration=h,h.type==="ClassDeclaration")this.maybeTakeDecorators(r,h,f);else if(r)throw this.raise(P.UnsupportedDecoratorExport,e);return this.checkExport(f,!0,!0),this.sawUnambiguousESM=!0,this.finishNode(f,"ExportDefaultDeclaration")}throw this.unexpected(null,5)}eatExportStar(e){return this.eat(55)}maybeParseExportDefaultSpecifier(e,r){if(r||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",r?.loc.start);let n=r||this.parseIdentifier(!0),i=this.startNodeAtNode(n);return i.exported=n,e.specifiers=[this.finishNode(i,"ExportDefaultSpecifier")],!0}return!1}maybeParseExportNamespaceSpecifier(e){if(this.isContextual(93)){var r,n;(n=(r=e).specifiers)!=null||(r.specifiers=[]);let i=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),i.exported=this.parseModuleExportName(),e.specifiers.push(this.finishNode(i,"ExportNamespaceSpecifier")),!0}return!1}maybeParseExportNamedSpecifiers(e){if(this.match(5)){let r=e;r.specifiers||(r.specifiers=[]);let n=r.exportKind==="type";return r.specifiers.push(...this.parseExportSpecifiers(n)),r.source=null,this.hasPlugin("importAssertions")?r.assertions=[]:r.attributes=[],r.declaration=null,!0}return!1}maybeParseExportDeclaration(e){return this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,this.hasPlugin("importAssertions")?e.assertions=[]:e.attributes=[],e.declaration=this.parseExportDeclaration(e),!0):!1}isAsyncFunction(){if(!this.isContextual(95))return!1;let e=this.nextTokenInLineStart();return this.isUnparsedContextual(e,"function")}parseExportDefaultExpression(){let e=this.startNode();if(this.match(68))return this.next(),this.parseFunction(e,5);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(e,13);if(this.match(80))return this.parseClass(e,!0,!0);if(this.match(26))return this.hasPlugin("decorators")&&this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(P.DecoratorBeforeExport,this.state.startLoc),this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(75)||this.match(74)||this.isLet()||this.isUsing()||this.isAwaitUsing())throw this.raise(P.UnsupportedDefaultExport,this.state.startLoc);let r=this.parseMaybeAssignAllowIn();return this.semicolon(),r}parseExportDeclaration(e){return this.match(80)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()}isExportDefaultSpecifier(){let{type:e}=this.state;if($t(e)){if(e===95&&!this.state.containsEsc||e===100)return!1;if((e===130||e===129)&&!this.state.containsEsc){let i=this.nextTokenStart(),s=this.input.charCodeAt(i);if(s===123||this.chStartsBindingIdentifier(s,i)&&!this.input.startsWith("from",i))return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(65))return!1;let r=this.nextTokenStart(),n=this.isUnparsedContextual(r,"from");if(this.input.charCodeAt(r)===44||$t(this.state.type)&&n)return!0;if(this.match(65)&&n){let i=this.input.charCodeAt(this.nextTokenStartSince(r+4));return i===34||i===39}return!1}parseExportFrom(e,r){this.eatContextual(98)?(e.source=this.parseImportSource(),this.checkExport(e),this.maybeParseImportAttributes(e),this.checkJSONModuleImport(e)):r&&this.unexpected(),this.semicolon()}shouldParseExportDeclaration(){let{type:e}=this.state;return e===26&&(this.expectOnePlugin(["decorators","decorators-legacy"]),this.hasPlugin("decorators"))?(this.getPluginOption("decorators","decoratorsBeforeExport")===!0&&this.raise(P.DecoratorBeforeExport,this.state.startLoc),!0):this.isUsing()?(this.raise(P.UsingDeclarationExport,this.state.startLoc),!0):this.isAwaitUsing()?(this.raise(P.UsingDeclarationExport,this.state.startLoc),!0):e===74||e===75||e===68||e===80||this.isLet()||this.isAsyncFunction()}checkExport(e,r,n,i){if(r){var s;if(n){if(this.checkDuplicateExports(e,"default"),this.hasPlugin("exportDefaultFrom")){var o;let a=e.declaration;a.type==="Identifier"&&a.name==="from"&&a.end-a.start===4&&!((o=a.extra)!=null&&o.parenthesized)&&this.raise(P.ExportDefaultFromAsIdentifier,a)}}else if((s=e.specifiers)!=null&&s.length)for(let a of e.specifiers){let{exported:c}=a,l=c.type==="Identifier"?c.name:c.value;if(this.checkDuplicateExports(a,l),!i&&a.local){let{local:u}=a;u.type!=="Identifier"?this.raise(P.ExportBindingIsString,a,{localName:u.value,exportName:l}):(this.checkReservedWord(u.name,u.loc.start,!0,!1),this.scope.checkLocalExport(u))}}else if(e.declaration){let a=e.declaration;if(a.type==="FunctionDeclaration"||a.type==="ClassDeclaration"){let{id:c}=a;if(!c)throw new Error("Assertion failure");this.checkDuplicateExports(e,c.name)}else if(a.type==="VariableDeclaration")for(let c of a.declarations)this.checkDeclaration(c.id)}}}checkDeclaration(e){if(e.type==="Identifier")this.checkDuplicateExports(e,e.name);else if(e.type==="ObjectPattern")for(let r of e.properties)this.checkDeclaration(r);else if(e.type==="ArrayPattern")for(let r of e.elements)r&&this.checkDeclaration(r);else e.type==="ObjectProperty"?this.checkDeclaration(e.value):e.type==="RestElement"?this.checkDeclaration(e.argument):e.type==="AssignmentPattern"&&this.checkDeclaration(e.left)}checkDuplicateExports(e,r){this.exportedIdentifiers.has(r)&&(r==="default"?this.raise(P.DuplicateDefaultExport,e):this.raise(P.DuplicateExport,e,{exportName:r})),this.exportedIdentifiers.add(r)}parseExportSpecifiers(e){let r=[],n=!0;for(this.expect(5);!this.eat(8);){if(n)n=!1;else if(this.expect(12),this.eat(8))break;let i=this.isContextual(130),s=this.match(134),o=this.startNode();o.local=this.parseModuleExportName(),r.push(this.parseExportSpecifier(o,s,e,i))}return r}parseExportSpecifier(e,r,n,i){return this.eatContextual(93)?e.exported=this.parseModuleExportName():r?e.exported=this.cloneStringLiteral(e.local):e.exported||(e.exported=this.cloneIdentifier(e.local)),this.finishNode(e,"ExportSpecifier")}parseModuleExportName(){if(this.match(134)){let e=this.parseStringLiteral(this.state.value),r=Y2e.exec(e.value);return r&&this.raise(P.ModuleExportNameHasLoneSurrogate,e,{surrogateCharCode:r[0].charCodeAt(0)}),e}return this.parseIdentifier(!0)}isJSONModuleImport(e){return e.assertions!=null?e.assertions.some(({key:r,value:n})=>n.value==="json"&&(r.type==="Identifier"?r.name==="type":r.value==="type")):!1}checkImportReflection(e){let{specifiers:r}=e,n=r.length===1?r[0].type:null;if(e.phase==="source")n!=="ImportDefaultSpecifier"&&this.raise(P.SourcePhaseImportRequiresDefault,r[0].loc.start);else if(e.phase==="defer")n!=="ImportNamespaceSpecifier"&&this.raise(P.DeferImportRequiresNamespace,r[0].loc.start);else if(e.module){var i;n!=="ImportDefaultSpecifier"&&this.raise(P.ImportReflectionNotBinding,r[0].loc.start),((i=e.assertions)==null?void 0:i.length)>0&&this.raise(P.ImportReflectionHasAssertion,r[0].loc.start)}}checkJSONModuleImport(e){if(this.isJSONModuleImport(e)&&e.type!=="ExportAllDeclaration"){let{specifiers:r}=e;if(r!=null){let n=r.find(i=>{let s;if(i.type==="ExportSpecifier"?s=i.local:i.type==="ImportSpecifier"&&(s=i.imported),s!==void 0)return s.type==="Identifier"?s.name!=="default":s.value!=="default"});n!==void 0&&this.raise(P.ImportJSONBindingNotDefault,n.loc.start)}}}isPotentialImportPhase(e){return e?!1:this.isContextual(105)||this.isContextual(97)||this.isContextual(127)}applyImportPhase(e,r,n,i){r||(n==="module"?(this.expectPlugin("importReflection",i),e.module=!0):this.hasPlugin("importReflection")&&(e.module=!1),n==="source"?(this.expectPlugin("sourcePhaseImports",i),e.phase="source"):n==="defer"?(this.expectPlugin("deferredImportEvaluation",i),e.phase="defer"):this.hasPlugin("sourcePhaseImports")&&(e.phase=null))}parseMaybeImportPhase(e,r){if(!this.isPotentialImportPhase(r))return this.applyImportPhase(e,r,null),null;let n=this.startNode(),i=this.parseIdentifierName(!0),{type:s}=this.state;return(Zs(s)?s!==98||this.lookaheadCharCode()===102:s!==12)?(this.applyImportPhase(e,r,i,n.loc.start),null):(this.applyImportPhase(e,r,null),this.createIdentifier(n,i))}isPrecedingIdImportPhase(e){let{type:r}=this.state;return $t(r)?r!==98||this.lookaheadCharCode()===102:r!==12}parseImport(e){return this.match(134)?this.parseImportSourceAndAttributes(e):this.parseImportSpecifiersAndAfter(e,this.parseMaybeImportPhase(e,!1))}parseImportSpecifiersAndAfter(e,r){e.specifiers=[];let i=!this.maybeParseDefaultImportSpecifier(e,r)||this.eat(12),s=i&&this.maybeParseStarImportSpecifier(e);return i&&!s&&this.parseNamedImportSpecifiers(e),this.expectContextual(98),this.parseImportSourceAndAttributes(e)}parseImportSourceAndAttributes(e){var r;return(r=e.specifiers)!=null||(e.specifiers=[]),e.source=this.parseImportSource(),this.maybeParseImportAttributes(e),this.checkImportReflection(e),this.checkJSONModuleImport(e),this.semicolon(),this.sawUnambiguousESM=!0,this.finishNode(e,"ImportDeclaration")}parseImportSource(){return this.match(134)||this.unexpected(),this.parseExprAtom()}parseImportSpecifierLocal(e,r,n){r.local=this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(r,n))}finishImportSpecifier(e,r,n=8201){return this.checkLVal(e.local,{type:r},n),this.finishNode(e,r)}parseImportAttributes(){this.expect(5);let e=[],r=new Set;do{if(this.match(8))break;let n=this.startNode(),i=this.state.value;if(r.has(i)&&this.raise(P.ModuleAttributesWithDuplicateKeys,this.state.startLoc,{key:i}),r.add(i),this.match(134)?n.key=this.parseStringLiteral(i):n.key=this.parseIdentifier(!0),this.expect(14),!this.match(134))throw this.raise(P.ModuleAttributeInvalidValue,this.state.startLoc);n.value=this.parseStringLiteral(this.state.value),e.push(this.finishNode(n,"ImportAttribute"))}while(this.eat(12));return this.expect(8),e}parseModuleAttributes(){let e=[],r=new Set;do{let n=this.startNode();if(n.key=this.parseIdentifier(!0),n.key.name!=="type"&&this.raise(P.ModuleAttributeDifferentFromType,n.key),r.has(n.key.name)&&this.raise(P.ModuleAttributesWithDuplicateKeys,n.key,{key:n.key.name}),r.add(n.key.name),this.expect(14),!this.match(134))throw this.raise(P.ModuleAttributeInvalidValue,this.state.startLoc);n.value=this.parseStringLiteral(this.state.value),e.push(this.finishNode(n,"ImportAttribute"))}while(this.eat(12));return e}maybeParseImportAttributes(e){let r;var n=!1;if(this.match(76)){if(this.hasPrecedingLineBreak()&&this.lookaheadCharCode()===40)return;this.next(),this.hasPlugin("moduleAttributes")?(r=this.parseModuleAttributes(),this.addExtra(e,"deprecatedWithLegacySyntax",!0)):r=this.parseImportAttributes(),n=!0}else this.isContextual(94)&&!this.hasPrecedingLineBreak()?(!this.hasPlugin("deprecatedImportAssert")&&!this.hasPlugin("importAssertions")&&this.raise(P.ImportAttributesUseAssert,this.state.startLoc),this.hasPlugin("importAssertions")||this.addExtra(e,"deprecatedAssertSyntax",!0),this.next(),r=this.parseImportAttributes()):r=[];!n&&this.hasPlugin("importAssertions")?e.assertions=r:e.attributes=r}maybeParseDefaultImportSpecifier(e,r){if(r){let n=this.startNodeAtNode(r);return n.local=r,e.specifiers.push(this.finishImportSpecifier(n,"ImportDefaultSpecifier")),!0}else if(Zs(this.state.type))return this.parseImportSpecifierLocal(e,this.startNode(),"ImportDefaultSpecifier"),!0;return!1}maybeParseStarImportSpecifier(e){if(this.match(55)){let r=this.startNode();return this.next(),this.expectContextual(93),this.parseImportSpecifierLocal(e,r,"ImportNamespaceSpecifier"),!0}return!1}parseNamedImportSpecifiers(e){let r=!0;for(this.expect(5);!this.eat(8);){if(r)r=!1;else{if(this.eat(14))throw this.raise(P.DestructureNamedImport,this.state.startLoc);if(this.expect(12),this.eat(8))break}let n=this.startNode(),i=this.match(134),s=this.isContextual(130);n.imported=this.parseModuleExportName();let o=this.parseImportSpecifier(n,i,e.importKind==="type"||e.importKind==="typeof",s,void 0);e.specifiers.push(o)}}parseImportSpecifier(e,r,n,i,s){if(this.eatContextual(93))e.local=this.parseIdentifier();else{let{imported:o}=e;if(r)throw this.raise(P.ImportBindingIsString,e,{importName:o.value});this.checkReservedWord(o.name,e.loc.start,!0,!0),e.local||(e.local=this.cloneIdentifier(o))}return this.finishImportSpecifier(e,"ImportSpecifier",s)}isThisParam(e){return e.type==="Identifier"&&e.name==="this"}},Fk=class extends gL{constructor(e,r,n){let i=Kje(e);super(i,r),this.options=i,this.initializeScopes(),this.plugins=n,this.filename=i.sourceFilename,this.startIndex=i.startIndex;let s=0;i.allowAwaitOutsideFunction&&(s|=1),i.allowReturnOutsideFunction&&(s|=2),i.allowImportExportEverywhere&&(s|=8),i.allowSuperOutsideMethod&&(s|=16),i.allowUndeclaredExports&&(s|=64),i.allowNewTargetOutsideFunction&&(s|=4),i.allowYieldOutsideFunction&&(s|=32),i.ranges&&(s|=128),i.tokens&&(s|=256),i.createImportExpressions&&(s|=512),i.createParenthesizedExpressions&&(s|=1024),i.errorRecovery&&(s|=2048),i.attachComment&&(s|=4096),i.annexB&&(s|=8192),this.optionFlags=s}getScopeHandler(){return wb}parse(){this.enterInitialScopes();let e=this.startNode(),r=this.startNode();this.nextToken(),e.errors=null;let n=this.parseTopLevel(e,r);return n.errors=this.state.errors,n.comments.length=this.state.commentsLen,n}};function Q2e(t,e){var r;if(((r=e)==null?void 0:r.sourceType)==="unambiguous"){e=Object.assign({},e);try{e.sourceType="module";let n=vb(e,t),i=n.parse();if(n.sawUnambiguousESM)return i;if(n.ambiguousScriptDifferentAst)try{return e.sourceType="script",vb(e,t).parse()}catch{}else i.program.sourceType="script";return i}catch(n){try{return e.sourceType="script",vb(e,t).parse()}catch{}throw n}}else return vb(e,t).parse()}function eLe(t,e){let r=vb(e,t);return r.options.strictMode&&(r.state.strict=!0),r.getExpression()}function tLe(t){let e={};for(let r of Object.keys(t))e[r]=La(t[r]);return e}var rLe=tLe(e2e);function vb(t,e){let r=Fk,n=new Map;if(t!=null&&t.plugins){for(let i of t.plugins){let s,o;typeof i=="string"?s=i:[s,o]=i,n.has(s)||n.set(s,o||{})}Z2e(n),r=nLe(n)}return new r(t,e,n)}var hQ=new Map;function nLe(t){let e=[];for(let i of J2e)t.has(i)&&e.push(i);let r=e.join("|"),n=hQ.get(r);if(!n){n=Fk;for(let i of e)n=IQ[i](n);hQ.set(r,n)}return n}kb.parse=Q2e;kb.parseExpression=eLe;kb.tokTypes=rLe});function zk(t){let e=(0,RQ.parse)(t.source,{sourceType:"unambiguous",plugins:["typescript","jsx"]}),r=[],n=[],i=t.framework??"vitest",s=(a,c)=>{let l=a.arguments?.[0];if(!PQ(l))return;let u=l.value,d=iLe.exec(u);if(!d)return;let f=[...d[1].matchAll(sLe)].map(y=>y[1]),h=l.loc?.start??{line:1,column:0},m=i==="vitest"&&c.length>0?[...c,u].join(" > "):u;for(let y of f){if(!t.knownCriteria.has(y)){n.push({code:"UNKNOWN_CRITERION",criterion:y,file:t.file,line:h.line,column:h.column+1});continue}r.push({criterion:y,framework:i,file:pLe(t.file),selector:m,carrier:"title"})}},o=(a,c)=>{for(let l of a){let u=aLe(l);if(u){if(uLe(u.callee)){let d=u.arguments?.[0],p=u.arguments?.[1];if(!PQ(d)||!cLe(p))continue;o(p.body.body,[...c,d.value]);continue}lLe(u.callee)&&s(u,c)}}};return o(oLe(e),[]),{bindings:r.sort(fLe),diagnostics:n.sort((a,c)=>`${a.file}:${a.line}:${a.criterion}`.localeCompare(`${c.file}:${c.line}:${c.criterion}`))}}function oLe(t){let e=t;return Array.isArray(e.program?.body)?e.program.body:[]}function aLe(t){let e=t;if(e.type!=="ExpressionStatement")return null;let r=e.expression;return r?.type==="CallExpression"?r:null}function PQ(t){let e=t;return e?.type==="StringLiteral"&&typeof e.value=="string"}function cLe(t){let e=t;if(e?.type!=="ArrowFunctionExpression"&&e?.type!=="FunctionExpression")return!1;let r=e.body;return r?.type==="BlockStatement"&&Array.isArray(r.body)}function Xu(t){let e=t.filter(r=>r.nodeType==="semantic"&&r.kind==="criterion"&&r.address.startsWith("criterion:")).map(r=>r.address.slice(10));return new Set(e)}function lLe(t){return CQ(t,new Set(["it","test"]))}function uLe(t){return CQ(t,new Set(["describe","suite"]))}function CQ(t,e){let r=t;for(;r?.type==="MemberExpression";){let n=r.property;if(r.computed||n?.type!=="Identifier"||!dLe.has(n.name??""))return!1;r=r.object}return r?.type==="Identifier"&&e.has(r.name??"")}function pLe(t){return t.replaceAll("\\","/").replace(/^\.\//,"")}function fLe(t,e){return`${t.criterion}\0${t.file}\0${t.selector}`.localeCompare(`${e.criterion}\0${e.file}\0${e.selector}`)}var RQ,iLe,sLe,dLe,Uk=S(()=>{"use strict";RQ=Et(AL(),1),iLe=/^((?:\[covers:(F-[a-z0-9]+\/AC-[a-z0-9]+)\])+)/i,sLe=/\[covers:(F-[a-z0-9]+\/AC-[a-z0-9]+)\]/gi;dLe=new Set(["only","skip","concurrent"])});import{createHash as hLe}from"node:crypto";import{lstatSync as TQ,readFileSync as mLe,readdirSync as gLe}from"node:fs";import{join as OQ,relative as yLe,resolve as bLe}from"node:path";function Qu(t,e){return Fa(t,Xu(e.nodes)).bindings}function Fa(t,e){let r="tests";try{let n=TQ(OQ(t,r));if(n.isSymbolicLink()||!n.isDirectory())return Bk("unsafe")}catch(n){return n.code==="ENOENT"?Bk("absent"):Bk("unsafe")}try{let n=Rk(t,r),i=[],s=u=>{for(let d of gLe(u,{withFileTypes:!0}).sort((p,f)=>NQ(p.name,f.name))){let p=OQ(u,d.name),f=yLe(bLe(t),p).replaceAll("\\","/");xn(t,f);let h=TQ(p);if(d.isSymbolicLink()||h.isSymbolicLink())throw new Error("unsafe proof link");h.isDirectory()?s(p):h.isFile()&&/\.(?:[cm]?[jt]sx?)$/.test(d.name)&&/\.(?:test|spec)\.[cm]?[jt]sx?$/.test(d.name)&&i.push(f)}};s(n);let o=[],a=!0,c=[],l=i.sort(NQ).flatMap(u=>{try{let d=mLe(xn(t,u)),p=d.toString("utf8");o.push({file:u,sha256:$L(d)});let f=zk({file:u,source:p,knownCriteria:e});return c.push(...f.diagnostics),f.bindings}catch(d){return a=!1,o.push({file:u,sha256:``}),[]}});return{bindings:a?l:[],diagnostics:c.sort(vLe),digest:$L(JSON.stringify(o)),safe:a}}catch{return Bk("unsafe")}}function NQ(t,e){return te?1:0}function Bk(t){return{bindings:[],diagnostics:[],digest:$L(t),safe:t==="absent"}}function vLe(t,e){return`${t.file}\0${t.line}\0${t.column}\0${t.criterion}`.localeCompare(`${e.file}\0${e.line}\0${e.column}\0${e.criterion}`)}function $L(t){return hLe("sha256").update(t).digest("hex")}var Uf=S(()=>{"use strict";Zu();Uk()});import{createHash as _Le}from"node:crypto";import{existsSync as SLe,readFileSync as wLe,statSync as xLe}from"node:fs";import{isAbsolute as kLe}from"node:path";function ed(t){let e=t.live.filter(s=>s.criterion===t.criterion);if(e.length>0)return{criterion:t.criterion,source:"live",live:[...e],reviewed:[],legacy:[]};let r=t.baseline?.reviewedCarryForwards?.find(s=>s.criterion===`criterion:${t.criterion}`);if(r&&SX(t.baseline,t.criterion,t.currentCriterion)){let s=r.bindings.map(o=>ELe(t.cwd,t.criterion,o));return{criterion:t.criterion,source:"reviewed",live:[],reviewed:s,legacy:[]}}if(t.baseline?.schema!==1||t.baseline.sourceSchema!=="0.1")return{criterion:t.criterion,source:"none",live:[],reviewed:[],legacy:[]};if(!Bn(t.baseline,`criterion:${t.criterion}`,t.currentCriterion))return{criterion:t.criterion,source:"none",live:[],reviewed:[],legacy:[]};let n=t.baseline?.criteria.find(s=>s.address===`criterion:${t.criterion}`);if(!n)return{criterion:t.criterion,source:"none",live:[],reviewed:[],legacy:[]};let i=n.bindings.filter(s=>s.channel==="test").map(s=>qk(t.cwd,t.criterion,s.raw,s.selector));return{criterion:t.criterion,source:i.length>0?"legacy":"none",live:[],reviewed:[],legacy:i}}function ELe(t,e,r){let n=qk(t,e,r.raw,r.selector),i=n.state==="available"&&n.file===r.file&&n.selector===r.selector&&n.sha256===r.sha256?"available":n.state==="unsafe"?"unsafe":"stale";return{criterion:e,raw:r.raw,file:r.file,...r.selector===void 0?{}:{selector:r.selector},sha256:r.sha256,state:i,provenance:"reviewed_carry_forward"}}function qk(t,e,r,n){let[i,s]=r.split("#",2),o=n??s,a=ALe(i);if(!a||kLe(i))return{criterion:e,raw:r,file:a,...o?{selector:o}:{},state:"stale",provenance:"legacy_test_ref"};let c;try{c=xn(t,a)}catch(l){if(l instanceof Hs)return{criterion:e,raw:r,file:a,...o?{selector:o}:{},state:"unsafe",provenance:"legacy_test_ref"};throw l}return!SLe(c)||!xLe(c).isFile()?{criterion:e,raw:r,file:a,...o?{selector:o}:{},state:"stale",provenance:"legacy_test_ref"}:{criterion:e,raw:r,file:a,...o?{selector:o}:{},sha256:_Le("sha256").update(wLe(c)).digest("hex"),state:"available",provenance:"legacy_test_ref"}}function ALe(t){return t.replaceAll("\\","/").replace(/^\.\//,"")}var Eb=S(()=>{"use strict";Vu();Zu()});function Vk(t){if(t.schemaVersion!=="0.2")throw new Error("Schema 0.2 compiler consumers require a schema 0.2 workspace.");let e=t.diagnostics.filter(n=>n.severity!=="advisory");if(t.contract&&e.length===0)return t.contract;let r=e.map(n=>n.message).join("; ");throw new Error(`Schema 0.2 compiler contract is unavailable${r?`: ${r}`:""}. Correct the specification before continuing.`)}var IL=S(()=>{"use strict"});import{resolve as $Le}from"node:path";function Gk(t,e,r){let n=Vk(e),i=CLe(e),s=r?.bindings??Qu(t,e);return{schema:"0.2",project:ILe(n.project),features:n.features.map(o=>PLe(t,o,TLe(i,o.id),e,s)),scenarios:n.scenarios.map(o=>({id:o.id,title:o.title,features:[...o.featureRefs]})),capabilities:n.capabilities.map(o=>({id:o.id,title:o.title,summary:o.outcome,features:n.features.filter(a=>a.capabilityRefs.includes(o.id)).map(a=>a.id)})),architecture:{layers:n.architecture.layers.map(o=>[...o]),forbidden_imports:n.architecture.rules.map(o=>({from:o.from,to:o.to}))},...n.inventory===void 0?{}:{inventory:{features:n.inventory.features,scenarios:n.inventory.scenarios,capabilities:n.inventory.capabilities,test_files:n.inventory.testFiles}}}}function DQ(t,e){return[...new Set(e.nodes.filter(r=>r.nodeType==="artifact"&&r.roles.includes("spec")&&r.address.startsWith("artifact:")).map(r=>r.address.slice(9)).filter(r=>/\.ya?ml$/i.test(r)))].sort().map(r=>$Le(t,r))}function ILe(t){let e=t.retainedPolicies;return{name:t.name,language:t.language,...t.description===void 0?{}:{description:t.description},...t.version===void 0?{}:{version:t.version},...t.repository===void 0?{}:{repository:t.repository},...t.onboardingSeeded===void 0?{}:{onboarding_seeded:t.onboardingSeeded},..."purpose"in t?{intent_summary:t.purpose}:{},...e}}function PLe(t,e,r,n,i){return{id:e.id,slug:el(r,e.id),title:e.title,status:e.status,...e.modules===void 0?{}:{modules:[...e.modules]},...e.dependsOn===void 0?{}:{depends_on:[...e.dependsOn]},...e.designImpact===void 0?{}:{design_impact:e.designImpact},...e.archivedAt===void 0?{}:{archived_at:e.archivedAt},...e.archiveReason===void 0?{}:{archive_reason:e.archiveReason},...e.supersededBy===void 0?{}:{superseded_by:e.supersededBy},...e.blockedReason===void 0?{}:{blocked_reason:e.blockedReason},acceptance_criteria:e.acceptanceCriteria.map(s=>RLe(t,e.id,s,n,i))}}function RLe(t,e,r,n,i){let s=`${e}/${r.id}`,o=ed({cwd:t,baseline:n.migrationBaseline,criterion:s,currentCriterion:Bf(r,n.migrationBaseline,s),live:i}),a=o.source==="live"?o.live.map(c=>`${c.file}#${c.selector}`):o.source==="reviewed"?o.reviewed.map(c=>c.raw):o.legacy.map(c=>c.raw);return{id:r.id,text:r.statement,...a.length===0?{}:{test_refs:a},...r.oracleRefs===void 0?{}:{oracle_refs:[...r.oracleRefs]},...r.evidenceRefs===void 0?{}:{evidence_refs:[...r.evidenceRefs]},...r.notes===void 0?{}:{notes:r.notes}}}function Bf(t,e,r){let n="baselineIdentity"in t&&r?e?.criteria.find(s=>s.address===`criterion:${r}`)?.legacyIntent.constraint_refs:void 0,i=n===void 0?t.constraintRefs:n.split(",");return{statement:t.statement,kind:t.kind,...t.rationale===void 0?{}:{rationale:t.rationale},...n===void 0&&i.length===0?{}:{constraint_refs:[...i]}}}function CLe(t){return new Map(t.nodes.filter(e=>e.nodeType==="semantic"&&e.kind==="feature"&&e.address.startsWith("feature:")).map(e=>[e.address.slice(8),e.source.path]))}function TLe(t,e){let r=t.get(e);if(!r)throw new Error(`Schema 0.2 compiler compatibility view cannot locate feature shard for ${e}.`);return r}var Ab=S(()=>{"use strict";Uf();Eb();IL();Li()});var ll=k((pi,TL)=>{"use strict";var PL=pi.ValidationError=function(e,r,n,i,s,o){if(Array.isArray(i)?(this.path=i,this.property=i.reduce(function(c,l){return c+LQ(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=s,this.argument=o,this.stack=this.toString()};PL.prototype.toString=function(){return this.property+" "+this.message};var Hk=pi.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};Hk.prototype.addError=function(e){var r;if(typeof e=="string")r=new PL(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 PL(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(r),this.throwFirst)throw new td(this);if(this.throwError)throw r;return r};Hk.prototype.importErrors=function(e){typeof e=="string"||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))};function OLe(t,e){return e+": "+t.toString()+` +`}Hk.prototype.toString=function(e){return this.errors.map(OLe).join("")};Object.defineProperty(Hk.prototype,"valid",{get:function(){return!this.errors.length}});TL.exports.ValidatorResultError=td;function td(t){typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,td),this.instance=t.instance,this.schema=t.schema,this.options=t.options,this.errors=t.errors}td.prototype=new Error;td.prototype.constructor=td;td.prototype.name="Validation Error";var jQ=pi.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};jQ.prototype=Object.create(Error.prototype,{constructor:{value:jQ,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var RL=pi.SchemaContext=function(e,r,n,i,s){this.schema=e,this.options=r,Array.isArray(n)?(this.path=n,this.propertyPath=n.reduce(function(o,a){return o+LQ(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=s};RL.prototype.resolve=function(e){return MQ(this.base,e)};RL.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let s=MQ(this.base,i||"");var o=new RL(e,this.options,n,s,Object.create(this.schemas));return i&&!o.schemas[s]&&(o.schemas[s]=e),o};var Js=pi.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]+$/};Js.regexp=Js.regex;Js.pattern=Js.regex;Js.ipv4=Js["ip-address"];pi.isFormat=function(e,r,n){if(typeof e=="string"&&Js[r]!==void 0){if(Js[r]instanceof RegExp)return Js[r].test(e);if(typeof Js[r]=="function")return Js[r](e)}else if(n&&n.customFormats&&typeof n.customFormats[r]=="function")return n.customFormats[r](e);return!0};var LQ=pi.makeSuffix=function(e){return e=e.toString(),!e.match(/[.\s\[\]]/)&&!e.match(/^[\d]/)?"."+e:e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]"};pi.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(s,o){return t(e[o],r[o])});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(s){return t(e[s],r[s])})}return e===r};function NLe(t,e,r,n){typeof r=="object"?e[n]=CL(t[n],r):t.indexOf(r)===-1&&e.push(r)}function DLe(t,e,r){e[r]=t[r]}function jLe(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=CL(t[n],e[n]):r[n]=e[n]}function CL(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(NLe.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(DLe.bind(null,t,n)),Object.keys(e).forEach(jLe.bind(null,t,e,n))),n}TL.exports.deepMerge=CL;pi.objectGetPath=function(e,r){for(var n=r.split("/").slice(1),i;typeof(i=n.shift())=="string";){var s=decodeURIComponent(i.replace(/~0/,"~").replace(/~1/g,"/"));if(!(s in e))return;e=e[s]}return e};function LLe(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}pi.encodePath=function(e){return e.map(LLe).join("")};pi.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};pi.isSchema=function(e){return typeof e=="object"&&e||typeof e=="boolean"};var MQ=pi.resolveUrl=function(e,r){let n=new URL(r,new URL(e,"resolve://"));if(n.protocol==="resolve:"){let{pathname:i,search:s,hash:o}=n;return i+s+o}return n.toString()}});var BQ=k((oIt,UQ)=>{"use strict";var zi=ll(),St=zi.ValidatorResult,ul=zi.SchemaError,OL={};OL.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var wt=OL.validators={};wt.type=function(e,r,n,i){if(e===void 0)return null;var s=new St(e,r,n,i),o=Array.isArray(r.type)?r.type:[r.type];if(!o.some(this.testType.bind(this,e,r,n,i))){var a=o.map(function(c){if(c){var l=c.$id||c.id;return l?"<"+l+">":c+""}});s.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return s};function NL(t,e,r,n,i){var s=e.throwError,o=e.throwAll;e.throwError=!1,e.throwAll=!1;var a=this.validateSchema(t,i,e,r);return e.throwError=s,e.throwAll=o,!a.valid&&n instanceof Function&&n(a),a.valid}wt.anyOf=function(e,r,n,i){if(e===void 0)return null;var s=new St(e,r,n,i),o=new St(e,r,n,i);if(!Array.isArray(r.anyOf))throw new ul("anyOf must be an array");if(!r.anyOf.some(NL.bind(this,e,n,i,function(c){o.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&&s.importErrors(o),s.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return s};wt.allOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.allOf))throw new ul("allOf must be an array");var s=new St(e,r,n,i),o=this;return r.allOf.forEach(function(a,c){var l=o.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+"]";s.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]:"}),s.importErrors(l)}}),s};wt.oneOf=function(e,r,n,i){if(e===void 0)return null;if(!Array.isArray(r.oneOf))throw new ul("oneOf must be an array");var s=new St(e,r,n,i),o=new St(e,r,n,i),a=r.oneOf.filter(NL.bind(this,e,n,i,function(l){o.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&&s.importErrors(o),s.addError({name:"oneOf",argument:c,message:"is not exactly one from "+c.join(",")})),s};wt.if=function(e,r,n,i){if(e===void 0)return null;if(!zi.isSchema(r.if))throw new Error('Expected "if" keyword to be a schema');var s=NL.call(this,e,n,i,null,r.if),o=new St(e,r,n,i),a;if(s){if(r.then===void 0)return;if(!zi.isSchema(r.then))throw new Error('Expected "then" keyword to be a schema');a=this.validateSchema(e,r.then,n,i.makeChild(r.then)),o.importErrors(a)}else{if(r.else===void 0)return;if(!zi.isSchema(r.else))throw new Error('Expected "else" keyword to be a schema');a=this.validateSchema(e,r.else,n,i.makeChild(r.else)),o.importErrors(a)}return o};function DL(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]}}wt.propertyNames=function(e,r,n,i){if(this.types.object(e)){var s=new St(e,r,n,i),o=r.propertyNames!==void 0?r.propertyNames:{};if(!zi.isSchema(o))throw new ul('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(DL(e,a)!==void 0){var c=this.validateSchema(a,o,n,i.makeChild(o));s.importErrors(c)}return s}};wt.properties=function(e,r,n,i){if(this.types.object(e)){var s=new St(e,r,n,i),o=r.properties||{};for(var a in o){var c=o[a];if(c!==void 0){if(c===null)throw new ul('Unexpected null, expected schema in "properties"');typeof n.preValidateProperty=="function"&&n.preValidateProperty(e,a,c,n,i);var l=DL(e,a),u=this.validateSchema(l,c,n,i.makeChild(c,a));u.instance!==s.instance[a]&&(s.instance[a]=u.instance),s.importErrors(u)}}return s}};function FQ(t,e,r,n,i,s){if(this.types.object(t)&&!(e.properties&&e.properties[i]!==void 0))if(e.additionalProperties===!1)s.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var o=e.additionalProperties||{};typeof r.preValidateProperty=="function"&&r.preValidateProperty(t,i,o,r,n);var a=this.validateSchema(t[i],o,r,n.makeChild(o,i));a.instance!==s.instance[i]&&(s.instance[i]=a.instance),s.importErrors(a)}}wt.patternProperties=function(e,r,n,i){if(this.types.object(e)){var s=new St(e,r,n,i),o=r.patternProperties||{};for(var a in e){var c=!0;for(var l in o){var u=o[l];if(u!==void 0){if(u===null)throw new ul('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 p=this.validateSchema(e[a],u,n,i.makeChild(u,a));p.instance!==s.instance[a]&&(s.instance[a]=p.instance),s.importErrors(p)}}}c&&FQ.call(this,e,r,n,i,a,s)}return s}};wt.additionalProperties=function(e,r,n,i){if(this.types.object(e)){if(r.patternProperties)return null;var s=new St(e,r,n,i);for(var o in e)FQ.call(this,e,r,n,i,o,s);return s}};wt.minProperties=function(e,r,n,i){if(this.types.object(e)){var s=new St(e,r,n,i),o=Object.keys(e);return o.length>=r.minProperties||s.addError({name:"minProperties",argument:r.minProperties,message:"does not meet minimum property length of "+r.minProperties}),s}};wt.maxProperties=function(e,r,n,i){if(this.types.object(e)){var s=new St(e,r,n,i),o=Object.keys(e);return o.length<=r.maxProperties||s.addError({name:"maxProperties",argument:r.maxProperties,message:"does not meet maximum property length of "+r.maxProperties}),s}};wt.items=function(e,r,n,i){var s=this;if(this.types.array(e)&&r.items!==void 0){var o=new St(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 o.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=s.validateSchema(a,l,n,i.makeChild(l,c));return u.instance!==o.instance[c]&&(o.instance[c]=u.instance),o.importErrors(u),!0}),o}};wt.contains=function(e,r,n,i){var s=this;if(this.types.array(e)&&r.contains!==void 0){if(!zi.isSchema(r.contains))throw new Error('Expected "contains" keyword to be a schema');var o=new St(e,r,n,i),a=e.some(function(c,l){var u=s.validateSchema(c,r.contains,n,i.makeChild(r.contains,l));return u.errors.length===0});return a===!1&&o.addError({name:"contains",argument:r.contains,message:"must contain an item matching given schema"}),o}};wt.minimum=function(e,r,n,i){if(this.types.number(e)){var s=new St(e,r,n,i);return r.exclusiveMinimum&&r.exclusiveMinimum===!0?e>r.minimum||s.addError({name:"minimum",argument:r.minimum,message:"must be greater than "+r.minimum}):e>=r.minimum||s.addError({name:"minimum",argument:r.minimum,message:"must be greater than or equal to "+r.minimum}),s}};wt.maximum=function(e,r,n,i){if(this.types.number(e)){var s=new St(e,r,n,i);return r.exclusiveMaximum&&r.exclusiveMaximum===!0?er.exclusiveMinimum;return o||s.addError({name:"exclusiveMinimum",argument:r.exclusiveMinimum,message:"must be strictly greater than "+r.exclusiveMinimum}),s}};wt.exclusiveMaximum=function(e,r,n,i){if(typeof r.exclusiveMaximum!="boolean"&&this.types.number(e)){var s=new St(e,r,n,i),o=e=r.minLength||s.addError({name:"minLength",argument:r.minLength,message:"does not meet minimum length of "+r.minLength}),s}};wt.maxLength=function(e,r,n,i){if(this.types.string(e)){var s=new St(e,r,n,i),o=e.match(/[\uDC00-\uDFFF]/g),a=e.length-(o?o.length:0);return a<=r.maxLength||s.addError({name:"maxLength",argument:r.maxLength,message:"does not meet maximum length of "+r.maxLength}),s}};wt.minItems=function(e,r,n,i){if(this.types.array(e)){var s=new St(e,r,n,i);return e.length>=r.minItems||s.addError({name:"minItems",argument:r.minItems,message:"does not meet minimum length of "+r.minItems}),s}};wt.maxItems=function(e,r,n,i){if(this.types.array(e)){var s=new St(e,r,n,i);return e.length<=r.maxItems||s.addError({name:"maxItems",argument:r.maxItems,message:"does not meet maximum length of "+r.maxItems}),s}};function MLe(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var jL=ll();LL.exports.SchemaScanResult=qQ;function qQ(t,e){this.id=t,this.ref=e}LL.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let f=jL.resolveUrl(c,l.$ref);a[f]=a[f]?a[f]+1:0;return}var u=l.$id||l.id;let d=jL.resolveUrl(c,u);var p=u?d:c;if(p){if(p.indexOf("#")<0&&(p+="#"),o[p]){if(!jL.deepCompareStrict(o[p],l))throw new Error("Schema <"+p+"> already exists with different definition");return o[p]}o[p]=l,p[p.length-1]=="#"&&(o[p.substring(0,p.length-1)]=l)}i(p+"/items",Array.isArray(l.items)?l.items:[l.items]),i(p+"/extends",Array.isArray(l.extends)?l.extends:[l.extends]),n(p+"/additionalItems",l.additionalItems),s(p+"/properties",l.properties),n(p+"/additionalProperties",l.additionalProperties),s(p+"/definitions",l.definitions),s(p+"/patternProperties",l.patternProperties),s(p+"/dependencies",l.dependencies),i(p+"/disallow",l.disallow),i(p+"/allOf",l.allOf),i(p+"/anyOf",l.anyOf),i(p+"/oneOf",l.oneOf),n(p+"/not",l.not)}function i(c,l){if(Array.isArray(l))for(var u=0;u{"use strict";var VQ=BQ(),dl=ll(),GQ=Wk().scan,HQ=dl.ValidatorResult,FLe=dl.ValidatorResultError,$b=dl.SchemaError,WQ=dl.SchemaContext,zLe="/",tn=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Uo),this.attributes=Object.create(VQ.validators)};tn.prototype.customFormats={};tn.prototype.schemas=null;tn.prototype.types=null;tn.prototype.attributes=null;tn.prototype.unresolvedRefs=null;tn.prototype.addSchema=function(e,r){var n=this;if(!e)return null;var i=GQ(r||zLe,e),s=r||e.$id||e.id;for(var o in i.id)this.schemas[o]=i.id[o];for(var o in i.ref)this.unresolvedRefs.push(o);return this.unresolvedRefs=this.unresolvedRefs.filter(function(a){return typeof n.schemas[a]>"u"}),this.schemas[s]};tn.prototype.addSubSchemaArray=function(e,r){if(Array.isArray(r))for(var n=0;n",e);var a=dl.objectGetPath(n.schemas[o],s.substr(1));if(a===void 0)throw new $b("no such schema "+s+" located in <"+o+">",e);return{subschema:a,switchSchema:r}};tn.prototype.testType=function(e,r,n,i,s){if(s!==void 0){if(s===null)throw new $b('Unexpected null in "type" keyword');if(typeof this.types[s]=="function")return this.types[s].call(this,e);if(s&&typeof s=="object"){var o=this.validateSchema(e,s,n,i);return o===void 0||!(o&&o.errors.length)}return!0}};var Uo=tn.prototype.types={};Uo.string=function(e){return typeof e=="string"};Uo.number=function(e){return typeof e=="number"&&isFinite(e)};Uo.integer=function(e){return typeof e=="number"&&e%1===0};Uo.boolean=function(e){return typeof e=="boolean"};Uo.array=function(e){return Array.isArray(e)};Uo.null=function(e){return e===null};Uo.date=function(e){return e instanceof Date};Uo.any=function(e){return!0};Uo.object=function(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Date)};JQ.exports=tn});var YQ=k((lIt,za)=>{"use strict";var ULe=za.exports.Validator=KQ();za.exports.ValidatorResult=ll().ValidatorResult;za.exports.ValidatorResultError=ll().ValidatorResultError;za.exports.ValidationError=ll().ValidationError;za.exports.SchemaError=ll().SchemaError;za.exports.SchemaScanResult=Wk().SchemaScanResult;za.exports.scan=Wk().scan;za.exports.validate=function(t,e,r){var n=new ULe;return n.validate(t,e,r)}});import{readFileSync as BLe}from"node:fs";import{dirname as qLe,join as VLe}from"node:path";import{fileURLToPath as GLe}from"node:url";function KLe(t){let e=JLe.validate(t,ZLe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function QQ(t){let e=KLe(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var AG,ibe,obe,sbe,abe,TG=y(()=>{"use strict";AG=wt(EG(),1),ibe=tbe(nbe(import.meta.url)),obe=rbe(ibe,"schema.json"),sbe=JSON.parse(ebe(obe,"utf8")),abe=new AG.Validator});import{existsSync as mR,readdirSync as lbe}from"node:fs";import{dirname as ube,join as Aa,resolve as IG}from"node:path";function RG(t){return mR(t)?lbe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Oa(t,e){J_=e?{cwd:IG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&IG(t)===J_.cwd?J_.spec:dbe(t,e)}function dbe(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,ube(e),"spec");if(!n.features||n.features.length===0){let o=RG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=RG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");mR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(mR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return OG(n),n}var J_,Ue=y(()=>{"use strict";V_();TG();J_=null});import $l from"node:process";function yR(){return!!$l.stdout.isTTY}function L(t,e,r=""){let n=PG[t],i=r?` ${r}`:"";yR()?$l.stdout.write(`${hR[t]}${n}${gR} ${e}${i} -`):$l.stdout.write(`${n} ${e}${i} -`)}function Yf(t,e,r=""){if(!yR())return;let n=r?` ${r}`:"";$l.stdout.write(`${CG}${hR.start}\xB7${gR} ${t} \xB7 ${e}${n}`)}function Ta(t,e,r=""){let n=PG[t],i=r?` ${r}`:"";yR()?$l.stdout.write(`${CG}${hR[t]}${n}${gR} ${e}${i} -`):$l.stdout.write(`${n} ${e}${i} -`)}var PG,hR,gR,CG,Pi=y(()=>{"use strict";PG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},hR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},gR="\x1B[0m",CG="\r\x1B[K"});import{createHash as vR}from"node:crypto";import{existsSync as Kbe,readFileSync as SR,writeFileSync as Jbe}from"node:fs";import{join as Y_}from"node:path";function oZ(t){let e=vR("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} -`)}),e.digest("hex")}function Ybe(t,e){let r=vR("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(SR(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function sZ(t,e){let r=vR("sha256");try{r.update(SR(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...iZ);if(!Kbe(e))return null;let r;try{r=SR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s={},a="other";for(let l of r.split(` -`)){if(l==="policy:"){a="policy";continue}if(l==="attested:"){a="v1",n??=new Map;continue}if(l==="attested_modules:"){a="modules",i??=new Map;continue}if(l==="attested_features:"){a="features",o??=new Set;continue}if(!(l.startsWith("#")||l.trim()==="")){if(a==="policy"){let u=l.match(/^ {2}cladding: "([^"]+)"$/),d=l.match(/^ {2}blocking: (strict)$/),f=l.match(/^ {2}detectors_sha256: ([0-9a-f]{64})$/);u&&(s.cladding=u[1]),d&&(s.blocking=d[1]),f&&(s.detectorsSha256=f[1])}else if(a==="v1"){let u=l.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);u&&n.set(u[1],u[2])}else if(a==="modules"){let u=l.match(/^ {2}(.+): ([0-9a-f]{16})$/);u&&i.set(u[1],u[2])}else if(a==="features"){let u=l.match(/^ {2}(F-[\w-]+): ok$/);u&&o.add(u[1])}}}return{policy:s.cladding!==void 0&&s.blocking==="strict"&&s.detectorsSha256!==void 0?{cladding:s.cladding,blocking:s.blocking,detectorsSha256:s.detectorsSha256}:null,v1:n,modules:i,features:o}}function X_(t){return t.features?.size??t.v1?.size??0}function Q_(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let o=t.modules??new Map;for(let s of[...n].sort())if(o.get(s)!==sZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Ybe(e,n)?{state:"fresh"}:{state:"stale"}}function aZ(t,e,r){let n=(e.features??[]).filter(c=>c.status==="done"&&(c.modules??[]).length>0);if(n.length===0)return!1;let i=new Set;for(let c of n)for(let l of c.modules??[])i.add(l);let o=[...i].sort().map(c=>` ${c}: ${sZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Xbe+(r?`policy: - cladding: ${JSON.stringify(r.cladding)} - blocking: ${r.blocking} - detectors_sha256: ${r.detectorsSha256} -`:"")+`attested_modules: -`+o.join(` + `)}`)}var XQ,HLe,WLe,ZLe,JLe,eee=S(()=>{"use strict";XQ=Et(YQ(),1),HLe=qLe(GLe(import.meta.url)),WLe=VLe(HLe,"schema.json"),ZLe=JSON.parse(BLe(WLe,"utf8")),JLe=new XQ.Validator});import{existsSync as ML,readdirSync as YLe}from"node:fs";import{dirname as XLe,join as rd,resolve as nd}from"node:path";function Zk(t,e){let r=ju(t);return e?.add(nd(t)),r}function tee(t,e){return ML(t)?YLe(t).filter(n=>n.endsWith(".yaml")||n.endsWith(".yml")).sort().map(n=>Zk(rd(t,n),e)):[]}function id(t,e,r=[]){Bo=e?{cwd:nd(t),spec:e,parsedPaths:new Set(r.map(n=>nd(n)))}:null}function ree(t,e){return Bo?.cwd===nd(t)&&Bo.parsedPaths.has(nd(e))}function oe(t=".",e="spec.yaml"){let r=e==="spec.yaml"?cb(t):void 0;return r||(Bo&&e==="spec.yaml"&&nd(t)===Bo.cwd?Bo.spec:To(t,()=>pl(t,e)))}function nee(t=".",e="spec.yaml"){let r=e==="spec.yaml"?cb(t):void 0;if(r)return{spec:r,parsedPaths:[]};if(Bo&&e==="spec.yaml"&&nd(t)===Bo.cwd)return{spec:Bo.spec,parsedPaths:[...Bo.parsedPaths]};let n=new Set;return{spec:To(t,()=>pl(t,e,n)),parsedPaths:[...n]}}function pl(t,e="spec.yaml",r){let n=rd(t,e),i=Zk(n,r);if(i.schema==="0.2"){if(e!=="spec.yaml")throw new Error("Schema 0.2 workspaces require the canonical spec.yaml compiler entry point.");let o=Nf(t),a=Gk(t,o);for(let c of DQ(t,o))r?.add(c);return a}let s=rd(t,XLe(e),"spec");if(!i.features||i.features.length===0){let o=tee(rd(s,"features"),r);o.length>0&&(i.features=o)}if(!i.scenarios||i.scenarios.length===0){let o=tee(rd(s,"scenarios"),r);o.length>0&&(i.scenarios=o)}if(!i.architecture){let o=rd(s,"architecture.yaml");ML(o)&&(i.architecture=Zk(o,r))}if(!i.capabilities||i.capabilities.length===0){let o=rd(s,"capabilities.yaml");if(ML(o)){let a=Zk(o,r);a&&Array.isArray(a.capabilities)&&(i.capabilities=a.capabilities)}}return i.schema!=="0.2"&&QQ(i),i}var Bo,gt=S(()=>{"use strict";ak();qn();Ab();kr();Cf();eee();Bo=null});function sd(t){return sMe[t]??t}function qo(){return["Onboarding complete. Ordinary natural-language development may continue.","Next: author your first feature's spec \u2014 its acceptance criteria (the testable promises) and the files it will cover \u2014 before writing code.","Run `clad check` on demand when you want to verify work.","Git hooks and CI enforcement are opt-in and not enabled automatically."].join(` +`)}function aMe(t,e=160){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function od(t,e=""){let r=oMe[t];return r?r.lead:aMe(e||t)}function cMe(t){if(!t)return;let e=[];for(let r of t.replaceAll("\\","/").split("/"))!r||r==="."||(r===".."&&e.length>0&&e[e.length-1]!==".."?e.pop():e.push(r));return e.join("/")||void 0}function aee(t){let e=od(t.detector,t.message),r=cMe(t.path),n=r?` \xB7 ${r}`:"";return`${e} (${t.detector}${n})`}function cee(t,e){return t===1?`cladding paused before finishing: 1 thing doesn't match the spec yet \u2014 e.g. ${e}. In-progress work? Stop once more to snooze.`:`cladding paused before finishing: ${t} things don't match the spec yet \u2014 e.g. ${e}. In-progress work? Stop once more to snooze.`}function lee(t,e,r,n){return`cladding drift: ${t} error(s) \u2014 ${e} (details: ${r})${n}`}function uee(){return"the completion check found problems above \u2014 fix them and re-run"}function dee(){return"the checks passed, but this feature has no independent or human review yet \u2014 this project asks for one before completion"}function pee(t){let e=new Set,r=[];for(let n of t){if(n.state!=="unobserved"||n.reason!=="unbound")continue;let i=n.subject.startsWith("criterion:")?n.subject.slice(10):n.subject;e.has(i)||(e.add(i),r.push(`no test claims this criterion \u2014 start a test title with \`[covers:${i}]\``))}return r}var sMe,oMe,Ba=S(()=>{"use strict";sMe={"stage_1.1":"Type","stage_1.2":"Lint","stage_1.3":"Drift","stage_1.4":"Commit","stage_1.5":"Architecture","stage_1.6":"Secret","stage_2.1":"Unit tests","stage_2.2":"Coverage","stage_2.3":"Spec conformance","stage_2.4":"Deliverable smoke","stage_3.1":"Smoke","stage_3.2":"Performance","stage_3.3":"Visual","stage_4.1":"Audit","stage_4.2":"UAT"};oMe={HARDCODED_SECRET:{lead:"A password or API key looks hard-coded in the source",action:"move it to an environment variable or secret store"},ARCHITECTURE_VIOLATION:{lead:"The code has an import loop or crosses a layer boundary the design forbids",action:"break the import cycle or remove the disallowed import"},MISSING_IMPLEMENTATION:{lead:"The spec lists a file that is not on disk yet",action:"create the file, or remove it from the feature module list"},UNMAPPED_ARTIFACT:{lead:"A source file exists that no feature in the spec claims",action:"add it to a feature module list, or delete the file"},TECH_STACK_MISMATCH:{lead:"The spec names one programming language but the source files on disk are another",action:"update project.language to a language the source tree actually contains"},STATUS_DRIFT:{lead:"A feature is marked done but its files or checks do not back that up",action:"add the missing modules, or set the status back"},STALE_SPECIFICATION:{lead:"A feature's lifecycle labels don't match its actual state",action:"reconcile the feature status and archive fields"},REFERENCE_INTEGRITY:{lead:"The spec points to a feature id that does not exist",action:"fix the reference or add the missing feature"},DOC_LINK_INTEGRITY:{lead:"A documentation link or feature reference points to something that no longer exists",action:"fix the broken link or reference in the doc"},HARNESS_INTEGRITY:{lead:"The cladding setup is inconsistent \u2014 a version or count does not match across its files"},META_INTEGRITY:{lead:"The spec schema files are missing or malformed",action:"restore spec/schema.json (reinstall cladding if needed)"},AC_DRIFT:{lead:"An acceptance criterion is incomplete or out of sync with the spec",action:"write the criterion text or its when/shall/so-that fields"},MISSING_TESTS:{lead:"A finished feature has an acceptance criterion with nothing proving it works",action:"start the verifying test title with `[covers:/]` on schema 0.2, or add a test file or evidence reference on schema 0.1"},STALE_TESTS:{lead:"The tests are much older than the code they cover, so they may no longer match",action:"review and refresh the outdated tests"},COVERAGE_DROP:{lead:"Test coverage fell below the project minimum",action:"add tests until coverage clears the floor"},PERFORMANCE_DRIFT:{lead:"A measured performance number is noticeably worse than the saved baseline",action:"investigate the slowdown or update the baseline"},EVIDENCE_MISMATCH:{lead:"A recorded piece of evidence points to a file that is gone from disk",action:"restore the file or update the evidence record"},STALE_EVIDENCE:{lead:"A piece of verification evidence is more than 90 days old",action:"re-verify so the evidence is current"},UNTESTED_AC:{lead:"A finished criterion names a test file that is not on disk",action:"add the missing test file or fix the reference"},UNVERIFIED_AC:{lead:"A finished criterion has a test that exists but never actually ran and passed",action:"run the test suite so the result is recorded"},CONVENTION_DRIFT:{lead:"A source file is missing its leading explanatory comment",action:"add a short header comment explaining the file purpose"},FIXTURE_REFERENCE_INVALID:{lead:"A criterion refers to a test fixture that is not registered",action:"register the fixture or fix the reference name"},SLUG_CONFLICT:{lead:"Two features or two scenarios share the same short name",action:"rename one so each short name is unique"},ID_COLLISION:{lead:"Two features or two scenarios share the same id",action:"give one of them a new id"},INVENTORY_DRIFT:{lead:"The spec summary counts do not match the spec files on disk",action:"run `clad sync` to refresh the counts"},AC_DUPLICATE_WITHIN_FEATURE:{lead:"The same criterion id appears twice inside one feature",action:"renumber or remove the duplicate criterion"},ARCHITECTURE_FROM_SPEC:{lead:"The code imports across layers in a way the architecture rules forbid",action:"remove the cross-layer import or update the architecture rules"},CAPABILITIES_FEATURE_MAPPING:{lead:"A capability lists a feature id that does not exist",action:"fix the capability feature list"},ABSENCE_OF_GOVERNANCE:{lead:"This project has no cladding spec set up, so the checks have nothing to inspect",action:"ask your AI tool to apply Cladding to this project"},AI_HINTS_FORBIDDEN_PATTERN:{lead:"The code uses a pattern the project rules told the AI never to use",action:"remove the forbidden pattern named in the project ai_hints"},PLANNED_BACKLOG:{lead:"Several features are specced but have no code yet \u2014 the plan has run ahead of the work",action:"implement the pending features before adding more"},HOLLOW_GOVERNANCE:{lead:"The design files exist but are still empty templates",action:"fill in the capabilities and architecture files"},DEPENDENCY_CYCLE:{lead:"Features depend on each other in a loop, so none of them can ever start",action:"break the dependency loop between the features"},SCENARIO_COVERAGE:{lead:"This project defines no user-journey scenarios, or a scenario links no features",action:"add a scenario, or bind features to the empty one"},PROJECT_CONTEXT_DRIFT:{lead:"The project why-it-exists document is still the empty starter stub",action:"write docs/project-context.md, or ask your AI tool to refresh the Cladding project context"},SPEC_CONFORMANCE:{lead:"A finished feature is missing the spec-derived test that should prove it",action:"add the required oracle test \u2014 `clad oracle ` prints the brief"},DELIVERABLE_INTEGRITY:{lead:"The declared entry point is missing, or a shipped feature declares none to smoke-test",action:"fix project.deliverable.path, or declare the entry point"},SMOKE_PROBE_DEMAND:{lead:"A shipped, runnable project has no smoke check proving its entry point actually runs",action:"add a smoke probe under project.smoke"},STALE_ATTESTATION:{lead:"Shipped code has changed since it was last verified",action:"re-run `clad check --tier=pre-push --strict` to refresh the attestation"},INFERABLE_DEPENDS_ON:{lead:"The code imports across feature boundaries the spec never recorded as dependencies",action:"run `clad infer-deps` to see suggested dependency links"},HOST_CLAIM_DRIFT:{lead:"The README claims a support level that the recorded test evidence does not back",action:"align the README host-claim with the evidence"}}});function Iee(t){return zMe[t]}function Bt(t,e){return te?1:0}function cd(t){return UMe.get(t)}function UL(t){let e=fi(t);return Vo.filter(r=>fi(r.assuranceLevel)<=e)}function Pee(t,e){return UL(t==="feedback"||t==="checkpoint"?"L1":e).filter(n=>n.profiles.includes(t)&&(t!=="feedback"||n.backgroundSafe))}function Pb(t,e){if(!e.complete)return"unresolved";switch(t.applicability){case"always":return"required";case"coverage":return e.hasExecutableTests===!0?"required":"na";case"oracle":return e.hasOracleProof===!0?"required":"na";case"deliverable":return e.hasDeliverable===!0?"required":"na";case"quality":return e.requiresQuality===!0?"required":"na";case"human":return e.requiresHuman===!0?"required":"na"}}function fi(t){return Number(t.slice(1))}function Vf(t){return t==="feedback"||t==="checkpoint"||t==="completion"||t==="push"||t==="release"?t:FMe[t]}var FMe,zMe,Hn,Vo,UMe,qa=S(()=>{"use strict";FMe=Object.freeze({"pre-commit":"checkpoint","pre-push":"push",all:"release"}),zMe=Object.freeze({feedback:!1,checkpoint:!1,completion:!0,push:!0,release:!0});Hn=(t,e,r,n,i={})=>Object.freeze({id:t,label:e,ironclad:i.ironclad??!0,assuranceLevel:r,profiles:Object.freeze([...i.profiles??["completion","push","release"]]),legacyAliases:Object.freeze([t]),dependencies:Object.freeze([...i.dependencies??[]]),adapter:i.adapter??{id:`legacy-stage:${t}`,version:"1"},applicability:n,sourceStrictness:i.sourceStrictness??"hard",blocking:i.blocking??"hard",cachePolicy:i.cachePolicy??"same-commit",resources:Object.freeze([...i.resources??[]]),backgroundSafe:i.backgroundSafe??!1,controls:Object.freeze([...i.controls??["workspace"]])}),Vo=Object.freeze([Hn("stage_1.1","Type","L1","always",{profiles:["checkpoint","completion","push","release"],controls:["workspace","type","python","rust","go","jvm"]}),Hn("stage_1.2","Lint","L1","always",{profiles:["checkpoint","completion","push","release"],controls:["workspace","lint","python","rust","go","jvm"]}),Hn("stage_1.3","Drift","L1","always",{profiles:["feedback","checkpoint","completion","push","release"],backgroundSafe:!0}),Hn("stage_1.4","Commit","L1","always",{profiles:["release"],dependencies:["stage_1.1","stage_1.2","stage_1.3"],cachePolicy:"never",resources:["workspace-write"]}),Hn("stage_1.5","Architecture","L1","always",{profiles:["feedback","checkpoint","completion","push","release"],backgroundSafe:!0}),Hn("stage_1.6","Secret","L1","always",{profiles:["feedback","checkpoint","completion","push","release"],backgroundSafe:!0}),Hn("stage_2.1","Unit","L2","coverage",{dependencies:["stage_1.1","stage_1.2"],resources:["cpu-exclusive"],controls:["workspace","test","python","rust","go","jvm"]}),Hn("stage_2.2","Coverage","L2","coverage",{dependencies:["stage_2.1"],sourceStrictness:"report",blocking:"hard",resources:["cpu-exclusive"],controls:["workspace","test","python","rust","go","jvm"]}),Hn("stage_2.3","Spec Conformance","L2","oracle",{dependencies:["stage_2.1"],ironclad:!1}),Hn("stage_2.4","Deliverable Smoke","L2","deliverable",{dependencies:["stage_2.1"],ironclad:!1}),Hn("stage_3.1","Smoke","L3","quality",{dependencies:["stage_2.1"],resources:["port"]}),Hn("stage_3.2","Performance","L3","quality",{dependencies:["stage_3.1"],sourceStrictness:"report",blocking:"hard",cachePolicy:"never",resources:["cpu-exclusive"]}),Hn("stage_3.3","Visual","L3","quality",{dependencies:["stage_3.1"],resources:["display"]}),Hn("stage_4.1","Audit","L4","human",{dependencies:["stage_2.1"],cachePolicy:"never"}),Hn("stage_4.2","UAT","L4","human",{dependencies:["stage_4.1"],cachePolicy:"never"})]),UMe=new Map(Vo.map(t=>[t.id,t]))});import{AsyncLocalStorage as BMe}from"node:async_hooks";import{spawnSync as qMe}from"node:child_process";import{resolve as VMe}from"node:path";function Cee(t){return qL.has(t.split("/").at(-1)??"")}function Tee(t){return t.normalize("NFC")}function GMe(t){let e={...process.env,GIT_OPTIONAL_LOCKS:"0"};delete e.GIT_DIR,delete e.GIT_WORK_TREE,delete e.GIT_INDEX_FILE;let r;try{r=qMe("git",["ls-files","--cached","--others","--exclude-standard","-z"],{cwd:t,encoding:"buffer",maxBuffer:512*1024*1024,env:e})}catch{return}if(r.error||r.status!==0||!r.stdout)return;let n=r.stdout.toString("utf8").split("\0").filter(i=>i!=="");if(n.length!==0)return new Set(n.map(Tee))}function Jk(t,e){if(e?.source==="filesystem")return Ree;let r=VMe(t),n=BL.getStore(),i=n?.get(r);if(i)return i;let s=GMe(r),o=s===void 0?Ree:Object.freeze({source:"git",includes:a=>!Cee(a)&&s.has(Tee(a))});return n?.set(r,o),o}function Gf(t){return BL.getStore()?t():BL.run(new Map,t)}var qL,BL,Ree,Rb=S(()=>{"use strict";qL=Object.freeze(new Set([".DS_Store","Thumbs.db","desktop.ini"])),BL=new BMe;Ree=Object.freeze({source:"filesystem",includes:t=>!Cee(t)})});import{createHash as Lee}from"node:crypto";import{lstatSync as Oee,readFileSync as Nee,readdirSync as HMe}from"node:fs";import{relative as Dee,resolve as jee}from"node:path";function It(t){return Array.isArray(t)?`[${t.map(It).join(",")}]`:t&&typeof t=="object"?`{${Object.entries(t).sort(([r],[n])=>Bt(r,n)).map(([r,n])=>`${JSON.stringify(r)}:${It(n)}`).join(",")}}`:JSON.stringify(t)??"null"}function WMe(t){return Lee("sha256").update(It(t),"utf8").digest("hex")}function Cb(t,e){try{let r=xn(t,e),n=Oee(r);if(n.isSymbolicLink())return;let i=Jk(t),s=Dee(jee(t),r).replaceAll("\\","/");if(n.isFile())return i.includes(s)?Nee(r):void 0;if(!n.isDirectory())return;let o=[],a=c=>{for(let l of HMe(c,{withFileTypes:!0}).sort((u,d)=>Bt(u.name,d.name))){let u=`${c}/${l.name}`,d=Dee(jee(t),u).replaceAll("\\","/");if(!l.isDirectory()&&!i.includes(d))continue;xn(t,d);let p=Oee(u);if(l.isSymbolicLink()||p.isSymbolicLink())return!1;if(p.isDirectory()){if(!a(u))return!1}else if(p.isFile())o.push(Buffer.from(`${d}\0`,"utf8"),Nee(u),Buffer.from("\0","utf8"));else return!1}return!0};return a(r)&&(o.length>0||i.source==="filesystem")?Buffer.concat(o):void 0}catch{return}}function Mee(t,e){let r=e.replace(/[\\/]+$/,"");return r===""?void 0:Cb(t,r)}function Yk(t,e){let r=VL(t,e);if(!r)return Hf([{address:`missing:feature:${e}`,value:""}],!1);let n=r.criteria.map(c=>({address:`criterion:${r.id}/${c.id}`,value:t.schemaVersion==="0.1"?Fee(c):zee(c)})),i=new Set(r.capabilityRefs??[]),s=(t.capabilities??[]).filter(c=>i.has(c.id)).map(c=>({address:`capability:${c.id}`,value:{id:c.id,outcome:c.outcome}})),o=Uee(t,r.id),a=[{address:`feature:${r.id}`,value:t.schemaVersion==="0.1"?{id:r.id,title:r.title,modules:Va(r.modules),depends_on:Va(r.dependsOn),baseline_identity:r.baselineIdentity??null}:{id:r.id,title:r.title,purpose:r.purpose??null,modules:Va(r.modules),depends_on:Va(r.dependsOn),capability_refs:Va(r.capabilityRefs),design_impact:r.designImpact??null,baseline_identity:r.baselineIdentity??null}},...n,...s,...t.schemaVersion==="0.2"?(t.architectureRules??[]).map((c,l)=>({address:`architecture_rule:${l}`,value:c})):[],...t.schemaVersion==="0.2"?[{address:"migration_baseline:receipt",value:t.migrationBaselineReceiptSha256??null}]:[],...o];return Hf(a,!0)}function Tb(t,e){let[r,n]=KMe(e),i=r?VL(t,r):void 0,s=i?.criteria.find(a=>a.id===n);if(!i||!s)return Hf([{address:`missing:criterion:${e}`,value:""}],!1);let o=Uee(t,i.id);return Hf([{address:`feature:${i.id}`,value:t.schemaVersion==="0.1"?{id:i.id,title:i.title,baseline_identity:i.baselineIdentity??null}:{id:i.id,title:i.title,purpose:i.purpose??null,baseline_identity:i.baselineIdentity??null}},{address:`criterion:${i.id}/${s.id}`,value:t.schemaVersion==="0.1"?Fee(s):zee(s)},...o],!0)}function Ob(t,e){let r=(t.proofInputs??[]).filter(s=>s.address===e),n=r.map(s=>({address:`proof:${s.address}:${s.path}${s.selector?`#${s.selector}`:""}`,value:{binding:{address:s.address,path:s.path,selector:s.selector??null},binding_state:s.bindingState??"available",expected_binding_sha256:s.expectedBindingSha256??null,binding_provenance:s.bindingProvenance??"live",source:Kk(s.sourceBytes,""),runner_config:s.runnerConfig??null,oracle:s.oracle?{declaration:s.oracle.declaration,bytes:Kk(s.oracle.resolvedBytes,"")}:null,evidence:s.evidence?{declaration:s.evidence.declaration,bytes:Kk(s.evidence.resolvedBytes,"")}:null}}));r.length===0&&n.push({address:`missing:proof:${e}`,value:""});for(let s of(t.receiptIdentities??[]).filter(o=>o.address===e||o.address===`criterion:${e}`||o.address===`feature:${e.split("/")[0]}`).sort((o,a)=>Bt(o.identity,a.identity)))n.push({address:`receipt:${s.identity}`,value:s.identity});let i=r.every(s=>s.bindingState==="unsafe"||!JMe(s.runnerConfig)?!1:s.bindingState==="stale"||s.oracle!==void 0||s.evidence!==void 0?!0:s.sourceBytes!==void 0);return Hf(n,i)}function Wf(t,e){let r=new Set,n=new Set,i=t.dependencyComplete===!0,s=c=>{if(n.has(c))return;n.add(c);let l=VL(t,c);if(!l){i=!1,r.add(`missing:feature:${c}`);return}for(let u of l.dependsOn??[])s(u);for(let u of l.modules??[])r.add(`${c}:${u}`)};s(e);let o=new Map((t.runtimeDependencies??[]).map(c=>[`${c.feature}:${c.module}`,c])),a=[];for(let c of Va([...r])){if(c.startsWith("missing:")){a.push({address:c,value:""});continue}let l=o.get(c);!l||l.state==="unknown"?(i=!1,a.push({address:`runtime:${c}`,value:""})):l.state==="missing"||l.bytes===void 0?(i=!1,a.push({address:`runtime:${c}`,value:""})):a.push({address:`runtime:${c}`,value:Kk(l.bytes,"")})}return Hf(a,i)}function Fee(t){return{text:t.text??null,ears:t.ears??{},scanner_state:t.scannerState??"opaque",legacy_unclassified:t.legacyUnclassified===!0,baseline_identity:t.baselineIdentity??null}}function zee(t){return{id:t.id,kind:t.kind??null,statement:t.statement??null,rationale:t.rationale??null,constraint_refs:Va(t.constraintRefs),oracle_refs:Va(t.oracleRefs),evidence_refs:Va(t.evidenceRefs),baseline_identity:t.baselineIdentity??null}}function Uee(t,e){return t.schemaVersion!=="0.2"||t.scenarioPolicy!=="required"?[]:(t.scenarios??[]).filter(r=>r.features?.includes(e)).map(r=>({address:`scenario:${r.id}`,value:{id:r.id,intent:ZMe(r.intent)}}))}function ZMe(t){let e=t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0;return{actor:typeof e?.actor=="string"?e.actor:null,goal:typeof e?.goal=="string"?e.goal:null,success:typeof e?.success=="string"?e.success:null,steps:Array.isArray(e?.steps)?e.steps.filter(r=>typeof r=="string"):[]}}function Hf(t,e){let r=[...t].sort((n,i)=>Bt(n.address,i.address));return Object.freeze({records:Object.freeze(r),sha256:WMe(r),complete:e})}function Kk(t,e){if(t===void 0)return e;let r=typeof t=="string"?Buffer.from(t,"utf8"):Buffer.from(t);return{sha256:Lee("sha256").update(r).digest("hex"),bytes:r.length}}function JMe(t){return t===void 0?!1:t!==null&&typeof t=="object"&&"complete"in t?t.complete!==!1:!0}function VL(t,e){return t.features.find(r=>r.id===e)}function KMe(t){let e=/^(?:criterion:)?([^/]+)\/([^/]+)$/.exec(t);return[e?.[1],e?.[2]]}function Va(t){return[...t??[]].sort(Bt)}var Go=S(()=>{"use strict";Zu();qa();Rb()});import{createHash as Bee}from"node:crypto";function Vee(t,e){let r=new Set(e.scopeAddresses.flatMap(c=>c.startsWith("feature:")?[c.slice(8)]:[])),n=YMe(t),i=Hee(t),s=new Set(e.executedStageIds),o=new Map(e.featureSeals.map(c=>[c.feature,Object.freeze({...c})])),a=Bee("sha256").update(It([...e.scopeAddresses].sort()),"utf8").digest("hex");!e.profileAuthoritative||r.size===0||o.size!==e.featureSeals.length||[...r].some(c=>!o.has(c))||t.input_sha256!==e.inputSha256||t.scope_sha256!==a||t.state!=="green"||!t.profile_complete||XMe(t)||n.length===0||t.results.some(c=>c.state==="pass"&&!s.has(c.obligation))||!QMe(t,s)||qee.set(t,Object.freeze({inputSha256:e.inputSha256,scopeSha256:a,featureIds:r,featureSeals:o,profileIdentity:Object.freeze({...e.profileIdentity}),observationSeal:i}))}function Gee(t,e,r,n,i){return HL(t,e,r,n,i)===void 0}function HL(t,e,r,n,i){let s=qee.get(t);if(s===void 0)return{guard:"run authority",detail:"this verdict was not sealed by the gate that ran the stages"};if(s.inputSha256!==r||s.inputSha256!==t.input_sha256)return{guard:"compiler snapshot",detail:"the spec compiled to a different snapshot than the one the gate sealed"};if(s.scopeSha256!==t.scope_sha256)return{guard:"scope",detail:"the verdict covers a different scope than the gate sealed"};if(!s.featureIds.has(e))return{guard:"scope",detail:`${e} is outside the scope this run sealed`};let o=s.featureSeals.get(e);if(o===void 0)return{guard:"verification seal",detail:`the gate sealed no closure for ${e}`};let a=o.contractSha256!==n.contractSha256?"contract":o.subjectSha256!==n.subjectSha256?"subject":o.verificationSha256!==n.verificationSha256?"verification":o.runtimeDependencySha256!==n.runtimeDependencySha256?"runtime dependency":void 0;if(a!==void 0)return{guard:"verification seal",detail:`the ${a} closure being recorded differs from the one the gate sealed`};let c=s.profileIdentity.registrySha256!==i.registrySha256?"obligation registry":s.profileIdentity.detectorCatalogSha256!==i.detectorCatalogSha256?"detector catalog":s.profileIdentity.toolIdentity!==i.toolIdentity?"tool version":s.profileIdentity.environmentClass!==i.environmentClass?"environment":s.profileIdentity.trustSnapshotSha256!==i.trustSnapshotSha256?"trust registry":void 0;if(c!==void 0)return{guard:"run identity",detail:`the ${c} changed during this run`};if(t.state!=="green")return{guard:"gate result",detail:"the gate did not finish green"};if(!t.profile_complete)return{guard:"gate result",detail:"the gate could not prove every required check applied"};if(s.observationSeal!==Hee(t))return{guard:"observations",detail:"the recorded stage results changed after the gate sealed them"}}function YMe(t){return[...new Set(t.results.flatMap(e=>e.observation_identities))].sort()}function XMe(t){let e=new Map;return t.results.some(r=>{let n=e.get(r.obligation)??new Set;return n.has(r.subject)?!0:(n.add(r.subject),e.set(r.obligation,n),!1)})}function Hee(t){return Bee("sha256").update(It(t.results.map(e=>({obligation:e.obligation,subject:e.subject,state:e.state,source_strictness:e.source_strictness??null,blocking:e.blocking,reason:e.reason??null,migration_baseline:e.migration_baseline??null,observation_identities:[...e.observation_identities].sort()}))),"utf8").digest("hex")}function QMe(t,e){return t.results.filter(r=>r.state==="migration_baseline").every(r=>r.obligation!=="stage_2.1"&&r.obligation!=="stage_2.2"||!r.subject.startsWith("criterion:")||r.observation_identities.length!==0||!eFe(r.migration_baseline)||!e.has(r.obligation)?!1:t.results.some(n=>n.obligation===r.obligation&&n.subject===`scope:${t.scope_sha256}`&&n.state==="pass"&&n.observation_identities.length>0&&e.has(n.obligation)))}function eFe(t){return t!==void 0&&GL(t.baseline_receipt_sha256)&&GL(t.resolution_sha256)&&GL(t.criterion_authorization_sha256)}function GL(t){return/^[a-f0-9]{64}$/.test(t)}var qee,WL=S(()=>{"use strict";Go();qee=new WeakMap});import{createHash as JL,createPublicKey as Zee,verify as tFe}from"node:crypto";import{TextDecoder as rFe}from"node:util";function Jee(t,e){if(t.method!=="human_channel"||t.claim!=="uat")return;let r=Ha(t),n=e.get(r);if(!n)throw new Pe(`UAT receipt subject feature ${r} is not present in the current compiler view.`);for(let i of Object.keys(t.criterion_verdicts))if(!i.startsWith(`criterion:${r}/`)||!n.has(i))throw new Pe(`UAT criterion_verdicts address ${i} is outside the receipt subject feature or current compiler criteria.`)}function yr(t){let e=mFe(t);Qk(e);let r=(0,Ks.parseDocument)(e,{schema:"core",uniqueKeys:!0,prettyErrors:!1});if(r.errors.length>0||r.warnings.length>0)throw new Pe(`Receipt YAML is invalid: ${[...r.errors,...r.warnings].map(i=>i.message).join(" ")}`);Xk(r.contents);let n=r.toJS({mapAsMap:!1});return eE(n),aFe(n)}function Ga(t){return eE(t),ZL(t)}function XL(t){let e=hFe(t),r=Buffer.from(Ga(e),"utf8"),n=Buffer.from(nFe,"ascii"),i=Buffer.allocUnsafe(4+n.length+8+r.length);return i.writeUInt32BE(n.length,0),n.copy(i,4),i.writeBigUInt64BE(BigInt(r.length),4+n.length),r.copy(i,12+n.length),i}function fl(t){return JL("sha256").update(Ga(t),"utf8").digest("hex")}function Zf(t){return`${Ga(t)} +`}function Ha(t){let e=YL.exec(t.subject);if(e)return e[1];let r=KL.exec(t.subject);if(r)return r[1];throw new Pe("Receipt subject has no valid feature address.")}function Nb(t=[]){let e=t.map(i=>{if(!i.issuer.trim())throw new Pe("Trusted issuer names must be non-empty.");let s=new Uint8Array(i.spkiDer),o=Db(s);if(i.issuerKeyId!==o)throw new Pe("Trusted issuer key id does not match its DER SPKI bytes.");if(Zee({key:Buffer.from(s),format:"der",type:"spki"}).asymmetricKeyType!=="ed25519")throw new Pe("Trusted issuer SPKI keys must be Ed25519 public keys.");return Object.freeze({issuer:i.issuer,issuerKeyId:o,spkiDerBase64:Buffer.from(s).toString("base64")})}).sort((i,s)=>ete(`${i.issuerKeyId}\0${i.issuer}`,`${s.issuerKeyId}\0${s.issuer}`)),r=new Set;for(let i of e){if(r.has(i.issuerKeyId))throw new Pe(`Duplicate trusted issuer key id ${i.issuerKeyId}.`);r.add(i.issuerKeyId)}let n=JL("sha256").update(Ga(e.map(i=>({issuer:i.issuer,issuer_key_id:i.issuerKeyId,spki_der:i.spkiDerBase64}))),"utf8").digest("hex");return Object.freeze({keys:Object.freeze(e),digest:n})}function Ho(){return Nb([])}function Db(t){return JL("sha256").update(t).digest("hex")}function rE(t,e=Ho(),r){let n=oFe(t,r);if(n==="mismatch")return{assurance:"invalid",currentness:"stale",reason:"expected_digest_mismatch",trustSnapshotDigest:e.digest};let i=e.keys.find(a=>a.issuerKeyId===t.issuer_key_id);if(!i)return{assurance:"asserted",currentness:"unresolved",reason:"unknown_issuer_key",trustSnapshotDigest:e.digest};if(i.issuer!==t.issuer)return{assurance:"invalid",currentness:"unresolved",reason:"issuer_mismatch",trustSnapshotDigest:e.digest};let s=Qee(t.issuer_proof),o=Zee({key:Buffer.from(i.spkiDerBase64,"base64"),format:"der",type:"spki"});return tFe(null,XL(t),o,s)?n==="incomplete"?{assurance:"asserted",currentness:"unresolved",reason:"missing_expected_context",trustSnapshotDigest:e.digest}:{assurance:"verified",currentness:"current",reason:"verified",trustSnapshotDigest:e.digest}:{assurance:"invalid",currentness:"unresolved",reason:"invalid_signature",trustSnapshotDigest:e.digest}}function oFe(t,e){let r=[["subject_sha256",e?.subjectSha256]];t.method==="human_channel"?(r.push(["reviewed_inputs_sha256",e?.reviewedInputsSha256]),r.push(["runtime_dependency_sha256",e?.runtimeDependencySha256]),r.push(["implementation_authors_sha256",e?.implementationAuthorsSha256])):(r.push(["evidence.sha256",e?.evidenceSha256]),r.push(["capability_manifest_sha256",e?.capabilityManifestSha256]));let n=!1;for(let[i,s]of r){if(s===void 0){n=!0;continue}if((i==="evidence.sha256"?t.method==="blind_capability"?t.evidence.sha256:void 0:t[i])!==s)return"mismatch"}return n?"incomplete":"complete"}function aFe(t){let e=nE(t,"Receipt must be a mapping."),r=e.method;if(r==="human_channel")return cFe(e);if(r==="blind_capability")return lFe(e);throw new Pe("Receipt method must be human_channel or blind_capability.")}function cFe(t){Yee(t,new Set(["receipt_schema","issuer","issuer_key_id","issuer_proof","subject","subject_sha256","observed_at","method","claim","reviewed_inputs_sha256","runtime_dependency_sha256","implementation_authors_sha256","checks","criterion_verdicts"]));let e=uFe(t);if(t.claim==="audit"){if(!YL.test(e.subject))throw new Pe("An audit receipt must have a criterion subject.");if(Object.hasOwn(t,"criterion_verdicts"))throw new Pe("An audit receipt cannot include criterion_verdicts.");return{...e,subject:e.subject,claim:"audit",checks:Wee(t.checks,["evidence_sufficiency","code_test_review","independence"])}}if(t.claim==="uat"){if(!KL.test(e.subject))throw new Pe("A UAT receipt must have a feature subject.");let r=nE(t.criterion_verdicts,"A UAT receipt requires criterion_verdicts."),n={};for(let[i,s]of Object.entries(r)){if(!sFe.test(i)||!tM(s))throw new Pe("UAT criterion_verdicts must be canonical criterion addresses with pass or fail values.");n[i]=s}return{...e,subject:e.subject,claim:"uat",criterion_verdicts:n,checks:Wee(t.checks,["no_surprise","tradeoff_acceptance"])}}throw new Pe("A human receipt claim must be audit or uat.")}function lFe(t){if(Yee(t,new Set(["receipt_schema","issuer","issuer_key_id","issuer_proof","subject","subject_sha256","observed_at","method","claim","verdict","evidence","capability_manifest_sha256"])),t.claim!=="independent_oracle")throw new Pe("A blind receipt claim must be independent_oracle.");if(!tM(t.verdict))throw new Pe("A blind receipt verdict must be pass or fail.");let e=nE(t.evidence,"A blind receipt requires evidence.");eM(e,["locator","sha256"],"blind evidence");let r=Xee(e.locator,"Blind evidence locator must be non-empty."),n=ld(e.sha256,"Blind evidence sha256");return{...QL(t),method:"blind_capability",claim:"independent_oracle",verdict:t.verdict,evidence:{locator:r,sha256:n},capability_manifest_sha256:ld(t.capability_manifest_sha256,"capability_manifest_sha256")}}function uFe(t){return{...QL(t),method:"human_channel",reviewed_inputs_sha256:ld(t.reviewed_inputs_sha256,"reviewed_inputs_sha256"),runtime_dependency_sha256:ld(t.runtime_dependency_sha256,"runtime_dependency_sha256"),implementation_authors_sha256:ld(t.implementation_authors_sha256,"implementation_authors_sha256")}}function QL(t){return{receipt_schema:tE,issuer:Xee(t.issuer,"Receipt issuer must be non-empty."),issuer_key_id:ld(t.issuer_key_id,"issuer_key_id"),issuer_proof:dFe(t.issuer_proof),subject:pFe(t.subject),subject_sha256:ld(t.subject_sha256,"subject_sha256"),observed_at:fFe(t.observed_at)}}function Yee(t,e){if(eM(t,e,"receipt"),t.receipt_schema!==tE)throw new Pe('Receipt receipt_schema must be the string "1".');QL(t)}function Wee(t,e){let r=nE(t,"Receipt checks must be a mapping.");eM(r,e,"receipt checks");let n={};for(let i of e){if(!tM(r[i]))throw new Pe(`Receipt check ${i} must be pass or fail.`);n[i]=r[i]}return n}function eM(t,e,r){let n=e instanceof Set?e:new Set(e);for(let i of Object.keys(t))if(!n.has(i))throw new Pe(`Unknown ${r} field ${i}.`);for(let i of n)if(!Object.hasOwn(t,i)&&i!=="criterion_verdicts")throw new Pe(`Missing ${r} field ${i}.`)}function nE(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Pe(e);return t}function Xee(t,e){if(typeof t!="string"||t.length===0)throw new Pe(e);return Qk(t),t}function ld(t,e){if(typeof t!="string"||!iFe.test(t))throw new Pe(`${e} must be a lowercase SHA-256 digest.`);return t}function dFe(t){if(typeof t!="string"||!Kee.test(t)||t.includes("="))throw new Pe("issuer_proof must be unpadded base64url.");try{let e=Qee(t);if(e.length!==64||e.toString("base64url")!==t)throw new Pe("issuer_proof is not a canonical Ed25519 base64url signature.")}catch(e){throw e instanceof Pe?e:new Pe("issuer_proof is not base64url.")}return t}function pFe(t){if(typeof t!="string"||!KL.test(t)&&!YL.test(t))throw new Pe("Receipt subject must be a canonical feature or criterion address.");return t}function fFe(t){if(typeof t!="string"||Buffer.byteLength(t,"utf8")!==24||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(t)||new Date(t).toISOString()!==t)throw new Pe("observed_at must be an exact canonical 24-byte UTC timestamp.");return t}function tM(t){return t==="pass"||t==="fail"}function hFe(t){return Object.fromEntries(Object.entries(t).filter(([e])=>e!=="issuer_proof"))}function Qee(t){if(!Kee.test(t)||t.includes("="))throw new Pe("Invalid base64url signature.");return Buffer.from(t,"base64url")}function mFe(t){if(typeof t=="string")return t;try{return new rFe("utf-8",{fatal:!0}).decode(t)}catch{throw new Pe("Receipt YAML is not valid UTF-8.")}}function Qk(t){for(let e=0;e57343)){if(r<=56319&&e+1=56320&&n<=57343){e++;continue}}throw new Pe("Receipt contains an invalid Unicode scalar value.")}}}function Xk(t){if(t===null)throw new Pe("Receipt YAML may not be empty.");if((0,Ks.isAlias)(t))throw new Pe("Receipt YAML aliases are not permitted.");if(t.anchor!==void 0||t.tag!==void 0)throw new Pe("Receipt YAML anchors and tags are not permitted.");if((0,Ks.isMap)(t))for(let e of t.items){if(!e.key||!(0,Ks.isScalar)(e.key)||typeof e.key.value!="string")throw new Pe("Receipt YAML map keys must be strings.");if(e.key.value==="<<")throw new Pe("Receipt YAML merge keys are not permitted.");Xk(e.key),Xk(e.value)}else if((0,Ks.isSeq)(t))for(let e of t.items)Xk(e);else if(!(0,Ks.isScalar)(t))throw new Pe("Receipt YAML contains an unsupported node.")}function eE(t){if(t===null||typeof t=="string"||typeof t=="boolean"){typeof t=="string"&&Qk(t);return}if(typeof t=="number"){if(!Number.isFinite(t))throw new Pe("Receipt numbers must be finite IEEE-754 values.");return}if(Array.isArray(t)){for(let e of t)eE(e);return}if(typeof t=="object"){for(let[e,r]of Object.entries(t))Qk(e),eE(r);return}throw new Pe("Receipt YAML must decode to JSON-compatible data.")}function ZL(t){if(t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(ZL).join(",")}]`;let e=t;return`{${Object.keys(e).sort(ete).map(r=>`${JSON.stringify(r)}:${ZL(e[r])}`).join(",")}}`}function ete(t,e){return te?1:0}var Ks,tE,nFe,Pe,iFe,Kee,KL,YL,sFe,kn=S(()=>{"use strict";Ks=Et(cr(),1),tE="1",nFe="cladding.receipt/1";Pe=class extends Error{},iFe=/^[a-f0-9]{64}$/,Kee=/^[A-Za-z0-9_-]+$/,KL=/^feature:(F-[a-z0-9]+)$/,YL=/^criterion:(F-[a-z0-9]+)\/(AC-[a-z0-9]+)$/,sFe=/^criterion:F-[a-z0-9]+\/AC-[a-z0-9]+$/});import{createHash as tte}from"node:crypto";function iE(t){return tte("sha256").update(JSON.stringify([...new Set(t)].sort(Bt)),"utf8").digest("hex")}function ote(t){let e=t.verdict;if(e.results.length===0||e.profile!=="completion"&&e.profile!=="push"&&e.profile!=="release"||!e.profile_complete||e.state!=="green"||lte(e)||e.results.some(a=>a.state==="unobserved"||a.state==="fail"&&a.blocking!=="report")||!Gee(e,t.feature,e.input_sha256,{contractSha256:t.contractSha256,subjectSha256:t.subjectSha256,verificationSha256:t.verificationSha256,runtimeDependencySha256:t.runtimeDependencySha256},{registrySha256:t.registrySha256,detectorCatalogSha256:t.detectorCatalogSha256,toolIdentity:t.toolIdentity,environmentClass:t.environmentClass,trustSnapshotSha256:t.trustSnapshotSha256}))return;let r=cte(e.results);if(r===void 0)return;let n=[...new Set(e.results.flatMap(a=>a.observation_identities))].sort(Bt),i={required:e.results.filter(a=>a.state!=="na").length,pass:e.results.filter(a=>a.state==="pass").length,na:e.results.filter(a=>a.state==="na").length,migration_baseline:e.results.filter(a=>a.state==="migration_baseline").length};if(i.required===0||n.lengtho.state==="unobserved"))return{guard:"observations",detail:"a required check produced no observation of its own"};if(e.results.some(o=>o.state==="fail"&&o.blocking!=="report"))return{guard:"observations",detail:"a blocking check failed"};let r=HL(e,t.feature,e.input_sha256,{contractSha256:t.contractSha256,subjectSha256:t.subjectSha256,verificationSha256:t.verificationSha256,runtimeDependencySha256:t.runtimeDependencySha256},{registrySha256:t.registrySha256,detectorCatalogSha256:t.detectorCatalogSha256,toolIdentity:t.toolIdentity,environmentClass:t.environmentClass,trustSnapshotSha256:t.trustSnapshotSha256});if(r!==void 0)return r;if(cte(e.results)===void 0)return{guard:"migration baseline",detail:"a carried-forward baseline row was not anchored by this run"};let n=new Set(e.results.flatMap(o=>o.observation_identities)),i=e.results.filter(o=>o.state!=="na").length,s=e.results.filter(o=>o.state==="migration_baseline").length;if(i===0)return{guard:"observations",detail:"no check in this run applied to the feature"};if(n.sizea.state==="migration_baseline");if(e.length===0)return null;let r=new Map;for(let a of e){if(!/^criterion:[^/]+\/[^/]+$/.test(a.subject)||a.obligation!=="stage_2.1"&&a.obligation!=="stage_2.2"||a.observation_identities.length!==0||!gFe(a.migration_baseline))return;let c=r.get(a.subject)??[];c.push(a),r.set(a.subject,c)}let n=[];for(let[a,c]of r){if(c.length!==2||new Set(c.map(u=>u.obligation)).size!==2||c.some(u=>u.obligation!=="stage_2.1"&&u.obligation!=="stage_2.2"))return;let l=c[0].migration_baseline;if(c.some(u=>u.migration_baseline?.baseline_receipt_sha256!==l.baseline_receipt_sha256||u.migration_baseline?.resolution_sha256!==l.resolution_sha256||u.migration_baseline?.criterion_authorization_sha256!==l.criterion_authorization_sha256))return;n.push({subject:a,basis:l})}let i=n[0].basis;if(n.some(a=>a.basis.baseline_receipt_sha256!==i.baseline_receipt_sha256||a.basis.resolution_sha256!==i.resolution_sha256))return;let s=n.map(a=>a.basis.criterion_authorization_sha256).sort(Bt);if(new Set(s).size!==s.length)return;let o=n.length*2;return Object.freeze({baseline_receipt_sha256:i.baseline_receipt_sha256,resolution_sha256:i.resolution_sha256,criterion_authorization_set_sha256:iE(s),criterion_count:n.length,obligation_count:o})}function gFe(t){return t!==void 0&&/^[a-f0-9]{64}$/.test(t.baseline_receipt_sha256)&&/^[a-f0-9]{64}$/.test(t.resolution_sha256)&&/^[a-f0-9]{64}$/.test(t.criterion_authorization_sha256)}function lte(t){let e=new Map;return t.results.some(r=>{let n=e.get(r.obligation)??new Set;return n.has(r.subject)?!0:(n.add(r.subject),e.set(r.obligation,n),!1)})}function ute(t,e){let r=t[0];if(!r||t.some(l=>!nM(l)))return;let n={configured_assurance_level:r.configured_assurance_level,registry_sha256:r.registry_sha256,detector_catalog_sha256:r.detector_catalog_sha256,tool_identity:r.tool_identity,environment_class:r.environment_class,trust_snapshot_sha256:r.trust_snapshot_sha256},i=bFe(e.trustSnapshot);if(!i||n.trust_snapshot_sha256!==i.digest)return;let s=Object.keys(n);if(t.some(l=>s.some(u=>l[u]!==n[u])))return;let o=e.currentLocations;if(o!==void 0){if(o.length!==e.candidates.length||new Set(o.map(l=>l.path)).size!==o.length)return}else if(e.candidates.length!==0)return;let a=[];for(let l of e.candidates){let u=yFe(l);if(!u)return;a.push(u)}let c=Object.freeze({[nte]:Object.freeze({receiptContext:Object.freeze({candidates:Object.freeze(a),trustSnapshot:Object.freeze({keys:Object.freeze(i.keys.map(l=>Object.freeze({...l}))),digest:i.digest}),...o===void 0?{}:{currentLocations:Object.freeze(o.map(l=>Object.freeze({path:l.path,expected:Object.freeze({...l.expected})})))}}),current:Object.freeze(n)})});return ste.add(c),c}function yFe(t){try{let e=typeof t.bytes=="string"?t.bytes:new TextDecoder("utf-8",{fatal:!0}).decode(t.bytes);return yr(e),Object.freeze({bytes:e,expected:Object.freeze({...t.expected})})}catch{return}}function bFe(t){try{let e=Nb(t.keys.map(r=>({issuer:r.issuer,issuerKeyId:r.issuerKeyId,spkiDer:Buffer.from(r.spkiDerBase64,"base64")})));return e.digest===t.digest?e:void 0}catch{return}}function dte(t){return t!==void 0&&ste.has(t)?t[nte]:void 0}function rM(t){return tte("sha256").update(It({profile:t.profile,assurance_level:t.assuranceLevel,configured_assurance_level:t.configuredAssuranceLevel,registry_sha256:t.registrySha256,detector_catalog_sha256:t.detectorCatalogSha256,tool_identity:t.toolIdentity,environment_class:t.environmentClass,trust_snapshot_sha256:t.trustSnapshotSha256}),"utf8").digest("hex")}function nM(t){return ite.has(t)&&t[rte]===!0}var rte,nte,ite,ste,sE=S(()=>{"use strict";Go();WL();qa();kn();rte=Symbol("authoritative-v3"),nte=Symbol("retention-context"),ite=new WeakSet,ste=new WeakSet});function pte(t){return t.assurance??"asserted"}function oE(t){let e=t.identity.timestamp??new Date().toISOString(),r=`ev-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return{...t,id:r,identity:{...t.identity,timestamp:e}}}var aE=S(()=>{"use strict"});function jb(t,e){let r=new Map;for(let n of t){let i=r.get(n.criterion)??[];i.push(n),r.set(n.criterion,i)}return[...r.entries()].map(([n,i])=>vFe(n,i,e.cases??[])).sort((n,i)=>n.criterion.localeCompare(i.criterion))}function vFe(t,e,r){let n=r.filter(c=>e.some(l=>_Fe(l,c,r))),i=n.filter(c=>c.status==="pass").length,s=n.filter(c=>c.status==="fail").length,o=n.filter(c=>c.status==="error").length,a=n.filter(c=>c.status==="skip").length;return{criterion:t,state:s+o>0?"failed":i>0?"verified":"unverified",matched:n.length,pass:i,fail:s,skip:a,error:o}}function _Fe(t,e,r){let n=cE(t.file);return e.files.some(i=>cE(i)===n)?t.selector===e.name?!0:r.some(i=>i.name===t.selector&&i.files.some(s=>cE(s)===n))||t.selector!==e.sourceTitle?!1:r.filter(i=>i.sourceTitle===t.selector&&i.files.some(s=>cE(s)===n)).length===1:!1}function cE(t){return t.replaceAll("\\","/").replace(/^\.\//,"")}var iM=S(()=>{"use strict"});function ud(t){try{let e=yr(Ga(t.receipt)),r=rE(e,t.trustSnapshot,t.expected);if(r.assurance!=="verified"||r.currentness!=="current")return;let n=Object.freeze({receipt:oM(e),verification:oM(r)});return fte.add(n),n}catch{return}}function lE(t){let e=t.bindings&&t.report?jb(t.bindings,t.report):[],r=new Map(e.map(n=>[n.criterion,n]));return[...t.criteria].sort().map(n=>{let i=r.get(n)??{criterion:n,state:"unverified",matched:0,pass:0,fail:0,skip:0,error:0};if(t.schemaVersion==="0.1")return{criterion:n,test:i,audit:"unverified",uat:"unverified",blind:"unverified",assertedEvidence:0};let s=(t.receipts??[]).filter($Fe).filter(({receipt:u})=>SFe(u,n)),o=wFe(s,n),a=xFe(s,n,t.criteriaByFeature),c=kFe(s,n,t.bindings??[],t.report),l=(t.evidence??[]).filter(u=>IFe(u,n)&&pte(u)==="asserted").length;return{criterion:n,test:i,audit:o,uat:a,blind:c,assertedEvidence:l}})}function SFe(t,e){return t.subject===`criterion:${e}`||t.subject===`feature:${e.split("/")[0]}`}function wFe(t,e){let r=t.map(({receipt:n})=>n).filter(n=>PFe(n)&&n.subject===`criterion:${e}`).map(n=>n.checks);return r.some(n=>Object.values(n).includes("fail"))?"failed":r.some(n=>Object.values(n).every(i=>i==="pass"))?"verified":"unverified"}function xFe(t,e,r){let n=t.map(({receipt:a})=>a).filter(a=>RFe(a)&&a.subject===`feature:${e.split("/")[0]}`),i=`criterion:${e}`;if(n.some(a=>a.criterion_verdicts[i]==="fail"||Object.values(a.checks).includes("fail")))return"failed";let s=e.split("/")[0],o=r?.get(s);return o&&n.some(a=>EFe(a,o)&&Object.values(a.criterion_verdicts).every(c=>c==="pass")&&Object.values(a.checks).every(c=>c==="pass"))?"verified":"unverified"}function kFe(t,e,r,n){let i=t.map(({receipt:s})=>s).filter(s=>s.method==="blind_capability"&&s.subject===`criterion:${e}`);return i.some(s=>s.verdict==="fail")?"failed":n&&i.some(s=>s.verdict==="pass"&&r.filter(o=>o.criterion===e&&AFe(s.evidence.locator,o)).some(o=>jb([o],n)[0]?.state==="verified"))?"verified":"unverified"}function EFe(t,e){let r=Object.keys(t.criterion_verdicts);return r.length===e.size&&r.every(n=>e.has(n))}function AFe(t,e){let r=sM(t),n=`${sM(e.file)}#${e.selector}`;return r===sM(e.file)||r===n}function sM(t){return t.replaceAll("\\","/").replace(/^\.\//,"")}function $Fe(t){return t!==null&&typeof t=="object"&&fte.has(t)}function oM(t){if(t===null||typeof t!="object"||Object.isFrozen(t))return t;for(let e of Object.values(t))oM(e);return Object.freeze(t)}function IFe(t,e){let[r,n]=e.split("/");return t.featureId===r&&t.acId===n}function PFe(t){return t.method==="human_channel"&&t.claim==="audit"}function RFe(t){return t.method==="human_channel"&&t.claim==="uat"}var fte,Lb=S(()=>{"use strict";aE();iM();kn();fte=new WeakSet});function uE(t,e){let r=[];for(let n of t){let i;try{i=yr(n.bytes)}catch{continue}let s=ud({receipt:i,trustSnapshot:e,expected:n.expected});s&&r.push({address:s.receipt.subject,identity:fl(s.receipt)})}return r.sort((n,i)=>n.identityi.identity?1:0)}var aM=S(()=>{"use strict";kn();Lb()});import{createHash as CFe}from"node:crypto";import{lstatSync as hte,readFileSync as TFe,readdirSync as OFe}from"node:fs";import{join as NFe,relative as mte,resolve as DFe}from"node:path";function vte(){return lM}function dE(){return Object.freeze({personas:dd,skills:Jf,geminiCommands:Object.freeze(["init"]),lanes:Object.freeze(["claude-agents","claude-init","claude-bundled-agents","codex-skills","antigravity-skills","gemini-init"]),policy:"plugin-mirror-census-v2"})}function UFe(t){let e=xte(t),r=e?.frontmatter?.description;if(!e||typeof r!="string"||!r.trim())return;let n=e.body.trimStart().replace(/\s+$/,""),i=`description = "${HFe(r.trim())}"`;return n.includes("'''")?`${i} +prompt = """ +${n.replace(/\\/g,"\\\\").replace(/"/g,'\\"')} +""" +`:`${i} +prompt = ''' +${n} +''' +`}function _te(t){let e=DFe(t),r=[],n=new Map;VFe(e,r);for(let h of cM){let m=gte(e,h,r,"canonical");m!==void 0&&n.set(h,m)}for(let h of[...dd.map(m=>`src/agents/${m}.md`),...Jf.map(m=>`skills/${m}/SKILL.md`)]){let m=n.get(h),y=m===void 0?void 0:xte(m);(!y||typeof y.frontmatter.description!="string"||!y.frontmatter.description.trim())&&r.push(nr("malformed",h,"canonical persona or skill requires a string YAML frontmatter description"))}let i=new Set(dd);for(let h of Jf)i.has(h)&&r.push(nr("collision",`plugins/codex/skills/${h}`,"persona and skill canonical inputs collide"));let s=qFe(n,r),o=new Set(s.keys()),a=[];for(let[h,m]of[...s.entries()].sort(([y],[v])=>Wa(y,v))){let y=gte(e,h,r,"destination",!1),v=Mb(m.bytes),g=y===void 0?"":Mb(y);a.push(Object.freeze({path:h,source:m.source,expected_sha256:v,actual_sha256:g,...y!==void 0&&y!==m.bytes?{state:"stale"}:y===void 0?{state:"missing"}:{state:"current"}})),y===void 0&&!WFe(r,h,"symlink")&&r.push(nr("missing",h,m.source)),y!==void 0&&y!==m.bytes&&r.push(nr("stale",h,m.source))}let c=GFe(e,r);for(let h of c)o.has(h)||[...o].some(m=>m.startsWith(`${h}/`))||r.push(nr("extra",h,"unmanaged nested destination"));let l=[...s.entries()].sort(([h],[m])=>Wa(h,m)).map(([h,m])=>Object.freeze({path:h,bytes:m.bytes,source:m.source,sha256:Mb(m.bytes)})),u=cM.map(h=>Object.freeze({path:h,sha256:n.has(h)?Mb(n.get(h)):""})),d=Object.freeze(ZFe(r).sort((h,m)=>Wa(`${h.kind}\0${h.path}\0${h.detail}`,`${m.kind}\0${m.path}\0${m.detail}`))),p=!d.some(h=>h.kind==="incomplete"||h.kind==="invalid"||h.kind==="malformed"||h.kind==="collision"||h.kind==="symlink"),f=Mb(dM({manifest:dE(),closure:lM,inputs:u,expected:l.map(h=>({path:h.path,sha256:h.sha256,source:h.source})),outputs:a.map(h=>({path:h.path,expected_sha256:h.expected_sha256,actual_sha256:h.actual_sha256}))}));return Object.freeze({manifest:dE(),inputAddresses:Object.freeze(lM.map(h=>`artifact:${h}`)),inputSha256:f,expected:Object.freeze(l),outputs:Object.freeze(a),issues:d,complete:p,clean:d.length===0})}function BFe(){let t=[];for(let e of dd){let r=`src/agents/${e}.md`;t.push({path:`plugins/claude-code/agents/${e}.md`,source:r,transform:"copy"},{path:`plugins/claude-code/dist/agents/${e}.md`,source:r,transform:"copy"},{path:`plugins/codex/skills/${e}/SKILL.md`,source:r,transform:"copy"},{path:`plugins/antigravity/skills/${e}/SKILL.md`,source:r,transform:"copy"})}for(let e of Jf){let r=`skills/${e}/SKILL.md`;t.push({path:`plugins/codex/skills/${e}/SKILL.md`,source:r,transform:"copy"},{path:`plugins/antigravity/skills/${e}/SKILL.md`,source:r,transform:"copy"})}return t.push({path:"plugins/claude-code/commands/init.md",source:"skills/init/SKILL.md",transform:"copy"},{path:"plugins/gemini-cli/commands/init.toml",source:"skills/init/SKILL.md",transform:"gemini"},{path:"plugins/claude-code/dist/agents/README.md",source:"src/agents/README.md",transform:"copy"},{path:"plugins/claude-code/agents/README.md",source:"mirror policy",transform:"literal",bytes:LFe},{path:"plugins/codex/skills/README.md",source:"mirror policy",transform:"literal",bytes:MFe},{path:"plugins/gemini-cli/commands/README.md",source:"mirror policy",transform:"literal",bytes:FFe}),t}function qFe(t,e){let r=new Map;for(let n of bte){let i=n.transform==="literal"?n.bytes:t.get(n.source);if(i===void 0)continue;let s=n.transform==="gemini"?UFe(i):i;if(s===void 0){e.push(nr("malformed",n.source,"Gemini init requires a string frontmatter description"));continue}if(r.has(n.path)){e.push(nr("collision",n.path,`${r.get(n.path).source} and ${n.source}`));continue}r.set(n.path,{bytes:s,source:n.source})}return r}function VFe(t,e){let r=uM(t,"src/agents",e,"canonical");for(let i of r)!i.name.endsWith(".md")||i.name==="README.md"||(i.isSymbolicLink?e.push(nr("symlink",`src/agents/${i.name}`,"canonical persona may not be a symbolic link")):i.isFile?dd.includes(i.name.replace(/\.md$/,""))||e.push(nr("invalid",`src/agents/${i.name}`,"unregistered persona input")):e.push(nr("invalid",`src/agents/${i.name}`,"canonical persona must be a regular file")));let n=uM(t,"skills",e,"canonical");for(let i of n){if(i.isSymbolicLink){e.push(nr("symlink",`skills/${i.name}`,"canonical skill may not be a symbolic link"));continue}if(!i.isDirectory){e.push(nr("invalid",`skills/${i.name}`,"canonical skill must be a directory"));continue}dd.includes(i.name)?e.push(nr("collision",`plugins/codex/skills/${i.name}`,"persona and skill canonical inputs collide")):Jf.includes(i.name)||e.push(nr("invalid",`skills/${i.name}`,"unregistered skill input"))}}function GFe(t,e){let r=[];for(let n of jFe)Ste(t,n,e,r);return r.sort(Wa)}function Ste(t,e,r,n){let i=uM(t,e,r,"destination",!1);for(let s of i){let o=`${e}/${s.name}`;n.push(o),s.isSymbolicLink?r.push(nr("symlink",o,"managed destination may not be a symbolic link")):s.isDirectory&&Ste(t,o,r,n)}}function uM(t,e,r,n,i=!0){let s=wte(t,e,r,n);if(s===void 0)return i&&r.push(nr("incomplete",e,`missing or unsafe ${n} directory`)),[];if(!s.stat.isDirectory())return r.push(nr("invalid",e,`${n} path is not a directory`)),[];try{return OFe(s.absolute,{withFileTypes:!0}).sort((o,a)=>Wa(o.name,a.name)).map(o=>({name:o.name,isFile:o.isFile(),isDirectory:o.isDirectory(),isSymbolicLink:o.isSymbolicLink()}))}catch{return r.push(nr("invalid",e,`${n} directory disappeared during census`)),[]}}function gte(t,e,r,n,i=!0){let s=wte(t,e,r,n);if(s===void 0){i&&r.push(nr("incomplete",e,`missing or unsafe ${n} input`));return}if(!s.stat.isFile()){r.push(nr("invalid",e,`${n} path is not a regular file`));return}try{return TFe(s.absolute,"utf8")}catch{r.push(nr("invalid",e,`${n} file disappeared during census`));return}}function wte(t,e,r,n){let i=t;try{let s=hte(t);if(s.isSymbolicLink()){r.push(nr("symlink",".",`${n} workspace root may not be a symbolic link`));return}if(!s.isDirectory()){r.push(nr("invalid",".",`${n} workspace root is not a directory`));return}}catch{r.push(nr("invalid",".",`${n} workspace root is unreadable`));return}for(let s of e.split("/")){i=NFe(i,s);try{let o=hte(i);if(o.isSymbolicLink()){r.push(nr("symlink",mte(t,i).replaceAll("\\","/"),`${n} path may not contain a symbolic link`));return}if(s!==e.split("/").at(-1)&&!o.isDirectory()){r.push(nr("invalid",mte(t,i).replaceAll("\\","/"),`${n} path ancestor is not a directory`));return}if(s===e.split("/").at(-1))return{absolute:i,stat:o}}catch{return}}}function xte(t){if(!t.startsWith(`--- +`))return;let e=t.indexOf(` +--- +`,4);if(e!==-1)try{let r=(0,yte.parse)(t.slice(4,e));return r&&typeof r=="object"&&!Array.isArray(r)?{frontmatter:r,body:t.slice(e+5)}:void 0}catch{return}}function HFe(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function nr(t,e,r){return Object.freeze({kind:t,path:e,detail:r})}function WFe(t,e,r){return t.some(n=>n.path===e&&n.kind===r)}function ZFe(t){return[...new Map(t.map(e=>[`${e.kind}\0${e.path}\0${e.detail}`,e])).values()]}function Wa(t,e){return te?1:0}function Mb(t){return CFe("sha256").update(t,"utf8").digest("hex")}function dM(t){return Array.isArray(t)?`[${t.map(dM).join(",")}]`:t&&typeof t=="object"?`{${Object.entries(t).sort(([e],[r])=>Wa(e,r)).map(([e,r])=>`${JSON.stringify(e)}:${dM(r)}`).join(",")}}`:JSON.stringify(t)}var yte,dd,Jf,cM,jFe,LFe,MFe,FFe,bte,zFe,lM,kte=S(()=>{"use strict";yte=Et(cr(),1),dd=Object.freeze(["blind-author","developer","observability","orchestrator","planner","reviewer"]),Jf=Object.freeze(["changelog","check","checkpoint","clarify","doctor","init","oracle","rollback","route","serve","status","sync"]),cM=Object.freeze([...dd.map(t=>`src/agents/${t}.md`),...Jf.map(t=>`skills/${t}/SKILL.md`),"src/agents/README.md","scripts/plugin-mirror-policy.mjs","scripts/build-plugin.mjs","package.json"].sort(Wa)),jFe=Object.freeze(["plugins/claude-code/agents","plugins/claude-code/commands","plugins/claude-code/dist/agents","plugins/codex/skills","plugins/antigravity/skills","plugins/gemini-cli/commands"]),LFe="\n\n\n# Cladding plugin \xB7 agents/\n\nThis directory is the Claude Code plugin manifest mirror of `src/agents/`.\nFiles here are copied verbatim from `src/agents/` by\n`scripts/build-plugin.mjs` (run by `npm run build:plugin`).\n\nEdit the source under `src/agents/.md`, then re-run the build.\n",MFe="\n\n\n# Cladding Codex plugin \xB7 skills/\n\nThis directory is the Codex plugin manifest mirror, generated from\ntwo canonical sources by `scripts/build-plugin.mjs`:\n\n- `/SKILL.md` \u2190 copied verbatim from repo-root `skills//SKILL.md`\n- `/SKILL.md` \u2190 copied verbatim from `src/agents/.md`\n\nRe-run `npm run build:plugin` after editing either source.\n",FFe=` + + +# Cladding Gemini CLI plugin \xB7 commands/ + +This directory is the Gemini CLI plugin manifest mirror, generated +by \`scripts/build-plugin.mjs\` from \`skills//SKILL.md\`: + +- \`description\` \u2190 SKILL.md frontmatter \`description\` +- \`prompt\` \u2190 SKILL.md body (after frontmatter) + +TOML output uses literal multi-line strings (\`'''\u2026'''\`) so +backticks and backslashes pass through unaltered. + +Re-run \`npm run build:plugin\` after editing the source. +`,bte=Object.freeze(BFe().map(t=>Object.freeze(t)).sort((t,e)=>Wa(t.path,e.path))),zFe=Object.freeze(bte.map(t=>t.path)),lM=Object.freeze([...new Set([...cM,...zFe])].sort(Wa))});import{relative as JFe,resolve as Ete}from"node:path";function pM(t){return t.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"")}function Ate(t){return t.replace(/\.[A-Za-z0-9]+$/,"")}function Ite(t){return t.includes("/")||t.includes(".")&&!/\s/.test(t)}function KFe(t){let e=[],r=pE(t,"file");r&&e.push(pM(r));let n=pE(t,"classname");if(n){let i=pM(n);e.push(i),!i.includes("/")&&i.includes(".")&&e.push(i.replace(/\./g,"/"))}return e}function pd(t){let e=new Map,r=[],n;for($te.lastIndex=0;(n=$te.exec(t))!==null;){let i=n[1],s=n[3]??"",o=KFe(i);if(o.length===0)continue;let a=e.get(o[0])??{pass:0,fail:0,skip:0},c=/typeof f=="string")&&typeof a.title=="string"?[...c,a.title].join(" > "):a.fullName??a.title;if(!u)continue;let d=a.status==="passed"?"pass":a.status==="failed"?"fail":a.status==="skipped"||a.status==="pending"||a.status==="todo"?"skip":"error",p=n.get(o)??{pass:0,fail:0,skip:0};d==="pass"?p.pass+=1:d==="skip"?p.skip+=1:p.fail+=1,n.set(o,p),i.push(Object.freeze({file:o,files:Object.freeze([o]),className:o,name:u,...typeof a.title=="string"?{sourceTitle:a.title}:{},status:d}))}}return Object.defineProperty(n,"cases",{value:Object.freeze(i),enumerable:!1}),n}catch{return}}function YFe(t){return t.replace(/&(?:(amp|lt|gt|quot|apos)|#(x[0-9a-fA-F]+|[0-9]+));/g,(e,r,n)=>{if(r)return{amp:"&",lt:"<",gt:">",quot:'"',apos:"'"}[r];let i=n,s=i.startsWith("x")?Number.parseInt(i.slice(1),16):Number.parseInt(i,10);return!Number.isInteger(s)||s<0||s>1114111||s>=55296&&s<=57343?"\uFFFD":String.fromCodePoint(s)})}function Pte(t,e){let r=pM(e),n=t.get(r);if(n)return n;let i=Ate(r);for(let[s,o]of t){let a=Ate(s);if(a===i||a.endsWith(`/${i}`)||i.endsWith(`/${a}`))return o}}var pE,$te,zb=S(()=>{"use strict";pE=(t,e)=>{let r=new RegExp(`\\b${e}=(?:"([^"]*)"|'([^']*)')`).exec(t);return r?YFe(r[1]??r[2]??""):void 0},$te=/]*?)(\/>|>([\s\S]*?)<\/testcase>)/g});function Rte(t){return t!==null&&typeof t=="object"&&XFe.has(t)}var XFe,fM=S(()=>{"use strict";XFe=new WeakSet});import{existsSync as fE,statSync as QFe}from"node:fs";import{dirname as hM,extname as eze,isAbsolute as Cte,join as mM,relative as gM,resolve as hE,sep as tze}from"node:path";function mE(t){return t==="./gradlew"||t==="gradle"}function rze(t){return(fE(mM(t,"build.gradle.kts"))||fE(mM(t,"build.gradle")))&&fE(mM(t,"gradle.properties"))}function nze(t,e){let n=gM(t,e).split(tze).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function hl(t,e){return t===":"?`:${e}`:`${t}:${e}`}function ize(t,e){let r=hE(t,e),n=r;fE(r)?QFe(r).isFile()&&(n=hM(r)):eze(r)!==""&&(n=hM(r));let i=gM(t,n);if(i.startsWith("..")||Cte(i))return null;let s=n;for(;;){if(rze(s))return s;if(hE(s)===hE(t))return null;let o=hM(s);if(o===s)return null;let a=gM(t,o);if(a.startsWith("..")||Cte(a))return null;s=o}}function gE(t,e){let r=hE(t),n=new Map,i=[];for(let s of e){let o=ize(r,s);if(!o){i.push(s);continue}let a=nze(r,o);n.has(a)||n.set(a,{path:a,dir:o})}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((s,o)=>s.patho.path?1:0)}var yE=S(()=>{"use strict"});import{existsSync as bM,readFileSync as sze}from"node:fs";import{join as Kf}from"node:path";function Yf(t="."){let e=Kf(t,".cladding","config.yaml");if(!bM(e))return yM;try{let n=(0,Tte.parse)(sze(e,"utf8"))?.gate;if(!n)return yM;let i=n.scope==="repo"?"repo":"feature",s=n.coverage==="kover"||n.coverage==="jacoco"?n.coverage:void 0,o=typeof n.test_report=="string"?n.test_report:void 0,a={};if(n.commands&&typeof n.commands=="object")for(let l of oze){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),s&&(c.coverage=s),o&&(c.testReport=o),c}catch{return yM}}function Ub(t="."){let e=Yf(t).testReport,r=e?[e,...vM]:vM;return[...new Set(r.map(n=>Kf(t,n)))]}function Ote(t="."){let e=Yf(t).testReport;if(e){let r=Kf(t,e);return bM(r)?r:null}return vM.map(r=>Kf(t,r)).find(r=>bM(r))??null}function Nte(t,e){let r=[],n=!1;for(let i of t){let s=aze.exec(i);if(s){n=!0;for(let o of e)r.push(hl(o.path,s[1]))}else r.push(i)}return n&&e.length===0||r.length===0?null:{cmd:r[0],args:r.slice(1)}}var Tte,oze,yM,vM,aze,Xf=S(()=>{"use strict";Tte=Et(cr(),1);yE();oze=["type","lint","test","coverage"],yM={scope:"feature"},vM=["test-report.junit.xml",Kf("coverage","junit.xml"),Kf(".cladding","test-report.junit.xml")];aze=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{createHash as _M,randomBytes as cze}from"node:crypto";import{readFileSync as SM,unlinkSync as lze}from"node:fs";import{tmpdir as uze}from"node:os";import{join as dze,relative as pze,resolve as Za}from"node:path";import fze from"node:process";function Dte(t,e){let r=Za(t),n=new Map;for(let i of Ub(r))try{n.set(i,SM(Lte(r,i),"utf8"))}catch{n.set(i,void 0)}xt={cwd:r,...e===void 0?{}:{inputSha256:e},run:null,jsonFile:null,reportsBefore:n}}function wM(){return xt!==null}function xM(t){return xt?.cwd===Za(t)&&xt.inputSha256!==void 0}function kM(t,e,r){if(!(!xt||xt.cwd!==Za(t)||xt.inputSha256===void 0))try{let n=SM(e,"utf8"),i=Object.freeze({inputSha256:xt.inputSha256,adapter:Object.freeze({id:"legacy-stage:stage_2.1",version:"1"}),command:Object.freeze([...r]),commandSha256:Mte(r),reportSha256:zte(n),format:"vitest-json",reportBytes:n});Bb.add(i),xt.proof=i}catch{}}function jte(t,e){if(!(!xt||xt.cwd!==Za(t)||xt.inputSha256===void 0))for(let r of Ub(xt.cwd))try{let n=SM(Lte(xt.cwd,r),"utf8");if(n===xt.reportsBefore.get(r))continue;let i=Object.freeze({inputSha256:xt.inputSha256,adapter:Object.freeze({id:"legacy-stage:stage_2.1",version:"1"}),command:Object.freeze([...e]),commandSha256:Mte(e),reportSha256:zte(n),format:"junit-xml",reportBytes:n});Bb.add(i),xt.proof=i;return}catch{}}function Lte(t,e){let r=Za(e),n=pze(Za(t),r).replaceAll("\\","/");if(n===".."||n.startsWith("../"))throw new Error("unsafe test report path");return xn(t,n)}function Mte(t){return _M("sha256").update(JSON.stringify([...t]),"utf8").digest("hex")}function Fte(t){if(!(t===void 0||!Bb.has(t)))return _M("sha256").update(JSON.stringify({input:t.inputSha256,adapter:t.adapter,command:t.commandSha256,report:t.reportSha256}),"utf8").digest("hex")}function zte(t){return _M("sha256").update(t,"utf8").digest("hex")}function Ute(t,e){let r=xt?.cwd===Za(t)&&xt.inputSha256===e?xt.proof:void 0;return r!==void 0&&Bb.has(r)?r:void 0}function qb(t){return t!==null&&typeof t=="object"&&Bb.has(t)}function EM(t,e){if(!xt||xt.cwd!==Za(t))return null;if(xt.run)return xt.run;let r=dze(uze(),`clad-shared-vitest-${fze.pid}-${cze(6).toString("hex")}.json`);xt.jsonFile=r;let n=e(r);return xt.run={proc:n,jsonFile:r},xt.run}function Bte(t){return!xt||xt.cwd!==Za(t)?null:xt.run}function AM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function qte(){let t=xt?.jsonFile;if(xt=null,t)try{lze(t)}catch{}}var Bb,xt,Qf=S(()=>{"use strict";Zu();fM();zb();Xf();Bb=new WeakSet,xt=null});import{createHash as hze}from"node:crypto";import{lstatSync as Vte,readFileSync as mze}from"node:fs";import{join as gze,resolve as yze}from"node:path";function PM(t,e=new WeakSet){if(t===null||typeof t!="object"||e.has(t))return t;e.add(t);for(let r of Object.values(t))PM(r,e);return Object.freeze(t),t}function Ja(t){return bze.get(t)}function RM(t){return t!==null&&typeof t=="object"&&Jte.has(t)}function Qte(t){return t!==null&&typeof t=="object"&&Kte.has(t)}function vze(t){let e=wE("F-dd8dc994/AC-25f77cec");return xze(e,TM(t,SE(e)),!0,Aze)}function _ze(t){let e=wE("F-40327b/AC-004"),r=_te(t),n=r.issues.some(i=>["incomplete","invalid","malformed","collision","symlink"].includes(i.kind));return xE({criterion:e.criterion,carrier:e.carrier,adapter:e.adapter,state:n?"unobserved":r.clean?"pass":"fail",current:!0,complete:r.complete&&!n,applicable:r.complete&&!n,input_addresses:e.inputAddresses,input_sha256:r.inputSha256,manifest_sha256:fd(e.manifest),...r.issues.length===0?{}:{locator:r.issues.map(i=>`${i.kind}:${i.path}`).join(",")},...n?{reason:"invalid"}:{}})}function vE(t,e,r){return e.schemaVersion!=="0.2"?Object.freeze([]):Object.freeze(nre(e,r).map(n=>$ze(t,n)))}function _E(t,e){let r=Object.freeze({subjects:Object.freeze(nre(t,e).map(n=>`criterion:${n.criterion}`).sort(Bt))});return Kte.add(r),r}function ere(t){if(t.compilation.schemaVersion!=="0.2"||!Eze(t.currentRun,t.expectedGateInputSha256))return Object.freeze([]);let e=[];return IM("F-b7873005/AC-0fa3265d",t.scopeAddresses)&&e.push(Sze(t)),IM("F-c58263b8/AC-01797b10",t.scopeAddresses)&&e.push(wze(t)),Object.freeze(e)}function Sze(t){let e=wE("F-b7873005/AC-0fa3265d"),r=CM(e,TM(t.cwd,SE(e))),n=Qu(t.cwd,t.compilation).filter(a=>a.criterion===e.criterion&&a.file===bE.path&&a.selector===bE.selector),i=tre(t.currentRun,t.cwd),s=i===void 0||n.length!==1?void 0:lE({schemaVersion:"0.2",criteria:[e.criterion],bindings:n,report:i})[0],o=!r.complete||s===void 0?"unobserved":s.test.state==="failed"?"fail":s.test.state==="verified"?"pass":"unobserved";return xE({criterion:e.criterion,carrier:e.carrier,adapter:e.adapter,state:o,current:!0,complete:r.complete&&s!==void 0,applicable:!1,input_addresses:e.inputAddresses,input_sha256:fd({criterion:e.criterion,manifest:e.manifest,records:r.records,gate:rre(t.currentRun)}),manifest_sha256:fd(e.manifest),...o==="unobserved"?{reason:r.complete?"stale":"missing"}:{}})}function wze(t){let e=wE("F-c58263b8/AC-01797b10"),r=CM(e,TM(t.cwd,SE(e))),n=tre(t.currentRun,t.cwd)?.cases,i=$M.map(c=>({path:c,cases:(n??[]).filter(l=>l.files.includes(c))})),s=r.complete&&i.every(c=>c.cases.length>0),o=s&&i.some(c=>c.cases.some(l=>l.status==="fail"||l.status==="error")),a=s&&i.every(c=>c.cases.every(l=>l.status==="pass"));return xE({criterion:e.criterion,carrier:e.carrier,adapter:e.adapter,state:o?"fail":a?"pass":"unobserved",current:!0,complete:s,applicable:!1,input_addresses:e.inputAddresses,input_sha256:fd({criterion:e.criterion,manifest:e.manifest,records:r.records,gate:rre(t.currentRun)}),manifest_sha256:fd(e.manifest),...a||o?{}:{reason:r.complete?"stale":"missing"}})}function xze(t,e,r,n){let i=CM(t,e),s=i.records.flatMap(a=>a.bytes===""?[]:n(a.path,Buffer.from(a.bytes,"base64").toString("utf8")).map(c=>`${a.path}:${c}`)).sort(Bt),o=Object.freeze({criterion:t.criterion,carrier:t.carrier,adapter:t.adapter,state:i.complete?s.length>0?"fail":"pass":"unobserved",current:!0,complete:i.complete,applicable:i.complete,input_addresses:t.inputAddresses,input_sha256:fd({criterion:t.criterion,adapter:t.adapter,manifest:t.manifest,records:i.records}),manifest_sha256:fd(t.manifest),...i.complete?{}:{reason:"missing"},...s.length>0?{locator:s.join(",")}:{}});return r?xE(o):o}function CM(t,e){let r=SE(t).map(n=>{let i=e[n];return Object.freeze({path:n,bytes:i===void 0?"":Buffer.from(i).toString("base64")})});return Object.freeze({complete:r.every(n=>n.bytes!==""),records:Object.freeze(r)})}function TM(t,e){return Object.freeze(Object.fromEntries(e.map(r=>[r,kze(t,r)])))}function kze(t,e){let r=yze(t);try{if(Vte(r).isSymbolicLink())return;let n=r,i=e.split("/");for(let[s,o]of i.entries()){n=gze(n,o);let a=Vte(n);if(a.isSymbolicLink()||se.includes(r)))}function SE(t){return t.inputAddresses.filter(e=>e.startsWith("artifact:")).map(e=>e.slice(9))}function nre(t,e){if(t.schemaVersion!=="0.2")return Object.freeze([]);let r=new Set(t.nodes.filter(n=>n.nodeType==="semantic"&&n.kind==="criterion").map(n=>n.address));return Object.freeze(Xte.filter(n=>n.mode==="static"&&r.has(`criterion:${n.criterion}`)&&IM(n.criterion,e)))}function $ze(t,e){if(e.criterion==="F-dd8dc994/AC-25f77cec")return vze(t);if(e.criterion==="F-40327b/AC-004")return _ze(t);throw new Error(`static criterion rule has no workspace adapter: ${e.criterion}`)}function IM(t,e){let r=t.split("/")[0];return e.includes(`criterion:${t}`)||e.includes(`feature:${r}`)}function wE(t){let e=Ja(t);if(!e)throw new Error(`missing criterion observation rule: ${t}`);return e}function xE(t){let e=Object.freeze({...t,input_addresses:Object.freeze([...t.input_addresses].sort(Bt))});return Jte.add(e),e}var Jte,Kte,Vb,ms,fd,bE,$M,Gte,Hte,Yte,Wte,Zte,Xte,bze,Gb=S(()=>{"use strict";kte();Go();qa();Uf();Lb();zb();Qf();Jte=new WeakSet,Kte=new WeakSet,Vb=t=>Object.freeze([...t].sort(Bt)),ms=t=>`artifact:${t}`,fd=t=>hze("sha256").update(It(t),"utf8").digest("hex");bE=Object.freeze({path:"tests/stages/finding-parser.test.ts",selector:"finding-parser (F-b7873005) > [covers:F-b7873005/AC-0fa3265d] derives every reported location from captured tool output despite contradictory, missing, or mutated source"}),$M=Vb(["tests/stages/planned-backlog.test.ts","tests/stages/hollow-governance.test.ts","tests/stages/scenario-coverage.test.ts","tests/stages/project-context-drift.test.ts","tests/core/git-ops.test.ts","tests/changelog/collect.test.ts","tests/report/report.test.ts","tests/report/report-cli.test.ts","tests/cli/changelog-measure.test.ts","tests/optimizer/measurement.test.ts","tests/optimizer/infer-depends-on.test.ts","tests/optimizer/code-excerpt.test.ts","tests/events/log.test.ts"]),Gte=Vb(["src/stages/detectors/planned-backlog.ts","src/stages/detectors/hollow-governance.ts","src/stages/detectors/scenario-coverage.ts","src/stages/detectors/project-context-drift.ts","src/core/git-ops.ts","src/changelog/collect.ts","src/cli/report.ts","src/cli/changelog.ts","src/optimizer/infer-depends-on.ts","src/optimizer/measurement.ts","src/optimizer/code-excerpt.ts","src/events/log.ts"]),Hte=Vb(["src/ui/softShell.ts","src/cli/hook.ts","src/cli/clad.ts","src/cli/done.ts","src/spec/schema.json","src/assurance/criterion-observations.ts","src/assurance/kernel.ts","src/assurance/adapters.ts","src/assurance/workspace.ts"]),Yte=Object.freeze(["resolveLocale","PlainLocale","readSidecarLocale","user-locale","project.locale"]),Wte=(t,e,r,n)=>Object.freeze({criterion:t,mode:"static",carrier:"static-census",adapter:Object.freeze(e),inputAddresses:Vb(r),manifest:PM(n),applicability:i=>i.current&&i.complete&&i.applicable}),Zte=(t,e,r,n,i)=>Object.freeze({criterion:t,mode:"behavior",carrier:e,adapter:Object.freeze(r),inputAddresses:Vb(n),manifest:PM(i),applicability:()=>!1}),Xte=Object.freeze([Zte("F-b7873005/AC-0fa3265d","proof-view",{id:"tool-output-location-parser",version:"2"},[ms("src/stages/finding-parser.ts"),ms(bE.path),ms("src/assurance/criterion-observations.ts"),ms("src/stages/junit-report.ts")],{carrier:"proof-view",binding:bE,adapterInput:"captured-tool-output-v1",locationSource:"adapter-only"}),Zte("F-c58263b8/AC-01797b10","current-suite-closure",{id:"compaction-proof-closure",version:"2"},[...$M.map(ms),...Gte.map(ms),ms("package.json"),ms("vitest.config.ts"),ms("src/assurance/criterion-observations.ts"),ms("src/stages/junit-report.ts")],{carrier:"current-suite-closure",suites:$M,implementations:Gte,runnerConfig:["package.json","vitest.config.ts"],adapterPolicy:"criterion-observations-v2"}),Wte("F-dd8dc994/AC-25f77cec",{id:"locale-tail-static",version:"2"},Hte.map(ms),{carrier:"static-census",sourceUniverse:Hte,forbidden:Yte,allowed:["String.localeCompare"]}),Wte("F-40327b/AC-004",{id:"plugin-mirror-census",version:"2"},vte().map(ms),{carrier:"static-census",manifest:dE(),transform:"plugin-mirror-policy.mjs",outputs:"expected-and-actual-sha256-v2"})]),bze=new Map(Xte.map(t=>[t.criterion,t]))});function kE(t,e){let r=Gu(t);return r.status==="valid"?typeof e=="string"&&e!==Ize(r.pattern)?{status:"conflict",reason:"DECLARED_PATTERN_MISMATCH"}:{status:"parsed",statement:r}:Rze(e)||Pze(t)||LX(t)?{status:"conflict",reason:"MALFORMED_EARS",issues:r.issues}:{status:"opaque"}}function Ize(t){return t==="compound"?"complex":t}function Pze(t){return typeof t=="string"&&/^\s*(?:the|when|while|where|if)\b/i.test(t)}function Rze(t){return t==="ubiquitous"||t==="event"||t==="state"||t==="optional"||t==="unwanted"||t==="complex"}var OM=S(()=>{"use strict";Ak()});import{existsSync as Cze}from"node:fs";import{join as Tze}from"node:path";function Oze(t){return Tze(t,DM,jM)}function ire(t){return NM.add(t),()=>NM.delete(t)}function sre(t,e,r){rr(t,()=>LM(t,e,r)),MM(t,e)}function LM(t,e,r){let n=`${DM}/${jM}`,i=Tr(t,n);Gr(t,[{path:n,before:i,after:`${i??""}${JSON.stringify(e)} +`}],r)}function MM(t,e){for(let r of NM)try{r(t,e)}catch{}}function Dr(t){let e=Oze(t);if(!Cze(e))return[];let r=Tr(t,`${DM}/${jM}`)?.trim()??"";return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var DM,jM,NM,hi=S(()=>{"use strict";kr();DM=".cladding",jM="audit.log.jsonl";NM=new Set});import{spawnSync as Nze}from"node:child_process";import{createHash as Dze}from"node:crypto";function FM(t,e,r){let n=r??Fze(t),i=new Map;for(let a of new Set(e)){let c=are(a),l=Lze(n,c).map(d=>({root:a,assurance:"asserted",author:d.author,name:d.name}));if(l.length>0){i.set(a,l);continue}let u=Mze(t,c);i.set(a,[u===void 0?{root:a,assurance:"asserted",author:"unknown",name:""}:{root:a,assurance:"asserted",author:"git",name:u}])}let s=new Map;for(let a of[...i.values()].flat())s.set(Ga(a),a);let o=[...s.entries()].sort(([a],[c])=>ac?1:0).map(([,a])=>Object.freeze(a));return Object.freeze({records:Object.freeze(o),complete:o.every(a=>a.author!=="unknown"),sha256:Dze("sha256").update(Ga(o.map(a=>({root:a.root,assurance:a.assurance,author:a.author,name:a.name}))),"utf8").digest("hex"),names:Object.freeze([...new Set(o.filter(a=>a.author!=="unknown"&&a.name.length>0).map(a=>a.name))].sort())})}function ore(t,e){let r=e.trim().toLowerCase();return r.length===0?!1:!t.names.some(n=>n.trim().toLowerCase()===r)}function Lze(t,e){let r=new Map;for(let n of t){if(n.artifact===void 0||are(n.artifact)!==e)continue;let i={author:n.identity.author,name:n.identity.name??""};r.set(`${i.author}\0${i.name}`,i)}return[...r.values()]}function Mze(t,e){try{let r=Nze("git",["log","-1","--format=%an","--",e],{cwd:t,encoding:"utf8",timeout:jze,windowsHide:!0});if(r.error||r.status!==0||typeof r.stdout!="string")return;let n=r.stdout.split(` +`)[0]?.trim()??"";return n.length>0?n:void 0}catch{return}}function Fze(t){try{return Dr(t)}catch{return[]}}function are(t){return t.replaceAll("\\","/").replace(/^\.\//,"").replace(/\/+$/,"")}var jze,cre=S(()=>{"use strict";hi();kn();jze=2e3});import{createHash as Zb}from"node:crypto";import{lstatSync as Ka,readFileSync as bre,readdirSync as zze}from"node:fs";import{dirname as zM,extname as lre,isAbsolute as ure,join as th,relative as dre,resolve as Hb}from"node:path";function Wn(t,e,r,n,i){return Gf(()=>Uze(t,e,r,n,i))}function Uze(t,e,r,n,i=md(t)){let s=i,o=e.schemaVersion==="0.1"?n??oe(t):void 0,a=e.contract,c=vre(e),l=a?a.features.map(g=>({id:g.id,title:g.title,..."baselineIdentity"in g?{baselineIdentity:g.baselineIdentity}:{purpose:g.purpose},modules:g.modules,dependsOn:g.dependsOn,capabilityRefs:g.capabilityRefs,designImpact:g.designImpact,criteria:g.acceptanceCriteria.map(b=>({id:b.id,kind:b.kind,statement:b.statement,rationale:b.rationale,constraintRefs:b.constraintRefs,oracleRefs:b.oracleRefs,evidenceRefs:b.evidenceRefs,..."baselineIdentity"in b?{legacyUnclassified:!0,baselineIdentity:b.baselineIdentity}:{}}))})):(o?.features??[]).map(g=>({id:g.id,title:g.title,modules:g.modules,dependsOn:g.depends_on,baselineIdentity:e.migrationBaseline?.features.find(b=>b.address===`feature:${g.id}`)?.exemption?.id,criteria:(g.acceptance_criteria??[]).map(b=>{let w=e.migrationBaseline?.criteria.find($=>$.address===`criterion:${g.id}/${b.id}`),x=w?.legacyIntent.text??b.text;return{id:b.id,text:x,ears:t6e(b,w?.legacyIntent),scannerState:kE(x,w?.legacyIntent.ears??b.ears).status,legacyUnclassified:w?.classification===Oo,baselineIdentity:w?.exemption.id,oracleRefs:b.oracle_refs,evidenceRefs:b.evidence_refs}})})),u=l.flatMap(g=>(g.modules??[]).map(b=>{let w=Mee(t,b);return{feature:g.id,module:b,...w===void 0?{state:"missing"}:{state:"present",bytes:w}}})),d=e.edges.filter(g=>g.relation==="supports"&&g.provenance==="authored"&&g.channel!==void 0).map(g=>{let b=g.from.replace(/^criterion:/,""),w=Qze(g.normalizedTarget??g.to),x=w?e6e(t,w):void 0,$={address:b,path:w??"",sourceBytes:x,runnerConfig:s(g.channel??"unknown",g.normalizedTarget??g.to)};return g.channel==="oracle"?{...$,oracle:{declaration:g.raw??g.to,resolvedBytes:x}}:g.channel==="evidence"?{...$,evidence:{declaration:g.raw??g.to,resolvedBytes:x}}:$}),p=Qu(t,e),f=new Set(a?.features.filter(g=>g.status==="done").map(g=>g.id)??[]),h=p.map(g=>({address:g.criterion,path:g.file,selector:g.selector,sourceBytes:Cb(t,g.file),bindingProvenance:"live",runnerConfig:{...s("test",`artifact:${g.file}`),framework:g.framework,carrier:g.carrier}})),m=a?.features.flatMap(g=>g.acceptanceCriteria.map(b=>{let w=`${g.id}/${b.id}`;return ed({cwd:t,baseline:e.migrationBaseline,criterion:w,currentCriterion:Bf(b,e.migrationBaseline,w),live:p})}))??[],y=m.flatMap(g=>(g.source==="reviewed"?g.reviewed:g.source==="legacy"?g.legacy:[]).map(w=>({address:g.criterion,path:w.file,...w.selector===void 0?{}:{selector:w.selector},sourceBytes:Cb(t,w.file),bindingState:w.state,...g.source==="reviewed"&&w.sha256!==void 0?{expectedBindingSha256:w.sha256}:{},bindingProvenance:g.source==="reviewed"?"reviewed_carry_forward":"legacy_exempt",runnerConfig:s("test",`artifact:${w.file}`)}))),v=[...d,...y,...h].sort((g,b)=>kt(`${g.address}\0${g.path}\0${g.selector??""}`,`${b.address}\0${b.path}\0${b.selector??""}`));return{schemaVersion:e.schemaVersion,features:l,capabilities:a?.capabilities,architectureRules:a?.architecture.rules,scenarios:a?.scenarios.map(g=>({id:g.id,features:g.featureRefs,intent:{actor:g.actor,goal:g.goal,success:g.success,steps:g.steps}})),scenarioPolicy:a?.project.scenarioPolicy,proofInputs:v,executableProofFeatureIds:Object.freeze([...new Set([...p.filter(g=>a===void 0||f.has(g.criterion.split("/")[0])).map(g=>g.criterion.split("/")[0]),...m.filter(g=>{let b=g.source==="reviewed"?g.reviewed:g.source==="legacy"?g.legacy:[];return(a===void 0||f.has(g.criterion.split("/")[0]))&&b.some(w=>w.state==="available")}).map(g=>g.criterion.split("/")[0])])].sort(kt)),...r?{receiptIdentities:uE(r.candidates,r.trustSnapshot)}:{},migrationBaselineReceiptSha256:c,runtimeDependencies:u,dependencyComplete:e.edges.filter(g=>g.relation==="depends_on"&&g.provenance==="authored").every(g=>l.some(b=>`feature:${b.id}`===g.to))}}function vre(t){let e=t.migrationBaseline;return e!==void 0&&qu(e).length===0?j2(e):null}function _re(t,e){let r=Wn(t,e),n=r.features.flatMap(i=>{let s=Yk(r,i.id),o=Wf(r,i.id),a=i.criteria.map(l=>Tb(r,`${i.id}/${l.id}`).sha256),c=i.criteria.map(l=>Ob(r,`${i.id}/${l.id}`).sha256);return[{feature:i.id,contract:s.sha256,runtime:o.sha256,subject:AE(a),verification:AE(c)}]});return{closures:r,inputSha256:Zb("sha256").update(It({records:n,controls:l6e(t,"workspace","all")}),"utf8").digest("hex")}}function hd(t,e){if(t.schemaVersion!=="0.2"||!t.contract)return!1;let r=new Set(e.flatMap(n=>{if(n.startsWith("feature:"))return[n.slice(8)];let i=/^criterion:(F-[^/]+)\//.exec(n);return i?[i[1]]:[]}));return t.contract.features.some(n=>n.status==="done"&&n.acceptanceCriteria.length>0&&(r.size===0||r.has(n.id)))}function Bze(t,e,r){if(e.schemaVersion!=="0.2"||!e.contract)return Object.freeze([]);let n=e.migrationBaseline;if(!n||qu(n).length>0)return Object.freeze([]);let i=n.legacyL2Baseline;if(i?.decision!=="accept")return Object.freeze([]);let s=new Set(e.contract.features.flatMap(m=>m.acceptanceCriteria.map(y=>`${m.id}/${y.id}`))),o=Fa(t,s);if(!o.safe)return Object.freeze([]);let a=new Set(o.bindings.map(m=>m.criterion)),c=new Map(i.authorizations.map(m=>[m.criterion,m])),l=new Map(n.criteria.map(m=>[m.address,m])),u=new Map((n.reviewedCarryForwards??[]).map(m=>[m.criterion,m])),d=Vze(r),p=qze(t,e),f=j2(n),h=[];for(let m of e.contract.features)if(!(m.status!=="done"||d.featureIds.size>0&&!d.featureIds.has(m.id)))for(let y of m.acceptanceCriteria){let v=`${m.id}/${y.id}`,g=`criterion:${v}`;if(!d.includes(m.id,g))continue;let b=c.get(g),w=l.get(g);if(!b||!w||!Gze(b.obligations)||a.has(v))continue;let x=p.get(g);if(x===void 0)continue;let $=yk(x);if(!$||b.finalIntentSha256!==gk($))continue;let I=u.get(g);I!==void 0&&Hze(I,y)&&I.bindings.some(E=>Wb(E.selector)||Wb(E.raw.includes("#")?E.raw.slice(E.raw.indexOf("#")+1):void 0))||Wze(w,y)&&w.bindings.some(E=>E.channel==="test"&&(Wb(E.selector)||Wb(E.raw.includes("#")?E.raw.slice(E.raw.indexOf("#")+1):void 0)))||Ja(v)===void 0&&h.push(Object.freeze({subject:g,obligations:Object.freeze([...nl]),basis:Object.freeze({baseline_receipt_sha256:f,resolution_sha256:b.resolutionSha256,criterion_authorization_sha256:_X(b)})}))}return Object.freeze(h.sort((m,y)=>kt(m.subject,y.subject)))}function qze(t,e){let r=new Map;for(let n of e.nodes)if(!(n.nodeType!=="semantic"||n.kind!=="feature"))try{let i=(0,GM.parse)(bre(th(t,n.source.path),"utf8"));if(i===null||typeof i!="object"||Array.isArray(i))continue;let s=i,o=n.address.slice(8),a=s.id===o?s:Array.isArray(s.features)?s.features.find(c=>c!==null&&typeof c=="object"&&!Array.isArray(c)&&c.id===o):void 0;if(a===void 0||typeof a.id!="string"||!Array.isArray(a.acceptance_criteria))continue;for(let c of a.acceptance_criteria){if(c===null||typeof c!="object"||Array.isArray(c))continue;let l=c;typeof l.id=="string"&&r.set(`criterion:${a.id}/${l.id}`,l)}}catch{}return r}function Vze(t){let e=new Set,r=new Set;for(let i of t)i.startsWith("feature:")?e.add(i.slice(8)):/^criterion:F-[^/]+\/AC-[^/]+$/.test(i)&&(r.add(i),e.add(i.slice(10).split("/")[0]));let n=new Set(t.filter(i=>i.startsWith("feature:")).map(i=>i.slice(8)));return Object.freeze({featureIds:e,includes:(i,s)=>t.length===0||n.has(i)||r.has(s)})}function Gze(t){return t.length===nl.length&&t.every((e,r)=>e===nl[r])}function Hze(t,e){if(e.statement!==t.intent.statement||e.kind!==t.intent.kind||e.rationale!==t.intent.rationale)return!1;let r=t.intent.constraintRefs;return r===void 0?e.constraintRefs.length===0:r.length===e.constraintRefs.length&&r.every((n,i)=>n===e.constraintRefs[i])}function Wze(t,e){if(!t.exemption||e.statement!==t.legacyIntent.text||e.kind!==void 0&&e.kind!==Oo)return!1;let r=t.legacyIntent.rationale,n=t.legacyIntent.constraint_refs;return(r===void 0?e.rationale===void 0:e.rationale===r)&&(n===void 0?e.constraintRefs.length===0:e.constraintRefs.join(",")===n)}function IE(t,e,r){let n=[...t.contract?.features??[]].sort((v,g)=>kt(v.id,g.id)),i=new Set(n.map(v=>v.id)),s=Object.freeze(n.map(v=>`feature:${v.id}`)),o=new Set;if(t.schemaVersion!=="0.2"||!t.contract)return{featureIds:Object.freeze([]),scopeAddresses:Object.freeze([]),repository:!0,complete:!1,incompleteReasons:Object.freeze(["schema"])};t.diagnostics.some(v=>v.severity!=="advisory")&&o.add("compiler-diagnostic"),t.edges.some(v=>(v.state==="unresolved"||v.state==="unknown")&&Zze.includes(v.relation))&&o.add("unresolved-graph");let a=r??[],c=new Set;for(let v of a){let g=/^feature:(F-[^/]+)$/.exec(v)?.[1],b=/^criterion:(F-[^/]+)\/(AC-[^/]+)$/.exec(v);g&&i.has(g)?c.add(g):b&&i.has(b[1])?n.find(x=>x.id===b[1])?.acceptanceCriteria.some(x=>x.id===b[2])?c.add(b[1]):o.add(`unknown:${v}`):o.add(`unknown:${v}`)}if(e.id==="push"||e.id==="release"||a.length===0)return{featureIds:Object.freeze([...i].sort(kt)),scopeAddresses:s,repository:!0,complete:o.size===0,incompleteReasons:Object.freeze([...o].sort(kt))};let l=HX(t),u=new Map,d=new Map;for(let v of l.prerequisites){let g=v.feature.replace(/^feature:/,""),b=v.prerequisite.replace(/^feature:/,"");if(!i.has(g)||!i.has(b)){o.add(`unresolved-dependency:${v.feature}->${v.prerequisite}`);continue}u.set(g,[...u.get(g)??[],b])}for(let v of l.dependents){let g=v.feature.replace(/^feature:/,""),b=v.dependent.replace(/^feature:/,"");if(!i.has(g)||!i.has(b)){o.add(`unresolved-dependent:${v.feature}->${v.dependent}`);continue}d.set(g,[...d.get(g)??[],b])}let p=new Map(l.artifactOwners.map(v=>[v.artifact,v.owners.map(g=>g.replace(/^feature:/,""))])),f=new Map(n.map(v=>[v.id,v])),h=new Set(c);for(;h.size>0;){let v=[...h].sort(kt)[0];h.delete(v);let g=f.get(v);if(!g){o.add(`unknown-feature:${v}`);continue}let b=w=>{i.has(w)?c.has(w)||(c.add(w),h.add(w)):o.add(`unowned-feature:${w}`)};(u.get(v)??[]).sort(kt).forEach(b),(d.get(v)??[]).sort(kt).forEach(b);for(let w of g.modules??[]){let x;try{x=ct(w)}catch{o.add(`invalid-module:${v}:${w}`);continue}let $=p.get(x);if(!$||!$.includes(v)){o.add(`unowned-artifact:${x}`);continue}$.sort(kt).forEach(b)}}if(o.size>0)return{featureIds:Object.freeze([...i].sort(kt)),scopeAddresses:s,repository:!0,complete:!1,incompleteReasons:Object.freeze([...o].sort(kt))};let m=[...c].sort(kt),y=[...new Set(m.flatMap(v=>f.get(v)?.modules??[]))].sort(kt);return{featureIds:Object.freeze(m),scopeAddresses:Object.freeze(m.map(v=>`feature:${v}`)),repository:!1,complete:!0,incompleteReasons:Object.freeze([]),...y.length>0?{focusModules:Object.freeze(y)}:{}}}function PE(t,e,r){let n=r.controlResolver??md(t),i=r.closureInput??Wn(t,e,r.receiptContext,void 0,n),s=r.scopeAddresses.flatMap(x=>{if(x.startsWith("feature:"))return[x.slice(8)];let $=/^criterion:(F-[^/]+)\//.exec(x);return $?[$[1]]:[]}),o=new Set(r.profile.obligations),a=n("profile",r.profile.id,Vo.filter(x=>o.has(x.id))),c=s.length>0?s:i.features.map(x=>x.id),l=[...new Set(a.complete?c:i.features.map(x=>x.id))].sort(kt),u=[...a.complete?r.scopeAddresses:l.map(x=>`feature:${x}`)].sort(kt),d=e.schemaVersion==="0.2"?hd(e,u):r.hasExecutableTests,p=d&&(o.has("stage_2.1")||o.has("stage_2.2")),f=o.has("stage_2.3"),h=r.requiresHuman&&(o.has("stage_4.1")||o.has("stage_4.2")),m=[],y=[];for(let x of l){let $=Yk(i,x),I=Wf(i,x);m.push({feature:x,contract:$.sha256,runtime:I.sha256});let E=e.schemaVersion==="0.2"?e.contract?.features.find(B=>B.id===x):void 0,R=e.schemaVersion!=="0.2"||E?.status==="done";R&&!$.complete&&y.push(`contract:${x}`),R&&!I.complete&&y.push(`runtime:${x}`);let A=i.features.find(B=>B.id===x);if(!(!A||!R))for(let B of A.criteria){let Z=`criterion:${x}/${B.id}`;if(!(p||h||f&&r.oracleRequiredSubjects?.has(Z)===!0))continue;let T=Tb(i,`${x}/${B.id}`),j=Ob(i,`${x}/${B.id}`);m.push({subject:Z,subject_sha256:T.sha256,verification_sha256:j.sha256}),T.complete||y.push(`subject:${x}/${B.id}`),j.complete||y.push(`verification:${x}/${B.id}`)}}let v={profile:r.profile.id,assurance_level:r.profile.assurance_level,obligations:[...r.profile.obligations].sort(kt),scope_addresses:u,has_executable_tests:d,oracle_required_subjects:[...r.oracleRequiredSubjects??[]].sort(kt),requires_human:r.requiresHuman},g=_E(e,u),b=vE(t,e,u),w=Bze(t,e,u);return m.push({criterion_observations:b.map(x=>({criterion:x.criterion,adapter:x.adapter,state:x.state,current:x.current,complete:x.complete,applicable:x.applicable,input_addresses:[...x.input_addresses].sort(kt),input_sha256:x.input_sha256,manifest_sha256:x.manifest_sha256}))}),m.push({migration_baseline_candidates:w.map(x=>({subject:x.subject,obligations:[...x.obligations],basis:x.basis}))}),r.scopeComplete===!1&&y.push("scope-closure"),a.complete!==!0&&y.push("runner-controls"),r.receiptCensusComplete===!1&&y.push("receipt-census:spec/evidence"),Object.freeze({inputSha256:Zb("sha256").update(It({policy:v,records:m,controls:a}),"utf8").digest("hex"),complete:y.length===0,closureInput:i,criterionObservations:Object.freeze(b),staticCriterionScope:g,migrationBaselineCandidates:w,incompleteAddresses:Object.freeze(y.sort(kt)),effectiveScopeAddresses:Object.freeze(u)})}function Sre(t,e,r,n,i,s,o){if(e.schemaVersion!=="0.2")return[];let a=new Set(r.flatMap(h=>{if(h.startsWith("feature:"))return[h.slice(8)];let m=/^criterion:(F-[^/]+)\//.exec(h);return m?[m[1]]:[]})),c=(e.contract?.features??[]).filter(h=>h.status==="done"&&(a.size===0||a.has(h.id))).flatMap(h=>h.acceptanceCriteria.map(m=>`${h.id}/${m.id}`));if(c.length===0)return[];let l=n&&i!==void 0&&n.inputSha256===i&&n.adapter.id==="legacy-stage:stage_2.1"&&n.adapter.version==="1"&&/^[0-9a-f]{64}$/.test(n.commandSha256)&&/^[0-9a-f]{64}$/.test(n.reportSha256)&&qb(n)?n.format==="vitest-json"?Fb(n.reportBytes,t):p6e(n.reportBytes):void 0,u=l?Kze(t,e):[];s&&l&&(s.criteria=new Set(u.filter(h=>h.source!=="none").map(h=>h.criterion)));let d=Yze(u),p=o===void 0?[]:o.candidates.flatMap(h=>{let m=ud({receipt:Jze(h.bytes),trustSnapshot:o.trustSnapshot,expected:h.expected});return m?[m]:[]}),f=new Map;for(let h of e.contract?.features??[])f.set(h.id,new Set(h.acceptanceCriteria.map(m=>`criterion:${h.id}/${m.id}`)));return lE({schemaVersion:"0.2",criteria:c,bindings:d,...l?{report:l}:{},criteriaByFeature:f,...p.length>0?{receipts:p}:{}})}function Jze(t){try{return yr(t)}catch{return}}function Kze(t,e){if(e.schemaVersion!=="0.2")return[];let r=Qu(t,e);return(e.contract?.features??[]).filter(n=>n.status==="done").flatMap(n=>n.acceptanceCriteria.map(i=>{let s=`${n.id}/${i.id}`;return ed({cwd:t,baseline:e.migrationBaseline,criterion:s,currentCriterion:Bf(i,e.migrationBaseline,s),live:r})}))}function Yze(t){return t.flatMap(e=>e.source==="live"?e.live:(e.source==="reviewed"?e.reviewed:e.source==="legacy"?e.legacy:[]).flatMap(n=>n.state==="available"&&Wb(n.selector)?[{criterion:e.criterion,framework:"vitest",file:n.file,selector:n.selector,carrier:"title"}]:[])).sort((e,r)=>kt(`${e.criterion}\0${e.file}\0${e.selector}`,`${r.criterion}\0${r.file}\0${r.selector}`))}function ml(t,e){let r=Yk(t,e),n=Wf(t,e),i=t.features.find(a=>a.id===e)?.criteria??[],s=i.map(a=>Tb(t,`${e}/${a.id}`)),o=i.map(a=>Ob(t,`${e}/${a.id}`));return Object.freeze({contractSha256:r.sha256,subjectSha256:AE(s.map(a=>a.sha256)),verificationSha256:AE(o.map(a=>a.sha256)),runtimeDependencySha256:n.sha256,complete:r.complete&&n.complete&&s.every(a=>a.complete)&&o.every(a=>a.complete)})}function wre(t,e){let r=new Set;for(let n of Wf(t,e).records){let i=/^runtime:F-[^:]+:(.+)$/.exec(n.address);i&&r.add(i[1])}return Object.freeze([...r].sort(kt))}function rh(t,e){let r=new Map,n=i=>{let s=r.get(i);if(s)return s;let o=FM(t,wre(e,i));return r.set(i,o),o};return i=>{if(i.method!=="human_channel")return;let s;try{s=Ha(i)}catch{return}if(!e.features.some(c=>c.id===s))return;let o=Wf(e,s);if(i.claim==="audit"){let c=i.subject.slice(10),l=Tb(e,c);return l.complete?{subjectSha256:l.sha256,reviewedInputsSha256:Ob(e,c).sha256,runtimeDependencySha256:o.sha256,implementationAuthorsSha256:n(s).sha256}:void 0}let a=ml(e,s);return{subjectSha256:a.contractSha256,reviewedInputsSha256:a.verificationSha256,runtimeDependencySha256:a.runtimeDependencySha256,implementationAuthorsSha256:n(s).sha256}}}function xre(t){let e=t.receiptContext.candidates.flatMap(r=>{let n;try{n=yr(r.bytes)}catch{return[]}let i=ud({receipt:n,trustSnapshot:t.receiptContext.trustSnapshot,expected:r.expected});return i?[i.receipt]:[]});return Object.freeze([...t.featureIds].sort(kt).map(r=>{let n=FM(t.cwd,wre(t.closures,r)),i=e.flatMap(s=>s.method==="human_channel"&&s.claim==="audit"&&s.subject.startsWith(`criterion:${r}/`)?[{issuer:s.issuer,independence:s.checks.independence,independentIssuer:ore(n,s.issuer)}]:[]);return Object.freeze({feature:r,authorMappingComplete:n.complete,verifiedAudits:Object.freeze(i)})}))}function kre(t){return Gf(()=>Xze(t))}function Xze(t){if(t.compilation.schemaVersion==="0.2"&&t.compilation.nodes.some(i=>i.nodeType==="artifact"&&i.address===ct("spec/generated/migration-baseline-0.1-to-0.2.yaml"))&&vre(t.compilation)===null){for(let i of new Set(t.featureIds))t.onRefusal?.(i,{guard:"migration baseline",detail:"the recorded migration baseline artifact is not valid"});return Object.freeze([])}let e=Wn(t.cwd,t.compilation,t.receiptContext),r=Zb("sha256").update(It(Vo),"utf8").digest("hex"),n=[];for(let i of[...new Set(t.featureIds)].sort()){let s=t.compilation.contract?.features.find(l=>l.id===i);if(t.compilation.schemaVersion==="0.2"&&s?.status!=="done"){t.onRefusal?.(i,{guard:"feature status",detail:"the feature is not marked done in the compiled spec"});continue}let o=ml(e,i),a={verdict:t.verdict,feature:i,contractSha256:o.contractSha256,subjectSha256:o.subjectSha256,verificationSha256:o.verificationSha256,runtimeDependencySha256:o.runtimeDependencySha256,registrySha256:r,detectorCatalogSha256:t.detectorCatalogSha256,toolIdentity:t.toolIdentity,environmentClass:t.environmentClass,trustSnapshotSha256:t.trustSnapshotSha256},c=ote(a);if(c)n.push(c);else if(t.onRefusal){let l=ate(a);l&&t.onRefusal(i,l)}}return n}function AE(t){return Zb("sha256").update(It([...t].sort()),"utf8").digest("hex")}function Qze(t){let e=t.match(/^(?:artifact|anchor):([^#]+)(?:#.*)?$/)?.[1];return e?.includes(":")||e?.split("/").includes("..")?void 0:e}function e6e(t,e){let r=e.replace(/[\\/]+$/,"");return r===""?void 0:Cb(t,r)}function t6e(t,e){return[["ears",e?.ears??t.ears],["condition",e?.condition??t.condition],["action",e?.action??t.action],["response",e?.response??t.response]].reduce((n,i)=>{let s=i[1];return typeof s=="string"&&(n[i[0]]=s),n},{})}function UM(t,e){let r;for(let n of t.properties??[])Ere(n.key)===e&&$E(n.value)&&(r=n.value);return r}function Ere(t){return t?.type==="Identifier"&&typeof t.name=="string"?t.name:t?.type==="StringLiteral"&&typeof t.value=="string"?t.value:void 0}function VM(t){return $E(t)&&t.type==="ObjectExpression"&&Array.isArray(t.properties)&&t.properties.every(c6e)}function c6e(t){return t.type==="ObjectProperty"&&t.computed!==!0&&t.shorthand!==!0&&Ere(t.key)!==void 0&&Are(t.value)}function Are(t){return $E(t)?t.type==="StringLiteral"?typeof t.value=="string":t.type==="BooleanLiteral"?typeof t.value=="boolean":t.type==="NullLiteral"?!0:t.type==="NumericLiteral"?typeof t.value=="number"&&Number.isFinite(t.value):t.type==="UnaryExpression"?t.operator==="-"&&$E(t.argument)&&t.argument.type==="NumericLiteral"&&typeof t.argument.value=="number"&&Number.isFinite(t.argument.value):t.type==="ArrayExpression"?Array.isArray(t.elements)&&t.elements.every(e=>e!==null&&Are(e)):t.type==="ObjectExpression"&&VM(t):!1}function $E(t){return t!==null&&typeof t=="object"}function l6e(t,e,r,n=Vo){return md(t)(e,r,n)}function md(t){let e=Gf(()=>u6e(t,new Set(Object.keys(qM))));return(r,n,i)=>Object.freeze({channel:r,target:n,controls:e.controls,unknown_controls:e.unknown,complete:e.complete})}function u6e(t,e){let r=Hb(t),n=Jk(r),i=new Set([...e].flatMap(D=>qM[D])),s=new Set(Object.values(qM).flat().filter(D=>!D.includes("/")).map(D=>D.split("/").at(-1))),o=new Map,a=new Set,c=new Set,l=new Set,u=new Set,d=new Set,p=new Set;for(let D of[...i].sort(kt))o.set(D,"");let f=D=>{let C=dre(r,D).replaceAll("\\","/");return C===""||C===".."||C.startsWith("../")?void 0:C},h=(D,C)=>{if(f(D)===void 0)return a.add(`out-of-root:${C}`),!1;let z=dre(r,D).split(/[\\/]/).filter(Boolean),O=r;for(let V of z){O=th(O,V);try{if(Ka(O).isSymbolicLink())return a.add(`symlink:${C}`),!1}catch{return a.add(`unresolved:${C}`),!1}}return!0},m=D=>{let C=Hb(r,D);if(h(C,D))try{if(!Ka(C).isFile()){a.add(`unresolved:${D}`);return}let O=bre(C,"utf8");return o.set(D,Zb("sha256").update(O,"utf8").digest("hex")),O}catch{a.add(`unresolved:${D}`);return}},y=D=>{let C=D.replaceAll("\\","/").replace(/^\.\//,"");if(!C||C===".."||C.startsWith("../")){a.add(`out-of-root:${D}`);return}c.add(C)},v=D=>{if(D==="."||D==="")return!0;let C=th(r,D,"package.json");try{return Ka(C).isFile()&&h(C,`${D}/package.json`)}catch{return!1}},g=D=>v(zM(D).replaceAll("\\","/")),b=D=>{let C="/.cladding/config.yaml";return D===".cladding/config.yaml"?!0:D.endsWith(C)&&v(D.slice(0,-C.length))},w=D=>{let C="gradle/wrapper/gradle-wrapper.properties";if(!D.endsWith(C))return!1;let z=D.slice(0,-C.length).replace(/\/$/,"");return v(z)},x=D=>{let C=D.split("/").at(-1);return C==="package.json"||s.has(C)&&g(D)||b(D)||w(D)},$=D=>/(?:^|[.-])config(?:[.-]|$)|(?:^|[.-])rc(?:[.-]|$)|^\.[a-z0-9-]+rc(?:\.(?:[cm]?[jt]s|json|ya?ml))?$/i.test(D)||/^tsconfig[^/]*\.json$/i.test(D)||/(?:^|[._-])workspace(?:[._-]|$)/i.test(D),I=(D,C)=>!D.includes("/")&&$(C)||/(?:^|[._-])runner(?:[._-]|$)/i.test(C)&&$(C),E=(D,C)=>o6e.has(C)||D.split("/").includes(".cladding")&&a6e.has(C),R=D=>{let C;try{C=zze(D,{withFileTypes:!0})}catch{let z=f(D)??D;a.add(`unresolved:${z}`);return}for(let z of C.sort((O,V)=>kt(O.name,V.name))){let O=th(D,z.name),V=f(O);if(V===void 0){a.add(`out-of-root:${z.name}`);continue}let re;try{re=Ka(O)}catch{a.add(`unresolved:${V}`);continue}if(!E(V,z.name)&&!(!re.isDirectory()&&!n.includes(V))){if(z.isSymbolicLink()||re.isSymbolicLink()){a.add(`symlink:${V}`);continue}if(re.isDirectory()){R(O);continue}re.isFile()&&(x(V)?y(V):I(V,z.name)&&a.add(`unknown:${V}`))}}},A=(D,C,z)=>{if(!C.startsWith(".")&&!ure(C))return;let O=Hb(r,zM(D),C);if(f(O)===void 0){a.add(`out-of-root:${D}->${C}`);return}let V=z==="tsconfig"?[O,`${O}.json`,th(O,"tsconfig.json")]:[O,...fre.slice(1).map(re=>`${O}${re}`),...fre.slice(1).map(re=>th(O,`index${re}`))];for(let re of V){let ge=f(re);if(ge!==void 0)try{let ue=Ka(re);if(!h(re,ge))return;if(ue.isFile())return ge}catch{}}a.add(`unresolved:${D}->${C}`)},B=D=>D?.split(/[\\/]/).at(-1)?.toLowerCase().replace(/\.(?:exe|cmd)$/,""),Z=D=>D.some((C,z)=>{let O=B(C);if(O&&i6e.has(O))return!0;if(!O||!eh.has(O))return!1;let V=D.slice(z+1),re=V.find(ge=>ge!=="--"&&!ge.startsWith("-"));return re==="run"||re==="run-script"?!1:V.some(ge=>n6e.has(ge))}),ee=D=>D.some((C,z)=>z===0||!eh.has(B(C)??"")?!1:D.slice(z+1).some(O=>O!=="--"&&!O.startsWith("-"))),T=(D,C)=>{let z=B(C[0]);return z?/^[A-Za-z_][A-Za-z0-9_]*=/.test(z)?(a.add(`environment-command:${D}`),!1):z==="env"||z==="cross-env"?(a.add(`environment-command:${D}`),!1):z==="eslint"?C.length===2&&C[1]==="."?!0:(C.length===2&&C[1]===".."?a.add(`out-of-root:${D}->..`):a.add(`dynamic-command:${D}`),!1):Z(C)||ee(C)?(a.add(`dynamic-command:${D}`),!1):s6e.has(z)||["cd","source",".","eval","exec"].includes(z)||["node","nodejs","bun","deno"].includes(z)&&C.some(O=>O==="-e"||O==="--eval"||O==="-p"||O==="--print")||EE.has(z)&&C.slice(1).some(O=>O!=="--"&&O.startsWith("-"))||eh.has(z)&&C.some(O=>O==="--prefix"||O==="--workspace"||O==="--workspaces"||O==="-w")||!EE.has(z)&&!eh.has(z)&&z!=="vitest"&&C.slice(1).some(O=>O==="--"||O.startsWith("-"))?(a.add(`dynamic-command:${D}`),!1):!0:(a.add(`malformed-command:${D}`),!1)},j=(D,C)=>{let z=[],O=[],V="",re=!1,ge,ue=se=>{a.add(`${se}:${D}`)},rt=()=>{re&&O.push(V),V="",re=!1},ye=()=>(rt(),O.length===0?!1:(z.push(O),O=[],!0));for(let se=0;se*?[]!(){}".includes(Je))return ue("dynamic-command");V+=Je,re=!0}}if(ge||!ye())return ue("malformed-command");if(!z.some(se=>!T(D,se)))return z},Ne=(D,C,z,O=!1)=>{let V=z.startsWith("--")&&z.includes("=")?z.slice(z.indexOf("=")+1):z;if(V===""||/^\{modules:[A-Za-z0-9_.:-]+\}$/.test(V)||!V.startsWith(".")&&!ure(V)&&(!O||V.startsWith("@")))return;let re=Hb(r,C,V),ge=f(re);if(ge===void 0){a.add(`out-of-root:${D}->${z}`);return}if(h(re,ge)){try{if(!Ka(re).isFile()){a.add(`unresolved:${D}->${z}`);return}}catch{a.add(`unresolved:${D}->${z}`);return}return ge}},U=(D,C,z)=>{if(z===""||z==="--"||z.startsWith("-")||z.startsWith("@")||/^\{modules:[A-Za-z0-9_.:-]+\}$/.test(z))return;let O=Hb(r,C,z),V=f(O);if(V===void 0){try{Ka(O),a.add(`out-of-root:${D}->${z}`)}catch{}return}try{if(!Ka(O).isFile())return}catch{return}return h(O,V)?V:void 0},H=D=>{let C=B(D[0]);if(!(!C||!EE.has(C)))return C==="deno"&&D[1]==="run"?D.slice(2).find(O=>O!=="--"&&!O.startsWith("-")):D.slice(1).find(z=>z!=="--"&&!z.startsWith("-"))},Oe=(D,C,z)=>{let O=new Set,V=ue=>{ue&&(O.add(ue),u.add(ue))},re=B(z[0]);for(let ue of z)re==="eslint"&&ue==="."||V(Ne(D,C,ue));if(re==="gradlew"){let ue=Ne(D,C,z[0]??"");ue==="gradlew"&&d.add(ue)}if(re==="vitest")for(let ue=1;ueV(U(D,C,ue)));let ge=H(z);return ge&&V(Ne(D,C,ge,!0)),[...O].sort(kt)},F=D=>{let C=B(D[0]);if(!C||!eh.has(C)||Z(D))return;let z=D.findIndex(O=>O==="run"||O==="run-script");if(z>=0){let O=D.slice(z+1).find(V=>V!=="--"&&!V.startsWith("-"));return O||a.add(`malformed-package-lifecycle:${C}`),O}return D.slice(1).find(O=>O!=="--"&&!O.startsWith("-"))},de=(D,C)=>{let z;try{z=JSON.parse(C)}catch{a.add(`malformed:${D}`);return}let O=z&&typeof z=="object"&&!Array.isArray(z)?z.scripts:void 0;if(O===void 0)return[];if(!O||typeof O!="object"||Array.isArray(O)){a.add(`malformed:${D}`);return}let V=new Map(Object.entries(O).filter(ye=>typeof ye[1]=="string")),re=new Set,ge=new Set,ue=ye=>{if(ge.has(ye))return;ge.add(ye);let se=V.get(ye);if(se===void 0){a.add(`unresolved:${D}#scripts.${ye}`);return}let Je=j(`${D}#scripts.${ye}`,se);if(Je)for(let mr of Je){Oe(`${D}#scripts.${ye}`,zM(D),mr).forEach(Tc=>re.add(Tc));let ci=F(mr);ci&&rt(ci)}},rt=ye=>{let se=[`pre${ye}`,ye,`post${ye}`];if(!se.some(Je=>V.has(Je))){a.add(`unresolved:${D}#scripts.${ye}`);return}for(let Je of se)V.has(Je)&&ue(Je)};return[...new Set([...[...r6e].filter(ye=>V.has(ye)),...D==="package.json"?p:[]])].sort(kt).forEach(rt),[...re].sort(kt)},Ft=(D,C)=>{let z;try{z=(0,GM.parse)(C)}catch{a.add(`malformed:${D}`);return}let O=z&&typeof z=="object"&&!Array.isArray(z)?z.gate:void 0;if(O===void 0)return[];if(!O||typeof O!="object"||Array.isArray(O)){a.add(`malformed:${D}`);return}let V=O.commands;if(V===void 0)return[];if(!V||typeof V!="object"||Array.isArray(V)){a.add(`malformed:${D}`);return}let re=new Set;for(let ge of["type","lint","test","coverage"]){let ue=V[ge];if(ue===void 0)continue;if(!Array.isArray(ue)||!ue.every(ye=>typeof ye=="string")){a.add(`malformed:${D}#gate.commands.${ge}`);continue}if(!T(`${D}#gate.commands.${ge}`,ue))continue;Oe(`${D}#gate.commands.${ge}`,"",ue).forEach(ye=>re.add(ye));let rt=F(ue);rt&&p.add(rt)}return[...re].sort(kt)},Se=(D,C)=>{try{let z=(0,BM.parse)(`(${C})`,{sourceType:"script",plugins:["typescript"]}).program,O=z.body.length===1&&z.body[0]?.type==="ExpressionStatement"?z.body[0].expression:void 0;if(!VM(O)){a.add(`malformed:${D}`);return}let V=[],re=UM(O,"extends");if(re!==void 0){if(re.type!=="StringLiteral"||typeof re.value!="string"){a.add(`malformed:${D}`);return}V.push(re.value)}let ge=UM(O,"references");if(ge!==void 0){if(ge.type!=="ArrayExpression"||!Array.isArray(ge.elements)){a.add(`malformed:${D}`);return}for(let ue of ge.elements){if(!VM(ue)){a.add(`malformed:${D}`);return}let rt=UM(ue,"path");if(rt?.type!=="StringLiteral"||typeof rt.value!="string"){a.add(`malformed:${D}`);return}V.push(rt.value)}}return V}catch{a.add(`malformed:${D}`);return}},Jt=(D,C)=>{try{let z=(0,BM.parse)(C,{sourceType:"unambiguous",plugins:["typescript","jsx"]}),O=[],V=!1,re=!1,ge=!1,ue=!1,rt=ye=>{if(!ye||typeof ye!="object")return;let se=ye;if(se.type==="Identifier"&&(se.name==="process"||se.name==="Bun"||se.name==="Deno"||se.name==="globalThis")&&(re=!0),se.type==="MetaProperty"&&se.meta?.name==="import"&&se.property?.name==="meta"&&(re=!0),(se.type==="MemberExpression"||se.type==="OptionalMemberExpression")&&se.object?.type==="Identifier"&&se.object.name==="module"&&se.property?.type==="Identifier"&&se.property.name==="require"&&(ue=!0),(se.type==="MemberExpression"||se.type==="OptionalMemberExpression")&&se.object?.type==="Identifier"&&(se.object.name==="process"||se.object.name==="Bun"||se.object.name==="Deno")&&(se.property?.type==="Identifier"&&se.property.name==="env"||se.property?.value==="env")&&(re=!0),(se.type==="MemberExpression"||se.type==="OptionalMemberExpression")&&se.object?.type==="MemberExpression"&&se.object.object?.type==="Identifier"&&(se.object.object.name==="process"||se.object.object.name==="Bun")&&(se.object.property?.type==="Identifier"&&se.object.property.name==="env"||se.object.property?.value==="env")&&(re=!0),(se.type==="MemberExpression"||se.type==="OptionalMemberExpression")&&se.object?.type==="MetaProperty"&&se.property?.type==="Identifier"&&se.property.name==="env"&&(re=!0),se.type==="CallExpression"&&(se.callee?.type==="Identifier"&&yre.has(se.callee.name??"")||(se.callee?.type==="MemberExpression"||se.callee?.type==="OptionalMemberExpression")&&yre.has(se.callee.property?.name??""))&&(ge=!0),se.type==="ImportDeclaration"||se.type==="ExportNamedDeclaration"||se.type==="ExportAllDeclaration")typeof se.source?.value=="string"&&(O.push(se.source.value),hre.has(se.source.value)&&(ge=!0),mre.has(se.source.value)&&(re=!0),gre.has(se.source.value)&&(ue=!0));else if(se.type==="ImportExpression"||se.type==="CallExpression"&&se.callee?.type==="Import")V=!0;else if(se.type==="CallExpression"&&d6e(se.callee)){let Je=se.arguments?.[0];Je?.type==="StringLiteral"&&typeof Je.value=="string"?(O.push(Je.value),hre.has(Je.value)&&(ge=!0),mre.has(Je.value)&&(re=!0),gre.has(Je.value)&&(ue=!0)):V=!0}for(let Je of Object.values(ye))Je&&typeof Je=="object"&&(Array.isArray(Je)?Je.forEach(rt):rt(Je))};if(rt(z),re){a.add(`ambient-runtime:${D}`);return}if(V){a.add(`dynamic:${D}`);return}if(ge){a.add(`runtime-read:${D}`);return}if(ue){a.add(`module-loader:${D}`);return}return O}catch{a.add(`malformed:${D}`);return}};try{Ka(r).isSymbolicLink()?a.add("symlink:."):R(r)}catch{a.add("unresolved:.")}for(;c.size>0;){let D=[...c].sort(kt)[0];if(c.delete(D),l.has(D))continue;l.add(D);let C=m(D);if(C!==void 0){if(u.has(D)&&!d.has(D)&&!pre.has(lre(D).toLowerCase())){a.add(`unresolved-runner:${D}`);continue}if(D===".cladding/config.yaml")for(let z of Ft(D,C)??[])y(z);else if(D.split("/").at(-1)==="package.json")for(let z of de(D,C)??[])y(z);if(/^tsconfig[^/]*\.json$/i.test(D.split("/").at(-1)))for(let z of Se(D,C)??[]){let O=A(D,z,"tsconfig");O&&y(O)}else if(pre.has(lre(D).toLowerCase()))for(let z of Jt(D,C)??[]){let O=A(D,z,"module");O&&y(O)}}}let xe=Object.fromEntries([...o.entries()].sort(([D],[C])=>kt(D,C))),sr=[...a].sort(kt);return{controls:Object.freeze(xe),unknown:Object.freeze(sr),complete:sr.length===0}}function d6e(t){return t?.type==="Identifier"?t.name==="require":t?.type==="MemberExpression"&&t.property?.type==="Identifier"&&(t.object?.type==="Identifier"&&t.object.name==="require"&&t.property.name==="resolve"||t.object?.type==="Identifier"&&t.object.name==="module"&&t.property.name==="require")}function p6e(t){try{return pd(t)}catch{return}}function Wb(t){return typeof t=="string"&&t.length>0}function kt(t,e){return te?1:0}var BM,GM,Zze,qM,pre,fre,r6e,EE,eh,n6e,i6e,s6e,hre,mre,gre,yre,o6e,a6e,gd=S(()=>{"use strict";BM=Et(AL(),1),GM=Et(cr(),1);sE();aM();Go();Go();Gb();qa();qn();Vu();OM();gt();cre();Uf();Rb();kn();Eb();Lb();Ab();zb();Qf();Zze=Object.freeze(["contains","contributes_to","defined_in","depends_on","participates_in","touches"]);qM=Object.freeze({workspace:Object.freeze(["package.json","package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","pnpm-workspace.yaml","yarn.lock","bun.lockb",".npmrc",".yarnrc.yml",".secretlintrc",".secretlintrc.json",".secretlintrc.yaml",".secretlintrc.yml","lerna.json","turbo.json","nx.json",".cladding/config.yaml"]),type:Object.freeze(["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.build.json","tsconfig.test.json"]),lint:Object.freeze(["eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts",".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.mjs",".eslintrc.ts",".eslintrc.cts",".eslintrc.mts",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"]),test:Object.freeze(["vitest.config.ts","vitest.config.mts","vitest.config.cts","vitest.config.js","vitest.config.mjs","vitest.config.cjs","vitest.workspace.ts","vitest.workspace.mts","vitest.workspace.cts","vitest.workspace.js","vitest.workspace.mjs","vitest.workspace.cjs","vite.config.ts","vite.config.mts","vite.config.cts","vite.config.js","vite.config.mjs","vite.config.cjs","jest.config.ts","jest.config.mts","jest.config.cts","jest.config.js","jest.config.cjs","jest.config.mjs","jest.config.json"]),python:Object.freeze(["pyproject.toml","pytest.ini","setup.cfg","tox.ini",".coveragerc","requirements.txt","requirements-dev.txt","poetry.lock","Pipfile.lock"]),rust:Object.freeze(["Cargo.toml","Cargo.lock"]),go:Object.freeze(["go.mod","go.sum"]),jvm:Object.freeze(["pom.xml","build.gradle","build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle/wrapper/gradle-wrapper.properties"])}),pre=new Set([".js",".cjs",".mjs",".ts",".cts",".mts"]),fre=["",".js",".cjs",".mjs",".ts",".cts",".mts",".json"],r6e=new Set(["lint","test","coverage","smoke","perf","visual"]),EE=new Set(["node","nodejs","bun","deno","tsx","ts-node","python","python2","python3","pypy","pypy3","ruby","perl","php","lua"]),eh=new Set(["npm","pnpm","yarn","bun"]),n6e=new Set(["exec","x","dlx"]),i6e=new Set(["npx","pnpx","bunx"]),s6e=new Set(["sh","bash","zsh","fish","cmd","powershell","pwsh"]),hre=new Set(["fs","node:fs","fs/promises","node:fs/promises"]),mre=new Set(["process","node:process"]),gre=new Set(["module","node:module"]),yre=new Set(["readFile","readFileSync","createReadStream","readdir","readdirSync","stat","statSync","lstat","lstatSync","realpath","realpathSync","open","openSync"]),o6e=new Set(["node_modules",".git","coverage","dist","build","target",".cache",".next","out",".gradle",".idea",".turbo",".nx","__pycache__",".pytest_cache",".mypy_cache"]),a6e=new Set(["cache","generated","graph","reports","tmp"])});import{createHash as Jb}from"node:crypto";function f6e(t){return JM.has(t)}function Ire(t,e="stale"){if(!f6e(t))return t;let r=Object.freeze({obligation:"attestation-write",subject:"scope",state:"unobserved",blocking:"hard",reason:e,observation_identities:Object.freeze([])}),n=Object.freeze([...t.results,r]),i=Object.freeze({...t,state:"unresolved",profile_complete:!1,results:n,obligation_sha256:Jb("sha256").update(It(n.map(o=>({obligation:o.obligation,subject:o.subject,state:o.state,source_strictness:o.source_strictness??null,blocking:o.blocking,migration_baseline:o.migration_baseline??null}))),"utf8").digest("hex")});JM.add(i);let s=WM.get(t);return s&&WM.set(i,s),i}function Wo(t,e){return Object.freeze({id:t,assurance_level:e,scope:t==="feedback"||t==="checkpoint"?"changed":t==="completion"?"feature":t==="push"?"integration":"repository",obligations:Object.freeze(Pee(t,e).map(i=>i.id)),authoritative:t==="completion"||t==="push"||t==="release"})}function Pre(t){let e=(t.profile.id==="completion"||t.profile.id==="push"||t.profile.id==="release")&&fi(t.profile.assurance_level){let l=cd(c.descriptor);if(!l||!n.has(l.id))return[];let u=ZM(c.subject),d=u===void 0?void 0:Ja(u),p=d!==void 0&&RE(l.id)?g6e(d,t.criterionObservations??[]):void 0,f=d!==void 0&&CE(c.input_addresses,d.inputAddresses),h=p!==void 0&&!f,m=h&&p!==void 0?p.input_addresses:c.input_addresses,y=h&&p!==void 0?p.input_sha256:c.input_sha256,v=d?.mode==="static"&&p!==void 0&&p.input_sha256===y&&p.state==="pass"&&d.applicability(p);return[Object.freeze({id:c.id,subject:c.subject,assurance_level:l.assuranceLevel,descriptor:l.id,input_addresses:Object.freeze([...m].sort(Bt)),input_sha256:y,...d!==void 0&&RE(l.id)?{adapter:d.adapter}:{},applicability:v?"na":u!==void 0&&RE(l.id)?"required":Pb(l,t.applicabilityFacts),source_strictness:l.sourceStrictness,blocking:l.blocking})]}),s=new Set(i.map(c=>c.descriptor));for(let c of r.obligations){if(s.has(c))continue;let l=cd(c);Pb(l,t.applicabilityFacts)==="na"&&i.push(Object.freeze({id:`${l.id}:scope:${t.scopeSha256}`,subject:`scope:${t.scopeSha256}`,assurance_level:l.assuranceLevel,descriptor:l.id,input_addresses:Object.freeze([]),input_sha256:t.inputSha256,applicability:"na",source_strictness:l.sourceStrictness,blocking:l.blocking}))}let o=i.flatMap(c=>{let l=ZM(c.subject),u=l===void 0?void 0:Ja(l);if(!u||!RE(c.descriptor))return[];let d=(t.criterionObservations??[]).find(p=>p.criterion===l&&RM(p)&&p.carrier===u.carrier&&p.adapter.id===u.adapter.id&&p.adapter.version===u.adapter.version);return!d||!CE(d.input_addresses,c.input_addresses)||d.input_sha256!==c.input_sha256||d.manifest_sha256!==KM(u)?[]:u.mode==="static"&&d.state==="pass"&&!u.applicability(d)?[]:[y6e(c,d,t.environmentClass??"neutral")]}),a=Object.freeze({profile:r,configuredAssuranceLevel:t.configuredAssuranceLevel,scopeSha256:t.scopeSha256,inputSha256:t.inputSha256,scopeAddresses:Object.freeze([...new Set(t.scopeAddresses)].sort(Bt)),obligations:Object.freeze(i),observations:Object.freeze([...t.observations,...o]),migrationBaselineCandidates:Object.freeze((t.migrationBaselineCandidates??[]).filter(m6e).sort((c,l)=>Bt(c.subject,l.subject))),...t.independence===void 0?{}:{independence:t.independence}});return $re.add(a),a}function RE(t){return t==="stage_2.1"||t==="stage_2.2"}function ZM(t){return t.startsWith("criterion:")?t.slice(10):void 0}function h6e(t){let e=ZM(t),r=e===void 0?void 0:Ja(e);return r===void 0?void 0:KM(r)}function CE(t,e){let r=[...t].sort(Bt),n=[...e].sort(Bt);return r.length===n.length&&r.every((i,s)=>i===n[s])}function m6e(t){return/^criterion:F-[^/]+\/AC-[^/]+$/.test(t.subject)&&t.obligations.length===2&&t.obligations[0]==="stage_2.1"&&t.obligations[1]==="stage_2.2"&&HM(t.basis.baseline_receipt_sha256)&&HM(t.basis.resolution_sha256)&&HM(t.basis.criterion_authorization_sha256)}function HM(t){return/^[a-f0-9]{64}$/.test(t)}function KM(t){return Jb("sha256").update(It(t.manifest),"utf8").digest("hex")}function g6e(t,e){return e.find(r=>r.criterion===t.criterion&&RM(r)&&r.carrier===t.carrier&&r.adapter.id===t.adapter.id&&r.adapter.version===t.adapter.version&&r.manifest_sha256===KM(t)&&CE(r.input_addresses,t.inputAddresses)&&r.current===!0&&r.complete===!0)}function y6e(t,e,r){return Object.freeze({obligation:t.descriptor,subject:t.subject,state:e.state,input_sha256:e.input_sha256,input_addresses:Object.freeze([...e.input_addresses].sort(Bt)),manifest_sha256:e.manifest_sha256,adapter:e.adapter,provenance:"observed",assurance:e.state==="unobserved"?"asserted":"verified",...e.reason===void 0?{}:{reason:e.reason==="missing"||e.reason==="invalid"?"stale":e.reason},...e.locator===void 0?{}:{locator:e.locator},observed_at:"1970-01-01T00:00:00.000Z",environment_class:r,current:e.current})}function TE(t){let e=t.requested??t.configured;return fi(e)fi(t.configured)&&!t.boundedScope?{ok:!1,reason:"A stronger one-run assurance level requires a compiler-proven bounded scope."}:{ok:!0,level:e}}function Rre(t){return $re.has(t)?b6e(t):_6e(t)}function b6e(t){let e=new Set(t.profile.obligations),r=t.obligations.filter(h=>e.has(h.descriptor)&&fi(h.assurance_level)<=fi(t.profile.assurance_level)).map(h=>({obligation:h,result:S6e(h,t.observations)})),n=new Set(r.filter(({result:h})=>h.subject===`scope:${t.scopeSha256}`&&h.state==="pass"&&h.observation_identities.length>0).map(({result:h})=>h.obligation)),i=new Map(t.migrationBaselineCandidates.map(h=>[h.subject,h])),s=r.map(({obligation:h,result:m})=>v6e(h,m,i.get(m.subject),n)).sort((h,m)=>Bt(`${h.obligation}\0${h.subject}`,`${m.obligation}\0${m.subject}`)),o=new Set(s.map(h=>h.obligation));for(let h of t.profile.obligations){if(o.has(h))continue;let m=cd(h);s.push({obligation:h,subject:"project",state:"unobserved",...m?{source_strictness:m.sourceStrictness,blocking:m.blocking}:{blocking:"hard"},reason:"stale",observation_identities:[]})}s.sort((h,m)=>Bt(`${h.obligation}\0${h.subject}`,`${m.obligation}\0${m.subject}`));let a=s.length>0&&s.every(h=>h.state!=="unobserved"),c=s.some(h=>h.state==="fail"&&h.blocking==="hard"),l=s.length===0||s.some(h=>h.state==="unobserved"),u=c?"red":l?"unresolved":"green",d=x6e(s),p=Jb("sha256").update(It(s.map(h=>({obligation:h.obligation,subject:h.subject,state:h.state,source_strictness:h.source_strictness??null,blocking:h.blocking,migration_baseline:h.migration_baseline??null}))),"utf8").digest("hex"),f=Object.freeze({profile:t.profile.id,assurance_level:t.profile.assurance_level,configured_assurance_level:t.configuredAssuranceLevel,achieved_assurance_level:d,scope_sha256:t.scopeSha256,input_sha256:t.inputSha256,state:u,profile_complete:a,results:Object.freeze(s),independence:t.independence??"not-applicable",obligation_sha256:p});return JM.add(f),WM.set(f,Object.freeze({inputSha256:t.inputSha256,featureIds:new Set(t.scopeAddresses.flatMap(h=>{if(h.startsWith("feature:"))return[h.slice(8)];let m=/^criterion:(F-[^/]+)\//.exec(h);return m?[m[1]]:[]}))})),f}function v6e(t,e,r,n){return e.state!=="unobserved"||t.applicability!=="required"||t.descriptor!=="stage_2.1"&&t.descriptor!=="stage_2.2"||t.assurance_level!=="L2"||r===void 0||!r.obligations.includes(t.descriptor)||!n.has(t.descriptor)?e:Object.freeze({obligation:e.obligation,subject:e.subject,state:"migration_baseline",source_strictness:e.source_strictness,blocking:e.blocking,migration_baseline:Object.freeze({...r.basis}),observation_identities:Object.freeze([])})}function _6e(t){return Object.freeze({profile:t.profile.id,assurance_level:t.profile.assurance_level,configured_assurance_level:t.configuredAssuranceLevel,achieved_assurance_level:"none",scope_sha256:t.scopeSha256,input_sha256:t.inputSha256,state:"unresolved",profile_complete:!1,results:Object.freeze([]),independence:t.independence??"not-applicable",obligation_sha256:Jb("sha256").update(It([]),"utf8").digest("hex")})}function S6e(t,e){if(t.applicability==="na")return{obligation:t.descriptor,subject:t.subject,state:"na",source_strictness:t.source_strictness,blocking:t.blocking,observation_identities:[]};if(t.applicability==="unresolved")return{obligation:t.descriptor,subject:t.subject,state:"unobserved",source_strictness:t.source_strictness,blocking:t.blocking,reason:"unresolved",observation_identities:[]};let r=cd(t.descriptor),n=t.adapter??r?.adapter,i=e.filter(u=>u.obligation===t.descriptor&&u.subject===t.subject&&u.input_sha256===t.input_sha256&&u.current!==!1&&u.provenance==="observed"&&(u.state==="unobserved"||u.assurance==="verified")&&u.adapter.id===n?.id&&u.adapter.version===n?.version&&(t.adapter===void 0||u.input_addresses!==void 0&&CE(u.input_addresses,t.input_addresses)&&u.manifest_sha256===h6e(t.subject))),s=i.map(w6e).sort(Bt),o=i.find(u=>u.state==="fail");if(o)return l("fail",o.reason,s);if(i.some(u=>u.state==="pass"))return l("pass",void 0,s);let c=i.find(u=>u.state==="unobserved");return l("unobserved",c?.reason??(i.length===0?"stale":"unsupported"),s);function l(u,d,p){return{obligation:t.descriptor,subject:t.subject,state:u,source_strictness:t.source_strictness,blocking:t.blocking,...d?{reason:d}:{},observation_identities:p}}}function w6e(t){return Jb("sha256").update(It({obligation:t.obligation,subject:t.subject,state:t.state,input_sha256:t.input_sha256,adapter:t.adapter,locator:t.locator??null,observed_at:t.observed_at,environment_class:t.environment_class}),"utf8").digest("hex")}function x6e(t){let e="none";for(let r of["L1","L2","L3","L4"]){let n=t.filter(i=>UL(r).some(s=>s.id===i.obligation&&s.assuranceLevel===r));if(n.length===0||n.some(i=>i.state==="unobserved"||i.state==="fail"&&i.source_strictness!=="report"))break;e=r}return e}var JM,$re,WM,OE=S(()=>{"use strict";Go();Gb();qa();JM=new WeakSet,$re=new WeakSet,WM=new WeakMap});import{createHash as k6e}from"node:crypto";function E6e(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Kb(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??Cre),sample:E6e(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(Cre),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Yb(t){return(t.features??[]).filter(e=>e.status==="done").length}function A6e(t,e){return e<=0?!1:e>=1?!0:parseInt(k6e("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var Cre,Qb=S(()=>{"use strict";Cre=["unwanted"]});function N(t,e,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let l=o.prototype,u=Object.keys(l);for(let d=0;dr?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(o,"name",{value:t}),o}function br(t){return t&&Object.assign(yd,t),yd}var Tre,YM,XM,Ys,gl,yd,bd=S(()=>{YM=Object.freeze({status:"aborted"});XM=Symbol("zod_brand"),Ys=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},gl=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Tre=globalThis).__zod_globalConfig??(Tre.__zod_globalConfig={});yd=globalThis.__zod_globalConfig});var K={};Di(K,{BIGINT_FORMAT_RANGES:()=>aF,Class:()=>eF,NUMBER_FORMAT_RANGES:()=>oF,aborted:()=>_l,allowsEval:()=>nF,assert:()=>C6e,assertEqual:()=>$6e,assertIs:()=>P6e,assertNever:()=>R6e,assertNotEqual:()=>I6e,assignProp:()=>bl,base64ToUint8Array:()=>zre,base64urlToUint8Array:()=>B6e,cached:()=>sh,captureStackTrace:()=>DE,cleanEnum:()=>U6e,cleanRegex:()=>rv,clone:()=>ln,cloneDef:()=>O6e,createTransparentProxy:()=>F6e,defineLazy:()=>Ge,esc:()=>NE,escapeRegex:()=>gs,explicitlyAborted:()=>cF,extend:()=>jre,finalizeIssue:()=>Zn,floatSafeRemainder:()=>tF,getElementAtPath:()=>N6e,getEnumValues:()=>tv,getLengthableOrigin:()=>sv,getParsedType:()=>M6e,getSizableOrigin:()=>iv,hexToUint8Array:()=>V6e,isObject:()=>vd,isPlainObject:()=>vl,issue:()=>oh,joinValues:()=>L,jsonStringifyReplacer:()=>ih,merge:()=>z6e,mergeDefs:()=>Ya,normalizeParams:()=>X,nullish:()=>yl,numKeys:()=>L6e,objectClone:()=>T6e,omit:()=>Dre,optionalKeys:()=>sF,parsedType:()=>J,partial:()=>Mre,pick:()=>Nre,prefixIssues:()=>mi,primitiveTypes:()=>iF,promiseAllObject:()=>D6e,propertyKeyTypes:()=>nv,randomString:()=>j6e,required:()=>Fre,safeExtend:()=>Lre,shallowClone:()=>jE,slugify:()=>rF,stringifyPrimitive:()=>W,uint8ArrayToBase64:()=>Ure,uint8ArrayToBase64url:()=>q6e,uint8ArrayToHex:()=>G6e,unwrapMessage:()=>ev});function $6e(t){return t}function I6e(t){return t}function P6e(t){}function R6e(t){throw new Error("Unexpected value in exhaustive check")}function C6e(t){}function tv(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function L(t,e="|"){return t.map(r=>W(r)).join(e)}function ih(t,e){return typeof e=="bigint"?e.toString():e}function sh(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function yl(t){return t==null}function rv(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function tF(t,e){let r=t/e,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)r?.[n],t):t}function D6e(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let i={};for(let s=0;se};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function F6e(t){let e;return new Proxy({},{get(r,n,i){return e??(e=t()),Reflect.get(e,n,i)},set(r,n,i,s){return e??(e=t()),Reflect.set(e,n,i,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,i){return e??(e=t()),Reflect.defineProperty(e,n,i)}})}function W(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function sF(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Nre(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=Ya(t._zod.def,{get shape(){let o={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(o[a]=r.shape[a])}return bl(this,"shape",o),o},checks:[]});return ln(t,s)}function Dre(t,e){let r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=Ya(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete o[a]}return bl(this,"shape",o),o},checks:[]});return ln(t,s)}function jre(t,e){if(!vl(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let o in e)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Ya(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return bl(this,"shape",s),s}});return ln(t,i)}function Lre(t,e){if(!vl(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ya(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e};return bl(this,"shape",n),n}});return ln(t,r)}function z6e(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Ya(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return bl(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return ln(t,r)}function Mre(t,e,r){let i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let o=Ya(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let l in r){if(!(l in a))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(c[l]=t?new t({type:"optional",innerType:a[l]}):a[l])}else for(let l in a)c[l]=t?new t({type:"optional",innerType:a[l]}):a[l];return bl(this,"shape",c),c},checks:[]});return ln(e,o)}function Fre(t,e,r){let n=Ya(e._zod.def,{get shape(){let i=e._zod.def.shape,s={...i};if(r)for(let o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=new t({type:"nonoptional",innerType:i[o]}))}else for(let o in i)s[o]=new t({type:"nonoptional",innerType:i[o]});return bl(this,"shape",s),s}});return ln(e,n)}function _l(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function ev(t){return typeof t=="string"?t:t?.message}function Zn(t,e,r){let n=t.message?t.message:ev(t.inst?._zod.def?.error?.(t))??ev(e?.error?.(t))??ev(r.customError?.(t))??ev(r.localeError?.(t))??"Invalid input",{inst:i,continue:s,input:o,...a}=t;return a.path??(a.path=[]),a.message=n,e?.reportInput&&(a.input=o),a}function iv(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function sv(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function J(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function oh(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function U6e(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function zre(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;ne.toString(16).padStart(2,"0")).join("")}var Ore,DE,nF,M6e,nv,iF,oF,aF,eF,_e=S(()=>{bd();Ore=Symbol("evaluating");DE="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};nF=sh(()=>{if(yd.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});M6e=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},nv=new Set(["string","number","symbol"]),iF=new Set(["string","number","bigint","boolean","symbol","undefined"]);oF={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},aF={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};eF=class{constructor(...e){}}});function av(t,e=r=>r.message){let r={},n=[];for(let i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function cv(t,e=r=>r.message){let r={_errors:[]},n=(i,s=[])=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a},[...s,...o.path]));else if(o.code==="invalid_key")n({issues:o.issues},[...s,...o.path]);else if(o.code==="invalid_element")n({issues:o.issues},[...s,...o.path]);else{let a=[...s,...o.path];if(a.length===0)r._errors.push(e(o));else{let c=r,l=0;for(;lr.message){let r={errors:[]},n=(i,s=[])=>{var o,a;for(let c of i.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>n({issues:l},[...s,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...s,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...s,...c.path]);else{let l=[...s,...c.path];if(l.length===0){r.errors.push(e(c));continue}let u=r,d=0;for(;dtypeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?e.push(`[${n}]`):typeof n=="symbol"?e.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?e.push(`[${JSON.stringify(n)}]`):(e.length&&e.push("."),e.push(n));return e.join("")}function uF(t){let e=[],r=[...t.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)e.push(`\u2716 ${n.message}`),n.path?.length&&e.push(` \u2192 at ${qre(n.path)}`);return e.join(` +`)}var Bre,ov,gi,dF=S(()=>{bd();_e();Bre=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,ih,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},ov=N("$ZodError",Bre),gi=N("$ZodError",Bre,{Parent:Error})});var ah,_d,ch,Sd,lh,Sl,uh,wl,LE,Vre,ME,Gre,FE,Hre,zE,Wre,UE,Zre,BE,Jre,qE,Kre,VE,Yre,pF=S(()=>{bd();dF();_e();ah=t=>(e,r,n,i)=>{let s=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new Ys;if(o.issues.length){let a=new(i?.Err??t)(o.issues.map(c=>Zn(c,s,br())));throw DE(a,i?.callee),a}return o.value},_d=ah(gi),ch=t=>async(e,r,n,i)=>{let s=n?{...n,async:!0}:{async:!0},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){let a=new(i?.Err??t)(o.issues.map(c=>Zn(c,s,br())));throw DE(a,i?.callee),a}return o.value},Sd=ch(gi),lh=t=>(e,r,n)=>{let i=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Ys;return s.issues.length?{success:!1,error:new(t??ov)(s.issues.map(o=>Zn(o,i,br())))}:{success:!0,data:s.value}},Sl=lh(gi),uh=t=>async(e,r,n)=>{let i=n?{...n,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(o=>Zn(o,i,br())))}:{success:!0,data:s.value}},wl=uh(gi),LE=t=>(e,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return ah(t)(e,r,i)},Vre=LE(gi),ME=t=>(e,r,n)=>ah(t)(e,r,n),Gre=ME(gi),FE=t=>async(e,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return ch(t)(e,r,i)},Hre=FE(gi),zE=t=>async(e,r,n)=>ch(t)(e,r,n),Wre=zE(gi),UE=t=>(e,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return lh(t)(e,r,i)},Zre=UE(gi),BE=t=>(e,r,n)=>lh(t)(e,r,n),Jre=BE(gi),qE=t=>async(e,r,n)=>{let i=n?{...n,direction:"backward"}:{direction:"backward"};return uh(t)(e,r,i)},Kre=qE(gi),VE=t=>async(e,r,n)=>uh(t)(e,r,n),Yre=VE(gi)});var yi={};Di(yi,{base64:()=>IF,base64url:()=>GE,bigint:()=>DF,boolean:()=>LF,browserEmail:()=>eUe,cidrv4:()=>AF,cidrv6:()=>$F,cuid:()=>fF,cuid2:()=>hF,date:()=>CF,datetime:()=>OF,domain:()=>nUe,duration:()=>vF,e164:()=>RF,email:()=>SF,emoji:()=>wF,extendedDuration:()=>W6e,guid:()=>_F,hex:()=>iUe,hostname:()=>rUe,html5Email:()=>Y6e,httpProtocol:()=>PF,idnEmail:()=>Q6e,integer:()=>jF,ipv4:()=>xF,ipv6:()=>kF,ksuid:()=>yF,lowercase:()=>zF,mac:()=>EF,md5_base64:()=>oUe,md5_base64url:()=>aUe,md5_hex:()=>sUe,nanoid:()=>bF,null:()=>MF,number:()=>HE,rfc5322Email:()=>X6e,sha1_base64:()=>lUe,sha1_base64url:()=>uUe,sha1_hex:()=>cUe,sha256_base64:()=>pUe,sha256_base64url:()=>fUe,sha256_hex:()=>dUe,sha384_base64:()=>mUe,sha384_base64url:()=>gUe,sha384_hex:()=>hUe,sha512_base64:()=>bUe,sha512_base64url:()=>vUe,sha512_hex:()=>yUe,string:()=>NF,time:()=>TF,ulid:()=>mF,undefined:()=>FF,unicodeEmail:()=>Xre,uppercase:()=>UF,uuid:()=>wd,uuid4:()=>Z6e,uuid6:()=>J6e,uuid7:()=>K6e,xid:()=>gF});function wF(){return new RegExp(tUe,"u")}function ene(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function TF(t){return new RegExp(`^${ene(t)}$`)}function OF(t){let e=ene({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Qre}T(?:${n})$`)}function lv(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function uv(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var fF,hF,mF,gF,yF,bF,vF,W6e,_F,wd,Z6e,J6e,K6e,SF,Y6e,X6e,Xre,Q6e,eUe,tUe,xF,kF,EF,AF,$F,IF,GE,rUe,nUe,PF,RF,Qre,CF,NF,DF,jF,HE,LF,MF,FF,zF,UF,iUe,sUe,oUe,aUe,cUe,lUe,uUe,dUe,pUe,fUe,hUe,mUe,gUe,yUe,bUe,vUe,WE=S(()=>{_e();fF=/^[cC][0-9a-z]{6,}$/,hF=/^[0-9a-z]+$/,mF=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gF=/^[0-9a-vA-V]{20}$/,yF=/^[A-Za-z0-9]{27}$/,bF=/^[a-zA-Z0-9_-]{21}$/,vF=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,W6e=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_F=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wd=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Z6e=wd(4),J6e=wd(6),K6e=wd(7),SF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Y6e=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[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])?)*$/,X6e=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Xre=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Q6e=Xre,eUe=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[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])?)*$/,tUe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";xF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,kF=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,EF=t=>{let e=gs(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},AF=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$F=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,IF=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,GE=/^[A-Za-z0-9_-]*$/,rUe=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,nUe=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,PF=/^https?$/,RF=/^\+[1-9]\d{6,14}$/,Qre="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",CF=new RegExp(`^${Qre}$`);NF=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},DF=/^-?\d+n?$/,jF=/^-?\d+$/,HE=/^-?\d+(?:\.\d+)?$/,LF=/^(?:true|false)$/i,MF=/^null$/i,FF=/^undefined$/i,zF=/^[^A-Z]*$/,UF=/^[^a-z]*$/,iUe=/^[0-9a-fA-F]*$/;sUe=/^[0-9a-fA-F]{32}$/,oUe=lv(22,"=="),aUe=uv(22),cUe=/^[0-9a-fA-F]{40}$/,lUe=lv(27,"="),uUe=uv(27),dUe=/^[0-9a-fA-F]{64}$/,pUe=lv(43,"="),fUe=uv(43),hUe=/^[0-9a-fA-F]{96}$/,mUe=lv(64,""),gUe=uv(64),yUe=/^[0-9a-fA-F]{128}$/,bUe=lv(86,"=="),vUe=uv(86)});function tne(t,e,r){t.issues.length&&e.issues.push(...mi(r,t.issues))}var qt,rne,ZE,JE,BF,qF,VF,GF,HF,WF,ZF,JF,KF,dh,YF,XF,QF,ez,tz,rz,nz,iz,sz,KE=S(()=>{bd();WE();_e();qt=N("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),rne={number:"number",bigint:"bigint",object:"date"},ZE=N("$ZodCheckLessThan",(t,e)=>{qt.init(t,e);let r=rne[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,s=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?n.value<=e.value:n.value{qt.init(t,e);let r=rne[typeof e.value];t._zod.onattach.push(n=>{let i=n._zod.bag,s=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),BF=N("$ZodCheckMultipleOf",(t,e)=>{qt.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):tF(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),qF=N("$ZodCheckNumberFormat",(t,e)=>{qt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[i,s]=oF[e.format];t._zod.onattach.push(o=>{let a=o._zod.bag;a.format=e.format,a.minimum=i,a.maximum=s,r&&(a.pattern=jF)}),t._zod.check=o=>{let a=o.value;if(r){if(!Number.isInteger(a)){o.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}as&&o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),VF=N("$ZodCheckBigIntFormat",(t,e)=>{qt.init(t,e);let[r,n]=aF[e.format];t._zod.onattach.push(i=>{let s=i._zod.bag;s.format=e.format,s.minimum=r,s.maximum=n}),t._zod.check=i=>{let s=i.value;sn&&i.issues.push({origin:"bigint",input:s,code:"too_big",maximum:n,inclusive:!0,inst:t,continue:!e.abort})}}),GF=N("$ZodCheckMaxSize",(t,e)=>{var r;qt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!yl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let i=n.value;i.size<=e.maximum||n.issues.push({origin:iv(i),code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),HF=N("$ZodCheckMinSize",(t,e)=>{var r;qt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!yl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;i.size>=e.minimum||n.issues.push({origin:iv(i),code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),WF=N("$ZodCheckSizeEquals",(t,e)=>{var r;qt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!yl(i)&&i.size!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.size,i.maximum=e.size,i.size=e.size}),t._zod.check=n=>{let i=n.value,s=i.size;if(s===e.size)return;let o=s>e.size;n.issues.push({origin:iv(i),...o?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ZF=N("$ZodCheckMaxLength",(t,e)=>{var r;qt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!yl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let i=n.value;if(i.length<=e.maximum)return;let o=sv(i);n.issues.push({origin:o,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),JF=N("$ZodCheckMinLength",(t,e)=>{var r;qt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!yl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let i=n.value;if(i.length>=e.minimum)return;let o=sv(i);n.issues.push({origin:o,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),KF=N("$ZodCheckLengthEquals",(t,e)=>{var r;qt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let i=n.value;return!yl(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{let i=n.value,s=i.length;if(s===e.length)return;let o=sv(i),a=s>e.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),dh=N("$ZodCheckStringFormat",(t,e)=>{var r,n;qt.init(t,e),t._zod.onattach.push(i=>{let s=i._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),YF=N("$ZodCheckRegex",(t,e)=>{dh.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),XF=N("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=zF),dh.init(t,e)}),QF=N("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=UF),dh.init(t,e)}),ez=N("$ZodCheckIncludes",(t,e)=>{qt.init(t,e);let r=gs(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{let s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),tz=N("$ZodCheckStartsWith",(t,e)=>{qt.init(t,e);let r=new RegExp(`^${gs(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),rz=N("$ZodCheckEndsWith",(t,e)=>{qt.init(t,e);let r=new RegExp(`.*${gs(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});nz=N("$ZodCheckProperty",(t,e)=>{qt.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>tne(i,r,e.property));tne(n,r,e.property)}}),iz=N("$ZodCheckMimeType",(t,e)=>{qt.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),sz=N("$ZodCheckOverwrite",(t,e)=>{qt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}})});var dv,oz=S(()=>{dv=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(` +`).filter(o=>o),i=Math.min(...n.map(o=>o.length-o.trimStart().length)),s=n.map(o=>o.slice(i)).map(o=>" ".repeat(this.indent*2)+o);for(let o of s)this.content.push(o)}compile(){let e=Function,r=this?.args,i=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,i.join(` +`))}}});var az,cz=S(()=>{az={major:4,minor:4,patch:3}});function hz(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}function bne(t){if(!GE.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return hz(r)}function vne(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}function ine(t,e,r){t.issues.length&&e.issues.push(...mi(r,t.issues)),e.value[r]=t.value}function eA(t,e,r,n,i,s){let o=r in n;if(t.issues.length){if(i&&s&&!o)return;e.issues.push(...mi(r,t.issues))}if(!o&&!i){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?o&&(e.value[r]=void 0):e.value[r]=t.value}function _ne(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=sF(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Sne(t,e,r,n,i,s){let o=[],a=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin==="optional",d=c.optout==="optional";for(let p in e){if(p==="__proto__"||a.has(p))continue;if(l==="never"){o.push(p);continue}let f=c.run({value:e[p],issues:[]},n);f instanceof Promise?t.push(f.then(h=>eA(h,r,p,e,u,d))):eA(f,r,p,e,u,d)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}function sne(t,e,r,n){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let i=t.filter(s=>!_l(s));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(o=>Zn(o,n,br())))}),e)}function one(t,e,r,n){let i=t.filter(s=>s.issues.length===0);return i.length===1?(e.value=i[0].value,e):(i.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(o=>Zn(o,n,br())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}function lz(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(vl(t)&&vl(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),i={...t,...e};for(let s of n){let o=lz(t[s],e[s]);if(!o.valid)return{valid:!1,mergeErrorPath:[s,...o.mergeErrorPath]};i[s]=o.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;na.l&&a.r).map(([a])=>a);if(s.length&&i&&t.issues.push({...i,keys:s}),_l(t))return t;let o=lz(e.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return t.value=o.data,t}function cne(t,e){for(let r=t.length-1;r>=0;r--)if(t[r]._zod[e]!=="optional")return r+1;return 0}function lne(t,e,r){t.issues.length&&e.issues.push(...mi(r,t.issues)),e.value[r]=t.value}function une(t,e,r,n,i){for(let s=0;s=i){e.value.length=s;break}e.issues.push(...mi(s,o.issues))}e.value[s]=o.value}for(let s=e.value.length-1;s>=n.length&&(r[s]._zod.optout==="optional"&&e.value[s]===void 0);s--)e.value.length=s;return e}function dne(t,e,r,n,i,s,o){t.issues.length&&(nv.has(typeof n)?r.issues.push(...mi(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:s,issues:t.issues.map(a=>Zn(a,o,br()))})),e.issues.length&&(nv.has(typeof n)?r.issues.push(...mi(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:s,key:n,issues:e.issues.map(a=>Zn(a,o,br()))})),r.value.set(t.value,e.value)}function pne(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}function fne(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}function hne(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function mne(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function YE(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}function XE(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let i=e.transform(t.value,t);return i instanceof Promise?i.then(s=>QE(t,s,e.out,r)):QE(t,i,e.out,r)}else{let i=e.reverseTransform(t.value,t);return i instanceof Promise?i.then(s=>QE(t,s,e.in,r)):QE(t,i,e.in,r)}}function QE(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}function gne(t){return t.value=Object.freeze(t.value),t}function yne(t,e,r,n){if(!t){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(oh(i))}}var Le,xl,jt,tA,rA,nA,iA,sA,oA,aA,cA,lA,uA,dA,uz,dz,pz,fz,pA,fA,hA,mA,gA,yA,bA,vA,_A,SA,pv,wA,ph,fv,xA,kA,EA,AA,$A,IA,PA,RA,CA,TA,OA,mz,fh,NA,DA,jA,hv,LA,MA,FA,zA,UA,BA,qA,mv,VA,GA,HA,WA,ZA,JA,KA,YA,gv,hh,gz,XA,QA,e$,t$,r$,n$,yz=S(()=>{KE();bd();oz();pF();WE();_e();cz();_e();Le=N("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=az;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let i of n)for(let s of i._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let i=(o,a,c)=>{let l=_l(o),u;for(let d of a){if(d._zod.def.when){if(cF(o)||!d._zod.def.when(o))continue}else if(l)continue;let p=o.issues.length,f=d._zod.check(o);if(f instanceof Promise&&c?.async===!1)throw new Ys;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,o.issues.length!==p&&(l||(l=_l(o,p)))});else{if(o.issues.length===p)continue;l||(l=_l(o,p))}}return u?u.then(()=>o):o},s=(o,a,c)=>{if(_l(o))return o.aborted=!0,o;let l=i(a,n,c);if(l instanceof Promise){if(c.async===!1)throw new Ys;return l.then(u=>t._zod.parse(u,c))}return t._zod.parse(l,c)};t._zod.run=(o,a)=>{if(a.skipChecks)return t._zod.parse(o,a);if(a.direction==="backward"){let l=t._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(u=>s(u,o,a)):s(l,o,a)}let c=t._zod.parse(o,a);if(c instanceof Promise){if(a.async===!1)throw new Ys;return c.then(l=>i(l,n,a))}return i(c,n,a)}}Ge(t,"~standard",()=>({validate:i=>{try{let s=Sl(t,i);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return wl(t,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),xl=N("$ZodString",(t,e)=>{Le.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??NF(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),jt=N("$ZodStringFormat",(t,e)=>{dh.init(t,e),xl.init(t,e)}),tA=N("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=_F),jt.init(t,e)}),rA=N("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=wd(n))}else e.pattern??(e.pattern=wd());jt.init(t,e)}),nA=N("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=SF),jt.init(t,e)}),iA=N("$ZodURL",(t,e)=>{jt.init(t,e),t._zod.check=r=>{try{let n=r.value.trim();if(!e.normalize&&e.protocol?.source===PF.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}let i=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),sA=N("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=wF()),jt.init(t,e)}),oA=N("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=bF),jt.init(t,e)}),aA=N("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=fF),jt.init(t,e)}),cA=N("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=hF),jt.init(t,e)}),lA=N("$ZodULID",(t,e)=>{e.pattern??(e.pattern=mF),jt.init(t,e)}),uA=N("$ZodXID",(t,e)=>{e.pattern??(e.pattern=gF),jt.init(t,e)}),dA=N("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=yF),jt.init(t,e)}),uz=N("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=OF(e)),jt.init(t,e)}),dz=N("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=CF),jt.init(t,e)}),pz=N("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=TF(e)),jt.init(t,e)}),fz=N("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=vF),jt.init(t,e)}),pA=N("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=xF),jt.init(t,e),t._zod.bag.format="ipv4"}),fA=N("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=kF),jt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),hA=N("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=EF(e.delimiter)),jt.init(t,e),t._zod.bag.format="mac"}),mA=N("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=AF),jt.init(t,e)}),gA=N("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=$F),jt.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,s]=n;if(!s)throw new Error;let o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});yA=N("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=IF),jt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{hz(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});bA=N("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=GE),jt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{bne(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),vA=N("$ZodE164",(t,e)=>{e.pattern??(e.pattern=RF),jt.init(t,e)});_A=N("$ZodJWT",(t,e)=>{jt.init(t,e),t._zod.check=r=>{vne(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),SA=N("$ZodCustomStringFormat",(t,e)=>{jt.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),pv=N("$ZodNumber",(t,e)=>{Le.init(t,e),t._zod.pattern=t._zod.bag.pattern??HE,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...s?{received:s}:{}}),r}}),wA=N("$ZodNumberFormat",(t,e)=>{qF.init(t,e),pv.init(t,e)}),ph=N("$ZodBoolean",(t,e)=>{Le.init(t,e),t._zod.pattern=LF,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),fv=N("$ZodBigInt",(t,e)=>{Le.init(t,e),t._zod.pattern=DF,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),xA=N("$ZodBigIntFormat",(t,e)=>{VF.init(t,e),fv.init(t,e)}),kA=N("$ZodSymbol",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:t}),r}}),EA=N("$ZodUndefined",(t,e)=>{Le.init(t,e),t._zod.pattern=FF,t._zod.values=new Set([void 0]),t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:t}),r}}),AA=N("$ZodNull",(t,e)=>{Le.init(t,e),t._zod.pattern=MF,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:t}),r}}),$A=N("$ZodAny",(t,e)=>{Le.init(t,e),t._zod.parse=r=>r}),IA=N("$ZodUnknown",(t,e)=>{Le.init(t,e),t._zod.parse=r=>r}),PA=N("$ZodNever",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),RA=N("$ZodVoid",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:t}),r}}),CA=N("$ZodDate",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,s=i instanceof Date;return s&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...s?{received:"Invalid Date"}:{},inst:t}),r}});TA=N("$ZodArray",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);let s=[];for(let o=0;oine(l,r,o))):ine(c,r,o)}return s.length?Promise.all(s).then(()=>r):r}});OA=N("$ZodObject",(t,e)=>{if(Le.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=sh(()=>_ne(e));Ge(t._zod,"propValues",()=>{let a=e.shape,c={};for(let l in a){let u=a[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(let d of u.values)c[l].add(d)}}return c});let i=vd,s=e.catchall,o;t._zod.parse=(a,c)=>{o??(o=n.value);let l=a.value;if(!i(l))return a.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),a;a.value={};let u=[],d=o.shape;for(let p of o.keys){let f=d[p],h=f._zod.optin==="optional",m=f._zod.optout==="optional",y=f._zod.run({value:l[p],issues:[]},c);y instanceof Promise?u.push(y.then(v=>eA(v,a,p,l,h,m))):eA(y,a,p,l,h,m)}return s?Sne(u,l,a,c,n.value,t):u.length?Promise.all(u).then(()=>a):a}}),mz=N("$ZodObjectJIT",(t,e)=>{OA.init(t,e);let r=t._zod.parse,n=sh(()=>_ne(e)),i=p=>{let f=new dv(["shape","payload","ctx"]),h=n.value,m=b=>{let w=NE(b);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),v=0;for(let b of h.keys)y[b]=`key_${v++}`;f.write("const newResult = {};");for(let b of h.keys){let w=y[b],x=NE(b),$=p[b],I=$?._zod?.optin==="optional",E=$?._zod?.optout==="optional";f.write(`const ${w} = ${m(b)};`),I&&E?f.write(` + if (${w}.issues.length) { + if (${x} in input) { + payload.issues = payload.issues.concat(${w}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${x}, ...iss.path] : [${x}] + }))); + } + } + + if (${w}.value === undefined) { + if (${x} in input) { + newResult[${x}] = undefined; + } + } else { + newResult[${x}] = ${w}.value; + } + + `):I?f.write(` + if (${w}.issues.length) { + payload.issues = payload.issues.concat(${w}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${x}, ...iss.path] : [${x}] + }))); + } + + if (${w}.value === undefined) { + if (${x} in input) { + newResult[${x}] = undefined; + } + } else { + newResult[${x}] = ${w}.value; + } + + `):f.write(` + const ${w}_present = ${x} in input; + if (${w}.issues.length) { + payload.issues = payload.issues.concat(${w}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${x}, ...iss.path] : [${x}] + }))); + } + if (!${w}_present && !${w}.issues.length) { + payload.issues.push({ + code: "invalid_type", + expected: "nonoptional", + input: undefined, + path: [${x}] + }); + } + + if (${w}_present) { + if (${w}.value === undefined) { + newResult[${x}] = undefined; + } else { + newResult[${x}] = ${w}.value; + } + } + + `)}f.write("payload.value = newResult;"),f.write("return payload;");let g=f.compile();return(b,w)=>g(p,b,w)},s,o=vd,a=!yd.jitless,l=a&&nF.value,u=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=n.value);let h=p.value;return o(h)?a&&l&&f?.async===!1&&f.jitless!==!0?(s||(s=i(e.shape)),p=s(p,f),u?Sne([],h,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:h,inst:t}),p)}});fh=N("$ZodUnion",(t,e)=>{Le.init(t,e),Ge(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Ge(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Ge(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),Ge(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){let n=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>rv(i.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,i)=>{if(r)return r(n,i);let s=!1,o=[];for(let a of e.options){let c=a._zod.run({value:n.value,issues:[]},i);if(c instanceof Promise)o.push(c),s=!0;else{if(c.issues.length===0)return c;o.push(c)}}return s?Promise.all(o).then(a=>sne(a,n,t,i)):sne(o,n,t,i)}});NA=N("$ZodXor",(t,e)=>{fh.init(t,e),e.inclusive=!1;let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,i)=>{if(r)return r(n,i);let s=!1,o=[];for(let a of e.options){let c=a._zod.run({value:n.value,issues:[]},i);c instanceof Promise?(o.push(c),s=!0):o.push(c)}return s?Promise.all(o).then(a=>one(a,n,t,i)):one(o,n,t,i)}}),DA=N("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,fh.init(t,e);let r=t._zod.parse;Ge(t._zod,"propValues",()=>{let i={};for(let s of e.options){let o=s._zod.propValues;if(!o||Object.keys(o).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(o)){i[a]||(i[a]=new Set);for(let l of c)i[a].add(l)}}return i});let n=sh(()=>{let i=e.options,s=new Map;for(let o of i){let a=o._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,o)}}return s});t._zod.parse=(i,s)=>{let o=i.value;if(!vd(o))return i.issues.push({code:"invalid_type",expected:"object",input:o,inst:t}),i;let a=n.value.get(o?.[e.discriminator]);return a?a._zod.run(i,s):e.unionFallback||s.direction==="backward"?r(i,s):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(n.value.keys()),input:o,path:[e.discriminator],inst:t}),i)}}),jA=N("$ZodIntersection",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{let i=r.value,s=e.left._zod.run({value:i,issues:[]},n),o=e.right._zod.run({value:i,issues:[]},n);return s instanceof Promise||o instanceof Promise?Promise.all([s,o]).then(([c,l])=>ane(r,c,l)):ane(r,s,o)}});hv=N("$ZodTuple",(t,e)=>{Le.init(t,e);let r=e.items;t._zod.parse=(n,i)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({input:s,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let o=[],a=cne(r,"optin"),c=cne(r,"optout");if(!e.rest){if(s.lengthr.length&&n.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:t,origin:"array"})}let l=new Array(r.length);for(let u=0;u{l[u]=p})):l[u]=d}if(e.rest){let u=r.length-1,d=s.slice(r.length);for(let p of d){u++;let f=e.rest._zod.run({value:p,issues:[]},i);f instanceof Promise?o.push(f.then(h=>lne(h,n,u))):lne(f,n,u)}}return o.length?Promise.all(o).then(()=>une(l,n,r,s,c)):une(l,n,r,s,c)}});LA=N("$ZodRecord",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!vl(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:t}),r;let s=[],o=e.keyType._zod.values;if(o){r.value={};let a=new Set;for(let l of o)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){a.add(typeof l=="number"?l.toString():l);let u=e.keyType._zod.run({value:l,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(f=>Zn(f,n,br())),input:l,path:[l],inst:t});continue}let d=u.value,p=e.valueType._zod.run({value:i[l],issues:[]},n);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&r.issues.push(...mi(l,f.issues)),r.value[d]=f.value})):(p.issues.length&&r.issues.push(...mi(l,p.issues)),r.value[d]=p.value)}let c;for(let l in i)a.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(i)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&HE.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=i[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Zn(d,n,br())),input:a,path:[a],inst:t});continue}let u=e.valueType._zod.run({value:i[a],issues:[]},n);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&r.issues.push(...mi(a,d.issues)),r.value[c.value]=d.value})):(u.issues.length&&r.issues.push(...mi(a,u.issues)),r.value[c.value]=u.value)}}return s.length?Promise.all(s).then(()=>r):r}}),MA=N("$ZodMap",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:t}),r;let s=[];r.value=new Map;for(let[o,a]of i){let c=e.keyType._zod.run({value:o,issues:[]},n),l=e.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise||l instanceof Promise?s.push(Promise.all([c,l]).then(([u,d])=>{dne(u,d,r,o,i,t,n)})):dne(c,l,r,o,i,t,n)}return s.length?Promise.all(s).then(()=>r):r}});FA=N("$ZodSet",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:t,expected:"set",code:"invalid_type"}),r;let s=[];r.value=new Set;for(let o of i){let a=e.valueType._zod.run({value:o,issues:[]},n);a instanceof Promise?s.push(a.then(c=>pne(c,r))):pne(a,r)}return s.length?Promise.all(s).then(()=>r):r}});zA=N("$ZodEnum",(t,e)=>{Le.init(t,e);let r=tv(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>nv.has(typeof i)).map(i=>typeof i=="string"?gs(i):i.toString()).join("|")})$`),t._zod.parse=(i,s)=>{let o=i.value;return n.has(o)||i.issues.push({code:"invalid_value",values:r,input:o,inst:t}),i}}),UA=N("$ZodLiteral",(t,e)=>{if(Le.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?gs(n):n?gs(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),n}}),BA=N("$ZodFile",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{let i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:t}),r}}),qA=N("$ZodTransform",(t,e)=>{Le.init(t,e),t._zod.optin="optional",t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gl(t.constructor.name);let i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(o=>(r.value=o,r.fallback=!0,r));if(i instanceof Promise)throw new Ys;return r.value=i,r.fallback=!0,r}});mv=N("$ZodOptional",(t,e)=>{Le.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Ge(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Ge(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${rv(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let i=r.value,s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>fne(o,i)):fne(s,i)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),VA=N("$ZodExactOptional",(t,e)=>{mv.init(t,e),Ge(t._zod,"values",()=>e.innerType._zod.values),Ge(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),GA=N("$ZodNullable",(t,e)=>{Le.init(t,e),Ge(t._zod,"optin",()=>e.innerType._zod.optin),Ge(t._zod,"optout",()=>e.innerType._zod.optout),Ge(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${rv(r.source)}|null)$`):void 0}),Ge(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),HA=N("$ZodDefault",(t,e)=>{Le.init(t,e),t._zod.optin="optional",Ge(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>hne(s,e)):hne(i,e)}});WA=N("$ZodPrefault",(t,e)=>{Le.init(t,e),t._zod.optin="optional",Ge(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),ZA=N("$ZodNonOptional",(t,e)=>{Le.init(t,e),Ge(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>mne(s,t)):mne(i,t)}});JA=N("$ZodSuccess",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gl("ZodSuccess");let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>(r.value=s.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),KA=N("$ZodCatch",(t,e)=>{Le.init(t,e),t._zod.optin="optional",Ge(t._zod,"optout",()=>e.innerType._zod.optout),Ge(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(o=>Zn(o,n,br()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(s=>Zn(s,n,br()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),YA=N("$ZodNaN",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),gv=N("$ZodPipe",(t,e)=>{Le.init(t,e),Ge(t._zod,"values",()=>e.in._zod.values),Ge(t._zod,"optin",()=>e.in._zod.optin),Ge(t._zod,"optout",()=>e.out._zod.optout),Ge(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=e.out._zod.run(r,n);return s instanceof Promise?s.then(o=>YE(o,e.in,n)):YE(s,e.in,n)}let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(s=>YE(s,e.out,n)):YE(i,e.out,n)}});hh=N("$ZodCodec",(t,e)=>{Le.init(t,e),Ge(t._zod,"values",()=>e.in._zod.values),Ge(t._zod,"optin",()=>e.in._zod.optin),Ge(t._zod,"optout",()=>e.out._zod.optout),Ge(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let s=e.in._zod.run(r,n);return s instanceof Promise?s.then(o=>XE(o,e,n)):XE(s,e,n)}else{let s=e.out._zod.run(r,n);return s instanceof Promise?s.then(o=>XE(o,e,n)):XE(s,e,n)}}});gz=N("$ZodPreprocess",(t,e)=>{gv.init(t,e)}),XA=N("$ZodReadonly",(t,e)=>{Le.init(t,e),Ge(t._zod,"propValues",()=>e.innerType._zod.propValues),Ge(t._zod,"values",()=>e.innerType._zod.values),Ge(t._zod,"optin",()=>e.innerType?._zod?.optin),Ge(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(gne):gne(i)}});QA=N("$ZodTemplateLiteral",(t,e)=>{Le.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let s=i.startsWith("^")?1:0,o=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(s,o))}else if(n===null||iF.has(typeof n))r.push(gs(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"string",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),e$=N("$ZodFunction",(t,e)=>(Le.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let i=t._def.input?_d(t._def.input,n):n,s=Reflect.apply(r,this,i);return t._def.output?_d(t._def.output,s):s}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=t._def.input?await Sd(t._def.input,n):n,s=await Reflect.apply(r,this,i);return t._def.output?await Sd(t._def.output,s):s}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new hv({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),t$=N("$ZodPromise",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>e.innerType._zod.run({value:i,issues:[]},n))}),r$=N("$ZodLazy",(t,e)=>{Le.init(t,e),Ge(t._zod,"innerType",()=>{let r=e;return r._cachedInner||(r._cachedInner=e.getter()),r._cachedInner}),Ge(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Ge(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Ge(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Ge(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),n$=N("$ZodCustom",(t,e)=>{qt.init(t,e),Le.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(s=>yne(s,r,n,t));yne(i,r,n,t)}})});function wne(){return{localeError:SUe()}}var SUe,xne=S(()=>{_e();SUe=()=>{let t={string:{unit:"\u062D\u0631\u0641",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},file:{unit:"\u0628\u0627\u064A\u062A",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},array:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"},set:{unit:"\u0639\u0646\u0635\u0631",verb:"\u0623\u0646 \u064A\u062D\u0648\u064A"}};function e(i){return t[i]??null}let r={regex:"\u0645\u062F\u062E\u0644",email:"\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",url:"\u0631\u0627\u0628\u0637",emoji:"\u0625\u064A\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",date:"\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO",time:"\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO",duration:"\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO",ipv4:"\u0639\u0646\u0648\u0627\u0646 IPv4",ipv6:"\u0639\u0646\u0648\u0627\u0646 IPv6",cidrv4:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4",cidrv6:"\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6",base64:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded",base64url:"\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded",json_string:"\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON",e164:"\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164",jwt:"JWT",template_literal:"\u0645\u062F\u062E\u0644"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${i.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`:`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${s}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${a}`}case"invalid_value":return i.values.length===1?`\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${W(i.values[0])}`:`\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${s} ${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631"}`:`\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${i.origin??"\u0627\u0644\u0642\u064A\u0645\u0629"} ${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${s} ${i.minimum.toString()} ${o.unit}`:`\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${i.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${i.prefix}"`:s.format==="ends_with"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${s.suffix}"`:s.format==="includes"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${s.includes}"`:s.format==="regex"?`\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${s.pattern}`:`${r[s.format]??i.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`}case"not_multiple_of":return`\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${i.divisor}`;case"unrecognized_keys":return`\u0645\u0639\u0631\u0641${i.keys.length>1?"\u0627\u062A":""} \u063A\u0631\u064A\u0628${i.keys.length>1?"\u0629":""}: ${L(i.keys,"\u060C ")}`;case"invalid_key":return`\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;case"invalid_union":return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644";case"invalid_element":return`\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${i.origin}`;default:return"\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"}}}});function kne(){return{localeError:wUe()}}var wUe,Ene=S(()=>{_e();wUe=()=>{let t={string:{unit:"simvol",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"element",verb:"olmal\u0131d\u0131r"},set:{unit:"element",verb:"olmal\u0131d\u0131r"}};function e(i){return t[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${i.expected}, daxil olan ${a}`:`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${s}, daxil olan ${a}`}case"invalid_value":return i.values.length===1?`Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${W(i.values[0])}`:`Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${s}${i.maximum.toString()} ${o.unit??"element"}`:`\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${i.origin??"d\u0259y\u0259r"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${s}${i.minimum.toString()} ${o.unit}`:`\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Yanl\u0131\u015F m\u0259tn: "${s.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`:s.format==="ends_with"?`Yanl\u0131\u015F m\u0259tn: "${s.suffix}" il\u0259 bitm\u0259lidir`:s.format==="includes"?`Yanl\u0131\u015F m\u0259tn: "${s.includes}" daxil olmal\u0131d\u0131r`:s.format==="regex"?`Yanl\u0131\u015F m\u0259tn: ${s.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`:`Yanl\u0131\u015F ${r[s.format]??i.format}`}case"not_multiple_of":return`Yanl\u0131\u015F \u0259d\u0259d: ${i.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`;case"unrecognized_keys":return`Tan\u0131nmayan a\xE7ar${i.keys.length>1?"lar":""}: ${L(i.keys,", ")}`;case"invalid_key":return`${i.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`;case"invalid_union":return"Yanl\u0131\u015F d\u0259y\u0259r";case"invalid_element":return`${i.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`;default:return"Yanl\u0131\u015F d\u0259y\u0259r"}}}});function Ane(t,e,r,n){let i=Math.abs(t),s=i%10,o=i%100;return o>=11&&o<=19?n:s===1?e:s>=2&&s<=4?r:n}function $ne(){return{localeError:xUe()}}var xUe,Ine=S(()=>{_e();xUe=()=>{let t={string:{unit:{one:"\u0441\u0456\u043C\u0432\u0430\u043B",few:"\u0441\u0456\u043C\u0432\u0430\u043B\u044B",many:"\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u044B",many:"\u0431\u0430\u0439\u0442\u0430\u045E"},verb:"\u043C\u0435\u0446\u044C"}};function e(i){return t[i]??null}let r={regex:"\u0443\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0430\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0447\u0430\u0441",duration:"ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0430\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0430\u0441",cidrv4:"IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D",base64:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64",base64url:"\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url",json_string:"JSON \u0440\u0430\u0434\u043E\u043A",e164:"\u043D\u0443\u043C\u0430\u0440 E.164",jwt:"JWT",template_literal:"\u0443\u0432\u043E\u0434"},n={nan:"NaN",number:"\u043B\u0456\u043A",array:"\u043C\u0430\u0441\u0456\u045E"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${i.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${s}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${W(i.values[0])}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);if(o){let a=Number(i.maximum),c=Ane(a,o.unit.one,o.unit.few,o.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${o.verb} ${s}${i.maximum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);if(o){let a=Number(i.minimum),c=Ane(a,o.unit.one,o.unit.few,o.unit.many);return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${o.verb} ${s}${i.minimum.toString()} ${c}`}return`\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${i.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${s.includes}"`:s.format==="regex"?`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${r[s.format]??i.format}`}case"not_multiple_of":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${i.keys.length>1?"\u043A\u043B\u044E\u0447\u044B":"\u043A\u043B\u044E\u0447"}: ${L(i.keys,", ")}`;case"invalid_key":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434";case"invalid_element":return`\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${i.origin}`;default:return"\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"}}}});function Pne(){return{localeError:kUe()}}var kUe,Rne=S(()=>{_e();kUe=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},file:{unit:"\u0431\u0430\u0439\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430",verb:"\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430"}};function e(i){return t[i]??null}let r={regex:"\u0432\u0445\u043E\u0434",email:"\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0436\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",base64url:"base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437",json_string:"JSON \u043D\u0438\u0437",e164:"E.164 \u043D\u043E\u043C\u0435\u0440",jwt:"JWT",template_literal:"\u0432\u0445\u043E\u0434"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${s}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${W(i.values[0])}`:`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${s}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin??"\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${s}${i.minimum.toString()} ${o.unit}`:`\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${i.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${s.prefix}"`;if(s.format==="ends_with")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${s.suffix}"`;if(s.format==="includes")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${s.includes}"`;if(s.format==="regex")return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${s.pattern}`;let o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D";return s.format==="emoji"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="datetime"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="date"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),s.format==="time"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"),s.format==="duration"&&(o="\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"),`${o} ${r[s.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${i.keys.length>1?"\u0438":""} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u043E\u0432\u0435":""}: ${L(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434";case"invalid_element":return`\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"}}}});function Cne(){return{localeError:EUe()}}var EUe,Tne=S(()=>{_e();EUe=()=>{let t={string:{unit:"car\xE0cters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function e(i){return t[i]??null}let r={regex:"entrada",email:"adre\xE7a electr\xF2nica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adre\xE7a IPv4",ipv6:"adre\xE7a IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Tipus inv\xE0lid: s'esperava instanceof ${i.expected}, s'ha rebut ${a}`:`Tipus inv\xE0lid: s'esperava ${s}, s'ha rebut ${a}`}case"invalid_value":return i.values.length===1?`Valor inv\xE0lid: s'esperava ${W(i.values[0])}`:`Opci\xF3 inv\xE0lida: s'esperava una de ${L(i.values," o ")}`;case"too_big":{let s=i.inclusive?"com a m\xE0xim":"menys de",o=e(i.origin);return o?`Massa gran: s'esperava que ${i.origin??"el valor"} contingu\xE9s ${s} ${i.maximum.toString()} ${o.unit??"elements"}`:`Massa gran: s'esperava que ${i.origin??"el valor"} fos ${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?"com a m\xEDnim":"m\xE9s de",o=e(i.origin);return o?`Massa petit: s'esperava que ${i.origin} contingu\xE9s ${s} ${i.minimum.toString()} ${o.unit}`:`Massa petit: s'esperava que ${i.origin} fos ${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Format inv\xE0lid: ha de comen\xE7ar amb "${s.prefix}"`:s.format==="ends_with"?`Format inv\xE0lid: ha d'acabar amb "${s.suffix}"`:s.format==="includes"?`Format inv\xE0lid: ha d'incloure "${s.includes}"`:s.format==="regex"?`Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${s.pattern}`:`Format inv\xE0lid per a ${r[s.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${i.divisor}`;case"unrecognized_keys":return`Clau${i.keys.length>1?"s":""} no reconeguda${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`Clau inv\xE0lida a ${i.origin}`;case"invalid_union":return"Entrada inv\xE0lida";case"invalid_element":return`Element inv\xE0lid a ${i.origin}`;default:return"Entrada inv\xE0lida"}}}});function One(){return{localeError:AUe()}}var AUe,Nne=S(()=>{_e();AUe=()=>{let t={string:{unit:"znak\u016F",verb:"m\xEDt"},file:{unit:"bajt\u016F",verb:"m\xEDt"},array:{unit:"prvk\u016F",verb:"m\xEDt"},set:{unit:"prvk\u016F",verb:"m\xEDt"}};function e(i){return t[i]??null}let r={regex:"regul\xE1rn\xED v\xFDraz",email:"e-mailov\xE1 adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a \u010Das ve form\xE1tu ISO",date:"datum ve form\xE1tu ISO",time:"\u010Das ve form\xE1tu ISO",duration:"doba trv\xE1n\xED ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64",base64url:"\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url",json_string:"\u0159et\u011Bzec ve form\xE1tu JSON",e164:"\u010D\xEDslo E.164",jwt:"JWT",template_literal:"vstup"},n={nan:"NaN",number:"\u010D\xEDslo",string:"\u0159et\u011Bzec",function:"funkce",array:"pole"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${i.expected}, obdr\u017Eeno ${a}`:`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${s}, obdr\u017Eeno ${a}`}case"invalid_value":return i.values.length===1?`Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${W(i.values[0])}`:`Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${s}${i.maximum.toString()} ${o.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED m\xEDt ${s}${i.minimum.toString()} ${o.unit??"prvk\u016F"}`:`Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${i.origin??"hodnota"} mus\xED b\xFDt ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${s.prefix}"`:s.format==="ends_with"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${s.suffix}"`:s.format==="includes"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${s.includes}"`:s.format==="regex"?`Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${s.pattern}`:`Neplatn\xFD form\xE1t ${r[s.format]??i.format}`}case"not_multiple_of":return`Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${i.divisor}`;case"unrecognized_keys":return`Nezn\xE1m\xE9 kl\xED\u010De: ${L(i.keys,", ")}`;case"invalid_key":return`Neplatn\xFD kl\xED\u010D v ${i.origin}`;case"invalid_union":return"Neplatn\xFD vstup";case"invalid_element":return`Neplatn\xE1 hodnota v ${i.origin}`;default:return"Neplatn\xFD vstup"}}}});function Dne(){return{localeError:$Ue()}}var $Ue,jne=S(()=>{_e();$Ue=()=>{let t={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function e(i){return t[i]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkesl\xE6t",date:"ISO-dato",time:"ISO-klokkesl\xE6t",duration:"ISO-varighed",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"s\xE6t",file:"fil"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ugyldigt input: forventede instanceof ${i.expected}, fik ${a}`:`Ugyldigt input: forventede ${s}, fik ${a}`}case"invalid_value":return i.values.length===1?`Ugyldig v\xE6rdi: forventede ${W(i.values[0])}`:`Ugyldigt valg: forventede en af f\xF8lgende ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin),a=n[i.origin]??i.origin;return o?`For stor: forventede ${a??"value"} ${o.verb} ${s} ${i.maximum.toString()} ${o.unit??"elementer"}`:`For stor: forventede ${a??"value"} havde ${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin),a=n[i.origin]??i.origin;return o?`For lille: forventede ${a} ${o.verb} ${s} ${i.minimum.toString()} ${o.unit}`:`For lille: forventede ${a} havde ${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ugyldig streng: skal starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: skal ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: skal indeholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: skal matche m\xF8nsteret ${s.pattern}`:`Ugyldig ${r[s.format]??i.format}`}case"not_multiple_of":return`Ugyldigt tal: skal v\xE6re deleligt med ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukendte n\xF8gler":"Ukendt n\xF8gle"}: ${L(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8gle i ${i.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig v\xE6rdi i ${i.origin}`;default:return"Ugyldigt input"}}}});function Lne(){return{localeError:IUe()}}var IUe,Mne=S(()=>{_e();IUe=()=>{let t={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function e(i){return t[i]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},n={nan:"NaN",number:"Zahl",array:"Array"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ung\xFCltige Eingabe: erwartet instanceof ${i.expected}, erhalten ${a}`:`Ung\xFCltige Eingabe: erwartet ${s}, erhalten ${a}`}case"invalid_value":return i.values.length===1?`Ung\xFCltige Eingabe: erwartet ${W(i.values[0])}`:`Ung\xFCltige Option: erwartet eine von ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${s}${i.maximum.toString()} ${o.unit??"Elemente"} hat`:`Zu gro\xDF: erwartet, dass ${i.origin??"Wert"} ${s}${i.maximum.toString()} ist`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Zu klein: erwartet, dass ${i.origin} ${s}${i.minimum.toString()} ${o.unit} hat`:`Zu klein: erwartet, dass ${i.origin} ${s}${i.minimum.toString()} ist`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ung\xFCltiger String: muss mit "${s.prefix}" beginnen`:s.format==="ends_with"?`Ung\xFCltiger String: muss mit "${s.suffix}" enden`:s.format==="includes"?`Ung\xFCltiger String: muss "${s.includes}" enthalten`:s.format==="regex"?`Ung\xFCltiger String: muss dem Muster ${s.pattern} entsprechen`:`Ung\xFCltig: ${r[s.format]??i.format}`}case"not_multiple_of":return`Ung\xFCltige Zahl: muss ein Vielfaches von ${i.divisor} sein`;case"unrecognized_keys":return`${i.keys.length>1?"Unbekannte Schl\xFCssel":"Unbekannter Schl\xFCssel"}: ${L(i.keys,", ")}`;case"invalid_key":return`Ung\xFCltiger Schl\xFCssel in ${i.origin}`;case"invalid_union":return"Ung\xFCltige Eingabe";case"invalid_element":return`Ung\xFCltiger Wert in ${i.origin}`;default:return"Ung\xFCltige Eingabe"}}}});function Fne(){return{localeError:PUe()}}var PUe,zne=S(()=>{_e();PUe=()=>{let t={string:{unit:"\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},file:{unit:"bytes",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},array:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},set:{unit:"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"},map:{unit:"\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2",verb:"\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9"}};function e(i){return t[i]??null}let r={regex:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2",email:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1",date:"ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1",time:"ISO \u03CE\u03C1\u03B1",duration:"ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1",ipv4:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4",ipv6:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6",mac:"\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC",cidrv4:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4",cidrv6:"\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6",base64:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64",base64url:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url",json_string:"\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON",e164:"\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164",jwt:"JWT",template_literal:"\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return typeof i.expected=="string"&&/^[A-Z]/.test(i.expected)?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${i.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${s}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${a}`}case"invalid_value":return i.values.length===1?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${W(i.values[0])}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${s}${i.maximum.toString()} ${o.unit??"\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin??"\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${s}${i.minimum.toString()} ${o.unit}`:`\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${i.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${s.prefix}"`:s.format==="ends_with"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${s.suffix}"`:s.format==="includes"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${s.includes}"`:s.format==="regex"?`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${s.pattern}`:`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${r[s.format]??i.format}`}case"not_multiple_of":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${i.divisor}`;case"unrecognized_keys":return`\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${i.keys.length>1?"\u03B1":"\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${i.keys.length>1?"\u03B9\u03AC":"\u03AF"}: ${L(i.keys,", ")}`;case"invalid_key":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${i.origin}`;case"invalid_union":return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2";case"invalid_element":return`\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${i.origin}`;default:return"\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"}}}});function i$(){return{localeError:RUe()}}var RUe,bz=S(()=>{_e();RUe=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(i){return t[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${W(i.values[0])}`:`Invalid option: expected one of ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${o.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(o=>`'${o}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}}});function Une(){return{localeError:CUe()}}var CUe,Bne=S(()=>{_e();CUe=()=>{let t={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function e(i){return t[i]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emo\u011Dio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-da\u016Dro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},n={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Nevalida enigo: atendi\u011Dis instanceof ${i.expected}, ricevi\u011Dis ${a}`:`Nevalida enigo: atendi\u011Dis ${s}, ricevi\u011Dis ${a}`}case"invalid_value":return i.values.length===1?`Nevalida enigo: atendi\u011Dis ${W(i.values[0])}`:`Nevalida opcio: atendi\u011Dis unu el ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${s}${i.maximum.toString()} ${o.unit??"elementojn"}`:`Tro granda: atendi\u011Dis ke ${i.origin??"valoro"} havu ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Tro malgranda: atendi\u011Dis ke ${i.origin} havu ${s}${i.minimum.toString()} ${o.unit}`:`Tro malgranda: atendi\u011Dis ke ${i.origin} estu ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Nevalida karaktraro: devas komenci\u011Di per "${s.prefix}"`:s.format==="ends_with"?`Nevalida karaktraro: devas fini\u011Di per "${s.suffix}"`:s.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${s.includes}"`:s.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${s.pattern}`:`Nevalida ${r[s.format]??i.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${i.divisor}`;case"unrecognized_keys":return`Nekonata${i.keys.length>1?"j":""} \u015Dlosilo${i.keys.length>1?"j":""}: ${L(i.keys,", ")}`;case"invalid_key":return`Nevalida \u015Dlosilo en ${i.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${i.origin}`;default:return"Nevalida enigo"}}}});function qne(){return{localeError:TUe()}}var TUe,Vne=S(()=>{_e();TUe=()=>{let t={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function e(i){return t[i]??null}let r={regex:"entrada",email:"direcci\xF3n de correo electr\xF3nico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duraci\xF3n ISO",ipv4:"direcci\xF3n IPv4",ipv6:"direcci\xF3n IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",string:"texto",number:"n\xFAmero",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"n\xFAmero grande",symbol:"s\xEDmbolo",undefined:"indefinido",null:"nulo",function:"funci\xF3n",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeraci\xF3n",union:"uni\xF3n",literal:"literal",promise:"promesa",void:"vac\xEDo",never:"nunca",unknown:"desconocido",any:"cualquiera"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Entrada inv\xE1lida: se esperaba instanceof ${i.expected}, recibido ${a}`:`Entrada inv\xE1lida: se esperaba ${s}, recibido ${a}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: se esperaba ${W(i.values[0])}`:`Opci\xF3n inv\xE1lida: se esperaba una de ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin),a=n[i.origin]??i.origin;return o?`Demasiado grande: se esperaba que ${a??"valor"} tuviera ${s}${i.maximum.toString()} ${o.unit??"elementos"}`:`Demasiado grande: se esperaba que ${a??"valor"} fuera ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin),a=n[i.origin]??i.origin;return o?`Demasiado peque\xF1o: se esperaba que ${a} tuviera ${s}${i.minimum.toString()} ${o.unit}`:`Demasiado peque\xF1o: se esperaba que ${a} fuera ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Cadena inv\xE1lida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inv\xE1lida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inv\xE1lida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${s.pattern}`:`Inv\xE1lido ${r[s.format]??i.format}`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Llave${i.keys.length>1?"s":""} desconocida${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`Llave inv\xE1lida en ${n[i.origin]??i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido en ${n[i.origin]??i.origin}`;default:return"Entrada inv\xE1lida"}}}});function Gne(){return{localeError:OUe()}}var OUe,Hne=S(()=>{_e();OUe=()=>{let t={string:{unit:"\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},file:{unit:"\u0628\u0627\u06CC\u062A",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},array:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"},set:{unit:"\u0622\u06CC\u062A\u0645",verb:"\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F"}};function e(i){return t[i]??null}let r={regex:"\u0648\u0631\u0648\u062F\u06CC",email:"\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644",url:"URL",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",date:"\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648",time:"\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",duration:"\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648",ipv4:"IPv4 \u0622\u062F\u0631\u0633",ipv6:"IPv6 \u0622\u062F\u0631\u0633",cidrv4:"IPv4 \u062F\u0627\u0645\u0646\u0647",cidrv6:"IPv6 \u062F\u0627\u0645\u0646\u0647",base64:"base64-encoded \u0631\u0634\u062A\u0647",base64url:"base64url-encoded \u0631\u0634\u062A\u0647",json_string:"JSON \u0631\u0634\u062A\u0647",e164:"E.164 \u0639\u062F\u062F",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u06CC"},n={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0622\u0631\u0627\u06CC\u0647"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${i.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`:`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${s} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${a} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`}case"invalid_value":return i.values.length===1?`\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${W(i.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`:`\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${L(i.values,"|")} \u0645\u06CC\u200C\u0628\u0648\u062F`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${s}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${i.origin??"\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${s}${i.maximum.toString()} \u0628\u0627\u0634\u062F`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${s}${i.minimum.toString()} ${o.unit} \u0628\u0627\u0634\u062F`:`\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${i.origin} \u0628\u0627\u06CC\u062F ${s}${i.minimum.toString()} \u0628\u0627\u0634\u062F`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${s.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`:s.format==="ends_with"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${s.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`:s.format==="includes"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${s.includes}" \u0628\u0627\u0634\u062F`:s.format==="regex"?`\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${s.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`:`${r[s.format]??i.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`}case"not_multiple_of":return`\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${i.divisor} \u0628\u0627\u0634\u062F`;case"unrecognized_keys":return`\u06A9\u0644\u06CC\u062F${i.keys.length>1?"\u0647\u0627\u06CC":""} \u0646\u0627\u0634\u0646\u0627\u0633: ${L(i.keys,", ")}`;case"invalid_key":return`\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${i.origin}`;case"invalid_union":return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631";case"invalid_element":return`\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${i.origin}`;default:return"\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631"}}}});function Wne(){return{localeError:NUe()}}var NUe,Zne=S(()=>{_e();NUe=()=>{let t={string:{unit:"merkki\xE4",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"p\xE4iv\xE4m\xE4\xE4r\xE4n"}};function e(i){return t[i]??null}let r={regex:"s\xE4\xE4nn\xF6llinen lauseke",email:"s\xE4hk\xF6postiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-p\xE4iv\xE4m\xE4\xE4r\xE4",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Virheellinen tyyppi: odotettiin instanceof ${i.expected}, oli ${a}`:`Virheellinen tyyppi: odotettiin ${s}, oli ${a}`}case"invalid_value":return i.values.length===1?`Virheellinen sy\xF6te: t\xE4ytyy olla ${W(i.values[0])}`:`Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Liian suuri: ${o.subject} t\xE4ytyy olla ${s}${i.maximum.toString()} ${o.unit}`.trim():`Liian suuri: arvon t\xE4ytyy olla ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Liian pieni: ${o.subject} t\xE4ytyy olla ${s}${i.minimum.toString()} ${o.unit}`.trim():`Liian pieni: arvon t\xE4ytyy olla ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Virheellinen sy\xF6te: t\xE4ytyy alkaa "${s.prefix}"`:s.format==="ends_with"?`Virheellinen sy\xF6te: t\xE4ytyy loppua "${s.suffix}"`:s.format==="includes"?`Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${s.includes}"`:s.format==="regex"?`Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${s.pattern}`:`Virheellinen ${r[s.format]??i.format}`}case"not_multiple_of":return`Virheellinen luku: t\xE4ytyy olla luvun ${i.divisor} monikerta`;case"unrecognized_keys":return`${i.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${L(i.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen sy\xF6te"}}}});function Jne(){return{localeError:DUe()}}var DUe,Kne=S(()=>{_e();DUe=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(i){return t[i]??null}let r={regex:"entr\xE9e",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},n={string:"cha\xEEne",number:"nombre",int:"entier",boolean:"bool\xE9en",bigint:"grand entier",symbol:"symbole",undefined:"ind\xE9fini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : instanceof ${i.expected} attendu, ${a} re\xE7u`:`Entr\xE9e invalide : ${s} attendu, ${a} re\xE7u`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : ${W(i.values[0])} attendu`:`Option invalide : une valeur parmi ${L(i.values,"|")} attendue`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Trop grand : ${n[i.origin]??"valeur"} doit ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"\xE9l\xE9ment(s)"}`:`Trop grand : ${n[i.origin]??"valeur"} doit \xEAtre ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Trop petit : ${n[i.origin]??"valeur"} doit ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`Trop petit : ${n[i.origin]??"valeur"} doit \xEAtre ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Cha\xEEne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Cha\xEEne invalide : doit correspondre au mod\xE8le ${s.pattern}`:`${r[s.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${L(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}}});function Yne(){return{localeError:jUe()}}var jUe,Xne=S(()=>{_e();jUe=()=>{let t={string:{unit:"caract\xE8res",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"\xE9l\xE9ments",verb:"avoir"},set:{unit:"\xE9l\xE9ments",verb:"avoir"}};function e(i){return t[i]??null}let r={regex:"entr\xE9e",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"dur\xE9e ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"cha\xEEne encod\xE9e en base64",base64url:"cha\xEEne encod\xE9e en base64url",json_string:"cha\xEEne JSON",e164:"num\xE9ro E.164",jwt:"JWT",template_literal:"entr\xE9e"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Entr\xE9e invalide : attendu instanceof ${i.expected}, re\xE7u ${a}`:`Entr\xE9e invalide : attendu ${s}, re\xE7u ${a}`}case"invalid_value":return i.values.length===1?`Entr\xE9e invalide : attendu ${W(i.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"\u2264":"<",o=e(i.origin);return o?`Trop grand : attendu que ${i.origin??"la valeur"} ait ${s}${i.maximum.toString()} ${o.unit}`:`Trop grand : attendu que ${i.origin??"la valeur"} soit ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?"\u2265":">",o=e(i.origin);return o?`Trop petit : attendu que ${i.origin} ait ${s}${i.minimum.toString()} ${o.unit}`:`Trop petit : attendu que ${i.origin} soit ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Cha\xEEne invalide : doit commencer par "${s.prefix}"`:s.format==="ends_with"?`Cha\xEEne invalide : doit se terminer par "${s.suffix}"`:s.format==="includes"?`Cha\xEEne invalide : doit inclure "${s.includes}"`:s.format==="regex"?`Cha\xEEne invalide : doit correspondre au motif ${s.pattern}`:`${r[s.format]??i.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit \xEAtre un multiple de ${i.divisor}`;case"unrecognized_keys":return`Cl\xE9${i.keys.length>1?"s":""} non reconnue${i.keys.length>1?"s":""} : ${L(i.keys,", ")}`;case"invalid_key":return`Cl\xE9 invalide dans ${i.origin}`;case"invalid_union":return"Entr\xE9e invalide";case"invalid_element":return`Valeur invalide dans ${i.origin}`;default:return"Entr\xE9e invalide"}}}});function Qne(){return{localeError:LUe()}}var LUe,eie=S(()=>{_e();LUe=()=>{let t={string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA",gender:"f"},number:{label:"\u05DE\u05E1\u05E4\u05E8",gender:"m"},boolean:{label:"\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA",gender:"m"},array:{label:"\u05DE\u05E2\u05E8\u05DA",gender:"m"},object:{label:"\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8",gender:"m"},null:{label:"\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)",gender:"m"},undefined:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)",gender:"m"},symbol:{label:"\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)",gender:"m"},function:{label:"\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4",gender:"f"},map:{label:"\u05DE\u05E4\u05D4 (Map)",gender:"f"},set:{label:"\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)",gender:"f"},file:{label:"\u05E7\u05D5\u05D1\u05E5",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2",gender:"m"},value:{label:"\u05E2\u05E8\u05DA",gender:"m"}},e={string:{unit:"\u05EA\u05D5\u05D5\u05D9\u05DD",shortLabel:"\u05E7\u05E6\u05E8",longLabel:"\u05D0\u05E8\u05D5\u05DA"},file:{unit:"\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},array:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},set:{unit:"\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"},number:{unit:"",shortLabel:"\u05E7\u05D8\u05DF",longLabel:"\u05D2\u05D3\u05D5\u05DC"}},r=l=>l?t[l]:void 0,n=l=>{let u=r(l);return u?u.label:l??t.unknown.label},i=l=>`\u05D4${n(l)}`,s=l=>(r(l)?.gender??"m")==="f"?"\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA":"\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA",o=l=>l?e[l]??null:null,a={regex:{label:"\u05E7\u05DC\u05D8",gender:"m"},email:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",gender:"f"},url:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA",gender:"f"},emoji:{label:"\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO",gender:"m"},date:{label:"\u05EA\u05D0\u05E8\u05D9\u05DA ISO",gender:"m"},time:{label:"\u05D6\u05DE\u05DF ISO",gender:"m"},duration:{label:"\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO",gender:"m"},ipv4:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv4",gender:"f"},ipv6:{label:"\u05DB\u05EA\u05D5\u05D1\u05EA IPv6",gender:"f"},cidrv4:{label:"\u05D8\u05D5\u05D5\u05D7 IPv4",gender:"m"},cidrv6:{label:"\u05D8\u05D5\u05D5\u05D7 IPv6",gender:"m"},base64:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64",gender:"f"},base64url:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA",gender:"f"},json_string:{label:"\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON",gender:"f"},e164:{label:"\u05DE\u05E1\u05E4\u05E8 E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},includes:{label:"\u05E7\u05DC\u05D8",gender:"m"},lowercase:{label:"\u05E7\u05DC\u05D8",gender:"m"},starts_with:{label:"\u05E7\u05DC\u05D8",gender:"m"},uppercase:{label:"\u05E7\u05DC\u05D8",gender:"m"}},c={nan:"NaN"};return l=>{switch(l.code){case"invalid_type":{let u=l.expected,d=c[u??""]??n(u),p=J(l.input),f=c[p]??t[p]?.label??p;return/^[A-Z]/.test(l.expected)?`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${l.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`:`\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${d}, \u05D4\u05EA\u05E7\u05D1\u05DC ${f}`}case"invalid_value":{if(l.values.length===1)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${W(l.values[0])}`;let u=l.values.map(f=>W(f));if(l.values.length===2)return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u[0]} \u05D0\u05D5 ${u[1]}`;let d=u[u.length-1];return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${u.slice(0,-1).join(", ")} \u05D0\u05D5 ${d}`}case"too_big":{let u=o(l.origin),d=i(l.origin??"value");if(l.origin==="string")return`${u?.longLabel??"\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.maximum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA":"\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim();if(l.origin==="number"){let h=l.inclusive?`\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.maximum}`:`\u05E7\u05D8\u05DF \u05DE-${l.maximum}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${h}`}if(l.origin==="array"||l.origin==="set"){let h=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA",m=l.inclusive?`${l.maximum} ${u?.unit??""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA`:`\u05E4\u05D7\u05D5\u05EA \u05DE-${l.maximum} ${u?.unit??""}`;return`\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${d} ${h} \u05DC\u05D4\u05DB\u05D9\u05DC ${m}`.trim()}let p=l.inclusive?"<=":"<",f=s(l.origin??"value");return u?.unit?`${u.longLabel} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.maximum.toString()} ${u.unit}`:`${u?.longLabel??"\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.maximum.toString()}`}case"too_small":{let u=o(l.origin),d=i(l.origin??"value");if(l.origin==="string")return`${u?.shortLabel??"\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${l.minimum.toString()} ${u?.unit??""} ${l.inclusive?"\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8":"\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim();if(l.origin==="number"){let h=l.inclusive?`\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${l.minimum}`:`\u05D2\u05D3\u05D5\u05DC \u05DE-${l.minimum}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${h}`}if(l.origin==="array"||l.origin==="set"){let h=l.origin==="set"?"\u05E6\u05E8\u05D9\u05DB\u05D4":"\u05E6\u05E8\u05D9\u05DA";if(l.minimum===1&&l.inclusive){let y=(l.origin==="set","\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3");return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${h} \u05DC\u05D4\u05DB\u05D9\u05DC ${y}`}let m=l.inclusive?`${l.minimum} ${u?.unit??""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8`:`\u05D9\u05D5\u05EA\u05E8 \u05DE-${l.minimum} ${u?.unit??""}`;return`\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${d} ${h} \u05DC\u05D4\u05DB\u05D9\u05DC ${m}`.trim()}let p=l.inclusive?">=":">",f=s(l.origin??"value");return u?.unit?`${u.shortLabel} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${d} ${f} ${p}${l.minimum.toString()}`}case"invalid_format":{let u=l;if(u.format==="starts_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${u.prefix}"`;if(u.format==="ends_with")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${u.suffix}"`;if(u.format==="includes")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${u.includes}"`;if(u.format==="regex")return`\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${u.pattern}`;let d=a[u.format],p=d?.label??u.format,h=(d?.gender??"m")==="f"?"\u05EA\u05E7\u05D9\u05E0\u05D4":"\u05EA\u05E7\u05D9\u05DF";return`${p} \u05DC\u05D0 ${h}`}case"not_multiple_of":return`\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${l.divisor}`;case"unrecognized_keys":return`\u05DE\u05E4\u05EA\u05D7${l.keys.length>1?"\u05D5\u05EA":""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${l.keys.length>1?"\u05D9\u05DD":"\u05D4"}: ${L(l.keys,", ")}`;case"invalid_key":return"\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8";case"invalid_union":return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF";case"invalid_element":return`\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${i(l.origin??"array")}`;default:return"\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"}}}});function tie(){return{localeError:MUe()}}var MUe,rie=S(()=>{_e();MUe=()=>{let t={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function e(i){return t[i]??null}let r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},n={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Neispravan unos: o\u010Dekuje se instanceof ${i.expected}, a primljeno je ${a}`:`Neispravan unos: o\u010Dekuje se ${s}, a primljeno je ${a}`}case"invalid_value":return i.values.length===1?`Neispravna vrijednost: o\u010Dekivano ${W(i.values[0])}`:`Neispravna opcija: o\u010Dekivano jedno od ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin),a=n[i.origin]??i.origin;return o?`Preveliko: o\u010Dekivano da ${a??"vrijednost"} ima ${s}${i.maximum.toString()} ${o.unit??"elemenata"}`:`Preveliko: o\u010Dekivano da ${a??"vrijednost"} bude ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin),a=n[i.origin]??i.origin;return o?`Premalo: o\u010Dekivano da ${a} ima ${s}${i.minimum.toString()} ${o.unit}`:`Premalo: o\u010Dekivano da ${a} bude ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Neispravan tekst: mora zapo\u010Dinjati s "${s.prefix}"`:s.format==="ends_with"?`Neispravan tekst: mora zavr\u0161avati s "${s.suffix}"`:s.format==="includes"?`Neispravan tekst: mora sadr\u017Eavati "${s.includes}"`:s.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${s.pattern}`:`Neispravna ${r[s.format]??i.format}`}case"not_multiple_of":return`Neispravan broj: mora biti vi\u0161ekratnik od ${i.divisor}`;case"unrecognized_keys":return`Neprepoznat${i.keys.length>1?"i klju\u010Devi":" klju\u010D"}: ${L(i.keys,", ")}`;case"invalid_key":return`Neispravan klju\u010D u ${n[i.origin]??i.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${n[i.origin]??i.origin}`;default:return"Neispravan unos"}}}});function nie(){return{localeError:FUe()}}var FUe,iie=S(()=>{_e();FUe=()=>{let t={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function e(i){return t[i]??null}let r={regex:"bemenet",email:"email c\xEDm",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO id\u0151b\xE9lyeg",date:"ISO d\xE1tum",time:"ISO id\u0151",duration:"ISO id\u0151intervallum",ipv4:"IPv4 c\xEDm",ipv6:"IPv6 c\xEDm",cidrv4:"IPv4 tartom\xE1ny",cidrv6:"IPv6 tartom\xE1ny",base64:"base64-k\xF3dolt string",base64url:"base64url-k\xF3dolt string",json_string:"JSON string",e164:"E.164 sz\xE1m",jwt:"JWT",template_literal:"bemenet"},n={nan:"NaN",number:"sz\xE1m",array:"t\xF6mb"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${i.expected}, a kapott \xE9rt\xE9k ${a}`:`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${s}, a kapott \xE9rt\xE9k ${a}`}case"invalid_value":return i.values.length===1?`\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${W(i.values[0])}`:`\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`T\xFAl nagy: ${i.origin??"\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${s}${i.maximum.toString()} ${o.unit??"elem"}`:`T\xFAl nagy: a bemeneti \xE9rt\xE9k ${i.origin??"\xE9rt\xE9k"} t\xFAl nagy: ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} m\xE9rete t\xFAl kicsi ${s}${i.minimum.toString()} ${o.unit}`:`T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${i.origin} t\xFAl kicsi ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\xC9rv\xE9nytelen string: "${s.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`:s.format==="ends_with"?`\xC9rv\xE9nytelen string: "${s.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`:s.format==="includes"?`\xC9rv\xE9nytelen string: "${s.includes}" \xE9rt\xE9ket kell tartalmaznia`:s.format==="regex"?`\xC9rv\xE9nytelen string: ${s.pattern} mint\xE1nak kell megfelelnie`:`\xC9rv\xE9nytelen ${r[s.format]??i.format}`}case"not_multiple_of":return`\xC9rv\xE9nytelen sz\xE1m: ${i.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`\xC9rv\xE9nytelen kulcs ${i.origin}`;case"invalid_union":return"\xC9rv\xE9nytelen bemenet";case"invalid_element":return`\xC9rv\xE9nytelen \xE9rt\xE9k: ${i.origin}`;default:return"\xC9rv\xE9nytelen bemenet"}}}});function sie(t,e,r){return Math.abs(t)===1?e:r}function mh(t){if(!t)return"";let e=["\u0561","\u0565","\u0568","\u056B","\u0578","\u0578\u0582","\u0585"],r=t[t.length-1];return t+(e.includes(r)?"\u0576":"\u0568")}function oie(){return{localeError:zUe()}}var zUe,aie=S(()=>{_e();zUe=()=>{let t={string:{unit:{one:"\u0576\u0577\u0561\u0576",many:"\u0576\u0577\u0561\u0576\u0576\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},file:{unit:{one:"\u0562\u0561\u0575\u0569",many:"\u0562\u0561\u0575\u0569\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},array:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"},set:{unit:{one:"\u057F\u0561\u0580\u0580",many:"\u057F\u0561\u0580\u0580\u0565\u0580"},verb:"\u0578\u0582\u0576\u0565\u0576\u0561\u056C"}};function e(i){return t[i]??null}let r={regex:"\u0574\u0578\u0582\u057F\u0584",email:"\u0567\u056C. \u0570\u0561\u057D\u0581\u0565",url:"URL",emoji:"\u0567\u0574\u0578\u057B\u056B",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574",date:"ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E",time:"ISO \u056A\u0561\u0574",duration:"ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576",ipv4:"IPv4 \u0570\u0561\u057D\u0581\u0565",ipv6:"IPv6 \u0570\u0561\u057D\u0581\u0565",cidrv4:"IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",cidrv6:"IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584",base64:"base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",base64url:"base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572",json_string:"JSON \u057F\u0578\u0572",e164:"E.164 \u0570\u0561\u0574\u0561\u0580",jwt:"JWT",template_literal:"\u0574\u0578\u0582\u057F\u0584"},n={nan:"NaN",number:"\u0569\u056B\u057E",array:"\u0566\u0561\u0576\u0563\u057E\u0561\u056E"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${i.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`:`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${s}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${a}`}case"invalid_value":return i.values.length===1?`\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${W(i.values[1])}`:`\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);if(o){let a=Number(i.maximum),c=sie(a,o.unit.one,o.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${mh(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${s}${i.maximum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${mh(i.origin??"\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);if(o){let a=Number(i.minimum),c=sie(a,o.unit.one,o.unit.many);return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${mh(i.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${s}${i.minimum.toString()} ${c}`}return`\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${mh(i.origin)} \u056C\u056B\u0576\u056B ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${s.prefix}"-\u0578\u057E`:s.format==="ends_with"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${s.suffix}"-\u0578\u057E`:s.format==="includes"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${s.includes}"`:s.format==="regex"?`\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${s.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`:`\u054D\u056D\u0561\u056C ${r[s.format]??i.format}`}case"not_multiple_of":return`\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${i.divisor}-\u056B`;case"unrecognized_keys":return`\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${i.keys.length>1?"\u0576\u0565\u0580":""}. ${L(i.keys,", ")}`;case"invalid_key":return`\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${mh(i.origin)}-\u0578\u0582\u0574`;case"invalid_union":return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574";case"invalid_element":return`\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${mh(i.origin)}-\u0578\u0582\u0574`;default:return"\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"}}}});function cie(){return{localeError:UUe()}}var UUe,lie=S(()=>{_e();UUe=()=>{let t={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function e(i){return t[i]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Input tidak valid: diharapkan instanceof ${i.expected}, diterima ${a}`:`Input tidak valid: diharapkan ${s}, diterima ${a}`}case"invalid_value":return i.values.length===1?`Input tidak valid: diharapkan ${W(i.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Terlalu besar: diharapkan ${i.origin??"value"} memiliki ${s}${i.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: diharapkan ${i.origin??"value"} menjadi ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Terlalu kecil: diharapkan ${i.origin} memiliki ${s}${i.minimum.toString()} ${o.unit}`:`Terlalu kecil: diharapkan ${i.origin} menjadi ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`String tidak valid: harus dimulai dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak valid: harus berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak valid: harus menyertakan "${s.includes}"`:s.format==="regex"?`String tidak valid: harus sesuai pola ${s.pattern}`:`${r[s.format]??i.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${i.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${i.origin}`;default:return"Input tidak valid"}}}});function uie(){return{localeError:BUe()}}var BUe,die=S(()=>{_e();BUe=()=>{let t={string:{unit:"stafi",verb:"a\xF0 hafa"},file:{unit:"b\xE6ti",verb:"a\xF0 hafa"},array:{unit:"hluti",verb:"a\xF0 hafa"},set:{unit:"hluti",verb:"a\xF0 hafa"}};function e(i){return t[i]??null}let r={regex:"gildi",email:"netfang",url:"vefsl\xF3\xF0",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og t\xEDmi",date:"ISO dagsetning",time:"ISO t\xEDmi",duration:"ISO t\xEDmalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 t\xF6lugildi",jwt:"JWT",template_literal:"gildi"},n={nan:"NaN",number:"n\xFAmer",array:"fylki"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera instanceof ${i.expected}`:`Rangt gildi: \xDE\xFA sl\xF3st inn ${a} \xFEar sem \xE1 a\xF0 vera ${s}`}case"invalid_value":return i.values.length===1?`Rangt gildi: gert r\xE1\xF0 fyrir ${W(i.values[0])}`:`\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} hafi ${s}${i.maximum.toString()} ${o.unit??"hluti"}`:`Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin??"gildi"} s\xE9 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} hafi ${s}${i.minimum.toString()} ${o.unit}`:`Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${i.origin} s\xE9 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${s.prefix}"`:s.format==="ends_with"?`\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${s.suffix}"`:s.format==="includes"?`\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${s.includes}"`:s.format==="regex"?`\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${s.pattern}`:`Rangt ${r[s.format]??i.format}`}case"not_multiple_of":return`R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${i.divisor}`;case"unrecognized_keys":return`\xD3\xFEekkt ${i.keys.length>1?"ir lyklar":"ur lykill"}: ${L(i.keys,", ")}`;case"invalid_key":return`Rangur lykill \xED ${i.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi \xED ${i.origin}`;default:return"Rangt gildi"}}}});function pie(){return{localeError:qUe()}}var qUe,fie=S(()=>{_e();qUe=()=>{let t={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function e(i){return t[i]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"numero",array:"vettore"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Input non valido: atteso instanceof ${i.expected}, ricevuto ${a}`:`Input non valido: atteso ${s}, ricevuto ${a}`}case"invalid_value":return i.values.length===1?`Input non valido: atteso ${W(i.values[0])}`:`Opzione non valida: atteso uno tra ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Troppo grande: ${i.origin??"valore"} deve avere ${s}${i.maximum.toString()} ${o.unit??"elementi"}`:`Troppo grande: ${i.origin??"valore"} deve essere ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Troppo piccolo: ${i.origin} deve avere ${s}${i.minimum.toString()} ${o.unit}`:`Troppo piccolo: ${i.origin} deve essere ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Stringa non valida: deve iniziare con "${s.prefix}"`:s.format==="ends_with"?`Stringa non valida: deve terminare con "${s.suffix}"`:s.format==="includes"?`Stringa non valida: deve includere "${s.includes}"`:s.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${s.pattern}`:`Input non valido: ${r[s.format]??i.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${i.divisor}`;case"unrecognized_keys":return`Chiav${i.keys.length>1?"i":"e"} non riconosciut${i.keys.length>1?"e":"a"}: ${L(i.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${i.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${i.origin}`;default:return"Input non valido"}}}});function hie(){return{localeError:VUe()}}var VUe,mie=S(()=>{_e();VUe=()=>{let t={string:{unit:"\u6587\u5B57",verb:"\u3067\u3042\u308B"},file:{unit:"\u30D0\u30A4\u30C8",verb:"\u3067\u3042\u308B"},array:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"},set:{unit:"\u8981\u7D20",verb:"\u3067\u3042\u308B"}};function e(i){return t[i]??null}let r={regex:"\u5165\u529B\u5024",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",url:"URL",emoji:"\u7D75\u6587\u5B57",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u6642",date:"ISO\u65E5\u4ED8",time:"ISO\u6642\u523B",duration:"ISO\u671F\u9593",ipv4:"IPv4\u30A2\u30C9\u30EC\u30B9",ipv6:"IPv6\u30A2\u30C9\u30EC\u30B9",cidrv4:"IPv4\u7BC4\u56F2",cidrv6:"IPv6\u7BC4\u56F2",base64:"base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",base64url:"base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217",json_string:"JSON\u6587\u5B57\u5217",e164:"E.164\u756A\u53F7",jwt:"JWT",template_literal:"\u5165\u529B\u5024"},n={nan:"NaN",number:"\u6570\u5024",array:"\u914D\u5217"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u7121\u52B9\u306A\u5165\u529B: instanceof ${i.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u5165\u529B: ${s}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${a}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`}case"invalid_value":return i.values.length===1?`\u7121\u52B9\u306A\u5165\u529B: ${W(i.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`:`\u7121\u52B9\u306A\u9078\u629E: ${L(i.values,"\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"too_big":{let s=i.inclusive?"\u4EE5\u4E0B\u3067\u3042\u308B":"\u3088\u308A\u5C0F\u3055\u3044",o=e(i.origin);return o?`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${o.unit??"\u8981\u7D20"}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5927\u304D\u3059\u304E\u308B\u5024: ${i.origin??"\u5024"}\u306F${i.maximum.toString()}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"too_small":{let s=i.inclusive?"\u4EE5\u4E0A\u3067\u3042\u308B":"\u3088\u308A\u5927\u304D\u3044",o=e(i.origin);return o?`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${o.unit}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u5C0F\u3055\u3059\u304E\u308B\u5024: ${i.origin}\u306F${i.minimum.toString()}${s}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="ends_with"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="includes"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: "${s.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:s.format==="regex"?`\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${s.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`:`\u7121\u52B9\u306A${r[s.format]??i.format}`}case"not_multiple_of":return`\u7121\u52B9\u306A\u6570\u5024: ${i.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`;case"unrecognized_keys":return`\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${i.keys.length>1?"\u7FA4":""}: ${L(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`;case"invalid_union":return"\u7121\u52B9\u306A\u5165\u529B";case"invalid_element":return`${i.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`;default:return"\u7121\u52B9\u306A\u5165\u529B"}}}});function gie(){return{localeError:GUe()}}var GUe,yie=S(()=>{_e();GUe=()=>{let t={string:{unit:"\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},file:{unit:"\u10D1\u10D0\u10D8\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},array:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"},set:{unit:"\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8",verb:"\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1"}};function e(i){return t[i]??null}let r={regex:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0",email:"\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",url:"URL",emoji:"\u10D4\u10DB\u10DD\u10EF\u10D8",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD",date:"\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8",time:"\u10D3\u10E0\u10DD",duration:"\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0",ipv4:"IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",ipv6:"IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8",cidrv4:"IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",cidrv6:"IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8",base64:"base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",base64url:"base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8",json_string:"JSON \u10D5\u10D4\u10DA\u10D8",e164:"E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8",jwt:"JWT",template_literal:"\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"},n={nan:"NaN",number:"\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8",string:"\u10D5\u10D4\u10DA\u10D8",boolean:"\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8",function:"\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0",array:"\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${i.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${s}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${a}`}case"invalid_value":return i.values.length===1?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${W(i.values[0])}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${L(i.values,"|")}-\u10D3\u10D0\u10DC`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin??"\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${i.origin} \u10D8\u10E7\u10DD\u10E1 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${s.prefix}"-\u10D8\u10D7`:s.format==="ends_with"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${s.suffix}"-\u10D8\u10D7`:s.format==="includes"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${s.includes}"-\u10E1`:s.format==="regex"?`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${s.pattern}`:`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${r[s.format]??i.format}`}case"not_multiple_of":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${i.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`;case"unrecognized_keys":return`\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${i.keys.length>1?"\u10D4\u10D1\u10D8":"\u10D8"}: ${L(i.keys,", ")}`;case"invalid_key":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${i.origin}-\u10E8\u10D8`;case"invalid_union":return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0";case"invalid_element":return`\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${i.origin}-\u10E8\u10D8`;default:return"\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"}}}});function s$(){return{localeError:HUe()}}var HUe,vz=S(()=>{_e();HUe=()=>{let t={string:{unit:"\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},file:{unit:"\u1794\u17C3",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},array:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"},set:{unit:"\u1792\u17B6\u178F\u17BB",verb:"\u1782\u17BD\u179A\u1798\u17B6\u1793"}};function e(i){return t[i]??null}let r={regex:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B",email:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B",url:"URL",emoji:"\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO",date:"\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO",time:"\u1798\u17C9\u17C4\u1784 ISO",duration:"\u179A\u1799\u17C8\u1796\u17C1\u179B ISO",ipv4:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",ipv6:"\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",cidrv4:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4",cidrv6:"\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6",base64:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64",base64url:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url",json_string:"\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON",e164:"\u179B\u17C1\u1781 E.164",jwt:"JWT",template_literal:"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B"},n={nan:"NaN",number:"\u179B\u17C1\u1781",array:"\u17A2\u17B6\u179A\u17C1 (Array)",null:"\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${i.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`:`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${s} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${a}`}case"invalid_value":return i.values.length===1?`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${W(i.values[0])}`:`\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${s} ${i.maximum.toString()} ${o.unit??"\u1792\u17B6\u178F\u17BB"}`:`\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin??"\u178F\u1798\u17D2\u179B\u17C3"} ${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${s} ${i.minimum.toString()} ${o.unit}`:`\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${i.origin} ${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${s.prefix}"`:s.format==="ends_with"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${s.suffix}"`:s.format==="includes"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${s.includes}"`:s.format==="regex"?`\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${s.pattern}`:`\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${r[s.format]??i.format}`}case"not_multiple_of":return`\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${i.divisor}`;case"unrecognized_keys":return`\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${L(i.keys,", ")}`;case"invalid_key":return`\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;case"invalid_union":return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C";case"invalid_element":return`\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${i.origin}`;default:return"\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C"}}}});function bie(){return s$()}var vie=S(()=>{vz()});function _ie(){return{localeError:WUe()}}var WUe,Sie=S(()=>{_e();WUe=()=>{let t={string:{unit:"\uBB38\uC790",verb:"to have"},file:{unit:"\uBC14\uC774\uD2B8",verb:"to have"},array:{unit:"\uAC1C",verb:"to have"},set:{unit:"\uAC1C",verb:"to have"}};function e(i){return t[i]??null}let r={regex:"\uC785\uB825",email:"\uC774\uBA54\uC77C \uC8FC\uC18C",url:"URL",emoji:"\uC774\uBAA8\uC9C0",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \uB0A0\uC9DC\uC2DC\uAC04",date:"ISO \uB0A0\uC9DC",time:"ISO \uC2DC\uAC04",duration:"ISO \uAE30\uAC04",ipv4:"IPv4 \uC8FC\uC18C",ipv6:"IPv6 \uC8FC\uC18C",cidrv4:"IPv4 \uBC94\uC704",cidrv6:"IPv6 \uBC94\uC704",base64:"base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",base64url:"base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4",json_string:"JSON \uBB38\uC790\uC5F4",e164:"E.164 \uBC88\uD638",jwt:"JWT",template_literal:"\uC785\uB825"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${i.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${s}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${a}\uC785\uB2C8\uB2E4`}case"invalid_value":return i.values.length===1?`\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${W(i.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C \uC635\uC158: ${L(i.values,"\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"too_big":{let s=i.inclusive?"\uC774\uD558":"\uBBF8\uB9CC",o=s==="\uBBF8\uB9CC"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(i.origin),c=a?.unit??"\uC694\uC18C";return a?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()}${c} ${s}${o}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${i.maximum.toString()} ${s}${o}`}case"too_small":{let s=i.inclusive?"\uC774\uC0C1":"\uCD08\uACFC",o=s==="\uC774\uC0C1"?"\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4":"\uC5EC\uC57C \uD569\uB2C8\uB2E4",a=e(i.origin),c=a?.unit??"\uC694\uC18C";return a?`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()}${c} ${s}${o}`:`${i.origin??"\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${i.minimum.toString()} ${s}${o}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`:s.format==="ends_with"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`:s.format==="includes"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${s.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`:s.format==="regex"?`\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${s.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`:`\uC798\uBABB\uB41C ${r[s.format]??i.format}`}case"not_multiple_of":return`\uC798\uBABB\uB41C \uC22B\uC790: ${i.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`;case"unrecognized_keys":return`\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${L(i.keys,", ")}`;case"invalid_key":return`\uC798\uBABB\uB41C \uD0A4: ${i.origin}`;case"invalid_union":return"\uC798\uBABB\uB41C \uC785\uB825";case"invalid_element":return`\uC798\uBABB\uB41C \uAC12: ${i.origin}`;default:return"\uC798\uBABB\uB41C \uC785\uB825"}}}});function wie(t){let e=Math.abs(t),r=e%10,n=e%100;return n>=11&&n<=19||r===0?"many":r===1?"one":"few"}function xie(){return{localeError:ZUe()}}var yv,ZUe,kie=S(()=>{_e();yv=t=>t.charAt(0).toUpperCase()+t.slice(1);ZUe=()=>{let t={string:{unit:{one:"simbolis",few:"simboliai",many:"simboli\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne ilgesn\u0117 kaip",notInclusive:"turi b\u016Bti trumpesn\u0117 kaip"},bigger:{inclusive:"turi b\u016Bti ne trumpesn\u0117 kaip",notInclusive:"turi b\u016Bti ilgesn\u0117 kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"bait\u0173"},verb:{smaller:{inclusive:"turi b\u016Bti ne didesnis kaip",notInclusive:"turi b\u016Bti ma\u017Eesnis kaip"},bigger:{inclusive:"turi b\u016Bti ne ma\u017Eesnis kaip",notInclusive:"turi b\u016Bti didesnis kaip"}}},array:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}},set:{unit:{one:"element\u0105",few:"elementus",many:"element\u0173"},verb:{smaller:{inclusive:"turi tur\u0117ti ne daugiau kaip",notInclusive:"turi tur\u0117ti ma\u017Eiau kaip"},bigger:{inclusive:"turi tur\u0117ti ne ma\u017Eiau kaip",notInclusive:"turi tur\u0117ti daugiau kaip"}}}};function e(i,s,o,a){let c=t[i]??null;return c===null?c:{unit:c.unit[s],verb:c.verb[a][o?"inclusive":"notInclusive"]}}let r={regex:"\u012Fvestis",email:"el. pa\u0161to adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukm\u0117",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 u\u017Ekoduota eilut\u0117",base64url:"base64url u\u017Ekoduota eilut\u0117",json_string:"JSON eilut\u0117",e164:"E.164 numeris",jwt:"JWT",template_literal:"\u012Fvestis"},n={nan:"NaN",number:"skai\u010Dius",bigint:"sveikasis skai\u010Dius",string:"eilut\u0117",boolean:"login\u0117 reik\u0161m\u0117",undefined:"neapibr\u0117\u017Eta reik\u0161m\u0117",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulin\u0117 reik\u0161m\u0117"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Gautas tipas ${a}, o tik\u0117tasi - instanceof ${i.expected}`:`Gautas tipas ${a}, o tik\u0117tasi - ${s}`}case"invalid_value":return i.values.length===1?`Privalo b\u016Bti ${W(i.values[0])}`:`Privalo b\u016Bti vienas i\u0161 ${L(i.values,"|")} pasirinkim\u0173`;case"too_big":{let s=n[i.origin]??i.origin,o=e(i.origin,wie(Number(i.maximum)),i.inclusive??!1,"smaller");if(o?.verb)return`${yv(s??i.origin??"reik\u0161m\u0117")} ${o.verb} ${i.maximum.toString()} ${o.unit??"element\u0173"}`;let a=i.inclusive?"ne didesnis kaip":"ma\u017Eesnis kaip";return`${yv(s??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${i.maximum.toString()} ${o?.unit}`}case"too_small":{let s=n[i.origin]??i.origin,o=e(i.origin,wie(Number(i.minimum)),i.inclusive??!1,"bigger");if(o?.verb)return`${yv(s??i.origin??"reik\u0161m\u0117")} ${o.verb} ${i.minimum.toString()} ${o.unit??"element\u0173"}`;let a=i.inclusive?"ne ma\u017Eesnis kaip":"didesnis kaip";return`${yv(s??i.origin??"reik\u0161m\u0117")} turi b\u016Bti ${a} ${i.minimum.toString()} ${o?.unit}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Eilut\u0117 privalo prasid\u0117ti "${s.prefix}"`:s.format==="ends_with"?`Eilut\u0117 privalo pasibaigti "${s.suffix}"`:s.format==="includes"?`Eilut\u0117 privalo \u012Ftraukti "${s.includes}"`:s.format==="regex"?`Eilut\u0117 privalo atitikti ${s.pattern}`:`Neteisingas ${r[s.format]??i.format}`}case"not_multiple_of":return`Skai\u010Dius privalo b\u016Bti ${i.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpa\u017Eint${i.keys.length>1?"i":"as"} rakt${i.keys.length>1?"ai":"as"}: ${L(i.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga \u012Fvestis";case"invalid_element":{let s=n[i.origin]??i.origin;return`${yv(s??i.origin??"reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`}default:return"Klaidinga \u012Fvestis"}}}});function Eie(){return{localeError:JUe()}}var JUe,Aie=S(()=>{_e();JUe=()=>{let t={string:{unit:"\u0437\u043D\u0430\u0446\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},file:{unit:"\u0431\u0430\u0458\u0442\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},array:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"},set:{unit:"\u0441\u0442\u0430\u0432\u043A\u0438",verb:"\u0434\u0430 \u0438\u043C\u0430\u0430\u0442"}};function e(i){return t[i]??null}let r={regex:"\u0432\u043D\u0435\u0441",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430",url:"URL",emoji:"\u0435\u043C\u043E\u045F\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435",date:"ISO \u0434\u0430\u0442\u0443\u043C",time:"ISO \u0432\u0440\u0435\u043C\u0435",duration:"ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441\u0430",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441\u0430",cidrv4:"IPv4 \u043E\u043F\u0441\u0435\u0433",cidrv6:"IPv6 \u043E\u043F\u0441\u0435\u0433",base64:"base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",base64url:"base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430",json_string:"JSON \u043D\u0438\u0437\u0430",e164:"E.164 \u0431\u0440\u043E\u0458",jwt:"JWT",template_literal:"\u0432\u043D\u0435\u0441"},n={nan:"NaN",number:"\u0431\u0440\u043E\u0458",array:"\u043D\u0438\u0437\u0430"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${i.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`:`\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${s}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${W(i.values[0])}`:`\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${s}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin??"\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0438\u043C\u0430 ${s}${i.minimum.toString()} ${o.unit}`:`\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${i.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438":"\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${L(i.keys,", ")}`;case"invalid_key":return`\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${i.origin}`;case"invalid_union":return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441";case"invalid_element":return`\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${i.origin}`;default:return"\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"}}}});function $ie(){return{localeError:KUe()}}var KUe,Iie=S(()=>{_e();KUe=()=>{let t={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function e(i){return t[i]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"nombor"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Input tidak sah: dijangka instanceof ${i.expected}, diterima ${a}`:`Input tidak sah: dijangka ${s}, diterima ${a}`}case"invalid_value":return i.values.length===1?`Input tidak sah: dijangka ${W(i.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Terlalu besar: dijangka ${i.origin??"nilai"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"elemen"}`:`Terlalu besar: dijangka ${i.origin??"nilai"} adalah ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Terlalu kecil: dijangka ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`Terlalu kecil: dijangka ${i.origin} adalah ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`String tidak sah: mesti bermula dengan "${s.prefix}"`:s.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${s.suffix}"`:s.format==="includes"?`String tidak sah: mesti mengandungi "${s.includes}"`:s.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${s.pattern}`:`${r[s.format]??i.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${i.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${L(i.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${i.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${i.origin}`;default:return"Input tidak sah"}}}});function Pie(){return{localeError:YUe()}}var YUe,Rie=S(()=>{_e();YUe=()=>{let t={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function e(i){return t[i]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},n={nan:"NaN",number:"getal"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ongeldige invoer: verwacht instanceof ${i.expected}, ontving ${a}`:`Ongeldige invoer: verwacht ${s}, ontving ${a}`}case"invalid_value":return i.values.length===1?`Ongeldige invoer: verwacht ${W(i.values[0])}`:`Ongeldige optie: verwacht \xE9\xE9n van ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin),a=i.origin==="date"?"laat":i.origin==="string"?"lang":"groot";return o?`Te ${a}: verwacht dat ${i.origin??"waarde"} ${s}${i.maximum.toString()} ${o.unit??"elementen"} ${o.verb}`:`Te ${a}: verwacht dat ${i.origin??"waarde"} ${s}${i.maximum.toString()} is`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin),a=i.origin==="date"?"vroeg":i.origin==="string"?"kort":"klein";return o?`Te ${a}: verwacht dat ${i.origin} ${s}${i.minimum.toString()} ${o.unit} ${o.verb}`:`Te ${a}: verwacht dat ${i.origin} ${s}${i.minimum.toString()} is`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ongeldige tekst: moet met "${s.prefix}" beginnen`:s.format==="ends_with"?`Ongeldige tekst: moet op "${s.suffix}" eindigen`:s.format==="includes"?`Ongeldige tekst: moet "${s.includes}" bevatten`:s.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${s.pattern}`:`Ongeldig: ${r[s.format]??i.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${i.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${i.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${i.origin}`;default:return"Ongeldige invoer"}}}});function Cie(){return{localeError:XUe()}}var XUe,Tie=S(()=>{_e();XUe=()=>{let t={string:{unit:"tegn",verb:"\xE5 ha"},file:{unit:"bytes",verb:"\xE5 ha"},array:{unit:"elementer",verb:"\xE5 inneholde"},set:{unit:"elementer",verb:"\xE5 inneholde"}};function e(i){return t[i]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-omr\xE5de",ipv6:"IPv6-omr\xE5de",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"tall",array:"liste"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ugyldig input: forventet instanceof ${i.expected}, fikk ${a}`:`Ugyldig input: forventet ${s}, fikk ${a}`}case"invalid_value":return i.values.length===1?`Ugyldig verdi: forventet ${W(i.values[0])}`:`Ugyldig valg: forventet en av ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${s}${i.maximum.toString()} ${o.unit??"elementer"}`:`For stor(t): forventet ${i.origin??"value"} til \xE5 ha ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`For lite(n): forventet ${i.origin} til \xE5 ha ${s}${i.minimum.toString()} ${o.unit}`:`For lite(n): forventet ${i.origin} til \xE5 ha ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ugyldig streng: m\xE5 starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: m\xE5 ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: m\xE5 inneholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: m\xE5 matche m\xF8nsteret ${s.pattern}`:`Ugyldig ${r[s.format]??i.format}`}case"not_multiple_of":return`Ugyldig tall: m\xE5 v\xE6re et multiplum av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukjente n\xF8kler":"Ukjent n\xF8kkel"}: ${L(i.keys,", ")}`;case"invalid_key":return`Ugyldig n\xF8kkel i ${i.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${i.origin}`;default:return"Ugyldig input"}}}});function Oie(){return{localeError:QUe()}}var QUe,Nie=S(()=>{_e();QUe=()=>{let t={string:{unit:"harf",verb:"olmal\u0131d\u0131r"},file:{unit:"bayt",verb:"olmal\u0131d\u0131r"},array:{unit:"unsur",verb:"olmal\u0131d\u0131r"},set:{unit:"unsur",verb:"olmal\u0131d\u0131r"}};function e(i){return t[i]??null}let r={regex:"giren",email:"epostag\xE2h",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO heng\xE2m\u0131",date:"ISO tarihi",time:"ISO zaman\u0131",duration:"ISO m\xFCddeti",ipv4:"IPv4 ni\u015F\xE2n\u0131",ipv6:"IPv6 ni\u015F\xE2n\u0131",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-\u015Fifreli metin",base64url:"base64url-\u015Fifreli metin",json_string:"JSON metin",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"giren"},n={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`F\xE2sit giren: umulan instanceof ${i.expected}, al\u0131nan ${a}`:`F\xE2sit giren: umulan ${s}, al\u0131nan ${a}`}case"invalid_value":return i.values.length===1?`F\xE2sit giren: umulan ${W(i.values[0])}`:`F\xE2sit tercih: m\xFBteberler ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${s}${i.maximum.toString()} ${o.unit??"elements"} sahip olmal\u0131yd\u0131.`:`Fazla b\xFCy\xFCk: ${i.origin??"value"}, ${s}${i.maximum.toString()} olmal\u0131yd\u0131.`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${s}${i.minimum.toString()} ${o.unit} sahip olmal\u0131yd\u0131.`:`Fazla k\xFC\xE7\xFCk: ${i.origin}, ${s}${i.minimum.toString()} olmal\u0131yd\u0131.`}case"invalid_format":{let s=i;return s.format==="starts_with"?`F\xE2sit metin: "${s.prefix}" ile ba\u015Flamal\u0131.`:s.format==="ends_with"?`F\xE2sit metin: "${s.suffix}" ile bitmeli.`:s.format==="includes"?`F\xE2sit metin: "${s.includes}" ihtiv\xE2 etmeli.`:s.format==="regex"?`F\xE2sit metin: ${s.pattern} nak\u015F\u0131na uymal\u0131.`:`F\xE2sit ${r[s.format]??i.format}`}case"not_multiple_of":return`F\xE2sit say\u0131: ${i.divisor} kat\u0131 olmal\u0131yd\u0131.`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar ${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7in tan\u0131nmayan anahtar var.`;case"invalid_union":return"Giren tan\u0131namad\u0131.";case"invalid_element":return`${i.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`;default:return"K\u0131ymet tan\u0131namad\u0131."}}}});function Die(){return{localeError:e4e()}}var e4e,jie=S(()=>{_e();e4e=()=>{let t={string:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},file:{unit:"\u0628\u0627\u06CC\u067C\u0633",verb:"\u0648\u0644\u0631\u064A"},array:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"},set:{unit:"\u062A\u0648\u06A9\u064A",verb:"\u0648\u0644\u0631\u064A"}};function e(i){return t[i]??null}let r={regex:"\u0648\u0631\u0648\u062F\u064A",email:"\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9",url:"\u06CC\u0648 \u0622\u0631 \u0627\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u064A",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A",date:"\u0646\u06D0\u067C\u0647",time:"\u0648\u062E\u062A",duration:"\u0645\u0648\u062F\u0647",ipv4:"\u062F IPv4 \u067E\u062A\u0647",ipv6:"\u062F IPv6 \u067E\u062A\u0647",cidrv4:"\u062F IPv4 \u0633\u0627\u062D\u0647",cidrv6:"\u062F IPv6 \u0633\u0627\u062D\u0647",base64:"base64-encoded \u0645\u062A\u0646",base64url:"base64url-encoded \u0645\u062A\u0646",json_string:"JSON \u0645\u062A\u0646",e164:"\u062F E.164 \u0634\u0645\u06D0\u0631\u0647",jwt:"JWT",template_literal:"\u0648\u0631\u0648\u062F\u064A"},n={nan:"NaN",number:"\u0639\u062F\u062F",array:"\u0627\u0631\u06D0"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${i.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`:`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${s} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${a} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`}case"invalid_value":return i.values.length===1?`\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${W(i.values[0])} \u0648\u0627\u06CC`:`\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${L(i.values,"|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${s}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${i.origin??"\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${s}${i.maximum.toString()} \u0648\u064A`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${s}${i.minimum.toString()} ${o.unit} \u0648\u0644\u0631\u064A`:`\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${i.origin} \u0628\u0627\u06CC\u062F ${s}${i.minimum.toString()} \u0648\u064A`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${s.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`:s.format==="ends_with"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${s.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`:s.format==="includes"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${s.includes}" \u0648\u0644\u0631\u064A`:s.format==="regex"?`\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${s.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`:`${r[s.format]??i.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`}case"not_multiple_of":return`\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${i.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`;case"unrecognized_keys":return`\u0646\u0627\u0633\u0645 ${i.keys.length>1?"\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647":"\u06A9\u0644\u06CC\u0689"}: ${L(i.keys,", ")}`;case"invalid_key":return`\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${i.origin} \u06A9\u06D0`;case"invalid_union":return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A";case"invalid_element":return`\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${i.origin} \u06A9\u06D0`;default:return"\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A"}}}});function Lie(){return{localeError:t4e()}}var t4e,Mie=S(()=>{_e();t4e=()=>{let t={string:{unit:"znak\xF3w",verb:"mie\u0107"},file:{unit:"bajt\xF3w",verb:"mie\u0107"},array:{unit:"element\xF3w",verb:"mie\u0107"},set:{unit:"element\xF3w",verb:"mie\u0107"}};function e(i){return t[i]??null}let r={regex:"wyra\u017Cenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ci\u0105g znak\xF3w zakodowany w formacie base64",base64url:"ci\u0105g znak\xF3w zakodowany w formacie base64url",json_string:"ci\u0105g znak\xF3w w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wej\u015Bcie"},n={nan:"NaN",number:"liczba",array:"tablica"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${i.expected}, otrzymano ${a}`:`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${s}, otrzymano ${a}`}case"invalid_value":return i.values.length===1?`Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${W(i.values[0])}`:`Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${s}${i.maximum.toString()} ${o.unit??"element\xF3w"}`:`Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie mie\u0107 ${s}${i.minimum.toString()} ${o.unit??"element\xF3w"}`:`Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${i.origin??"warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${s.prefix}"`:s.format==="ends_with"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${s.suffix}"`:s.format==="includes"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${s.includes}"`:s.format==="regex"?`Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${s.pattern}`:`Nieprawid\u0142ow(y/a/e) ${r[s.format]??i.format}`}case"not_multiple_of":return`Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${i.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`Nieprawid\u0142owy klucz w ${i.origin}`;case"invalid_union":return"Nieprawid\u0142owe dane wej\u015Bciowe";case"invalid_element":return`Nieprawid\u0142owa warto\u015B\u0107 w ${i.origin}`;default:return"Nieprawid\u0142owe dane wej\u015Bciowe"}}}});function Fie(){return{localeError:r4e()}}var r4e,zie=S(()=>{_e();r4e=()=>{let t={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function e(i){return t[i]??null}let r={regex:"padr\xE3o",email:"endere\xE7o de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"dura\xE7\xE3o ISO",ipv4:"endere\xE7o IPv4",ipv6:"endere\xE7o IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"n\xFAmero E.164",jwt:"JWT",template_literal:"entrada"},n={nan:"NaN",number:"n\xFAmero",null:"nulo"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Tipo inv\xE1lido: esperado instanceof ${i.expected}, recebido ${a}`:`Tipo inv\xE1lido: esperado ${s}, recebido ${a}`}case"invalid_value":return i.values.length===1?`Entrada inv\xE1lida: esperado ${W(i.values[0])}`:`Op\xE7\xE3o inv\xE1lida: esperada uma das ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Muito grande: esperado que ${i.origin??"valor"} tivesse ${s}${i.maximum.toString()} ${o.unit??"elementos"}`:`Muito grande: esperado que ${i.origin??"valor"} fosse ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Muito pequeno: esperado que ${i.origin} tivesse ${s}${i.minimum.toString()} ${o.unit}`:`Muito pequeno: esperado que ${i.origin} fosse ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Texto inv\xE1lido: deve come\xE7ar com "${s.prefix}"`:s.format==="ends_with"?`Texto inv\xE1lido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inv\xE1lido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inv\xE1lido: deve corresponder ao padr\xE3o ${s.pattern}`:`${r[s.format]??i.format} inv\xE1lido`}case"not_multiple_of":return`N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${i.divisor}`;case"unrecognized_keys":return`Chave${i.keys.length>1?"s":""} desconhecida${i.keys.length>1?"s":""}: ${L(i.keys,", ")}`;case"invalid_key":return`Chave inv\xE1lida em ${i.origin}`;case"invalid_union":return"Entrada inv\xE1lida";case"invalid_element":return`Valor inv\xE1lido em ${i.origin}`;default:return"Campo inv\xE1lido"}}}});function Uie(){return{localeError:n4e()}}var n4e,Bie=S(()=>{_e();n4e=()=>{let t={string:{unit:"caractere",verb:"s\u0103 aib\u0103"},file:{unit:"octe\u021Bi",verb:"s\u0103 aib\u0103"},array:{unit:"elemente",verb:"s\u0103 aib\u0103"},set:{unit:"elemente",verb:"s\u0103 aib\u0103"},map:{unit:"intr\u0103ri",verb:"s\u0103 aib\u0103"}};function e(i){return t[i]??null}let r={regex:"intrare",email:"adres\u0103 de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dat\u0103 \u0219i or\u0103 ISO",date:"dat\u0103 ISO",time:"or\u0103 ISO",duration:"durat\u0103 ISO",ipv4:"adres\u0103 IPv4",ipv6:"adres\u0103 IPv6",mac:"adres\u0103 MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"\u0219ir codat base64",base64url:"\u0219ir codat base64url",json_string:"\u0219ir JSON",e164:"num\u0103r E.164",jwt:"JWT",template_literal:"intrare"},n={nan:"NaN",string:"\u0219ir",number:"num\u0103r",boolean:"boolean",function:"func\u021Bie",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"num\u0103r mare",void:"void",never:"never",map:"hart\u0103",set:"set"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return`Intrare invalid\u0103: a\u0219teptat ${s}, primit ${a}`}case"invalid_value":return i.values.length===1?`Intrare invalid\u0103: a\u0219teptat ${W(i.values[0])}`:`Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Prea mare: a\u0219teptat ca ${i.origin??"valoarea"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"elemente"}`:`Prea mare: a\u0219teptat ca ${i.origin??"valoarea"} s\u0103 fie ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Prea mic: a\u0219teptat ca ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`Prea mic: a\u0219teptat ca ${i.origin} s\u0103 fie ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${s.prefix}"`:s.format==="ends_with"?`\u0218ir invalid: trebuie s\u0103 se termine cu "${s.suffix}"`:s.format==="includes"?`\u0218ir invalid: trebuie s\u0103 includ\u0103 "${s.includes}"`:s.format==="regex"?`\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${s.pattern}`:`Format invalid: ${r[s.format]??i.format}`}case"not_multiple_of":return`Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${i.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${L(i.keys,", ")}`;case"invalid_key":return`Cheie invalid\u0103 \xEEn ${i.origin}`;case"invalid_union":return"Intrare invalid\u0103";case"invalid_element":return`Valoare invalid\u0103 \xEEn ${i.origin}`;default:return"Intrare invalid\u0103"}}}});function qie(t,e,r,n){let i=Math.abs(t),s=i%10,o=i%100;return o>=11&&o<=19?n:s===1?e:s>=2&&s<=4?r:n}function Vie(){return{localeError:i4e()}}var i4e,Gie=S(()=>{_e();i4e=()=>{let t={string:{unit:{one:"\u0441\u0438\u043C\u0432\u043E\u043B",few:"\u0441\u0438\u043C\u0432\u043E\u043B\u0430",many:"\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},file:{unit:{one:"\u0431\u0430\u0439\u0442",few:"\u0431\u0430\u0439\u0442\u0430",many:"\u0431\u0430\u0439\u0442"},verb:"\u0438\u043C\u0435\u0442\u044C"},array:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"},set:{unit:{one:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442",few:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430",many:"\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432"},verb:"\u0438\u043C\u0435\u0442\u044C"}};function e(i){return t[i]??null}let r={regex:"\u0432\u0432\u043E\u0434",email:"email \u0430\u0434\u0440\u0435\u0441",url:"URL",emoji:"\u044D\u043C\u043E\u0434\u0437\u0438",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F",date:"ISO \u0434\u0430\u0442\u0430",time:"ISO \u0432\u0440\u0435\u043C\u044F",duration:"ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C",ipv4:"IPv4 \u0430\u0434\u0440\u0435\u0441",ipv6:"IPv6 \u0430\u0434\u0440\u0435\u0441",cidrv4:"IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",cidrv6:"IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D",base64:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64",base64url:"\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url",json_string:"JSON \u0441\u0442\u0440\u043E\u043A\u0430",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0432\u043E\u0434"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${i.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${s}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${W(i.values[0])}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);if(o){let a=Number(i.maximum),c=qie(a,o.unit.one,o.unit.few,o.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${s}${i.maximum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);if(o){let a=Number(i.minimum),c=qie(a,o.unit.one,o.unit.few,o.unit.many);return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${s}${i.minimum.toString()} ${c}`}return`\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${i.origin} \u0431\u0443\u0434\u0435\u0442 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${r[s.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${i.keys.length>1?"\u044B\u0435":"\u044B\u0439"} \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0438":""}: ${L(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435";case"invalid_element":return`\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${i.origin}`;default:return"\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"}}}});function Hie(){return{localeError:s4e()}}var s4e,Wie=S(()=>{_e();s4e=()=>{let t={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function e(i){return t[i]??null}let r={regex:"vnos",email:"e-po\u0161tni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in \u010Das",date:"ISO datum",time:"ISO \u010Das",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 \u0161tevilka",jwt:"JWT",template_literal:"vnos"},n={nan:"NaN",number:"\u0161tevilo",array:"tabela"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Neveljaven vnos: pri\u010Dakovano instanceof ${i.expected}, prejeto ${a}`:`Neveljaven vnos: pri\u010Dakovano ${s}, prejeto ${a}`}case"invalid_value":return i.values.length===1?`Neveljaven vnos: pri\u010Dakovano ${W(i.values[0])}`:`Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} imelo ${s}${i.maximum.toString()} ${o.unit??"elementov"}`:`Preveliko: pri\u010Dakovano, da bo ${i.origin??"vrednost"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Premajhno: pri\u010Dakovano, da bo ${i.origin} imelo ${s}${i.minimum.toString()} ${o.unit}`:`Premajhno: pri\u010Dakovano, da bo ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Neveljaven niz: mora se za\u010Deti z "${s.prefix}"`:s.format==="ends_with"?`Neveljaven niz: mora se kon\u010Dati z "${s.suffix}"`:s.format==="includes"?`Neveljaven niz: mora vsebovati "${s.includes}"`:s.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${s.pattern}`:`Neveljaven ${r[s.format]??i.format}`}case"not_multiple_of":return`Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${i.divisor}`;case"unrecognized_keys":return`Neprepoznan${i.keys.length>1?"i klju\u010Di":" klju\u010D"}: ${L(i.keys,", ")}`;case"invalid_key":return`Neveljaven klju\u010D v ${i.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${i.origin}`;default:return"Neveljaven vnos"}}}});function Zie(){return{localeError:o4e()}}var o4e,Jie=S(()=>{_e();o4e=()=>{let t={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att inneh\xE5lla"},set:{unit:"objekt",verb:"att inneh\xE5lla"}};function e(i){return t[i]??null}let r={regex:"regulj\xE4rt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad str\xE4ng",base64url:"base64url-kodad str\xE4ng",json_string:"JSON-str\xE4ng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},n={nan:"NaN",number:"antal",array:"lista"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${i.expected}, fick ${a}`:`Ogiltig inmatning: f\xF6rv\xE4ntat ${s}, fick ${a}`}case"invalid_value":return i.values.length===1?`Ogiltig inmatning: f\xF6rv\xE4ntat ${W(i.values[0])}`:`Ogiltigt val: f\xF6rv\xE4ntade en av ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`F\xF6r stor(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${s}${i.maximum.toString()} ${o.unit??"element"}`:`F\xF6r stor(t): f\xF6rv\xE4ntat ${i.origin??"v\xE4rdet"} att ha ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${s}${i.minimum.toString()} ${o.unit}`:`F\xF6r lite(t): f\xF6rv\xE4ntade ${i.origin??"v\xE4rdet"} att ha ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${s.prefix}"`:s.format==="ends_with"?`Ogiltig str\xE4ng: m\xE5ste sluta med "${s.suffix}"`:s.format==="includes"?`Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${s.includes}"`:s.format==="regex"?`Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${s.pattern}"`:`Ogiltig(t) ${r[s.format]??i.format}`}case"not_multiple_of":return`Ogiltigt tal: m\xE5ste vara en multipel av ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ok\xE4nda nycklar":"Ok\xE4nd nyckel"}: ${L(i.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${i.origin??"v\xE4rdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt v\xE4rde i ${i.origin??"v\xE4rdet"}`;default:return"Ogiltig input"}}}});function Kie(){return{localeError:a4e()}}var a4e,Yie=S(()=>{_e();a4e=()=>{let t={string:{unit:"\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},file:{unit:"\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},array:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"},set:{unit:"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD",verb:"\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD"}};function e(i){return t[i]??null}let r={regex:"\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1",email:"\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",date:"ISO \u0BA4\u0BC7\u0BA4\u0BBF",time:"ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD",duration:"ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1",ipv4:"IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",ipv6:"IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF",cidrv4:"IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",cidrv6:"IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1",base64:"base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD",base64url:"base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD",json_string:"JSON \u0B9A\u0BB0\u0BAE\u0BCD",e164:"E.164 \u0B8E\u0BA3\u0BCD",jwt:"JWT",template_literal:"input"},n={nan:"NaN",number:"\u0B8E\u0BA3\u0BCD",array:"\u0B85\u0BA3\u0BBF",null:"\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${i.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${s}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${a}`}case"invalid_value":return i.values.length===1?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${W(i.values[0])}`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${L(i.values,"|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${s}${i.maximum.toString()} ${o.unit??"\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin??"\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${s}${i.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${s}${i.minimum.toString()} ${o.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${i.origin} ${s}${i.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="ends_with"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="includes"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${s.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:s.format==="regex"?`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${s.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`:`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${r[s.format]??i.format}`}case"not_multiple_of":return`\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${i.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`;case"unrecognized_keys":return`\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${i.keys.length>1?"\u0B95\u0BB3\u0BCD":""}: ${L(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`;case"invalid_union":return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1";case"invalid_element":return`${i.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`;default:return"\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"}}}});function Xie(){return{localeError:c4e()}}var c4e,Qie=S(()=>{_e();c4e=()=>{let t={string:{unit:"\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},file:{unit:"\u0E44\u0E1A\u0E15\u0E4C",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},array:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"},set:{unit:"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23",verb:"\u0E04\u0E27\u0E23\u0E21\u0E35"}};function e(i){return t[i]??null}let r={regex:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19",email:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25",url:"URL",emoji:"\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",date:"\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO",time:"\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",duration:"\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO",ipv4:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4",ipv6:"\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6",cidrv4:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4",cidrv6:"\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6",base64:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64",base64url:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL",json_string:"\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON",e164:"\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)",jwt:"\u0E42\u0E17\u0E40\u0E04\u0E19 JWT",template_literal:"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19"},n={nan:"NaN",number:"\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02",array:"\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)",null:"\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${i.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`:`\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${s} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${a}`}case"invalid_value":return i.values.length===1?`\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${W(i.values[0])}`:`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19":"\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32",o=e(i.origin);return o?`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${i.maximum.toString()} ${o.unit??"\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`:`\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin??"\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?"\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22":"\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32",o=e(i.origin);return o?`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${i.minimum.toString()} ${o.unit}`:`\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${i.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${s} ${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${s.prefix}"`:s.format==="ends_with"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${s.suffix}"`:s.format==="includes"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${s.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`:s.format==="regex"?`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${s.pattern}`:`\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${r[s.format]??i.format}`}case"not_multiple_of":return`\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${i.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`;case"unrecognized_keys":return`\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${L(i.keys,", ")}`;case"invalid_key":return`\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;case"invalid_union":return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49";case"invalid_element":return`\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${i.origin}`;default:return"\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"}}}});function ese(){return{localeError:l4e()}}var l4e,tse=S(()=>{_e();l4e=()=>{let t={string:{unit:"karakter",verb:"olmal\u0131"},file:{unit:"bayt",verb:"olmal\u0131"},array:{unit:"\xF6\u011Fe",verb:"olmal\u0131"},set:{unit:"\xF6\u011Fe",verb:"olmal\u0131"}};function e(i){return t[i]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO s\xFCre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aral\u0131\u011F\u0131",cidrv6:"IPv6 aral\u0131\u011F\u0131",base64:"base64 ile \u015Fifrelenmi\u015F metin",base64url:"base64url ile \u015Fifrelenmi\u015F metin",json_string:"JSON dizesi",e164:"E.164 say\u0131s\u0131",jwt:"JWT",template_literal:"\u015Eablon dizesi"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Ge\xE7ersiz de\u011Fer: beklenen instanceof ${i.expected}, al\u0131nan ${a}`:`Ge\xE7ersiz de\u011Fer: beklenen ${s}, al\u0131nan ${a}`}case"invalid_value":return i.values.length===1?`Ge\xE7ersiz de\u011Fer: beklenen ${W(i.values[0])}`:`Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${s}${i.maximum.toString()} ${o.unit??"\xF6\u011Fe"}`:`\xC7ok b\xFCy\xFCk: beklenen ${i.origin??"de\u011Fer"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${s}${i.minimum.toString()} ${o.unit}`:`\xC7ok k\xFC\xE7\xFCk: beklenen ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Ge\xE7ersiz metin: "${s.prefix}" ile ba\u015Flamal\u0131`:s.format==="ends_with"?`Ge\xE7ersiz metin: "${s.suffix}" ile bitmeli`:s.format==="includes"?`Ge\xE7ersiz metin: "${s.includes}" i\xE7ermeli`:s.format==="regex"?`Ge\xE7ersiz metin: ${s.pattern} desenine uymal\u0131`:`Ge\xE7ersiz ${r[s.format]??i.format}`}case"not_multiple_of":return`Ge\xE7ersiz say\u0131: ${i.divisor} ile tam b\xF6l\xFCnebilmeli`;case"unrecognized_keys":return`Tan\u0131nmayan anahtar${i.keys.length>1?"lar":""}: ${L(i.keys,", ")}`;case"invalid_key":return`${i.origin} i\xE7inde ge\xE7ersiz anahtar`;case"invalid_union":return"Ge\xE7ersiz de\u011Fer";case"invalid_element":return`${i.origin} i\xE7inde ge\xE7ersiz de\u011Fer`;default:return"Ge\xE7ersiz de\u011Fer"}}}});function o$(){return{localeError:u4e()}}var u4e,_z=S(()=>{_e();u4e=()=>{let t={string:{unit:"\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},file:{unit:"\u0431\u0430\u0439\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},array:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"},set:{unit:"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432",verb:"\u043C\u0430\u0442\u0438\u043C\u0435"}};function e(i){return t[i]??null}let r={regex:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456",email:"\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438",url:"URL",emoji:"\u0435\u043C\u043E\u0434\u0437\u0456",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO",date:"\u0434\u0430\u0442\u0430 ISO",time:"\u0447\u0430\u0441 ISO",duration:"\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO",ipv4:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv4",ipv6:"\u0430\u0434\u0440\u0435\u0441\u0430 IPv6",cidrv4:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4",cidrv6:"\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6",base64:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64",base64url:"\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url",json_string:"\u0440\u044F\u0434\u043E\u043A JSON",e164:"\u043D\u043E\u043C\u0435\u0440 E.164",jwt:"JWT",template_literal:"\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"},n={nan:"NaN",number:"\u0447\u0438\u0441\u043B\u043E",array:"\u043C\u0430\u0441\u0438\u0432"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${i.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${s}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${a}`}case"invalid_value":return i.values.length===1?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${W(i.values[0])}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin??"\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${i.origin} \u0431\u0443\u0434\u0435 ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${s.prefix}"`:s.format==="ends_with"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${s.suffix}"`:s.format==="includes"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${s.includes}"`:s.format==="regex"?`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${s.pattern}`:`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${r[s.format]??i.format}`}case"not_multiple_of":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${i.divisor}`;case"unrecognized_keys":return`\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${i.keys.length>1?"\u0456":""}: ${L(i.keys,", ")}`;case"invalid_key":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${i.origin}`;case"invalid_union":return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456";case"invalid_element":return`\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${i.origin}`;default:return"\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"}}}});function rse(){return o$()}var nse=S(()=>{_z()});function ise(){return{localeError:d4e()}}var d4e,sse=S(()=>{_e();d4e=()=>{let t={string:{unit:"\u062D\u0631\u0648\u0641",verb:"\u06C1\u0648\u0646\u0627"},file:{unit:"\u0628\u0627\u0626\u0679\u0633",verb:"\u06C1\u0648\u0646\u0627"},array:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"},set:{unit:"\u0622\u0626\u0679\u0645\u0632",verb:"\u06C1\u0648\u0646\u0627"}};function e(i){return t[i]??null}let r={regex:"\u0627\u0646 \u067E\u0679",email:"\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633",url:"\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644",emoji:"\u0627\u06CC\u0645\u0648\u062C\u06CC",uuid:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",uuidv4:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4",uuidv6:"\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6",nanoid:"\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC",guid:"\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",cuid2:"\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2",ulid:"\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC",xid:"\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC",ksuid:"\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC",datetime:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645",date:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E",time:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A",duration:"\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A",ipv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633",ipv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633",cidrv4:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C",cidrv6:"\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C",base64:"\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",base64url:"\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF",json_string:"\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF",e164:"\u0627\u06CC 164 \u0646\u0645\u0628\u0631",jwt:"\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC",template_literal:"\u0627\u0646 \u067E\u0679"},n={nan:"NaN",number:"\u0646\u0645\u0628\u0631",array:"\u0622\u0631\u06D2",null:"\u0646\u0644"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${i.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`:`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${s} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${a} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`}case"invalid_value":return i.values.length===1?`\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${W(i.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`:`\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${L(i.values,"|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${s}${i.maximum.toString()} ${o.unit??"\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0628\u0691\u0627: ${i.origin??"\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${s}${i.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u06D2 ${s}${i.minimum.toString()} ${o.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`:`\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${i.origin} \u06A9\u0627 ${s}${i.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="ends_with"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="includes"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${s.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:s.format==="regex"?`\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${s.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`:`\u063A\u0644\u0637 ${r[s.format]??i.format}`}case"not_multiple_of":return`\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${i.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`;case"unrecognized_keys":return`\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${i.keys.length>1?"\u0632":""}: ${L(i.keys,"\u060C ")}`;case"invalid_key":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`;case"invalid_union":return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679";case"invalid_element":return`${i.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`;default:return"\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"}}}});function ose(){return{localeError:p4e()}}var p4e,ase=S(()=>{_e();p4e=()=>{let t={string:{unit:"belgi",verb:"bo\u2018lishi kerak"},file:{unit:"bayt",verb:"bo\u2018lishi kerak"},array:{unit:"element",verb:"bo\u2018lishi kerak"},set:{unit:"element",verb:"bo\u2018lishi kerak"},map:{unit:"yozuv",verb:"bo\u2018lishi kerak"}};function e(i){return t[i]??null}let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},n={nan:"NaN",number:"raqam",array:"massiv"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`Noto\u2018g\u2018ri kirish: kutilgan instanceof ${i.expected}, qabul qilingan ${a}`:`Noto\u2018g\u2018ri kirish: kutilgan ${s}, qabul qilingan ${a}`}case"invalid_value":return i.values.length===1?`Noto\u2018g\u2018ri kirish: kutilgan ${W(i.values[0])}`:`Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Juda katta: kutilgan ${i.origin??"qiymat"} ${s}${i.maximum.toString()} ${o.unit} ${o.verb}`:`Juda katta: kutilgan ${i.origin??"qiymat"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Juda kichik: kutilgan ${i.origin} ${s}${i.minimum.toString()} ${o.unit} ${o.verb}`:`Juda kichik: kutilgan ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Noto\u2018g\u2018ri satr: "${s.prefix}" bilan boshlanishi kerak`:s.format==="ends_with"?`Noto\u2018g\u2018ri satr: "${s.suffix}" bilan tugashi kerak`:s.format==="includes"?`Noto\u2018g\u2018ri satr: "${s.includes}" ni o\u2018z ichiga olishi kerak`:s.format==="regex"?`Noto\u2018g\u2018ri satr: ${s.pattern} shabloniga mos kelishi kerak`:`Noto\u2018g\u2018ri ${r[s.format]??i.format}`}case"not_multiple_of":return`Noto\u2018g\u2018ri raqam: ${i.divisor} ning karralisi bo\u2018lishi kerak`;case"unrecognized_keys":return`Noma\u2019lum kalit${i.keys.length>1?"lar":""}: ${L(i.keys,", ")}`;case"invalid_key":return`${i.origin} dagi kalit noto\u2018g\u2018ri`;case"invalid_union":return"Noto\u2018g\u2018ri kirish";case"invalid_element":return`${i.origin} da noto\u2018g\u2018ri qiymat`;default:return"Noto\u2018g\u2018ri kirish"}}}});function cse(){return{localeError:f4e()}}var f4e,lse=S(()=>{_e();f4e=()=>{let t={string:{unit:"k\xFD t\u1EF1",verb:"c\xF3"},file:{unit:"byte",verb:"c\xF3"},array:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"},set:{unit:"ph\u1EA7n t\u1EED",verb:"c\xF3"}};function e(i){return t[i]??null}let r={regex:"\u0111\u1EA7u v\xE0o",email:"\u0111\u1ECBa ch\u1EC9 email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ng\xE0y gi\u1EDD ISO",date:"ng\xE0y ISO",time:"gi\u1EDD ISO",duration:"kho\u1EA3ng th\u1EDDi gian ISO",ipv4:"\u0111\u1ECBa ch\u1EC9 IPv4",ipv6:"\u0111\u1ECBa ch\u1EC9 IPv6",cidrv4:"d\u1EA3i IPv4",cidrv6:"d\u1EA3i IPv6",base64:"chu\u1ED7i m\xE3 h\xF3a base64",base64url:"chu\u1ED7i m\xE3 h\xF3a base64url",json_string:"chu\u1ED7i JSON",e164:"s\u1ED1 E.164",jwt:"JWT",template_literal:"\u0111\u1EA7u v\xE0o"},n={nan:"NaN",number:"s\u1ED1",array:"m\u1EA3ng"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${i.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`:`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${s}, nh\u1EADn \u0111\u01B0\u1EE3c ${a}`}case"invalid_value":return i.values.length===1?`\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${W(i.values[0])}`:`T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${o.verb} ${s}${i.maximum.toString()} ${o.unit??"ph\u1EA7n t\u1EED"}`:`Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${i.origin??"gi\xE1 tr\u1ECB"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${o.verb} ${s}${i.minimum.toString()} ${o.unit}`:`Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${s.prefix}"`:s.format==="ends_with"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${s.suffix}"`:s.format==="includes"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${s.includes}"`:s.format==="regex"?`Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${s.pattern}`:`${r[s.format]??i.format} kh\xF4ng h\u1EE3p l\u1EC7`}case"not_multiple_of":return`S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${i.divisor}`;case"unrecognized_keys":return`Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${L(i.keys,", ")}`;case"invalid_key":return`Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;case"invalid_union":return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7";case"invalid_element":return`Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${i.origin}`;default:return"\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"}}}});function use(){return{localeError:h4e()}}var h4e,dse=S(()=>{_e();h4e=()=>{let t={string:{unit:"\u5B57\u7B26",verb:"\u5305\u542B"},file:{unit:"\u5B57\u8282",verb:"\u5305\u542B"},array:{unit:"\u9879",verb:"\u5305\u542B"},set:{unit:"\u9879",verb:"\u5305\u542B"}};function e(i){return t[i]??null}let r={regex:"\u8F93\u5165",email:"\u7535\u5B50\u90AE\u4EF6",url:"URL",emoji:"\u8868\u60C5\u7B26\u53F7",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO\u65E5\u671F\u65F6\u95F4",date:"ISO\u65E5\u671F",time:"ISO\u65F6\u95F4",duration:"ISO\u65F6\u957F",ipv4:"IPv4\u5730\u5740",ipv6:"IPv6\u5730\u5740",cidrv4:"IPv4\u7F51\u6BB5",cidrv6:"IPv6\u7F51\u6BB5",base64:"base64\u7F16\u7801\u5B57\u7B26\u4E32",base64url:"base64url\u7F16\u7801\u5B57\u7B26\u4E32",json_string:"JSON\u5B57\u7B26\u4E32",e164:"E.164\u53F7\u7801",jwt:"JWT",template_literal:"\u8F93\u5165"},n={nan:"NaN",number:"\u6570\u5B57",array:"\u6570\u7EC4",null:"\u7A7A\u503C(null)"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${i.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`:`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${s}\uFF0C\u5B9E\u9645\u63A5\u6536 ${a}`}case"invalid_value":return i.values.length===1?`\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${W(i.values[0])}`:`\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${s}${i.maximum.toString()} ${o.unit??"\u4E2A\u5143\u7D20"}`:`\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${i.origin??"\u503C"} ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${s}${i.minimum.toString()} ${o.unit}`:`\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${i.origin} ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${s.prefix}" \u5F00\u5934`:s.format==="ends_with"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${s.suffix}" \u7ED3\u5C3E`:s.format==="includes"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${s.includes}"`:s.format==="regex"?`\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${s.pattern}`:`\u65E0\u6548${r[s.format]??i.format}`}case"not_multiple_of":return`\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${i.divisor} \u7684\u500D\u6570`;case"unrecognized_keys":return`\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${L(i.keys,", ")}`;case"invalid_key":return`${i.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`;case"invalid_union":return"\u65E0\u6548\u8F93\u5165";case"invalid_element":return`${i.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`;default:return"\u65E0\u6548\u8F93\u5165"}}}});function pse(){return{localeError:m4e()}}var m4e,fse=S(()=>{_e();m4e=()=>{let t={string:{unit:"\u5B57\u5143",verb:"\u64C1\u6709"},file:{unit:"\u4F4D\u5143\u7D44",verb:"\u64C1\u6709"},array:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"},set:{unit:"\u9805\u76EE",verb:"\u64C1\u6709"}};function e(i){return t[i]??null}let r={regex:"\u8F38\u5165",email:"\u90F5\u4EF6\u5730\u5740",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO \u65E5\u671F\u6642\u9593",date:"ISO \u65E5\u671F",time:"ISO \u6642\u9593",duration:"ISO \u671F\u9593",ipv4:"IPv4 \u4F4D\u5740",ipv6:"IPv6 \u4F4D\u5740",cidrv4:"IPv4 \u7BC4\u570D",cidrv6:"IPv6 \u7BC4\u570D",base64:"base64 \u7DE8\u78BC\u5B57\u4E32",base64url:"base64url \u7DE8\u78BC\u5B57\u4E32",json_string:"JSON \u5B57\u4E32",e164:"E.164 \u6578\u503C",jwt:"JWT",template_literal:"\u8F38\u5165"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${i.expected}\uFF0C\u4F46\u6536\u5230 ${a}`:`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${s}\uFF0C\u4F46\u6536\u5230 ${a}`}case"invalid_value":return i.values.length===1?`\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${W(i.values[0])}`:`\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${s}${i.maximum.toString()} ${o.unit??"\u500B\u5143\u7D20"}`:`\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${i.origin??"\u503C"} \u61C9\u70BA ${s}${i.maximum.toString()}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${s}${i.minimum.toString()} ${o.unit}`:`\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${i.origin} \u61C9\u70BA ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${s.prefix}" \u958B\u982D`:s.format==="ends_with"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${s.suffix}" \u7D50\u5C3E`:s.format==="includes"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${s.includes}"`:s.format==="regex"?`\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${s.pattern}`:`\u7121\u6548\u7684 ${r[s.format]??i.format}`}case"not_multiple_of":return`\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${i.divisor} \u7684\u500D\u6578`;case"unrecognized_keys":return`\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${i.keys.length>1?"\u5011":""}\uFF1A${L(i.keys,"\u3001")}`;case"invalid_key":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`;case"invalid_union":return"\u7121\u6548\u7684\u8F38\u5165\u503C";case"invalid_element":return`${i.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`;default:return"\u7121\u6548\u7684\u8F38\u5165\u503C"}}}});function hse(){return{localeError:g4e()}}var g4e,mse=S(()=>{_e();g4e=()=>{let t={string:{unit:"\xE0mi",verb:"n\xED"},file:{unit:"bytes",verb:"n\xED"},array:{unit:"nkan",verb:"n\xED"},set:{unit:"nkan",verb:"n\xED"}};function e(i){return t[i]??null}let r={regex:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9",email:"\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"\xE0k\xF3k\xF2 ISO",date:"\u1ECDj\u1ECD\u0301 ISO",time:"\xE0k\xF3k\xF2 ISO",duration:"\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO",ipv4:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv4",ipv6:"\xE0d\xEDr\u1EB9\u0301s\xEC IPv6",cidrv4:"\xE0gb\xE8gb\xE8 IPv4",cidrv6:"\xE0gb\xE8gb\xE8 IPv6",base64:"\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64",base64url:"\u1ECD\u0300r\u1ECD\u0300 base64url",json_string:"\u1ECD\u0300r\u1ECD\u0300 JSON",e164:"n\u1ECD\u0301mb\xE0 E.164",jwt:"JWT",template_literal:"\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9"},n={nan:"NaN",number:"n\u1ECD\u0301mb\xE0",array:"akop\u1ECD"};return i=>{switch(i.code){case"invalid_type":{let s=n[i.expected]??i.expected,o=J(i.input),a=n[o]??o;return/^[A-Z]/.test(i.expected)?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${i.expected}, \xE0m\u1ECD\u0300 a r\xED ${a}`:`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${s}, \xE0m\u1ECD\u0300 a r\xED ${a}`}case"invalid_value":return i.values.length===1?`\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${W(i.values[0])}`:`\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${L(i.values,"|")}`;case"too_big":{let s=i.inclusive?"<=":"<",o=e(i.origin);return o?`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin??"iye"} ${o.verb} ${s}${i.maximum} ${o.unit}`:`T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${s}${i.maximum}`}case"too_small":{let s=i.inclusive?">=":">",o=e(i.origin);return o?`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${i.origin} ${o.verb} ${s}${i.minimum} ${o.unit}`:`K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${s}${i.minimum}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${s.prefix}"`:s.format==="ends_with"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${s.suffix}"`:s.format==="includes"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${s.includes}"`:s.format==="regex"?`\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${s.pattern}`:`A\u1E63\xEC\u1E63e: ${r[s.format]??i.format}`}case"not_multiple_of":return`N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${i.divisor}`;case"unrecognized_keys":return`B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${L(i.keys,", ")}`;case"invalid_key":return`B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;case"invalid_union":return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e";case"invalid_element":return`Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${i.origin}`;default:return"\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"}}}});var gh={};Di(gh,{ar:()=>wne,az:()=>kne,be:()=>$ne,bg:()=>Pne,ca:()=>Cne,cs:()=>One,da:()=>Dne,de:()=>Lne,el:()=>Fne,en:()=>i$,eo:()=>Une,es:()=>qne,fa:()=>Gne,fi:()=>Wne,fr:()=>Jne,frCA:()=>Yne,he:()=>Qne,hr:()=>tie,hu:()=>nie,hy:()=>oie,id:()=>cie,is:()=>uie,it:()=>pie,ja:()=>hie,ka:()=>gie,kh:()=>bie,km:()=>s$,ko:()=>_ie,lt:()=>xie,mk:()=>Eie,ms:()=>$ie,nl:()=>Pie,no:()=>Cie,ota:()=>Oie,pl:()=>Lie,ps:()=>Die,pt:()=>Fie,ro:()=>Uie,ru:()=>Vie,sl:()=>Hie,sv:()=>Zie,ta:()=>Kie,th:()=>Xie,tr:()=>ese,ua:()=>rse,uk:()=>o$,ur:()=>ise,uz:()=>ose,vi:()=>cse,yo:()=>hse,zhCN:()=>use,zhTW:()=>pse});var a$=S(()=>{xne();Ene();Ine();Rne();Tne();Nne();jne();Mne();zne();bz();Bne();Vne();Hne();Zne();Kne();Xne();eie();rie();iie();aie();lie();die();fie();mie();yie();vie();vz();Sie();kie();Aie();Iie();Rie();Tie();Nie();jie();Mie();zie();Bie();Gie();Wie();Jie();Yie();Qie();tse();nse();_z();sse();ase();lse();dse();fse();mse()});function l$(){return new c$}var gse,Sz,wz,c$,un,bv=S(()=>{Sz=Symbol("ZodOutput"),wz=Symbol("ZodInput"),c$=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(gse=globalThis).__zod_globalRegistry??(gse.__zod_globalRegistry=l$());un=globalThis.__zod_globalRegistry});function u$(t,e){return new t({type:"string",...X(e)})}function xz(t,e){return new t({type:"string",coerce:!0,...X(e)})}function vv(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...X(e)})}function yh(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...X(e)})}function _v(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...X(e)})}function Sv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...X(e)})}function wv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...X(e)})}function xv(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...X(e)})}function bh(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...X(e)})}function kv(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...X(e)})}function Ev(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...X(e)})}function Av(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...X(e)})}function $v(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...X(e)})}function Iv(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...X(e)})}function Pv(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...X(e)})}function Rv(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...X(e)})}function Cv(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...X(e)})}function Tv(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...X(e)})}function d$(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...X(e)})}function Ov(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...X(e)})}function Nv(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...X(e)})}function Dv(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...X(e)})}function jv(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...X(e)})}function Lv(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...X(e)})}function Mv(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...X(e)})}function Ez(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...X(e)})}function Az(t,e){return new t({type:"string",format:"date",check:"string_format",...X(e)})}function $z(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...X(e)})}function Iz(t,e){return new t({type:"string",format:"duration",check:"string_format",...X(e)})}function p$(t,e){return new t({type:"number",checks:[],...X(e)})}function Pz(t,e){return new t({type:"number",coerce:!0,checks:[],...X(e)})}function f$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...X(e)})}function h$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...X(e)})}function m$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...X(e)})}function g$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...X(e)})}function y$(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...X(e)})}function b$(t,e){return new t({type:"boolean",...X(e)})}function Rz(t,e){return new t({type:"boolean",coerce:!0,...X(e)})}function v$(t,e){return new t({type:"bigint",...X(e)})}function Cz(t,e){return new t({type:"bigint",coerce:!0,...X(e)})}function _$(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...X(e)})}function S$(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...X(e)})}function w$(t,e){return new t({type:"symbol",...X(e)})}function x$(t,e){return new t({type:"undefined",...X(e)})}function k$(t,e){return new t({type:"null",...X(e)})}function E$(t){return new t({type:"any"})}function A$(t){return new t({type:"unknown"})}function $$(t,e){return new t({type:"never",...X(e)})}function I$(t,e){return new t({type:"void",...X(e)})}function P$(t,e){return new t({type:"date",...X(e)})}function Tz(t,e){return new t({type:"date",coerce:!0,...X(e)})}function R$(t,e){return new t({type:"nan",...X(e)})}function Zo(t,e){return new ZE({check:"less_than",...X(e),value:t,inclusive:!1})}function Ui(t,e){return new ZE({check:"less_than",...X(e),value:t,inclusive:!0})}function Jo(t,e){return new JE({check:"greater_than",...X(e),value:t,inclusive:!1})}function Jn(t,e){return new JE({check:"greater_than",...X(e),value:t,inclusive:!0})}function C$(t){return Jo(0,t)}function T$(t){return Zo(0,t)}function O$(t){return Ui(0,t)}function N$(t){return Jn(0,t)}function kl(t,e){return new BF({check:"multiple_of",...X(e),value:t})}function El(t,e){return new GF({check:"max_size",...X(e),maximum:t})}function Ko(t,e){return new HF({check:"min_size",...X(e),minimum:t})}function xd(t,e){return new WF({check:"size_equals",...X(e),size:t})}function kd(t,e){return new ZF({check:"max_length",...X(e),maximum:t})}function Xa(t,e){return new JF({check:"min_length",...X(e),minimum:t})}function Ed(t,e){return new KF({check:"length_equals",...X(e),length:t})}function vh(t,e){return new YF({check:"string_format",format:"regex",...X(e),pattern:t})}function _h(t){return new XF({check:"string_format",format:"lowercase",...X(t)})}function Sh(t){return new QF({check:"string_format",format:"uppercase",...X(t)})}function wh(t,e){return new ez({check:"string_format",format:"includes",...X(e),includes:t})}function xh(t,e){return new tz({check:"string_format",format:"starts_with",...X(e),prefix:t})}function kh(t,e){return new rz({check:"string_format",format:"ends_with",...X(e),suffix:t})}function D$(t,e,r){return new nz({check:"property",property:t,schema:e,...X(r)})}function Eh(t,e){return new iz({check:"mime_type",mime:t,...X(e)})}function Xs(t){return new sz({check:"overwrite",tx:t})}function Ah(t){return Xs(e=>e.normalize(t))}function $h(){return Xs(t=>t.trim())}function Ih(){return Xs(t=>t.toLowerCase())}function Ph(){return Xs(t=>t.toUpperCase())}function Rh(){return Xs(t=>rF(t))}function Oz(t,e,r){return new t({type:"array",element:e,...X(r)})}function b4e(t,e,r){return new t({type:"union",options:e,...X(r)})}function v4e(t,e,r){return new t({type:"union",options:e,inclusive:!1,...X(r)})}function _4e(t,e,r,n){return new t({type:"union",options:r,discriminator:e,...X(n)})}function S4e(t,e,r){return new t({type:"intersection",left:e,right:r})}function w4e(t,e,r,n){let i=r instanceof Le,s=i?n:r,o=i?r:null;return new t({type:"tuple",items:e,rest:o,...X(s)})}function x4e(t,e,r,n){return new t({type:"record",keyType:e,valueType:r,...X(n)})}function k4e(t,e,r,n){return new t({type:"map",keyType:e,valueType:r,...X(n)})}function E4e(t,e,r){return new t({type:"set",valueType:e,...X(r)})}function A4e(t,e,r){let n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new t({type:"enum",entries:n,...X(r)})}function $4e(t,e,r){return new t({type:"enum",entries:e,...X(r)})}function I4e(t,e,r){return new t({type:"literal",values:Array.isArray(e)?e:[e],...X(r)})}function j$(t,e){return new t({type:"file",...X(e)})}function P4e(t,e){return new t({type:"transform",transform:e})}function R4e(t,e){return new t({type:"optional",innerType:e})}function C4e(t,e){return new t({type:"nullable",innerType:e})}function T4e(t,e,r){return new t({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():jE(r)}})}function O4e(t,e,r){return new t({type:"nonoptional",innerType:e,...X(r)})}function N4e(t,e){return new t({type:"success",innerType:e})}function D4e(t,e,r){return new t({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}function j4e(t,e,r){return new t({type:"pipe",in:e,out:r})}function L4e(t,e){return new t({type:"readonly",innerType:e})}function M4e(t,e,r){return new t({type:"template_literal",parts:e,...X(r)})}function F4e(t,e){return new t({type:"lazy",getter:e})}function z4e(t,e){return new t({type:"promise",innerType:e})}function L$(t,e,r){let n=X(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function M$(t,e,r){return new t({type:"custom",check:"custom",fn:e,...X(r)})}function F$(t,e){let r=yse(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(oh(i,n.value,r._zod.def));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(oh(s))}},t(n.value,n)),e);return r}function yse(t,e){let r=new qt({check:"custom",...X(e)});return r._zod.check=t,r}function z$(t){let e=new qt({check:"describe"});return e._zod.onattach=[r=>{let n=un.get(r)??{};un.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function U$(t){let e=new qt({check:"meta"});return e._zod.onattach=[r=>{let n=un.get(r)??{};un.add(r,{...n,...t})}],e._zod.check=()=>{},e}function B$(t,e){let r=X(e),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),i=i.map(f=>typeof f=="string"?f.toLowerCase():f));let s=new Set(n),o=new Set(i),a=t.Codec??hh,c=t.Boolean??ph,l=t.String??xl,u=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new a({type:"pipe",in:u,out:d,transform:((f,h)=>{let m=f;return r.case!=="sensitive"&&(m=m.toLowerCase()),s.has(m)?!0:o.has(m)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...o],input:h.value,inst:p,continue:!1}),{})}),reverseTransform:((f,h)=>f===!0?n[0]||"true":i[0]||"false"),error:r.error});return p}function Ad(t,e,r,n={}){let i=X(n),s={...X(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:a=>r.test(a),...i};return r instanceof RegExp&&(s.pattern=r),new t(s)}var kz,bse=S(()=>{KE();bv();yz();_e();kz={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6}});function Al(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??un,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function Dt(t,e,r={path:[],schemaPath:[]}){var n;let i=t._zod.def,s=e.seen.get(t);if(s)return s.count++,r.schemaPath.includes(t)&&(s.cycle=r.path),s.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,o);let a=t._zod.toJSONSchema?.();if(a)o.schema=a;else{let u={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,o.schema,u);else{let p=o.schema,f=e.processors[i.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);f(t,e,p,u)}let d=t._zod.parent;d&&(o.ref||(o.ref=d),Dt(d,e,u),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(o.schema,c),e.io==="input"&&Kn(t)&&(delete o.schema.examples,delete o.schema.default),e.io==="input"&&"_prefault"in o.schema&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault,e.seen.get(t).schema}function $l(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let o of t.seen.entries()){let a=t.metadataRegistry.get(o[0])?.id;if(a){let c=n.get(a);if(c&&c!==o[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,o[0])}}let i=o=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(o[0])?.id,p=t.external.uri??(h=>h);if(d)return{ref:p(d)};let f=o[1].defId??o[1].schema.id??`schema${t.counter++}`;return o[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(o[1]===r)return{ref:"#"};let l=`#/${a}/`,u=o[1].schema.id??`__schema${t.counter++}`;return{defId:u,ref:l+u}},s=o=>{if(o[1].schema.$ref)return;let a=o[1],{ref:c,defId:l}=i(o);a.def={...a.schema},l&&(a.defId=l);let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(t.cycles==="throw")for(let o of t.seen.entries()){let a=o[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of t.seen.entries()){let a=o[1];if(e===o[0]){s(o);continue}if(t.external){let l=t.external.registry.get(o[0])?.id;if(e!==o[0]&&l){s(o);continue}}if(t.metadataRegistry.get(o[0])?.id){s(o);continue}if(a.cycle){s(o);continue}if(a.count>1&&t.reused==="ref"){s(o);continue}}}function Il(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=t.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){n(d);let f=t.seen.get(d),h=f.schema;if(h.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(h)):Object.assign(l,h),Object.assign(l,u),a._zod.parent===d)for(let y in l)y==="$ref"||y==="allOf"||y in u||delete l[y];if(h.$ref&&f.def)for(let y in l)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(l[y])===JSON.stringify(f.def[y])&&delete l[y]}let p=a._zod.parent;if(p&&p!==d){n(p);let f=t.seen.get(p);if(f?.schema.$ref&&(l.$ref=f.schema.$ref,f.def))for(let h in l)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(l[h])===JSON.stringify(f.def[h])&&delete l[h]}t.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(a)}Object.assign(i,r.def??r.schema);let s=t.metadataRegistry.get(e)?.id;s!==void 0&&i.id===s&&delete i.id;let o=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,o[c.defId]=c.def)}t.external||Object.keys(o).length>0&&(t.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Ch(e,"input",t.processors),output:Ch(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Kn(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Kn(n.element,r);if(n.type==="set")return Kn(n.valueType,r);if(n.type==="lazy")return Kn(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Kn(n.innerType,r);if(n.type==="intersection")return Kn(n.left,r)||Kn(n.right,r);if(n.type==="record"||n.type==="map")return Kn(n.keyType,r)||Kn(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Kn(n.in,r)||Kn(n.out,r);if(n.type==="object"){for(let i in n.shape)if(Kn(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(Kn(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(Kn(i,r))return!0;return!!(n.rest&&Kn(n.rest,r))}return!1}var Nz,Ch,Fv=S(()=>{bv();Nz=(t,e={})=>r=>{let n=Al({...r,processors:e});return Dt(t,n),$l(n,t),Il(n,t)},Ch=(t,e,r={})=>n=>{let{libraryOptions:i,target:s}=n??{},o=Al({...i??{},target:s,io:e,processors:r});return Dt(t,o),$l(o,t),Il(o,t)}});function $d(t,e){if("_idmap"in t){let n=t,i=Al({...e,processors:q$}),s={};for(let c of n._idmap.entries()){let[l,u]=c;Dt(u,i)}let o={},a={registry:n,uri:e?.uri,defs:s};i.external=a;for(let c of n._idmap.entries()){let[l,u]=c;$l(i,u),o[l]=Il(i,u)}if(Object.keys(s).length>0){let c=i.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[c]:s}}return{schemas:o}}let r=Al({...e,processors:q$});return Dt(t,r),$l(r,t),Il(r,t)}var U4e,Dz,jz,Lz,Mz,Fz,zz,Uz,Bz,qz,Vz,Gz,Hz,Wz,Zz,Jz,Kz,Yz,Xz,Qz,e6,t6,r6,n6,i6,s6,V$,o6,a6,c6,l6,u6,d6,p6,f6,h6,m6,g6,G$,y6,q$,Th=S(()=>{Fv();_e();U4e={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dz=(t,e,r,n)=>{let i=r;i.type="string";let{minimum:s,maximum:o,format:a,patterns:c,contentEncoding:l}=t._zod.bag;if(typeof s=="number"&&(i.minLength=s),typeof o=="number"&&(i.maxLength=o),a&&(i.format=U4e[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let u=[...c];u.length===1?i.pattern=u[0].source:u.length>1&&(i.allOf=[...u.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},jz=(t,e,r,n)=>{let i=r,{minimum:s,maximum:o,format:a,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=t._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number";let d=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),p=typeof l=="number"&&l<=(o??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";d?f?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof s=="number"&&(i.minimum=s),p?f?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o=="number"&&(i.maximum=o),typeof c=="number"&&(i.multipleOf=c)},Lz=(t,e,r,n)=>{r.type="boolean"},Mz=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Fz=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},zz=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Uz=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Bz=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},qz=(t,e,r,n)=>{r.not={}},Vz=(t,e,r,n)=>{},Gz=(t,e,r,n)=>{},Hz=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Wz=(t,e,r,n)=>{let i=t._zod.def,s=tv(i.entries);s.every(o=>typeof o=="number")&&(r.type="number"),s.every(o=>typeof o=="string")&&(r.type="string"),r.enum=s},Zz=(t,e,r,n)=>{let i=t._zod.def,s=[];for(let o of i.values)if(o===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof o=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(o))}else s.push(o);if(s.length!==0)if(s.length===1){let o=s[0];r.type=o===null?"null":typeof o,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[o]:r.const=o}else s.every(o=>typeof o=="number")&&(r.type="number"),s.every(o=>typeof o=="string")&&(r.type="string"),s.every(o=>typeof o=="boolean")&&(r.type="boolean"),s.every(o=>o===null)&&(r.type="null"),r.enum=s},Jz=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Kz=(t,e,r,n)=>{let i=r,s=t._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=s.source},Yz=(t,e,r,n)=>{let i=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:a,mime:c}=t._zod.bag;o!==void 0&&(s.minLength=o),a!==void 0&&(s.maxLength=a),c?c.length===1?(s.contentMediaType=c[0],Object.assign(i,s)):(Object.assign(i,s),i.anyOf=c.map(l=>({contentMediaType:l}))):Object.assign(i,s)},Xz=(t,e,r,n)=>{r.type="boolean"},Qz=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},e6=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},t6=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},r6=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},n6=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},i6=(t,e,r,n)=>{let i=r,s=t._zod.def,{minimum:o,maximum:a}=t._zod.bag;typeof o=="number"&&(i.minItems=o),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=Dt(s.element,e,{...n,path:[...n.path,"items"]})},s6=(t,e,r,n)=>{let i=r,s=t._zod.def;i.type="object",i.properties={};let o=s.shape;for(let l in o)i.properties[l]=Dt(o[l],e,{...n,path:[...n.path,"properties",l]});let a=new Set(Object.keys(o)),c=new Set([...a].filter(l=>{let u=s.shape[l]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(i.required=Array.from(c)),s.catchall?._zod.def.type==="never"?i.additionalProperties=!1:s.catchall?s.catchall&&(i.additionalProperties=Dt(s.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},V$=(t,e,r,n)=>{let i=t._zod.def,s=i.inclusive===!1,o=i.options.map((a,c)=>Dt(a,e,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=o:r.anyOf=o},o6=(t,e,r,n)=>{let i=t._zod.def,s=Dt(i.left,e,{...n,path:[...n.path,"allOf",0]}),o=Dt(i.right,e,{...n,path:[...n.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(o)?o.allOf:[o]];r.allOf=c},a6=(t,e,r,n)=>{let i=r,s=t._zod.def;i.type="array";let o=e.target==="draft-2020-12"?"prefixItems":"items",a=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=s.items.map((p,f)=>Dt(p,e,{...n,path:[...n.path,o,f]})),l=s.rest?Dt(s.rest,e,{...n,path:[...n.path,a,...e.target==="openapi-3.0"?[s.items.length]:[]]}):null;e.target==="draft-2020-12"?(i.prefixItems=c,l&&(i.items=l)):e.target==="openapi-3.0"?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=t._zod.bag;typeof u=="number"&&(i.minItems=u),typeof d=="number"&&(i.maxItems=d)},c6=(t,e,r,n)=>{let i=r,s=t._zod.def;i.type="object";let o=s.keyType,c=o._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let u=Dt(s.valueType,e,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(i.propertyNames=Dt(s.keyType,e,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=Dt(s.valueType,e,{...n,path:[...n.path,"additionalProperties"]});let l=o._zod.values;if(l){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(i.required=u)}},l6=(t,e,r,n)=>{let i=t._zod.def,s=Dt(i.innerType,e,n),o=e.seen.get(t);e.target==="openapi-3.0"?(o.ref=i.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},u6=(t,e,r,n)=>{let i=t._zod.def;Dt(i.innerType,e,n);let s=e.seen.get(t);s.ref=i.innerType},d6=(t,e,r,n)=>{let i=t._zod.def;Dt(i.innerType,e,n);let s=e.seen.get(t);s.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},p6=(t,e,r,n)=>{let i=t._zod.def;Dt(i.innerType,e,n);let s=e.seen.get(t);s.ref=i.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},f6=(t,e,r,n)=>{let i=t._zod.def;Dt(i.innerType,e,n);let s=e.seen.get(t);s.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=o},h6=(t,e,r,n)=>{let i=t._zod.def,s=i.in._zod.traits.has("$ZodTransform"),o=e.io==="input"?s?i.out:i.in:i.out;Dt(o,e,n);let a=e.seen.get(t);a.ref=o},m6=(t,e,r,n)=>{let i=t._zod.def;Dt(i.innerType,e,n);let s=e.seen.get(t);s.ref=i.innerType,r.readOnly=!0},g6=(t,e,r,n)=>{let i=t._zod.def;Dt(i.innerType,e,n);let s=e.seen.get(t);s.ref=i.innerType},G$=(t,e,r,n)=>{let i=t._zod.def;Dt(i.innerType,e,n);let s=e.seen.get(t);s.ref=i.innerType},y6=(t,e,r,n)=>{let i=t._zod.innerType;Dt(i,e,n);let s=e.seen.get(t);s.ref=i},q$={string:Dz,number:jz,boolean:Lz,bigint:Mz,symbol:Fz,null:zz,undefined:Uz,void:Bz,never:qz,any:Vz,unknown:Gz,date:Hz,enum:Wz,literal:Zz,nan:Jz,template_literal:Kz,file:Yz,success:Xz,custom:Qz,function:e6,transform:t6,map:r6,set:n6,array:i6,object:s6,union:V$,intersection:o6,tuple:a6,record:c6,nullable:l6,nonoptional:u6,default:d6,prefault:p6,catch:f6,pipe:h6,readonly:m6,promise:g6,optional:G$,lazy:y6}});var H$,vse=S(()=>{Th();Fv();H$=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let r=e?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Al({processors:q$,target:r,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,r={path:[],schemaPath:[]}){return Dt(e,this.ctx,r)}emit(e,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),$l(this.ctx,e);let n=Il(this.ctx,e),{"~standard":i,...s}=n;return s}}});var _se={};var Sse=S(()=>{});var Qs={};Di(Qs,{$ZodAny:()=>$A,$ZodArray:()=>TA,$ZodAsyncError:()=>Ys,$ZodBase64:()=>yA,$ZodBase64URL:()=>bA,$ZodBigInt:()=>fv,$ZodBigIntFormat:()=>xA,$ZodBoolean:()=>ph,$ZodCIDRv4:()=>mA,$ZodCIDRv6:()=>gA,$ZodCUID:()=>aA,$ZodCUID2:()=>cA,$ZodCatch:()=>KA,$ZodCheck:()=>qt,$ZodCheckBigIntFormat:()=>VF,$ZodCheckEndsWith:()=>rz,$ZodCheckGreaterThan:()=>JE,$ZodCheckIncludes:()=>ez,$ZodCheckLengthEquals:()=>KF,$ZodCheckLessThan:()=>ZE,$ZodCheckLowerCase:()=>XF,$ZodCheckMaxLength:()=>ZF,$ZodCheckMaxSize:()=>GF,$ZodCheckMimeType:()=>iz,$ZodCheckMinLength:()=>JF,$ZodCheckMinSize:()=>HF,$ZodCheckMultipleOf:()=>BF,$ZodCheckNumberFormat:()=>qF,$ZodCheckOverwrite:()=>sz,$ZodCheckProperty:()=>nz,$ZodCheckRegex:()=>YF,$ZodCheckSizeEquals:()=>WF,$ZodCheckStartsWith:()=>tz,$ZodCheckStringFormat:()=>dh,$ZodCheckUpperCase:()=>QF,$ZodCodec:()=>hh,$ZodCustom:()=>n$,$ZodCustomStringFormat:()=>SA,$ZodDate:()=>CA,$ZodDefault:()=>HA,$ZodDiscriminatedUnion:()=>DA,$ZodE164:()=>vA,$ZodEmail:()=>nA,$ZodEmoji:()=>sA,$ZodEncodeError:()=>gl,$ZodEnum:()=>zA,$ZodError:()=>ov,$ZodExactOptional:()=>VA,$ZodFile:()=>BA,$ZodFunction:()=>e$,$ZodGUID:()=>tA,$ZodIPv4:()=>pA,$ZodIPv6:()=>fA,$ZodISODate:()=>dz,$ZodISODateTime:()=>uz,$ZodISODuration:()=>fz,$ZodISOTime:()=>pz,$ZodIntersection:()=>jA,$ZodJWT:()=>_A,$ZodKSUID:()=>dA,$ZodLazy:()=>r$,$ZodLiteral:()=>UA,$ZodMAC:()=>hA,$ZodMap:()=>MA,$ZodNaN:()=>YA,$ZodNanoID:()=>oA,$ZodNever:()=>PA,$ZodNonOptional:()=>ZA,$ZodNull:()=>AA,$ZodNullable:()=>GA,$ZodNumber:()=>pv,$ZodNumberFormat:()=>wA,$ZodObject:()=>OA,$ZodObjectJIT:()=>mz,$ZodOptional:()=>mv,$ZodPipe:()=>gv,$ZodPrefault:()=>WA,$ZodPreprocess:()=>gz,$ZodPromise:()=>t$,$ZodReadonly:()=>XA,$ZodRealError:()=>gi,$ZodRecord:()=>LA,$ZodRegistry:()=>c$,$ZodSet:()=>FA,$ZodString:()=>xl,$ZodStringFormat:()=>jt,$ZodSuccess:()=>JA,$ZodSymbol:()=>kA,$ZodTemplateLiteral:()=>QA,$ZodTransform:()=>qA,$ZodTuple:()=>hv,$ZodType:()=>Le,$ZodULID:()=>lA,$ZodURL:()=>iA,$ZodUUID:()=>rA,$ZodUndefined:()=>EA,$ZodUnion:()=>fh,$ZodUnknown:()=>IA,$ZodVoid:()=>RA,$ZodXID:()=>uA,$ZodXor:()=>NA,$brand:()=>XM,$constructor:()=>N,$input:()=>wz,$output:()=>Sz,Doc:()=>dv,JSONSchema:()=>_se,JSONSchemaGenerator:()=>H$,NEVER:()=>YM,TimePrecision:()=>kz,_any:()=>E$,_array:()=>Oz,_base64:()=>Dv,_base64url:()=>jv,_bigint:()=>v$,_boolean:()=>b$,_catch:()=>D4e,_check:()=>yse,_cidrv4:()=>Ov,_cidrv6:()=>Nv,_coercedBigint:()=>Cz,_coercedBoolean:()=>Rz,_coercedDate:()=>Tz,_coercedNumber:()=>Pz,_coercedString:()=>xz,_cuid:()=>Av,_cuid2:()=>$v,_custom:()=>L$,_date:()=>P$,_decode:()=>ME,_decodeAsync:()=>zE,_default:()=>T4e,_discriminatedUnion:()=>_4e,_e164:()=>Lv,_email:()=>vv,_emoji:()=>kv,_encode:()=>LE,_encodeAsync:()=>FE,_endsWith:()=>kh,_enum:()=>A4e,_file:()=>j$,_float32:()=>h$,_float64:()=>m$,_gt:()=>Jo,_gte:()=>Jn,_guid:()=>yh,_includes:()=>wh,_int:()=>f$,_int32:()=>g$,_int64:()=>_$,_intersection:()=>S4e,_ipv4:()=>Cv,_ipv6:()=>Tv,_isoDate:()=>Az,_isoDateTime:()=>Ez,_isoDuration:()=>Iz,_isoTime:()=>$z,_jwt:()=>Mv,_ksuid:()=>Rv,_lazy:()=>F4e,_length:()=>Ed,_literal:()=>I4e,_lowercase:()=>_h,_lt:()=>Zo,_lte:()=>Ui,_mac:()=>d$,_map:()=>k4e,_max:()=>Ui,_maxLength:()=>kd,_maxSize:()=>El,_mime:()=>Eh,_min:()=>Jn,_minLength:()=>Xa,_minSize:()=>Ko,_multipleOf:()=>kl,_nan:()=>R$,_nanoid:()=>Ev,_nativeEnum:()=>$4e,_negative:()=>T$,_never:()=>$$,_nonnegative:()=>N$,_nonoptional:()=>O4e,_nonpositive:()=>O$,_normalize:()=>Ah,_null:()=>k$,_nullable:()=>C4e,_number:()=>p$,_optional:()=>R4e,_overwrite:()=>Xs,_parse:()=>ah,_parseAsync:()=>ch,_pipe:()=>j4e,_positive:()=>C$,_promise:()=>z4e,_property:()=>D$,_readonly:()=>L4e,_record:()=>x4e,_refine:()=>M$,_regex:()=>vh,_safeDecode:()=>BE,_safeDecodeAsync:()=>VE,_safeEncode:()=>UE,_safeEncodeAsync:()=>qE,_safeParse:()=>lh,_safeParseAsync:()=>uh,_set:()=>E4e,_size:()=>xd,_slugify:()=>Rh,_startsWith:()=>xh,_string:()=>u$,_stringFormat:()=>Ad,_stringbool:()=>B$,_success:()=>N4e,_superRefine:()=>F$,_symbol:()=>w$,_templateLiteral:()=>M4e,_toLowerCase:()=>Ih,_toUpperCase:()=>Ph,_transform:()=>P4e,_trim:()=>$h,_tuple:()=>w4e,_uint32:()=>y$,_uint64:()=>S$,_ulid:()=>Iv,_undefined:()=>x$,_union:()=>b4e,_unknown:()=>A$,_uppercase:()=>Sh,_url:()=>bh,_uuid:()=>_v,_uuidv4:()=>Sv,_uuidv6:()=>wv,_uuidv7:()=>xv,_void:()=>I$,_xid:()=>Pv,_xor:()=>v4e,clone:()=>ln,config:()=>br,createStandardJSONSchemaMethod:()=>Ch,createToJSONSchemaMethod:()=>Nz,decode:()=>Gre,decodeAsync:()=>Wre,describe:()=>z$,encode:()=>Vre,encodeAsync:()=>Hre,extractDefs:()=>$l,finalize:()=>Il,flattenError:()=>av,formatError:()=>cv,globalConfig:()=>yd,globalRegistry:()=>un,initializeContext:()=>Al,isValidBase64:()=>hz,isValidBase64URL:()=>bne,isValidJWT:()=>vne,locales:()=>gh,meta:()=>U$,parse:()=>_d,parseAsync:()=>Sd,prettifyError:()=>uF,process:()=>Dt,regexes:()=>yi,registry:()=>l$,safeDecode:()=>Jre,safeDecodeAsync:()=>Yre,safeEncode:()=>Zre,safeEncodeAsync:()=>Kre,safeParse:()=>Sl,safeParseAsync:()=>wl,toDotPath:()=>qre,toJSONSchema:()=>$d,treeifyError:()=>lF,util:()=>K,version:()=>az});var En=S(()=>{bd();pF();dF();yz();KE();cz();_e();WE();a$();bv();oz();bse();Fv();Th();vse();Sse()});var W$={};Di(W$,{endsWith:()=>kh,gt:()=>Jo,gte:()=>Jn,includes:()=>wh,length:()=>Ed,lowercase:()=>_h,lt:()=>Zo,lte:()=>Ui,maxLength:()=>kd,maxSize:()=>El,mime:()=>Eh,minLength:()=>Xa,minSize:()=>Ko,multipleOf:()=>kl,negative:()=>T$,nonnegative:()=>N$,nonpositive:()=>O$,normalize:()=>Ah,overwrite:()=>Xs,positive:()=>C$,property:()=>D$,regex:()=>vh,size:()=>xd,slugify:()=>Rh,startsWith:()=>xh,toLowerCase:()=>Ih,toUpperCase:()=>Ph,trim:()=>$h,uppercase:()=>Sh});var Z$=S(()=>{En()});var Pl={};Di(Pl,{ZodISODate:()=>K$,ZodISODateTime:()=>J$,ZodISODuration:()=>X$,ZodISOTime:()=>Y$,date:()=>v6,datetime:()=>b6,duration:()=>S6,time:()=>_6});function b6(t){return Ez(J$,t)}function v6(t){return Az(K$,t)}function _6(t){return $z(Y$,t)}function S6(t){return Iz(X$,t)}var J$,K$,Y$,X$,zv=S(()=>{En();Bv();J$=N("ZodISODateTime",(t,e)=>{uz.init(t,e),Vt.init(t,e)});K$=N("ZodISODate",(t,e)=>{dz.init(t,e),Vt.init(t,e)});Y$=N("ZodISOTime",(t,e)=>{pz.init(t,e),Vt.init(t,e)});X$=N("ZodISODuration",(t,e)=>{fz.init(t,e),Vt.init(t,e)})});var wse,q4e,bi,w6=S(()=>{En();En();_e();wse=(t,e)=>{ov.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>cv(t,r)},flatten:{value:r=>av(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,ih,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,ih,2)}},isEmpty:{get(){return t.issues.length===0}}})},q4e=N("ZodError",wse),bi=N("ZodError",wse,{Parent:Error})});var x6,k6,E6,A6,$6,I6,P6,R6,C6,T6,O6,N6,D6=S(()=>{En();w6();x6=ah(bi),k6=ch(bi),E6=lh(bi),A6=uh(bi),$6=LE(bi),I6=ME(bi),P6=FE(bi),R6=zE(bi),C6=UE(bi),T6=BE(bi),O6=qE(bi),N6=VE(bi)});var Uv={};Di(Uv,{ZodAny:()=>z6,ZodArray:()=>V6,ZodBase64:()=>hI,ZodBase64URL:()=>mI,ZodBigInt:()=>Fh,ZodBigIntFormat:()=>bI,ZodBoolean:()=>Mh,ZodCIDRv4:()=>pI,ZodCIDRv6:()=>fI,ZodCUID:()=>sI,ZodCUID2:()=>oI,ZodCatch:()=>uU,ZodCodec:()=>Qv,ZodCustom:()=>e_,ZodCustomStringFormat:()=>jh,ZodDate:()=>Zv,ZodDefault:()=>iU,ZodDiscriminatedUnion:()=>H6,ZodE164:()=>gI,ZodEmail:()=>rI,ZodEmoji:()=>nI,ZodEnum:()=>Nh,ZodExactOptional:()=>tU,ZodFile:()=>Q6,ZodFunction:()=>_U,ZodGUID:()=>qv,ZodIPv4:()=>uI,ZodIPv6:()=>dI,ZodIntersection:()=>W6,ZodJWT:()=>yI,ZodKSUID:()=>lI,ZodLazy:()=>yU,ZodLiteral:()=>X6,ZodMAC:()=>j6,ZodMap:()=>K6,ZodNaN:()=>pU,ZodNanoID:()=>iI,ZodNever:()=>B6,ZodNonOptional:()=>SI,ZodNull:()=>F6,ZodNullable:()=>nU,ZodNumber:()=>Lh,ZodNumberFormat:()=>Id,ZodObject:()=>Jv,ZodOptional:()=>Uh,ZodPipe:()=>Xv,ZodPrefault:()=>oU,ZodPreprocess:()=>fU,ZodPromise:()=>vU,ZodReadonly:()=>hU,ZodRecord:()=>Oh,ZodSet:()=>Y6,ZodString:()=>Dh,ZodStringFormat:()=>Vt,ZodSuccess:()=>lU,ZodSymbol:()=>L6,ZodTemplateLiteral:()=>gU,ZodTransform:()=>eU,ZodTuple:()=>Z6,ZodType:()=>qe,ZodULID:()=>aI,ZodURL:()=>Hv,ZodUUID:()=>Yo,ZodUndefined:()=>M6,ZodUnion:()=>Kv,ZodUnknown:()=>U6,ZodVoid:()=>q6,ZodXID:()=>cI,ZodXor:()=>G6,_ZodString:()=>tI,_default:()=>sU,_function:()=>Aoe,any:()=>aoe,array:()=>Qe,base64:()=>Vse,base64url:()=>Gse,bigint:()=>roe,boolean:()=>Ar,catch:()=>dU,check:()=>$oe,cidrv4:()=>Bse,cidrv6:()=>qse,codec:()=>woe,cuid:()=>Nse,cuid2:()=>Dse,custom:()=>wI,date:()=>loe,describe:()=>Ioe,discriminatedUnion:()=>Yv,e164:()=>Hse,email:()=>kse,emoji:()=>Tse,enum:()=>pn,exactOptional:()=>rU,file:()=>boe,float32:()=>Xse,float64:()=>Qse,function:()=>Aoe,guid:()=>Ese,hash:()=>Yse,hex:()=>Kse,hostname:()=>Jse,httpUrl:()=>Cse,instanceof:()=>Roe,int:()=>Q$,int32:()=>eoe,int64:()=>noe,intersection:()=>zh,invertCodec:()=>xoe,ipv4:()=>Fse,ipv6:()=>Use,json:()=>Toe,jwt:()=>Wse,keyof:()=>uoe,ksuid:()=>Mse,lazy:()=>bU,literal:()=>ke,looseObject:()=>dn,looseRecord:()=>hoe,mac:()=>zse,map:()=>moe,meta:()=>Poe,nan:()=>Soe,nanoid:()=>Ose,nativeEnum:()=>yoe,never:()=>vI,nonoptional:()=>cU,null:()=>Wv,nullable:()=>Vv,nullish:()=>voe,number:()=>yt,object:()=>pe,optional:()=>Kt,partialRecord:()=>foe,pipe:()=>eI,prefault:()=>aU,preprocess:()=>t_,promise:()=>Eoe,readonly:()=>mU,record:()=>Lt,refine:()=>SU,set:()=>goe,strictObject:()=>doe,string:()=>M,stringFormat:()=>Zse,stringbool:()=>Coe,success:()=>_oe,superRefine:()=>wU,symbol:()=>soe,templateLiteral:()=>koe,transform:()=>_I,tuple:()=>J6,uint32:()=>toe,uint64:()=>ioe,ulid:()=>jse,undefined:()=>ooe,union:()=>Ht,unknown:()=>Gt,url:()=>Rse,uuid:()=>Ase,uuidv4:()=>$se,uuidv6:()=>Ise,uuidv7:()=>Pse,void:()=>coe,xid:()=>Lse,xor:()=>poe});function Gv(t,e,r){let n=Object.getPrototypeOf(t),i=xse.get(n);if(i||(i=new Set,xse.set(n,i)),!i.has(e)){i.add(e);for(let s in r){let o=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let a=o.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}function M(t){return u$(Dh,t)}function kse(t){return vv(rI,t)}function Ese(t){return yh(qv,t)}function Ase(t){return _v(Yo,t)}function $se(t){return Sv(Yo,t)}function Ise(t){return wv(Yo,t)}function Pse(t){return xv(Yo,t)}function Rse(t){return bh(Hv,t)}function Cse(t){return bh(Hv,{protocol:yi.httpProtocol,hostname:yi.domain,...K.normalizeParams(t)})}function Tse(t){return kv(nI,t)}function Ose(t){return Ev(iI,t)}function Nse(t){return Av(sI,t)}function Dse(t){return $v(oI,t)}function jse(t){return Iv(aI,t)}function Lse(t){return Pv(cI,t)}function Mse(t){return Rv(lI,t)}function Fse(t){return Cv(uI,t)}function zse(t){return d$(j6,t)}function Use(t){return Tv(dI,t)}function Bse(t){return Ov(pI,t)}function qse(t){return Nv(fI,t)}function Vse(t){return Dv(hI,t)}function Gse(t){return jv(mI,t)}function Hse(t){return Lv(gI,t)}function Wse(t){return Mv(yI,t)}function Zse(t,e,r={}){return Ad(jh,t,e,r)}function Jse(t){return Ad(jh,"hostname",yi.hostname,t)}function Kse(t){return Ad(jh,"hex",yi.hex,t)}function Yse(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,i=yi[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return Ad(jh,n,i,e)}function yt(t){return p$(Lh,t)}function Q$(t){return f$(Id,t)}function Xse(t){return h$(Id,t)}function Qse(t){return m$(Id,t)}function eoe(t){return g$(Id,t)}function toe(t){return y$(Id,t)}function Ar(t){return b$(Mh,t)}function roe(t){return v$(Fh,t)}function noe(t){return _$(bI,t)}function ioe(t){return S$(bI,t)}function soe(t){return w$(L6,t)}function ooe(t){return x$(M6,t)}function Wv(t){return k$(F6,t)}function aoe(){return E$(z6)}function Gt(){return A$(U6)}function vI(t){return $$(B6,t)}function coe(t){return I$(q6,t)}function loe(t){return P$(Zv,t)}function Qe(t,e){return Oz(V6,t,e)}function uoe(t){let e=t._zod.def.shape;return pn(Object.keys(e))}function pe(t,e){let r={type:"object",shape:t??{},...K.normalizeParams(e)};return new Jv(r)}function doe(t,e){return new Jv({type:"object",shape:t,catchall:vI(),...K.normalizeParams(e)})}function dn(t,e){return new Jv({type:"object",shape:t,catchall:Gt(),...K.normalizeParams(e)})}function Ht(t,e){return new Kv({type:"union",options:t,...K.normalizeParams(e)})}function poe(t,e){return new G6({type:"union",options:t,inclusive:!1,...K.normalizeParams(e)})}function Yv(t,e,r){return new H6({type:"union",options:e,discriminator:t,...K.normalizeParams(r)})}function zh(t,e){return new W6({type:"intersection",left:t,right:e})}function J6(t,e,r){let n=e instanceof Le,i=n?r:e,s=n?e:null;return new Z6({type:"tuple",items:t,rest:s,...K.normalizeParams(i)})}function Lt(t,e,r){return!e||!e._zod?new Oh({type:"record",keyType:M(),valueType:t,...K.normalizeParams(e)}):new Oh({type:"record",keyType:t,valueType:e,...K.normalizeParams(r)})}function foe(t,e,r){let n=ln(t);return n._zod.values=void 0,new Oh({type:"record",keyType:n,valueType:e,...K.normalizeParams(r)})}function hoe(t,e,r){return new Oh({type:"record",keyType:t,valueType:e,mode:"loose",...K.normalizeParams(r)})}function moe(t,e,r){return new K6({type:"map",keyType:t,valueType:e,...K.normalizeParams(r)})}function goe(t,e){return new Y6({type:"set",valueType:t,...K.normalizeParams(e)})}function pn(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Nh({type:"enum",entries:r,...K.normalizeParams(e)})}function yoe(t,e){return new Nh({type:"enum",entries:t,...K.normalizeParams(e)})}function ke(t,e){return new X6({type:"literal",values:Array.isArray(t)?t:[t],...K.normalizeParams(e)})}function boe(t){return j$(Q6,t)}function _I(t){return new eU({type:"transform",transform:t})}function Kt(t){return new Uh({type:"optional",innerType:t})}function rU(t){return new tU({type:"optional",innerType:t})}function Vv(t){return new nU({type:"nullable",innerType:t})}function voe(t){return Kt(Vv(t))}function sU(t,e){return new iU({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():K.shallowClone(e)}})}function aU(t,e){return new oU({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():K.shallowClone(e)}})}function cU(t,e){return new SI({type:"nonoptional",innerType:t,...K.normalizeParams(e)})}function _oe(t){return new lU({type:"success",innerType:t})}function dU(t,e){return new uU({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function Soe(t){return R$(pU,t)}function eI(t,e){return new Xv({type:"pipe",in:t,out:e})}function woe(t,e,r){return new Qv({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}function xoe(t){let e=t._zod.def;return new Qv({type:"pipe",in:e.out,out:e.in,transform:e.reverseTransform,reverseTransform:e.transform})}function mU(t){return new hU({type:"readonly",innerType:t})}function koe(t,e){return new gU({type:"template_literal",parts:t,...K.normalizeParams(e)})}function bU(t){return new yU({type:"lazy",getter:t})}function Eoe(t){return new vU({type:"promise",innerType:t})}function Aoe(t){return new _U({type:"function",input:Array.isArray(t?.input)?J6(t?.input):t?.input??Qe(Gt()),output:t?.output??Gt()})}function $oe(t){let e=new qt({check:"custom"});return e._zod.check=t,e}function wI(t,e){return L$(e_,t??(()=>!0),e)}function SU(t,e={}){return M$(e_,t,e)}function wU(t,e){return F$(t,e)}function Roe(t,e={}){let r=new e_({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...K.normalizeParams(e)});return r._zod.bag.Class=t,r._zod.check=n=>{n.value instanceof t||n.issues.push({code:"invalid_type",expected:t.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function Toe(t){let e=bU(()=>Ht([M(t),yt(),Ar(),Wv(),Qe(e),Lt(M(),e)]));return e}function t_(t,e){return new fU({type:"pipe",in:_I(t),out:e})}var xse,qe,tI,Dh,Vt,rI,qv,Yo,Hv,nI,iI,sI,oI,aI,cI,lI,uI,j6,dI,pI,fI,hI,mI,gI,yI,jh,Lh,Id,Mh,Fh,bI,L6,M6,F6,z6,U6,B6,q6,Zv,V6,Jv,Kv,G6,H6,W6,Z6,Oh,K6,Y6,Nh,X6,Q6,eU,Uh,tU,nU,iU,oU,SI,lU,uU,pU,Xv,Qv,fU,hU,gU,yU,vU,_U,e_,Ioe,Poe,Coe,Bv=S(()=>{En();En();Th();Fv();Z$();zv();D6();xse=new WeakMap;qe=N("ZodType",(t,e)=>(Le.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Ch(t,"input"),output:Ch(t,"output")}}),t.toJSONSchema=Nz(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,n)=>x6(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>E6(t,r,n),t.parseAsync=async(r,n)=>k6(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>A6(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>$6(t,r,n),t.decode=(r,n)=>I6(t,r,n),t.encodeAsync=async(r,n)=>P6(t,r,n),t.decodeAsync=async(r,n)=>R6(t,r,n),t.safeEncode=(r,n)=>C6(t,r,n),t.safeDecode=(r,n)=>T6(t,r,n),t.safeEncodeAsync=async(r,n)=>O6(t,r,n),t.safeDecodeAsync=async(r,n)=>N6(t,r,n),Gv(t,"ZodType",{check(...r){let n=this.def;return this.clone(K.mergeDefs(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return ln(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(SU(r,n))},superRefine(r,n){return this.check(wU(r,n))},overwrite(r){return this.check(Xs(r))},optional(){return Kt(this)},exactOptional(){return rU(this)},nullable(){return Vv(this)},nullish(){return Kt(Vv(this))},nonoptional(r){return cU(this,r)},array(){return Qe(this)},or(r){return Ht([this,r])},and(r){return zh(this,r)},transform(r){return eI(this,_I(r))},default(r){return sU(this,r)},prefault(r){return aU(this,r)},catch(r){return dU(this,r)},pipe(r){return eI(this,r)},readonly(){return mU(this)},describe(r){let n=this.clone();return un.add(n,{description:r}),n},meta(...r){if(r.length===0)return un.get(this);let n=this.clone();return un.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return un.get(t)?.description},configurable:!0}),t)),tI=N("_ZodString",(t,e)=>{xl.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Dz(t,n,i,s);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,Gv(t,"_ZodString",{regex(...n){return this.check(vh(...n))},includes(...n){return this.check(wh(...n))},startsWith(...n){return this.check(xh(...n))},endsWith(...n){return this.check(kh(...n))},min(...n){return this.check(Xa(...n))},max(...n){return this.check(kd(...n))},length(...n){return this.check(Ed(...n))},nonempty(...n){return this.check(Xa(1,...n))},lowercase(n){return this.check(_h(n))},uppercase(n){return this.check(Sh(n))},trim(){return this.check($h())},normalize(...n){return this.check(Ah(...n))},toLowerCase(){return this.check(Ih())},toUpperCase(){return this.check(Ph())},slugify(){return this.check(Rh())}})}),Dh=N("ZodString",(t,e)=>{xl.init(t,e),tI.init(t,e),t.email=r=>t.check(vv(rI,r)),t.url=r=>t.check(bh(Hv,r)),t.jwt=r=>t.check(Mv(yI,r)),t.emoji=r=>t.check(kv(nI,r)),t.guid=r=>t.check(yh(qv,r)),t.uuid=r=>t.check(_v(Yo,r)),t.uuidv4=r=>t.check(Sv(Yo,r)),t.uuidv6=r=>t.check(wv(Yo,r)),t.uuidv7=r=>t.check(xv(Yo,r)),t.nanoid=r=>t.check(Ev(iI,r)),t.guid=r=>t.check(yh(qv,r)),t.cuid=r=>t.check(Av(sI,r)),t.cuid2=r=>t.check($v(oI,r)),t.ulid=r=>t.check(Iv(aI,r)),t.base64=r=>t.check(Dv(hI,r)),t.base64url=r=>t.check(jv(mI,r)),t.xid=r=>t.check(Pv(cI,r)),t.ksuid=r=>t.check(Rv(lI,r)),t.ipv4=r=>t.check(Cv(uI,r)),t.ipv6=r=>t.check(Tv(dI,r)),t.cidrv4=r=>t.check(Ov(pI,r)),t.cidrv6=r=>t.check(Nv(fI,r)),t.e164=r=>t.check(Lv(gI,r)),t.datetime=r=>t.check(b6(r)),t.date=r=>t.check(v6(r)),t.time=r=>t.check(_6(r)),t.duration=r=>t.check(S6(r))});Vt=N("ZodStringFormat",(t,e)=>{jt.init(t,e),tI.init(t,e)}),rI=N("ZodEmail",(t,e)=>{nA.init(t,e),Vt.init(t,e)});qv=N("ZodGUID",(t,e)=>{tA.init(t,e),Vt.init(t,e)});Yo=N("ZodUUID",(t,e)=>{rA.init(t,e),Vt.init(t,e)});Hv=N("ZodURL",(t,e)=>{iA.init(t,e),Vt.init(t,e)});nI=N("ZodEmoji",(t,e)=>{sA.init(t,e),Vt.init(t,e)});iI=N("ZodNanoID",(t,e)=>{oA.init(t,e),Vt.init(t,e)});sI=N("ZodCUID",(t,e)=>{aA.init(t,e),Vt.init(t,e)});oI=N("ZodCUID2",(t,e)=>{cA.init(t,e),Vt.init(t,e)});aI=N("ZodULID",(t,e)=>{lA.init(t,e),Vt.init(t,e)});cI=N("ZodXID",(t,e)=>{uA.init(t,e),Vt.init(t,e)});lI=N("ZodKSUID",(t,e)=>{dA.init(t,e),Vt.init(t,e)});uI=N("ZodIPv4",(t,e)=>{pA.init(t,e),Vt.init(t,e)});j6=N("ZodMAC",(t,e)=>{hA.init(t,e),Vt.init(t,e)});dI=N("ZodIPv6",(t,e)=>{fA.init(t,e),Vt.init(t,e)});pI=N("ZodCIDRv4",(t,e)=>{mA.init(t,e),Vt.init(t,e)});fI=N("ZodCIDRv6",(t,e)=>{gA.init(t,e),Vt.init(t,e)});hI=N("ZodBase64",(t,e)=>{yA.init(t,e),Vt.init(t,e)});mI=N("ZodBase64URL",(t,e)=>{bA.init(t,e),Vt.init(t,e)});gI=N("ZodE164",(t,e)=>{vA.init(t,e),Vt.init(t,e)});yI=N("ZodJWT",(t,e)=>{_A.init(t,e),Vt.init(t,e)});jh=N("ZodCustomStringFormat",(t,e)=>{SA.init(t,e),Vt.init(t,e)});Lh=N("ZodNumber",(t,e)=>{pv.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(n,i,s)=>jz(t,n,i,s),Gv(t,"ZodNumber",{gt(n,i){return this.check(Jo(n,i))},gte(n,i){return this.check(Jn(n,i))},min(n,i){return this.check(Jn(n,i))},lt(n,i){return this.check(Zo(n,i))},lte(n,i){return this.check(Ui(n,i))},max(n,i){return this.check(Ui(n,i))},int(n){return this.check(Q$(n))},safe(n){return this.check(Q$(n))},positive(n){return this.check(Jo(0,n))},nonnegative(n){return this.check(Jn(0,n))},negative(n){return this.check(Zo(0,n))},nonpositive(n){return this.check(Ui(0,n))},multipleOf(n,i){return this.check(kl(n,i))},step(n,i){return this.check(kl(n,i))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});Id=N("ZodNumberFormat",(t,e)=>{wA.init(t,e),Lh.init(t,e)});Mh=N("ZodBoolean",(t,e)=>{ph.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Lz(t,r,n,i)});Fh=N("ZodBigInt",(t,e)=>{fv.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Mz(t,n,i,s),t.gte=(n,i)=>t.check(Jn(n,i)),t.min=(n,i)=>t.check(Jn(n,i)),t.gt=(n,i)=>t.check(Jo(n,i)),t.gte=(n,i)=>t.check(Jn(n,i)),t.min=(n,i)=>t.check(Jn(n,i)),t.lt=(n,i)=>t.check(Zo(n,i)),t.lte=(n,i)=>t.check(Ui(n,i)),t.max=(n,i)=>t.check(Ui(n,i)),t.positive=n=>t.check(Jo(BigInt(0),n)),t.negative=n=>t.check(Zo(BigInt(0),n)),t.nonpositive=n=>t.check(Ui(BigInt(0),n)),t.nonnegative=n=>t.check(Jn(BigInt(0),n)),t.multipleOf=(n,i)=>t.check(kl(n,i));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});bI=N("ZodBigIntFormat",(t,e)=>{xA.init(t,e),Fh.init(t,e)});L6=N("ZodSymbol",(t,e)=>{kA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Fz(t,r,n,i)});M6=N("ZodUndefined",(t,e)=>{EA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Uz(t,r,n,i)});F6=N("ZodNull",(t,e)=>{AA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>zz(t,r,n,i)});z6=N("ZodAny",(t,e)=>{$A.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Vz(t,r,n,i)});U6=N("ZodUnknown",(t,e)=>{IA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Gz(t,r,n,i)});B6=N("ZodNever",(t,e)=>{PA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>qz(t,r,n,i)});q6=N("ZodVoid",(t,e)=>{RA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Bz(t,r,n,i)});Zv=N("ZodDate",(t,e)=>{CA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Hz(t,n,i,s),t.min=(n,i)=>t.check(Jn(n,i)),t.max=(n,i)=>t.check(Ui(n,i));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});V6=N("ZodArray",(t,e)=>{TA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>i6(t,r,n,i),t.element=e.element,Gv(t,"ZodArray",{min(r,n){return this.check(Xa(r,n))},nonempty(r){return this.check(Xa(1,r))},max(r,n){return this.check(kd(r,n))},length(r,n){return this.check(Ed(r,n))},unwrap(){return this.element}})});Jv=N("ZodObject",(t,e)=>{mz.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>s6(t,r,n,i),K.defineLazy(t,"shape",()=>e.shape),Gv(t,"ZodObject",{keyof(){return pn(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Gt()})},loose(){return this.clone({...this._zod.def,catchall:Gt()})},strict(){return this.clone({...this._zod.def,catchall:vI()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return K.extend(this,r)},safeExtend(r){return K.safeExtend(this,r)},merge(r){return K.merge(this,r)},pick(r){return K.pick(this,r)},omit(r){return K.omit(this,r)},partial(...r){return K.partial(Uh,this,r[0])},required(...r){return K.required(SI,this,r[0])}})});Kv=N("ZodUnion",(t,e)=>{fh.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>V$(t,r,n,i),t.options=e.options});G6=N("ZodXor",(t,e)=>{Kv.init(t,e),NA.init(t,e),t._zod.processJSONSchema=(r,n,i)=>V$(t,r,n,i),t.options=e.options});H6=N("ZodDiscriminatedUnion",(t,e)=>{Kv.init(t,e),DA.init(t,e)});W6=N("ZodIntersection",(t,e)=>{jA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>o6(t,r,n,i)});Z6=N("ZodTuple",(t,e)=>{hv.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>a6(t,r,n,i),t.rest=r=>t.clone({...t._zod.def,rest:r})});Oh=N("ZodRecord",(t,e)=>{LA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>c6(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType});K6=N("ZodMap",(t,e)=>{MA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>r6(t,r,n,i),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...r)=>t.check(Ko(...r)),t.nonempty=r=>t.check(Ko(1,r)),t.max=(...r)=>t.check(El(...r)),t.size=(...r)=>t.check(xd(...r))});Y6=N("ZodSet",(t,e)=>{FA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>n6(t,r,n,i),t.min=(...r)=>t.check(Ko(...r)),t.nonempty=r=>t.check(Ko(1,r)),t.max=(...r)=>t.check(El(...r)),t.size=(...r)=>t.check(xd(...r))});Nh=N("ZodEnum",(t,e)=>{zA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(n,i,s)=>Wz(t,n,i,s),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{let s={};for(let o of n)if(r.has(o))s[o]=e.entries[o];else throw new Error(`Key ${o} not found in enum`);return new Nh({...e,checks:[],...K.normalizeParams(i),entries:s})},t.exclude=(n,i)=>{let s={...e.entries};for(let o of n)if(r.has(o))delete s[o];else throw new Error(`Key ${o} not found in enum`);return new Nh({...e,checks:[],...K.normalizeParams(i),entries:s})}});X6=N("ZodLiteral",(t,e)=>{UA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Zz(t,r,n,i),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});Q6=N("ZodFile",(t,e)=>{BA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Yz(t,r,n,i),t.min=(r,n)=>t.check(Ko(r,n)),t.max=(r,n)=>t.check(El(r,n)),t.mime=(r,n)=>t.check(Eh(Array.isArray(r)?r:[r],n))});eU=N("ZodTransform",(t,e)=>{qA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>t6(t,r,n,i),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gl(t.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(K.issue(s,r.value,e));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),r.issues.push(K.issue(o))}};let i=e.transform(r.value,r);return i instanceof Promise?i.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});Uh=N("ZodOptional",(t,e)=>{mv.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>G$(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});tU=N("ZodExactOptional",(t,e)=>{VA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>G$(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});nU=N("ZodNullable",(t,e)=>{GA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>l6(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});iU=N("ZodDefault",(t,e)=>{HA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>d6(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});oU=N("ZodPrefault",(t,e)=>{WA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>p6(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});SI=N("ZodNonOptional",(t,e)=>{ZA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>u6(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});lU=N("ZodSuccess",(t,e)=>{JA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Xz(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});uU=N("ZodCatch",(t,e)=>{KA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>f6(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});pU=N("ZodNaN",(t,e)=>{YA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Jz(t,r,n,i)});Xv=N("ZodPipe",(t,e)=>{gv.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>h6(t,r,n,i),t.in=e.in,t.out=e.out});Qv=N("ZodCodec",(t,e)=>{Xv.init(t,e),hh.init(t,e)});fU=N("ZodPreprocess",(t,e)=>{Xv.init(t,e),gz.init(t,e)}),hU=N("ZodReadonly",(t,e)=>{XA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>m6(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});gU=N("ZodTemplateLiteral",(t,e)=>{QA.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Kz(t,r,n,i)});yU=N("ZodLazy",(t,e)=>{r$.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>y6(t,r,n,i),t.unwrap=()=>t._zod.def.getter()});vU=N("ZodPromise",(t,e)=>{t$.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>g6(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});_U=N("ZodFunction",(t,e)=>{e$.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>e6(t,r,n,i)});e_=N("ZodCustom",(t,e)=>{n$.init(t,e),qe.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Qz(t,r,n,i)});Ioe=z$,Poe=U$;Coe=(...t)=>B$({Codec:Qv,Boolean:Mh,String:Dh},...t)});function H4e(t){br({customError:t})}function W4e(){return br().customError}var G4e,xU,Ooe=S(()=>{En();G4e={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};xU||(xU={})});function J4e(t,e){let r=t.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function K4e(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=t.slice(1).split("/").filter(Boolean);if(r.length===0)return e.rootSchema;let n=e.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!e.defs[i])throw new Error(`Reference not found: ${t}`);return e.defs[i]}throw new Error(`Reference not found: ${t}`)}function Noe(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return ce.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let i=t.$ref;if(e.refs.has(i))return e.refs.get(i);if(e.processing.has(i))return ce.lazy(()=>{if(!e.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return e.refs.get(i)});e.processing.add(i);let s=K4e(i,e),o=An(s,e);return e.refs.set(i,o),e.processing.delete(i),o}if(t.enum!==void 0){let i=t.enum;if(e.version==="openapi-3.0"&&t.nullable===!0&&i.length===1&&i[0]===null)return ce.null();if(i.length===0)return ce.never();if(i.length===1)return ce.literal(i[0]);if(i.every(o=>typeof o=="string"))return ce.enum(i);let s=i.map(o=>ce.literal(o));return s.length<2?s[0]:ce.union([s[0],s[1],...s.slice(2)])}if(t.const!==void 0)return ce.literal(t.const);let r=t.type;if(Array.isArray(r)){let i=r.map(s=>{let o={...t,type:s};return Noe(o,e)});return i.length===0?ce.never():i.length===1?i[0]:ce.union(i)}if(!r)return ce.any();let n;switch(r){case"string":{let i=ce.string();if(t.format){let s=t.format;s==="email"?i=i.check(ce.email()):s==="uri"||s==="uri-reference"?i=i.check(ce.url()):s==="uuid"||s==="guid"?i=i.check(ce.uuid()):s==="date-time"?i=i.check(ce.iso.datetime()):s==="date"?i=i.check(ce.iso.date()):s==="time"?i=i.check(ce.iso.time()):s==="duration"?i=i.check(ce.iso.duration()):s==="ipv4"?i=i.check(ce.ipv4()):s==="ipv6"?i=i.check(ce.ipv6()):s==="mac"?i=i.check(ce.mac()):s==="cidr"?i=i.check(ce.cidrv4()):s==="cidr-v6"?i=i.check(ce.cidrv6()):s==="base64"?i=i.check(ce.base64()):s==="base64url"?i=i.check(ce.base64url()):s==="e164"?i=i.check(ce.e164()):s==="jwt"?i=i.check(ce.jwt()):s==="emoji"?i=i.check(ce.emoji()):s==="nanoid"?i=i.check(ce.nanoid()):s==="cuid"?i=i.check(ce.cuid()):s==="cuid2"?i=i.check(ce.cuid2()):s==="ulid"?i=i.check(ce.ulid()):s==="xid"?i=i.check(ce.xid()):s==="ksuid"&&(i=i.check(ce.ksuid()))}typeof t.minLength=="number"&&(i=i.min(t.minLength)),typeof t.maxLength=="number"&&(i=i.max(t.maxLength)),t.pattern&&(i=i.regex(new RegExp(t.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?ce.number().int():ce.number();typeof t.minimum=="number"&&(i=i.min(t.minimum)),typeof t.maximum=="number"&&(i=i.max(t.maximum)),typeof t.exclusiveMinimum=="number"?i=i.gt(t.exclusiveMinimum):t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(i=i.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?i=i.lt(t.exclusiveMaximum):t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(i=i.lt(t.maximum)),typeof t.multipleOf=="number"&&(i=i.multipleOf(t.multipleOf)),n=i;break}case"boolean":{n=ce.boolean();break}case"null":{n=ce.null();break}case"object":{let i={},s=t.properties||{},o=new Set(t.required||[]);for(let[c,l]of Object.entries(s)){let u=An(l,e);i[c]=o.has(c)?u:u.optional()}if(t.propertyNames){let c=An(t.propertyNames,e),l=t.additionalProperties&&typeof t.additionalProperties=="object"?An(t.additionalProperties,e):ce.any();if(Object.keys(i).length===0){n=ce.record(c,l);break}let u=ce.object(i).passthrough(),d=ce.looseRecord(c,l);n=ce.intersection(u,d);break}if(t.patternProperties){let c=t.patternProperties,l=Object.keys(c),u=[];for(let p of l){let f=An(c[p],e),h=ce.string().regex(new RegExp(p));u.push(ce.looseRecord(h,f))}let d=[];if(Object.keys(i).length>0&&d.push(ce.object(i).passthrough()),d.push(...u),d.length===0)n=ce.object({}).passthrough();else if(d.length===1)n=d[0];else{let p=ce.intersection(d[0],d[1]);for(let f=2;fAn(c,e)),a=s&&typeof s=="object"&&!Array.isArray(s)?An(s,e):void 0;a?n=ce.tuple(o).rest(a):n=ce.tuple(o),typeof t.minItems=="number"&&(n=n.check(ce.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(ce.maxLength(t.maxItems)))}else if(Array.isArray(s)){let o=s.map(c=>An(c,e)),a=t.additionalItems&&typeof t.additionalItems=="object"?An(t.additionalItems,e):void 0;a?n=ce.tuple(o).rest(a):n=ce.tuple(o),typeof t.minItems=="number"&&(n=n.check(ce.minLength(t.minItems))),typeof t.maxItems=="number"&&(n=n.check(ce.maxLength(t.maxItems)))}else if(s!==void 0){let o=An(s,e),a=ce.array(o);typeof t.minItems=="number"&&(a=a.min(t.minItems)),typeof t.maxItems=="number"&&(a=a.max(t.maxItems)),n=a}else n=ce.array(ce.any());break}default:throw new Error(`Unsupported type: ${r}`)}return n}function An(t,e){if(typeof t=="boolean")return t?ce.any():ce.never();let r=Noe(t,e),n=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let a=t.anyOf.map(l=>An(l,e)),c=ce.union(a);r=n?ce.intersection(r,c):c}if(t.oneOf&&Array.isArray(t.oneOf)){let a=t.oneOf.map(l=>An(l,e)),c=ce.xor(a);r=n?ce.intersection(r,c):c}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)r=n?r:ce.any();else{let a=n?r:An(t.allOf[0],e),c=n?0:1;for(let l=c;l0&&e.registry.add(r,i),t.description&&(r=r.describe(t.description)),r}function Doe(t,e){if(typeof t=="boolean")return t?ce.any():ce.never();let r;try{r=JSON.parse(JSON.stringify(t))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=J4e(r,e?.defaultTarget),i=r.$defs||r.definitions||{},s={version:n,defs:i,refs:new Map,processing:new Set,rootSchema:r,registry:e?.registry??un};return An(r,s)}var ce,Z4e,joe=S(()=>{bv();Z$();zv();Bv();ce={...Uv,...W$,iso:Pl},Z4e=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"])});var kU={};Di(kU,{bigint:()=>eBe,boolean:()=>Q4e,date:()=>tBe,number:()=>X4e,string:()=>Y4e});function Y4e(t){return xz(Dh,t)}function X4e(t){return Pz(Lh,t)}function Q4e(t){return Rz(Mh,t)}function eBe(t){return Cz(Fh,t)}function tBe(t){return Tz(Zv,t)}var Loe=S(()=>{En();Bv()});var _={};Di(_,{$brand:()=>XM,$input:()=>wz,$output:()=>Sz,NEVER:()=>YM,TimePrecision:()=>kz,ZodAny:()=>z6,ZodArray:()=>V6,ZodBase64:()=>hI,ZodBase64URL:()=>mI,ZodBigInt:()=>Fh,ZodBigIntFormat:()=>bI,ZodBoolean:()=>Mh,ZodCIDRv4:()=>pI,ZodCIDRv6:()=>fI,ZodCUID:()=>sI,ZodCUID2:()=>oI,ZodCatch:()=>uU,ZodCodec:()=>Qv,ZodCustom:()=>e_,ZodCustomStringFormat:()=>jh,ZodDate:()=>Zv,ZodDefault:()=>iU,ZodDiscriminatedUnion:()=>H6,ZodE164:()=>gI,ZodEmail:()=>rI,ZodEmoji:()=>nI,ZodEnum:()=>Nh,ZodError:()=>q4e,ZodExactOptional:()=>tU,ZodFile:()=>Q6,ZodFirstPartyTypeKind:()=>xU,ZodFunction:()=>_U,ZodGUID:()=>qv,ZodIPv4:()=>uI,ZodIPv6:()=>dI,ZodISODate:()=>K$,ZodISODateTime:()=>J$,ZodISODuration:()=>X$,ZodISOTime:()=>Y$,ZodIntersection:()=>W6,ZodIssueCode:()=>G4e,ZodJWT:()=>yI,ZodKSUID:()=>lI,ZodLazy:()=>yU,ZodLiteral:()=>X6,ZodMAC:()=>j6,ZodMap:()=>K6,ZodNaN:()=>pU,ZodNanoID:()=>iI,ZodNever:()=>B6,ZodNonOptional:()=>SI,ZodNull:()=>F6,ZodNullable:()=>nU,ZodNumber:()=>Lh,ZodNumberFormat:()=>Id,ZodObject:()=>Jv,ZodOptional:()=>Uh,ZodPipe:()=>Xv,ZodPrefault:()=>oU,ZodPreprocess:()=>fU,ZodPromise:()=>vU,ZodReadonly:()=>hU,ZodRealError:()=>bi,ZodRecord:()=>Oh,ZodSet:()=>Y6,ZodString:()=>Dh,ZodStringFormat:()=>Vt,ZodSuccess:()=>lU,ZodSymbol:()=>L6,ZodTemplateLiteral:()=>gU,ZodTransform:()=>eU,ZodTuple:()=>Z6,ZodType:()=>qe,ZodULID:()=>aI,ZodURL:()=>Hv,ZodUUID:()=>Yo,ZodUndefined:()=>M6,ZodUnion:()=>Kv,ZodUnknown:()=>U6,ZodVoid:()=>q6,ZodXID:()=>cI,ZodXor:()=>G6,_ZodString:()=>tI,_default:()=>sU,_function:()=>Aoe,any:()=>aoe,array:()=>Qe,base64:()=>Vse,base64url:()=>Gse,bigint:()=>roe,boolean:()=>Ar,catch:()=>dU,check:()=>$oe,cidrv4:()=>Bse,cidrv6:()=>qse,clone:()=>ln,codec:()=>woe,coerce:()=>kU,config:()=>br,core:()=>Qs,cuid:()=>Nse,cuid2:()=>Dse,custom:()=>wI,date:()=>loe,decode:()=>I6,decodeAsync:()=>R6,describe:()=>Ioe,discriminatedUnion:()=>Yv,e164:()=>Hse,email:()=>kse,emoji:()=>Tse,encode:()=>$6,encodeAsync:()=>P6,endsWith:()=>kh,enum:()=>pn,exactOptional:()=>rU,file:()=>boe,flattenError:()=>av,float32:()=>Xse,float64:()=>Qse,formatError:()=>cv,fromJSONSchema:()=>Doe,function:()=>Aoe,getErrorMap:()=>W4e,globalRegistry:()=>un,gt:()=>Jo,gte:()=>Jn,guid:()=>Ese,hash:()=>Yse,hex:()=>Kse,hostname:()=>Jse,httpUrl:()=>Cse,includes:()=>wh,instanceof:()=>Roe,int:()=>Q$,int32:()=>eoe,int64:()=>noe,intersection:()=>zh,invertCodec:()=>xoe,ipv4:()=>Fse,ipv6:()=>Use,iso:()=>Pl,json:()=>Toe,jwt:()=>Wse,keyof:()=>uoe,ksuid:()=>Mse,lazy:()=>bU,length:()=>Ed,literal:()=>ke,locales:()=>gh,looseObject:()=>dn,looseRecord:()=>hoe,lowercase:()=>_h,lt:()=>Zo,lte:()=>Ui,mac:()=>zse,map:()=>moe,maxLength:()=>kd,maxSize:()=>El,meta:()=>Poe,mime:()=>Eh,minLength:()=>Xa,minSize:()=>Ko,multipleOf:()=>kl,nan:()=>Soe,nanoid:()=>Ose,nativeEnum:()=>yoe,negative:()=>T$,never:()=>vI,nonnegative:()=>N$,nonoptional:()=>cU,nonpositive:()=>O$,normalize:()=>Ah,null:()=>Wv,nullable:()=>Vv,nullish:()=>voe,number:()=>yt,object:()=>pe,optional:()=>Kt,overwrite:()=>Xs,parse:()=>x6,parseAsync:()=>k6,partialRecord:()=>foe,pipe:()=>eI,positive:()=>C$,prefault:()=>aU,preprocess:()=>t_,prettifyError:()=>uF,promise:()=>Eoe,property:()=>D$,readonly:()=>mU,record:()=>Lt,refine:()=>SU,regex:()=>vh,regexes:()=>yi,registry:()=>l$,safeDecode:()=>T6,safeDecodeAsync:()=>N6,safeEncode:()=>C6,safeEncodeAsync:()=>O6,safeParse:()=>E6,safeParseAsync:()=>A6,set:()=>goe,setErrorMap:()=>H4e,size:()=>xd,slugify:()=>Rh,startsWith:()=>xh,strictObject:()=>doe,string:()=>M,stringFormat:()=>Zse,stringbool:()=>Coe,success:()=>_oe,superRefine:()=>wU,symbol:()=>soe,templateLiteral:()=>koe,toJSONSchema:()=>$d,toLowerCase:()=>Ih,toUpperCase:()=>Ph,transform:()=>_I,treeifyError:()=>lF,trim:()=>$h,tuple:()=>J6,uint32:()=>toe,uint64:()=>ioe,ulid:()=>jse,undefined:()=>ooe,union:()=>Ht,unknown:()=>Gt,uppercase:()=>Sh,url:()=>Rse,util:()=>K,uuid:()=>Ase,uuidv4:()=>$se,uuidv6:()=>Ise,uuidv7:()=>Pse,void:()=>coe,xid:()=>Lse,xor:()=>poe});var xI=S(()=>{En();Bv();Z$();w6();D6();Ooe();En();bz();En();Th();joe();a$();zv();zv();Loe();br(i$())});var kI=S(()=>{xI();xI()});import{lstatSync as rBe}from"node:fs";import{join as nBe,resolve as Foe}from"node:path";function EI(t){return iBe.get(t)}function Moe(t,e){try{let r=rBe(nBe(t,e));return r.isSymbolicLink()?"symlink":r.isDirectory()?"directory":r.isFile()?"file":"other"}catch{return"absent"}}function Uoe(t){return zoe.map(e=>{let{oldPath:r,newPath:n}=EI(e),i=Moe(t,r),s=Moe(t,n),o=[...i==="file"||i==="absent"?[]:[{path:r,kind:i}],...s==="file"||s==="absent"?[]:[{path:n,kind:s}]];return{id:e,oldPath:r,newPath:n,presence:i==="file"&&s==="file"?"both":s==="file"?"new":i==="file"?"old":"none",irregular:o}})}function Boe(t){let e=t.filter(r=>r.presence!=="none");return e.length>0&&e.every(r=>r.presence==="new")?"new":"old"}function qoe(t,e){let r=t.presence==="both"?void 0:t.presence==="new"||t.presence==="none"&&e==="new"?t.newPath:t.oldPath;return{id:t.id,oldPath:t.oldPath,newPath:t.newPath,presence:t.presence,...r===void 0?{}:{resolvedPath:r},irregular:t.irregular}}function Bh(t,e){let r=Uoe(Foe(t)),n=Boe(r);return qoe(r.find(i=>i.id===e),n)}function AI(t,e){let r=Bh(t,e);return r.resolvedPath??r.oldPath}function Pd(t,e){let r=Bh(t,e);if(r.irregular.length>0)throw new q("INVALID_OPERATION",`A generated projection may not be a directory or a symbolic link: ${r_(r.irregular)}.`);if(r.resolvedPath===void 0)throw new q("INVALID_OPERATION",`${r.id} exists at both ${r.oldPath} and ${r.newPath}; remove one copy before writing (see \`clad relocate-generated\`).`);return r.resolvedPath}function r_(t){return t.map(e=>`${e.path} (${e.kind})`).join(", ")}function Rd(t){let e=Uoe(Foe(t)),r=Boe(e),n=e.map(o=>qoe(o,r)),i=n.filter(o=>o.resolvedPath===o.newPath).length;return{state:n.some(o=>o.presence==="both")?"conflict":i===n.length?"new":i===0?"old":"mixed",artifacts:n,pendingMoves:n.filter(o=>o.presence==="old")}}function Voe(t){return new Map(t.artifacts.map(e=>[e.id,e.resolvedPath??e.oldPath]))}function Goe(t){let e=t.artifacts.some(r=>r.presence!=="none");return new Map(t.artifacts.map(r=>[r.id,r.presence==="none"&&!e?r.oldPath:r.newPath]))}var zoe,iBe,Cd=S(()=>{"use strict";_f();kr();zoe=["generated-index","generated-doc-links","generated-attestation"],iBe=new Map(zoe.map(t=>{let e=ck.find(n=>n.id===t);if(e===void 0)throw new Error(`relocatable artifact ${t} is missing from the registry`);let r=e.compatibilityAliases[0];if(r===void 0)throw new Error(`relocatable artifact ${t} declares no relocated alias`);return[t,{oldPath:e.currentPath,newPath:r}]}))});import{createHash as sBe}from"node:crypto";import{existsSync as EU,readFileSync as oBe,readdirSync as Woe,statSync as aBe}from"node:fs";import{join as n_,relative as cBe}from"node:path";function Hoe(t){if(!EU(t))return 0;try{return Woe(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function lBe(t,e){if(!EU(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),s;try{s=Woe(i)}catch{continue}for(let o of s){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let a=n_(i,o),c;try{c=aBe(a)}catch{continue}c.isDirectory()?n.push(a):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&r.push(cBe(e,a).replace(/\\/g,"/"))}}return r.sort()}function Zoe(t="."){return lBe(n_(t,"tests"),t)}function i_(t="."){let e=Zoe(t);return{names:e,count:e.length,digest:sBe("sha256").update(JSON.stringify(e)).digest("hex")}}function Joe(t="."){return i_(t).digest}function uBe(t){let e=n_(t,"spec","capabilities.yaml");if(!EU(e))return 0;try{let r=AU.default.parse(oBe(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function qh(t="."){let e=Hoe(n_(t,"spec","features")),r=Hoe(n_(t,"spec","scenarios")),n=uBe(t),i=Zoe(t).length;return{features:e,scenarios:r,capabilities:n,test_files:i}}function Koe(t,e){let r=t.includes(`\r +`)?`\r +`:` +`,n=t.split(/\r?\n/),i=n.findIndex(d=>/^inventory:\s*$/.test(d)),s=["# 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}`],o=d=>r===`\r +`?d.replace(/\n/g,`\r +`):d;if(i<0){let d=n.join(` +`).replace(/\n+$/,"");return d.length>0&&(d+=` +`),o(`${d} +${s.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(""),o([...l,...s,"",...u.filter((d,p)=>!(p===0&&d.trim()===""))].join(` +`).replace(/\n{3,}/g,` + +`))}var AU,Vh=S(()=>{"use strict";AU=Et(cr(),1);kr()});import{createHash as PU}from"node:crypto";import{existsSync as II,lstatSync as dBe,readFileSync as pBe,readdirSync as nae}from"node:fs";import{join as Rl,relative as Yoe,resolve as PI}from"node:path";function a_(t=".",e={}){for(let r=0;r<12;r++){let n=$I(t),i=i_(t);try{let s=fBe(t,e,i),o=$I(t),a=i_(t);if(JSON.stringify(n)===JSON.stringify(o)&&JSON.stringify(i)===JSON.stringify(a))return s}catch(s){let o=$I(t),a=i_(t);if(JSON.stringify(n)===JSON.stringify(o)&&JSON.stringify(i)===JSON.stringify(a))throw s}}throw new Error("Schema migration preview could not obtain a stable source snapshot.")}function fBe(t,e,r){let n=e.lockHeld?di(t):Nr(t);if(n.schemaVersion!=="0.1")throw new Error("Schema migration preview currently accepts only schema 0.1 workspaces");let i=GX(t);if(i.root.features!==void 0&&!Array.isArray(i.root.features))throw new Error("Schema migration preview cannot address a non-array inline features source.");if(i.root.scenarios!==void 0&&!Array.isArray(i.root.scenarios))throw new Error("Schema migration preview cannot address a non-array inline scenarios source.");if(Array.isArray(i.root.features)&&i.root.features.length>0&&Xoe(t,"features"))throw new Error("Schema migration preview rejects mixed inline and sharded feature sources; reconcile the ignored shard domain first.");if(Array.isArray(i.root.scenarios)&&i.root.scenarios.length>0&&Xoe(t,"scenarios"))throw new Error("Schema migration preview rejects mixed inline and sharded scenario sources; reconcile the ignored shard domain first.");if(Object.hasOwn(i.root,"capabilities")&&II(Rl(PI(t),"spec","capabilities.yaml")))throw new Error("Schema migration preview rejects mixed inline and sharded capability sources; reconcile the ignored catalog first.");if(Object.hasOwn(i.root,"architecture")&&II(Rl(PI(t),"spec","architecture.yaml")))throw new Error("Schema migration preview rejects mixed inline and sharded architecture sources; reconcile the ignored architecture artifact first.");let s=_Be(n.edges),o=[],a=ys(i.root.project),c=a?.intent_summary,l=typeof c=="string"?{purpose:c,status:"proposed",assuranceLevel:"L2",scenarioPolicy:"advisory"}:{status:"legacy_exempt",assuranceLevel:"L2",scenarioPolicy:"advisory"};typeof c=="string"&&o.push({code:"PROJECT_PURPOSE_CONFIRMATION",subject:"project",detail:"Confirm the exact legacy intent_summary copied to purpose."}),o.push({code:"PROJECT_ASSURANCE_LEVEL_CONFIRMATION",subject:"project",detail:"Confirm or change the proposed L2 assurance level; migration does not infer it from the legacy stage layout."}),o.push({code:"PROJECT_SCENARIO_POLICY_CONFIRMATION",subject:"project",detail:"Confirm or change the proposed advisory scenario policy; migration does not create an invisible default."});let u=kBe(i.features);bBe(u,i.scenarios),vBe(u);let d=u.filter(F=>F.value.status==="done").flatMap(F=>$U(F.value).map(de=>`criterion:${ir(F.value.id)}/${ir(de.id)}`)).sort(Na),p={candidateCount:d.length,candidateCensusSha256:db(d)};o.push({code:"PROJECT_LEGACY_L2_BASELINE",subject:"project",detail:"Accept or reject the separate completed-legacy-criterion L2 baseline; it is not implied by assurance policy confirmation."});let f=new Map;for(let F of u){let de=ir(F.value.id);de&&f.set(de,(f.get(de)??0)+1)}let h=new Set([...f.entries()].filter(([,F])=>F>1).map(([F])=>F)),m=u.filter(F=>F.value.status==="done").map(F=>ir(F.value.id)).sort(),y=mBe(t,a,m),v=new Map,g=[],b=[],w=[],x=[];for(let F of u){let de=ir(F.value.id),Ft=ir(F.value.title);if(!de||!Ft)continue;let Se=`feature:${de}`;h.has(de)||v.set(de,F),g.push({address:Se,path:F.path,targetPath:F.path==="spec.yaml"?Qoe("features",de,Ft,F.value):F.path,title:Ft,purpose:"legacy_exempt"});let Jt=xBe(F.value);w.push({address:Se,title:Ft,exemption:s_(Se,"missing_feature_purpose"),...Jt===void 0?{}:{legacyStructuralReview:Jt}});for(let xe of $U(F.value)){let sr=ir(xe.id);if(!sr)continue;let D=`criterion:${de}/${sr}`,C=ir(xe.text),z=C===void 0?{status:"unknown"}:kE(C,xe.ears),O=s[D]??[];b.push({address:D,...C===void 0?{}:{statement:C},scan:z,kind:"legacy_exempt",legacyBindings:O,reviewedTestCandidates:SBe(t,D,O)}),x.push({address:D,legacyIntent:wBe(xe),legacyRecord:xe,classification:Oo,bindings:O,exemption:s_(D,"legacy_criterion_intent")}),z.status==="conflict"?o.push({code:"CRITERION_STATEMENT_CONFLICT",subject:D,detail:O.some(V=>V.channel==="test")?"Resolve strict intent and explicitly retain selected historic test inputs or drop them.":"Resolve the legacy EARS structural conflict before strict schema 0.2 authoring."}):z.status==="unknown"&&o.push({code:"CRITERION_TEXT_UNKNOWN",subject:D,detail:O.some(V=>V.channel==="test")?"Supply strict intent and explicitly retain selected historic test inputs or drop them.":"Provide an authored legacy text value; condition/action/response are not reconstructed."}),Array.isArray(xe.adr_refs)&&xe.adr_refs.length>0&&o.push({code:"ADR_REFERENCE_REVIEW",subject:D,detail:"Review legacy adr_refs manually; the preview does not assign a new target field."})}}let $=EBe(i.capabilities),I=$.records,E=I.flatMap(F=>F.surface===void 0||F.id===void 0?[]:[{id:F.id,legacySurface:F.surface,disposition:"removed_by_schema_0.2"}]).sort((F,de)=>F.id.localeCompare(de.id)),R=$Be($,o),A=[...h].sort().map(F=>`duplicate feature shard id ${F} prevents safe edge inversion`);for(let F of I)F.id&&o.push({code:"CAPABILITY_OUTCOME_CONFIRMATION",subject:`capability:${F.id}`,detail:F.status==="proposed"?"Confirm the exact legacy summary copied to outcome.":"Provide an outcome; no legacy summary was available to copy."});let B=ABe(I,v,h,[...R,...A],o),Z=g.map(F=>({...F,capabilityRefs:B.candidatePairs.filter(de=>de.featureId===F.address.slice(8)).map(de=>de.capabilityId)})).sort((F,de)=>F.address.localeCompare(de.address)),ee=[],T=[],j=IBe(i.architecture,o);for(let F of rae(i.scenarios)){let de=ir(F.value.id),Ft=ir(F.value.title),Se=`scenario:${de}`;ee.push({address:Se,status:"legacy_exempt",path:F.path,targetPath:F.path==="spec.yaml"?Qoe("scenarios",de,Ft,F.value):F.path}),T.push({address:Se,legacyRecord:F.value,exemption:s_(Se,"legacy_scenario")}),o.push({code:"SCENARIO_MEANING_REQUIRED",subject:Se,detail:"Resolve actor, goal, success, and steps without inferring a journey from legacy flow prose."})}let Ne=b.sort((F,de)=>F.address.localeCompare(de.address)),U={schema:O2,sourceSchema:"0.1",project:typeof c=="string"?{address:"project",legacyIntent:c}:{address:"project",exemption:s_("project","missing_project_intent")},features:w.sort((F,de)=>F.address.localeCompare(de.address)),criteria:x.sort((F,de)=>F.address.localeCompare(de.address)),scenarios:T.sort((F,de)=>F.address.localeCompare(de.address)),...E.length===0?{}:{capabilitySurfaceDispositions:E},...i.architecture===void 0?{}:{architecture:{address:"architecture",legacyRecord:i.architecture,exemption:s_("architecture","legacy_architecture")}}},H=$I(t),Oe={features:{source:u.map(F=>ir(F.value.id)).sort(),candidate:Z.map(F=>F.address.slice(8)).sort()},criteria:{source:u.flatMap(F=>$U(F.value).map(de=>`${ir(F.value.id)}/${ir(de.id)}`)).sort(),candidate:Ne.map(F=>F.address.slice(10)).sort()},scenarios:{source:rae(i.scenarios).map(F=>ir(F.value.id)).sort(),candidate:ee.map(F=>F.address.slice(9)).sort()}};return hBe(Oe),{schema:1,sourceSchema:"0.1",targetSchema:"0.2",mode:"preview",sourceDigest:gBe(H),sourceManifest:H,testFileSetDigest:r.digest,testFileCount:r.count,project:l,legacyL2Baseline:p,features:Z,criteria:Ne,capabilities:I.flatMap(F=>F.id?[{id:F.id,...F.title===void 0?{}:{title:F.title},...F.outcome===void 0?{}:{outcome:F.outcome},status:F.status}]:[]).sort((F,de)=>F.id.localeCompare(de.id)),capabilityEdgeProof:B,capabilitySurfaceDispositions:E,scenarios:ee.sort((F,de)=>F.address.localeCompare(de.address)),architecture:j,oldPathProjections:[{path:"spec/index.yaml",disposition:"regenerate"},{path:"spec/_doc-links.yaml",disposition:"carry_forward"},{path:"spec/attestation.yaml",disposition:"invalidate"}],independence:y,identityProof:Oe,baseline:U,requiredResolution:o.sort((F,de)=>`${F.subject}|${F.code}`.localeCompare(`${de.subject}|${de.code}`))}}function hBe(t){for(let[e,r]of Object.entries(t))if(JSON.stringify(r.source)!==JSON.stringify(r.candidate))throw new Error(`Schema migration preview cannot prove lossless ${e} identity/count preservation.`)}function mBe(t,e,r){if(e?.independence_policy!=="require"||r.length===0)return{legacyEvidence:"asserted",requirePolicyDoneLosses:[]};let n;try{n=Dr(t)}catch(s){throw new Error(`Schema migration preview cannot classify the require-policy audit evidence: ${s.message}`)}return{legacyEvidence:"asserted",requirePolicyDoneLosses:r.filter(s=>n.some(o=>o.featureId===s&&(o.identity?.author==="human"||o.blind===!0)))}}function $I(t){let e=PI(t),r=[],n=i=>{if(!II(i))return;let s=dBe(i);if(s.isSymbolicLink())throw new Error(`Schema migration preview rejects symbolic-link source ${Yoe(e,i)}.`);if(s.isDirectory()){for(let o of nae(i).sort())n(Rl(i,o));return}s.isFile()&&r.push(Yoe(e,i).replace(/\\/g,"/"))};return n(Rl(e,"spec.yaml")),n(Rl(e,"spec")),n(Rl(e,".cladding","audit.log.jsonl")),r.sort().map(i=>({path:i,sha256:PU("sha256").update(pBe(Rl(e,i))).digest("hex")}))}function gBe(t){return PU("sha256").update(JSON.stringify(t)).digest("hex")}function Xoe(t,e){let r=Rl(PI(t),"spec",e);return II(r)&&nae(r).some(n=>/\.ya?ml$/i.test(n))}function Qoe(t,e,r,n){if(/^(?:F|S)-\d+$/.test(e))return`spec/${t}/${e}.yaml`;let s=ir(n.slug),o=s&&/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(s)?s:yBe(r),a=e.replace(/^[FS]-/,"");if(!/^[a-f0-9]{6,}$/.test(a))throw new Error(`Schema migration preview cannot derive a safe shard filename for ${e}.`);return`spec/${t}/${o}-${a}.yaml`}function yBe(t){let e=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,63).replace(/-+$/g,"");return e.length>0?e:"legacy"}function bBe(t,e){let r=new Set;for(let i of t){let s=ir(i.value.id),o=ir(i.value.title);if(!s||!o)throw new Error(`Schema migration preview cannot address legacy feature ${i.path}: id and title are required.`);if(r.has(s))throw new Error(`Schema migration preview cannot address duplicate legacy feature id ${s}.`);r.add(s),eae("feature",i.path,s);let a=new Set,c=i.value.acceptance_criteria;if(c!==void 0&&!Array.isArray(c))throw new Error(`Schema migration preview cannot address criteria in ${s}: acceptance_criteria must be an array.`);for(let[l,u]of(c??[]).entries()){let d=ys(u),p=ir(d?.id);if(!d||!p)throw new Error(`Schema migration preview cannot address criterion ${l+1} in ${s}: criterion id is required.`);if(a.has(p))throw new Error(`Schema migration preview cannot address duplicate criterion id ${p} in ${s}.`);a.add(p);for(let h of["test_refs","oracle_refs","evidence_refs"]){let m=d[h];if(m!==void 0&&(!Array.isArray(m)||m.some(y=>typeof y!="string")))throw new Error(`Schema migration preview cannot losslessly retain ${h} for ${s}/${p}: it must be an array of strings.`)}let f=d.adr_refs;if(f!==void 0&&(!Array.isArray(f)||f.some(h=>typeof h!="string"||h.trim().length===0)))throw new Error(`Schema migration preview cannot losslessly retain adr_refs for ${s}/${p}: it must be an array of non-empty strings.`)}}let n=new Set;for(let i of e){let s=ys(i.value),o=ir(s?.id),a=ir(s?.title);if(!s||!o||!a)throw new Error(`Schema migration preview cannot address legacy scenario ${i.path}: scenario id and title are required.`);if(n.has(o))throw new Error(`Schema migration preview cannot address duplicate legacy scenario id ${o}.`);n.add(o),eae("scenario",i.path,o)}}function eae(t,e,r){if(e==="spec.yaml")return;if(!zn(t,r)||!Af(t,e))throw new Error(`Schema migration preview cannot prove ${t} shard identity for ${e}.`);let n=e.slice(e.lastIndexOf("/")+1).replace(/\.ya?ml$/i,"");if((new RegExp(`^${t==="feature"?"F":"S"}-(?:\\d{3,}|[a-f0-9]{6,})$`).test(n)?r:`${t==="feature"?"F":"S"}-${n.slice(n.lastIndexOf("-")+1)}`)!==r)throw new Error(`Schema migration preview cannot prove ${t} shard filename/body identity for ${e}.`)}function vBe(t){let e=new Set(["planned","in_progress","done","blocked","archived"]);for(let r of t){let n=ir(r.value.id)??r.path;if(typeof r.value.status!="string"||!e.has(r.value.status))throw new Error(`Schema migration preview cannot losslessly retain feature ${n}: status must be a supported string.`);for(let i of["modules","depends_on"]){let s=r.value[i];if(s!==void 0&&(!Array.isArray(s)||s.some(o=>typeof o!="string")))throw new Error(`Schema migration preview cannot losslessly retain feature ${n}: ${i} must be an array of strings.`)}}}function iae(t){return`${JSON.stringify(t,null,2)} +`}function _Be(t){let e=new Map;for(let r of t){if(r.relation!=="supports"||r.provenance!=="authored"||!r.channel||r.raw===void 0)continue;let n={channel:r.channel,raw:r.raw,...r.selector?.precision==="fragment"?{selector:r.selector.value}:{}},i=e.get(r.from)??[];i.push(n),e.set(r.from,i)}return Object.fromEntries([...e.entries()].sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>[r,n.sort((i,s)=>`${i.channel}|${i.raw}`.localeCompare(`${s.channel}|${s.raw}`))]))}function SBe(t,e,r){return r.filter(n=>n.channel==="test").map(n=>{let i=qk(t,e.replace(/^criterion:/,""),n.raw,n.selector);return{raw:n.raw,file:i.file,...i.selector===void 0?{}:{selector:i.selector},...i.sha256===void 0?{}:{sha256:i.sha256},state:i.state}}).sort((n,i)=>`${n.raw}\0${n.selector??""}`.localeCompare(`${i.raw}\0${i.selector??""}`))}function wBe(t){let e=["ears","condition","action","response","text","rationale"],r=[];for(let n of e){let i=t[n];typeof i=="string"&&r.push([n,i])}return Array.isArray(t.constraint_refs)&&t.constraint_refs.every(n=>typeof n=="string")&&r.push(["constraint_refs",t.constraint_refs.join(",")]),Object.fromEntries(r)}function xBe(t){let e=ys(t.design_impact);if(!(!e||e.classification!=="structural"||e.status!=="review_required"||typeof e.rationale!="string"||e.rationale.length===0||!Array.isArray(e.artifacts)||e.artifacts.some(r=>typeof r!="string"||r.length===0)||new Set(e.artifacts).size!==e.artifacts.length))return{classification:"structural",rationale:e.rationale,status:"review_required",artifacts:[...e.artifacts]}}function s_(t,e){return{id:`legacy-${PU("sha256").update(`${e}:${t}`).digest("hex").slice(0,16)}`,subject:t,reason:e}}function kBe(t){return t.flatMap(e=>{let r=ys(e.value);return e.path==="spec.yaml"?Array.isArray(r?.features)?r.features.map(n=>({path:e.path,value:ys(n)??{}})):[]:r?[{path:e.path,value:r}]:[]})}function $U(t){return Array.isArray(t.acceptance_criteria)?t.acceptance_criteria.map(e=>ys(e)??{}):[]}function EBe(t){if(t===void 0)return{records:[],malformed:!1};let e=ys(t),r=Array.isArray(t)?t:Array.isArray(e?.capabilities)?e.capabilities:void 0;return r?{records:r.map((n,i)=>{let s=ys(n),o=ir(s?.id),a=ir(s?.title),c=ir(s?.summary),l=s?.surface;if(l!==void 0&&(typeof l!="string"||!["feature","platform","tool","infrastructure"].includes(l)))throw new Error(`Schema migration preview cannot losslessly disposition legacy capability surface at index ${i}.`);return{index:i,isObject:s!==void 0,...o===void 0?{}:{id:o},...a===void 0?{}:{title:a},...c===void 0?{}:{outcome:c},status:c===void 0?"unknown":"proposed",legacyFeatures:s?.features,...l===void 0?{}:{surface:l}}}),malformed:!1}:{records:[],malformed:!0}}function ABe(t,e,r,n,i){let s=new Map,o=new Map,a=[...n],c=new Set;for(let m of t){let y=m.id;if(y&&(c.has(y)&&a.push(`duplicate capability id ${y}`),c.add(y),m.legacyFeatures!==void 0)){if(!Array.isArray(m.legacyFeatures)){a.push(`capability ${y} has a non-array legacy features value`);continue}m.legacyFeatures.forEach((v,g)=>{if(typeof v!="string"||v.trim().length===0){a.push(`capability ${y} has an invalid legacy features entry at index ${g}`);return}let b=v,w={capabilityId:y,featureId:b},x=o_(w);if(s.has(x)&&a.push(`duplicate legacy capability edge ${y} -> ${b}`),s.set(x,w),r.has(b)){a.push(`duplicate feature shard id ${b} prevents safe edge inversion`);return}if(!e.has(b)){a.push(`dangling legacy capability edge ${y} -> ${b}`);return}o.set(x,w)})}}let l=tae([...s.values()]),u=tae([...o.values()]),d=l.filter(m=>!o.has(o_(m))),p=u.filter(m=>!s.has(o_(m))),f=[...new Set(a)].sort(),h=d.length===0&&p.length===0&&f.length===0;return h||i.push({code:"CAPABILITY_EDGE_RESOLUTION",subject:"capabilities",detail:`Resolve legacy capability edges before apply: missing=${d.length}, extra=${p.length}, conflicts=${f.length}.`}),{legacyPairs:l,candidatePairs:u,missing:d,extra:p,conflicts:f,equal:h}}function $Be(t,e){let r=[];if(t.malformed)throw new Error("Schema migration preview cannot address a legacy capability catalog that is not an array.");let n=new Set;for(let i of t.records){if(!i.isObject)throw new Error(`Schema migration preview cannot address capability record ${i.index}: it is not an object.`);if(i.id){if(n.has(i.id))throw new Error(`Schema migration preview cannot address duplicate capability id ${i.id}.`);n.add(i.id)}else throw new Error(`Schema migration preview cannot address capability record ${i.index}: capability id is required.`);if(!i.title){let s=`capability:${i.id} has no title.`;r.push(s),e.push({code:"CAPABILITY_RECORD_RESOLUTION",subject:`capability:${i.id}`,detail:"Provide the required schema 0.2 capability title before apply."})}}return[...new Set(r)].sort()}function IBe(t,e){if(!t)return e.push({code:"ARCHITECTURE_LAYER_RESOLUTION",subject:"architecture",detail:"Provide the initial schema 0.2 architecture layers; the legacy workspace has no architecture record to project."}),{status:"resolution_required",rules:[]};let r=PBe(t.layers),n=!1;r||(n=!0,e.push({code:"ARCHITECTURE_LAYER_RESOLUTION",subject:"architecture",detail:"Resolve the legacy object-form or lossy layers value; the preview does not manufacture layer meaning."}));let i=[];t.forbidden_imports!==void 0&&!Array.isArray(t.forbidden_imports)&&(n=!0,e.push({code:"ARCHITECTURE_RULE_RESOLUTION",subject:"architecture",detail:"Resolve the non-array legacy forbidden_imports value without inventing an architecture rule."})),Array.isArray(t.forbidden_imports)&&t.forbidden_imports.forEach((a,c)=>{let l=ys(a),u=ir(l?.from),d=ir(l?.to);if(!u||!d){n=!0,e.push({code:"ARCHITECTURE_RULE_RESOLUTION",subject:`architecture.rules[${c}]`,detail:"Resolve a legacy forbidden-import pair with missing or invalid from/to; the preview does not guess direction."});return}i.push({from:u,to:d})});let s=new Map,o=RBe(i).map(a=>{let c=IU(a),l=s.get(c)??0;s.set(c,l+1);let u=RX(a.from,a.to,l);return n=!0,e.push({code:"ARCHITECTURE_RULE_RATIONALE",subject:`architecture_rule:${u}`,detail:"Provide a non-empty rule rationale; legacy YAML comments are not treated as structured rationale."}),l>0&&e.push({code:"ARCHITECTURE_RULE_RESOLUTION",subject:`architecture_rule:${u}`,detail:"Resolve a duplicate legacy forbidden-import pair before strict schema 0.2 validation."}),{id:u,kind:"forbidden_import",from:a.from,to:a.to,status:"rationale_required"}});return{status:n?"resolution_required":"proposed",...r?{layers:r}:{},rules:o}}function PBe(t){if(!Array.isArray(t)||t.length===0)return;let e=[];for(let r of t){if(!Array.isArray(r)||r.length===0||r.some(n=>typeof n!="string"||n.trim().length===0))return;e.push([...r])}return e}function o_(t){return`${t.capabilityId}\0${t.featureId}`}function tae(t){return[...t].sort((e,r)=>o_(e).localeCompare(o_(r)))}function IU(t){return`${t.from}\0${t.to}`}function RBe(t){return[...t].sort((e,r)=>IU(e).localeCompare(IU(r)))}function rae(t){return t.flatMap(e=>{let r=ys(e.value);return e.path==="spec.yaml"?Array.isArray(r?.scenarios)?r.scenarios.map(n=>({path:e.path,value:ys(n)??{}})):[]:r?[{path:e.path,value:r}]:[]})}function ys(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0}function ir(t){return typeof t=="string"?t:void 0}var RU=S(()=>{"use strict";qn();kk();Vu();OM();Eb();hi();Vh();Li()});function Cl(t=""){return new RegExp(CBe,t)}var CBe,RI=S(()=>{"use strict";Li();CBe=GY("feature")});import{lstatSync as OI,readlinkSync as TBe,readdirSync as OBe,readFileSync as NBe}from"node:fs";import{dirname as sae,join as c_,relative as NI,resolve as CU}from"node:path";function LBe(t){let e=[],r=!1,n=new Map;for(let i of t.matchAll(oae)){let s=i[1];if(s.trim().startsWith("ignore")){r=!0;continue}for(let o of s.matchAll(Cl("g"))??[]){let a=TU(n,o[0]);e.push(Object.freeze({featureId:o[0],raw:o[0],selector:TI("declaration",{featureId:o[0]},a)}))}}return Object.freeze({facts:Object.freeze(e),ignoresOrganic:r})}function MBe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function DI(t){return t.split("\\").join("/")}function FBe(t){return DBe.some(e=>t===e||t.startsWith(`${e}/`))}function TI(t,e,r){return`${t}:${JSON.stringify({fact:e,occurrence:r})}`}function TU(t,e){let r=t.get(e)??0;return t.set(e,r+1),r}function zBe(t){let r=c_(t,"docs"),n=[],i=[];try{let o=OI(r);if(o.isSymbolicLink())return i.push("document scan refuses symlink traversal: docs"),CI(n,i);if(!o.isDirectory())return i.push("document scan root is not a directory: docs"),CI(n,i)}catch(o){return o.code!=="ENOENT"&&i.push("document scan cannot inspect docs"),CI(n,i)}let s=[r];for(;s.length>0;){let o=s.pop(),a=DI(NI(t,o)),c;try{c=OBe(o).sort()}catch{i.push(`document scan cannot read directory: ${a}`);continue}for(let l of c){if(l.startsWith("."))continue;let u=c_(o,l),d=DI(NI(t,u)),p;try{p=OI(u)}catch{i.push(`document scan cannot inspect path: ${d}`);continue}p.isSymbolicLink()?i.push(`document scan refuses symlink traversal: ${d}`):p.isDirectory()?s.push(u):p.isFile()&&l.endsWith(".md")&&n.push(d)}}return CI(n,i)}function CI(t,e){return Object.freeze({docs:Object.freeze([...new Set(t)].sort()),unknownReasons:Object.freeze([...new Set(e)].sort())})}function UBe(t,e,r){let n=CU(t);if(r.startsWith("//"))return;if(qBe(r))return Object.freeze({unsafe:"absolute_path"});if(BBe(r))return;let i=CU(n,sae(e),r.replaceAll("\\","/")),s=DI(NI(n,i));if(!aae(s))return Object.freeze({unsafe:"path_escapes_workspace"});let o=n,a=s.split("/");for(let c=0;c0&&t!==".."&&!t.startsWith("../")&&!t.startsWith("..\\")}function VBe(t,e){let r=e.split("/"),n=new Set,i=t;for(;r.length>0;){i=c_(i,r.shift());let s;try{s=OI(i)}catch{return!1}if(!s.isSymbolicLink())continue;if(n.has(i))return!1;n.add(i);let o;try{o=TBe(i)}catch{return!1}let a=CU(sae(i),o),c=NI(t,a);if(!GBe(c))return!0;let l=r.splice(0);c.length>0&&r.push(...DI(c).split("/")),r.push(...l),i=t}return!1}function GBe(t){return t===""||aae(t)}function HBe(t,e){return`unsafe local Markdown path (${e.reason}) at ${t}#${e.selector}: ${JSON.stringify(e.raw)}`}function Gh(t="."){let e=zBe(t),r=[],n=[...e.unknownReasons];for(let i of e.docs){let s=FBe(i),o;try{o=NBe(c_(t,i),"utf8")}catch{n.push(`document scan cannot read document: ${i}`),r.push(Object.freeze({doc:i,excluded:s,readable:!1,explicit:Object.freeze([]),organic:Object.freeze([]),links:Object.freeze([]),issues:Object.freeze([]),projectionLinks:Object.freeze([])}));continue}let a=MBe(o),c=LBe(a),l=[];if(!s&&!c.ignoresOrganic){let f=a.replace(oae," "),h=new Map;for(let m of f.matchAll(Cl("g"))??[]){let y=TU(h,m[0]);l.push(Object.freeze({featureId:m[0],raw:m[0],selector:TI("mention",{featureId:m[0]},y)}))}}let u=[],d=[],p=new Set;if(!s){let f=new Map;for(let h of a.matchAll(jBe)){let m=`${h[1]}${h[2]??""}`,y=UBe(t,i,h[1]);if(!y)continue;let v=TU(f,m);if("unsafe"in y){let g=Object.freeze({kind:"unsafe_local_markdown_path",raw:m,selector:TI("link",{raw:m},v),reason:y.unsafe});d.push(g),n.push(HBe(i,g));continue}y.unknownReason!==void 0&&n.push(y.unknownReason),u.push(Object.freeze({raw:m,...h[2]===void 0?{}:{targetSelector:h[2].slice(1)},target:y.target,selector:TI("link",{raw:m,target:y.target},v),state:y.state})),p.add(y.target)}}r.push(Object.freeze({doc:i,excluded:s,readable:!0,explicit:c.facts,organic:Object.freeze(l),links:Object.freeze(u),issues:Object.freeze(d),projectionLinks:Object.freeze([...p].sort())}))}return Object.freeze({docs:Object.freeze(r),completeness:n.length===0?"complete":"unknown",unknownReasons:Object.freeze([...new Set(n)].sort())})}function WBe(t="."){let e=[];for(let r of Gh(t).docs){if(!r.readable)continue;let n=r.explicit.map(i=>i.featureId);if(r.excluded){if(n.length===0)continue;e.push({doc:r.doc,features:[...new Set(n)].sort(),doc_links:[]});continue}e.push({doc:r.doc,features:[...new Set([...r.organic.map(i=>i.featureId),...n])].sort(),doc_links:r.projectionLinks})}return{docs:e}}function cae(t="."){let e=WBe(t);if(e.docs.length===0)return null;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`${r.join(` +`)} +`}var DBe,jBe,oae,jI=S(()=>{"use strict";RI();DBe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],jBe=/\]\(\s*([^)\s]+?\.md)(#[^)]*)?\s*\)/g,oae=/clad-doc-links:[ \t]*([^\n>]*)/g});function lae(t){let e=t.lastIndexOf(".");return e>=0?t.slice(e).toLowerCase():""}function KBe(t){let e=new Map,r=(n,i)=>{if(!n)return;let s=e.get(n)??new Set;for(let o of i)s.add(o);e.set(n,s)};for(let[n,i]of t){let s=lae(n),a=(s?n.slice(0,-s.length):n).split("/").filter(Boolean),c=s===".py"?".":"/";for(let l=0;l<=a.length-2;l++)r(a.slice(l).join(c),i)}return e}function YBe(t,e){let r=[];if(e===".py"){for(let n=OU.exec(t);n;n=OU.exec(t))r.push(n[1]??n[2]);OU.lastIndex=0}else if(jU.includes(e)){for(let n=NU.exec(t);n;n=NU.exec(t))r.push(n[1]??n[2]??n[3]??n[4]);NU.lastIndex=0;for(let n=DU.exec(t);n;n=DU.exec(t))r.push(n[1]);DU.lastIndex=0}return r.filter(Boolean)}function XBe(t,e){if(e===".py"){let s=t.replace(/^\.+/,"").split(".").filter(Boolean),o=[];for(let a=0;a<=s.length-2;a++)o.push(s.slice(a).join("."));return o}let n=t.replace(/\.(js|jsx|ts|tsx|mjs|cjs)$/i,"").replace(/^[./]+/,"").split("/").filter(Boolean),i=[];for(let s=0;s<=n.length-2;s++)i.push(n.slice(s).join("/"));return i}function Hh(t,e,r={}){let n=r.maxOwnerAmbiguity??1,i=Ro(t,{graph:r.graph}),s=t.features??[],o=[...new Set(s.flatMap(y=>y.modules??[]))].sort(),a=KBe(o.map(y=>[y,i.owners(y)])),c=new Map,l=new Set;for(let y of s){let v=y.id;for(let g of y.modules??[]){let b=lae(g);if(b!==".py"&&!jU.includes(b))continue;let w=e(g);if(w!=null){(ZBe.test(w)||jU.includes(b)&&JBe.test(w))&&l.add(g);for(let x of YBe(w,b))for(let $ of XBe(x,b)){let I=a.get($);if(!(!I||I.size>n))for(let E of I){if(E===v)continue;let R=`${v}\0${E}`,A=c.get(R);(!A||g[y.id,new Set(y.depends_on??[])])),d=[...c.values()].sort((y,v)=>y.from.localeCompare(v.from)||y.to.localeCompare(v.to)),p=[],f=[],h={};for(let y of d)u.get(y.from)?.has(y.to)?f.push(y):(p.push(y),(h[y.from]??=new Set).add(y.to));let m={};for(let[y,v]of Object.entries(h))m[y]=[...v].sort();return{edges:p,alreadyDeclared:f,suggestions:m,dynamicImportFiles:[...l].sort()}}var ZBe,JBe,OU,NU,DU,jU,LI=S(()=>{"use strict";Ou();ZBe=/\b(?:importlib\.import_module|importlib\.__import__|__import__\s*\(|import_module\s*\(|require\s*\(\s*[^'"\s)])/,JBe=/\bimport\s*\(\s*[^'"\s)]/,OU=/^\s*(?:from\s+([.\w]+)\s+import\b|import\s+([.\w]+))/gm,NU=/(?:^|\n)\s*(?:import\b[^'"]*from\s*['"]([^'"]+)['"]|import\s*['"]([^'"]+)['"]|export\b[^'"]*from\s*['"]([^'"]+)['"]|(?:const|let|var)\s+[^=]+=\s*require\(\s*['"]([^'"]+)['"]\s*\))/g,DU=/\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g,jU=[".ts",".tsx",".js",".jsx",".mjs",".cjs"]});import{createHash as QBe}from"node:crypto";import{execFileSync as uae}from"node:child_process";import{existsSync as _s,lstatSync as xae,readFileSync as eqe,readdirSync as h_,realpathSync as MU}from"node:fs";import{dirname as tqe,join as Pn,resolve as vi}from"node:path";function qU(t){if(!Array.isArray(t)||t.length===0)throw ne("A typed edit batch needs at least one operation.");if(t.length>Aae||XU(t)>Eae)throw ne("A typed edit batch exceeds the 16 KiB / 128-operation transport limit.");let e=t.map(r=>Pae(r));if(e.some(r=>r.kind==="project.upgrade_schema")&&e.length!==1)throw ne("Schema migration apply must be the sole operation in its transaction.");return e}function Pae(t){let e=$ae.safeParse(t);if(!e.success)throw ne(`Invalid typed specification operation: ${e.error.issues[0]?.message??"invalid shape"}.`);let r=fn(e.data),n=te(r.kind);if(["feature.begin","feature.block","feature.archive","feature.set_title","feature.set_purpose","feature.set_links","feature.set_design_impact","criterion.upsert","criterion.remove","criterion.set_proof_refs","dependency.promote","evidence.revoke"].includes(n)&&!zn("feature",te(r.featureId)))throw ne(`${n}.featureId is not a readable feature identifier.`);if(n==="feature.create"&&!Oa("feature",te(r.id)))throw ne(`${n}.id must be a newly generated feature identifier.`);if(n==="scenario.remove"&&!zn("scenario",te(r.scenarioId)))throw ne(`${n}.scenarioId is not a readable scenario identifier.`);let i=a=>He(te(r[a]),`${n}.${a}`),s=a=>r[a]===void 0?void 0:He(te(r[a]),`${n}.${a}`),o=a=>r[a]===void 0?void 0:Pt(Xn(r[a],`${n}.${a}`),`${n}.${a}`);switch(n){case"project.set_description":return r.description===void 0?{kind:n}:{kind:n,description:He(te(r.description),`${n}.description`)};case"project.set_purpose":return{kind:n,purpose:i("purpose")};case"project.set_policy":{let a=r.assuranceLevel,c=r.scenarioPolicy;if(a!==void 0&&!["L1","L2","L3","L4"].includes(te(a)))throw ne(`${n}.assuranceLevel is invalid.`);if(c!==void 0&&!["off","advisory","required"].includes(te(c)))throw ne(`${n}.scenarioPolicy is invalid.`);if(a===void 0&&c===void 0)throw ne(`${n} needs a policy value.`);return{kind:n,...a===void 0?{}:{assuranceLevel:te(a)},...c===void 0?{}:{scenarioPolicy:te(c)}}}case"feature.create":return{kind:n,id:i("id"),slug:i("slug"),title:i("title"),purpose:i("purpose"),...o("modules")===void 0?{}:{modules:o("modules")},...o("dependsOn")===void 0?{}:{dependsOn:o("dependsOn")},...o("capabilityRefs")===void 0?{}:{capabilityRefs:o("capabilityRefs")},...r.criteria===void 0?{}:{criteria:VI(r.criteria,`${n}.criteria`).map(pae)}};case"feature.begin":return{kind:n,featureId:i("featureId")};case"feature.block":return{kind:n,featureId:i("featureId"),reason:i("reason")};case"feature.archive":return{kind:n,featureId:i("featureId"),reason:i("reason"),...s("supersededBy")===void 0?{}:{supersededBy:s("supersededBy")}};case"feature.set_title":return{kind:n,featureId:i("featureId"),title:i("title")};case"feature.set_purpose":return{kind:n,featureId:i("featureId"),purpose:i("purpose")};case"feature.set_links":{let a=o("modules"),c=o("dependsOn"),l=o("capabilityRefs");if(a===void 0&&c===void 0&&l===void 0)throw ne(`${n} needs at least one replacement field.`);return{kind:n,featureId:i("featureId"),...a===void 0?{}:{modules:a},...c===void 0?{}:{dependsOn:c},...l===void 0?{}:{capabilityRefs:l}}}case"feature.set_design_impact":return{kind:n,featureId:i("featureId"),...r.designImpact===void 0?{}:{designImpact:aqe(bs(r.designImpact,`${n}.designImpact`))}};case"criterion.upsert":return{kind:n,featureId:i("featureId"),criterion:pae(bs(r.criterion,`${n}.criterion`))};case"criterion.remove":return{kind:n,featureId:i("featureId"),criterionId:i("criterionId")};case"criterion.set_proof_refs":{let a=o("oracleRefs"),c=o("evidenceRefs");if(a===void 0&&c===void 0)throw ne(`${n} needs a proof reference field.`);return{kind:n,featureId:i("featureId"),criterionId:i("criterionId"),...a===void 0?{}:{oracleRefs:a},...c===void 0?{}:{evidenceRefs:c}}}case"capability.upsert":{let a=bs(r.capability,`${n}.capability`);return In(a,["id","title","outcome"],`${n}.capability`),{kind:n,capability:{id:He(te(a.id),"capability id"),title:He(te(a.title),"capability title"),outcome:He(te(a.outcome),"capability outcome")}}}case"capability.remove":return{kind:n,capabilityId:i("capabilityId")};case"architecture.set_layers":return{kind:n,layers:ZI(r.layers,`${n}.layers`).map(a=>Pt(Xn(a,`${n}.layer`),`${n}.layer`))};case"architecture_rule.upsert":{let a=bs(r.rule,`${n}.rule`);if(In(a,["id","kind","from","to","rationale"],`${n}.rule`),a.kind!=="forbidden_import")throw ne(`${n}.rule.kind is invalid.`);return{kind:n,rule:{id:$n(a,"id"),kind:"forbidden_import",from:$n(a,"from"),to:$n(a,"to"),rationale:$n(a,"rationale")}}}case"architecture_rule.remove":return{kind:n,ruleId:i("ruleId")};case"scenario.upsert":return{kind:n,scenario:oqe(bs(r.scenario,`${n}.scenario`))};case"scenario.remove":return{kind:n,scenarioId:i("scenarioId")};case"dependency.promote":return{kind:n,featureId:i("featureId"),candidate:i("candidate")};case"evidence.revoke":return{kind:n,featureId:i("featureId"),digest:i("digest")};case"project.upgrade_schema":{let a=bs(r.resolutions,`${n}.resolutions`);In(a,["previewDigest","confirmed"],`${n}.resolutions`);let c=He(te(a.previewDigest),`${n}.resolutions.previewDigest`);if(!/^[a-f0-9]{64}$/.test(c))throw ne(`${n}.resolutions.previewDigest must be a SHA-256 digest.`);let l=VI(a.confirmed,`${n}.resolutions.confirmed`).map(u=>(In(u,["code","subject","value"],`${n}.resolution`),{code:$n(u,"code"),subject:$n(u,"subject"),...u.value===void 0?{}:{value:u.value}}));return{kind:n,resolutions:{previewDigest:c,confirmed:l}}}}}function pae(t){In(t,["id","kind","statement","rationale","constraintRefs","oracleRefs","evidenceRefs","notes"],"criterion");let e=t.kind;if(e!=="behavior"&&e!=="quality"&&e!=="constraint")throw ne("criterion.kind is invalid.");return{id:$n(t,"id"),kind:e,statement:$n(t,"statement"),...t.rationale===void 0?{}:{rationale:$n(t,"rationale")},...t.constraintRefs===void 0?{}:{constraintRefs:Pt(Xn(t.constraintRefs,"criterion.constraintRefs"),"criterion.constraintRefs")},...t.oracleRefs===void 0?{}:{oracleRefs:Pt(Xn(t.oracleRefs,"criterion.oracleRefs"),"criterion.oracleRefs")},...t.evidenceRefs===void 0?{}:{evidenceRefs:Pt(Xn(t.evidenceRefs,"criterion.evidenceRefs"),"criterion.evidenceRefs")},...t.notes===void 0?{}:{notes:$n(t,"notes")}}}function oqe(t){In(t,["id","slug","title","actor","goal","success","steps","featureRefs"],"scenario");let e=Pt(Xn(t.steps,"scenario.steps"),"scenario.steps"),r=Pt(Xn(t.featureRefs,"scenario.featureRefs"),"scenario.featureRefs");if(e.length===0)throw ne("scenario.steps must contain at least one journey step.");if(r.length===0)throw ne("scenario.featureRefs must resolve at least one feature.");return{id:$n(t,"id"),slug:$n(t,"slug"),title:$n(t,"title"),actor:$n(t,"actor"),goal:$n(t,"goal"),success:$n(t,"success"),steps:e,featureRefs:r}}function aqe(t){In(t,["classification","rationale","status","artifacts"],"design impact");let e=te(t.classification);if(!["none","additive","structural"].includes(e))throw ne("design impact classification is invalid.");let r=He(te(t.rationale),"design impact rationale"),n=t.status===void 0?void 0:te(t.status);if(n!==void 0&&!["resolved","review_required"].includes(n))throw ne("design impact status is invalid.");let i=t.artifacts===void 0?void 0:Pt(Xn(t.artifacts,"design impact artifacts"),"design impact artifacts");return{classification:e,rationale:r,...n===void 0?{}:{status:n},...i===void 0?{}:{artifacts:i}}}function Xo(t,e){let r=st(t,e);return r===null?{}:fn(Yn.default.parse(r))}function Bi(t,e){let r=qU(e);return Rae(t,r)}function VU(t,e){XU(e);let n=[Pae({kind:"project.upgrade_schema",resolutions:e})],i=vi(t);return Tae({cwd:i,operations:n,inputRevisions:Rae(i,n)},n)}function Rae(t,e){return rr(t,()=>{let r=WI(t,e);return Object.fromEntries([...r].sort().map(n=>[n,WU(t,n)]))})}function Cae(t,e){let r=qU(e);return To(t,()=>{zU(t,r,!1);let n=WI(t,r);return{contextRevision:BI(t),inputRevisions:Object.fromEntries([...n].sort().map(i=>[i,WU(t,i)]))}})}function _i(t){if(XU({operations:t.operations,inputRevisions:t.inputRevisions,contextRevision:t.contextRevision})>Eae)throw new q("INVALID_OPERATION","Typed edit request exceeds the 16 KiB transport limit.");return Tae(t,qU(t.operations))}function Tae(t,e){let r=vi(t.cwd??".");if(t.contextRevision!==void 0&&!UI.test(t.contextRevision))throw new q("INVALID_OPERATION","Context revision must be a SHA-256 projection digest.");let n=WI(r,e),i=Object.keys(t.inputRevisions).sort(),s=[...n].sort();if(Yt(i)!==Yt(s))throw new q("INVALID_OPERATION","Input revisions must name exactly the canonical write regions for this typed batch.");for(let o of n){let a=t.inputRevisions[o];if(!a)throw new q("INVALID_OPERATION",`Missing input revision for canonical region ${o}.`);if(!UI.test(a))throw new q("INVALID_OPERATION",`Input revision for canonical region ${o} must be a SHA-256 digest.`)}return To(r,()=>zU(r,e,!1)),rr(r,()=>{let o=mae(r,e);for(let u of n)if(o[u]!==t.inputRevisions[u])throw new q("STALE_INPUT",`The ${u} input changed since it was read.`);let a=zU(r,e,!0),c=Od(r,a.files,a.inventoryNeeded,a.migrationTestFileCount);if(a.migrationApplied){if(a.migrationTestFileSetDigest===void 0||Joe(r)!==a.migrationTestFileSetDigest||a.migrationPreviewDigest===void 0||Jh(a_(r,{lockHeld:!0}))!==a.migrationPreviewDigest)throw new q("STALE_INPUT","The migration preview inputs changed before its journal could be published.");if(c=dqe(r,c),Oqe(r,c),a.migrationLiveProofCensus!==void 0&&!wqe(r,a.migrationLiveProofCensus))throw new q("STALE_INPUT","The live migration proof source changed before its journal could be published.")}return c.length===0?{changed:!1,inputRevisions:o,contextRevision:BI(r),checkpointedFeatures:[]}:(Gr(r,c,t.testFaultAfterReplacements,t.testErrorAfterReplacements,t.testBeforeReplacement),{changed:!0,inputRevisions:mae(r,e),contextRevision:BI(r),checkpointedFeatures:a.checkpointedFeatures})})}function GI(t,e){let r=vi(t),n=Oae.get(e);if(!n||Nae.has(e)||n.root!==Td(r)||e.schemaVersion!=="0.2"||e.previousStatus!=="in_progress"||!Dqe(e.path,Pn(r,n.featurePath))||e.rollback!==n.rollback||e.rollback.feature.path!==n.featurePath||e.rollback.feature.before!==n.sourceBytes||e.rollback.feature.postHash!==n.targetGeneration||e.rollback.feature.previousStatus!==n.previousStatus||Yt(e.rollback.files)!==n.rollbackFiles||e.targetBytes!==n.targetBytes||e.targetGeneration!==n.targetGeneration||vs(e.targetBytes)!==e.targetGeneration||e.rootBefore!==n.rootBefore||e.attestationBefore!==n.attestationBefore)throw ne("The schema-0.2 completion gate was not prepared for this workspace.");return Object.freeze({featureId:n.featureId})}function Lae(t,e,r){let i={feature:GI(t,e).featureId,worst:0,anyFailed:!1,kept:!0,blockers:[],...r===void 0?{}:{independence:r}},s=Object.freeze({type:"done_attempted",payload:Object.freeze(i)}),o=Object.freeze({});return Dae.set(o,Object.freeze({root:Td(t),mark:e,event:s})),o}function Mae(t,e,r){let n=GI(t,e),i=Dae.get(r);if(!i||i.root!==Td(t)||i.mark!==e)throw ne("The schema-0.2 completion event was not prepared for this gate.");Nae.add(e);let s=Object.freeze({}),o=GU.get(e.rollback);if(!o)throw ne("The schema-0.2 completion gate lost its prepared target.");let a=Td(t),c=cqe(a,o.featureId);return jae.set(s,Object.freeze({root:a,targetKey:c,completion:o,event:i.event})),FU.set(c,s),Object.freeze({featureId:n.featureId,writer:s})}function Fae(t,e,r){let n=jae.get(e);if(!n||fae.has(e)||n.root!==Td(t)||FU.get(n.targetKey)!==e)throw ne("The completion receipt does not belong to the current gate epoch.");let i=zae(r,vi(t));if(r.rollback!==n.completion.rollback||i.featureId!==n.completion.featureId||Yt(r.event)!==Yt(n.event))throw ne("The completion receipt does not belong to its successful gate run.");fae.add(e),FU.delete(n.targetKey)}function cqe(t,e){return`${t}\0${e}`}function zae(t,e){let r=GU.get(t.rollback);if(!r||e!==void 0&&r.root!==Td(e)||t.rollback.feature.path!==r.featurePath||t.rollback.feature.before!==r.sourceBytes||t.rollback.feature.postHash!==r.targetGeneration||t.rollback.feature.previousStatus!==r.previousStatus||Yt(t.rollback.files)!==r.rollbackFiles||t.targetBytes!==r.targetBytes||t.targetGeneration!==r.targetGeneration||t.rootBefore!==r.rootBefore||t.attestationBefore!==r.attestationBefore||t.targetGeneration!==t.rollback.feature.postHash||vs(t.targetBytes)!==t.targetGeneration)throw ne("The completion packet was not prepared by the current schema-0.2 done transition.");let n=hae(t.rollback.feature.before,"completion source"),i=hae(t.targetBytes,"completion target"),s=te(i.id);if(te(n.status)!=="in_progress"||te(i.status)!=="done"||!zn("feature",s)||s!==te(n.id))throw ne("The completion target feature identity is malformed.");let o=ec(n);if(o.status="done",delete o.blocked_reason,Yt(i)!==Yt(o))throw ne("The completion target must be the exact allowed done transition.");let a=t.event,c=a&&a.payload;if(a?.type!=="done_attempted"||!bae(a,["payload","type"])||!c||!bae(c,c.independence===void 0?["anyFailed","blockers","feature","kept","worst"]:["anyFailed","blockers","feature","independence","kept","worst"])||te(c.feature)!==s||c.worst!==0||c.kept!==!0||c.anyFailed!==!1||!Array.isArray(c.blockers)||c.blockers.length!==0||c.independence!==void 0&&c.independence!=="independent"&&c.independence!=="self-certified")throw ne("A completion receipt needs the exact successful done_attempted event.");return Object.freeze({featureId:s,feature:Object.freeze(i)})}function hae(t,e){try{return bs(Yn.default.parse(t),e)}catch(r){throw r instanceof q?r:ne(`${e} is not valid YAML.`)}}function Si(t,e,r=[],n={}){let i=vi(t);rr(i,()=>{if(vt(i)!=="0.1")throw new q("STALE_INPUT","The workspace migrated to schema 0.2; retry through the typed edit boundary.");let o=e.map(c=>{let l=st(i,c.path);if(l!==c.before)throw new q("STALE_INPUT",`The legacy source ${c.path} changed while the mutation was being prepared.`);if(c.path==="spec.yaml"&&(!c.rootRegions||c.rootRegions.length===0))throw ne("A compatibility root replacement must declare its exact owned regions.");return{path:c.path,before:l,after:c.after,...c.rootRegions===void 0?{}:{rootRegions:c.rootRegions}}});if(r.length>0){let c=".cladding/events.log.jsonl",l=st(i,c)??"",u=r.map(d=>JSON.stringify(vn(d.type,Zc(i,{...d.payload})))).join(` +`);o.push({path:c,before:l===""&&st(i,c)===null?null:l,after:`${l}${u} +`})}let a=n.refreshDerived?Od(i,o,!0):o;a.length>0&&Gr(i,a)})}function Uae(t,e,r,n,i){let s=vi(t);rr(s,()=>{let o=vt(s),a=i===void 0?void 0:zae(i,s);if(a!==void 0&&o!=="0.2")throw ne("A generated completion receipt is only valid for schema 0.2.");let c=i===void 0?e:i.rootBefore,l=i===void 0?r:i.attestationBefore,u=Pd(s,"generated-attestation");if(c===null||st(s,"spec.yaml")!==c||st(s,u)!==l)throw new q("STALE_INPUT","The workspace changed while the verification receipt was being prepared.");if(!i){let g=n();Gr(s,[{path:u,before:l,after:g}]);return}if(!a)throw ne("A generated completion receipt needs a validated target.");let d=st(s,i.rollback.feature.path);if(d!==i.rollback.feature.before)throw new q("STALE_INPUT","The feature changed while its completion receipt was being prepared.");JU(s,new Map([[i.rollback.feature.path,{...a.feature}]]),Xo(s,"spec.yaml"));let p=n(a),f=Od(s,[{path:i.rollback.feature.path,before:d,after:i.targetBytes}],!0),h=new Map(f.map(g=>[g.path,g]));h.set(u,{path:u,before:l,after:p});let m=".cladding/events.log.jsonl",y=st(s,m),v=JSON.stringify(vn(i.event.type,Zc(s,{...i.event.payload})));h.set(m,{path:m,before:y,after:`${y??""}${v} +`}),i.testBeforeCommit?.(),Gr(s,[...h.values()])})}function HI(t="."){let e=vi(t);return _s(Pn(e,"spec.yaml"))?rr(e,()=>{if(!_s(Pn(e,"spec.yaml")))return!1;let r=new Map(Od(e,[],!0).map(s=>[s.path,s])),n=cae(e);if(n!==null){let s=Pd(e,"generated-doc-links"),o=st(e,s);o!==n&&r.set(s,{path:s,before:o,after:n})}let i=[...r.values()].sort((s,o)=>s.path.localeCompare(o.path));return i.length===0?!1:(Gr(e,i),!0)}):!1}function Bae(t,e){let r=vi(t);return rr(r,()=>{let n=vt(r);if(n!=="0.1"&&n!=="0.2")throw ne("The workspace schema is not supported by the done boundary.");let i=n,s=Qa(r,e,!1),o=st(r,s.path),a=st(r,"spec.yaml"),c=st(r,Pd(r,"generated-attestation"));if(o===null)throw to(`Feature ${e} disappeared before it could be completed.`);if(a===null)throw ne("An initialized specification needs spec.yaml before it can be completed.");let l=te(fn(s.value.design_impact).status)||void 0;if(l==="review_required")throw to("Structural design impact still needs review before this feature can be completed.");let u={modules:Hr(s.value.modules),...l===void 0?{}:{designImpactStatus:l}},d;if(i==="0.2"){if(s.value.status!=="in_progress")throw to("Only an in-progress feature can be completed in schema 0.2.");let y=ec(s.value);y.status="done",delete y.blocked_reason,JU(r,new Map([[s.path,y]]),Xo(r,"spec.yaml")),d=Yn.default.stringify(y)}else d=Vae(o,"done");let p=i==="0.1"?Od(r,[{path:s.path,before:o,after:d}],!0):[];p.length>0&&Gr(r,p);let f=vs(d),h={files:p.map(y=>({path:y.path,before:y.before,postHash:vs(y.after??d_),...y.rootRegions===void 0?{}:{rootRegions:y.rootRegions}})),feature:{path:s.path,before:o,postHash:f,...typeof s.value.status=="string"?{previousStatus:s.value.status}:{}}},m=Object.freeze({previousStatus:te(s.value.status)||"unset",path:Pn(r,s.path),rollback:h,schemaVersion:i,gateScope:u,targetGeneration:f,targetBytes:d,rootBefore:a,attestationBefore:c});if(i==="0.2"){let y=Object.freeze({root:Td(r),featureId:te(s.value.id),rollback:h,featurePath:s.path,sourceBytes:o,targetBytes:d,targetGeneration:f,rootBefore:a,attestationBefore:c,rollbackFiles:Yt(h.files),previousStatus:h.feature.previousStatus});GU.set(h,y),Oae.set(m,y)}return m})}function qae(t,e,r){let n=vi(t);return rr(n,()=>{let i=st(n,e.feature.path);if(i!==null&&vs(i)===r)return{kept:!0,stale:!1};let s=[];if(i!==null&&Hae(i)==="done"){let a=Gae(i,e.feature.previousStatus);a!==i&&s.push({path:e.feature.path,before:i,after:a})}let o=Od(n,s,!0);return o.length>0&&Gr(n,o),{kept:!1,stale:!0}})}function Vae(t,e){return/^status:[ \t]*.*$/m.test(t)?t.replace(/^status:[ \t]*.*$/m,`status: ${e}`):/^id:[ \t]*.*$/m.test(t)?t.replace(/^(id:[ \t]*.*)$/m,`$1 +status: ${e}`):`status: ${e} +${t}`}function Gae(t,e){return e!==void 0?Vae(t,e):t.replace(/^status:[^\n]*(?:\n|$)/m,"")}function Hae(t){try{let e=fn(Yn.default.parse(t)).status;return typeof e=="string"?e:void 0}catch{return}}function HU(t,e){let r=vi(t);rr(r,()=>lqe(r,e))}function lqe(t,e){let r=st(t,e.feature.path),n=[];if(r!==null&&Hae(r)==="done"){let s=vs(r)===e.feature.postHash?e.feature.before:Gae(r,e.feature.previousStatus);s!==r&&n.push({path:e.feature.path,before:r,after:s})}let i=Od(t,n,!0);i.length>0&&Gr(t,i)}function mae(t,e){let r=WI(t,e);return Object.fromEntries([...r].sort().map(n=>[n,WU(t,n)]))}function WI(t,e){let r=new Set;for(let n of e)switch(n.kind){case"project.set_description":case"project.set_purpose":case"project.set_policy":r.add("project");break;case"project.upgrade_schema":r.add("workspace");break;case"capability.upsert":case"capability.remove":r.add("capabilities");break;case"architecture.set_layers":case"architecture_rule.upsert":case"architecture_rule.remove":r.add("architecture");break;case"scenario.upsert":r.add(`scenario:${n.scenario.id}`);break;case"scenario.remove":r.add(`scenario:${n.scenarioId}`);break;case"evidence.revoke":r.add(`evidence:${n.featureId}/${n.digest}`);break;case"feature.create":r.add(`feature:${n.id}`);break;default:r.add(`feature:${n.featureId}`);break}for(let n of r)n.startsWith("feature:")&&Qa(t,n.slice(8),!0),n.startsWith("scenario:")&&f_(t,n.slice(9),!0);return r}function WU(t,e){if(e==="workspace")return BI(t);if(e==="project")return vs(Wae(st(t,"spec.yaml")??"","project")??d_);if(e==="capabilities")return l_(t,"spec/capabilities.yaml");if(e==="architecture")return l_(t,"spec/architecture.yaml");if(e.startsWith("feature:")){let r=Qa(t,e.slice(8),!0);return r?l_(t,r.path):vs(d_)}if(e.startsWith("scenario:")){let r=f_(t,e.slice(9),!0);return r?l_(t,r.path):vs(d_)}if(e.startsWith("evidence:")){let[r,n]=e.slice(9).split("/");return l_(t,`spec/evidence/${r}/${n}.yaml`)}throw new q("INVALID_OPERATION",`Unknown canonical write region ${e}.`)}function BI(t){return E2(t)}function zU(t,e,r){let n=new Map,i=new Map,s=new Set,o=(g,b=!1)=>{let w=n.get(g);if(b&&s.add(g),w)return w;let x=st(t,g);i.set(g,x);let $=x===null?{}:fn(Yn.default.parse(x));return n.set(g,$),$},a=o("spec.yaml");if(a.schema!=="0.2"&&!e.some(g=>g.kind==="project.upgrade_schema"))throw new q("INVALID_OPERATION","Typed specification editing is available only after schema 0.2 migration.");let c=new Set,l=!1,u=!1,d,p,f,h;for(let g of e)switch(g.kind){case"project.set_description":{s.add("spec.yaml");let b=p_(a);g.description===void 0?delete b.description:b.description=He(g.description,"project description");break}case"project.set_purpose":s.add("spec.yaml"),p_(a).purpose=He(g.purpose,"project purpose");break;case"project.set_policy":{s.add("spec.yaml");let b=p_(a);if(g.assuranceLevel!==void 0&&(b.assurance_level=g.assuranceLevel),g.scenarioPolicy!==void 0&&(b.scenario_policy=g.scenarioPolicy),g.assuranceLevel===void 0&&g.scenarioPolicy===void 0)throw ne("project.set_policy needs a policy value");break}case"feature.create":{if(jqe(g.id,g.slug),Qa(t,g.id,!0)||[...n.values()].some(x=>x.id===g.id))throw ne(`Feature ${g.id} already exists.`);let b=`spec/features/${g.slug}-${g.id.slice(2)}.yaml`,w=o(b,!0);Object.assign(w,{id:g.id,title:He(g.title,"feature title"),status:"planned",purpose:He(g.purpose,"feature purpose"),modules:Pt(g.modules??[],"modules"),depends_on:Pt(g.dependsOn??[],"depends_on"),capability_refs:Pt(g.capabilityRefs??[],"capability_refs"),acceptance_criteria:(g.criteria??[]).map(x=>vae(x,!0))}),l=!0;break}case"feature.begin":{let b=zI(t,o,g.featureId,!1,n),w=te(b.status);if(w==="archived")throw to("Archived features cannot be begun.");if(!["planned","blocked","done","in_progress"].includes(w))throw to(`Unknown feature lifecycle state for ${g.featureId}.`);w!=="in_progress"&&(s.add(FI(t,n,g.featureId)),c.add(g.featureId),b.status="in_progress",delete b.blocked_reason,l=!0);break}case"feature.block":{let b=zI(t,o,g.featureId,!0,n),w=He(g.reason,"blocked reason"),x=te(b.status);if(x==="archived"||!["planned","in_progress","blocked","done"].includes(x))throw to(`Feature ${g.featureId} cannot be blocked from its current lifecycle state.`);if(x==="done")throw to(`Begin ${g.featureId} before blocking it.`);(x!=="blocked"||b.blocked_reason!==w)&&(b.status="blocked",b.blocked_reason=w,l=!0);break}case"feature.archive":{let b=zI(t,o,g.featureId,!0,n),w=He(g.reason,"archive reason");if(g.supersededBy!==void 0&&!Lqe(t,n,g.supersededBy))throw rn(`Unknown superseding feature ${g.supersededBy}.`);if(b.status==="archived"){if(b.archive_reason!==w||b.superseded_by!==g.supersededBy)throw to("Archive metadata is immutable once a feature is archived.")}else b.status="archived",b.archive_reason=w,b.archived_at=new Date().toISOString(),g.supersededBy===void 0?delete b.superseded_by:b.superseded_by=g.supersededBy,delete b.blocked_reason,l=!0;break}case"feature.set_title":Tl(t,o,g.featureId,n).title=He(g.title,"feature title");break;case"feature.set_purpose":Tl(t,o,g.featureId,n).purpose=He(g.purpose,"feature purpose");break;case"feature.set_links":{let b=Tl(t,o,g.featureId,n);g.modules!==void 0&&(b.modules=Pt(g.modules,"modules")),g.dependsOn!==void 0&&(b.depends_on=Pt(g.dependsOn,"depends_on")),g.capabilityRefs!==void 0&&(b.capability_refs=Pt(g.capabilityRefs,"capability_refs")),g.modules!==void 0&&(l=!0);break}case"feature.set_design_impact":{let b=Tl(t,o,g.featureId,n);if(g.designImpact===void 0){if(fn(b.design_impact).classification==="structural"&&fn(b.design_impact).status==="review_required")throw to("A pending structural design impact cannot be cleared.");delete b.design_impact}else b.design_impact=yqe(t,g.featureId,fn(b.design_impact),g.designImpact);break}case"criterion.upsert":{let b=Tl(t,o,g.featureId,n),w=Wh(b),x=w.findIndex(I=>I.id===g.criterion.id),$=vae(g.criterion,x<0);x<0?w.push($):w[x]=$,b.acceptance_criteria=w;break}case"criterion.remove":{let b=Tl(t,o,g.featureId,n),w=Wh(b),x=w.findIndex($=>$.id===g.criterionId);if(x<0)throw rn(`Unknown criterion ${g.criterionId}.`);w.splice(x,1),b.acceptance_criteria=w;break}case"criterion.set_proof_refs":{let b=Tl(t,o,g.featureId,n),w=Wh(b),x=w.find($=>$.id===g.criterionId);if(!x)throw rn(`Unknown criterion ${g.criterionId}.`);g.oracleRefs!==void 0&&(x.oracle_refs=Pt(g.oracleRefs,"oracle_refs")),g.evidenceRefs!==void 0&&(x.evidence_refs=Pt(g.evidenceRefs,"evidence_refs")),b.acceptance_criteria=w;break}case"capability.upsert":{let b=o("spec/capabilities.yaml",!0),w=no(b.capabilities),x=ec(g.capability);if(!He(te(x.id),"capability id"))throw ne("Capability id is required.");let $=w.findIndex(I=>I.id===x.id);$<0?w.push(x):w[$]=x,b.capabilities=w,l=!0;break}case"capability.remove":{let b=o("spec/capabilities.yaml",!0),w=no(b.capabilities),x=w.findIndex($=>$.id===g.capabilityId);if(x<0)throw rn(`Unknown capability ${g.capabilityId}.`);w.splice(x,1),b.capabilities=w,l=!0;break}case"architecture.set_layers":o("spec/architecture.yaml",!0).layers=g.layers.map(b=>Pt(b,"architecture layer"));break;case"architecture_rule.upsert":{if(!rqe.test(g.rule.id))throw ne(`Invalid architecture rule id ${g.rule.id}.`);let b=o("spec/architecture.yaml",!0),w=no(b.rules),x=ec(g.rule),$=w.findIndex(I=>I.id===x.id);$<0?w.push(x):w[$]=x,b.rules=w;break}case"architecture_rule.remove":{let b=o("spec/architecture.yaml",!0),w=no(b.rules),x=w.findIndex($=>$.id===g.ruleId);if(x<0)throw rn(`Unknown architecture rule ${g.ruleId}.`);w.splice(x,1),b.rules=w;break}case"scenario.upsert":{let b=g.scenario;if(!zn("scenario",b.id)||!kae.test(b.slug))throw ne("Scenario id and slug are invalid.");let w=f_(t,b.id,!0);if(!w&&!Oa("scenario",b.id))throw ne("New scenarios must use generated identifiers.");let x=w?.path??`spec/scenarios/${b.slug}-${b.id.slice(2)}.yaml`,$=o(x,!0);if(b.steps.length===0||b.featureRefs.length===0)throw ne("Scenario journeys need both steps and at least one feature reference.");Object.assign($,{id:b.id,title:He(b.title,"scenario title"),actor:He(b.actor,"scenario actor"),goal:He(b.goal,"scenario goal"),success:He(b.success,"scenario success"),steps:Pt(b.steps,"scenario steps"),feature_refs:Pt(b.featureRefs,"scenario feature_refs")}),l=!0;break}case"scenario.remove":{let b=f_(t,g.scenarioId,!1);if(!b)throw rn(`Unknown scenario ${g.scenarioId}.`);i.set(b.path,st(t,b.path)),n.set(b.path,{}),s.add(b.path),l=!0;break}case"dependency.promote":{let b=Tl(t,o,g.featureId,n),w=Pt(Hr(b.depends_on),"depends_on");if(w.includes(g.candidate))break;let x=Fqe(t,n),$=x.suggestions[g.featureId]??[],I=new Set(x.dynamicImportFiles);if($.length!==1||$[0]!==g.candidate||Hr(b.modules).some(E=>I.has(E)))throw ne("Dependency promotion requires exactly one current, statically inferable candidate.");b.depends_on=[...w,g.candidate];break}case"evidence.revoke":{if(!/^[a-f0-9]{64}$/.test(g.digest))throw ne("Evidence revocation requires one full content digest.");if(!Qa(t,g.featureId,!0))throw rn(`Unknown evidence feature ${g.featureId}.`);let b=`spec/evidence/${g.featureId}/${g.digest}.yaml`;if(!_s(Pn(t,b)))throw rn(`Unknown evidence receipt ${g.digest}.`);i.set(b,st(t,b)),n.set(b,{}),s.add(b);break}case"project.upgrade_schema":{let b=_qe(t,g.resolutions,n,i,r);if(u=b.applied,d=b.testFileCount,p=b.testFileSetDigest,f=b.previewDigest,h=b.liveProofCensus,u){for(let w of n.keys())s.add(w);l=!0}break}}for(let g of e){if(g.kind!=="feature.begin")continue;let b=Qa(t,g.featureId,!0),w=b?n.get(b.path):void 0,x=b?i.get(b.path):void 0,$=x!=null&&w!==void 0&&Yt(Yn.default.parse(x))!==Yt(w);b&&w?.status==="in_progress"&&$&&c.add(g.featureId)}vqe(t,n,a),JU(t,n,a);let m=[];for(let g of s){let b=n.get(g),w=i.get(g)??st(t,g),x=e.some(E=>E.kind==="scenario.remove"&&f_(t,E.scenarioId,!0)?.path===g||E.kind==="evidence.revoke"&&g.endsWith(`/${E.digest}.yaml`)),$=x?null:pqe(g,w,b,e),I=!x&&w!==null&&Yt(Yn.default.parse(w))===Yt(b);if(w!==$&&!I){let E=g==="spec.yaml"?uqe(e):void 0;m.push({path:g,before:w,after:$,...E===void 0?{}:{rootRegions:E}})}}let y=new Set(m.map(g=>g.path)),v=[];for(let g of[...c].sort())v.push(JSON.stringify(vn("feature_checkpoint",{...Zc(t,{feature:g,git_head:Bs(t),spec_digest:Zy(t)})})));for(let g of e){if(g.kind==="feature.create"){let b=FI(t,n,g.id);y.has(b)&&v.push(JSON.stringify(vn("feature_created",Zc(t,{feature:g.id,slug:g.slug}))))}if(g.kind==="scenario.upsert"){let b=Yae(t,n).find(x=>x.id===g.scenario.id);(b&&m.find(x=>x.path===b.path))?.before===null&&v.push(JSON.stringify(vn("scenario_created",Zc(t,{scenario:g.scenario.id,slug:g.scenario.slug}))))}if(g.kind==="feature.set_design_impact"){let b=FI(t,n,g.featureId),w=n.get(b),x=m.find(E=>E.path===b)?.before,$=x==null?{}:fn(Yn.default.parse(x)),I=fn($.design_impact);y.has(b)&&I.classification==="structural"&&I.status==="review_required"&&fn(w?.design_impact).status==="resolved"&&v.push(JSON.stringify(vn("design_impact_resolved",Zc(t,{feature:g.featureId}))))}}if(v.length>0){let g=".cladding/events.log.jsonl",b=st(t,g)??"";m.push({path:g,before:st(t,g),after:`${b}${v.join(` +`)} +`})}return{files:m,inventoryNeeded:l,checkpointedFeatures:[...c].sort(),migrationApplied:u,...d===void 0?{}:{migrationTestFileCount:d},...p===void 0?{}:{migrationTestFileSetDigest:p},...f===void 0?{}:{migrationPreviewDigest:f},...h===void 0?{}:{migrationLiveProofCensus:h}}}function Od(t,e,r,n){if(!r)return e;let i=new Map(e.map(u=>[u.path,u])),s=i.get("spec.yaml"),o=s?.before??st(t,"spec.yaml"),a=s?.after??o;if(a!==null){let u=fn(Yn.default.parse(a)),d={features:wae(t,"features",u.features,e),scenarios:wae(t,"scenarios",u.scenarios,e),capabilities:zqe(t,u.capabilities,e),test_files:n??qh(t).test_files},p=Koe(a,d),f=new Set(s?.rootRegions??[]);f.add("inventory"),i.set("spec.yaml",{path:"spec.yaml",before:o,after:p,rootRegions:[...f].sort()})}let c=Pd(t,"generated-index"),l=Uqe(t,e,c);l!==null&&i.set(c,{path:c,before:st(t,c),after:l});for(let u of ZU(t))i.set(u.path,u);return[...i.values()].filter(u=>u.before!==u.after).sort((u,d)=>u.path.localeCompare(d.path))}function ZU(t,e){let r;try{r=vt(t)}catch{return[]}if(r!=="0.2")return[];let n="spec/generated/README.md",i=e;if(i===void 0){let a=Rd(t);if(a.artifacts.some(c=>c.presence==="both"))throw new q("INVALID_OPERATION","A generated projection exists at both of its known locations; resolve the conflict before refreshing the generated-directory notice.");i=Voe(a)}let s=TY(i),o=st(t,n);return o===s?[]:[{path:n,before:o,after:s}]}function uqe(t){let e=new Set;for(let r of t)r.kind.startsWith("project.set_")&&e.add("project"),r.kind==="project.upgrade_schema"&&(e.add("schema"),e.add("project"));return e.size===0?void 0:[...e].sort()}function dqe(t,e){let r=new Map(e.map(o=>[o.path,o])),n="spec/index.yaml";if(!r.has(n)){let o=st(t,n);o!==null&&r.set(n,{path:n,before:o,after:o})}let i="spec/_doc-links.yaml";if(!r.has(i)){let o=st(t,i);o!==null&&r.set(i,{path:i,before:o,after:o})}let s="spec/attestation.yaml";if(!r.has(s)){let o=st(t,s);o!==null&&r.set(s,{path:s,before:o,after:null})}return[...r.values()].sort((o,a)=>o.path.localeCompare(a.path))}function pqe(t,e,r,n){if(!(t==="spec.yaml"&&e!==null&&n.some(o=>o.kind.startsWith("project.set_"))&&!n.some(o=>o.kind==="project.upgrade_schema")))return Yn.default.stringify(r);let s=Yn.default.stringify({project:p_(r)});return hqe(e,"project",s)}function Wae(t,e){let r=new RegExp(`^${Zae(e)}:[^\\n]*(?:\\n|$)`,"m").exec(t);if(!r||r.index===void 0)return;let n=r.index;for(;n>0;){let c=n-1,l=t.lastIndexOf(` +`,c-1)+1,u=t.slice(l,n).trim();if(u===""||u.startsWith("#"))n=l;else break}let i=r.index,s=t.slice(i+r[0].length),o=/^(?:[A-Za-z0-9_-]+):(?:[^\n]*(?:\n|$))/m.exec(s),a=o?.index===void 0?fqe(t,i,r[0].length):i+r[0].length+o.index;if(o?.index!==void 0)for(;a>i;){let c=a-1,l=t.lastIndexOf(` +`,c-1)+1,u=t.slice(l,a).trim();if(u===""||u.startsWith("#"))a=l;else break}return t.slice(n,a)}function fqe(t,e,r){let n=e+r,i=e+r;for(let s of t.slice(i).matchAll(/[^\n]*(?:\n|$)/g)){if(s[0]==="")break;/^[ \t]/.test(s[0])&&(n=i+s[0].length),i+=s[0].length}return n}function hqe(t,e,r){let n=Wae(t,e);if(n===void 0)return`${t}${t.endsWith(` +`)||t.length===0?"":` +`}${r}`;let i=t.indexOf(n),s=new RegExp(`^${Zae(e)}:`,"m").exec(n),o=s?.index===void 0?"":n.slice(0,s.index);return`${t.slice(0,i)}${o}${r}${t.slice(i+n.length)}`}function Zae(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function JU(t,e,r){if(r.schema!=="0.2")return;let n=KU(t,e),i=kX(r.project).issues.filter(p=>p.path[0]!=="purpose"||!Bn(n,"project",fn(r.project)));MI(i),MI(wk({capabilities:_ae(t,e)}).issues),MI(xk(Sae(t,e)).issues);let s=JI(t,e);LU(s.map(p=>p.id),"feature");let o=new Set(s.map(p=>p.id)),a=_ae(t,e),c=new Set(a.map(p=>te(p.id))),l=Sae(t,e).rules,u=new Set(no(l).map(p=>te(p.id)));for(let p of s){let f=$X(p.value).issues.filter(m=>{if(m.path[0]==="purpose")return!Bn(n,`feature:${p.id}`,p.value);if(m.path[0]!=="acceptance_criteria"||typeof m.path[1]!="number"||m.path[2]!=="kind")return!0;let y=Wh(p.value)[m.path[1]];return!Bn(n,`criterion:${p.id}/${te(y?.id)}`,y)});if(MI(f),!zn("feature",p.id))throw ne(`Invalid feature id ${p.id}.`);if(gae("feature",p.path,p.id),!["planned","in_progress","done","blocked","archived"].includes(te(p.value.status)))throw ne(`Invalid status for ${p.id}.`);if(te(p.value.status)==="blocked"&&!ro(te(p.value.blocked_reason)))throw ne(`Blocked feature ${p.id} needs a non-empty blocked reason.`);if(te(p.value.status)!=="blocked"&&p.value.blocked_reason!==void 0)throw ne("Only blocked features may retain a blocked reason.");u_(Hr(p.value.modules),`${p.id}.modules`);for(let m of Hr(p.value.modules))mqe(m,`${p.id}.modules`);u_(Hr(p.value.depends_on),`${p.id}.depends_on`),u_(Hr(p.value.capability_refs),`${p.id}.capability_refs`);for(let m of Hr(p.value.depends_on)){if(m===p.id)throw rn(`${p.id} cannot depend on itself.`);if(!o.has(m))throw rn(`${p.id} depends on unknown feature ${m}.`)}for(let m of Hr(p.value.capability_refs))if(!c.has(m))throw rn(`${p.id} links unknown capability ${m}.`);let h=Wh(p.value);LU(h.map(m=>te(m.id)),`criterion in ${p.id}`);for(let m of h){if(!zn("criterion",te(m.id)))throw ne(`Invalid criterion id ${te(m.id)}.`);if(!Bn(n,`criterion:${p.id}/${te(m.id)}`,m)&&Gu(te(m.statement)).status==="invalid")throw ne(`Criterion ${te(m.id)} has an invalid strict statement.`);for(let v of[...Hr(m.oracle_refs),...Hr(m.evidence_refs)])gqe(v,`Criterion ${te(m.id)} proof reference`);for(let v of Hr(m.constraint_refs))if(!u.has(v))throw rn(`Criterion ${te(m.id)} references unknown architecture rule ${v}.`)}}Mqe(s);let d=Yae(t,e);LU(d.map(p=>p.id),"scenario");for(let p of d){let f=Xn(p.value.steps,`${p.id}.steps`),h=Xn(p.value.feature_refs,`${p.id}.feature_refs`);if(!zn("scenario",p.id)||!ro(te(p.value.title))||!ro(te(p.value.actor))||!ro(te(p.value.goal))||!ro(te(p.value.success))||f.length===0||h.length===0)throw ne(`Scenario ${p.id} does not satisfy the schema 0.2 journey contract.`);gae("scenario",p.path,p.id),u_(h,`${p.id}.feature_refs`);for(let m of h)if(!o.has(m))throw rn(`Scenario ${p.id} references unknown feature ${m}.`)}}function MI(t){if(t.length>0)throw ne(t.map(e=>e.message).join(" "))}function LU(t,e){if(t.some(r=>!ro(r))||new Set(t).size!==t.length)throw ne(`Duplicate or empty ${e} identifier.`)}function mqe(t,e){try{lk(t)}catch{throw ne(`${e} contains an unsafe repository path.`)}}function gqe(t,e){let r=t.split("#",1)[0];if(!r||r.startsWith("/")||r.includes("\\")||r.split("/").some(n=>n===".."||n==="."))throw ne(`${e} contains an unsafe path.`)}function gae(t,e,r){if(!Af(t,e))throw ne(`Invalid ${t} shard filename ${e}.`);let n=e.split("/").pop(),i=n.replace(/\.ya?ml$/,"");if(i===r)return;if(Oa(t,r)){try{HY(t,n,r)}catch(o){throw ne(o.message)}return}let s=r.slice(r.indexOf("-")+1);if(i!==r&&(!/^[a-f0-9]{6,}$/.test(s)||!i.endsWith(`-${s}`)))throw ne(`${e} does not match its legacy ${t} identifier ${r}.`)}function KU(t,e){let r=e.get("spec/generated/migration-baseline-0.1-to-0.2.yaml")??(()=>{let s=st(t,"spec/generated/migration-baseline-0.1-to-0.2.yaml");return s===null?void 0:fn(Yn.default.parse(s))})();if(!r||Object.keys(r).length===0)return;let n=r,i=qu(n);if(i.length>0)throw ne(`Invalid migration baseline: ${i.join("; ")}`);return n}function yqe(t,e,r,n){let i=te(n.classification),s=He(te(n.rationale),"design impact rationale");if(vt(t)==="0.2"&&r.classification==="structural"&&r.baseline_digests===void 0&&(i!=="structural"||n.status!=="resolved"))throw ne("A migrated structural design impact without baseline digests may only transition to resolved through its exact immutable migration baseline review.");if(i==="structural"){let o=Pt(Hr(n.artifacts),"design impact artifacts");if(new Set(o).size!==o.length)throw ne("Structural design impact artifacts must be an exact unique set.");if(r.classification==="structural"&&n.status==="resolved"){let c=Pt(Hr(r.artifacts),"recorded structural design artifacts");if(Yt(o)!==Yt(c))throw ne("A structural resolution must retain its recorded artifact set.");let l=new Map(c.map(p=>[p,Zh(t,p)])),u=bqe(t,e,r,c);if(u===void 0&&s!==te(r.rationale))throw ne("A migrated structural design resolution must retain the immutable baseline rationale.");let d=u===void 0?[]:c.filter(p=>u[p]===l.get(p));if(d.length>0)throw to(`Structural design impact is not resolved; unchanged artifact(s): ${d.join(", ")}.`);return{...r,rationale:s,status:"resolved"}}if(n.status==="resolved")throw ne("A new structural design impact must begin in review_required state.");let a=Object.fromEntries(o.map(c=>[c,Zh(t,c)]));return{classification:i,rationale:s,status:"review_required",artifacts:o,baseline_digests:a}}if(n.status==="review_required")throw ne("Only structural design impact may require review.");return{classification:i,rationale:s,status:"resolved",...n.artifacts===void 0?{}:{artifacts:Pt(Hr(n.artifacts),"design impact artifacts")}}}function Zh(t,e){let r;try{r=lk(e)}catch{throw ne(`Design impact artifact contains an unsafe repository path: ${e}.`)}if(!Lu(r).some(s=>s.domain==="design"))throw ne(`Design impact artifact is not a registered design document: ${e}.`);let n=Pn(t,r);if(!_s(n)||!xae(n).isFile())throw ne(`Design impact artifact must be a regular file: ${e}.`);let i=st(t,r);if(i===null)throw ne(`Design impact artifact must be a regular file: ${e}.`);return vs(i)}function bqe(t,e,r,n){if(new Set(n).size!==n.length)throw ne("Structural design impact artifacts must be an exact unique set.");let i=r.baseline_digests;if(i===void 0){if(vt(t)==="0.2"){let a=KU(t,new Map);if(!bk(a,e,r))throw ne("A schema 0.2 structural design impact requires complete baseline digests or an exact immutable migration baseline review.")}return}if(i===null||typeof i!="object"||Array.isArray(i))throw ne("Structural design impact baseline digests must be an object.");let s=i,o=Object.keys(s);if(o.length!==n.length||n.some(a=>!UI.test(te(s[a])))||o.some(a=>!n.includes(a)))throw ne("Structural design impact baseline digests must exactly match its recorded design artifacts.");return s}function vqe(t,e,r){if(r.schema!=="0.2")return;let n=KU(t,e);if(n)for(let i of JI(t,e)){let s=`feature:${i.id}`;if(n.features.find(a=>a.address===s)?.exemption!==void 0&&!Bn(n,s,i.value)&&!ro(te(i.value.purpose)))throw ne(`${i.id} changed its title and now requires an explicit purpose.`);for(let a of Wh(i.value)){let c=`criterion:${i.id}/${te(a.id)}`;if(n.criteria.find(u=>u.address===c)?.exemption!==void 0&&!Bn(n,c,a)&&!["behavior","quality","constraint"].includes(te(a.kind)))throw ne(`${i.id}/${te(a.id)} changed its legacy intent and now requires an explicit kind.`)}}}function _qe(t,e,r,n,i){let s=r.get("spec.yaml")??Xo(t,"spec.yaml");if(s.schema==="0.2"){if(_s(Pn(t,"spec/generated/migration-baseline-0.1-to-0.2.yaml")))return{applied:!1};throw ne("A schema 0.2 workspace without its migration baseline cannot replay an upgrade.")}let o=a_(t,{lockHeld:i});if(e.previewDigest!==Jh(o))throw new q("STALE_INPUT","The migration preview changed; review the current candidate before applying it.");if(o.sourceSchema!=="0.1"||o.targetSchema!=="0.2")throw ne("Migration preview is not safe to apply.");if(o.independence.requirePolicyDoneLosses.length>0)throw new q("MIGRATION_UNRESOLVED",`Schema 0.2 cannot inherit asserted legacy independence for completed features: ${o.independence.requirePolicyDoneLosses.join(", ")}. Obtain supported replacement receipts before migrating.`);Iqe(o,e.confirmed);let a=new Set(e.confirmed.map(I=>`${I.code}|${I.subject}`));if(o.requiredResolution.filter(I=>!a.has(`${I.code}|${I.subject}`)).length>0)throw new q("MIGRATION_UNRESOLVED","Migration still has unresolved human decisions.");let l=kqe(e),u=ec(s),d=Sqe(t,o,e,u),p=s;p.schema="0.2";let f=p_(p);o.project.purpose!==void 0?f.purpose=qI(e,"PROJECT_PURPOSE_CONFIRMATION","project",o.project.purpose):delete f.purpose,f.assurance_level=yae(e,"PROJECT_ASSURANCE_LEVEL_CONFIRMATION","project",["L1","L2","L3","L4"],o.project.assuranceLevel),f.scenario_policy=yae(e,"PROJECT_SCENARIO_POLICY_CONFIRMATION","project",["off","advisory","required"],o.project.scenarioPolicy),delete f.intent_summary,delete p.features,delete p.scenarios,delete p.capabilities,delete p.architecture,r.set("spec.yaml",p),n.set("spec.yaml",st(t,"spec.yaml"));let h="spec/generated/migration-baseline-0.1-to-0.2.yaml";if(_s(Pn(t,h)))throw ne("A migration baseline already exists.");let m=ec(o.baseline),y=[],v=new Map,g=[];for(let I of o.requiredResolution.filter(E=>E.code==="ADR_REFERENCE_REVIEW")){let E=$qe(e,I.subject),R=m.criteria.find(A=>A.address===I.subject);if(!R)throw new q("MIGRATION_UNRESOLVED",`ADR review subject ${I.subject} is absent from the baseline.`);R.adrReview=E}for(let I of o.features){let E=UU(t,u,I.path,"features",I.address.slice(8)),R=te(E.id),A=no(E.acceptance_criteria).map(ee=>{let T=te(ee.id),j=o.criteria.find(de=>de.address===`criterion:${R}/${T}`),Ne=`criterion:${R}/${T}`,U=j?.scan.status==="conflict"?"CRITERION_STATEMENT_CONFLICT":j?.scan.status==="unknown"?"CRITERION_TEXT_UNKNOWN":void 0,H=U?Jae(e,U,Ne,j):void 0,Oe=H?.statement??j?.statement;if(!Oe)throw new q("MIGRATION_UNRESOLVED",`Criterion ${R}/${T} needs an explicit statement resolution.`);let F={id:T,statement:Oe};return H&&(F.kind=H.kind,H.rationale!==void 0&&(F.rationale=H.rationale),H.constraintRefs!==void 0&&(F.constraint_refs=H.constraintRefs)),H||(eo(ee,F,"rationale"),eo(ee,F,"constraint_refs")),H?.bindingDisposition==="retain"&&y.push({criterion:Ne,intent:{statement:H.statement,kind:H.kind,...H.rationale===void 0?{}:{rationale:H.rationale},...H.constraintRefs===void 0||H.constraintRefs.length===0?{}:{constraintRefs:[...H.constraintRefs].sort()}},bindings:H.retainedTestBindings}),eo(ee,F,"oracle_refs"),eo(ee,F,"evidence_refs"),eo(ee,F,"notes"),v.set(Ne,F),E.status==="done"&&g.push(Ne),F}),B={id:R,title:te(E.title),status:te(E.status)||"planned",modules:Hr(E.modules),depends_on:Hr(E.depends_on),capability_refs:Rqe(o,e,R),acceptance_criteria:A},Z=o.baseline.features.find(ee=>ee.address===`feature:${R}`);Z?.purpose!==void 0&&(B.purpose=Z.purpose),eo(E,B,"design_impact"),eo(E,B,"archived_at"),eo(E,B,"archive_reason"),eo(E,B,"superseded_by"),eo(E,B,"blocked_reason"),eo(E,B,"notes"),r.set(I.targetPath,B),n.set(I.targetPath,st(t,I.targetPath))}y.length>0&&(m.reviewedCarryForwards=y.sort((I,E)=>I.criterion.localeCompare(E.criterion))),m.legacyL2Baseline=Eqe(o,l,v,g),r.set(h,m),n.set(h,null);let b="spec/capabilities.yaml",w={capabilities:Cqe(o,e)};r.set(b,w),n.set(b,st(t,b));let x="spec/architecture.yaml",$=Tqe(o,e);r.set(x,$),n.set(x,st(t,x));for(let I of o.scenarios){let E=UU(t,u,I.path,"scenarios",I.address.slice(9)),R=YU(e,"SCENARIO_MEANING_REQUIRED",I.address);In(R,["actor","goal","success","steps","feature_refs"],"SCENARIO_MEANING_REQUIRED resolution");let A={id:te(E.id),title:te(E.title),actor:He(te(R.actor),"scenario actor"),goal:He(te(R.goal),"scenario goal"),success:He(te(R.success),"scenario success"),steps:Pt(Xn(R.steps,"scenario steps"),"scenario steps"),feature_refs:Pt(Xn(R.feature_refs,"scenario feature_refs"),"scenario feature_refs")};if(A.steps.length===0||A.feature_refs.length===0)throw new q("MIGRATION_UNRESOLVED","Scenario migration needs non-empty steps and feature_refs.");r.set(I.targetPath,A),n.set(I.targetPath,st(t,I.targetPath))}return xqe(o,r),{applied:!0,testFileCount:o.testFileCount,testFileSetDigest:o.testFileSetDigest,previewDigest:Jh(o),...d===void 0?{}:{liveProofCensus:d}}}function Sqe(t,e,r,n){let i=new Map(e.features.map(c=>{let l=c.address.slice(8),u=UU(t,n,c.path,"features",l);return[l,te(u.status)]})),s=[];for(let c of e.criteria){let l=c.scan.status==="conflict"?"CRITERION_STATEMENT_CONFLICT":c.scan.status==="unknown"?"CRITERION_TEXT_UNKNOWN":void 0;if(!l||!c.legacyBindings.some(f=>f.channel==="test"))continue;let u=Jae(r,l,c.address,c),d=c.address.slice(10),p=d.slice(0,d.indexOf("/"));i.get(p)==="done"&&u.bindingDisposition==="drop"&&s.push(d)}if(s.length===0)return;let o=e.criteria.map(c=>c.address.slice(10)).sort(),a=Fa(t,new Set(o));for(let c of s.sort())if(!a.bindings.some(u=>u.criterion===c&&u.carrier==="title"&&(u.framework==="vitest"||u.framework==="jest")))throw new q("MIGRATION_UNRESOLVED",`Completed criterion ${c} cannot drop historic test inputs without an exact current safe [covers:] title carrier.`);return{criteria:o,digest:a.digest}}function wqe(t,e){return Fa(t,new Set(e.criteria)).digest===e.digest}function xqe(t,e){let r=t.features.map(s=>{let o=e.get(s.targetPath);if(!o||typeof o.id!="string")throw new q("MIGRATION_UNRESOLVED","Migration planned feature artifacts no longer match the reviewed identity proof.");return o}),n=t.scenarios.map(s=>{let o=e.get(s.targetPath);if(!o||typeof o.id!="string")throw new q("MIGRATION_UNRESOLVED","Migration planned scenario artifacts no longer match the reviewed identity proof.");return o}),i={features:r.map(s=>te(s.id)).sort(),criteria:r.flatMap(s=>no(s.acceptance_criteria).map(o=>`${te(s.id)}/${te(o.id)}`)).sort(),scenarios:n.map(s=>te(s.id)).sort()};if(Yt(i.features)!==Yt(t.identityProof.features.candidate)||Yt(i.criteria)!==Yt(t.identityProof.criteria.candidate)||Yt(i.scenarios)!==Yt(t.identityProof.scenarios.candidate))throw new q("MIGRATION_UNRESOLVED","Migration planned artifacts do not preserve the reviewed source identity/count proof.")}function UU(t,e,r,n,i){if(r!=="spec.yaml")return Xo(t,r);let o=no(e[n]).find(a=>a.id===i);if(!o)throw new q("MIGRATION_UNRESOLVED",`Migration source ${n}/${i} disappeared from spec.yaml.`);return ec(o)}function Jh(t){return vs(iae(t))}function kqe(t){let e=t.confirmed.filter(n=>n.code==="PROJECT_LEGACY_L2_BASELINE"&&n.subject==="project"),r=e[0]?.value;if(e.length!==1||r!=="accept"&&r!=="reject")throw new q("MIGRATION_UNRESOLVED","The completed-legacy-criterion L2 baseline needs one explicit accept or reject decision.");return r}function Eqe(t,e,r,n){let i=[...n].sort(Na),s=db(i);if(i.length!==t.legacyL2Baseline.candidateCount||s!==t.legacyL2Baseline.candidateCensusSha256)throw new q("MIGRATION_UNRESOLVED","The converted completed-legacy criterion census no longer matches the reviewed preview.");let o=Jh(t),a=D2({previewSha256:o,decision:e,candidateCount:t.legacyL2Baseline.candidateCount,candidateCensusSha256:t.legacyL2Baseline.candidateCensusSha256}),c=e==="accept"?i.map(l=>{let u=yk(r.get(l));if(!u)throw new q("MIGRATION_UNRESOLVED",`Completed criterion ${l.slice(10)} has no final intent to authorize.`);let d=gk(u),p={criterion:l,sourceStatus:"done",finalIntentSha256:d,obligations:[...nl],candidateSha256:"",resolutionSha256:a};return{...p,candidateSha256:N2(p)}}):[];return{decision:e,previewSha256:o,candidateCount:t.legacyL2Baseline.candidateCount,candidateCensusSha256:t.legacyL2Baseline.candidateCensusSha256,resolutionSha256:a,authorizations:c}}function qI(t,e,r,n){let i=t.confirmed.filter(o=>o.code===e&&o.subject===r);if(i.length>1)throw new q("MIGRATION_UNRESOLVED",`Migration resolution ${e} for ${r} is ambiguous.`);let s=i[0];if(!s){if(n!==void 0)return n;throw new q("MIGRATION_UNRESOLVED",`Migration resolution ${e} for ${r} is required.`)}if(s.value===void 0&&n!==void 0)return n;if(typeof s.value!="string"||!ro(s.value))throw new q("MIGRATION_UNRESOLVED",`Migration resolution ${e} for ${r} needs a non-empty text candidate.`);return s.value}function YU(t,e,r){let n=t.confirmed.filter(i=>i.code===e&&i.subject===r);if(n.length!==1||!n[0].value||typeof n[0].value!="object"||Array.isArray(n[0].value))throw new q("MIGRATION_UNRESOLVED",`Migration resolution ${e} for ${r} needs exactly one structured candidate.`);return n[0].value}function Jae(t,e,r,n){let i=YU(t,e,r);In(i,["statement","kind","rationale","constraintRefs","testBindingDisposition","retainedTestRefs"],`${e} resolution`);let s=He(te(i.statement),`${e} statement`),o=i.kind;if(o!=="behavior"&&o!=="quality"&&o!=="constraint")throw new q("MIGRATION_UNRESOLVED",`${e} needs an explicit criterion kind.`);if(Gu(s).status==="invalid")throw new q("MIGRATION_UNRESOLVED",`${e} statement is not a valid strict statement.`);let a=i.rationale===void 0?void 0:He(te(i.rationale),`${e} rationale`),c=i.constraintRefs===void 0?void 0:Pt(Xn(i.constraintRefs,`${e} constraintRefs`),`${e} constraintRefs`);if(o==="constraint"&&!a&&(!c||c.length===0))throw new q("MIGRATION_UNRESOLVED",`${e} constraint kind needs rationale or constraint refs.`);let l=n?.reviewedTestCandidates??[],u=l.length>0,d=i.testBindingDisposition,p=d==="retain"||d==="drop"?d:void 0;if(u&&p===void 0)throw new q("MIGRATION_UNRESOLVED",`${e} must explicitly retain selected historic test inputs or drop them.`);if(!u&&d!==void 0)throw new q("MIGRATION_UNRESOLVED",`${e} has no historic test inputs to retain or drop.`);let f=p==="retain"?Aqe(i,l,e):[];if(p==="drop"&&i.retainedTestRefs!==void 0)throw new q("MIGRATION_UNRESOLVED",`${e} cannot select test inputs after choosing drop.`);return{statement:s,kind:o,...a===void 0?{}:{rationale:a},...c===void 0?{}:{constraintRefs:c},...p===void 0?{}:{bindingDisposition:p},retainedTestBindings:f}}function Aqe(t,e,r){let n=Pt(Xn(t.retainedTestRefs,`${r} retainedTestRefs`),`${r} retainedTestRefs`);if(n.length===0||new Set(n).size!==n.length)throw new q("MIGRATION_UNRESOLVED",`${r} retain needs one or more distinct exact historic test refs.`);let i=new Map(e.map(s=>[s.raw,s]));return n.map(s=>{let o=i.get(s);if(!o||o.state!=="available"||o.sha256===void 0)throw new q("MIGRATION_UNRESOLVED",`${r} can retain only safe preview-bound whole-file test inputs.`);return{raw:o.raw,file:o.file,...o.selector===void 0?{}:{selector:o.selector},sha256:o.sha256}})}function $qe(t,e){let r=YU(t,"ADR_REFERENCE_REVIEW",e);In(r,["disposition","rationale"],"ADR_REFERENCE_REVIEW resolution");let n=te(r.disposition);if(!["retain_external","superseded","not_applicable"].includes(n))throw new q("MIGRATION_UNRESOLVED","ADR review needs an explicit supported disposition.");return{disposition:n,rationale:He(te(r.rationale),"ADR review rationale")}}function yae(t,e,r,n,i){let s=t.confirmed.find(o=>o.code===e&&o.subject===r);if(!s||s.value===void 0)return i;if(typeof s.value!="string"||!n.includes(s.value))throw new q("MIGRATION_UNRESOLVED",`Migration resolution ${e} for ${r} has an invalid selected value.`);return s.value}function Iqe(t,e){let r=new Set(t.requiredResolution.map(i=>`${i.code}|${i.subject}`)),n=new Set;for(let i of e){let s=`${i.code}|${i.subject}`;if(!r.has(s))throw new q("MIGRATION_UNRESOLVED",`Migration resolution ${s} is not part of the current preview.`);if(n.has(s))throw new q("MIGRATION_UNRESOLVED",`Migration resolution ${s} is ambiguous.`);Pqe(i),n.add(s)}}function Pqe(t){if(t.code==="PROJECT_LEGACY_L2_BASELINE"){if(t.subject!=="project"||t.value!==void 0&&t.value!=="accept"&&t.value!=="reject")throw new q("MIGRATION_UNRESOLVED","Completed-legacy-criterion L2 baseline needs an explicit accept or reject decision.");return}if(t.value===void 0)return;let e=new Set(["PROJECT_PURPOSE_CONFIRMATION","PROJECT_ASSURANCE_LEVEL_CONFIRMATION","PROJECT_SCENARIO_POLICY_CONFIRMATION","CAPABILITY_OUTCOME_CONFIRMATION","ARCHITECTURE_RULE_RATIONALE"]),r=new Set(["CRITERION_STATEMENT_CONFLICT","CRITERION_TEXT_UNKNOWN","CAPABILITY_RECORD_RESOLUTION","CAPABILITY_EDGE_RESOLUTION","SCENARIO_MEANING_REQUIRED","ARCHITECTURE_LAYER_RESOLUTION","ARCHITECTURE_RULE_RESOLUTION","ADR_REFERENCE_REVIEW"]);if(e.has(t.code)&&(typeof t.value!="string"||!ro(t.value)))throw new q("MIGRATION_UNRESOLVED",`${t.code} needs a non-empty text decision when a value is supplied.`);if(r.has(t.code)&&(!t.value||typeof t.value!="object"||Array.isArray(t.value)))throw new q("MIGRATION_UNRESOLVED",`${t.code} needs a structured resolved candidate.`)}function Rqe(t,e,r){return Kae(t,e).filter(n=>n.featureId===r).map(n=>n.capabilityId).sort()}function Kae(t,e){let r=e.confirmed.filter(a=>a.code==="CAPABILITY_EDGE_RESOLUTION");if(r.length>1)throw new q("MIGRATION_UNRESOLVED","Capability edge migration has more than one resolved candidate.");if(r.length===0){if(!t.capabilityEdgeProof.equal)throw new q("MIGRATION_UNRESOLVED","Capability edge migration needs an explicit resolved candidate.");return t.capabilityEdgeProof.candidatePairs}let n=bs(r[0].value,"CAPABILITY_EDGE_RESOLUTION value");In(n,["pairs"],"CAPABILITY_EDGE_RESOLUTION value");let i=VI(n.pairs,"CAPABILITY_EDGE_RESOLUTION pairs").map(a=>(In(a,["capabilityId","featureId"],"CAPABILITY_EDGE_RESOLUTION pair"),{capabilityId:He(te(a.capabilityId),"capability edge id"),featureId:He(te(a.featureId),"capability edge feature")})).sort((a,c)=>`${a.capabilityId}|${a.featureId}`.localeCompare(`${c.capabilityId}|${c.featureId}`));if(new Set(i.map(a=>`${a.capabilityId}|${a.featureId}`)).size!==i.length||Yt(i)!==Yt(t.capabilityEdgeProof.legacyPairs))throw new q("MIGRATION_UNRESOLVED","The resolved capability edges do not re-prove the legacy L = N pair set.");let s=new Set(t.features.map(a=>a.address.slice(8))),o=new Set(t.capabilities.map(a=>a.id));if(i.some(a=>!s.has(a.featureId)||!o.has(a.capabilityId)))throw new q("MIGRATION_UNRESOLVED","A resolved capability edge names a feature or capability absent from the current candidate.");return i}function Cqe(t,e){let r=new Map;for(let o of e.confirmed.filter(a=>a.code==="CAPABILITY_RECORD_RESOLUTION")){let a=bs(o.value,"CAPABILITY_RECORD_RESOLUTION value");In(a,["id","title","outcome"],"CAPABILITY_RECORD_RESOLUTION value");let c=He(te(a.id),"capability id");if(o.subject!==`capability:${c}`)throw new q("MIGRATION_UNRESOLVED","Capability record resolution must bind its id to its capability subject.");if(r.has(c))throw new q("MIGRATION_UNRESOLVED",`Capability record resolution for ${c} is duplicated.`);r.set(c,{id:c,title:He(te(a.title),"capability title"),outcome:He(te(a.outcome),"capability outcome")})}let n=t.capabilities.map(o=>{let a=r.get(o.id);if(a)return{...a,outcome:qI(e,"CAPABILITY_OUTCOME_CONFIRMATION",`capability:${o.id}`,He(te(a.outcome),"capability outcome"))};if(!o.title)throw new q("MIGRATION_UNRESOLVED",`Capability ${o.id} needs its CAPABILITY_RECORD_RESOLUTION.`);return{id:o.id,title:o.title,outcome:qI(e,"CAPABILITY_OUTCOME_CONFIRMATION",`capability:${o.id}`,o.outcome)}});for(let o of r.keys())if(!n.some(a=>a.id===o))throw new q("MIGRATION_UNRESOLVED",`Capability record resolution ${o} does not belong to the current preview.`);let i=Kae(t,e),s=new Set(n.map(o=>te(o.id)));if(new Set(n.map(o=>te(o.id))).size!==n.length||i.some(o=>!s.has(o.capabilityId)))throw new q("MIGRATION_UNRESOLVED","Resolved capabilities do not provide a unique record for every resolved edge.");return n.sort((o,a)=>te(o.id).localeCompare(te(a.id)))}function Tqe(t,e){let r=t.architecture.layers,n,i;for(let o of e.confirmed.filter(a=>a.code==="ARCHITECTURE_LAYER_RESOLUTION")){let a=bs(o.value,"ARCHITECTURE_LAYER_RESOLUTION value");In(a,["layers"],"ARCHITECTURE_LAYER_RESOLUTION value");let c=ZI(a.layers,"architecture layers").map(l=>Pt(Xn(l,"architecture layer"),"architecture layer"));if(n!==void 0&&Yt(n)!==Yt(c))throw new q("MIGRATION_UNRESOLVED","Architecture layer resolutions disagree on the final candidate.");n=c}n!==void 0&&(r=n);for(let o of e.confirmed.filter(a=>a.code==="ARCHITECTURE_RULE_RESOLUTION")){let a=bs(o.value,"ARCHITECTURE_RULE_RESOLUTION value");In(a,["rules"],"ARCHITECTURE_RULE_RESOLUTION value");let c=VI(a.rules,"architecture rules").map(l=>{if(In(l,["id","kind","from","to","rationale"],"architecture rule"),l.kind!=="forbidden_import")throw new q("MIGRATION_UNRESOLVED","Architecture rule kind must be forbidden_import.");return{id:He(te(l.id),"architecture rule id"),kind:"forbidden_import",from:He(te(l.from),"architecture rule from"),to:He(te(l.to),"architecture rule to"),rationale:He(te(l.rationale),"architecture rule rationale")}});if(i!==void 0&&Yt(i)!==Yt(c))throw new q("MIGRATION_UNRESOLVED","Architecture rule resolutions disagree on the final candidate.");i=c}if(!r)throw new q("MIGRATION_UNRESOLVED","Architecture conversion needs explicit layers.");let s=i??t.architecture.rules.map(o=>({id:o.id,kind:o.kind,from:o.from,to:o.to,rationale:qI(e,"ARCHITECTURE_RULE_RATIONALE",`architecture_rule:${o.id}`)}));return{layers:r,rules:s}}function eo(t,e,r){t[r]!==void 0&&(e[r]=ec(t[r]))}function Oqe(t,e){let r=e.map(n=>n.path).filter(n=>!n.startsWith(".cladding/")).sort();if(r.length!==0)try{try{uae("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]})}catch(i){let s=i;if(!Nqe(t)&&(s.status===128||s.code==="ENOENT"))return;throw i}if(uae("git",["-c","status.showUntrackedFiles=all","status","--porcelain=v1","--untracked-files=all","--ignored=matching","--",...r],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim())throw new q("DIRTY_PLANNED_PATH","Migration planned paths have uncommitted changes; unrelated paths may remain dirty.")}catch(n){throw n instanceof q?n:new q("INVALID_OPERATION",`Unable to verify migration planned-path dirt: ${n.message}`)}}function Nqe(t){if(process.env.GIT_DIR||process.env.GIT_WORK_TREE)return!0;let e=vi(t);for(;;){try{return xae(Pn(e,".git")),!0}catch(n){if(n.code!=="ENOENT")return!0}let r=tqe(e);if(r===e)return!1;e=r}}function vs(t){return QBe("sha256").update(t).digest("hex")}function l_(t,e){return vs(st(t,e)??d_)}function Yt(t){return JSON.stringify(BU(t))}function BU(t){return Array.isArray(t)?t.map(BU):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).sort(([e],[r])=>e.localeCompare(r)).map(([e,r])=>[e,BU(r)])):t}function fn(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function bs(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw ne(`${e} must be an object.`);return t}function ZI(t,e){if(!Array.isArray(t))throw ne(`${e} must be an array.`);return t}function VI(t,e){return ZI(t,e).map((r,n)=>bs(r,`${e}[${n}]`))}function Xn(t,e){return ZI(t,e).map((r,n)=>{if(typeof r!="string")throw ne(`${e}[${n}] must be a string.`);return r})}function $n(t,e){return He(te(t[e]),e)}function In(t,e,r){let n=new Set(e);for(let i of Object.keys(t))if(!n.has(i))throw ne(`${r} does not accept the field ${i}.`)}function te(t){return typeof t=="string"?t:""}function no(t){return Array.isArray(t)?t.filter(e=>!!e&&typeof e=="object"&&!Array.isArray(e)).map(e=>ec(e)):[]}function Hr(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"):[]}function Pt(t,e){let r=[...t];if(r.some(n=>!ro(n)))throw ne(`${e} must contain only non-empty strings.`);return u_(r,e),r}function ro(t){return t.trim().length>0}function He(t,e){if(!ro(t))throw ne(`${e} must be non-empty.`);return t}function ec(t){return JSON.parse(JSON.stringify(t))}function bae(t,e){if(!t||typeof t!="object")return!1;let r=Object.keys(t).sort(),n=[...e].sort();return r.length===n.length&&r.every((i,s)=>i===n[s])}function Td(t){let e=vi(t);try{return MU(e)}catch{return e}}function Dqe(t,e){try{return MU(t)===MU(e)}catch{return vi(t)===vi(e)}}function XU(t){try{return Buffer.byteLength(JSON.stringify(t))}catch{throw ne("Typed edit transport must be JSON serializable.")}}function ne(t){return new q("INVALID_OPERATION",t)}function rn(t){return new q("UNKNOWN_REFERENCE",t)}function to(t){return new q("LIFECYCLE",t)}function p_(t){let e=fn(t.project);return t.project=e,e}function u_(t,e){if(new Set(t).size!==t.length)throw ne(`${e} may not contain duplicate references.`)}function jqe(t,e){if(!Oa("feature",t)||!kae.test(e))throw ne("Feature id and slug are invalid.")}function vae(t,e=!0){if(!zn("criterion",t.id)||e&&!Oa("criterion",t.id))throw ne(`Invalid criterion id ${t.id}.`);let r={id:t.id,kind:t.kind,statement:He(t.statement,"criterion statement")};return t.rationale!==void 0&&(r.rationale=He(t.rationale,"criterion rationale")),t.constraintRefs!==void 0&&(r.constraint_refs=Pt(t.constraintRefs,"constraint_refs")),t.oracleRefs!==void 0&&(r.oracle_refs=Pt(t.oracleRefs,"oracle_refs")),t.evidenceRefs!==void 0&&(r.evidence_refs=Pt(t.evidenceRefs,"evidence_refs")),t.notes!==void 0&&(r.notes=t.notes),r}function Wh(t){return no(t.acceptance_criteria)}function Qa(t,e,r){let n=Pn(t,"spec","features");if(!_s(n))return r?null:(()=>{throw rn(`Unknown feature ${e}.`)})();for(let i of h_(n).sort()){if(!/\.ya?ml$/.test(i))continue;let s=`spec/features/${i}`,o=Xo(t,s);if(o.id===e)return{id:e,path:s,value:o}}return r?null:(()=>{throw rn(`Unknown feature ${e}.`)})()}function f_(t,e,r){let n=Pn(t,"spec","scenarios");if(!_s(n))return r?null:(()=>{throw rn(`Unknown scenario ${e}.`)})();for(let i of h_(n).sort()){if(!/\.ya?ml$/.test(i))continue;let s=`spec/scenarios/${i}`,o=Xo(t,s);if(o.id===e)return{id:e,path:s,value:o}}return r?null:(()=>{throw rn(`Unknown scenario ${e}.`)})()}function FI(t,e,r){let n=[...e.entries()].find(([i,s])=>i.startsWith("spec/features/")&&s.id===r);return n?n[0]:Qa(t,r,!1).path}function zI(t,e,r,n=!1,i){return e(i?FI(t,i,r):Qa(t,r,!1).path,n)}function Tl(t,e,r,n){let i=zI(t,e,r,!0,n);if(i.status==="archived")throw to(`Archived feature ${r} is terminal and cannot be edited.`);return i}function Lqe(t,e,r){return[...e.values()].some(n=>n.id===r)||Qa(t,r,!0)!==null}function JI(t,e){let r=[],n=Pn(t,"spec","features");if(_s(n)){for(let i of h_(n).sort())if(/\.ya?ml$/.test(i)){let s=`spec/features/${i}`,o=e.get(s)??Xo(t,s);typeof o.id=="string"&&r.push({id:o.id,path:s,value:o})}}for(let[i,s]of e)i.startsWith("spec/features/")&&!r.some(o=>o.path===i)&&typeof s.id=="string"&&r.push({id:s.id,path:i,value:s});return r}function Yae(t,e){let r=[],n=Pn(t,"spec","scenarios");if(_s(n)){for(let i of h_(n).sort())if(/\.ya?ml$/.test(i)){let s=`spec/scenarios/${i}`,o=e.get(s)??Xo(t,s);typeof o.id=="string"&&r.push({id:o.id,path:s,value:o})}}for(let[i,s]of e)i.startsWith("spec/scenarios/")&&!r.some(o=>o.path===i)&&typeof s.id=="string"&&r.push({id:s.id,path:i,value:s});return r}function _ae(t,e){return no((e.get("spec/capabilities.yaml")??Xo(t,"spec/capabilities.yaml")).capabilities)}function Sae(t,e){return e.get("spec/architecture.yaml")??Xo(t,"spec/architecture.yaml")}function Mqe(t){let e=new Map(t.map(s=>[s.id,Hr(s.value.depends_on)])),r=new Set,n=new Set,i=s=>{if(r.has(s))throw rn(`Dependency cycle includes ${s}.`);if(!n.has(s)){r.add(s);for(let o of e.get(s)??[])i(o);r.delete(s),n.add(s)}};for(let s of e.keys())i(s)}function Fqe(t,e){let r={features:JI(t,e).map(n=>n.value)};return Hh(r,n=>{if(!n||n.startsWith("/")||n.split("/").some(i=>i==="."||i===".."))return null;try{return eqe(Pn(t,n),"utf8")}catch{return null}})}function wae(t,e,r,n){if(Array.isArray(r)&&r.length>0)return r.length;let i=new Set,s=Pn(t,"spec",e);if(_s(s))for(let o of h_(s))/\.ya?ml$/.test(o)&&i.add(`spec/${e}/${o}`);for(let o of n)o.path.startsWith(`spec/${e}/`)&&(o.after===null?i.delete(o.path):i.add(o.path));return i.size}function zqe(t,e,r){if(Array.isArray(e)&&e.length>0)return e.length;let n=r.find(i=>i.path==="spec/capabilities.yaml")?.after??st(t,"spec/capabilities.yaml");return n?no(fn(Yn.default.parse(n)).capabilities).length:0}function Uqe(t,e,r="spec/index.yaml"){let n=JI(t,new Map(e.filter(s=>s.path.startsWith("spec/features/")&&s.after!==null).map(s=>[s.path,fn(Yn.default.parse(s.after))])));if(n.length===0&&!_s(Pn(t,"spec","features")))return null;let i=n.sort((s,o)=>s.id.localeCompare(o.id)).map(s=>` ${s.id}: {slug: ${el(s.path,s.id)}, status: ${te(s.value.status)||"planned"}, modules: ${Hr(s.value.modules).length}}`);return`# Cladding \xB7 Tier C \u2014 generated feature index (\`clad sync\`). Do not edit by hand. +# One line per feature \u2192 1-file lookup + line-independent merges +# (suggested .gitattributes: \`${r} merge=union\`). +features: +`+i.join(` +`)+` +`}var Yn,d_,rqe,kae,Eae,Aae,UI,dae,nqe,iqe,sqe,$ae,Iae,st,GU,Oae,Nae,Dae,jae,fae,FU,wi=S(()=>{"use strict";Yn=Et(cr(),1);kI();ji();ff();_f();Cd();Li();RU();kk();Vu();Vh();Vh();jI();Ak();LI();Uf();kr();d_="",rqe=/^AR-[a-f0-9]{8}$/,kae=/^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$/,Eae=16*1024,Aae=128,UI=/^[a-f0-9]{64}$/,dae=_.object({id:_.string(),kind:_.enum(["behavior","quality","constraint"]),statement:_.string(),rationale:_.string().optional(),constraintRefs:_.array(_.string()).optional(),oracleRefs:_.array(_.string()).optional(),evidenceRefs:_.array(_.string()).optional(),notes:_.string().optional()}).strict(),nqe=_.object({id:_.string(),slug:_.string(),title:_.string(),actor:_.string(),goal:_.string(),success:_.string(),steps:_.array(_.string()),featureRefs:_.array(_.string())}).strict(),iqe=_.object({code:_.string(),subject:_.string(),value:_.unknown().optional()}).strict(),sqe=_.discriminatedUnion("classification",[_.object({classification:_.literal("none"),rationale:_.string(),status:_.literal("resolved").optional()}).strict(),_.object({classification:_.literal("additive"),rationale:_.string(),status:_.literal("resolved").optional()}).strict(),_.object({classification:_.literal("structural"),rationale:_.string(),status:_.enum(["review_required","resolved"]).optional(),artifacts:_.array(_.string())}).strict()]),$ae=_.discriminatedUnion("kind",[_.object({kind:_.literal("project.set_description"),description:_.string().optional()}).strict(),_.object({kind:_.literal("project.set_purpose"),purpose:_.string()}).strict(),_.object({kind:_.literal("project.set_policy"),assuranceLevel:_.enum(["L1","L2","L3","L4"]).optional(),scenarioPolicy:_.enum(["off","advisory","required"]).optional()}).strict(),_.object({kind:_.literal("feature.create"),id:_.string(),slug:_.string(),title:_.string(),purpose:_.string(),modules:_.array(_.string()).optional(),dependsOn:_.array(_.string()).optional(),capabilityRefs:_.array(_.string()).optional(),criteria:_.array(dae).optional()}).strict(),_.object({kind:_.literal("feature.begin"),featureId:_.string()}).strict(),_.object({kind:_.literal("feature.block"),featureId:_.string(),reason:_.string()}).strict(),_.object({kind:_.literal("feature.archive"),featureId:_.string(),reason:_.string(),supersededBy:_.string().optional()}).strict(),_.object({kind:_.literal("feature.set_title"),featureId:_.string(),title:_.string()}).strict(),_.object({kind:_.literal("feature.set_purpose"),featureId:_.string(),purpose:_.string()}).strict(),_.object({kind:_.literal("feature.set_links"),featureId:_.string(),modules:_.array(_.string()).optional(),dependsOn:_.array(_.string()).optional(),capabilityRefs:_.array(_.string()).optional()}).strict(),_.object({kind:_.literal("feature.set_design_impact"),featureId:_.string(),designImpact:sqe.optional()}).strict(),_.object({kind:_.literal("criterion.upsert"),featureId:_.string(),criterion:dae}).strict(),_.object({kind:_.literal("criterion.remove"),featureId:_.string(),criterionId:_.string()}).strict(),_.object({kind:_.literal("criterion.set_proof_refs"),featureId:_.string(),criterionId:_.string(),oracleRefs:_.array(_.string()).optional(),evidenceRefs:_.array(_.string()).optional()}).strict(),_.object({kind:_.literal("capability.upsert"),capability:_.object({id:_.string(),title:_.string(),outcome:_.string()}).strict()}).strict(),_.object({kind:_.literal("capability.remove"),capabilityId:_.string()}).strict(),_.object({kind:_.literal("architecture.set_layers"),layers:_.array(_.array(_.string()))}).strict(),_.object({kind:_.literal("architecture_rule.upsert"),rule:_.object({id:_.string(),kind:_.literal("forbidden_import"),from:_.string(),to:_.string(),rationale:_.string()}).strict()}).strict(),_.object({kind:_.literal("architecture_rule.remove"),ruleId:_.string()}).strict(),_.object({kind:_.literal("scenario.upsert"),scenario:nqe}).strict(),_.object({kind:_.literal("scenario.remove"),scenarioId:_.string()}).strict(),_.object({kind:_.literal("dependency.promote"),featureId:_.string(),candidate:_.string()}).strict(),_.object({kind:_.literal("evidence.revoke"),featureId:_.string(),digest:_.string()}).strict(),_.object({kind:_.literal("project.upgrade_schema"),resolutions:_.object({previewDigest:_.string().regex(UI),confirmed:_.array(iqe)}).strict()}).strict()]),Iae=_.array($ae).min(1).max(Aae);st=Tr;GU=new WeakMap,Oae=new WeakMap,Nae=new WeakSet,Dae=new WeakMap,jae=new WeakMap,fae=new WeakSet,FU=new Map});import{createHash as Yh}from"node:crypto";import{existsSync as Kh,lstatSync as Xae,readFileSync as Nd,readdirSync as rce}from"node:fs";import{join as tc}from"node:path";function YI(t){let e=Yh("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} +`)}),e.digest("hex")}function Bqe(t,e){let r=Yh("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(Nd(tc(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function ice(t,e){let r=Yh("sha256");try{r.update(Nd(tc(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function e4(t,e=oe(t)){let r=["spec.yaml",...nVe(t)].sort();return Object.freeze({spec:e,sourceFiles:Object.freeze(r.map(n=>({path:n,bytes:Nd(tc(t,n),"utf8")})))})}function io(t){let e=tc(t,AI(t,"generated-attestation"));if(!Kh(e))return null;let r;try{r=Nd(e,"utf8")}catch{return null}let n=null,i=null,s=null,o=null,a=null,c={},l="other";for(let d of r.split(` +`)){if(d==="policy:"){l="policy";continue}if(d==="attested:"){l="v1",n??=new Map;continue}if(d==="attested_modules:"){l="modules",i??=new Map;continue}if(d==="attested_features:"){l="features",s??=new Set;continue}if(d==="attested_v3:"){l="v3",o??=new Map,a??=new Set;continue}if(!(d.startsWith("#")||d.trim()==="")){if(l==="policy"){let p=d.match(/^ {2}cladding: "([^"]+)"$/),f=d.match(/^ {2}blocking: (strict)$/),h=d.match(/^ {2}detectors_sha256: ([0-9a-f]{64})$/);p&&(c.cladding=p[1]),f&&(c.blocking=f[1]),h&&(c.detectorsSha256=h[1])}else if(l==="v1"){let p=d.match(/^ {2}(F-[\w-]+): ([0-9a-f]{16})$/);p&&n.set(p[1],p[2])}else if(l==="modules"){let p=d.match(/^ {2}(.+): ([0-9a-f]{16})$/);p&&i.set(p[1],p[2])}else if(l==="features"){let p=d.match(/^ {2}(F-[\w-]+): ok$/);p&&s.add(p[1])}else if(l==="v3"){let p=d.match(/^ {2}(F-[\w-]+):(?: .*)?$/);p&&(a.add(p[1]),o.delete(p[1]));let f=d.match(/^ {2}(F-[\w-]+): (.+)$/);if(!f)continue;try{let h=sVe(JSON.parse(f[2]),f[1]);h&&o.set(f[1],h)}catch{}}}}return{policy:c.cladding!==void 0&&c.blocking==="strict"&&c.detectorsSha256!==void 0?{cladding:c.cladding,blocking:c.blocking,detectorsSha256:c.detectorsSha256}:null,v1:n,modules:i,features:s,v3:o,v3ObservedFeatures:a}}function XI(t){return t.v3!==null||t.features!==null?new Set([...t.v3?[...t.v3.keys()]:[],...t.features?[...t.features]:[]]).size:t.v1?.size??0}function QI(t,e,r){let n=r.modules??[];if(t.modules!==null||t.features!==null){if(!t.features?.has(r.id))return{state:"unattested"};let s=t.modules??new Map;for(let o of[...n].sort())if(s.get(o)!==ice(e,o))return{state:"stale",module:o};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Bqe(e,n)?{state:"fresh"}:{state:"stale"}}function sce(t,e,r){let n=t.v3?.get(e);if(!n)return{state:"unattested"};for(let i of["profile","configured_assurance_level","achieved_assurance_level","scope_sha256","input_sha256","contract_sha256","subject_sha256","verification_sha256","runtime_dependency_sha256","profile_sha256","obligation_sha256","registry_sha256","detector_catalog_sha256","tool_identity","environment_class","trust_snapshot_sha256","migration_baseline"])if(i==="migration_baseline"?!ace(n.migration_baseline,r.migration_baseline):n[i]!==r[i])return{state:"stale",field:i};return{state:"fresh"}}function oce(t,e,r){let n=t.v3?.get(e);if(!n)return{state:"unattested"};for(let i of["contract_sha256","subject_sha256","verification_sha256","runtime_dependency_sha256"])if(n[i]!==r[i])return{state:"stale",field:i};return{state:"fresh"}}function t4(t,e,r,n,i,s={}){let o=s.writeLegacy!==!1;if(n?.some(p=>!nM(p)))throw new q("INVALID_OPERATION","Attestation v3 rows must come from a complete authoritative profile verdict.");if(s.completion!==void 0&&(i===void 0||i.runtime===void 0))throw new q("STALE_INPUT","A completion receipt needs its captured verification-input snapshot.");if((e.features??[]).filter(p=>p.status==="done"&&(p.modules??[]).length>0).length===0&&(n?.length??0)===0)return!1;let c=tc(t,"spec.yaml"),l=tc(t,Pd(t,"generated-attestation"));if(!Kh(c))throw new q("INVALID_OPERATION","An initialized specification needs spec.yaml with an exact supported schema before writing an attestation.");let u=s.completion===void 0?Nd(c,"utf8"):s.completion.rootBefore,d=s.completion===void 0?Kh(l)?Nd(l,"utf8"):null:s.completion.attestationBefore;return Uae(t,u,d,p=>{if(i&&(!ece(t,i,s.completion!==void 0)||s.completion===void 0&&!m_(i.spec,e)))throw new q("STALE_INPUT","A sealed verification input changed while the gate was running.");let f=p===void 0?r4(t):eVe(t,p);if(p===void 0&&!m_(f,e))throw new q("STALE_INPUT","The specification changed after the verification gate snapshot.");if(p!==void 0){if(!m_(f,e))throw new q("INVALID_OPERATION","The completion receipt Spec does not match its locked replacement target.");tVe(t,p),rVe(n,i,p)}let h=io(t),m=Vqe(t,f,h,n,s.retention,s.completion),y=iVe(t,f,r,m.entries,o,m.suppressedLegacyFeatures);if(i&&(!ece(t,i,s.completion!==void 0)||s.completion===void 0&&!m_(i.spec,e)))throw new q("STALE_INPUT","A sealed verification input changed while the attestation was being rendered.");return y},s.completion),!0}function Vqe(t,e,r,n,i,s){if(n===void 0)return{entries:void 0,suppressedLegacyFeatures:new Set};let o=new Set(n.map(p=>p.feature)),a=new Set((e.features??[]).filter(p=>p.status==="done").map(p=>p.id)),c=new Set,l=dte(i),u=l&&Gqe(l,n)?Hqe(t,e,l,s):void 0;for(let p of r?.v3ObservedFeatures??[])!o.has(p)&&!r?.v3?.has(p)&&c.add(p);return{entries:[...[...r?.v3?.values()??[]].flatMap(p=>{if(o.has(p.feature))return[];let f=!1;try{f=a.has(p.feature)&&u!==void 0&&Wqe(p,u)}catch{f=!1}return f?[p]:(c.add(p.feature),[])}),...n].sort((p,f)=>p.featuref.feature?1:0),suppressedLegacyFeatures:c}}function Gqe(t,e){let r=["configured_assurance_level","registry_sha256","detector_catalog_sha256","tool_identity","environment_class","trust_snapshot_sha256"];return t.current.trust_snapshot_sha256===t.receiptContext.trustSnapshot.digest&&e.every(n=>r.every(i=>n[i]===t.current[i]))}function Hqe(t,e,r,n){try{let i=Xqe(t,n);if(i.schemaVersion!=="0.2"||!i.contract)return;let s=i.contract.project.assuranceLevel??"L2",o=Jqe(t,r.receiptContext);if(!o)return;let a=md(t),c=Wn(t,i,o,e,a),l=Yh("sha256").update(It(Vo),"utf8").digest("hex");return{cwd:t,spec:e,state:r,configured:s,compilation:i,closureInput:c,receiptContext:o,registrySha256:l,controlResolver:a,profiles:new Map}}catch{return}}function Wqe(t,e){let{state:r,configured:n}=e;if(t.configured_assurance_level!==n||t.achieved_assurance_level!==n||t.configured_assurance_level!==r.current.configured_assurance_level||t.registry_sha256!==r.current.registry_sha256||t.detector_catalog_sha256!==r.current.detector_catalog_sha256||t.tool_identity!==r.current.tool_identity||t.environment_class!==r.current.environment_class||t.trust_snapshot_sha256!==r.current.trust_snapshot_sha256||e.registrySha256!==r.current.registry_sha256)return!1;let i=Zqe(t,e);if(!i||!i.snapshot.complete||t.scope_sha256!==Qqe(i.snapshot.effectiveScopeAddresses)||t.input_sha256!==i.snapshot.inputSha256)return!1;let s=ml(e.closureInput,t.feature);return t.contract_sha256!==s.contractSha256||t.subject_sha256!==s.subjectSha256||t.verification_sha256!==s.verificationSha256||t.runtime_dependency_sha256!==s.runtimeDependencySha256||!ace(t.migration_baseline,cVe(i.profile,i.snapshot.migrationBaselineCandidates))?!1:t.profile_sha256===rM({profile:t.profile,assuranceLevel:n,configuredAssuranceLevel:n,registrySha256:e.registrySha256,detectorCatalogSha256:r.current.detector_catalog_sha256,toolIdentity:r.current.tool_identity,environmentClass:r.current.environment_class,trustSnapshotSha256:e.receiptContext.trustSnapshot.digest})}function Zqe(t,e){let r=t.profile==="completion"?`${t.profile}:${t.feature}`:t.profile;if(e.profiles.has(r))return e.profiles.get(r);let n=Wo(t.profile,e.configured),i=IE(e.compilation,n,t.profile==="completion"?[`feature:${t.feature}`]:void 0);if(!i.complete||!i.featureIds.includes(t.feature)){e.profiles.set(r,void 0);return}let s=new Set(i.featureIds),o=new Set(nh(e.spec).filter(l=>s.has(l.featureId)).map(l=>`criterion:${l.featureId}/${l.acId}`)),a=PE(e.cwd,e.compilation,{profile:n,scopeAddresses:i.scopeAddresses,scopeComplete:i.complete,hasExecutableTests:hd(e.compilation,i.scopeAddresses),oracleRequiredSubjects:o,requiresHuman:e.configured==="L4",closureInput:e.closureInput,controlResolver:e.controlResolver}),c={profile:n,scope:i,snapshot:a};return e.profiles.set(r,c),c}function Jqe(t,e){let r=g_(t);if(!r)return;if(e.currentLocations===void 0)return e.candidates.length===0&&r.length===0?e:void 0;let n=e.currentLocations.map(o=>o.path);if(e.candidates.length!==e.currentLocations.length||new Set(n).size!==n.length||!Kqe(r.map(o=>o.path),n))return;let i=new Map(r.map(o=>[o.path,o])),s=[];for(let o of e.currentLocations){if(!/^spec\/evidence\/[^/]+\/[a-f0-9]{64}\.yaml$/.test(o.path)||o.path.split("/").includes(".."))return;let a=i.get(o.path);if(!a)return;s.push({bytes:a.bytes,expected:o.expected})}return Yqe(e.candidates,s)?{candidates:s,trustSnapshot:e.trustSnapshot,currentLocations:e.currentLocations}:void 0}function g_(t){let e="spec/evidence";if(!Kh(tc(t,e)))return[];try{let r=xn(t,e),n=Xae(r);if(!n.isDirectory()||n.isSymbolicLink())return;let i=[],s=(o,a)=>{for(let c of rce(o).sort()){if(qL.has(c))continue;let l=`${a}/${c}`,u=xn(t,l),d=Xae(u);if(d.isSymbolicLink())return!1;if(d.isDirectory()){if(!s(u,l))return!1}else if(d.isFile()){if(!/^spec\/evidence\/[^/]+\/[a-f0-9]{64}\.yaml$/.test(l))return!1;let p=Nd(u),f=yr(p),h=new TextDecoder("utf-8",{fatal:!0}).decode(p);if(h!==Zf(f))return!1;let m=`spec/evidence/${Ha(f)}/${fl(f)}.yaml`;if(l!==m)return!1;i.push({path:l,bytes:h})}else return!1}return!0};return s(r,e)?i.sort((o,a)=>o.patha.path?1:0):void 0}catch{return}}function Kqe(t,e){let r=[...t].sort(),n=[...e].sort();return r.length===n.length&&r.every((i,s)=>i===n[s])}function Yqe(t,e){let r=new Map;for(let n of t){let i=Qae(n);if(!i)return!1;r.set(i,(r.get(i)??0)+1)}for(let n of e){let i=Qae({bytes:n.bytes,expected:n.expected});if(!i)return!1;let s=r.get(i)??0;if(s===0)return!1;s===1?r.delete(i):r.set(i,s-1)}return r.size===0}function Qae(t){try{let e=typeof t.bytes=="string"?t.bytes:new TextDecoder("utf-8",{fatal:!0}).decode(t.bytes);return yr(e),Yh("sha256").update(e,"utf8").update("\0","utf8").update(It(t.expected),"utf8").digest("hex")}catch{return}}function Xqe(t,e){let r=di(t);if(!e)return r;let n=nce.default.parse(e.targetBytes);return typeof n.id=="string"?rl(r,n.id):r}function Qqe(t){return Yh("sha256").update(It([...t].sort()),"utf8").digest("hex")}function ece(t,e,r=!1){try{let n=e4(t,r4(t));return(r||m_(n.spec,e.spec))&&n.sourceFiles.length===e.sourceFiles.length&&n.sourceFiles.every((i,s)=>i.path===e.sourceFiles[s]?.path&&i.bytes===e.sourceFiles[s]?.bytes)&&(e.runtime===void 0||e.runtime.complete&&e.runtime.matchesCurrent())}catch{return!1}}function eVe(t,e){let r=r4(t);if((r.features??[]).filter(i=>i.id===e.featureId).length!==1)throw new q("INVALID_OPERATION","The locked completion target does not identify exactly one current feature.");return Bu(r,e.featureId)}function tVe(t,e){let r=rl(di(t),e.featureId),n=r.contract?.features.find(i=>i.id===e.featureId);if(r.schemaVersion!=="0.2"||n?.status!=="done")throw new q("INVALID_OPERATION","The locked completion target does not produce a schema-0.2 done compiler view.")}function rVe(t,e,r){if(!e.runtime?.complete||!t||t.length!==1||t[0]?.feature!==r.featureId||t[0].profile!=="completion"||t[0].input_sha256!==e.runtime.inputSha256)throw new q("INVALID_OPERATION","The completion receipt does not seal its exact feature and verification input.")}function nVe(t){let e=["spec/capabilities.yaml","spec/architecture.yaml","spec/generated/migration-baseline-0.1-to-0.2.yaml"],r=["spec/features","spec/scenarios"].flatMap(n=>{let i=tc(t,n);return Kh(i)?rce(i).filter(s=>/\.ya?ml$/.test(s)).map(s=>`${n}/${s}`):[]});return[...e.filter(n=>Kh(tc(t,n))),...r]}function r4(t){return pl(t)}function iVe(t,e,r,n,i,s){let o=(e.features??[]).filter(f=>f.status==="done"&&(f.modules??[]).length>0),a=new Set;for(let f of o)for(let h of f.modules??[])a.add(h);let c=[...a].sort().map(f=>` ${f}: ${ice(t,f)}`),l=[...n??[]].sort((f,h)=>f.featureh.feature?1:0).map(f=>` ${f.feature}: ${JSON.stringify(f)}`),u=new Set((n??[]).map(f=>f.feature)),d=o.filter(f=>!s.has(f.id)).filter(f=>i||!u.has(f.id)).map(f=>` ${f.id}: ok`).sort(),p=`attested_modules: +`+c.join(` `)+` attested_features: -`+s.join(` +`+d.join(` `)+` -`;return Jbe(Y_(t,...iZ),a,"utf8"),!0}var iZ,Xbe,El=y(()=>{"use strict";iZ=["spec","attestation.yaml"];Xbe=`# 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. +`;return qqe+(r?`policy: + cladding: ${JSON.stringify(r.cladding)} + blocking: ${r.blocking} + detectors_sha256: ${r.detectorsSha256} +`:"")+p+(l.length>0?`attested_v3: +${l.join(` +`)} +`:"")}function sVe(t,e){if(!t||typeof t!="object")return;let r=t,n=[r.scope_sha256,r.input_sha256,r.contract_sha256,r.subject_sha256,r.verification_sha256,r.runtime_dependency_sha256,r.profile_sha256,r.obligation_sha256,r.registry_sha256,r.detector_catalog_sha256,r.trust_snapshot_sha256],i=new Set(["L1","L2","L3","L4"]),s=oVe(r.observation_counts);if(!(r.attestation_schema==="3"&&r.feature===e&&(r.profile==="completion"||r.profile==="push"||r.profile==="release")&&i.has(r.configured_assurance_level??"")&&(r.achieved_assurance_level==="none"||i.has(r.achieved_assurance_level??""))&&n.every(c=>/^[a-f0-9]{64}$/.test(c??""))&&typeof r.tool_identity=="string"&&r.tool_identity.length>0&&typeof r.environment_class=="string"&&r.environment_class.length>0&&/^[a-f0-9]{64}$/.test(r.observation_set_sha256??"")&&typeof r.observation_count=="number"&&Number.isSafeInteger(r.observation_count)&&r.observation_count>=0&&!("observation_identities"in r)&&s!==void 0&&r.observation_count>=s.required-s.migration_baseline)||s===void 0)return;let a=aVe(r.migration_baseline,s.migration_baseline);if(!(a===void 0&&s.migration_baseline!==0)&&!(a===void 0&&r.migration_baseline!==void 0))return{...r,observation_counts:s,...a===void 0?{}:{migration_baseline:a}}}function oVe(t){if(!t||typeof t!="object"||Array.isArray(t))return;let e=t,r=Object.keys(e).sort(),n=r.join(",")==="na,pass,required",i=r.join(",")==="migration_baseline,na,pass,required";if(!n&&!i)return;let{required:s,pass:o,na:a}=e,c=n?0:e.migration_baseline;if(typeof s=="number"&&Number.isSafeInteger(s)&&s>0&&typeof o=="number"&&Number.isSafeInteger(o)&&o>=0&&o<=s&&typeof a=="number"&&Number.isSafeInteger(a)&&a>=0&&typeof c=="number"&&Number.isSafeInteger(c)&&c>=0&&c<=s&&o<=s-c)return Object.freeze({required:s,pass:o,na:a,migration_baseline:c})}function aVe(t,e){if(e===0||!t||typeof t!="object"||Array.isArray(t))return;let r=t,n=Object.keys(r).sort(Bt),i=r.baseline_receipt_sha256,s=r.resolution_sha256,o=r.criterion_authorization_set_sha256,a=r.criterion_count,c=r.obligation_count;if(!(n.join(",")!=="baseline_receipt_sha256,criterion_authorization_set_sha256,criterion_count,obligation_count,resolution_sha256"||!QU(i)||!QU(s)||!QU(o)||!tce(a)||!tce(c)||c!==e||c!==2*a))return Object.freeze({baseline_receipt_sha256:i,resolution_sha256:s,criterion_authorization_set_sha256:o,criterion_count:a,obligation_count:c})}function cVe(t,e){if(!t.obligations.includes("stage_2.1")||!t.obligations.includes("stage_2.2")||e.length===0||e.some(i=>i.obligations.length!==2||i.obligations[0]!=="stage_2.1"||i.obligations[1]!=="stage_2.2"))return;let r=e[0].basis;if(e.some(i=>i.basis.baseline_receipt_sha256!==r.baseline_receipt_sha256||i.basis.resolution_sha256!==r.resolution_sha256))return;let n=e.map(i=>i.basis.criterion_authorization_sha256).sort(Bt);if(new Set(n).size===n.length)return Object.freeze({baseline_receipt_sha256:r.baseline_receipt_sha256,resolution_sha256:r.resolution_sha256,criterion_authorization_set_sha256:iE(n),criterion_count:n.length,obligation_count:n.length*2})}function ace(t,e){return It(t??null)===It(e??null)}function tce(t){return typeof t=="number"&&Number.isSafeInteger(t)&&t>0}function QU(t){return typeof t=="string"&&/^[a-f0-9]{64}$/.test(t)}function m_(t,e){return JSON.stringify(KI(t))===JSON.stringify(KI(e))}function KI(t){return Array.isArray(t)?t.map(KI):!t||typeof t!="object"?t:Object.fromEntries(Object.entries(t).sort(([e],[r])=>er?1:0).map(([e,r])=>[e,KI(r)]))}var nce,qqe,Ol=S(()=>{"use strict";nce=Et(cr(),1);sE();gd();Go();OE();qa();Rb();Qb();Zu();kn();wi();gt();qn();Cf();Cd();qqe=`# Cladding \xB7 Tier C \u2014 verification attestation. Legacy module rows retain byte compatibility; +# schema 0.1 feature rows need a GREEN strict pre-push gate; v3 replaces a schema 0.2 feature row only after an authoritative profile-complete GREEN result. # Do not edit by hand. # # policy: verifier identity: Cladding version, strict blocking, @@ -212,139 +352,127 @@ attested_features: # value = sha256 of that file's bytes (16 hex). Editing a # file moves exactly its own line \u2014 not every co-owning # feature's \u2014 so parallel work rarely conflicts here. -# attested_features: one constant \`ok\` marker per done feature with modules. -# STALE_ATTESTATION calls a feature fresh only when its -# marker is present AND every module hash still matches. +# attested_features: legacy constant \`ok\` markers for done features not +# replaced by a v3 row. STALE_ATTESTATION reads the v3 +# closure seal first, otherwise this marker + modules. # # 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 wR}from"node:path";function eb(t){fs={cwd:wR(t),results:new Map}}function cZ(t,e,r){!fs||fs.cwd!==wR(e)||fs.results.set(t,r)}function tb(t,e){return!fs||fs.cwd!==wR(e)?null:fs.results.get(t)??null}function rb(){fs=null}var fs,Al=y(()=>{"use strict";fs=null});function Tt(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 bo=y(()=>{});import{fileURLToPath as Qbe}from"node:url";var Ol,eve,xR,$R,Tl=y(()=>{Ol=(t,e)=>{let r=$R(eve(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},eve=t=>xR(t)?t.toString():t,xR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,$R=t=>t instanceof URL?Qbe(t):t});var nb,kR=y(()=>{bo();Tl();nb=(t,e=[],r={})=>{let n=Ol(t,"First argument"),[i,o]=Tt(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(!Tt(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as tve}from"node:string_decoder";var lZ,uZ,qt,vo,rve,dZ,nve,ib,fZ,ive,Qf,ove,ER,sve,an=y(()=>{({toString:lZ}=Object.prototype),uZ=t=>lZ.call(t)==="[object ArrayBuffer]",qt=t=>lZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rve=new TextEncoder,dZ=t=>rve.encode(t),nve=new TextDecoder,ib=t=>nve.decode(t),fZ=(t,e)=>ive(t,e).join(""),ive=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new tve(e),n=t.map(o=>typeof o=="string"?dZ(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Qf=t=>t.length===1&&qt(t[0])?t[0]:ER(ove(t)),ove=t=>t.map(e=>typeof e=="string"?dZ(e):e),ER=t=>{let e=new Uint8Array(sve(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},sve=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as ave}from"node:child_process";var gZ,yZ,cve,lve,pZ,uve,mZ,hZ,dve,_Z=y(()=>{bo();an();gZ=t=>Array.isArray(t)&&Array.isArray(t.raw),yZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=cve({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,{}]},cve=({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}=lve(i,t.raw[n]),c=mZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>hZ(d)):[hZ(l)];return mZ(c,u,a)},lve=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=pZ.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)],hZ=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Tt(t)&&("stdout"in t||"isMaxBuffer"in t))return dve(t);throw t instanceof ave||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`)},dve=({stdout:t})=>{if(typeof t=="string")return t;if(qt(t))return ib(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 AR from"node:process";var ri,ob,Pn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[AR.stdin,AR.stdout,AR.stderr],Pn=["stdin","stdout","stderr"],sb=t=>Pn[t]??`stdio[${t}]`});import{debuglog as fve}from"node:util";var vZ,OR,pve,mve,hve,gve,bZ,yve,TR,_ve,bve,vve,Sve,RR,wo,xo=y(()=>{bo();So();vZ=t=>{let e={...t};for(let r of RR)e[r]=OR(t,r);return e},OR=(t,e)=>{let r=Array.from({length:pve(t)+1}),n=mve(t[e],r,e);return bve(n,e)},pve=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Pn.length):Pn.length,mve=(t,e,r)=>Tt(t)?hve(t,e,r):e.fill(t),hve=(t,e,r)=>{for(let n of Object.keys(t).sort(gve))for(let i of yve(n,r,e))e[i]=t[n];return e},gve=(t,e)=>bZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,yve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=TR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{createHash as lVe}from"node:crypto";function dce(t,e,r){let n=g_(t);if(n===void 0)return uce({layerId:cce,nodes:[],edges:[],completeness:"unknown",unknownReasons:["receipt census is unsafe"]});let i=new Set(e.nodes.filter(c=>c.nodeType==="semantic").map(c=>c.address)),s=[],o=[],a=[];for(let c of n){let l=uVe(c),u=ct(c.path);if(!l){a.push(`receipt ${c.path} is not a portable receipt`),s.push(lce(u,[],hVe(c.bytes)));continue}let d=fl(l),p=`feature:${Ha(l)}`;if(s.push(lce(u,i.has(p)?[p]:[],d)),!i.has(l.subject)){a.push(`receipt ${c.path} names unknown subject ${l.subject}`);continue}if(!l.subject.startsWith("criterion:")){a.push(`receipt ${c.path} names feature subject ${l.subject} that carries no criterion-scoped supports fact`);continue}o.push(dVe(l.subject,u,d,pVe(l,r)))}return uce({layerId:cce,nodes:s.sort((c,l)=>c.address.localeCompare(l.address)),edges:o.sort((c,l)=>c.identity.localeCompare(l.identity)),completeness:a.length===0?"complete":"unknown",unknownReasons:[...new Set(a)].sort()})}function uVe(t){try{return yr(t.bytes)}catch{return}}function lce(t,e,r){return Object.freeze({address:t,nodeType:"artifact",roles:Object.freeze(["evidence"]),owners:Object.freeze([...e]),provenance:"observed",locator:Object.freeze({kind:"runtime_observation",adapter:n4,reference:r})})}function dVe(t,e,r,n){return Object.freeze({identity:`${n4}:${t}->${e}:${r}`,from:t,to:e,relation:"supports",provenance:"observed",owner:Object.freeze({kind:"runtime_observation",adapter:n4,reference:r}),state:n,channel:"evidence",normalizedTarget:e})}function pVe(t,e){if(!e)return"unknown";let r=e.expectedDigests(t);if(!r)return"unknown";let n=ud({receipt:t,trustSnapshot:e.trustSnapshot,expected:r});return n?fVe(n.receipt)?"passed":"failed":"unknown"}function fVe(t){return t.method==="blind_capability"?t.verdict==="pass":t.claim==="uat"?Object.values(t.criterion_verdicts).every(e=>e==="pass")&&Object.values(t.checks).every(e=>e==="pass"):Object.values(t.checks).every(e=>e==="pass")}function hVe(t){return lVe("sha256").update(t,"utf8").digest("hex")}function uce(t){return Object.freeze({...t,nodes:Object.freeze([...t.nodes]),edges:Object.freeze([...t.edges]),unknownReasons:Object.freeze([...t.unknownReasons])})}var cce,n4,pce=S(()=>{"use strict";qs();Ol();kn();Lb();cce="receipt-observations",n4="receipt-facts@1"});function mce(t,e,r){let n=mVe(t,e);if(n.length>0)return i4(n);if(r===void 0)return i4(["current-gate observation context is missing"]);if(!Rte(r))return i4(["current-gate testcase ledger is unsealed"]);let i=e.bindings.map(s=>yVe(s,r,r.identity)).sort((s,o)=>s.identity.localeCompare(o.identity));return gce({layerId:hce,nodes:[],edges:i,completeness:"complete",unknownReasons:[]})}function mVe(t,e){let r=new Set(t.nodes.filter(i=>i.nodeType==="semantic"&&i.kind==="criterion").map(i=>i.address)),n=[...e.safe?[]:["current-safe binding census is unsafe"],...e.diagnostics.length===0?[]:["current-safe binding census has diagnostics"],...e.bindings.every(i=>gVe(i,r))?[]:["current-safe binding census does not match the compiler snapshot"]];return Object.freeze(n)}function gVe(t,e){if(!t||typeof t.criterion!="string"||typeof t.file!="string"||typeof t.selector!="string"||t.framework!=="vitest"&&t.framework!=="jest"||t.carrier!=="title"&&t.carrier!=="metadata"&&t.carrier!=="annotation"||!e.has(`criterion:${t.criterion}`))return!1;try{return an(t.file,t.selector),!0}catch{return!1}}function yVe(t,e,r){let n=jb([t],e)[0],i=n?.state==="failed"?"failed":n?.state==="verified"?"passed":n!==void 0&&n.matched>0?"skipped":"unobserved",s=an(t.file,t.selector),o=`criterion:${t.criterion}`;return Object.freeze({identity:`${fce}:${t.framework}:${s}->${o}:${r}`,from:s,to:o,relation:"covers",provenance:"observed",owner:Object.freeze({kind:"runtime_observation",adapter:fce,reference:r}),state:i,normalizedTarget:o,selector:Object.freeze({precision:"fragment",value:t.selector})})}function i4(t){return gce({layerId:hce,nodes:[],edges:[],completeness:"unknown",unknownReasons:[...new Set(t)].sort()})}function gce(t){return Object.freeze({...t,nodes:Object.freeze([...t.nodes]),edges:Object.freeze([...t.edges]),unknownReasons:Object.freeze([...t.unknownReasons])})}var hce,fce,yce=S(()=>{"use strict";qs();iM();fM();hce="current-gate-junit-testcase-observations",fce="current-gate-junit-observation@1"});function vce(t,e){let r=bVe(e);if(r.length>0)return Xh({layerId:eP,nodes:[],edges:[],completeness:"unknown",unknownReasons:r});let n=new Map(t.nodes.map(o=>[o.address,o])),i=[],s=[];for(let o of e.bindings){let a=`criterion:${o.criterion}`,c=`feature:${o.criterion.slice(0,o.criterion.indexOf("/"))}`;if(!n.has(a)||!n.has(c))return Xh({layerId:eP,nodes:[],edges:[],completeness:"unknown",unknownReasons:[`binding does not resolve to a current compiler criterion: ${o.criterion}`]});let l=ct(o.file),u=an(o.file,o.selector),d=Object.freeze({kind:"text_source",path:o.file,selector:o.selector});i.push(Object.freeze({address:l,nodeType:"artifact",roles:Object.freeze(["test"]),owners:Object.freeze([c]),provenance:"authored",locator:d}));let p=n.get(u);if(p===void 0)i.push(Object.freeze({address:u,nodeType:"anchor",artifact:l,selector:o.selector,selectorProvenance:"authored",provenance:"authored",locator:d}));else if(p.nodeType!=="anchor"||p.artifact!==l||p.selector!==o.selector)return Xh({layerId:eP,nodes:[],edges:[],completeness:"unknown",unknownReasons:[`binding anchor collides with a nonmatching compiler node: ${u}`]});s.push(Object.freeze({identity:vVe(o,u,a),from:u,to:a,relation:"covers",provenance:"authored",owner:d,state:"resolved",raw:`[covers:${o.criterion}]`,normalizedTarget:a,selector:Object.freeze({precision:"fragment",value:o.selector})}))}return Xh({layerId:eP,nodes:i,edges:s,completeness:"complete",unknownReasons:[]})}function _ce(t,e){if(!e)return Xh({layerId:bce,nodes:[],edges:[],completeness:"unknown",unknownReasons:["document scan is unavailable for a prospective workspace overlay"]});let r=new Set(t.nodes.filter(u=>u.nodeType==="semantic"&&u.kind==="feature").map(u=>u.address)),n=new Map,i=new Map,s=[],o=[...e.unknownReasons],a=(u,d=[],p="derived")=>{let f=ct(u),h=n.get(f);if(h){for(let m of d)h.owners.add(m);return p==="authored"&&(h.provenance="authored"),f}return n.set(f,{path:u,owners:new Set(d),provenance:p}),f},c=(u,d,p,f)=>{let h=ct(u),m=an(u,d);return i.has(m)||i.set(m,Object.freeze({address:m,nodeType:"anchor",artifact:h,selector:d,selectorProvenance:p,provenance:f,locator:Object.freeze({kind:"text_source",path:u,selector:d})})),m};for(let u of e.docs){let d=u.explicit.map(p=>`feature:${p.featureId}`).filter(p=>r.has(p));a(u.doc,d,d.length>0?"authored":"derived");for(let p of u.explicit){let f=`feature:${p.featureId}`,h=r.has(f)?"resolved":"unresolved";h==="unresolved"&&o.push(`explicit document feature target is absent: ${p.featureId} at ${u.doc}#${p.selector}`),s.push(s4("explains",c(u.doc,p.selector,"authored","authored"),f,h,u.doc,p.selector,p.raw))}for(let p of u.organic){let f=`feature:${p.featureId}`,h=r.has(f)?"resolved":"unresolved";s.push(s4("mentions",c(u.doc,p.selector,"derived","derived"),f,h,u.doc,p.selector,p.raw))}for(let p of u.links){let f=ct(p.target);p.state==="resolved"?a(p.target):o.push(`repository-local Markdown link target is absent: ${p.target} at ${u.doc}#${p.selector}`),s.push(s4("links_to",c(u.doc,p.selector,"authored","authored"),f,p.state,u.doc,p.selector,p.raw))}for(let p of u.issues)o.push(`unsafe local Markdown path (${p.reason}) at ${u.doc}#${p.selector}: ${JSON.stringify(p.raw)}`)}let l=[...[...n.entries()].sort(([u],[d])=>u.localeCompare(d)).map(([u,d])=>Object.freeze({address:u,nodeType:"artifact",roles:Object.freeze(["doc"]),owners:Object.freeze([...d.owners].sort()),provenance:d.provenance,locator:Object.freeze({kind:"text_source",path:d.path})})),...[...i.values()].sort((u,d)=>u.address.localeCompare(d.address))];return Xh({layerId:bce,nodes:l,edges:s.sort((u,d)=>u.identity.localeCompare(d.identity)),completeness:o.length===0&&e.completeness==="complete"?"complete":"unknown",unknownReasons:[...new Set(o)].sort()})}function s4(t,e,r,n,i,s,o){return Object.freeze({identity:`${t}:${e}->${r}`,from:e,to:r,relation:t,provenance:t==="mentions"?"derived":"authored",owner:Object.freeze({kind:"text_source",path:i,selector:s}),state:n,raw:o,normalizedTarget:r,selector:Object.freeze({precision:"fragment",value:s})})}function bVe(t){let e=[...t.safe?[]:["live Vitest/Jest declaration scan is incomplete"],...t.diagnostics.map(r=>`unknown [covers:] criterion ${r.criterion} at ${r.file}:${r.line}:${r.column}`)];return Object.freeze([...new Set(e)].sort())}function vVe(t,e,r){return`${t.framework}:${e}->${r}`}function Xh(t){return Object.freeze({...t,nodes:Object.freeze([...t.nodes]),edges:Object.freeze([...t.edges]),unknownReasons:Object.freeze([...t.unknownReasons])})}var eP,bce,Sce=S(()=>{"use strict";qs();eP="current-safe-vitest-jest-bindings",bce="document-facts"});import{lstatSync as _Ve,readFileSync as SVe}from"node:fs";import{join as wVe}from"node:path";import{TextDecoder as xVe}from"node:util";function b_(t,e,r=AVe){let n=$Ve(e),i=IVe(e),s=[],o=[],a=[],c=[];for(let f of n){let h=PVe(t,f,r);if(!("inapplicable"in h)){if("reason"in h){h.reason==="missing"?c.push(f):a.push(Object.freeze({path:f,reason:h.reason}));continue}for(let m of CVe(h.text)){let y=i.featuresByPath.get(m.rawPath);if(!y){o.push(Object.freeze({code:"UNKNOWN_FEATURE_SHARD",sourcePath:f,raw:m.raw,location:m.location,selector:"",...y_(m.rawPath)?{featurePath:m.rawPath}:{}}));continue}if(m.criteria.length===0){o.push(Object.freeze({code:"FEATURE_ONLY",sourcePath:f,raw:m.raw,location:m.location,featurePath:m.rawPath,selector:""}));continue}let v=new Map;for(let b of m.criteria){let w=`criterion:${y}/${b}`,x=i.criteriaByPath.get(m.rawPath)?.has(w)?"resolved":"unresolved";v.set(w,x)}let g=JSON.stringify([f,`feature:${y}`,[...v.keys()].sort()]);for(let[b,w]of[...v.entries()].sort(([x],[$])=>x.localeCompare($)))s.push({sourcePath:f,raw:m.raw,normalizedTarget:b,state:w,occurrenceKey:g,location:m.location}),w==="unresolved"&&o.push(Object.freeze({code:"UNKNOWN_CRITERION",sourcePath:f,raw:m.raw,location:m.location,selector:"",featurePath:m.rawPath,normalizedTarget:b}))}for(let m of TVe(h.text))o.push(Object.freeze({code:"NONCANONICAL_FEATURE_PATH",sourcePath:f,raw:m.raw,location:m.location,selector:""}))}}let l=NVe(s),u=DVe(o,l),d=[...a].sort((f,h)=>f.path.localeCompare(h.path)),p=[...d.map(f=>`source artifact ${f.path} is ${f.reason}`),...u.map(LVe)];return MVe({records:l,issues:u,unknownFiles:d,absentSources:[...c].sort((f,h)=>f.localeCompare(h)),completeness:p.length===0?"complete":"unknown",unknownReasons:p})}function kce(t,e){let r=new Set(t.nodes.filter(c=>c.nodeType==="artifact").map(c=>c.address)),n=[],i=[],s=new Set,o=[...e.unknownReasons];for(let c of e.records){let l=`artifact:${c.sourcePath}`;if(!r.has(l)){o.push(`compiler source artifact is absent: ${c.sourcePath}`);continue}let u=an(c.sourcePath,c.selector),d=Object.freeze({kind:"text_source",path:c.sourcePath,selector:c.selector});s.has(u)||(s.add(u),n.push(Object.freeze({address:u,nodeType:"anchor",artifact:l,selector:c.selector,selectorProvenance:"authored",provenance:"authored",locator:d}))),i.push(Object.freeze({identity:`source-reference:${u}->${c.normalizedTarget}`,from:u,to:c.normalizedTarget,relation:"traces_to",provenance:"authored",owner:d,state:c.state,raw:c.raw,normalizedTarget:c.normalizedTarget,selector:Object.freeze({precision:"fragment",value:c.selector})})),c.state==="unresolved"&&o.push(`source reference target is unresolved: ${c.normalizedTarget}`)}for(let c of e.issues){let l=`artifact:${c.sourcePath}`;if(!r.has(l)){o.push(`compiler source artifact is absent: ${c.sourcePath}`);continue}let u=an(c.sourcePath,c.selector);if(s.has(u))continue;s.add(u);let d=Object.freeze({kind:"text_source",path:c.sourcePath,selector:c.selector});n.push(Object.freeze({address:u,nodeType:"anchor",artifact:l,selector:c.selector,selectorProvenance:"authored",provenance:"authored",locator:d}))}let a=[...new Set(o)].sort();return FVe({layerId:kVe,nodes:n.sort((c,l)=>c.address.localeCompare(l.address)),edges:i.sort((c,l)=>c.identity.localeCompare(l.identity)),completeness:a.length===0?"complete":"unknown",unknownReasons:a})}function $Ve(t){let e=t.nodes.filter(r=>r.nodeType==="artifact").filter(r=>r.roles.includes("source")).map(r=>r.address.slice(9)).filter(r=>!Lu(r).some(n=>EVe.has(n.authority)));return Object.freeze([...new Set(e)].sort())}function IVe(t){let e=new Map,r=new Map;for(let n of t.nodes)if(n.nodeType==="semantic"&&(n.kind==="feature"&&y_(n.source.path)&&e.set(n.source.path,n.address.slice(8)),n.kind==="criterion"&&y_(n.source.path))){let i=r.get(n.source.path)??new Set;i.add(n.address),r.set(n.source.path,i)}return{featuresByPath:e,criteriaByPath:r}}function PVe(t,e,r){let n=t;try{if(r.lstat(n).isSymbolicLink())return{reason:"symlink"}}catch{return{reason:"unreadable"}}let i=e.split("/");for(let[s,o]of i.entries()){n=wVe(n,o);let a;try{a=r.lstat(n)}catch(c){return{reason:wce(c)?"missing":"unreadable"}}if(a.isSymbolicLink())return{reason:"symlink"};if(s===i.length-1){if(a.isDirectory())return{inapplicable:!0};if(!a.isFile())return{reason:"not_file"}}}try{return{text:new xVe("utf-8",{fatal:!0}).decode(r.readFile(n))}}catch(s){return wce(s)?{reason:"missing"}:{reason:RVe(s)?"invalid_utf8":"unreadable"}}}function wce(t){return typeof t=="object"&&t!==null&&t.code==="ENOENT"}function RVe(t){return t instanceof TypeError&&/utf-8/i.test(t.message)}function CVe(t){let e=[],r=t.split(` +`);for(let n=0;ne[1])}function y_(t){return/^spec\/features\/[^/\\]+\.ya?ml$/.test(t)}function OVe(t){return/(?:^|[./\\])spec(?:[/\\])features(?:[/\\])/.test(t)||/^spec[/\\]features(?:[/\\]|$)/.test(t)||t.includes("spec/features/")||t.includes("spec\\features\\")}function NVe(t){let e=new Map;for(let n of t){let i=e.get(n.occurrenceKey)??[];i.push(n),e.set(n.occurrenceKey,i)}let r=[];for(let[n,i]of e){let s=new Map;for(let a of i){let c=`${a.location.line}\0${a.location.column}`,l=s.get(c)??[];l.push(a),s.set(c,l)}let o=[...s.values()].sort((a,c)=>a[0].location.line-c[0].location.line||a[0].location.column-c[0].location.column);for(let[a,c]of o.entries())for(let l of c)r.push(Object.freeze({sourcePath:l.sourcePath,raw:l.raw,normalizedTarget:l.normalizedTarget,state:l.state,selector:`source-reference:${n}:${a+1}`,location:l.location}))}return Object.freeze(r.sort((n,i)=>n.selector.localeCompare(i.selector)||n.normalizedTarget.localeCompare(i.normalizedTarget)))}function DVe(t,e){let r=new Map(e.map(s=>[`${s.sourcePath}\0${s.raw}\0${s.normalizedTarget}\0${s.location.line}\0${s.location.column}`,s.selector])),n=new Map;for(let s of t){let o=JSON.stringify([s.sourcePath,s.code,s.raw,s.normalizedTarget??""]),a=n.get(o)??[];a.push(s),n.set(o,a)}let i=[];for(let[s,o]of n){o.sort((a,c)=>a.location.line-c.location.line||a.location.column-c.location.column);for(let[a,c]of o.entries()){let l=`${c.sourcePath}\0${c.raw}\0${c.normalizedTarget??""}\0${c.location.line}\0${c.location.column}`;i.push(Object.freeze({...c,selector:r.get(l)??`source-reference-issue:${s}:${a+1}`}))}}return Object.freeze(i.sort(jVe))}function jVe(t,e){return t.sourcePath.localeCompare(e.sourcePath)||t.location.line-e.location.line||t.location.column-e.location.column||t.code.localeCompare(e.code)||t.raw.localeCompare(e.raw)}function LVe(t){let e=t.normalizedTarget?`: ${t.normalizedTarget}`:"";return`source reference ${t.code} at ${t.sourcePath}:${t.location.line}:${t.location.column}${e}`}function MVe(t){return Object.freeze({...t,records:Object.freeze(t.records.map(e=>Object.freeze({...e,location:Object.freeze({...e.location})}))),issues:Object.freeze(t.issues.map(e=>Object.freeze({...e,location:Object.freeze({...e.location})}))),unknownFiles:Object.freeze(t.unknownFiles.map(e=>Object.freeze({...e}))),absentSources:Object.freeze([...t.absentSources]),unknownReasons:Object.freeze([...t.unknownReasons])})}function FVe(t){return Object.freeze({...t,nodes:Object.freeze([...t.nodes]),edges:Object.freeze([...t.edges]),unknownReasons:Object.freeze([...t.unknownReasons])})}var kVe,EVe,AVe,a4=S(()=>{"use strict";_f();qs();kVe="source-references",EVe=new Set(["generated","transient","evidence","migration"]),AVe=Object.freeze({lstat:_Ve,readFile:SVe})});function Nl(t=".",e,r){let n=cb(t),i=lb(t);if(n||i){if(!n||!i)throw new Error("GraphIR workspace query requires matching prospective Spec and compiler overlays.");let s=Gh(t),o=b_(t,i),a=Fa(t,Xu(i.nodes));return c4(t,n,i,a,s,o,e,r)}return To(t,()=>zVe(t,e,r))}function zVe(t,e,r){let n=Nf(t),i=Fa(t,Xu(n.nodes)),s=Gh(t),o=b_(t,n);switch(n.schemaVersion){case"0.1":return c4(t,pl(t),n,i,s,o,e,r);case"0.2":return c4(t,Gk(t,n,i),n,i,s,o,e,r);default:return Ice(n.schemaVersion)}}function c4(t,e,r,n,i,s,o,a){UVe(e,r),u4(e),u4(r);let c=vce(r,n),l=o===void 0?void 0:mce(r,n,o),u=_ce(r,i),d=kce(r,s),p=dce(t,r,a),f=[c,l,u,d].filter(g=>g!==void 0&&Ece(g)),h=[...f,p],m=Ece(p)?h:f,y=Object.freeze(m.length===0?sb(r):sb(r,m)),v=Object.freeze(h.map(g=>Object.freeze({id:g.layerId,completeness:g.completeness,reasons:Object.freeze([...g.unknownReasons])})));return Object.freeze({spec:e,compilation:r,kernel:y,layers:v})}function Ece(t){return t.completeness==="unknown"||t.nodes.length>0||t.edges.length>0}function UVe(t,e){if(t.schema!==e.schemaVersion)throw new Error(`GraphIR workspace query cannot combine Spec schema ${JSON.stringify(t.schema)} with compiler schema ${JSON.stringify(e.schemaVersion)}.`);switch(e.schemaVersion){case"0.1":BVe(t.features,e.presentations);return;case"0.2":qVe(t.features,e);return;default:return Ice(e.schemaVersion)}}function BVe(t,e){let r=e.filter(i=>i.schemaVersion==="0.1"&&i.kind==="feature").map(i=>({id:Ace(i.address),title:i.title,status:i.status,slug:i.slug})),n=t.map(i=>({id:i.id,title:i.title,status:i.status,slug:i.slug}));if(!l4(n,r,!0))throw new Error("GraphIR workspace query cannot prove schema 0.1 presentation and compiler feature identity.")}function qVe(t,e){let r=e.diagnostics.filter(c=>c.severity!=="advisory");if(!e.contract||r.length>0)throw new Error("GraphIR workspace query requires a complete schema 0.2 compiler contract.");let n=e.contract.features.map(c=>({id:c.id,title:c.title,status:c.status,slug:void 0})),i=t.map(c=>({id:c.id,title:c.title,status:c.status,slug:c.slug}));if(!l4(i,n))throw new Error("GraphIR workspace query cannot prove schema 0.2 presentation and compiler contract identity.");if(!VVe(t,e.contract.features))throw new Error("GraphIR workspace query cannot prove schema 0.2 presentation and compiler contract structure.");let s=e.presentations.filter(c=>c.schemaVersion==="0.2"&&c.kind==="feature").map(c=>({id:Ace(c.address),title:c.title,status:c.status,slug:c.slug}));if(!l4(i,s,!0))throw new Error("GraphIR workspace query cannot prove schema 0.2 presentation and GraphIR feature identity.");let o=e.contract.features.map(c=>`feature:${c.id}`),a=e.nodes.filter(c=>c.nodeType==="semantic"&&c.kind==="feature").map(c=>c.address);if(!$ce(o,a))throw new Error("GraphIR workspace query cannot prove schema 0.2 contract and GraphIR feature identity.")}function VVe(t,e){if(t.length!==e.length)return!1;let r=new Map(t.map(n=>[n.id,n]));if(r.size!==t.length)return!1;for(let n of e){let i=r.get(n.id);if(!i||!WVe(GVe(i),HVe(n)))return!1}return!0}function GVe(t){return{id:t.id,title:t.title,status:t.status,modules:t.modules??null,dependsOn:t.depends_on??null,designImpact:t.design_impact??null,archivedAt:t.archived_at??null,archiveReason:t.archive_reason??null,supersededBy:t.superseded_by??null,blockedReason:t.blocked_reason??null,criteria:(t.acceptance_criteria??[]).map(e=>({id:e.id,statement:e.text??null,oracleRefs:e.oracle_refs??null,evidenceRefs:e.evidence_refs??null,notes:e.notes??null}))}}function HVe(t){return{id:t.id,title:t.title,status:t.status,modules:t.modules??null,dependsOn:t.dependsOn??null,designImpact:t.designImpact??null,archivedAt:t.archivedAt??null,archiveReason:t.archiveReason??null,supersededBy:t.supersededBy??null,blockedReason:t.blockedReason??null,criteria:t.acceptanceCriteria.map(e=>({id:e.id,statement:e.statement,oracleRefs:e.oracleRefs??null,evidenceRefs:e.evidenceRefs??null,notes:e.notes??null}))}}function WVe(t,e){return tP(t)===tP(e)}function tP(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(tP).join(",")}]`;let e=t;return`{${Object.keys(e).sort().map(r=>`${JSON.stringify(r)}:${tP(e[r])}`).join(",")}}`}function Ace(t){if(!t.startsWith("feature:"))throw new Error(`GraphIR workspace query found a non-feature presentation address: ${t}`);return t.slice(8)}function l4(t,e,r=!1){let n=i=>[...i].sort((s,o)=>s.id.localeCompare(o.id)).map(s=>[s.id,s.title??"",s.status??"",...r?[s.slug??""]:[]].join("\0"));return $ce(n(t),n(e))}function $ce(t,e){if(t.length!==e.length)return!1;let r=[...t].sort(),n=[...e].sort();return r.every((i,s)=>i===n[s])}function Ice(t){throw new Error(`GraphIR workspace query does not recognize workspace schema ${JSON.stringify(t)}.`)}function u4(t,e=new WeakSet){if(!(t===null||typeof t!="object"||e.has(t))){e.add(t);for(let r of Reflect.ownKeys(t))u4(Reflect.get(t,r),e);Object.freeze(t)}}function rc(t,e){try{return aY(Nl(t),e)}catch(r){return cY(e,`graph-ir workspace unavailable: ${r.message}`)}}var Dd=S(()=>{"use strict";b2();qn();Ab();jI();Uf();Uk();gt();Cf();kr();Ou();pce();yce();Sce();a4()});import{resolve as d4}from"node:path";function rP(t){Dl={cwd:d4(t),results:new Map}}function Pce(t,e,r){!Dl||Dl.cwd!==d4(e)||Dl.results.set(t,r)}function nP(t,e){return!Dl||Dl.cwd!==d4(e)?null:Dl.results.get(t)??null}function iP(){Dl=null}var Dl,Qh=S(()=>{"use strict";Dl=null});function $r(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 nc=S(()=>{});import{fileURLToPath as ZVe}from"node:url";var em,JVe,p4,f4,tm=S(()=>{em=(t,e)=>{let r=f4(JVe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},JVe=t=>p4(t)?t.toString():t,p4=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,f4=t=>t instanceof URL?ZVe(t):t});var sP,h4=S(()=>{nc();tm();sP=(t,e=[],r={})=>{let n=em(t,"First argument"),[i,s]=$r(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 o=i.map(String),a=o.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!$r(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[n,o,s]}});import{StringDecoder as KVe}from"node:string_decoder";var Rce,Cce,Wr,ic,YVe,Tce,XVe,oP,Oce,QVe,v_,eGe,m4,tGe,qi=S(()=>{({toString:Rce}=Object.prototype),Cce=t=>Rce.call(t)==="[object ArrayBuffer]",Wr=t=>Rce.call(t)==="[object Uint8Array]",ic=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),YVe=new TextEncoder,Tce=t=>YVe.encode(t),XVe=new TextDecoder,oP=t=>XVe.decode(t),Oce=(t,e)=>QVe(t,e).join(""),QVe=(t,e)=>{if(e==="utf8"&&t.every(s=>typeof s=="string"))return t;let r=new KVe(e),n=t.map(s=>typeof s=="string"?Tce(s):s).map(s=>r.write(s)),i=r.end();return i===""?n:[...n,i]},v_=t=>t.length===1&&Wr(t[0])?t[0]:m4(eGe(t)),eGe=t=>t.map(e=>typeof e=="string"?Tce(e):e),m4=t=>{let e=new Uint8Array(tGe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},tGe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as rGe}from"node:child_process";var Lce,Mce,nGe,iGe,Nce,sGe,Dce,jce,oGe,Fce=S(()=>{nc();qi();Lce=t=>Array.isArray(t)&&Array.isArray(t.raw),Mce=(t,e)=>{let r=[];for(let[s,o]of t.entries())r=nGe({templates:t,expressions:e,tokens:r,index:s,template:o});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},nGe=({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:s,leadingWhitespaces:o,trailingWhitespaces:a}=iGe(i,t.raw[n]),c=Dce(r,s,o);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>jce(d)):[jce(l)];return Dce(c,u,a)},iGe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=Nce.has(e[0]);for(let o=0,a=0;or||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],jce=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if($r(t)&&("stdout"in t||"isMaxBuffer"in t))return oGe(t);throw t instanceof rGe||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`)},oGe=({stdout:t})=>{if(typeof t=="string")return t;if(Wr(t))return oP(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 g4 from"node:process";var so,aP,Ss,cP,sc=S(()=>{so=t=>aP.includes(t),aP=[g4.stdin,g4.stdout,g4.stderr],Ss=["stdin","stdout","stderr"],cP=t=>Ss[t]??`stdio[${t}]`});import{debuglog as aGe}from"node:util";var Uce,y4,cGe,lGe,uGe,dGe,zce,pGe,b4,fGe,hGe,mGe,gGe,v4,oc,ac=S(()=>{nc();sc();Uce=t=>{let e={...t};for(let r of v4)e[r]=y4(t,r);return e},y4=(t,e)=>{let r=Array.from({length:cGe(t)+1}),n=lGe(t[e],r,e);return hGe(n,e)},cGe=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Ss.length):Ss.length,lGe=(t,e,r)=>$r(t)?uGe(t,e,r):e.fill(t),uGe=(t,e,r)=>{for(let n of Object.keys(t).sort(dGe))for(let i of pGe(n,r,e))e[i]=t[n];return e},dGe=(t,e)=>zce(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,pGe=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=b4(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]},TR=t=>{if(t==="all")return t;if(Pn.includes(t))return Pn.indexOf(t);let e=_ve.exec(t);if(e!==null)return Number(e[1])},_ve=/^fd(\d+)$/,bve=(t,e)=>t.map(r=>r===void 0?Sve[e]:r),vve=fve("execa").enabled?"full":"none",Sve={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:vve,stripFinalNewline:!0},RR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Rl,Il,SZ,IR,wve,ab,cb,ps=y(()=>{xo();Rl=({verbose:t},e)=>IR(t,e)!=="none",Il=({verbose:t},e)=>!["none","short"].includes(IR(t,e)),SZ=({verbose:t},e)=>{let r=IR(t,e);return ab(r)?r:void 0},IR=(t,e)=>e===void 0?wve(t):wo(t,e),wve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as xve}from"node:process";import{stripVTControlCharacters as $ve}from"node:util";var wZ,ep,xZ,kve,Eve,Ave,Ove,Tve,Rve,Ive,lb=y(()=>{wZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Rve(xZ(o))).join(" ");return{command:n,escapedCommand:i}},ep=t=>$ve(t).split(` -`).map(e=>xZ(e)).join(` -`),xZ=t=>t.replaceAll(Ave,e=>kve(e)),kve=t=>{let e=Ove[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Tve?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Eve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Ave=Eve(),Ove={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Tve=65535,Rve=t=>Ive.test(t)?t:xve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Ive=/^[\w./-]+$/});import $Z from"node:process";function PR(){let{env:t}=$Z,{TERM:e,TERM_PROGRAM:r}=t;return $Z.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 kZ=y(()=>{});var EZ,AZ,Pve,Cve,Dve,Nve,jve,ub,Dtt,OZ=y(()=>{kZ();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"},AZ={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"},Pve={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"},Cve={...EZ,...AZ},Dve={...EZ,...Pve},Nve=PR(),jve=Nve?Cve:Dve,ub=jve,Dtt=Object.entries(AZ)});import Mve from"node:tty";var Fve,ve,Mtt,TZ,Ftt,Ltt,ztt,Utt,qtt,Htt,Btt,Gtt,Ztt,Vtt,Wtt,Ktt,Jtt,Ytt,Xtt,db,Qtt,ert,trt,rrt,nrt,irt,ort,srt,art,RZ,crt,IZ,lrt,urt,drt,frt,prt,mrt,hrt,grt,yrt,_rt,brt,CR=y(()=>{Fve=Mve?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!Fve)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}},Mtt=ve(0,0),TZ=ve(1,22),Ftt=ve(2,22),Ltt=ve(3,23),ztt=ve(4,24),Utt=ve(53,55),qtt=ve(7,27),Htt=ve(8,28),Btt=ve(9,29),Gtt=ve(30,39),Ztt=ve(31,39),Vtt=ve(32,39),Wtt=ve(33,39),Ktt=ve(34,39),Jtt=ve(35,39),Ytt=ve(36,39),Xtt=ve(37,39),db=ve(90,39),Qtt=ve(40,49),ert=ve(41,49),trt=ve(42,49),rrt=ve(43,49),nrt=ve(44,49),irt=ve(45,49),ort=ve(46,49),srt=ve(47,49),art=ve(100,49),RZ=ve(91,39),crt=ve(92,39),IZ=ve(93,39),lrt=ve(94,39),urt=ve(95,39),drt=ve(96,39),frt=ve(97,39),prt=ve(101,49),mrt=ve(102,49),hrt=ve(103,49),grt=ve(104,49),yrt=ve(105,49),_rt=ve(106,49),brt=ve(107,49)});var PZ=y(()=>{CR();CR()});var NZ,zve,fb,CZ,Uve,DZ,qve,jZ=y(()=>{OZ();PZ();NZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=zve(r),c=Uve[t]({failed:o,reject:s,piped:n}),l=qve[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},zve=t=>`${fb(t.getHours(),2)}:${fb(t.getMinutes(),2)}:${fb(t.getSeconds(),2)}.${fb(t.getMilliseconds(),3)}`,fb=(t,e)=>String(t).padStart(e,"0"),CZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Uve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:CZ,duration:CZ},DZ=t=>t,qve={command:()=>TZ,output:()=>DZ,ipc:()=>DZ,error:({reject:t})=>t?RZ:IZ,duration:()=>db}});var MZ,Hve,Bve,FZ=y(()=>{ps();MZ=(t,e,r)=>{let n=SZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Hve(i,o,n)).filter(i=>i!==void 0).map(i=>Bve(i)).join("")},Hve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Bve=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},b4=t=>{if(t==="all")return t;if(Ss.includes(t))return Ss.indexOf(t);let e=fGe.exec(t);if(e!==null)return Number(e[1])},fGe=/^fd(\d+)$/,hGe=(t,e)=>t.map(r=>r===void 0?gGe[e]:r),mGe=aGe("execa").enabled?"full":"none",gGe={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:mGe,stripFinalNewline:!0},v4=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],oc=(t,e)=>e==="ipc"?t.at(-1):t[e]});var rm,nm,Bce,_4,yGe,lP,uP,jl=S(()=>{ac();rm=({verbose:t},e)=>_4(t,e)!=="none",nm=({verbose:t},e)=>!["none","short"].includes(_4(t,e)),Bce=({verbose:t},e)=>{let r=_4(t,e);return lP(r)?r:void 0},_4=(t,e)=>e===void 0?yGe(t):oc(t,e),yGe=t=>t.find(e=>lP(e))??uP.findLast(e=>t.includes(e)),lP=t=>typeof t=="function",uP=["none","short","full"]});import{platform as bGe}from"node:process";import{stripVTControlCharacters as vGe}from"node:util";var qce,__,Vce,_Ge,SGe,wGe,xGe,kGe,EGe,AGe,dP=S(()=>{qce=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(s=>EGe(Vce(s))).join(" ");return{command:n,escapedCommand:i}},__=t=>vGe(t).split(` +`).map(e=>Vce(e)).join(` +`),Vce=t=>t.replaceAll(wGe,e=>_Ge(e)),_Ge=t=>{let e=xGe[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=kGe?`\\u${n.padStart(4,"0")}`:`\\U${n}`},SGe=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},wGe=SGe(),xGe={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},kGe=65535,EGe=t=>AGe.test(t)?t:bGe==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,AGe=/^[\w./-]+$/});import Gce from"node:process";function S4(){let{env:t}=Gce,{TERM:e,TERM_PROGRAM:r}=t;return Gce.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 Hce=S(()=>{});var Wce,Zce,$Ge,IGe,PGe,RGe,CGe,pP,cDt,Jce=S(()=>{Hce();Wce={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"},Zce={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"},$Ge={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"},IGe={...Wce,...Zce},PGe={...Wce,...$Ge},RGe=S4(),CGe=RGe?IGe:PGe,pP=CGe,cDt=Object.entries(Zce)});import TGe from"node:tty";var OGe,We,dDt,Kce,pDt,fDt,hDt,mDt,gDt,yDt,bDt,vDt,_Dt,SDt,wDt,xDt,kDt,EDt,ADt,fP,$Dt,IDt,PDt,RDt,CDt,TDt,ODt,NDt,DDt,Yce,jDt,Xce,LDt,MDt,FDt,zDt,UDt,BDt,qDt,VDt,GDt,HDt,WDt,w4=S(()=>{OGe=TGe?.WriteStream?.prototype?.hasColors?.()??!1,We=(t,e)=>{if(!OGe)return i=>i;let r=`\x1B[${t}m`,n=`\x1B[${e}m`;return i=>{let s=i+"",o=s.indexOf(n);if(o===-1)return r+s+n;let a=r,c=0,u=(e===22?n:"")+r;for(;o!==-1;)a+=s.slice(c,o)+u,c=o+n.length,o=s.indexOf(n,c);return a+=s.slice(c)+n,a}},dDt=We(0,0),Kce=We(1,22),pDt=We(2,22),fDt=We(3,23),hDt=We(4,24),mDt=We(53,55),gDt=We(7,27),yDt=We(8,28),bDt=We(9,29),vDt=We(30,39),_Dt=We(31,39),SDt=We(32,39),wDt=We(33,39),xDt=We(34,39),kDt=We(35,39),EDt=We(36,39),ADt=We(37,39),fP=We(90,39),$Dt=We(40,49),IDt=We(41,49),PDt=We(42,49),RDt=We(43,49),CDt=We(44,49),TDt=We(45,49),ODt=We(46,49),NDt=We(47,49),DDt=We(100,49),Yce=We(91,39),jDt=We(92,39),Xce=We(93,39),LDt=We(94,39),MDt=We(95,39),FDt=We(96,39),zDt=We(97,39),UDt=We(101,49),BDt=We(102,49),qDt=We(103,49),VDt=We(104,49),GDt=We(105,49),HDt=We(106,49),WDt=We(107,49)});var Qce=S(()=>{w4();w4()});var rle,DGe,hP,ele,jGe,tle,LGe,nle=S(()=>{Jce();Qce();rle=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:s=!1}={},options:{reject:o=!0}})=>{let a=DGe(r),c=jGe[t]({failed:s,reject:o,piped:n}),l=LGe[t]({reject:o});return`${fP(`[${a}]`)} ${fP(`[${i}]`)} ${l(c)} ${l(e)}`},DGe=t=>`${hP(t.getHours(),2)}:${hP(t.getMinutes(),2)}:${hP(t.getSeconds(),2)}.${hP(t.getMilliseconds(),3)}`,hP=(t,e)=>String(t).padStart(e,"0"),ele=({failed:t,reject:e})=>t?e?pP.cross:pP.warning:pP.tick,jGe={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:ele,duration:ele},tle=t=>t,LGe={command:()=>Kce,output:()=>tle,ipc:()=>tle,error:({reject:t})=>t?Yce:Xce,duration:()=>fP}});var ile,MGe,FGe,sle=S(()=>{jl();ile=(t,e,r)=>{let n=Bce(e,r);return t.map(({verboseLine:i,verboseObject:s})=>MGe(i,s,n)).filter(i=>i!==void 0).map(i=>FGe(i)).join("")},MGe=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},FGe=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Gve}from"node:util";var Ci,Zve,Vve,Wve,pb,Kve,Pl=y(()=>{lb();jZ();FZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Zve({type:t,result:i,verboseInfo:n}),s=Vve(e,o),a=MZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Zve=({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}),Vve=(t,e)=>t.split(` -`).map(r=>Wve({...e,message:r})),Wve=t=>({verboseLine:NZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Gve(t);return ep(e).replaceAll(" "," ".repeat(Kve))},Kve=2});var LZ,zZ=y(()=>{ps();Pl();LZ=(t,e)=>{Rl(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var UZ,Jve,Yve,Xve,qZ=y(()=>{ps();UZ=(t,e,r)=>{Xve(t);let n=Jve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Jve=t=>Rl({verbose:t})?Yve++:void 0,Yve=0n,Xve=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(!cb.includes(e)&&!ab(e)){let r=cb.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as HZ}from"node:process";var mb,DR,hb=y(()=>{mb=()=>HZ.bigint(),DR=t=>Number(HZ.bigint()-t)/1e6});var gb,NR=y(()=>{zZ();qZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=wZ(t,e),s=OR(r,"verbose"),a=UZ(s,o,{...r});return LZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var WZ=v((Grt,VZ)=>{VZ.exports=ZZ;ZZ.sync=eSe;var BZ=Ze("fs");function Qve(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{XZ.exports=JZ;JZ.sync=tSe;var KZ=Ze("fs");function JZ(t,e,r){KZ.stat(t,function(n,i){r(n,n?!1:YZ(i,e))})}function tSe(t,e){return YZ(KZ.statSync(t),e)}function YZ(t,e){return t.isFile()&&rSe(t,e)}function rSe(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 tV=v((Wrt,eV)=>{var Vrt=Ze("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=WZ():yb=QZ();eV.exports=jR;jR.sync=nSe;function jR(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){jR(t,e||{},function(o,s){o?i(o):n(s)})})}yb(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function nSe(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var cV=v((Krt,aV)=>{var Cl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",rV=Ze("path"),iSe=Cl?";":":",nV=tV(),iV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),oV=(t,e)=>{let r=e.colon||iSe,n=t.match(/\//)||Cl&&t.match(/\\/)?[""]:[...Cl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Cl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Cl?i.split(r):[""];return Cl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},sV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=oV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(iV(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=rV.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];nV(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)},oSe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=oV(t,e),o=[];for(let s=0;s{"use strict";var lV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};MR.exports=lV;MR.exports.default=lV});var mV=v((Yrt,pV)=>{"use strict";var dV=Ze("path"),sSe=cV(),aSe=uV();function fV(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=sSe.sync(t.command,{path:r[aSe({env:r})],pathExt:e?dV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=dV.resolve(i?t.options.cwd:"",s)),s}function cSe(t){return fV(t)||fV(t,!0)}pV.exports=cSe});var hV=v((Xrt,LR)=>{"use strict";var FR=/([()\][%!^"`<>&|;, *?])/g;function lSe(t){return t=t.replace(FR,"^$1"),t}function uSe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(FR,"^$1"),e&&(t=t.replace(FR,"^$1")),t}LR.exports.command=lSe;LR.exports.argument=uSe});var yV=v((Qrt,gV)=>{"use strict";gV.exports=/^#!(.*)/});var bV=v((ent,_V)=>{"use strict";var dSe=yV();_V.exports=(t="")=>{let e=t.match(dSe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var SV=v((tnt,vV)=>{"use strict";var zR=Ze("fs"),fSe=bV();function pSe(t){let r=Buffer.alloc(150),n;try{n=zR.openSync(t,"r"),zR.readSync(n,r,0,150,0),zR.closeSync(n)}catch{}return fSe(r.toString())}vV.exports=pSe});var kV=v((rnt,$V)=>{"use strict";var mSe=Ze("path"),wV=mV(),xV=hV(),hSe=SV(),gSe=process.platform==="win32",ySe=/\.(?:com|exe)$/i,_Se=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function bSe(t){t.file=wV(t);let e=t.file&&hSe(t.file);return e?(t.args.unshift(t.file),t.command=e,wV(t)):t.file}function vSe(t){if(!gSe)return t;let e=bSe(t),r=!ySe.test(e);if(t.options.forceShell||r){let n=_Se.test(e);t.command=mSe.normalize(t.command),t.command=xV.command(t.command),t.args=t.args.map(o=>xV.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 SSe(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:vSe(n)}$V.exports=SSe});var OV=v((nnt,AV)=>{"use strict";var UR=process.platform==="win32";function qR(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 wSe(t,e){if(!UR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=EV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function EV(t,e){return UR&&t===1&&!e.file?qR(e.original,"spawn"):null}function xSe(t,e){return UR&&t===1&&!e.file?qR(e.original,"spawnSync"):null}AV.exports={hookChildProcess:wSe,verifyENOENT:EV,verifyENOENTSync:xSe,notFoundError:qR}});var IV=v((int,Dl)=>{"use strict";var TV=Ze("child_process"),HR=kV(),BR=OV();function RV(t,e,r){let n=HR(t,e,r),i=TV.spawn(n.command,n.args,n.options);return BR.hookChildProcess(i,n),i}function $Se(t,e,r){let n=HR(t,e,r),i=TV.spawnSync(n.command,n.args,n.options);return i.error=i.error||BR.verifyENOENTSync(i.status,n),i}Dl.exports=RV;Dl.exports.spawn=RV;Dl.exports.sync=$Se;Dl.exports._parse=HR;Dl.exports._enoent=BR});function _b(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 PV=y(()=>{});var CV=y(()=>{});import{promisify as kSe}from"node:util";import{execFile as ESe,execFileSync as lnt}from"node:child_process";import DV from"node:path";import{fileURLToPath as ASe}from"node:url";function bb(t){return t instanceof URL?ASe(t):t}function NV(t){return{*[Symbol.iterator](){let e=DV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=DV.resolve(e,"..")}}}var fnt,pnt,jV=y(()=>{CV();fnt=kSe(ESe);pnt=10*1024*1024});import vb from"node:process";import Ca from"node:path";var OSe,TSe,RSe,MV,FV=y(()=>{PV();jV();OSe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(bb(t)),s=[],a=e.split(Ca.delimiter);return r&&TSe(s,a,o),i&&RSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},TSe=(t,e,r)=>{for(let n of NV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},RSe=(t,e,r,n)=>{let i=Ca.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},MV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=OSe(e),t}});var LV,ni,zV,UV,qV,Sb,tp,rp,Da=y(()=>{LV=(t,e,r)=>{let n=r?rp:tp,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},zV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,qV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},UV=t=>Sb(t)&&qV in t,qV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",tp=class extends Error{};zV(tp,tp.name);rp=class extends Error{};zV(rp,rp.name)});var HV,ISe,BV,GV,ZV=y(()=>{HV=()=>{let t=GV-BV+1;return Array.from({length:t},ISe)},ISe=(t,e)=>({name:`SIGRT${e+1}`,number:BV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),BV=34,GV=64});var VV,WV=y(()=>{VV=[{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 PSe}from"node:os";var GR,CSe,KV=y(()=>{WV();ZV();GR=()=>{let t=HV();return[...VV,...t].map(CSe)},CSe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=PSe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as DSe}from"node:os";var NSe,jSe,JV,MSe,FSe,LSe,Rnt,YV=y(()=>{KV();NSe=()=>{let t=GR();return Object.fromEntries(t.map(jSe))},jSe=({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}],JV=NSe(),MSe=()=>{let t=GR(),e=65,r=Array.from({length:e},(n,i)=>FSe(i,t));return Object.assign({},...r)},FSe=(t,e)=>{let r=LSe(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}}},LSe=(t,e)=>{let r=e.find(({name:n})=>DSe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Rnt=MSe()});import{constants as np}from"node:os";var QV,e9,t9,zSe,USe,XV,qSe,ZR,HSe,BSe,wb,ip=y(()=>{YV();QV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return t9(t,e)},e9=t=>t===0?t:t9(t,"`subprocess.kill()`'s argument"),t9=(t,e)=>{if(Number.isInteger(t))return zSe(t,e);if(typeof t=="string")return qSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${ZR()}`)},zSe=(t,e)=>{if(XV.has(t))return XV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${ZR()}`)},USe=()=>new Map(Object.entries(np.signals).reverse().map(([t,e])=>[e,t])),XV=USe(),qSe=(t,e)=>{if(t in np.signals)return t;throw t.toUpperCase()in np.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${ZR()}`)},ZR=()=>`Available signal names: ${HSe()}. -Available signal numbers: ${BSe()}.`,HSe=()=>Object.keys(np.signals).sort().map(t=>`'${t}'`).join(", "),BSe=()=>[...new Set(Object.values(np.signals).sort((t,e)=>t-e))].join(", "),wb=t=>JV[t].description});import{setTimeout as GSe}from"node:timers/promises";var r9,ZSe,n9,VSe,WSe,KSe,VR,xb=y(()=>{Da();ip();r9=t=>{if(t===!1)return t;if(t===!0)return ZSe;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},ZSe=1e3*5,n9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=VSe(s,a,r);WSe(l,n);let u=t(c);return KSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},VSe=(t,e,r)=>{let[n=r,i]=Sb(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&&!Sb(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:e9(n),error:i}},WSe=(t,e)=>{t!==void 0&&e.reject(t)},KSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&VR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},VR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await GSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as JSe}from"node:events";var $b,WR=y(()=>{$b=async(t,e)=>{t.aborted||await JSe(t,"abort",{signal:e})}});var i9,o9,YSe,KR=y(()=>{WR();i9=({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)}`)},o9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[YSe(t,e,n,i)],YSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Nl,XSe,JR,s9,a9,kb,c9,l9,u9,d9,f9,p9,QSe,ewe,twe,ii,rwe,ms,jl,Ml=y(()=>{Nl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{XSe(t,e,r),JR(t,e,n)},XSe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},JR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},s9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},a9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as zGe}from"node:util";var Qo,UGe,BGe,qGe,mP,VGe,im=S(()=>{dP();nle();sle();Qo=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let s=UGe({type:t,result:i,verboseInfo:n}),o=BGe(e,s),a=ile(o,n,r);a!==""&&console.warn(a.slice(0,-1))},UGe=({type:t,result:e,verboseInfo:{escapedCommand:r,commandId:n,rawOptions:{piped:i=!1,...s}}})=>({type:t,escapedCommand:r,commandId:`${n}`,timestamp:new Date,piped:i,result:e,options:s}),BGe=(t,e)=>t.split(` +`).map(r=>qGe({...e,message:r})),qGe=t=>({verboseLine:rle(t),verboseObject:t}),mP=t=>{let e=typeof t=="string"?t:zGe(t);return __(e).replaceAll(" "," ".repeat(VGe))},VGe=2});var ole,ale=S(()=>{jl();im();ole=(t,e)=>{rm(e)&&Qo({type:"command",verboseMessage:t,verboseInfo:e})}});var cle,GGe,HGe,WGe,lle=S(()=>{jl();cle=(t,e,r)=>{WGe(t);let n=GGe(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},GGe=t=>rm({verbose:t})?HGe++:void 0,HGe=0n,WGe=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(!uP.includes(e)&&!lP(e)){let r=uP.map(n=>`'${n}'`).join(", ");throw new TypeError(`The "verbose" option must not be ${e}. Allowed values are: ${r} or a function.`)}}}});import{hrtime as ule}from"node:process";var gP,x4,yP=S(()=>{gP=()=>ule.bigint(),x4=t=>Number(ule.bigint()-t)/1e6});var bP,k4=S(()=>{ale();lle();yP();dP();ac();bP=(t,e,r)=>{let n=gP(),{command:i,escapedCommand:s}=qce(t,e),o=y4(r,"verbose"),a=cle(o,s,{...r});return ole(s,a),{command:i,escapedCommand:s,startTime:n,verboseInfo:a}}});var mle=k((vjt,hle)=>{hle.exports=fle;fle.sync=JGe;var dle=Ot("fs");function ZGe(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{vle.exports=yle;yle.sync=KGe;var gle=Ot("fs");function yle(t,e,r){gle.stat(t,function(n,i){r(n,n?!1:ble(i,e))})}function KGe(t,e){return ble(gle.statSync(t),e)}function ble(t,e){return t.isFile()&&YGe(t,e)}function YGe(t,e){var r=t.mode,n=t.uid,i=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=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===o||r&a&&n===s||r&u&&s===0;return d}});var wle=k((wjt,Sle)=>{var Sjt=Ot("fs"),vP;process.platform==="win32"||global.TESTING_WINDOWS?vP=mle():vP=_le();Sle.exports=E4;E4.sync=XGe;function E4(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){E4(t,e||{},function(s,o){s?i(s):n(o)})})}vP(t,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),r(n,i)})}function XGe(t,e){try{return vP.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Ple=k((xjt,Ile)=>{var sm=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",xle=Ot("path"),QGe=sm?";":":",kle=wle(),Ele=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Ale=(t,e)=>{let r=e.colon||QGe,n=t.match(/\//)||sm&&t.match(/\\/)?[""]:[...sm?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=sm?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=sm?i.split(r):[""];return sm&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:i}},$le=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:s}=Ale(t,e),o=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&o.length?u(o):d(Ele(t));let p=n[l],f=/^".*"$/.test(p)?p.slice(1,-1):p,h=xle.join(f,t),m=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+h:h;u(c(m,l,0))}),c=(l,u,d)=>new Promise((p,f)=>{if(d===i.length)return p(a(u+1));let h=i[d];kle(l+h,{pathExt:s},(m,y)=>{if(!m&&y)if(e.all)o.push(l+h);else return p(l+h);return p(c(l,u,d+1))})});return r?a(0).then(l=>r(null,l),r):a(0)},e5e=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=Ale(t,e),s=[];for(let o=0;o{"use strict";var Rle=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};A4.exports=Rle;A4.exports.default=Rle});var Dle=k((Ejt,Nle)=>{"use strict";var Tle=Ot("path"),t5e=Ple(),r5e=Cle();function Ole(t,e){let r=t.options.env||process.env,n=process.cwd(),i=t.options.cwd!=null,s=i&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let o;try{o=t5e.sync(t.command,{path:r[r5e({env:r})],pathExt:e?Tle.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return o&&(o=Tle.resolve(i?t.options.cwd:"",o)),o}function n5e(t){return Ole(t)||Ole(t,!0)}Nle.exports=n5e});var jle=k((Ajt,I4)=>{"use strict";var $4=/([()\][%!^"`<>&|;, *?])/g;function i5e(t){return t=t.replace($4,"^$1"),t}function s5e(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace($4,"^$1"),e&&(t=t.replace($4,"^$1")),t}I4.exports.command=i5e;I4.exports.argument=s5e});var Mle=k(($jt,Lle)=>{"use strict";Lle.exports=/^#!(.*)/});var zle=k((Ijt,Fle)=>{"use strict";var o5e=Mle();Fle.exports=(t="")=>{let e=t.match(o5e);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var Ble=k((Pjt,Ule)=>{"use strict";var P4=Ot("fs"),a5e=zle();function c5e(t){let r=Buffer.alloc(150),n;try{n=P4.openSync(t,"r"),P4.readSync(n,r,0,150,0),P4.closeSync(n)}catch{}return a5e(r.toString())}Ule.exports=c5e});var Hle=k((Rjt,Gle)=>{"use strict";var l5e=Ot("path"),qle=Dle(),Vle=jle(),u5e=Ble(),d5e=process.platform==="win32",p5e=/\.(?:com|exe)$/i,f5e=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function h5e(t){t.file=qle(t);let e=t.file&&u5e(t.file);return e?(t.args.unshift(t.file),t.command=e,qle(t)):t.file}function m5e(t){if(!d5e)return t;let e=h5e(t),r=!p5e.test(e);if(t.options.forceShell||r){let n=f5e.test(e);t.command=l5e.normalize(t.command),t.command=Vle.command(t.command),t.args=t.args.map(s=>Vle.argument(s,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 g5e(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:m5e(n)}Gle.exports=g5e});var Jle=k((Cjt,Zle)=>{"use strict";var R4=process.platform==="win32";function C4(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 y5e(t,e){if(!R4)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let s=Wle(i,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function Wle(t,e){return R4&&t===1&&!e.file?C4(e.original,"spawn"):null}function b5e(t,e){return R4&&t===1&&!e.file?C4(e.original,"spawnSync"):null}Zle.exports={hookChildProcess:y5e,verifyENOENT:Wle,verifyENOENTSync:b5e,notFoundError:C4}});var Xle=k((Tjt,om)=>{"use strict";var Kle=Ot("child_process"),T4=Hle(),O4=Jle();function Yle(t,e,r){let n=T4(t,e,r),i=Kle.spawn(n.command,n.args,n.options);return O4.hookChildProcess(i,n),i}function v5e(t,e,r){let n=T4(t,e,r),i=Kle.spawnSync(n.command,n.args,n.options);return i.error=i.error||O4.verifyENOENTSync(i.status,n),i}om.exports=Yle;om.exports.spawn=Yle;om.exports.sync=v5e;om.exports._parse=T4;om.exports._enoent=O4});function _P(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 Qle=S(()=>{});var eue=S(()=>{});import{promisify as _5e}from"node:util";import{execFile as S5e,execFileSync as Ljt}from"node:child_process";import tue from"node:path";import{fileURLToPath as w5e}from"node:url";function SP(t){return t instanceof URL?w5e(t):t}function rue(t){return{*[Symbol.iterator](){let e=tue.resolve(SP(t)),r;for(;r!==e;)yield e,r=e,e=tue.resolve(e,"..")}}}var zjt,Ujt,nue=S(()=>{eue();zjt=_5e(S5e);Ujt=10*1024*1024});import wP from"node:process";import jd from"node:path";var x5e,k5e,E5e,iue,sue=S(()=>{Qle();nue();x5e=({cwd:t=wP.cwd(),path:e=wP.env[_P()],preferLocal:r=!0,execPath:n=wP.execPath,addExecPath:i=!0}={})=>{let s=jd.resolve(SP(t)),o=[],a=e.split(jd.delimiter);return r&&k5e(o,a,s),i&&E5e(o,a,n,s),e===""||e===jd.delimiter?`${o.join(jd.delimiter)}${e}`:[...o,e].join(jd.delimiter)},k5e=(t,e,r)=>{for(let n of rue(r)){let i=jd.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},E5e=(t,e,r,n)=>{let i=jd.resolve(n,SP(r),"..");e.includes(i)||t.push(i)},iue=({env:t=wP.env,...e}={})=>{t={...t};let r=_P({env:t});return e.path=t[r],t[r]=x5e(e),t}});var oue,oo,aue,cue,lue,xP,S_,w_,Ld=S(()=>{oue=(t,e,r)=>{let n=r?w_:S_,i=t instanceof oo?{}:{cause:t};return new n(e,i)},oo=class extends Error{},aue=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,lue,{value:!0,writable:!1,enumerable:!1,configurable:!1})},cue=t=>xP(t)&&lue in t,lue=Symbol("isExecaError"),xP=t=>Object.prototype.toString.call(t)==="[object Error]",S_=class extends Error{};aue(S_,S_.name);w_=class extends Error{};aue(w_,w_.name)});var uue,A5e,due,pue,fue=S(()=>{uue=()=>{let t=pue-due+1;return Array.from({length:t},A5e)},A5e=(t,e)=>({name:`SIGRT${e+1}`,number:due+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),due=34,pue=64});var hue,mue=S(()=>{hue=[{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 $5e}from"node:os";var N4,I5e,gue=S(()=>{mue();fue();N4=()=>{let t=uue();return[...hue,...t].map(I5e)},I5e=({name:t,number:e,description:r,action:n,forced:i=!1,standard:s})=>{let{signals:{[t]:o}}=$5e,a=o!==void 0;return{name:t,number:a?o:e,description:r,supported:a,action:n,forced:i,standard:s}}});import{constants as P5e}from"node:os";var R5e,C5e,yue,T5e,O5e,N5e,i2t,bue=S(()=>{gue();R5e=()=>{let t=N4();return Object.fromEntries(t.map(C5e))},C5e=({name:t,number:e,description:r,supported:n,action:i,forced:s,standard:o})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:s,standard:o}],yue=R5e(),T5e=()=>{let t=N4(),e=65,r=Array.from({length:e},(n,i)=>O5e(i,t));return Object.assign({},...r)},O5e=(t,e)=>{let r=N5e(t,e);if(r===void 0)return{};let{name:n,description:i,supported:s,action:o,forced:a,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:s,action:o,forced:a,standard:c}}},N5e=(t,e)=>{let r=e.find(({name:n})=>P5e.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},i2t=T5e()});import{constants as x_}from"node:os";var _ue,Sue,wue,D5e,j5e,vue,L5e,D4,M5e,F5e,kP,k_=S(()=>{bue();_ue=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return wue(t,e)},Sue=t=>t===0?t:wue(t,"`subprocess.kill()`'s argument"),wue=(t,e)=>{if(Number.isInteger(t))return D5e(t,e);if(typeof t=="string")return L5e(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${D4()}`)},D5e=(t,e)=>{if(vue.has(t))return vue.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${D4()}`)},j5e=()=>new Map(Object.entries(x_.signals).reverse().map(([t,e])=>[e,t])),vue=j5e(),L5e=(t,e)=>{if(t in x_.signals)return t;throw t.toUpperCase()in x_.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${D4()}`)},D4=()=>`Available signal names: ${M5e()}. +Available signal numbers: ${F5e()}.`,M5e=()=>Object.keys(x_.signals).sort().map(t=>`'${t}'`).join(", "),F5e=()=>[...new Set(Object.values(x_.signals).sort((t,e)=>t-e))].join(", "),kP=t=>yue[t].description});import{setTimeout as z5e}from"node:timers/promises";var xue,U5e,kue,B5e,q5e,V5e,j4,EP=S(()=>{Ld();k_();xue=t=>{if(t===!1)return t;if(t===!0)return U5e;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},U5e=1e3*5,kue=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:s},o,a)=>{let{signal:c,error:l}=B5e(o,a,r);q5e(l,n);let u=t(c);return V5e({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:s}),u},B5e=(t,e,r)=>{let[n=r,i]=xP(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&&!xP(i))throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${i}`);return{signal:Sue(n),error:i}},q5e=(t,e)=>{t!==void 0&&e.reject(t)},V5e=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:s,controller:o})=>{e===n&&i&&j4({kill:t,forceKillAfterDelay:r,context:s,controllerSignal:o.signal})},j4=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await z5e(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as G5e}from"node:events";var AP,L4=S(()=>{AP=async(t,e)=>{t.aborted||await G5e(t,"abort",{signal:e})}});var Eue,Aue,H5e,M4=S(()=>{L4();Eue=({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)}`)},Aue=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[H5e(t,e,n,i)],H5e=async(t,e,r,{signal:n})=>{throw await AP(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var am,W5e,F4,$ue,Iue,$P,Pue,Rue,Cue,Tue,Oue,Nue,Z5e,J5e,K5e,ao,Y5e,Ll,cm,lm=S(()=>{am=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{W5e(t,e,r),F4(t,e,n)},W5e=(t,e,r)=>{if(!r)throw new Error(`${ao(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},F4=(t,e,r)=>{if(!r)throw new Error(`${ao(t,e)} cannot be used: the ${Ll(e)} has already exited or disconnected.`)},$ue=t=>{throw new Error(`${ao("getOneMessage",t)} could not complete: the ${Ll(t)} exited or disconnected.`)},Iue=t=>{throw new Error(`${ao("sendMessage",t)} failed: the ${Ll(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([ - ${ii("getOneMessage",t)}, - ${ii("sendMessage",t,"message, {strict: true}")}, -]);`)},kb=(t,e)=>new Error(`${ii("sendMessage",e)} failed when sending an acknowledgment response to the ${ms(e)}.`,{cause:t}),c9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is not listening to incoming messages.`)},l9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} exited without listening to incoming messages.`)},u9=()=>new Error(`\`cancelSignal\` aborted: the ${ms(!0)} disconnected.`),d9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},f9=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ii(e,r)} cannot be used: the ${ms(r)} is disconnecting.`,{cause:t})},p9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(QSe(t))throw new Error(`${ii(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},QSe=({code:t,message:e})=>ewe.has(t)||twe.some(r=>e.includes(r)),ewe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),twe=["could not be cloned","circular structure","call stack size exceeded"],ii=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${rwe(e)}${t}(${r})`,rwe=t=>t?"":"subprocess.",ms=t=>t?"parent process":"subprocess",jl=t=>{t.connected&&t.disconnect()}});var Di,Fl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Ab,Ll,Ni,m9,nwe,iwe,h9,owe,g9,op,Eb,hs=y(()=>{xo();Ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=m9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(h9(o,e,n,!0));return s},Ll=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=m9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(h9(o,e,n,!1));return s},Ni=new WeakMap,m9=(t,e,r)=>{let n=nwe(e,r);return iwe(n,e,r,t),n},nwe=(t,e)=>{let r=TR(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(`"${op(e)}" must not be "${t}". + ${ao("getOneMessage",t)}, + ${ao("sendMessage",t,"message, {strict: true}")}, +]);`)},$P=(t,e)=>new Error(`${ao("sendMessage",e)} failed when sending an acknowledgment response to the ${Ll(e)}.`,{cause:t}),Pue=t=>{throw new Error(`${ao("sendMessage",t)} failed: the ${Ll(t)} is not listening to incoming messages.`)},Rue=t=>{throw new Error(`${ao("sendMessage",t)} failed: the ${Ll(t)} exited without listening to incoming messages.`)},Cue=()=>new Error(`\`cancelSignal\` aborted: the ${Ll(!0)} disconnected.`),Tue=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},Oue=({error:t,methodName:e,isSubprocess:r})=>{if(t.code==="EPIPE")throw new Error(`${ao(e,r)} cannot be used: the ${Ll(r)} is disconnecting.`,{cause:t})},Nue=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(Z5e(t))throw new Error(`${ao(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},Z5e=({code:t,message:e})=>J5e.has(t)||K5e.some(r=>e.includes(r)),J5e=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),K5e=["could not be cloned","circular structure","call stack size exceeded"],ao=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${Y5e(e)}${t}(${r})`,Y5e=t=>t?"":"subprocess.",Ll=t=>t?"parent process":"subprocess",cm=t=>{t.connected&&t.disconnect()}});var ea,um=S(()=>{ea=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var PP,dm,ta,Due,X5e,Q5e,jue,eHe,Lue,E_,IP,Ml=S(()=>{ac();PP=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=ta.get(t),s=Due(i,e,!0),o=t.stdio[s];if(o===null)throw new TypeError(jue(s,e,n,!0));return o},dm=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=ta.get(t),s=Due(i,e,!1),o=s==="all"?t.all:t.stdio[s];if(o==null)throw new TypeError(jue(s,e,n,!1));return o},ta=new WeakMap,Due=(t,e,r)=>{let n=X5e(e,r);return Q5e(n,e,r,t),n},X5e=(t,e)=>{let r=b4(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(`"${E_(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},iwe=(t,e,r,n)=>{let i=n[g9(t)];if(i===void 0)throw new TypeError(`"${op(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(`"${op(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${op(r)}" must not be ${e}. It must be a writable stream, not readable.`)},h9=(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}=owe(t,r);return`The "${i}: ${Eb(o)}" option is incompatible with using "${op(n)}: ${Eb(e)}". -Please set this option with "pipe" instead.`},owe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=g9(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]}},g9=t=>t==="all"?1:t,op=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as swe}from"node:events";var Na,Ob=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),swe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Tb,YR,Rb,XR,y9,_9,sp=y(()=>{Tb=(t,e)=>{e&&YR(t)},YR=t=>{t.refCounted()},Rb=(t,e)=>{e&&XR(t)},XR=t=>{t.unrefCounted()},y9=(t,e)=>{e&&(XR(t),XR(t))},_9=(t,e)=>{e&&(YR(t),YR(t))}});import{once as awe}from"node:events";import{scheduler as cwe}from"node:timers/promises";var b9,v9,Ib,S9=y(()=>{Cb();sp();Pb();Db();b9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(x9(i)||k9(i))return;Ib.has(t)||Ib.set(t,[]);let o=Ib.get(t);if(o.push(i),!(o.length>1))for(;o.length>0;){await $9(t,n,i),await cwe.yield();let s=await w9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},v9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{QR();let o=Ib.get(t);for(;o?.length>0;)await awe(n,"message:done");t.removeListener("message",i),_9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as lwe}from"node:events";var gs,Nb,uwe,jb,ap=y(()=>{S9();sp();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new lwe;return n.connected=!0,Nb.set(t,n),uwe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,uwe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=b9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",v9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),y9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as dwe}from"node:events";var E9,fwe,A9,w9,x9,O9,Mb,pwe,Fb,T9,Pb=y(()=>{Fl();Ob();Ub();Ml();ap();Cb();E9=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let o=gs(t,e,r),s=Lb(t,o);return{id:fwe++,type:Fb,message:n,hasListeners:s}},fwe=0n,A9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},w9=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==Fb||!e.connected)return t;let{id:o,message:s}=t,a={id:o,type:T9,message:Lb(e,i)};try{await zb({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return s},x9=t=>{if(t?.type!==T9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},O9=async(t,e,r)=>{if(t?.type!==Fb)return;let n=Di();Mb[t.id]=n;let i=new AbortController;try{let{isDeadlock:o,hasListeners:s}=await Promise.race([n,pwe(e,r,i)]);o&&a9(r),s||c9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},pwe=async(t,e,{signal:r})=>{Na(t,1,r),await dwe(t,"disconnect",{signal:r}),l9(e)},Fb="execa:ipc:request",T9="execa:ipc:response"});var R9,I9,$9,cp,Lb,mwe,Cb=y(()=>{Fl();xo();hs();Pb();R9=(t,e,r)=>{cp.has(t)||cp.set(t,new Set);let n=cp.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},I9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},$9=async(t,e,r)=>{for(;!Lb(t,e)&&cp.get(t)?.size>0;){let n=[...cp.get(t)];A9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},cp=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>mwe(t),mwe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as hwe}from"node:util";var zb,gwe,tI,ywe,eI,Ub=y(()=>{Ml();Cb();Pb();zb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Nl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),gwe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},gwe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=E9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=R9(t,s,o);try{await tI({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw jl(t),c}finally{I9(a)}},tI=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ywe(t);try{await Promise.all([O9(n,t,r),o(n)])}catch(s){throw f9({error:s,methodName:e,isSubprocess:r}),p9({error:s,methodName:e,isSubprocess:r,message:i}),s}},ywe=t=>{if(eI.has(t))return eI.get(t);let e=hwe(t.send.bind(t));return eI.set(t,e),e},eI=new WeakMap});import{scheduler as _we}from"node:timers/promises";var C9,D9,bwe,P9,k9,N9,QR,rI,Db=y(()=>{Ub();ap();Ml();C9=(t,e)=>{let r="cancelSignal";return JR(r,!1,t.connected),tI({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:N9,message:e},message:e})},D9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await bwe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),rI.signal),bwe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!P9){if(P9=!0,!n){d9();return}if(e===null){QR();return}gs(t,e,r),await _we.yield()}},P9=!1,k9=t=>t?.type!==N9?!1:(rI.abort(t.message),!0),N9="execa:ipc:cancel",QR=()=>{rI.abort(u9())},rI=new AbortController});var j9,M9,vwe,Swe,nI=y(()=>{WR();Db();xb();j9=({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.")}},M9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[vwe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],vwe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=Swe(e);throw await C9(t,o),VR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Swe=({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 wwe}from"node:timers/promises";var F9,L9,xwe,iI=y(()=>{Da();F9=({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})`)},L9=(t,e,r,n)=>e===0||e===void 0?[]:[xwe(t,e,r,n)],xwe=async(t,e,r,{signal:n})=>{throw await wwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as $we,execArgv as kwe}from"node:process";import z9 from"node:path";var U9,q9,oI=y(()=>{Tl();U9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},q9=(t,e,{node:r=!1,nodePath:n=$we,nodeOptions:i=kwe.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=Ol(n,'The "nodePath" option'),l=z9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(z9.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 Ewe}from"node:v8";var H9,Awe,Owe,Twe,B9,sI=y(()=>{H9=({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`.");Twe[r](t)}},Awe=t=>{try{Ewe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Owe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Twe={advanced:Awe,json:Owe},B9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var Z9,Rwe,cn,aI,Iwe,G9,qb,ja=y(()=>{Z9=({encoding:t})=>{if(aI.has(t))return;let e=Iwe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. -Please rename it to ${qb(e)}.`);let r=[...aI].map(n=>qb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. -Please rename it to one of: ${r}.`)},Rwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),aI=new Set([...Rwe,...cn]),Iwe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in G9)return G9[e];if(aI.has(e))return e},G9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},qb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Pwe}from"node:fs";import Cwe from"node:path";import Dwe from"node:process";var V9,W9,K9,cI=y(()=>{Tl();V9=(t=W9())=>{let e=Ol(t,'The "cwd" option');return Cwe.resolve(e)},W9=()=>{try{return Dwe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},K9=(t,e)=>{if(e===W9())return t;let r;try{r=Pwe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},Q5e=(t,e,r,n)=>{let i=n[Lue(t)];if(i===void 0)throw new TypeError(`"${E_(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(`"${E_(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${E_(r)}" must not be ${e}. It must be a writable stream, not readable.`)},jue=(t,e,r,n)=>{if(t==="all"&&!r.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:i,optionValue:s}=eHe(t,r);return`The "${i}: ${IP(s)}" option is incompatible with using "${E_(n)}: ${IP(e)}". +Please set this option with "pipe" instead.`},eHe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let s=Lue(t);return s===0&&e!==void 0?{optionName:"stdin",optionValue:e}:s===1&&r!==void 0?{optionName:"stdout",optionValue:r}:s===2&&n!==void 0?{optionName:"stderr",optionValue:n}:{optionName:`stdio[${s}]`,optionValue:i[s]}},Lue=t=>t==="all"?1:t,E_=t=>t?"to":"from",IP=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as tHe}from"node:events";var Md,RP=S(()=>{Md=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),tHe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var CP,z4,TP,U4,Mue,Fue,A_=S(()=>{CP=(t,e)=>{e&&z4(t)},z4=t=>{t.refCounted()},TP=(t,e)=>{e&&U4(t)},U4=t=>{t.unrefCounted()},Mue=(t,e)=>{e&&(U4(t),U4(t))},Fue=(t,e)=>{e&&(z4(t),z4(t))}});import{once as rHe}from"node:events";import{scheduler as nHe}from"node:timers/promises";var zue,Uue,OP,Bue=S(()=>{DP();A_();NP();jP();zue=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(Vue(i)||Hue(i))return;OP.has(t)||OP.set(t,[]);let s=OP.get(t);if(s.push(i),!(s.length>1))for(;s.length>0;){await Gue(t,n,i),await nHe.yield();let o=await que({wrappedMessage:s[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});s.shift(),n.emit("message",o),n.emit("message:done")}},Uue=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{B4();let s=OP.get(t);for(;s?.length>0;)await rHe(n,"message:done");t.removeListener("message",i),Fue(e,r),n.connected=!1,n.emit("disconnect")},OP=new WeakMap});import{EventEmitter as iHe}from"node:events";var Fl,LP,sHe,MP,$_=S(()=>{Bue();A_();Fl=(t,e,r)=>{if(LP.has(t))return LP.get(t);let n=new iHe;return n.connected=!0,LP.set(t,n),sHe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},LP=new WeakMap,sHe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=zue.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",Uue.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),Mue(r,n)},MP=t=>{let e=LP.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as oHe}from"node:events";var Wue,aHe,Zue,que,Vue,Jue,FP,cHe,zP,Kue,NP=S(()=>{um();RP();qP();lm();$_();DP();Wue=({anyProcess:t,channel:e,isSubprocess:r,message:n,strict:i})=>{if(!i)return n;let s=Fl(t,e,r),o=UP(t,s);return{id:aHe++,type:zP,message:n,hasListeners:o}},aHe=0n,Zue=(t,e)=>{if(!(e?.type!==zP||e.hasListeners))for(let{id:r}of t)r!==void 0&&FP[r].resolve({isDeadlock:!0,hasListeners:!1})},que=async({wrappedMessage:t,anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:i})=>{if(t?.type!==zP||!e.connected)return t;let{id:s,message:o}=t,a={id:s,type:Kue,message:UP(e,i)};try{await BP({anyProcess:e,channel:r,isSubprocess:n,ipc:!0},a)}catch(c){i.emit("strict:error",c)}return o},Vue=t=>{if(t?.type!==Kue)return!1;let{id:e,message:r}=t;return FP[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},Jue=async(t,e,r)=>{if(t?.type!==zP)return;let n=ea();FP[t.id]=n;let i=new AbortController;try{let{isDeadlock:s,hasListeners:o}=await Promise.race([n,cHe(e,r,i)]);s&&Iue(r),o||Pue(r)}finally{i.abort(),delete FP[t.id]}},FP={},cHe=async(t,e,{signal:r})=>{Md(t,1,r),await oHe(t,"disconnect",{signal:r}),Rue(e)},zP="execa:ipc:request",Kue="execa:ipc:response"});var Yue,Xue,Gue,I_,UP,lHe,DP=S(()=>{um();ac();Ml();NP();Yue=(t,e,r)=>{I_.has(t)||I_.set(t,new Set);let n=I_.get(t),i=ea(),s=r?e.id:void 0,o={onMessageSent:i,id:s};return n.add(o),{outgoingMessages:n,outgoingMessage:o}},Xue=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},Gue=async(t,e,r)=>{for(;!UP(t,e)&&I_.get(t)?.size>0;){let n=[...I_.get(t)];Zue(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},I_=new WeakMap,UP=(t,e)=>e.listenerCount("message")>lHe(t),lHe=t=>ta.has(t)&&!oc(ta.get(t).options.buffer,"ipc")?1:0});import{promisify as uHe}from"node:util";var BP,dHe,V4,pHe,q4,qP=S(()=>{lm();DP();NP();BP=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:s=!1}={})=>{let o="sendMessage";return am({methodName:o,isSubprocess:r,ipc:n,isConnected:t.connected}),dHe({anyProcess:t,channel:e,methodName:o,isSubprocess:r,message:i,strict:s})},dHe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:s})=>{let o=Wue({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:s}),a=Yue(t,o,s);try{await V4({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:o,message:i})}catch(c){throw cm(t),c}finally{Xue(a)}},V4=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let s=pHe(t);try{await Promise.all([Jue(n,t,r),s(n)])}catch(o){throw Oue({error:o,methodName:e,isSubprocess:r}),Nue({error:o,methodName:e,isSubprocess:r,message:i}),o}},pHe=t=>{if(q4.has(t))return q4.get(t);let e=uHe(t.send.bind(t));return q4.set(t,e),e},q4=new WeakMap});import{scheduler as fHe}from"node:timers/promises";var ede,tde,hHe,Que,Hue,rde,B4,G4,jP=S(()=>{qP();$_();lm();ede=(t,e)=>{let r="cancelSignal";return F4(r,!1,t.connected),V4({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:rde,message:e},message:e})},tde=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await hHe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),G4.signal),hHe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!Que){if(Que=!0,!n){Tue();return}if(e===null){B4();return}Fl(t,e,r),await fHe.yield()}},Que=!1,Hue=t=>t?.type!==rde?!1:(G4.abort(t.message),!0),rde="execa:ipc:cancel",B4=()=>{G4.abort(Cue())},G4=new AbortController});var nde,ide,mHe,gHe,H4=S(()=>{L4();jP();EP();nde=({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.")}},ide=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:s})=>r?[mHe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:s})]:[],mHe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await AP(e,i);let s=gHe(e);throw await ede(t,s),j4({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},gHe=({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 yHe}from"node:timers/promises";var sde,ode,bHe,W4=S(()=>{Ld();sde=({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})`)},ode=(t,e,r,n)=>e===0||e===void 0?[]:[bHe(t,e,r,n)],bHe=async(t,e,r,{signal:n})=>{throw await yHe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new oo}});import{execPath as vHe,execArgv as _He}from"node:process";import ade from"node:path";var cde,lde,Z4=S(()=>{tm();cde=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},lde=(t,e,{node:r=!1,nodePath:n=vHe,nodeOptions:i=_He.filter(c=>!c.startsWith("--inspect")),cwd:s,execPath:o,...a})=>{if(o!==void 0)throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let c=em(n,'The "nodePath" option'),l=ade.resolve(s,c),u={...a,nodePath:l,node:r,cwd:s};if(!r)return[t,e,u];if(ade.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 SHe}from"node:v8";var ude,wHe,xHe,kHe,dde,J4=S(()=>{ude=({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`.");kHe[r](t)}},wHe=t=>{try{SHe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},xHe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},kHe={advanced:wHe,json:xHe},dde=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var fde,EHe,Vi,K4,AHe,pde,VP,Fd=S(()=>{fde=({encoding:t})=>{if(K4.has(t))return;let e=AHe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${VP(t)}\`. +Please rename it to ${VP(e)}.`);let r=[...K4].map(n=>VP(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${VP(t)}\`. +Please rename it to one of: ${r}.`)},EHe=new Set(["utf8","utf16le"]),Vi=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),K4=new Set([...EHe,...Vi]),AHe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in pde)return pde[e];if(K4.has(e))return e},pde={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},VP=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as $He}from"node:fs";import IHe from"node:path";import PHe from"node:process";var hde,mde,gde,Y4=S(()=>{tm();hde=(t=mde())=>{let e=em(t,'The "cwd" option');return IHe.resolve(e)},mde=()=>{try{return PHe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},gde=(t,e)=>{if(e===mde())return t;let r;try{r=$He(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 Nwe from"node:path";import J9 from"node:process";var Y9,Hb,jwe,Mwe,lI=y(()=>{Y9=wt(IV(),1);FV();xb();ip();KR();nI();iI();oI();sI();ja();cI();Tl();xo();Hb=(t,e,r)=>{r.cwd=V9(r.cwd);let[n,i,o]=q9(t,e,r),{command:s,args:a,options:c}=Y9.default._parse(n,i,o),l=vZ(c),u=jwe(l);return F9(u),Z9(u),H9(u),i9(u),j9(u),u.shell=$R(u.shell),u.env=Mwe(u),u.killSignal=QV(u.killSignal),u.forceKillAfterDelay=r9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),J9.platform==="win32"&&Nwe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},jwe=({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}),Mwe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...J9.env,...t}:t;return r||n?MV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,uI=y(()=>{Bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function zl(t){if(typeof t=="string")return Fwe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Lwe(t)}var Fwe,Lwe,X9,zwe,Q9,Uwe,dI=y(()=>{Fwe=t=>t.at(-1)===X9?t.slice(0,t.at(-2)===Q9?-2:-1):t,Lwe=t=>t.at(-1)===zwe?t.subarray(0,t.at(-2)===Uwe?-2:-1):t,X9=` -`,zwe=X9.codePointAt(0),Q9="\r",Uwe=Q9.codePointAt(0)});function oi(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 fI(t,{checkOpen:e=!0}={}){return oi(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 Ma(t,{checkOpen:e=!0}={}){return oi(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 pI(t,e){return fI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function eW(){return this[hI].next()}function tW(t){return this[hI].return(t)}function gI({preventCancel:t=!1}={}){let e=this.getReader(),r=new mI(e,t),n=Object.create(Hwe);return n[hI]=r,n}var qwe,mI,hI,Hwe,rW=y(()=>{qwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),mI=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}}},hI=Symbol();Object.defineProperty(eW,"name",{value:"next"});Object.defineProperty(tW,"name",{value:"return"});Hwe=Object.create(qwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:eW},return:{enumerable:!0,configurable:!0,writable:!0,value:tW}})});var nW=y(()=>{});var iW=y(()=>{rW();nW()});var oW,Bwe,Gwe,Zwe,lp,yI=y(()=>{Fa();iW();oW=t=>{if(Ma(t,{checkOpen:!1})&&lp.on!==void 0)return Gwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Bwe.call(t)==="[object ReadableStream]")return gI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Bwe}=Object.prototype,Gwe=async function*(t){let e=new AbortController,r={};Zwe(t,e,r);try{for await(let[n]of lp.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()}},Zwe=async(t,e,r)=>{try{await lp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},lp={}});var Ul,Vwe,cW,sW,Wwe,aW,ji,up=y(()=>{yI();Ul=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=oW(t),u=e();u.length=0;try{for await(let d of l){let f=Wwe(d),p=r[f](d,u);cW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Vwe({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}},Vwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&cW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},cW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){sW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&sW(c,e,i,o),new ji},sW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Wwe=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=aW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&aW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:aW}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var $o,dp,Gb,Zb,Vb,Wb=y(()=>{$o=t=>t,dp=()=>{},Gb=({contents:t})=>t,Zb=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},Vb=t=>t.length});async function Kb(t,e){return Ul(t,Xwe,e)}var Kwe,Jwe,Ywe,Xwe,lW=y(()=>{up();Wb();Kwe=()=>({contents:[]}),Jwe=()=>1,Ywe=(t,{contents:e})=>(e.push(t),e),Xwe={init:Kwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:Jwe,truncateChunk:dp,addChunk:Ywe,getFinalChunk:dp,finalize:Gb}});async function Jb(t,e){return Ul(t,axe,e)}var Qwe,exe,txe,uW,dW,rxe,nxe,ixe,oxe,pW,fW,sxe,mW,axe,hW=y(()=>{up();Wb();Qwe=()=>({contents:new ArrayBuffer(0)}),exe=t=>txe.encode(t),txe=new TextEncoder,uW=t=>new Uint8Array(t),dW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rxe=(t,e)=>t.slice(0,e),nxe=(t,{contents:e,length:r},n)=>{let i=mW()?oxe(e,n):ixe(e,n);return new Uint8Array(i).set(t,r),i},ixe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(pW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},oxe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:pW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},pW=t=>fW**Math.ceil(Math.log(t)/Math.log(fW)),fW=2,sxe=({contents:t,length:e})=>mW()?t:t.slice(0,e),mW=()=>"resize"in ArrayBuffer.prototype,axe={init:Qwe,convertChunk:{string:exe,buffer:uW,arrayBuffer:uW,dataView:dW,typedArray:dW,others:Zb},getSize:Vb,truncateChunk:rxe,addChunk:nxe,getFinalChunk:dp,finalize:sxe}});async function Xb(t,e){return Ul(t,fxe,e)}var cxe,Yb,lxe,uxe,dxe,fxe,gW=y(()=>{up();Wb();cxe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),lxe=(t,{contents:e})=>e+t,uxe=(t,e)=>t.slice(0,e),dxe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},fxe={init:cxe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:uxe,addChunk:lxe,getFinalChunk:dxe,finalize:Gb}});var yW=y(()=>{lW();hW();gW();up()});import{on as pxe}from"node:events";import{finished as mxe}from"node:stream/promises";var Qb=y(()=>{yI();yW();Object.assign(lp,{on:pxe,finished:mxe})});var _W,hxe,bW,vW,gxe,SW,wW,ev,La=y(()=>{Qb();So();xo();_W=({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=hxe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},hxe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",bW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},vW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=gxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},gxe=(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=wo(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:sb(r),threshold:i,unit:n}},SW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),wW=(t,e,r)=>{if(!e)return t;let n=ev(r);return t.length>n?t.slice(0,n):t},ev=([,t])=>t});import{inspect as yxe}from"node:util";var $W,_xe,bxe,vxe,Sxe,wxe,xW,kW=y(()=>{dI();an();cI();lb();La();ip();Da();$W=({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=_xe({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=vxe(n,b),w=x===void 0?"":` -${x}`,R=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],O=[R,...A,...t.slice(3),r.map(D=>Sxe(D)).join(` -`)].map(D=>ep(zl(wxe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:R,message:O}},_xe=({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=bxe(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?`${vW(t,i)}${m}`:o!==void 0?`Command failed with ${o}${m}`:d?`Command was killed with ${p} (${wb(p)})${m}`:s!==void 0?`Command was killed with ${s} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},bxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",vxe=(t,e)=>{if(t instanceof ni)return;let r=UV(t)?t.originalMessage:String(t?.message??t),n=ep(K9(r,e));return n===""?void 0:n},Sxe=t=>typeof t=="string"?t:yxe(t),wxe=t=>Array.isArray(t)?t.map(e=>zl(xW(e))).filter(Boolean).join(` -`):xW(t),xW=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,ql,fp,xxe,EW,$xe,pp=y(()=>{ip();hb();Da();kW();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>EW({command:t,escapedCommand:e,cwd:o,durationMs:DR(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:[]}),ql=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:s})=>fp({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}),fp=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:f,ipcOutput:p,options:{timeoutDuration:m,timeout:h=m,forceKillAfterDelay:g,killSignal:b,cwd:_,maxBuffer:S},isSync:x})=>{let{exitCode:w,signal:R,signalDescription:A}=$xe(l,u),{originalMessage:O,shortMessage:D,message:E}=$W({stdio:d,all:f,ipcOutput:p,originalError:t,signal:R,signalDescription:A,exitCode:w,escapedCommand:r,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:g,killSignal:b,maxBuffer:S,timeout:h,cwd:_}),ae=LV(t,E,x);return Object.assign(ae,xxe({error:ae,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:o,isGracefullyCanceled:s,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:w,signal:R,signalDescription:A,stdio:d,all:f,ipcOutput:p,cwd:_,originalMessage:O,shortMessage:D})),ae},xxe=({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:DR(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)),$xe=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:wb(e);return{exitCode:r,signal:n,signalDescription:i}}});function kxe(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(AW(t*1e3)%1e3),nanoseconds:Math.trunc(AW(t*1e6)%1e3)}}function Exe(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 _I(t){switch(typeof t){case"number":{if(Number.isFinite(t))return kxe(t);break}case"bigint":return Exe(t)}throw new TypeError("Expected a finite number or bigint")}var AW,OW=y(()=>{AW=t=>Number.isFinite(t)?t:0});function bI(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+Txe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Axe(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?" "+Oxe(d,u):f;i.push(p)}},a=_I(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%Rxe):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 Axe,Oxe,Txe,Rxe,TW=y(()=>{OW();Axe=t=>t===0||t===0n,Oxe=(t,e)=>e===1||e===1n?t:`${t}s`,Txe=1e-7,Rxe=24n*60n*60n*1000n});var RW,IW=y(()=>{Pl();RW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var PW,Ixe,CW=y(()=>{TW();ps();Pl();IW();PW=(t,e)=>{Rl(e)&&(RW(t,e),Ixe(t,e))},Ixe=(t,e)=>{let r=`(done in ${bI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Hl,rv=y(()=>{CW();Hl=(t,e,{reject:r})=>{if(PW(t,e),t.failed&&r)throw t;return t}});var jW,Pxe,Cxe,MW,FW,DW,Dxe,vI,NW,za,LW,Nxe,nv,zW,jxe,Mxe,SI,UW,Fxe,qW,iv,Lxe,wI,zxe,Uxe,HW,Cn,ov,xI,BW,GW,ys,$r=y(()=>{Fa();bo();an();jW=(t,e)=>za(t)?"asyncGenerator":LW(t)?"generator":nv(t)?"fileUrl":jxe(t)?"filePath":Lxe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":zxe(t)?"asyncIterable":Uxe(t)?"iterable":wI(t)?MW({transform:t},e):Nxe(t)?Pxe(t,e):"native",Pxe=(t,e)=>pI(t.transform,{checkOpen:!1})?Cxe(t,e):wI(t.transform)?MW(t,e):Dxe(t,e),Cxe=(t,e)=>(FW(t,e,"Duplex stream"),"duplex"),MW=(t,e)=>(FW(t,e,"web TransformStream"),"webTransform"),FW=({final:t,binary:e,objectMode:r},n,i)=>{DW(t,`${n}.final`,i),DW(e,`${n}.binary`,i),vI(r,`${n}.objectMode`)},DW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Dxe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!NW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(pI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(wI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!NW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return vI(r,`${i}.binary`),vI(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},vI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},NW=t=>za(t)||LW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",LW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Nxe=t=>Tt(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",zW=t=>nv(t)&&t.protocol!=="file:",jxe=t=>Tt(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Mxe.has(e))&&SI(t.file),Mxe=new Set(["file","append"]),SI=t=>typeof t=="string",UW=(t,e)=>t==="native"&&typeof e=="string"&&!Fxe.has(e),Fxe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),qW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Lxe=t=>qW(t)||iv(t),wI=t=>qW(t?.readable)&&iv(t?.writable),zxe=t=>HW(t)&&typeof t[Symbol.asyncIterator]=="function",Uxe=t=>HW(t)&&typeof t[Symbol.iterator]=="function",HW=t=>typeof t=="object"&&t!==null,Cn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),xI=new Set(["fileUrl","filePath"]),BW=new Set([...xI,"webStream","nodeStream"]),GW=new Set(["webTransform","duplex"]),ys={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 $I,qxe,Hxe,ZW,kI=y(()=>{$r();$I=(t,e,r,n)=>n==="output"?qxe(t,e,r):Hxe(t,e,r),qxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Hxe=(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}},ZW=(t,e)=>{let r=t.findLast(({type:n})=>Cn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var VW,Bxe,Gxe,Zxe,Vxe,Wxe,Kxe,WW=y(()=>{bo();ja();$r();kI();VW=(t,e,r,n)=>[...t.filter(({type:i})=>!Cn.has(i)),...Bxe(t,e,r,n)],Bxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Cn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Gxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Kxe(o,r)},Gxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Zxe({stdioItem:t,optionName:i}):e==="webTransform"?Vxe({stdioItem:t,index:r,newTransforms:n,direction:o}):Wxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Zxe=({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}}},Vxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Tt(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=$I(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Wxe=({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}=Tt(e)?e:{transform:e},d=c||cn.has(o),{writableObjectMode:f,readableObjectMode:p}=$I(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Kxe=(t,e)=>e==="input"?t.reverse():t});import EI from"node:process";var KW,Jxe,Yxe,Bl,AI,JW,Xxe,Qxe,YW=y(()=>{Fa();$r();KW=(t,e,r)=>{let n=t.map(i=>Jxe(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)??Qxe},Jxe=({type:t,value:e},r)=>Yxe[r]??JW[t](e),Yxe=["input","output","output"],Bl=()=>{},AI=()=>"input",JW={generator:Bl,asyncGenerator:Bl,fileUrl:Bl,filePath:Bl,iterable:AI,asyncIterable:AI,uint8Array:AI,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?fI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Bl,duplex:Bl,native(t){let e=Xxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return JW.nodeStream(t)}},Xxe=t=>{if([0,EI.stdin].includes(t))return"input";if([1,2,EI.stdout,EI.stderr].includes(t))return"output"},Qxe="output"});var XW,QW=y(()=>{XW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var eK,e0e,t0e,tK,r0e,n0e,rK=y(()=>{So();QW();ps();eK=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=e0e(t,n).map((a,c)=>tK(a,c));return o?r0e(s,r,i):XW(s,e)},e0e=(t,e)=>{if(t===void 0)return Pn.map(n=>e[n]);if(t0e(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Pn.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,Pn.length);return Array.from({length:r},(n,i)=>t[i])},t0e=t=>Pn.some(e=>t[e]!==void 0),tK=(t,e)=>Array.isArray(t)?t.map(r=>tK(r,e)):t??(e>=Pn.length?"ignore":"pipe"),r0e=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Il(r,i)&&n0e(n)?"ignore":n),n0e=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as i0e}from"node:fs";import o0e from"node:tty";var iK,s0e,a0e,c0e,l0e,nK,oK=y(()=>{Fa();So();an();hs();iK=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?s0e({stdioItem:t,fdNumber:n,direction:i}):l0e({stdioItem:t,fdNumber:n}),s0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=a0e({value:e,optionName:r,fdNumber:n,direction:i});if(o!==void 0)return o;if(oi(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},a0e=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=c0e(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(o0e.isatty(i))throw new TypeError(`The \`${e}: ${Eb(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:vo(i0e(i)),optionName:e}}},c0e=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},l0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:nK(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:nK(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,nK=(t,e,r)=>{let n=ob[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var sK,u0e,d0e,f0e,p0e,aK=y(()=>{Fa();an();$r();sK=({input:t,inputFile:e},r)=>r===0?[...u0e(t),...f0e(e)]:[],u0e=t=>t===void 0?[]:[{type:d0e(t),value:t,optionName:"input"}],d0e=t=>{if(Ma(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.")},f0e=t=>t===void 0?[]:[{...p0e(t),optionName:"inputFile"}],p0e=t=>{if(nv(t))return{type:"fileUrl",value:t};if(SI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var cK,lK,m0e,h0e,uK,g0e,y0e,dK,fK=y(()=>{$r();cK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),lK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=m0e(i,t);if(s.length!==0){if(o){h0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(BW.has(t))return uK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});GW.has(t)&&y0e({otherStdioItems:s,type:t,value:e,optionName:r})}},m0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),h0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{xI.has(e)&&uK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},uK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>g0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return dK(s,n,e),i==="output"?o[0].stream:void 0},g0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,y0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);dK(i,n,e)},dK=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${ys[r]} that is the same.`)}});var sv,_0e,b0e,v0e,S0e,w0e,x0e,$0e,k0e,E0e,A0e,O0e,OI,T0e,av=y(()=>{So();WW();kI();$r();YW();rK();oK();aK();fK();sv=(t,e,r,n)=>{let o=eK(e,r,n).map((a,c)=>_0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=E0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>T0e(a)),s},_0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=b0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=KW(o,e,i),c=o.map(d=>iK({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=VW(c,i,a,r),u=ZW(l,a);return k0e(l,u),{direction:a,objectMode:u,stdioItems:l}},b0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>v0e(c,n)),...sK(r,e)],s=cK(o),a=s.length>1;return S0e(s,a,n),x0e(s),{stdioItems:s,isStdioArray:a}},v0e=(t,e)=>({type:jW(t,e),value:t,optionName:e}),S0e=(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(w0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},w0e=new Set(["ignore","ipc"]),x0e=t=>{for(let e of t)$0e(e)},$0e=({type:t,value:e,optionName:r})=>{if(zW(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(UW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},k0e=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>ov.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},E0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(A0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw OI(i),o}},A0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>O0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},O0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=lK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},OI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},T0e=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 pK}from"node:fs";var hK,Mi,R0e,gK,mK,I0e,yK=y(()=>{an();av();$r();hK=(t,e)=>sv(I0e,t,e,!0),Mi=({type:t,optionName:e})=>{gK(e,ys[t])},R0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&gK(t,`"${e}"`),{}),gK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},mK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:R0e},I0e={input:{...mK,fileUrl:({value:t})=>({contents:[vo(pK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(pK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...mK,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 ko,TI,mp=y(()=>{dI();ko=(t,{stripFinalNewline:e},r)=>TI(e,r)&&t!==void 0&&!Array.isArray(t)?zl(t):t,TI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,II,_K,bK,P0e,C0e,D0e,vK,N0e,RI,j0e,M0e,F0e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:bK(e,n),II=(t,e,r)=>r?t.flatMap(n=>_K(n,e)):_K(t,e),_K=(t,e)=>{let{transform:r,final:n}=bK(e,{});return[...r(t),...n()]},bK=(t,e)=>(e.previousChunks="",{transform:P0e.bind(void 0,e,t),final:D0e.bind(void 0,e)}),P0e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=RI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=RI(n,r.slice(i+1))),t.previousChunks=n},C0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),D0e=function*({previousChunks:t}){t.length>0&&(yield t)},vK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:N0e.bind(void 0,n)},N0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?j0e:F0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},RI=(t,e)=>`${t}${e}`,j0e={windowsNewline:`\r +${t}`}});import RHe from"node:path";import yde from"node:process";var bde,GP,CHe,THe,X4=S(()=>{bde=Et(Xle(),1);sue();EP();k_();M4();H4();W4();Z4();J4();Fd();Y4();tm();ac();GP=(t,e,r)=>{r.cwd=hde(r.cwd);let[n,i,s]=lde(t,e,r),{command:o,args:a,options:c}=bde.default._parse(n,i,s),l=Uce(c),u=CHe(l);return sde(u),fde(u),ude(u),Eue(u),nde(u),u.shell=f4(u.shell),u.env=THe(u),u.killSignal=_ue(u.killSignal),u.forceKillAfterDelay=xue(u.forceKillAfterDelay),u.lines=u.lines.map((d,p)=>d&&!Vi.has(u.encoding)&&u.buffer[p]),yde.platform==="win32"&&RHe.basename(o,".exe")==="cmd"&&a.unshift("/q"),{file:o,commandArguments:a,options:u}},CHe=({extendEnv:t=!0,preferLocal:e=!1,cwd:r,localDir:n=r,encoding:i="utf8",reject:s=!0,cleanup:o=!0,all:a=!1,windowsHide:c=!0,killSignal:l="SIGTERM",forceKillAfterDelay:u=!0,gracefulCancel:d=!1,ipcInput:p,ipc:f=p!==void 0||d,serialization:h="advanced",...m})=>({...m,extendEnv:t,preferLocal:e,cwd:r,localDirectory:n,encoding:i,reject:s,cleanup:o,all:a,windowsHide:c,killSignal:l,forceKillAfterDelay:u,gracefulCancel:d,ipcInput:p,ipc:f,serialization:h}),THe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:s})=>{let o=e?{...yde.env,...t}:t;return r||n?iue({env:o,cwd:i,execPath:s,preferLocal:r,addExecPath:n}):o}});var HP,Q4=S(()=>{HP=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function pm(t){if(typeof t=="string")return OHe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return NHe(t)}var OHe,NHe,vde,DHe,_de,jHe,eB=S(()=>{OHe=t=>t.at(-1)===vde?t.slice(0,t.at(-2)===_de?-2:-1):t,NHe=t=>t.at(-1)===DHe?t.subarray(0,t.at(-2)===jHe?-2:-1):t,vde=` +`,DHe=vde.codePointAt(0),_de="\r",jHe=_de.codePointAt(0)});function co(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 tB(t,{checkOpen:e=!0}={}){return co(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 zd(t,{checkOpen:e=!0}={}){return co(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 rB(t,e){return tB(t,e)&&zd(t,e)}var Ud=S(()=>{});function Sde(){return this[iB].next()}function wde(t){return this[iB].return(t)}function sB({preventCancel:t=!1}={}){let e=this.getReader(),r=new nB(e,t),n=Object.create(MHe);return n[iB]=r,n}var LHe,nB,iB,MHe,xde=S(()=>{LHe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),nB=class{#t;#r;#e=!1;#n=void 0;constructor(e,r){this.#t=e,this.#r=r}next(){let e=()=>this.#s();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#s(){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}}},iB=Symbol();Object.defineProperty(Sde,"name",{value:"next"});Object.defineProperty(wde,"name",{value:"return"});MHe=Object.create(LHe,{next:{enumerable:!0,configurable:!0,writable:!0,value:Sde},return:{enumerable:!0,configurable:!0,writable:!0,value:wde}})});var kde=S(()=>{});var Ede=S(()=>{xde();kde()});var Ade,FHe,zHe,UHe,P_,oB=S(()=>{Ud();Ede();Ade=t=>{if(zd(t,{checkOpen:!1})&&P_.on!==void 0)return zHe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(FHe.call(t)==="[object ReadableStream]")return sB.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:FHe}=Object.prototype,zHe=async function*(t){let e=new AbortController,r={};UHe(t,e,r);try{for await(let[n]of P_.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()}},UHe=async(t,e,r)=>{try{await P_.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},P_={}});var fm,BHe,Pde,$de,qHe,Ide,ra,R_=S(()=>{oB();fm=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:s,getFinalChunk:o,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=Ade(t),u=e();u.length=0;try{for await(let d of l){let p=qHe(d),f=r[p](d,u);Pde({convertedChunk:f,state:u,getSize:n,truncateChunk:i,addChunk:s,maxBuffer:c})}return BHe({state:u,convertChunk:r,getSize:n,truncateChunk:i,addChunk:s,getFinalChunk:o,maxBuffer:c}),a(u)}catch(d){let p=typeof d=="object"&&d!==null?d:new Error(d);throw p.bufferedData=a(u),p}},BHe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:s})=>{let o=i(t);o!==void 0&&Pde({convertedChunk:o,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:s})},Pde=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:s})=>{let o=r(t),a=e.length+o;if(a<=s){$de(t,e,i,a);return}let c=n(t,s-e.length);throw c!==void 0&&$de(c,e,i,s),new ra},$de=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},qHe=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=Ide.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&Ide.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:Ide}=Object.prototype,ra=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var cc,C_,WP,ZP,JP,KP=S(()=>{cc=t=>t,C_=()=>{},WP=({contents:t})=>t,ZP=t=>{throw new Error(`Streams in object mode are not supported: ${String(t)}`)},JP=t=>t.length});async function YP(t,e){return fm(t,WHe,e)}var VHe,GHe,HHe,WHe,Rde=S(()=>{R_();KP();VHe=()=>({contents:[]}),GHe=()=>1,HHe=(t,{contents:e})=>(e.push(t),e),WHe={init:VHe,convertChunk:{string:cc,buffer:cc,arrayBuffer:cc,dataView:cc,typedArray:cc,others:cc},getSize:GHe,truncateChunk:C_,addChunk:HHe,getFinalChunk:C_,finalize:WP}});async function XP(t,e){return fm(t,r3e,e)}var ZHe,JHe,KHe,Cde,Tde,YHe,XHe,QHe,e3e,Nde,Ode,t3e,Dde,r3e,jde=S(()=>{R_();KP();ZHe=()=>({contents:new ArrayBuffer(0)}),JHe=t=>KHe.encode(t),KHe=new TextEncoder,Cde=t=>new Uint8Array(t),Tde=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),YHe=(t,e)=>t.slice(0,e),XHe=(t,{contents:e,length:r},n)=>{let i=Dde()?e3e(e,n):QHe(e,n);return new Uint8Array(i).set(t,r),i},QHe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(Nde(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},e3e=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:Nde(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},Nde=t=>Ode**Math.ceil(Math.log(t)/Math.log(Ode)),Ode=2,t3e=({contents:t,length:e})=>Dde()?t:t.slice(0,e),Dde=()=>"resize"in ArrayBuffer.prototype,r3e={init:ZHe,convertChunk:{string:JHe,buffer:Cde,arrayBuffer:Cde,dataView:Tde,typedArray:Tde,others:ZP},getSize:JP,truncateChunk:YHe,addChunk:XHe,getFinalChunk:C_,finalize:t3e}});async function eR(t,e){return fm(t,a3e,e)}var n3e,QP,i3e,s3e,o3e,a3e,Lde=S(()=>{R_();KP();n3e=()=>({contents:"",textDecoder:new TextDecoder}),QP=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),i3e=(t,{contents:e})=>e+t,s3e=(t,e)=>t.slice(0,e),o3e=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},a3e={init:n3e,convertChunk:{string:cc,buffer:QP,arrayBuffer:QP,dataView:QP,typedArray:QP,others:ZP},getSize:JP,truncateChunk:s3e,addChunk:i3e,getFinalChunk:o3e,finalize:WP}});var Mde=S(()=>{Rde();jde();Lde();R_()});import{on as c3e}from"node:events";import{finished as l3e}from"node:stream/promises";var tR=S(()=>{oB();Mde();Object.assign(P_,{on:c3e,finished:l3e})});var Fde,u3e,zde,Ude,d3e,Bde,qde,rR,Bd=S(()=>{tR();sc();ac();Fde=({error:t,stream:e,readableObjectMode:r,lines:n,encoding:i,fdNumber:s})=>{if(!(t instanceof ra))throw t;if(s==="all")return t;let o=u3e(r,n,i);throw t.maxBufferInfo={fdNumber:s,unit:o},e.destroy(),t},u3e=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",zde=(t,e,r)=>{if(e.length!==r)return;let n=new ra;throw n.maxBufferInfo={fdNumber:"ipc"},n},Ude=(t,e)=>{let{streamName:r,threshold:n,unit:i}=d3e(t,e);return`Command's ${r} was larger than ${n} ${i}`},d3e=(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=oc(e,r);return r==="ipc"?{streamName:"IPC output",threshold:i,unit:"messages"}:{streamName:cP(r),threshold:i,unit:n}},Bde=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>rR(r)),qde=(t,e,r)=>{if(!e)return t;let n=rR(r);return t.length>n?t.slice(0,n):t},rR=([,t])=>t});import{inspect as p3e}from"node:util";var Gde,f3e,h3e,m3e,g3e,y3e,Vde,Hde=S(()=>{eB();qi();Y4();dP();Bd();k_();Ld();Gde=({stdio:t,all:e,ipcOutput:r,originalError:n,signal:i,signalDescription:s,exitCode:o,escapedCommand:a,timedOut:c,isCanceled:l,isGracefullyCanceled:u,isMaxBuffer:d,isForcefullyTerminated:p,forceKillAfterDelay:f,killSignal:h,maxBuffer:m,timeout:y,cwd:v})=>{let g=n?.code,b=f3e({originalError:n,timedOut:c,timeout:y,isMaxBuffer:d,maxBuffer:m,errorCode:g,signal:i,signalDescription:s,exitCode:o,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:p,forceKillAfterDelay:f,killSignal:h}),w=m3e(n,v),x=w===void 0?"":` +${w}`,$=`${b}: ${a}${x}`,I=e===void 0?[t[2],t[1]]:[e],E=[$,...I,...t.slice(3),r.map(R=>g3e(R)).join(` +`)].map(R=>__(pm(y3e(R)))).filter(Boolean).join(` + +`);return{originalMessage:w,shortMessage:$,message:E}},f3e=({originalError:t,timedOut:e,timeout:r,isMaxBuffer:n,maxBuffer:i,errorCode:s,signal:o,signalDescription:a,exitCode:c,isCanceled:l,isGracefullyCanceled:u,isForcefullyTerminated:d,forceKillAfterDelay:p,killSignal:f})=>{let h=h3e(d,p);return e?`Command timed out after ${r} milliseconds${h}`:u?o===void 0?`Command was gracefully canceled with exit code ${c}`:d?`Command was gracefully canceled${h}`:`Command was gracefully canceled with ${o} (${a})`:l?`Command was canceled${h}`:n?`${Ude(t,i)}${h}`:s!==void 0?`Command failed with ${s}${h}`:d?`Command was killed with ${f} (${kP(f)})${h}`:o!==void 0?`Command was killed with ${o} (${a})`:c!==void 0?`Command failed with exit code ${c}`:"Command failed"},h3e=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",m3e=(t,e)=>{if(t instanceof oo)return;let r=cue(t)?t.originalMessage:String(t?.message??t),n=__(gde(r,e));return n===""?void 0:n},g3e=t=>typeof t=="string"?t:p3e(t),y3e=t=>Array.isArray(t)?t.map(e=>pm(Vde(e))).filter(Boolean).join(` +`):Vde(t),Vde=t=>typeof t=="string"?t:Wr(t)?oP(t):""});var nR,hm,T_,b3e,Wde,v3e,O_=S(()=>{k_();yP();Ld();Hde();nR=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:s},startTime:o})=>Wde({command:t,escapedCommand:e,cwd:s,durationMs:x4(o),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:[]}),hm=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:o})=>T_({error:t,command:e,escapedCommand:r,startTime:s,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:n.length}),ipcOutput:[],options:i,isSync:o}),T_=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,stdio:d,all:p,ipcOutput:f,options:{timeoutDuration:h,timeout:m=h,forceKillAfterDelay:y,killSignal:v,cwd:g,maxBuffer:b},isSync:w})=>{let{exitCode:x,signal:$,signalDescription:I}=v3e(l,u),{originalMessage:E,shortMessage:R,message:A}=Gde({stdio:d,all:p,ipcOutput:f,originalError:t,signal:$,signalDescription:I,exitCode:x,escapedCommand:r,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,forceKillAfterDelay:y,killSignal:v,maxBuffer:b,timeout:m,cwd:g}),B=oue(t,A,w);return Object.assign(B,b3e({error:B,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:x,signal:$,signalDescription:I,stdio:d,all:p,ipcOutput:f,cwd:g,originalMessage:E,shortMessage:R})),B},b3e=({error:t,command:e,escapedCommand:r,startTime:n,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,stdio:p,all:f,ipcOutput:h,cwd:m,originalMessage:y,shortMessage:v})=>Wde({shortMessage:v,originalMessage:y,command:e,escapedCommand:r,cwd:m,durationMs:x4(n),failed:!0,timedOut:i,isCanceled:s,isGracefullyCanceled:o,isTerminated:u!==void 0,isMaxBuffer:a,isForcefullyTerminated:c,exitCode:l,signal:u,signalDescription:d,code:t.cause?.code,stdout:p[1],stderr:p[2],all:f,stdio:p,ipcOutput:h,pipedFrom:[]}),Wde=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),v3e=(t,e)=>{let r=t===null?void 0:t,n=e===null?void 0:e,i=n===void 0?void 0:kP(e);return{exitCode:r,signal:n,signalDescription:i}}});function _3e(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(Zde(t*1e3)%1e3),nanoseconds:Math.trunc(Zde(t*1e6)%1e3)}}function S3e(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 aB(t){switch(typeof t){case"number":{if(Number.isFinite(t))return _3e(t);break}case"bigint":return S3e(t)}throw new TypeError("Expected a finite number or bigint")}var Zde,Jde=S(()=>{Zde=t=>Number.isFinite(t)?t:0});function cB(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=[],s=(u,d)=>{let p=Math.floor(u*10**d+k3e);return(Math.round(p)/10**d).toFixed(d)},o=(u,d,p,f)=>{if(!((i.length===0||!e.colonNotation)&&w3e(u)&&!(e.colonNotation&&p==="m"))){if(f??=String(u),e.colonNotation){let h=f.includes(".")?f.split(".")[0].length:f.length,m=i.length>0?2:1;f="0".repeat(Math.max(0,m-h))+f}else f+=e.verbose?" "+x3e(d,u):p;i.push(f)}},a=aB(t),c=BigInt(a.days);if(e.hideYearAndDays?o(BigInt(c)*24n+BigInt(a.hours),"hour","h"):(e.hideYear?o(c,"day","d"):(o(c/365n,"year","y"),o(c%365n,"day","d")),o(Number(a.hours),"hour","h")),o(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),p=Number(a.microseconds),f=Number(a.nanoseconds);if(o(u,"second","s"),e.formatSubMilliseconds)o(d,"millisecond","ms"),o(p,"microsecond","\xB5s"),o(f,"nanosecond","ns");else{let h=d+p/1e3+f/1e6,m=typeof e.millisecondsDecimalDigits=="number"?e.millisecondsDecimalDigits:0,y=h>=1?Math.round(h):Math.ceil(h),v=m?h.toFixed(m):y;o(Number.parseFloat(v),"millisecond","ms",v)}}else{let u=(r?Number(t%E3e):t)/1e3%60,d=typeof e.secondsDecimalDigits=="number"?e.secondsDecimalDigits:1,p=s(u,d),f=e.keepDecimalsOnWholeSeconds?p:p.replace(/\.0+$/,"");o(Number.parseFloat(f),"second","s",f)}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 w3e,x3e,k3e,E3e,Kde=S(()=>{Jde();w3e=t=>t===0||t===0n,x3e=(t,e)=>e===1||e===1n?t:`${t}s`,k3e=1e-7,E3e=24n*60n*60n*1000n});var Yde,Xde=S(()=>{im();Yde=(t,e)=>{t.failed&&Qo({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var Qde,A3e,epe=S(()=>{Kde();jl();im();Xde();Qde=(t,e)=>{rm(e)&&(Yde(t,e),A3e(t,e))},A3e=(t,e)=>{let r=`(done in ${cB(t.durationMs)})`;Qo({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var mm,iR=S(()=>{epe();mm=(t,e,{reject:r})=>{if(Qde(t,e),t.failed&&r)throw t;return t}});var npe,$3e,I3e,ipe,spe,tpe,P3e,lB,rpe,qd,ope,R3e,sR,ape,C3e,T3e,uB,cpe,O3e,lpe,oR,N3e,dB,D3e,j3e,upe,ws,aR,pB,dpe,ppe,zl,Qn=S(()=>{Ud();nc();qi();npe=(t,e)=>qd(t)?"asyncGenerator":ope(t)?"generator":sR(t)?"fileUrl":C3e(t)?"filePath":N3e(t)?"webStream":co(t,{checkOpen:!1})?"native":Wr(t)?"uint8Array":D3e(t)?"asyncIterable":j3e(t)?"iterable":dB(t)?ipe({transform:t},e):R3e(t)?$3e(t,e):"native",$3e=(t,e)=>rB(t.transform,{checkOpen:!1})?I3e(t,e):dB(t.transform)?ipe(t,e):P3e(t,e),I3e=(t,e)=>(spe(t,e,"Duplex stream"),"duplex"),ipe=(t,e)=>(spe(t,e,"web TransformStream"),"webTransform"),spe=({final:t,binary:e,objectMode:r},n,i)=>{tpe(t,`${n}.final`,i),tpe(e,`${n}.binary`,i),lB(r,`${n}.objectMode`)},tpe=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},P3e=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!rpe(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(rB(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(dB(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!rpe(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return lB(r,`${i}.binary`),lB(n,`${i}.objectMode`),qd(t)||qd(e)?"asyncGenerator":"generator"},lB=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},rpe=t=>qd(t)||ope(t),qd=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",ope=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",R3e=t=>$r(t)&&(t.transform!==void 0||t.final!==void 0),sR=t=>Object.prototype.toString.call(t)==="[object URL]",ape=t=>sR(t)&&t.protocol!=="file:",C3e=t=>$r(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>T3e.has(e))&&uB(t.file),T3e=new Set(["file","append"]),uB=t=>typeof t=="string",cpe=(t,e)=>t==="native"&&typeof e=="string"&&!O3e.has(e),O3e=new Set(["ipc","ignore","inherit","overlapped","pipe"]),lpe=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",oR=t=>Object.prototype.toString.call(t)==="[object WritableStream]",N3e=t=>lpe(t)||oR(t),dB=t=>lpe(t?.readable)&&oR(t?.writable),D3e=t=>upe(t)&&typeof t[Symbol.asyncIterator]=="function",j3e=t=>upe(t)&&typeof t[Symbol.iterator]=="function",upe=t=>typeof t=="object"&&t!==null,ws=new Set(["generator","asyncGenerator","duplex","webTransform"]),aR=new Set(["fileUrl","filePath","fileNumber"]),pB=new Set(["fileUrl","filePath"]),dpe=new Set([...pB,"webStream","nodeStream"]),ppe=new Set(["webTransform","duplex"]),zl={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 fB,L3e,M3e,fpe,hB=S(()=>{Qn();fB=(t,e,r,n)=>n==="output"?L3e(t,e,r):M3e(t,e,r),L3e=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},M3e=(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}},fpe=(t,e)=>{let r=t.findLast(({type:n})=>ws.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var hpe,F3e,z3e,U3e,B3e,q3e,V3e,mpe=S(()=>{nc();Fd();Qn();hB();hpe=(t,e,r,n)=>[...t.filter(({type:i})=>!ws.has(i)),...F3e(t,e,r,n)],F3e=(t,e,r,{encoding:n})=>{let i=t.filter(({type:o})=>ws.has(o)),s=Array.from({length:i.length});for(let[o,a]of Object.entries(i))s[o]=z3e({stdioItem:a,index:Number(o),newTransforms:s,optionName:e,direction:r,encoding:n});return V3e(s,r)},z3e=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:s,encoding:o})=>e==="duplex"?U3e({stdioItem:t,optionName:i}):e==="webTransform"?B3e({stdioItem:t,index:r,newTransforms:n,direction:s}):q3e({stdioItem:t,index:r,newTransforms:n,direction:s,encoding:o}),U3e=({stdioItem:t,stdioItem:{value:{transform:e,transform:{writableObjectMode:r,readableObjectMode:n},objectMode:i=n}},optionName:s})=>{if(i&&!n)throw new TypeError(`The \`${s}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!i&&n)throw new TypeError(`The \`${s}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...t,value:{transform:e,writableObjectMode:r,readableObjectMode:n}}},B3e=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:s,objectMode:o}=$r(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=fB(o,r,n,i);return{...t,value:{transform:s,writableObjectMode:a,readableObjectMode:c}}},q3e=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i,encoding:s})=>{let{transform:o,final:a,binary:c=!1,preserveNewlines:l=!1,objectMode:u}=$r(e)?e:{transform:e},d=c||Vi.has(s),{writableObjectMode:p,readableObjectMode:f}=fB(u,r,n,i);return{...t,value:{transform:o,final:a,binary:d,preserveNewlines:l,writableObjectMode:p,readableObjectMode:f}}},V3e=(t,e)=>e==="input"?t.reverse():t});import mB from"node:process";var gpe,G3e,H3e,gm,gB,ype,W3e,Z3e,bpe=S(()=>{Ud();Qn();gpe=(t,e,r)=>{let n=t.map(i=>G3e(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)??Z3e},G3e=({type:t,value:e},r)=>H3e[r]??ype[t](e),H3e=["input","output","output"],gm=()=>{},gB=()=>"input",ype={generator:gm,asyncGenerator:gm,fileUrl:gm,filePath:gm,iterable:gB,asyncIterable:gB,uint8Array:gB,webStream:t=>oR(t)?"output":"input",nodeStream(t){return zd(t,{checkOpen:!1})?tB(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:gm,duplex:gm,native(t){let e=W3e(t);if(e!==void 0)return e;if(co(t,{checkOpen:!1}))return ype.nodeStream(t)}},W3e=t=>{if([0,mB.stdin].includes(t))return"input";if([1,2,mB.stdout,mB.stderr].includes(t))return"output"},Z3e="output"});var vpe,_pe=S(()=>{vpe=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var Spe,J3e,K3e,wpe,Y3e,X3e,xpe=S(()=>{sc();_pe();jl();Spe=({stdio:t,ipc:e,buffer:r,...n},i,s)=>{let o=J3e(t,n).map((a,c)=>wpe(a,c));return s?Y3e(o,r,i):vpe(o,e)},J3e=(t,e)=>{if(t===void 0)return Ss.map(n=>e[n]);if(K3e(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Ss.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,Ss.length);return Array.from({length:r},(n,i)=>t[i])},K3e=t=>Ss.some(e=>t[e]!==void 0),wpe=(t,e)=>Array.isArray(t)?t.map(r=>wpe(r,e)):t??(e>=Ss.length?"ignore":"pipe"),Y3e=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!nm(r,i)&&X3e(n)?"ignore":n),X3e=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Q3e}from"node:fs";import e9e from"node:tty";var Epe,t9e,r9e,n9e,i9e,kpe,Ape=S(()=>{Ud();sc();qi();Ml();Epe=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:s})=>!r||e!=="native"?t:s?t9e({stdioItem:t,fdNumber:n,direction:i}):i9e({stdioItem:t,fdNumber:n}),t9e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let s=r9e({value:e,optionName:r,fdNumber:n,direction:i});if(s!==void 0)return s;if(co(e,{checkOpen:!1}))throw new TypeError(`The \`${r}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return t},r9e=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=n9e(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(e9e.isatty(i))throw new TypeError(`The \`${e}: ${IP(t)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:ic(Q3e(i)),optionName:e}}},n9e=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=aP.indexOf(t);if(r!==-1)return r},i9e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:kpe(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:kpe(e,e,r),optionName:r}:co(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,kpe=(t,e,r)=>{let n=aP[t];if(n===void 0)throw new TypeError(`The \`${r}: ${e}\` option is invalid: no such standard stream.`);return n}});var $pe,s9e,o9e,a9e,c9e,Ipe=S(()=>{Ud();qi();Qn();$pe=({input:t,inputFile:e},r)=>r===0?[...s9e(t),...a9e(e)]:[],s9e=t=>t===void 0?[]:[{type:o9e(t),value:t,optionName:"input"}],o9e=t=>{if(zd(t,{checkOpen:!1}))return"nodeStream";if(typeof t=="string")return"string";if(Wr(t))return"uint8Array";throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},a9e=t=>t===void 0?[]:[{...c9e(t),optionName:"inputFile"}],c9e=t=>{if(sR(t))return{type:"fileUrl",value:t};if(uB(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var Ppe,Rpe,l9e,u9e,Cpe,d9e,p9e,Tpe,Ope=S(()=>{Qn();Ppe=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),Rpe=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:s})=>{let o=l9e(i,t);if(o.length!==0){if(s){u9e({otherStdioItems:o,type:t,value:e,optionName:r,direction:n});return}if(dpe.has(t))return Cpe({otherStdioItems:o,type:t,value:e,optionName:r,direction:n});ppe.has(t)&&p9e({otherStdioItems:o,type:t,value:e,optionName:r})}},l9e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),u9e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{pB.has(e)&&Cpe({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},Cpe=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let s=t.filter(a=>d9e(a,r));if(s.length===0)return;let o=s.find(a=>a.direction!==i);return Tpe(o,n,e),i==="output"?s[0].stream:void 0},d9e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,p9e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:s}})=>s===r.transform);Tpe(i,n,e)},Tpe=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${t.optionName}\` and \`${e}\` options must not target ${zl[r]} that is the same.`)}});var cR,f9e,h9e,m9e,g9e,y9e,b9e,v9e,_9e,S9e,w9e,x9e,yB,k9e,lR=S(()=>{sc();mpe();hB();Qn();bpe();xpe();Ape();Ipe();Ope();cR=(t,e,r,n)=>{let s=Spe(e,r,n).map((a,c)=>f9e({stdioOption:a,fdNumber:c,options:e,isSync:n})),o=S9e({initialFileDescriptors:s,addProperties:t,options:e,isSync:n});return e.stdio=o.map(({stdioItems:a})=>k9e(a)),o},f9e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=cP(e),{stdioItems:s,isStdioArray:o}=h9e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=gpe(s,e,i),c=s.map(d=>Epe({stdioItem:d,isStdioArray:o,fdNumber:e,direction:a,isSync:n})),l=hpe(c,i,a,r),u=fpe(l,a);return _9e(l,u),{direction:a,objectMode:u,stdioItems:l}},h9e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let s=[...(Array.isArray(t)?t:[t]).map(c=>m9e(c,n)),...$pe(r,e)],o=Ppe(s),a=o.length>1;return g9e(o,a,n),b9e(o),{stdioItems:o,isStdioArray:a}},m9e=(t,e)=>({type:npe(t,e),value:t,optionName:e}),g9e=(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(y9e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},y9e=new Set(["ignore","ipc"]),b9e=t=>{for(let e of t)v9e(e)},v9e=({type:t,value:e,optionName:r})=>{if(ape(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(cpe(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},_9e=(t,e)=>{if(!e)return;let r=t.find(({type:n})=>aR.has(n));if(r!==void 0)throw new TypeError(`The \`${r.optionName}\` option cannot use both files and transforms in objectMode.`)},S9e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let s of t)i.push(w9e({fileDescriptor:s,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(s){throw yB(i),s}},w9e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:s,isSync:o})=>{let a=r.map(c=>x9e({stdioItem:c,addProperties:i,direction:t,options:s,fileDescriptors:n,isSync:o}));return{direction:t,objectMode:e,stdioItems:a}},x9e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:s})=>{let o=Rpe({stdioItem:t,direction:r,fileDescriptors:i,isSync:s});return o!==void 0?{...t,stream:o}:{...t,...e[r][t.type](t,n)}},yB=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!so(r)&&r.destroy()},k9e=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 Npe}from"node:fs";var jpe,na,E9e,Lpe,Dpe,A9e,Mpe=S(()=>{qi();lR();Qn();jpe=(t,e)=>cR(A9e,t,e,!0),na=({type:t,optionName:e})=>{Lpe(e,zl[t])},E9e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&Lpe(t,`"${e}"`),{}),Lpe=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},Dpe={generator(){},asyncGenerator:na,webStream:na,nodeStream:na,webTransform:na,duplex:na,asyncIterable:na,native:E9e},A9e={input:{...Dpe,fileUrl:({value:t})=>({contents:[ic(Npe(t))]}),filePath:({value:{file:t}})=>({contents:[ic(Npe(t))]}),fileNumber:na,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...Dpe,fileUrl:({value:t})=>({path:t}),filePath:({value:{file:t,append:e}})=>({path:t,append:e}),fileNumber:({value:t})=>({path:t}),iterable:na,string:na,uint8Array:na}}});var lc,bB,N_=S(()=>{eB();lc=(t,{stripFinalNewline:e},r)=>bB(e,r)&&t!==void 0&&!Array.isArray(t)?pm(t):t,bB=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var uR,_B,Fpe,zpe,$9e,I9e,P9e,Upe,R9e,vB,C9e,T9e,O9e,dR=S(()=>{uR=(t,e,r,n)=>t||r?void 0:zpe(e,n),_B=(t,e,r)=>r?t.flatMap(n=>Fpe(n,e)):Fpe(t,e),Fpe=(t,e)=>{let{transform:r,final:n}=zpe(e,{});return[...r(t),...n()]},zpe=(t,e)=>(e.previousChunks="",{transform:$9e.bind(void 0,e,t),final:P9e.bind(void 0,e)}),$9e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let s=0;s0&&(a=vB(n,a),n=""),yield a,i=s}i!==r.length-1&&(n=vB(n,r.slice(i+1))),t.previousChunks=n},I9e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),P9e=function*({previousChunks:t}){t.length>0&&(yield t)},Upe=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:R9e.bind(void 0,n)},R9e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:s}=typeof e=="string"?C9e:O9e;if(e.at(-1)===i){yield e;return}yield s(e,t?n:r)},vB=(t,e)=>`${t}${e}`,C9e={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:RI},M0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},F0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:M0e}});import{Buffer as L0e}from"node:buffer";var SK,z0e,wK,U0e,q0e,xK,$K=y(()=>{an();SK=(t,e)=>t?void 0:z0e.bind(void 0,e),z0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!L0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},wK=(t,e)=>t?U0e.bind(void 0,e):q0e.bind(void 0,e),U0e=function*(t,e){xK(t,e),yield e},q0e=function*(t,e){if(xK(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},xK=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:vB},T9e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},O9e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:T9e}});import{Buffer as N9e}from"node:buffer";var Bpe,D9e,qpe,j9e,L9e,Vpe,Gpe=S(()=>{qi();Bpe=(t,e)=>t?void 0:D9e.bind(void 0,e),D9e=function*(t,e){if(typeof e!="string"&&!Wr(e)&&!N9e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},qpe=(t,e)=>t?j9e.bind(void 0,e):L9e.bind(void 0,e),j9e=function*(t,e){Vpe(t,e),yield e},L9e=function*(t,e){if(Vpe(t,e),typeof e!="string"&&!Wr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},Vpe=(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 H0e}from"node:buffer";import{StringDecoder as B0e}from"node:string_decoder";var uv,G0e,Z0e,V0e,PI=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:G0e.bind(void 0,new TextEncoder)};let n=new B0e(e);return{transform:Z0e.bind(void 0,n),final:V0e.bind(void 0,n)}},G0e=function*(t,e){H0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},Z0e=function*(t,e){yield qt(e)?t.write(e):e},V0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as kK}from"node:util";var CI,dv,EK,W0e,AK,K0e,OK=y(()=>{CI=kK(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),dv=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=K0e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},EK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*W0e(r,Number(e),t)},W0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},AK=kK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),K0e=function*(t){yield t}});var DI,TK,Ua,hp,J0e,Y0e,NI=y(()=>{DI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TK=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...hp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Y0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},hp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*J0e(r,Number(e),t)},J0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ua(n,r,e+1)},Y0e=function*(t){yield t}});import{Transform as X0e,getDefaultHighWaterMark as RK}from"node:stream";var jI,fv,IK,pv=y(()=>{$r();lv();$K();PI();OK();NI();jI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=IK(t,s,o),l=za(e),u=za(r),d=l?CI.bind(void 0,dv,a):DI.bind(void 0,Ua),f=l||u?CI.bind(void 0,EK,a):DI.bind(void 0,hp),p=l||u?AK.bind(void 0,a):void 0;return{stream:new X0e({writableObjectMode:n,writableHighWaterMark:RK(n),readableObjectMode:i,readableHighWaterMark:RK(i),transform(h,g,b){d([h,c,0],this,b)},flush(h){f([c],this,h)},destroy:p})}},fv=(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=IK(s,r,a);t=TK(c,t)}return t},IK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:SK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:wK(i,a)},vK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var PK,Q0e,e$e,t$e,r$e,CK=y(()=>{pv();an();$r();PK=(t,e)=>{for(let r of Q0e(t))e$e(t,r,e)},Q0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),e$e=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${ys[a]} with synchronous methods.`)}let s=i.map(({contents:a})=>a).map(a=>t$e(a,n));r.input=Qf(s)},t$e=(t,e)=>{let r=fv(t,e,"utf8",!0);return r$e(r),Qf(r)},r$e=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 mv,n$e,i$e,DK,NK,o$e,jK,MI=y(()=>{ja();$r();Pl();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Il(r,n)&&!cn.has(e)&&n$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&i$e.has(o))||t.every(({type:i})=>Cn.has(i))),n$e=t=>t===1||t===2,i$e=new Set(["pipe","overlapped"]),DK=async(t,e,r,n)=>{for await(let i of t)o$e(e)||jK(i,r,n)},NK=(t,e,r)=>{for(let n of t)jK(n,e,r)},o$e=t=>t._readableState.pipes.length>0,jK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as s$e,appendFileSync as a$e}from"node:fs";var MK,c$e,l$e,u$e,d$e,f$e,FK=y(()=>{MI();pv();lv();an();$r();La();MK=({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)=>c$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},c$e=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:o,verboseInfo:s},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=wW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=l$e([p],m,c,n),{serializedResult:b,finalResult:_=b}=u$e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});d$e({serializedResult:b,fdNumber:r,state:n,verboseInfo:s,encoding:c,stdioItems:m,objectMode:h});let S=a[r]?_:void 0;try{return n.error===void 0&&f$e(b,m,i),S}catch(x){return n.error=x,S}},l$e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},u$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Qf(t)};let s=fZ(t,r);return n[o]?{serializedResult:s,finalResult:II(s,!i[o],e)}:{serializedResult:s}},d$e=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:o,objectMode:s})=>{if(!mv({stdioItems:o,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=II(t,!1,s);try{NK(a,e,n)}catch(c){r.error??=c}},f$e=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:o})=>ov.has(o))){let o=typeof n=="string"?n:n.toString();i||r.has(o)?a$e(n,t):(r.add(o),s$e(n,t))}}});var LK,zK=y(()=>{an();mp();LK=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,ko(e,r,"all")]:Array.isArray(e)?[ko(t,r,"all"),...e]:qt(t)&&qt(e)?ER([t,e]):`${t}${e}`}});import{once as FI}from"node:events";var UK,p$e,qK,HK,m$e,LI,zI=y(()=>{Da();UK=async(t,e)=>{let[r,n]=await p$e(t);return e.isForcefullyTerminated??=!1,[r,n]},p$e=async t=>{let[e,r]=await Promise.allSettled([FI(t,"spawn"),FI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?qK(t):r.value},qK=async t=>{try{return await FI(t,"exit")}catch{return qK(t)}},HK=async t=>{let[e,r]=await t;if(!m$e(e,r)&&LI(e,r))throw new ni;return[e,r]},m$e=(t,e)=>t===void 0&&e===void 0,LI=(t,e)=>t!==0||e!==null});var BK,h$e,GK=y(()=>{Da();La();zI();BK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=h$e(t,e,r),s=o?.code==="ETIMEDOUT",a=SW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},h$e=(t,e,r)=>t!==void 0?t:LI(e,r)?new ni:void 0});import{spawnSync as g$e}from"node:child_process";var ZK,y$e,_$e,b$e,hv,v$e,S$e,w$e,x$e,VK=y(()=>{NR();lI();uI();pp();rv();yK();mp();CK();FK();La();zK();GK();ZK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=y$e(t,e,r),d=v$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Hl(d,c,l)},y$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=_$e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);b$e(u);let d=hK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},_$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,b$e=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&hv("ipcInput"),t&&hv("ipc: true"),r&&hv("detached: true"),n&&hv("cancelSignal")},hv=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},v$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=S$e({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}=BK(c,r),{output:m,error:h=l}=MK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(LK(m,r),r,"all");return x$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},S$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{PK(o,r);let a=w$e(r);return g$e(...Bb(t,e,a))}catch(a){return ql({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},w$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),x$e=({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?tv({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):fp({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 UI,on as $$e}from"node:events";var WK,k$e,E$e,A$e,O$e,KK=y(()=>{Ml();ap();sp();WK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Nl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),k$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),k$e=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{Tb(e,i);let o=gs(t,e,r),s=new AbortController;try{return await Promise.race([E$e(o,n,s),A$e(o,r,s),O$e(o,r,s)])}catch(a){throw jl(t),a}finally{s.abort(),Rb(e,i)}},E$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await UI(t,"message",{signal:r});return n}for await(let[n]of $$e(t,"message",{signal:r}))if(e(n))return n},A$e=async(t,e,{signal:r})=>{await UI(t,"disconnect",{signal:r}),s9(e)},O$e=async(t,e,{signal:r})=>{let[n]=await UI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as YK,on as T$e}from"node:events";var XK,qI,R$e,I$e,P$e,JK,HI=y(()=>{Ml();ap();sp();XK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>qI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),qI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Nl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),Tb(e,o);let s=gs(t,e,r),a=new AbortController,c={};return R$e(t,s,a),I$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),P$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},R$e=async(t,e,r)=>{try{await YK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},I$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await YK(t,"strict:error",{signal:r.signal});n.error=kb(i,e),r.abort()}catch{}},P$e=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:o,state:s,reference:a}){try{for await(let[c]of T$e(r,"message",{signal:o.signal}))JK(s),yield c}catch{JK(s)}finally{o.abort(),Rb(e,a),n||jl(t),i&&await t}},JK=({error:t})=>{if(t)throw t}});import QK from"node:process";var e3,t3,r3,BI=y(()=>{Ub();KK();HI();Db();e3=(t,{ipc:e})=>{Object.assign(t,r3(t,!1,e))},t3=()=>{let t=QK,e=!0,r=QK.channel!==void 0;return{...r3(t,e,r),getCancelSignal:D9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},r3=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:WK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:XK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as C$e}from"node:child_process";import{PassThrough as D$e,Readable as N$e,Writable as j$e,Duplex as M$e}from"node:stream";var n3,F$e,gp,L$e,z$e,U$e,q$e,i3=y(()=>{av();pp();rv();n3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{OI(n);let a=new C$e;F$e(a,n),Object.assign(a,{readable:L$e,writable:z$e,duplex:U$e});let c=ql({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=q$e(c,s,i);return{subprocess:a,promise:l}},F$e=(t,e)=>{let r=gp(),n=gp(),i=gp(),o=Array.from({length:e.length-3},gp),s=gp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},gp=()=>{let t=new D$e;return t.end(),t},L$e=()=>new N$e({read(){}}),z$e=()=>new j$e({write(){}}),U$e=()=>new M$e({read(){},write(){}}),q$e=async(t,e,r)=>Hl(t,e,r)});import{createReadStream as o3,createWriteStream as s3}from"node:fs";import{Buffer as H$e}from"node:buffer";import{Readable as yp,Writable as B$e,Duplex as G$e}from"node:stream";var c3,_p,a3,Z$e,l3=y(()=>{pv();av();$r();c3=(t,e)=>sv(Z$e,t,e,!1),_p=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},a3={fileNumber:_p,generator:jI,asyncGenerator:jI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:G$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Z$e={input:{...a3,fileUrl:({value:t})=>({stream:o3(t)}),filePath:({value:{file:t}})=>({stream:o3(t)}),webStream:({value:t})=>({stream:yp.fromWeb(t)}),iterable:({value:t})=>({stream:yp.from(t)}),asyncIterable:({value:t})=>({stream:yp.from(t)}),string:({value:t})=>({stream:yp.from(t)}),uint8Array:({value:t})=>({stream:yp.from(H$e.from(t))})},output:{...a3,fileUrl:({value:t})=>({stream:s3(t)}),filePath:({value:{file:t,append:e}})=>({stream:s3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:B$e.fromWeb(t)}),iterable:_p,asyncIterable:_p,string:_p,uint8Array:_p}}});import{on as V$e,once as u3}from"node:events";import{PassThrough as W$e,getDefaultHighWaterMark as K$e}from"node:stream";import{finished as p3}from"node:stream/promises";function qa(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)ZI(i);let e=t.some(({readableObjectMode:i})=>i),r=J$e(t,e),n=new GI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var J$e,GI,Y$e,X$e,Q$e,ZI,eke,tke,rke,nke,ike,m3,h3,VI,g3,oke,gv,d3,f3,yv=y(()=>{J$e=(t,e)=>{if(t.length===0)return K$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},GI=class extends W$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(ZI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Y$e(this,this.#t,this.#o);let r=eke({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(ZI(e),!this.#t.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},Y$e=async(t,e,r)=>{gv(t,d3);let n=new AbortController;try{await Promise.race([X$e(t,n),Q$e(t,e,r,n)])}finally{n.abort(),gv(t,-d3)}},X$e=async(t,{signal:e})=>{try{await p3(t,{signal:e,cleanup:!0})}catch(r){throw m3(t,r),r}},Q$e=async(t,e,r,{signal:n})=>{for await(let[i]of V$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},ZI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},eke=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{gv(t,f3);let a=new AbortController;try{await Promise.race([tke(o,e,a),rke({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),nke({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-f3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?VI(t):ike(t))},tke=async(t,e,{signal:r})=>{try{await t,r.aborted||VI(e)}catch(n){r.aborted||m3(e,n)}},rke=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await p3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;h3(s)?i.add(e):g3(t,s)}},nke=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await u3(t,i,{signal:o}),!t.readable)return u3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},ike=t=>{t.writable&&t.end()},m3=(t,e)=>{h3(e)?VI(t):g3(t,e)},h3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",VI=t=>{(t.readable||t.writable)&&t.destroy()},g3=(t,e)=>{t.destroyed||(t.once("error",oke),t.destroy(e))},oke=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},d3=2,f3=1});import{finished as y3}from"node:stream/promises";var Gl,ske,WI,ake,KI,_v=y(()=>{So();Gl=(t,e)=>{t.pipe(e),ske(t,e),ake(t,e)},ske=async(t,e)=>{if(!(ri(t)||ri(e))){try{await y3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}WI(e)}},WI=t=>{t.writable&&t.end()},ake=async(t,e)=>{if(!(ri(t)||ri(e))){try{await y3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}KI(t)}},KI=t=>{t.readable&&t.destroy()}});var _3,cke,lke,uke,dke,fke,b3=y(()=>{yv();So();Ob();$r();_v();_3=(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})=>Cn.has(c)))cke(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Cn.has(c)))uke({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]:qa(o);Gl(s,i)}},cke=(t,e,r,n)=>{r==="output"?Gl(t.stdio[n],e):Gl(e,t.stdio[n]);let i=lke[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},lke=["stdin","stdout","stderr"],uke=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;dke(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},dke=(t,{signal:e})=>{ri(t)&&Na(t,fke,e)},fke=2});var Ha,v3=y(()=>{Ha=[];Ha.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ha.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ha.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var bv,JI,YI,pke,XI,vv,mke,QI,eP,tP,S3,plt,mlt,w3=y(()=>{v3();bv=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"),YI=globalThis,pke=Object.defineProperty.bind(Object),XI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(YI[JI])return YI[JI];pke(YI,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}},vv=class{},mke=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),QI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},eP=class extends vv{#t=tP.platform==="win32"?"SIGINT":"SIGHUP";#r=new XI;#e;#n;#o;#i={};#s=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Ha)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(!bv(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 Ha)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,Ha.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 bv(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"&&bv(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)}},tP=globalThis.process,{onExit:S3,load:plt,unload:mlt}=mke(bv(tP)?new eP(tP):new QI)});import{addAbortListener as hke}from"node:events";var x3,$3=y(()=>{w3();x3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=S3(()=>{t.kill()});hke(n,()=>{i()})}});var E3,gke,yke,k3,_ke,A3=y(()=>{kR();hb();hs();Tl();E3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=gke(r,n,i),{sourceStream:d,sourceError:f}=_ke(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}},gke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=yke(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},yke=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(k3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||xR(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]=nb(r,...n);return{destination:e(k3)(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}`)},k3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),_ke=(t,e)=>{try{return{sourceStream:Ll(t,e)}}catch(r){return{sourceError:r}}}});var T3,bke,rP,O3,nP=y(()=>{pp();_v();T3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=bke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw rP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},bke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return KI(t),n;if(e!==void 0)return WI(r),e},rP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>ql({error:t,command:O3,escapedCommand:O3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),O3="source.pipe(destination)"});var R3,I3=y(()=>{R3=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 vke}from"node:stream/promises";var P3,Ske,wke,xke,Sv,$ke,kke,C3=y(()=>{yv();Ob();_v();P3=(t,e,r)=>{let n=Sv.has(e)?wke(t,e):Ske(t,e);return Na(t,$ke,r.signal),Na(e,kke,r.signal),xke(e),n},Ske=(t,e)=>{let r=qa([t]);return Gl(r,e),Sv.set(e,r),r},wke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},xke=async t=>{try{await vke(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,$ke=2,kke=1});import{aborted as Eke}from"node:util";var D3,Ake,N3=y(()=>{nP();D3=(t,e)=>t===void 0?[]:[Ake(t,e)],Ake=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Eke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw rP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,Oke,Tke,j3=y(()=>{bo();A3();nP();I3();C3();N3();wv=(t,...e)=>{if(Tt(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=E3(t,...e),i=Oke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Oke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Tke(t,i);T3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=P3(e,o,d);return await Promise.race([R3(u),...D3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Tke=(t,e)=>Promise.allSettled([t,e])});import{on as Rke}from"node:events";import{getDefaultHighWaterMark as Ike}from"node:stream";var xv,Pke,iP,Cke,F3,oP,M3,Dke,Nke,$v=y(()=>{PI();lv();NI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Pke(e,s),F3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Pke=async(t,e)=>{try{await t}catch{}finally{e.abort()}},iP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Cke(e,s,t);let a=t.readableObjectMode&&!o;return F3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Cke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},F3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Rke(t,"data",{signal:e.signal,highWaterMark:M3,highWatermark:M3});return Dke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},oP=Ike(!0),M3=oP,Dke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Nke({binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s});try{for await(let[c]of t)yield*Ua(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*hp(a)}},Nke=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as jke}from"node:timers/promises";var L3,Mke,Fke,Lke,sP,z3,aP=y(()=>{Qb();an();MI();$v();La();mp();L3=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=Mke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Fke(t),d]);return}let f=TI(c,r),p=iP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Lke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Mke=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:o,streamInfo:{fileDescriptors:s}})=>{if(!mv({stdioItems:s[r]?.stdioItems,encoding:n,verboseInfo:o,fdNumber:r}))return;let a=iP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await DK(a,t,r,o)},Fke=async t=>{await jke(),t.readableFlowing===null&&t.resume()},Lke=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:o,lines:s})=>{try{return e||s?await Kb(r,{maxBuffer:o}):i==="buffer"?new Uint8Array(await Jb(r,{maxBuffer:o})):await Xb(r,{maxBuffer:o})}catch(a){return z3(_W({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},sP=async t=>{try{return await t}catch(e){return z3(e)}},z3=({bufferedData:t})=>uZ(t)?new Uint8Array(t):t});import{finished as zke}from"node:stream/promises";var bp,Uke,qke,Hke,Bke,Gke,cP,kv,U3,Ev=y(()=>{bp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Uke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],zke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Bke(a,e,r,n)}finally{s.abort()}},Uke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&qke(t,r,n),n},qke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Hke(e,r),n.call(t,...i)}},Hke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Bke=(t,e,r,n)=>{if(!Gke(t,e,r,n))throw t},Gke=(t,e,r,n=!0)=>r.propagating?U3(t)||kv(t):(r.propagating=!0,cP(r,e)===n?U3(t):kv(t)),cP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",U3=t=>t?.code==="EPIPE"});var q3,lP,uP=y(()=>{aP();Ev();q3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>lP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),lP=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=bp(t,e,l);if(cP(l,e)){await u;return}let[d]=await Promise.all([L3({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 H3,B3,Zke,Vke,dP=y(()=>{yv();uP();H3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,B3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>lP({...Zke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Vke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Zke=({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}},Vke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var G3,Z3,V3=y(()=>{Pl();ps();G3=t=>Il(t,"ipc"),Z3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var W3,K3,J3=y(()=>{La();V3();xo();HI();W3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=G3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of qI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(bW(t,i,c),i.push(l)),s&&Z3(l,o);return i},K3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Wke}from"node:events";var Y3,Kke,Jke,Yke,X3=y(()=>{Fa();iI();KR();nI();So();$r();aP();J3();sI();dP();uP();zI();Ev();Y3=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 _=UK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=q3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=B3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=W3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),O=Kke(h,t,S),D=Jke(m,S);try{return await Promise.race([Promise.all([{},HK(_),Promise.all(x),w,A,B9(t,d),...O,...D]),g,Yke(t,b),...L9(t,o,f,b),...o9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...M9({subprocess:t,cancelSignal:s,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:b})])}catch(E){return f.terminationReason??="other",Promise.all([{error:E},_,Promise.all(x.map(ae=>sP(ae))),sP(w),K3(A,R),Promise.allSettled(O),Promise.allSettled(D)])}},Kke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:bp(n,i,r)),Jke=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:o=i})=>oi(o,{checkOpen:!1})&&!ri(o)).map(({type:i,value:o,stream:s=o})=>bp(s,n,e,{isSameDirection:Cn.has(i),stopOnExit:i==="native"}))),Yke=async(t,{signal:e})=>{let[r]=await Wke(t,"error",{signal:e});throw r}});var Q3,vp,Zl,Av=y(()=>{Fl();Q3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),vp=(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}},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 eJ}from"node:stream/promises";var fP,tJ,pP,mP,Ov,Tv,hP=y(()=>{Ev();fP=async t=>{if(t!==void 0)try{await pP(t)}catch{}},tJ=async t=>{if(t!==void 0)try{await mP(t)}catch{}},pP=async t=>{await eJ(t,{cleanup:!0,readable:!1,writable:!0})},mP=async t=>{await eJ(t,{cleanup:!0,readable:!0,writable:!1})},Ov=async(t,e)=>{if(await t,e)throw e},Tv=(t,e,r)=>{r&&!kv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as Xke}from"node:stream";import{callbackify as Qke}from"node:util";var rJ,gP,yP,_P,eEe,bP,vP,nJ,SP=y(()=>{ja();hs();$v();Fl();Av();hP();rJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=gP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=yP(a,s),{read:f,onStdoutDataDone:p}=_P({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Xke({read:f,destroy:Qke(vP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return bP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},gP=(t,e,r)=>{let n=Ll(t,e),i=vp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},yP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:oP},_P=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let o=Di(),s=xv({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){eEe(this,s,o)},onStdoutDataDone:o}},eEe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},bP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await mP(t),await n,await fP(i),await e,r.readable&&r.push(null)}catch(o){await fP(i),nJ(r,o)}},vP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Zl(r,e)&&(nJ(t,n),await Ov(e,n))},nJ=(t,e)=>{Tv(t,t.readable,e)}});import{Writable as tEe}from"node:stream";import{callbackify as iJ}from"node:util";var oJ,wP,xP,rEe,nEe,$P,kP,sJ,EP=y(()=>{hs();Av();hP();oJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=wP(t,r,e),s=new tEe({...xP(n,t,i),destroy:iJ(kP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return $P(n,s),s},wP=(t,e,r)=>{let n=Ab(t,e),i=vp(r,n,"writableFinal"),o=vp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},xP=(t,e,r)=>({write:rEe.bind(void 0,t),final:iJ(nEe.bind(void 0,t,e,r))}),rEe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},nEe=async(t,e,r)=>{await Zl(r,e)&&(t.writable&&t.end(),await e)},$P=async(t,e,r)=>{try{await pP(t),e.writable&&e.end()}catch(n){await tJ(r),sJ(e,n)}},kP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Zl(r,e),await Zl(n,e)&&(sJ(t,i),await Ov(e,i))},sJ=(t,e)=>{Tv(t,t.writable,e)}});import{Duplex as iEe}from"node:stream";import{callbackify as oEe}from"node:util";var aJ,sEe,cJ=y(()=>{ja();SP();EP();aJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:o=!0,preserveNewlines:s=!0}={})=>{let a=o||cn.has(r),{subprocessStdout:c,waitReadableDestroy:l}=gP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=wP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=yP(c,a),{read:g,onStdoutDataDone:b}=_P({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new iEe({read:g,...xP(u,t,d),destroy:oEe(sEe.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 bP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),$P(u,_,c),_},sEe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([vP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),kP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var AP,aEe,lJ=y(()=>{ja();hs();$v();AP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||cn.has(e),s=Ll(t,r),a=xv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return aEe(a,s,t)},aEe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var uJ,dJ=y(()=>{Av();SP();EP();cJ();lJ();uJ=(t,{encoding:e})=>{let r=Q3();t.readable=rJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=oJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=aJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=AP.bind(void 0,t,e),t[Symbol.asyncIterator]=AP.bind(void 0,t,e,{})}});var fJ,cEe,lEe,pJ=y(()=>{fJ=(t,e)=>{for(let[r,n]of lEe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},cEe=(async()=>{})().constructor.prototype,lEe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(cEe,t)])});import{setMaxListeners as uEe}from"node:events";import{spawn as dEe}from"node:child_process";var mJ,fEe,pEe,mEe,hEe,gEe,hJ=y(()=>{Qb();NR();lI();hs();uI();BI();pp();rv();i3();l3();mp();b3();xb();$3();j3();dP();X3();dJ();Fl();pJ();mJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=fEe(t,e,r),{subprocess:f,promise:p}=mEe({file:i,commandArguments:o,options:u,startTime:c,verboseInfo:l,command:s,escapedCommand:a,fileDescriptors:d});return f.pipe=wv.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),fJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},fEe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),{file:a,commandArguments:c,options:l}=Hb(t,e,r),u=pEe(l),d=c3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},pEe=({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}},mEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=dEe(...Bb(t,e,r))}catch(m){return n3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;uEe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_3(c,a,l),x3(c,r,l);let d={},f=Di();c.kill=n9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=H3(c,r),uJ(c,r),e3(c,r);let p=hEe({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}},hEe=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 Y3({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)=>ko(x,e,w)),_=ko(h,e,"all"),S=gEe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Hl(S,n,e)},gEe=({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?fp({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}):tv({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:o,options:a,startTime:u})});var Rv,yEe,_Ee,gJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,yEe(n,t[n],i)]));return{...t,...r}},yEe=(t,e,r)=>_Ee.has(t)&&Tt(e)&&Tt(r)?{...e,...r}:r,_Ee=new Set(["env",...RR])});var _s,bEe,vEe,yJ=y(()=>{bo();kR();_Z();VK();hJ();gJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>bEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},bEe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Tt(o))return i(t,Rv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=vEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?ZK(a,c,l):mJ(a,c,l,i)},vEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=gZ(e)?yZ(e,r):[e,...r],[s,a,c]=nb(...o),l=Rv(Rv(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 _J,bJ,vJ,SEe,wEe,SJ=y(()=>{_J=({file:t,commandArguments:e})=>vJ(t,e),bJ=({file:t,commandArguments:e})=>({...vJ(t,e),isSync:!0}),vJ=(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]=SEe(t);return{file:r,commandArguments:n}},SEe=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(wEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},wEe=/ +/g});var wJ,xJ,xEe,$J,$Ee,kJ,EJ=y(()=>{wJ=(t,e,r)=>{t.sync=e(xEe,r),t.s=t.sync},xJ=({options:t})=>$J(t),xEe=({options:t})=>({...$J(t),isSync:!0}),$J=t=>({options:{...$Ee(t),...t}}),$Ee=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},kJ={preferLocal:!0}});var nft,Ke,ift,oft,sft,aft,cft,lft,uft,dft,zr=y(()=>{yJ();SJ();oI();EJ();BI();nft=_s(()=>({})),Ke=_s(()=>({isSync:!0})),ift=_s(_J),oft=_s(bJ),sft=_s(U9),aft=_s(xJ,{},kJ,wJ),{sendMessage:cft,getOneMessage:lft,getEachMessage:uft,getCancelSignal:dft}=t3()});import{existsSync as Iv,statSync as kEe}from"node:fs";import{dirname as OP,extname as EEe,isAbsolute as AJ,join as TP,relative as RP,resolve as Pv,sep as AEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function OEe(t){return(Iv(TP(t,"build.gradle.kts"))||Iv(TP(t,"build.gradle")))&&Iv(TP(t,"gradle.properties"))}function TEe(t,e){let n=RP(t,e).split(AEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function REe(t,e){let r=Pv(t,e),n=r;Iv(r)?kEe(r).isFile()&&(n=OP(r)):EEe(r)!==""&&(n=OP(r));let i=RP(t,n);if(i.startsWith("..")||AJ(i))return null;let o=n;for(;;){if(OEe(o))return o;if(Pv(o)===Pv(t))return null;let s=OP(o);if(s===o)return null;let a=RP(t,s);if(a.startsWith("..")||AJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=REe(r,o);if(!s){i.push(o);continue}let a=TEe(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 Nv=y(()=>{"use strict"});import{existsSync as PP,readFileSync as IEe}from"node:fs";import{join as Vl}from"node:path";function Wl(t="."){let e=Vl(t,".cladding","config.yaml");if(!PP(e))return IP;try{let n=(0,OJ.parse)(IEe(e,"utf8"))?.gate;if(!n)return IP;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 PEe){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 IP}}function TJ(t="."){let e=Wl(t).testReport,r=e?[e,...CP]:CP;return[...new Set(r.map(n=>Vl(t,n)))]}function RJ(t="."){let e=Wl(t).testReport;if(e){let r=Vl(t,e);return PP(r)?r:null}return CP.map(r=>Vl(t,r)).find(r=>PP(r))??null}function IJ(t,e){let r=[],n=!1;for(let i of t){let o=CEe.exec(i);if(o){n=!0;for(let s of e)r.push(bs(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 OJ,PEe,IP,CP,CEe,Sp=y(()=>{"use strict";OJ=wt(tr(),1);Nv();PEe=["type","lint","test","coverage"],IP={scope:"feature"},CP=["test-report.junit.xml",Vl("coverage","junit.xml"),Vl(".cladding","test-report.junit.xml")];CEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as NP,readFileSync as PJ,readdirSync as DEe,statSync as NEe}from"node:fs";import{join as jv}from"node:path";function FP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(NP(r))try{if(CJ.test(PJ(r,"utf8")))return!0}catch{}}return!1}function DJ(t){try{return NP(t)&&CJ.test(PJ(t,"utf8"))}catch{return!1}}function NJ(t,e=0){if(e>4||!NP(t))return!1;let r;try{r=DEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=NEe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(NJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&DJ(i))return!0}return!1}function FEe(t){if(FP(t))return!0;for(let e of jEe)if(DJ(jv(t,e)))return!0;for(let e of MEe)if(NJ(jv(t,e)))return!0;return!1}function jJ(t="."){let e=Wl(t).coverage;return e||(FEe(t)?"kover":"jacoco")}function MJ(t="."){return jP[jJ(t)]}function FJ(t="."){return DP[jJ(t)]}var jP,DP,MP,CJ,jEe,MEe,Mv=y(()=>{"use strict";Sp();jP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},DP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},MP=[DP.kover,DP.jacoco],CJ=/kover/i;jEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],MEe=["buildSrc","build-logic"]});import{existsSync as xp,readFileSync as zP,readdirSync as zJ,statSync as LEe}from"node:fs";import{dirname as zEe,join as kr,resolve as UEe}from"node:path";import Kl from"node:process";function UP(t){return xp(kr(t,"gradlew"))?"./gradlew":"gradle"}function qEe(t){let e=UP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[MJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function HEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(zP(kr(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 GEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function WEe(t,e){for(let r of e)if(xp(kr(t,r)))return r}function KEe(t,e){try{return zJ(t).find(n=>n.endsWith(e))}catch{return}}function QEe(t){let e=[],r=Kl.platform==="win32";r||e.push(kr("/etc","madge","config"),kr("/etc","madgerc"));let n=r?Kl.env.USERPROFILE:Kl.env.HOME;n&&e.push(kr(n,".config","madge","config"),kr(n,".config","madge"),kr(n,".madge","config"),kr(n,".madgerc"));for(let o=UEe(t);;){e.push(kr(o,".madgerc"));let s=zEe(o);if(s===o)break;o=s}let i=Kl.env.MADGE_config??Kl.env.madge_config;return i&&e.push(i),e}function eAe(){for(let[t,e]of Object.entries(Kl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function UJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function rAe(t){try{return LEe(t).isFile()}catch{return!1}}function nAe(t){let e;try{e=zP(t,"utf8")}catch{return!0}try{return UJ(JSON.parse(e).excludeRegExp)}catch{return tAe.test(e)}}function iAe(t,e){let r=e.madge;return r&&typeof r=="object"&&UJ(r.excludeRegExp)||eAe()?!0:QEe(t).some(n=>rAe(n)&&nAe(n))}function oAe(t){try{return JSON.parse(zP(kr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function wp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function LJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function sAe(t,e,r){if(iAe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",XEe),{...e,args:n}}function aAe(t,e,r){if(wp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of JEe)if(n.configs.some(i=>xp(kr(t,i))))return n.gate;if(YEe.some(n=>xp(kr(t,n)))||r.eslintConfig!==void 0)return e}function lAe(t,e){return cAe.some(r=>xp(kr(t,r)))?!0:e.jest!==void 0}function uAe(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 LP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function dAe(t,e){let r=oAe(t),n=e.lint?aAe(t,e.lint,r):void 0,i=e.arch?{...e,arch:sAe(t,e.arch,r)}:e,o=n?{...i,lint:n}:LP(i,"lint"),s=wp(r,"test"),a=s?uAe(s):void 0;return s&&!a?(o=LP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...wp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&lAe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!wp(r,"coverage")&&!LJ(r,"@vitest/coverage-v8")&&!LJ(r,"@vitest/coverage-istanbul")?o=LP(o,"coverage"):a==="vitest"&&wp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function _t(t="."){for(let e of ZEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=KEe(t,o):r=WEe(t,[o]),r)break;if(!r||e.requiresSource&&!GEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?dAe(t,n):n;return{language:e.language,manifest:r,gates:i}}return VEe}var Fi,BEe,ZEe,VEe,JEe,YEe,XEe,tAe,cAe,Dn=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];BEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);ZEe=[{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:qEe},{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:HEe}],VEe={language:"unknown",manifest:"",gates:{}};JEe=[{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"]}}],YEe=["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"],XEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";tAe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;cAe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as fAe,readFileSync as pAe}from"node:fs";import{join as mAe}from"node:path";function Ba(t){return t.code==="ENOENT"}function Fv(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 qJ.test(o)||qJ.test(s)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function Nt(t,e,r,n=[]){if(Ba(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`,skipReason:"tool-missing"};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",skipReason:"tool-missing"}:null}function Xt(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 Jl(t,e){let r=mAe(t,"package.json");if(!fAe(r))return!1;try{return!!JSON.parse(pAe(r,"utf8")).scripts?.[e]}catch{return!1}}var qJ,Nn=y(()=>{"use strict";qJ=/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 hAe(t){let{cwd:e="."}=t,r=_t(e),n=r.gates.arch;if(!n)return[{detector:Lv,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Ke(n.cmd,[...n.args],{cwd:e,reject:!1});return Ba(i)?[{detector:Lv,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:Fv(i,Lv,o=>`${n.cmd} reported architecture violations: ${o}`,o=>`${n.cmd} could not validate (config/setup gap, not a violation): ${o}`)}var Lv,Ga,zv=y(()=>{"use strict";zr();Dn();Nn();Lv="ARCHITECTURE_VIOLATION";Ga={name:Lv,subprocess:!0,run:hAe}});function gAe(t){let{cwd:e="."}=t,r=_t(e),n=r.gates.secret;if(!n)return[{detector:Uv,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Ke(n.cmd,[...n.args],{cwd:e,reject:!1});return Ba(i)?[{detector:Uv,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:Fv(i,Uv,o=>`${n.cmd} reported secrets: ${o}`,o=>`${n.cmd} could not scan (config/setup gap, not a secret): ${o}`)}var Uv,Za,qv=y(()=>{"use strict";zr();Dn();Nn();Uv="HARDCODED_SECRET";Za={name:Uv,subprocess:!0,run:gAe}});import{existsSync as qP,readdirSync as HJ}from"node:fs";import{join as Hv}from"node:path";function _Ae(t,e){let r=Hv(t,e.path);if(!qP(r))return!0;if(e.isDirectory)try{return HJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function bAe(t){let{cwd:e="."}=t,r=[];for(let i of yAe)_Ae(e,i)&&r.push({detector:$p,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=Hv(e,"spec.yaml");if(qP(n)){let i=wAe(n),o=i?null:vAe(e);if(i)r.push({detector:$p,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:$p,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=SAe(e);s&&r.push({detector:$p,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 vAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!qP(r))continue;let n;try{n=HJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort())try{Ri(Hv(r,i))}catch(o){return{path:`${e}/${i}`,reason:o.message}}}return null}function SAe(t){try{return q(t),null}catch(e){return e.message}}function wAe(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 $p,yAe,BJ,GJ=y(()=>{"use strict";Ue();V_();$p="ABSENCE_OF_GOVERNANCE",yAe=[{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}];BJ={name:$p,run:bAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function HP(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=Bv(r)==="while",o=$Ae.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 '${Bv(r)}'`}let n=xAe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:Bv(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${Bv(r)}'`:null}function kAe(t,e){let r=HP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function ZJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...kAe(r,n));return e}var xAe,$Ae,BP=y(()=>{"use strict";xAe={event:"when",state:"while",optional:"where",unwanted:"if"},$Ae=/\bwhen\b/i});function ye(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 xt=y(()=>{"use strict";Ue()});function EAe(t){let{cwd:e="."}=t;return ye(e,Gv,AAe)}function AAe(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:Gv,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 ZJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,VJ,WJ=y(()=>{"use strict";BP();xt();Gv="AC_DRIFT";VJ={name:Gv,run:EAe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||_t(t).language;return JJ[n]??KJ}var OAe,TAe,RAe,KJ,IAe,PAe,JJ,CAe,YJ,Va=y(()=>{"use strict";Dn();OAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,TAe=/^[ \t]*import\s+([\w.]+)/gm,RAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,KJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:OAe,importStyle:"relative"},IAe={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:TAe,importStyle:"dotted"},PAe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:RAe,importStyle:"dotted"},JJ={typescript:KJ,kotlin:IAe,python:PAe},CAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],YJ=new Set([...Object.values(JJ).flatMap(t=>t?.extensions??[]),...CAe].map(t=>t.toLowerCase()))});import{existsSync as DAe,readFileSync as NAe,readdirSync as jAe,statSync as MAe}from"node:fs";import{join as QJ,relative as XJ}from"node:path";function FAe(t,e){if(!DAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=jAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=QJ(i,s),c;try{c=MAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function LAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function UAe(t){return zAe.test(t)}function qAe(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=>FAe(QJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=NAe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Va();e8="AI_HINTS_FORBIDDEN_PATTERN";zAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;t8={name:e8,run:qAe}});function HAe(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:n8,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var n8,i8,o8=y(()=>{"use strict";Ue();n8="AC_DUPLICATE_WITHIN_FEATURE";i8={name:n8,run:HAe}});import{createRequire as BAe}from"module";import{basename as GAe,dirname as ZP,normalize as ZAe,relative as VAe,resolve as WAe,sep as c8}from"path";import*as KAe from"fs";function JAe(t){let e=ZAe(t);return e.length>1&&e[e.length-1]===c8&&(e=e.substring(0,e.length-1)),e}function l8(t,e){return t.replace(YAe,e)}function QAe(t){return t==="/"||XAe.test(t)}function GP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=WAe(t)),(n||o)&&(t=JAe(t)),t===".")return"";let s=t[t.length-1]!==i;return l8(s?t+i:t,i)}function u8(t,e){return e+t}function eOe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:l8(VAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function tOe(t){return t}function rOe(t,e,r){return e+t+r}function nOe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?eOe(t,e):n?u8:tOe}function iOe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function oOe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function lOe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?oOe(t):iOe(t):n&&n.length?aOe:sOe:cOe}function hOe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?mOe:r&&r.length?n?uOe:dOe:n?fOe:pOe}function _Oe(t){return t.group?yOe:gOe}function SOe(t){return t.group?bOe:vOe}function $Oe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?xOe:wOe}function d8(t,e,r){if(r.options.useRealPaths)return kOe(e,r);let n=ZP(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=ZP(n)}return r.symlinks.set(t,e),i>1}function kOe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function DOe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?EOe:ROe:n?e?AOe:COe:i?e?TOe:POe:e?OOe:IOe}function MOe(t){return t?jOe:NOe}function UOe(t,e){return new Promise((r,n)=>{m8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function m8(t,e,r){new p8(t,e,r).start()}function qOe(t,e){return new p8(t,e).start()}var s8,YAe,XAe,sOe,aOe,cOe,uOe,dOe,fOe,pOe,mOe,gOe,yOe,bOe,vOe,wOe,xOe,EOe,AOe,OOe,TOe,ROe,IOe,POe,COe,f8,NOe,jOe,FOe,LOe,zOe,p8,a8,h8,g8,y8=y(()=>{s8=BAe(import.meta.url);YAe=/[\\/]/g;XAe=/^[a-z]:[\\/]$/i;sOe=(t,e)=>{e.push(t||".")},aOe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},cOe=()=>{};uOe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},dOe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},fOe=(t,e,r,n)=>{r.files++},pOe=(t,e)=>{e.push(t)},mOe=()=>{};gOe=t=>t,yOe=()=>[""].slice(0,0);bOe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},vOe=()=>{};wOe=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()&&d8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},xOe=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()&&d8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};EOe=t=>t.counts,AOe=t=>t.groups,OOe=t=>t.paths,TOe=t=>t.paths.slice(0,t.options.maxFiles),ROe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),IOe=(t,e,r)=>(Zv(e,r,t.paths,t.options.suppressErrors),null),POe=(t,e,r)=>(Zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),COe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);f8={withFileTypes:!0},NOe=(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||".",f8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},jOe=(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||".",f8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};FOe=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))}},LOe=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}},zOe=class{aborted=!1;abort(){this.aborted=!0}},p8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=DOe(e,this.isSynchronous),this.root=GP(t,e),this.state={root:QAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new LOe,options:e,queue:new FOe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new zOe,fs:e.fs||KAe},this.joinPath=nOe(this.root,e),this.pushDirectory=lOe(this.root,e),this.pushFile=hOe(e),this.getArray=_Oe(e),this.groupFiles=SOe(e),this.resolveSymlink=$Oe(e,this.isSynchronous),this.walkDirectory=MOe(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(_=GP(_,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=GAe(_),x=GP(ZP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};a8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return UOe(this.root,this.options)}withCallback(t){m8(this.root,this.options,t)}sync(){return qOe(this.root,this.options)}},h8=null;try{s8.resolve("picomatch"),h8=s8("picomatch")}catch{}g8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:c8,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 a8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new a8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||h8;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 kp=v((hpt,w8)=>{"use strict";var _8="[^\\\\/]",HOe="(?=.)",b8="[^/]",VP="(?:\\/|$)",v8="(?:^|\\/)",WP=`\\.{1,2}${VP}`,BOe="(?!\\.)",GOe=`(?!${v8}${WP})`,ZOe=`(?!\\.{0,1}${VP})`,VOe=`(?!${WP})`,WOe="[^.\\/]",KOe=`${b8}*?`,JOe="/",S8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:HOe,QMARK:b8,END_ANCHOR:VP,DOTS_SLASH:WP,NO_DOT:BOe,NO_DOTS:GOe,NO_DOT_SLASH:ZOe,NO_DOTS_SLASH:VOe,QMARK_NO_DOT:WOe,STAR:KOe,START_ANCHOR:v8,SEP:JOe},YOe={...S8,SLASH_LITERAL:"[\\\\/]",QMARK:_8,STAR:`${_8}*?`,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:"\\"},XOe={__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"};w8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:XOe,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?YOe:S8}}});var Ep=v(Ur=>{"use strict";var{REGEX_BACKSLASH:QOe,REGEX_REMOVE_BACKSLASH:eTe,REGEX_SPECIAL_CHARS:tTe,REGEX_SPECIAL_CHARS_GLOBAL:rTe}=kp();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>tTe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(rTe,"\\$1");Ur.toPosixSlashes=t=>t.replace(QOe,"/");Ur.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};Ur.removeBackslashes=t=>t.replace(eTe,e=>e==="\\"?"":e);Ur.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ur.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ur.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ur.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",o=`${n}(?:${t})${i}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o};Ur.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var R8=v((ypt,T8)=>{"use strict";var x8=Ep(),{CHAR_ASTERISK:KP,CHAR_AT:nTe,CHAR_BACKWARD_SLASH:Ap,CHAR_COMMA:iTe,CHAR_DOT:JP,CHAR_EXCLAMATION_MARK:YP,CHAR_FORWARD_SLASH:O8,CHAR_LEFT_CURLY_BRACE:XP,CHAR_LEFT_PARENTHESES:QP,CHAR_LEFT_SQUARE_BRACKET:oTe,CHAR_PLUS:sTe,CHAR_QUESTION_MARK:$8,CHAR_RIGHT_CURLY_BRACE:aTe,CHAR_RIGHT_PARENTHESES:k8,CHAR_RIGHT_SQUARE_BRACKET:cTe}=kp(),E8=t=>t===O8||t===Ap,A8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},lTe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,o=[],s=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,m=!1,h=!1,g=!1,b=!1,_=!1,S=!1,x=!1,w=!1,R=0,A,O,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,ae=()=>c.charCodeAt(l+1),X=()=>(A=O,c.charCodeAt(++l));for(;l0&&(P=c.slice(0,u),c=c.slice(u),d-=u),J&&m===!0&&d>0?(J=c.slice(0,d),C=c.slice(d)):m===!0?(J="",C=c):J=c,J&&J!==""&&J!=="/"&&J!==c&&E8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=x8.removeBackslashes(C)),J&&_===!0&&(J=x8.removeBackslashes(J)));let dr={prefix:P,input:t,start:u,base:J,glob:C,isBrace:f,isBracket:p,isGlob:m,isExtglob:h,isGlobstar:g,negated:S,negatedExtglob:x};if(r.tokens===!0&&(dr.maxDepth=0,E8(O)||s.push(D),dr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var Op=kp(),ln=Ep(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:uTe,REGEX_NON_SPECIAL_CHARS:dTe,REGEX_SPECIAL_CHARS_BACKREF:fTe,REPLACEMENTS:I8}=Op,pTe=(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},Yl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,P8=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},mTe=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},tC=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(mTe(e))return e.replace(/\\(.)/g,"$1")},hTe=t=>{let e=t.map(tC).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}}}}},gTe=t=>`${t.length===1?ln.escapeRegex(t[0]):`[${t.map(r=>ln.escapeRegex(r)).join("")}]`}*`,yTe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=tC(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},_Te=t=>{let e=0,r=t.trim(),n=eC(r);for(;n;)e++,r=n.body.trim(),n=eC(r);return e},bTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Op.DEFAULT_MAX_EXTGLOB_RECURSION,n=P8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||hTe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=yTe(a);if(c){o=!0,i.push(...c);continue}let l=tC(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,_Te(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:gTe([...new Set(i)])}:{risky:!0}:{risky:!1}},rC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=I8[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(Vv,r.maxLength):Vv,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=Op.globChars(r.windows),l=Op.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:f,ONE_CHAR:p,DOTS_SLASH:m,NO_DOT:h,NO_DOT_SLASH:g,NO_DOTS_SLASH:b,QMARK:_,QMARK_NO_DOT:S,STAR:x,START_ANCHOR:w}=c,R=G=>`(${a}(?:(?!${w}${G.dot?m:u}).)*?)`,A=r.dot?"":h,O=r.dot?_:S,D=r.bash===!0?R(r):x;r.capture&&(D=`(${D})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let E={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};t=ln.removePrefix(t,E),i=t.length;let ae=[],X=[],J=[],P=o,C,dr=()=>E.index===i-1,se=E.peek=(G=1)=>t[E.index+G],Ce=E.advance=()=>t[++E.index]||"",Kt=()=>t.slice(E.index+1),fr=(G="",ht=0)=>{E.consumed+=G,E.index+=ht},Qt=G=>{E.output+=G.output!=null?G.output:G.value,fr(G.value)},fo=()=>{let G=1;for(;se()==="!"&&(se(2)!=="("||se(3)==="?");)Ce(),E.start++,G++;return G%2===0?!1:(E.negated=!0,E.start++,!0)},ki=G=>{E[G]++,J.push(G)},tn=G=>{E[G]--,J.pop()},fe=G=>{if(P.type==="globstar"){let ht=E.braces>0&&(G.type==="comma"||G.type==="brace"),B=G.extglob===!0||ae.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!ht&&!B&&(E.output=E.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=D,E.output+=P.output)}if(ae.length&&G.type!=="paren"&&(ae[ae.length-1].inner+=G.value),(G.value||G.output)&&Qt(G),P&&P.type==="text"&&G.type==="text"){P.output=(P.output||P.value)+G.value,P.value+=G.value;return}G.prev=P,s.push(G),P=G},po=(G,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=P,B.parens=E.parens,B.output=E.output,B.startIndex=E.index,B.tokensIndex=s.length;let Te=(r.capture?"(":"")+B.open;ki("parens"),fe({type:G,value:ht,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Te}),ae.push(B)},Nfe=G=>{let ht=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Te=bTe(B,r);if((G.type==="plus"||G.type==="star")&&Te.risky){let ut=Te.safeOutput?(G.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,Ei=s[G.tokensIndex];Ei.type="text",Ei.value=ht,Ei.output=ut||ln.escapeRegex(ht);for(let Ai=G.tokensIndex+1;Ai1&&G.inner.includes("/")&&(ut=R(r)),(ut!==D||dr()||/^\)+$/.test(Kt()))&&(dt=G.close=`)$))${ut}`),G.inner.includes("*")&&(zt=Kt())&&/^\.[^\\/.]+$/.test(zt)){let Ei=rC(zt,{...e,fastpaths:!1}).output;dt=G.close=`)${Ei})${ut})`}G.prev.type==="bos"&&(E.negatedExtglob=!0)}fe({type:"paren",extglob:!0,value:C,output:dt}),tn("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,ht=t.replace(fTe,(B,Te,dt,zt,ut,Ei)=>zt==="\\"?(G=!0,B):zt==="?"?Te?Te+zt+(ut?_.repeat(ut.length):""):Ei===0?O+(ut?_.repeat(ut.length):""):_.repeat(dt.length):zt==="."?u.repeat(dt.length):zt==="*"?Te?Te+zt+(ut?D:""):D:Te?B:`\\${B}`);return G===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?(E.output=t,E):(E.output=ln.wrapOutput(ht,E,e),E)}for(;!dr();){if(C=Ce(),C==="\0")continue;if(C==="\\"){let B=se();if(B==="/"&&r.bash!==!0||B==="."||B===";")continue;if(!B){C+="\\",fe({type:"text",value:C});continue}let Te=/^\\+/.exec(Kt()),dt=0;if(Te&&Te[0].length>2&&(dt=Te[0].length,E.index+=dt,dt%2!==0&&(C+="\\")),r.unescape===!0?C=Ce():C+=Ce(),E.brackets===0){fe({type:"text",value:C});continue}}if(E.brackets>0&&(C!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&C===":"){let B=P.value.slice(1);if(B.includes("[")&&(P.posix=!0,B.includes(":"))){let Te=P.value.lastIndexOf("["),dt=P.value.slice(0,Te),zt=P.value.slice(Te+2),ut=uTe[zt];if(ut){P.value=dt+ut,E.backtrack=!0,Ce(),!o.output&&s.indexOf(P)===1&&(o.output=p);continue}}}(C==="["&&se()!==":"||C==="-"&&se()==="]")&&(C=`\\${C}`),C==="]"&&(P.value==="["||P.value==="[^")&&(C=`\\${C}`),r.posix===!0&&C==="!"&&P.value==="["&&(C="^"),P.value+=C,Qt({value:C});continue}if(E.quotes===1&&C!=='"'){C=ln.escapeRegex(C),P.value+=C,Qt({value:C});continue}if(C==='"'){E.quotes=E.quotes===1?0:1,r.keepQuotes===!0&&fe({type:"text",value:C});continue}if(C==="("){ki("parens"),fe({type:"paren",value:C});continue}if(C===")"){if(E.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Yl("opening","("));let B=ae[ae.length-1];if(B&&E.parens===B.parens+1){Nfe(ae.pop());continue}fe({type:"paren",value:C,output:E.parens?")":"\\)"}),tn("parens");continue}if(C==="["){if(r.nobracket===!0||!Kt().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Yl("closing","]"));C=`\\${C}`}else ki("brackets");fe({type:"bracket",value:C});continue}if(C==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){fe({type:"text",value:C,output:`\\${C}`});continue}if(E.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Yl("opening","["));fe({type:"text",value:C,output:`\\${C}`});continue}tn("brackets");let B=P.value.slice(1);if(P.posix!==!0&&B[0]==="^"&&!B.includes("/")&&(C=`/${C}`),P.value+=C,Qt({value:C}),r.literalBrackets===!1||ln.hasRegexChars(B))continue;let Te=ln.escapeRegex(P.value);if(E.output=E.output.slice(0,-P.value.length),r.literalBrackets===!0){E.output+=Te,P.value=Te;continue}P.value=`(${a}${Te}|${P.value})`,E.output+=P.value;continue}if(C==="{"&&r.nobrace!==!0){ki("braces");let B={type:"brace",value:C,output:"(",outputIndex:E.output.length,tokensIndex:E.tokens.length};X.push(B),fe(B);continue}if(C==="}"){let B=X[X.length-1];if(r.nobrace===!0||!B){fe({type:"text",value:C,output:C});continue}let Te=")";if(B.dots===!0){let dt=s.slice(),zt=[];for(let ut=dt.length-1;ut>=0&&(s.pop(),dt[ut].type!=="brace");ut--)dt[ut].type!=="dots"&&zt.unshift(dt[ut].value);Te=pTe(zt,r),E.backtrack=!0}if(B.comma!==!0&&B.dots!==!0){let dt=E.output.slice(0,B.outputIndex),zt=E.tokens.slice(B.tokensIndex);B.value=B.output="\\{",C=Te="\\}",E.output=dt;for(let ut of zt)E.output+=ut.output||ut.value}fe({type:"brace",value:C,output:Te}),tn("braces"),X.pop();continue}if(C==="|"){ae.length>0&&ae[ae.length-1].conditions++,fe({type:"text",value:C});continue}if(C===","){let B=C,Te=X[X.length-1];Te&&J[J.length-1]==="braces"&&(Te.comma=!0,B="|"),fe({type:"comma",value:C,output:B});continue}if(C==="/"){if(P.type==="dot"&&E.index===E.start+1){E.start=E.index+1,E.consumed="",E.output="",s.pop(),P=o;continue}fe({type:"slash",value:C,output:f});continue}if(C==="."){if(E.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let B=X[X.length-1];P.type="dots",P.output+=C,P.value+=C,B.dots=!0;continue}if(E.braces+E.parens===0&&P.type!=="bos"&&P.type!=="slash"){fe({type:"text",value:C,output:u});continue}fe({type:"dot",value:C,output:u});continue}if(C==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&se()==="("&&se(2)!=="?"){po("qmark",C);continue}if(P&&P.type==="paren"){let Te=se(),dt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\w+>)/.test(Kt()))&&(dt=`\\${C}`),fe({type:"text",value:C,output:dt});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){fe({type:"qmark",value:C,output:S});continue}fe({type:"qmark",value:C,output:_});continue}if(C==="!"){if(r.noextglob!==!0&&se()==="("&&(se(2)!=="?"||!/[!=<:]/.test(se(3)))){po("negate",C);continue}if(r.nonegate!==!0&&E.index===0){fo();continue}}if(C==="+"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){po("plus",C);continue}if(P&&P.value==="("||r.regex===!1){fe({type:"plus",value:C,output:d});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||E.parens>0){fe({type:"plus",value:C});continue}fe({type:"plus",value:d});continue}if(C==="@"){if(r.noextglob!==!0&&se()==="("&&se(2)!=="?"){fe({type:"at",extglob:!0,value:C,output:""});continue}fe({type:"text",value:C});continue}if(C!=="*"){(C==="$"||C==="^")&&(C=`\\${C}`);let B=dTe.exec(Kt());B&&(C+=B[0],E.index+=B[0].length),fe({type:"text",value:C});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=C,P.output=D,E.backtrack=!0,E.globstar=!0,fr(C);continue}let G=Kt();if(r.noextglob!==!0&&/^\([^?]/.test(G)){po("star",C);continue}if(P.type==="star"){if(r.noglobstar===!0){fr(C);continue}let B=P.prev,Te=B.prev,dt=B.type==="slash"||B.type==="bos",zt=Te&&(Te.type==="star"||Te.type==="globstar");if(r.bash===!0&&(!dt||G[0]&&G[0]!=="/")){fe({type:"star",value:C,output:""});continue}let ut=E.braces>0&&(B.type==="comma"||B.type==="brace"),Ei=ae.length&&(B.type==="pipe"||B.type==="paren");if(!dt&&B.type!=="paren"&&!ut&&!Ei){fe({type:"star",value:C,output:""});continue}for(;G.slice(0,3)==="/**";){let Ai=t[E.index+4];if(Ai&&Ai!=="/")break;G=G.slice(3),fr("/**",3)}if(B.type==="bos"&&dr()){P.type="globstar",P.value+=C,P.output=R(r),E.output=P.output,E.globstar=!0,fr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&!zt&&dr()){E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=R(r)+(r.strictSlashes?")":"|$)"),P.value+=C,E.globstar=!0,E.output+=B.output+P.output,fr(C);continue}if(B.type==="slash"&&B.prev.type!=="bos"&&G[0]==="/"){let Ai=G[1]!==void 0?"|$":"";E.output=E.output.slice(0,-(B.output+P.output).length),B.output=`(?:${B.output}`,P.type="globstar",P.output=`${R(r)}${f}|${f}${Ai})`,P.value+=C,E.output+=B.output+P.output,E.globstar=!0,fr(C+Ce()),fe({type:"slash",value:"/",output:""});continue}if(B.type==="bos"&&G[0]==="/"){P.type="globstar",P.value+=C,P.output=`(?:^|${f}|${R(r)}${f})`,E.output=P.output,E.globstar=!0,fr(C+Ce()),fe({type:"slash",value:"/",output:""});continue}E.output=E.output.slice(0,-P.output.length),P.type="globstar",P.output=R(r),P.value+=C,E.output+=P.output,E.globstar=!0,fr(C);continue}let ht={type:"star",value:C,output:D};if(r.bash===!0){ht.output=".*?",(P.type==="bos"||P.type==="slash")&&(ht.output=A+ht.output),fe(ht);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ht.output=C,fe(ht);continue}(E.index===E.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(E.output+=g,P.output+=g):r.dot===!0?(E.output+=b,P.output+=b):(E.output+=A,P.output+=A),se()!=="*"&&(E.output+=p,P.output+=p)),fe(ht)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing","]"));E.output=ln.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing",")"));E.output=ln.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing","}"));E.output=ln.escapeLast(E.output,"{"),tn("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&fe({type:"maybe_slash",value:"",output:`${f}?`}),E.backtrack===!0){E.output="";for(let G of E.tokens)E.output+=G.output!=null?G.output:G.value,G.suffix&&(E.output+=G.suffix)}return E};rC.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(Vv,r.maxLength):Vv,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=I8[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}=Op.globChars(r.windows),m=r.dot?u:l,h=r.dot?d:l,g=r.capture?"":"?:",b={negated:!1,prefix:""},_=r.bash===!0?".*?":f;r.capture&&(_=`(${_})`);let S=A=>A.noglobstar===!0?_:`(${g}(?:(?!${p}${A.dot?c:o}).)*?)`,x=A=>{switch(A){case"*":return`${m}${a}${_}`;case".*":return`${o}${a}${_}`;case"*.*":return`${m}${_}${o}${a}${_}`;case"*/*":return`${m}${_}${s}${a}${h}${_}`;case"**":return m+S(r);case"**/*":return`(?:${m}${S(r)}${s})?${h}${a}${_}`;case"**/*.*":return`(?:${m}${S(r)}${s})?${h}${_}${o}${a}${_}`;case"**/.*":return`(?:${m}${S(r)}${s})?${o}${a}${_}`;default:{let O=/^(.*?)\.(\w+)$/.exec(A);if(!O)return;let D=x(O[1]);return D?D+o+O[2]:void 0}}},w=ln.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};C8.exports=rC});var M8=v((bpt,j8)=>{"use strict";var vTe=R8(),nC=D8(),N8=Ep(),STe=kp(),wTe=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=wTe(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?N8.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,n=r&&r.windows)=>(e instanceof RegExp?e:Rt.makeRe(e,r)).test(N8.basename(t,{windows:n}));Rt.isMatch=(t,e,r)=>Rt(e,r)(t);Rt.parse=(t,e)=>Array.isArray(t)?t.map(r=>Rt.parse(r,e)):nC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>vTe(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=nC.fastpaths(t,e)),i.output||(i=nC(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=STe;j8.exports=Rt});var U8=v((vpt,z8)=>{"use strict";var F8=M8(),xTe=Ep();function L8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:xTe.isWindows()}),F8(t,e,r)}Object.assign(L8,F8);z8.exports=L8});import{readdir as $Te,readdirSync as kTe,realpath as ETe,realpathSync as ATe,stat as OTe,statSync as TTe}from"fs";import{isAbsolute as RTe,posix as Wa,resolve as ITe}from"path";import{fileURLToPath as PTe}from"url";function jTe(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]===".."&&NTe.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=>Wa.relative(t,n)||".":n=>Wa.relative(t,`${e}/${n}`)||"."}function LTe(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Wa.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function H8(t){return t.replace(DTe,e=>`${e}/`)}function V8(t){var e;let r=Xl.default.scan(t,zTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function ZTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Xl.default.scan(t);return r.isGlob||r.negated}function Tp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function W8(t){return typeof t=="string"?[t]:t??[]}function iC(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=GTe(o);s=RTe(s.replace(WTe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=VTe.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=H8(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?Wa.join(o,...d):o)}return s}function KTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(iC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(iC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(iC(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function JTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=KTe(t,e,n);t.debug&&Tp("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(G8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Xl.default)(i.match,f),m=(0,Xl.default)(i.ignore,f),h=jTe(i.match,f),g=q8(r,d,o),b=o?g:q8(r,d,!0),_=(w,R)=>{let A=b(R,!0);return A!=="."&&!h(A)||m(A)},S;t.deep!==void 0&&(S=Math.round(t.deep-n.depthOffset));let x=new g8({filters:[a?(w,R)=>{let A=g(w,R),O=p(A)&&!m(A);return O&&Tp(`matched ${A}`),O}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return Tp(`${A?"skipped":"crawling"} ${R}`),A}:_,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:S,signal:t.signal}).crawl(d);return t.debug&&Tp("internal properties:",{...n,root:d}),[x,r!==d&&!o&<e(r,d)]}function YTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function XTe(t){let e=Object.assign({},t);for(let r in B8)e[r]===void 0&&Object.assign(e,{[r]:B8[r]});return e.cwd=(e.cwd instanceof URL?PTe(e.cwd):ITe(e.cwd||process.cwd())).replace(G8,"/"),e.ignore=W8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||$Te,readdirSync:e.fs.readdirSync||kTe,realpath:e.fs.realpath||ETe,realpathSync:e.fs.realpathSync||ATe,stat:e.fs.stat||OTe,statSync:e.fs.statSync||TTe}),e.debug&&Tp("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=CTe(t)||typeof t=="string",i=W8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=XTe(n?e:t);return i.length>0?JTe(o,i):[]}function vs(t,e){let[r,n]=QTe(t,e);return r?YTe(r.sync(),n):[]}var Xl,CTe,G8,DTe,Z8,NTe,MTe,FTe,zTe,UTe,qTe,HTe,BTe,GTe,VTe,WTe,B8,Rp=y(()=>{y8();Xl=wt(U8(),1),CTe=Array.isArray,G8=/\\/g,DTe=/^[A-Za-z]:$/,Z8=process.platform==="win32",NTe=/^(\/?\.\.)+$/;MTe=/^[A-Z]:\/$/i,FTe=Z8?t=>MTe.test(t):t=>t==="/";zTe={parts:!0};UTe=/(?t.replace(UTe,"\\$&"),BTe=t=>t.replace(qTe,"\\$&"),GTe=Z8?BTe:HTe;VTe=/^(\/?\.\.)+/,WTe=/\\(?=[()[\]{}!*+?@|])/g;B8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Ip,readFileSync as eRe,readdirSync as tRe,statSync as K8}from"node:fs";import{join as Ka}from"node:path";function rRe(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}=oC(r);return(s.size>0||a.length>0)&&!Ip(Ka(e,i.mainRoot))?[{detector:Pp,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&&(nRe(e,i,s,o),iRe(e,i,s,o)),a.length>0&&oRe(e,i,a,o),o)}function oC(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 nRe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Ip(o))for(let s of tRe(o)){let a=Ka(o,s);K8(a).isDirectory()&&(r.has(s)||n.push({detector:Pp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function iRe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Ip(o))for(let s of r){let a=Ka(o,s);Ip(a)&&K8(a).isDirectory()||n.push({detector:Pp,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 oRe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Ip(a))continue;let c=vs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ka(a,l),d;try{d=eRe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];sRe(p,s.to,e.importStyle)&&n.push({detector:Pp,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 sRe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Pp,J8,sC=y(()=>{"use strict";Rp();Ue();Va();Pp="ARCHITECTURE_FROM_SPEC";J8={name:Pp,run:rRe}});import{existsSync as aRe,readFileSync as cRe}from"node:fs";import{join as lRe}from"node:path";function dRe(t){let{cwd:e="."}=t,r=lRe(e,"spec/capabilities.yaml");if(!aRe(r))return[];let n;try{let u=cRe(r,"utf8"),d=Y8.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";Y8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",uRe=8;X8={name:Wv,run:dRe}});import{existsSync as fRe,readFileSync as pRe}from"node:fs";import{join as mRe}from"node:path";function hRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function gRe(t){let{cwd:e="."}=t;return ye(e,aC,r=>yRe(r,e))}function yRe(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=mRe(e,o);if(!fRe(s))continue;let a=pRe(s,"utf8");hRe(a)||n.push({detector:aC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var aC,e5,t5=y(()=>{"use strict";Va();xt();aC="CONVENTION_DRIFT";e5={name:aC,run:gRe}});import{existsSync as cC,readFileSync as r5}from"node:fs";import{join as Kv}from"node:path";function _Re(t){return JSON.parse(t).total?.lines?.pct??0}function n5(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function SRe(t,e){if(!Cv(_t(t).gates.coverage?.cmd))return null;let r;try{r=Dv(t,e)}catch(c){return[{detector:Eo,severity:"error",message:c.message}]}let n=0,i=0,o=0,s=[];for(let c of r){let l=MP.find(d=>cC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=n5(r5(Kv(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,o++)}if(o===0)return[{detector:Eo,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=i5(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function wRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=SRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=_t(e).language==="kotlin"?MP.find(a=>cC(Kv(e,a)))??FJ(e):n.coverageSummary,o=Kv(e,i);if(!cC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=r5(o,"utf8");s=n.coverageFormat==="jacoco-xml"?bRe(a):n.coverageFormat==="cobertura-xml"?vRe(a):_Re(a)}catch(a){return[{detector:Eo,severity:"warn",message:`${i} unparseable: ${a.message}`}]}return s===null?n.coverageFormat==="cobertura-xml"?[]:[{detector:Eo,severity:"warn",message:`${i} contained no line-coverage counter`}]:s>=Jv?[]:[{detector:Eo,severity:"warn",message:`line coverage ${s.toFixed(1)}% < floor ${Jv}%`}]}var Eo,Jv,o5,s5=y(()=>{"use strict";Ue();Mv();Va();Nv();Dn();Eo="COVERAGE_DROP",Jv=70;o5={name:Eo,run:wRe}});import{existsSync as xRe}from"node:fs";import{join as $Re}from"node:path";function ERe(t){let{cwd:e="."}=t;return ye(e,Yv,r=>ARe(r,e))}function ARe(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";xt();Yv="DELIVERABLE_INTEGRITY",kRe=8;a5={name:Yv,run:ERe}});function ORe(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:Xv,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 TRe(t){let e=ORe(t),r=(t.features??[]).filter(o=>o.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:Xv,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 RRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>TRe(r))}var Xv,l5,u5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";l5={name:Xv,run:RRe}});function IRe(t){let{cwd:e="."}=t;return ye(e,Qv,r=>PRe(r,e))}function PRe(t,e){let r=(t.features??[]).filter(o=>o.status==="done"&&(o.modules??[]).length>0);if(r.length===0)return[];let n=ds(e);if(n===null)return[{detector:Qv,severity:"info",path:"spec/attestation.yaml",message:"no verification attestation \u2014 when this tree was last verified is unknown. Run `clad check --tier=pre-push --strict` GREEN once to attest (the gate writes spec/attestation.yaml)."}];let i=[];for(let o of r){let s=Q_(n,e,o);s.state!=="fresh"&&i.push({detector:Qv,severity:"warn",path:"spec/attestation.yaml",message:s.state==="unattested"?`${o.id} is done but has no attestation entry \u2014 its modules were never verified by an attested gate. Run \`clad check --tier=pre-push --strict\` to attest.`:s.module?`${o.id}'s module ${s.module} changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`:`${o.id}'s modules changed since the last attested verification \u2014 shipped code is running ahead of its verification. Run \`clad check --tier=pre-push --strict\` to re-verify and re-attest.`})}return i}var Qv,eS,lC=y(()=>{"use strict";El();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:IRe}});function CRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return DRe(r)}function DRe(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:d5,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 d5,tS,uC=y(()=>{"use strict";Ue();d5="DEPENDENCY_CYCLE";tS={name:d5,run:CRe}});import{appendFileSync as NRe,existsSync as f5,mkdirSync as jRe,readFileSync as MRe}from"node:fs";import{dirname as FRe,join as LRe}from"node:path";function p5(t){return LRe(t,zRe,URe)}function m5(t){return dC.add(t),()=>dC.delete(t)}function Ja(t,e){let r=p5(t),n=FRe(r);f5(n)||jRe(n,{recursive:!0}),NRe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of dC)try{i(t,e)}catch{}}function pr(t){let e=p5(t);if(!f5(e))return[];let r=MRe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var zRe,URe,dC,un=y(()=>{"use strict";zRe=".cladding",URe="audit.log.jsonl";dC=new Set});import{existsSync as qRe}from"node:fs";import{join as HRe}from"node:path";function BRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:fC,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=[];for(let i of r)i.artifact&&(qRe(HRe(e,i.artifact))||n.push({detector:fC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var fC,h5,g5=y(()=>{"use strict";un();fC="EVIDENCE_MISMATCH";h5={name:fC,run:BRe}});import{existsSync as GRe,readFileSync as ZRe}from"node:fs";import{join as VRe}from"node:path";function WRe(t){let e=VRe(t,v5);if(!GRe(e))return null;try{let n=((0,b5.parse)(ZRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*_5(t,e){for(let r of t??[])r.startsWith(y5)&&(yield{ref:r,name:r.slice(y5.length),field:e})}function KRe(t){let{cwd:e="."}=t,r=WRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:pC,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=[..._5(s.evidence_refs,"evidence_refs"),..._5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:pC,severity:"warn",path:v5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var b5,pC,y5,v5,S5,w5=y(()=>{"use strict";b5=wt(tr(),1);Ue();pC="FIXTURE_REFERENCE_INVALID",y5="fixture:",v5="conformance/fixtures.yaml";S5={name:pC,run:KRe}});import{existsSync as Ql,readFileSync as mC}from"node:fs";import{join as Ya}from"node:path";function JRe(t){return vs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Cp(t){if(!Ql(t))return null;try{return JSON.parse(mC(t,"utf8"))}catch{return null}}function YRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(mC(r,"utf8"))}catch(c){e.push({detector:Ao,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:Ao,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let s=Number(o[1]),a=JRe(t);s!==a&&e.push({detector:Ao,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function XRe(t,e){for(let r of x5){let n=Ya(t,r.path);if(!Ql(n))continue;let i=Cp(n);if(!i){e.push({detector:Ao,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:Ao,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(o)}'`})}}function QRe(t,e){let r=Cp(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of x5){let s=Ya(t,o.path);if(!Ql(s))continue;let a=Cp(s);a?.version&&a.version!==n&&e.push({detector:Ao,severity:"error",message:`${o.host}: ${o.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Ya(t,".claude-plugin","marketplace.json");if(Ql(i)){let o=Cp(i);for(let s of o?.plugins??[])s?.version&&s.version!==n&&e.push({detector:Ao,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 eIe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function tIe(t,e){let r=Ya(t,"src","cli","clad.ts"),n=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Ql(r)||!Ql(n))return;let i=eIe(mC(r,"utf8"));if(i.length===0)return;let s=Cp(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:Ao,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 rIe(t){let{cwd:e="."}=t,r=[];return YRe(e,r),tIe(e,r),XRe(e,r),QRe(e,r),r}var Ao,x5,$5,k5=y(()=>{"use strict";Rp();Ao="HARNESS_INTEGRITY",x5=[{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"]}];$5={name:Ao,run:rIe}});import{existsSync as nIe,readFileSync as iIe}from"node:fs";import{join as oIe}from"node:path";function aIe(t){let{cwd:e="."}=t;return ye(e,rS,r=>lIe(r,e))}function cIe(t){let e=oIe(t,"spec/capabilities.yaml");if(!nIe(e))return!1;try{let r=E5.default.parse(iIe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function lIe(t,e){let r=t.features.length;if(r{"use strict";E5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",sIe=8;A5={name:rS,run:aIe}});function uIe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function dIe(t,e,r){let n=t.split(/\r\n|\n|\r/g),i="",o=(Math.log10(e+1)|0)+1;for(let s=e-1;s<=e+1;s++){let a=n[s-1];a&&(i+=s.toString().padEnd(o," "),i+=": ",i+=a,i+=` -`,s===e&&(i+=" ".repeat(o+r+2),i+=`^ -`))}return i}var ge,Xa=y(()=>{ge=class extends Error{line;column;codeblock;constructor(e,r){let[n,i]=uIe(r.toml,r.ptr),o=dIe(r.toml,n,i);super(`Invalid TOML document: ${e} - -${o}`,r),this.line=n,this.column=i,this.codeblock=o}}});function fIe(t,e){let r=0;for(;t[e-++r]==="\\";);return--r&&r%2}function nS(t,e=0,r=t.length){let n=t.indexOf(` -`,e);return t[n-1]==="\r"&&n--,n<=r?n:-1}function eu(t,e){for(let r=e;r{qi();pR=(t,e,r)=>{if(r)return;if(t)return{transform:z9e.bind(void 0,new TextEncoder)};let n=new F9e(e);return{transform:U9e.bind(void 0,n),final:B9e.bind(void 0,n)}},z9e=function*(t,e){M9e.isBuffer(e)?yield ic(e):typeof e=="string"?yield t.encode(e):yield e},U9e=function*(t,e){yield Wr(e)?t.write(e):e},B9e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as Hpe}from"node:util";var wB,fR,Wpe,q9e,Zpe,V9e,Jpe=S(()=>{wB=Hpe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),fR=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=V9e}=e[r];for await(let i of n(t))yield*fR(i,e,r+1)},Wpe=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*q9e(r,Number(e),t)},q9e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*fR(n,r,e+1)},Zpe=Hpe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),V9e=function*(t){yield t}});var xB,Kpe,Vd,D_,G9e,H9e,kB=S(()=>{xB=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},Kpe=(t,e)=>[...e.flatMap(r=>[...Vd(r,t,0)]),...D_(t)],Vd=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=H9e}=e[r];for(let i of n(t))yield*Vd(i,e,r+1)},D_=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*G9e(r,Number(e),t)},G9e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Vd(n,r,e+1)},H9e=function*(t){yield t}});import{Transform as W9e,getDefaultHighWaterMark as Ype}from"node:stream";var EB,hR,Xpe,mR=S(()=>{Qn();dR();Gpe();SB();Jpe();kB();EB=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=Xpe(t,o,s),l=qd(e),u=qd(r),d=l?wB.bind(void 0,fR,a):xB.bind(void 0,Vd),p=l||u?wB.bind(void 0,Wpe,a):xB.bind(void 0,D_),f=l||u?Zpe.bind(void 0,a):void 0;return{stream:new W9e({writableObjectMode:n,writableHighWaterMark:Ype(n),readableObjectMode:i,readableHighWaterMark:Ype(i),transform(m,y,v){d([m,c,0],this,v)},flush(m){p([c],this,m)},destroy:f})}},hR=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=Xpe(o,r,a);t=Kpe(c,t)}return t},Xpe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:Bpe(n,a)},pR(r,o,n),uR(r,s,n,c),{transform:t,final:e},{transform:qpe(i,a)},Upe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)}});var Qpe,Z9e,J9e,K9e,Y9e,efe=S(()=>{mR();qi();Qn();Qpe=(t,e)=>{for(let r of Z9e(t))J9e(t,r,e)},Z9e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),J9e=(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 ${zl[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>K9e(a,n));r.input=v_(o)},K9e=(t,e)=>{let r=hR(t,e,"utf8",!0);return Y9e(r),v_(r)},Y9e=t=>{let e=t.find(r=>typeof r!="string"&&!Wr(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 gR,X9e,Q9e,tfe,rfe,eWe,nfe,AB=S(()=>{Fd();Qn();im();jl();gR=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&nm(r,n)&&!Vi.has(e)&&X9e(n)&&(t.some(({type:i,value:s})=>i==="native"&&Q9e.has(s))||t.every(({type:i})=>ws.has(i))),X9e=t=>t===1||t===2,Q9e=new Set(["pipe","overlapped"]),tfe=async(t,e,r,n)=>{for await(let i of t)eWe(e)||nfe(i,r,n)},rfe=(t,e,r)=>{for(let n of t)nfe(n,e,r)},eWe=t=>t._readableState.pipes.length>0,nfe=(t,e,r)=>{let n=mP(t);Qo({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as tWe,appendFileSync as rWe}from"node:fs";var ife,nWe,iWe,sWe,oWe,aWe,sfe=S(()=>{AB();mR();dR();qi();Qn();Bd();ife=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>nWe({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},nWe=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let p=qde(t,s,d),f=ic(p),{stdioItems:h,objectMode:m}=e[r],y=iWe([f],h,c,n),{serializedResult:v,finalResult:g=v}=sWe({chunks:y,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});oWe({serializedResult:v,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let b=a[r]?g:void 0;try{return n.error===void 0&&aWe(v,h,i),b}catch(w){return n.error=w,b}},iWe=(t,e,r,n)=>{try{return hR(t,e,r,!1)}catch(i){return n.error=i,t}},sWe=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:v_(t)};let o=Oce(t,r);return n[s]?{serializedResult:o,finalResult:_B(o,!i[s],e)}:{serializedResult:o}},oWe=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!gR({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=_B(t,!1,o);try{rfe(a,e,n)}catch(c){r.error??=c}},aWe=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>aR.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?rWe(n,t):(r.add(s),tWe(n,t))}}});var ofe,afe=S(()=>{qi();N_();ofe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,lc(e,r,"all")]:Array.isArray(e)?[lc(t,r,"all"),...e]:Wr(t)&&Wr(e)?m4([t,e]):`${t}${e}`}});import{once as $B}from"node:events";var cfe,cWe,lfe,ufe,lWe,IB,PB=S(()=>{Ld();cfe=async(t,e)=>{let[r,n]=await cWe(t);return e.isForcefullyTerminated??=!1,[r,n]},cWe=async t=>{let[e,r]=await Promise.allSettled([$B(t,"spawn"),$B(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?lfe(t):r.value},lfe=async t=>{try{return await $B(t,"exit")}catch{return lfe(t)}},ufe=async t=>{let[e,r]=await t;if(!lWe(e,r)&&IB(e,r))throw new oo;return[e,r]},lWe=(t,e)=>t===void 0&&e===void 0,IB=(t,e)=>t!==0||e!==null});var dfe,uWe,pfe=S(()=>{Ld();Bd();PB();dfe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=uWe(t,e,r),o=s?.code==="ETIMEDOUT",a=Bde(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},uWe=(t,e,r)=>t!==void 0?t:IB(e,r)?new oo:void 0});import{spawnSync as dWe}from"node:child_process";var ffe,pWe,fWe,hWe,yR,mWe,gWe,yWe,bWe,hfe=S(()=>{k4();X4();Q4();O_();iR();Mpe();N_();efe();sfe();Bd();afe();pfe();ffe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=pWe(t,e,r),d=mWe({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return mm(d,c,l)},pWe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=bP(t,e,r),a=fWe(r),{file:c,commandArguments:l,options:u}=GP(t,e,a);hWe(u);let d=jpe(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},fWe=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,hWe=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&yR("ipcInput"),t&&yR("ipc: true"),r&&yR("detached: true"),n&&yR("cancelSignal")},yR=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},mWe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=gWe({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:p,isMaxBuffer:f}=dfe(c,r),{output:h,error:m=l}=ife({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:f,verboseInfo:s}),y=h.map((g,b)=>lc(g,r,b)),v=lc(ofe(h,r),r,"all");return bWe({error:m,exitCode:u,signal:d,timedOut:p,isMaxBuffer:f,stdio:y,all:v,options:r,command:n,escapedCommand:i,startTime:a})},gWe=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{Qpe(s,r);let a=yWe(r);return dWe(...HP(t,e,a))}catch(a){return hm({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},yWe=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:rR(e)}),bWe=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?nR({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):T_({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0})});import{once as RB,on as vWe}from"node:events";var mfe,_We,SWe,wWe,xWe,gfe=S(()=>{lm();$_();A_();mfe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(am({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:MP(t)}),_We({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),_We=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{CP(e,i);let s=Fl(t,e,r),o=new AbortController;try{return await Promise.race([SWe(s,n,o),wWe(s,r,o),xWe(s,r,o)])}catch(a){throw cm(t),a}finally{o.abort(),TP(e,i)}},SWe=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await RB(t,"message",{signal:r});return n}for await(let[n]of vWe(t,"message",{signal:r}))if(e(n))return n},wWe=async(t,e,{signal:r})=>{await RB(t,"disconnect",{signal:r}),$ue(e)},xWe=async(t,e,{signal:r})=>{let[n]=await RB(t,"strict:error",{signal:r});throw $P(n,e)}});import{once as bfe,on as kWe}from"node:events";var vfe,CB,EWe,AWe,$We,yfe,TB=S(()=>{lm();$_();A_();vfe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>CB({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),CB=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{am({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:MP(t)}),CP(e,s);let o=Fl(t,e,r),a=new AbortController,c={};return EWe(t,o,a),AWe({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),$We({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},EWe=async(t,e,r)=>{try{await bfe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},AWe=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await bfe(t,"strict:error",{signal:r.signal});n.error=$P(i,e),r.abort()}catch{}},$We=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of kWe(r,"message",{signal:s.signal}))yfe(o),yield c}catch{yfe(o)}finally{s.abort(),TP(e,a),n||cm(t),i&&await t}},yfe=({error:t})=>{if(t)throw t}});import _fe from"node:process";var Sfe,wfe,xfe,OB=S(()=>{qP();gfe();TB();jP();Sfe=(t,{ipc:e})=>{Object.assign(t,xfe(t,!1,e))},wfe=()=>{let t=_fe,e=!0,r=_fe.channel!==void 0;return{...xfe(t,e,r),getCancelSignal:tde.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},xfe=(t,e,r)=>({sendMessage:BP.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:mfe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:vfe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as IWe}from"node:child_process";import{PassThrough as PWe,Readable as RWe,Writable as CWe,Duplex as TWe}from"node:stream";var kfe,OWe,j_,NWe,DWe,jWe,LWe,Efe=S(()=>{lR();O_();iR();kfe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{yB(n);let a=new IWe;OWe(a,n),Object.assign(a,{readable:NWe,writable:DWe,duplex:jWe});let c=hm({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=LWe(c,o,i);return{subprocess:a,promise:l}},OWe=(t,e)=>{let r=j_(),n=j_(),i=j_(),s=Array.from({length:e.length-3},j_),o=j_(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},j_=()=>{let t=new PWe;return t.end(),t},NWe=()=>new RWe({read(){}}),DWe=()=>new CWe({write(){}}),jWe=()=>new TWe({read(){},write(){}}),LWe=async(t,e,r)=>mm(t,e,r)});import{createReadStream as Afe,createWriteStream as $fe}from"node:fs";import{Buffer as MWe}from"node:buffer";import{Readable as L_,Writable as FWe,Duplex as zWe}from"node:stream";var Pfe,M_,Ife,UWe,Rfe=S(()=>{mR();lR();Qn();Pfe=(t,e)=>cR(UWe,t,e,!1),M_=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${zl[t]}.`)},Ife={fileNumber:M_,generator:EB,asyncGenerator:EB,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:zWe.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},UWe={input:{...Ife,fileUrl:({value:t})=>({stream:Afe(t)}),filePath:({value:{file:t}})=>({stream:Afe(t)}),webStream:({value:t})=>({stream:L_.fromWeb(t)}),iterable:({value:t})=>({stream:L_.from(t)}),asyncIterable:({value:t})=>({stream:L_.from(t)}),string:({value:t})=>({stream:L_.from(t)}),uint8Array:({value:t})=>({stream:L_.from(MWe.from(t))})},output:{...Ife,fileUrl:({value:t})=>({stream:$fe(t)}),filePath:({value:{file:t,append:e}})=>({stream:$fe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:FWe.fromWeb(t)}),iterable:M_,asyncIterable:M_,string:M_,uint8Array:M_}}});import{on as BWe,once as Cfe}from"node:events";import{PassThrough as qWe,getDefaultHighWaterMark as VWe}from"node:stream";import{finished as Nfe}from"node:stream/promises";function Gd(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)DB(i);let e=t.some(({readableObjectMode:i})=>i),r=GWe(t,e),n=new NB({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var GWe,NB,HWe,WWe,ZWe,DB,JWe,KWe,YWe,XWe,QWe,Dfe,jfe,jB,Lfe,e8e,bR,Tfe,Ofe,vR=S(()=>{GWe=(t,e)=>{if(t.length===0)return VWe(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},NB=class extends qWe{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(DB(e),this.#t.has(e))return;this.#t.add(e),this.#n??=HWe(this,this.#t,this.#s);let r=JWe({passThroughStream:this,stream:e,streams:this.#t,ended:this.#r,aborted:this.#e,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(DB(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)}},HWe=async(t,e,r)=>{bR(t,Tfe);let n=new AbortController;try{await Promise.race([WWe(t,n),ZWe(t,e,r,n)])}finally{n.abort(),bR(t,-Tfe)}},WWe=async(t,{signal:e})=>{try{await Nfe(t,{signal:e,cleanup:!0})}catch(r){throw Dfe(t,r),r}},ZWe=async(t,e,r,{signal:n})=>{for await(let[i]of BWe(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},DB=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},JWe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{bR(t,Ofe);let a=new AbortController;try{await Promise.race([KWe(s,e,a),YWe({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),XWe({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),bR(t,-Ofe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?jB(t):QWe(t))},KWe=async(t,e,{signal:r})=>{try{await t,r.aborted||jB(e)}catch(n){r.aborted||Dfe(e,n)}},YWe=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await Nfe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;jfe(o)?i.add(e):Lfe(t,o)}},XWe=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await Cfe(t,i,{signal:s}),!t.readable)return Cfe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},QWe=t=>{t.writable&&t.end()},Dfe=(t,e)=>{jfe(e)?jB(t):Lfe(t,e)},jfe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",jB=t=>{(t.readable||t.writable)&&t.destroy()},Lfe=(t,e)=>{t.destroyed||(t.once("error",e8e),t.destroy(e))},e8e=()=>{},bR=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},Tfe=2,Ofe=1});import{finished as Mfe}from"node:stream/promises";var ym,t8e,LB,r8e,MB,_R=S(()=>{sc();ym=(t,e)=>{t.pipe(e),t8e(t,e),r8e(t,e)},t8e=async(t,e)=>{if(!(so(t)||so(e))){try{await Mfe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}LB(e)}},LB=t=>{t.writable&&t.end()},r8e=async(t,e)=>{if(!(so(t)||so(e))){try{await Mfe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}MB(t)}},MB=t=>{t.readable&&t.destroy()}});var Ffe,n8e,i8e,s8e,o8e,a8e,zfe=S(()=>{vR();sc();RP();Qn();_R();Ffe=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>ws.has(c)))n8e(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!ws.has(c)))s8e({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Gd(s);ym(o,i)}},n8e=(t,e,r,n)=>{r==="output"?ym(t.stdio[n],e):ym(e,t.stdio[n]);let i=i8e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},i8e=["stdin","stdout","stderr"],s8e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;o8e(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},o8e=(t,{signal:e})=>{so(t)&&Md(t,a8e,e)},a8e=2});var Hd,Ufe=S(()=>{Hd=[];Hd.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Hd.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Hd.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var SR,FB,zB,c8e,UB,wR,l8e,BB,qB,VB,Bfe,U6t,B6t,qfe=S(()=>{Ufe();SR=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",FB=Symbol.for("signal-exit emitter"),zB=globalThis,c8e=Object.defineProperty.bind(Object),UB=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(zB[FB])return zB[FB];c8e(zB,FB,{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 s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},wR=class{},l8e=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),BB=class extends wR{onExit(){return()=>{}}load(){}unload(){}},qB=class extends wR{#t=VB.platform==="win32"?"SIGINT":"SIGHUP";#r=new UB;#e;#n;#s;#i={};#o=!1;constructor(e){super(),this.#e=e,this.#i={};for(let r of Hd)this.#i[r]=()=>{let n=this.#e.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#t:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!SR(this.#e))return()=>{};this.#o===!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.#o){this.#o=!0,this.#r.count+=1;for(let e of Hd)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.#o&&(this.#o=!1,Hd.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.#s,this.#r.count-=1)}#a(e){return SR(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&SR(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)}},VB=globalThis.process,{onExit:Bfe,load:U6t,unload:B6t}=l8e(SR(VB)?new qB(VB):new BB)});import{addAbortListener as u8e}from"node:events";var Vfe,Gfe=S(()=>{qfe();Vfe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=Bfe(()=>{t.kill()});u8e(n,()=>{i()})}});var Wfe,d8e,p8e,Hfe,f8e,Zfe=S(()=>{h4();yP();Ml();tm();Wfe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=gP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=d8e(r,n,i),{sourceStream:d,sourceError:p}=f8e(t,l),{options:f,fileDescriptors:h}=ta.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:f,sourceError:p,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},d8e=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=p8e(t,e,...r),a=PP(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},p8e=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Hfe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||p4(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,s,o]=sP(r,...n);return{destination:e(Hfe)(i,s,o),pipeOptions:o}}if(ta.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}`)},Hfe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),f8e=(t,e)=>{try{return{sourceStream:dm(t,e)}}catch(r){return{sourceError:r}}}});var Kfe,h8e,GB,Jfe,HB=S(()=>{O_();_R();Kfe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=h8e({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw GB({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},h8e=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return MB(t),n;if(e!==void 0)return LB(r),e},GB=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>hm({error:t,command:Jfe,escapedCommand:Jfe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),Jfe="source.pipe(destination)"});var Yfe,Xfe=S(()=>{Yfe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o}});import{finished as m8e}from"node:stream/promises";var Qfe,g8e,y8e,b8e,xR,v8e,_8e,ehe=S(()=>{vR();RP();_R();Qfe=(t,e,r)=>{let n=xR.has(e)?y8e(t,e):g8e(t,e);return Md(t,v8e,r.signal),Md(e,_8e,r.signal),b8e(e),n},g8e=(t,e)=>{let r=Gd([t]);return ym(r,e),xR.set(e,r),r},y8e=(t,e)=>{let r=xR.get(e);return r.add(t),r},b8e=async t=>{try{await m8e(t,{cleanup:!0,readable:!1,writable:!0})}catch{}xR.delete(t)},xR=new WeakMap,v8e=2,_8e=1});import{aborted as S8e}from"node:util";var the,w8e,rhe=S(()=>{HB();the=(t,e)=>t===void 0?[]:[w8e(t,e)],w8e=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await S8e(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw GB({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})}});var kR,x8e,k8e,nhe=S(()=>{nc();Zfe();HB();Xfe();ehe();rhe();kR=(t,...e)=>{if($r(e[0]))return kR.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=Wfe(t,...e),i=x8e({...n,destination:r});return i.pipe=kR.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},x8e=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=k8e(t,i);Kfe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let p=Qfe(e,s,d);return await Promise.race([Yfe(u),...the(a,{sourceStream:e,mergedStream:p,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},k8e=(t,e)=>Promise.allSettled([t,e])});import{on as E8e}from"node:events";import{getDefaultHighWaterMark as A8e}from"node:stream";var ER,$8e,WB,I8e,she,ZB,ihe,P8e,R8e,AR=S(()=>{SB();dR();kB();ER=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return $8e(e,o),she({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},$8e=async(t,e)=>{try{await t}catch{}finally{e.abort()}},WB=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;I8e(e,o,t);let a=t.readableObjectMode&&!s;return she({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},I8e=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},she=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=E8e(t,"data",{signal:e.signal,highWaterMark:ihe,highWatermark:ihe});return P8e({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},ZB=A8e(!0),ihe=ZB,P8e=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=R8e({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*Vd(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*D_(a)}},R8e=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[pR(t,r,!e),uR(t,i,!n,{})].filter(Boolean)});import{setImmediate as C8e}from"node:timers/promises";var ohe,T8e,O8e,N8e,JB,ahe,KB=S(()=>{tR();qi();AB();AR();Bd();N_();ohe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=T8e({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([O8e(t),d]);return}let p=bB(c,r),f=WB({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:p,allMixed:a}),[h]=await Promise.all([N8e({stream:t,iterable:f,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},T8e=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!gR({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=WB({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await tfe(a,t,r,s)},O8e=async t=>{await C8e(),t.readableFlowing===null&&t.resume()},N8e=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await YP(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await XP(r,{maxBuffer:s})):await eR(r,{maxBuffer:s})}catch(a){return ahe(Fde({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},JB=async t=>{try{return await t}catch(e){return ahe(e)}},ahe=({bufferedData:t})=>Cce(t)?new Uint8Array(t):t});import{finished as D8e}from"node:stream/promises";var F_,j8e,L8e,M8e,F8e,z8e,YB,$R,che,IR=S(()=>{F_=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=j8e(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],D8e(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||F8e(a,e,r,n)}finally{o.abort()}},j8e=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&L8e(t,r,n),n},L8e=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{M8e(e,r),n.call(t,...i)}},M8e=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},F8e=(t,e,r,n)=>{if(!z8e(t,e,r,n))throw t},z8e=(t,e,r,n=!0)=>r.propagating?che(t)||$R(t):(r.propagating=!0,YB(r,e)===n?che(t):$R(t)),YB=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",$R=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",che=t=>t?.code==="EPIPE"});var lhe,XB,QB=S(()=>{KB();IR();lhe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>XB({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),XB=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=F_(t,e,l);if(YB(l,e)){await u;return}let[d]=await Promise.all([ohe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d}});var uhe,dhe,U8e,B8e,eq=S(()=>{vR();QB();uhe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Gd([t,e].filter(Boolean)):void 0,dhe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>XB({...U8e(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:B8e(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),U8e=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},B8e=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var phe,fhe,hhe=S(()=>{im();jl();phe=t=>nm(t,"ipc"),fhe=(t,e)=>{let r=mP(t);Qo({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var mhe,ghe,yhe=S(()=>{Bd();hhe();ac();TB();mhe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=phe(s),a=oc(e,"ipc"),c=oc(r,"ipc");for await(let l of CB({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(zde(t,i,c),i.push(l)),o&&fhe(l,s);return i},ghe=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as q8e}from"node:events";var bhe,V8e,G8e,H8e,vhe=S(()=>{Ud();W4();M4();H4();sc();Qn();KB();yhe();J4();eq();QB();PB();IR();bhe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:p,verboseInfo:f,fileDescriptors:h,originalStreams:m,onInternalError:y,controller:v})=>{let g=cfe(t,p),b={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:g,propagating:!1},w=lhe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:f,streamInfo:b}),x=dhe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:f,streamInfo:b}),$=[],I=mhe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:$,verboseInfo:f}),E=V8e(m,t,b),R=G8e(h,b);try{return await Promise.race([Promise.all([{},ufe(g),Promise.all(w),x,I,dde(t,d),...E,...R]),y,H8e(t,v),...ode(t,s,p,v),...Aue({subprocess:t,cancelSignal:o,gracefulCancel:a,context:p,controller:v}),...ide({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:p,controller:v})])}catch(A){return p.terminationReason??="other",Promise.all([{error:A},g,Promise.all(w.map(B=>JB(B))),JB(x),ghe(I,$),Promise.allSettled(E),Promise.allSettled(R)])}},V8e=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:F_(n,i,r)),G8e=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>co(s,{checkOpen:!1})&&!so(s)).map(({type:i,value:s,stream:o=s})=>F_(o,n,e,{isSameDirection:ws.has(i),stopOnExit:i==="native"}))),H8e=async(t,{signal:e})=>{let[r]=await q8e(t,"error",{signal:e});throw r}});var _he,z_,bm,PR=S(()=>{um();_he=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),z_=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=ea();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},bm=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 She}from"node:stream/promises";var tq,whe,rq,nq,RR,CR,iq=S(()=>{IR();tq=async t=>{if(t!==void 0)try{await rq(t)}catch{}},whe=async t=>{if(t!==void 0)try{await nq(t)}catch{}},rq=async t=>{await She(t,{cleanup:!0,readable:!1,writable:!0})},nq=async t=>{await She(t,{cleanup:!0,readable:!0,writable:!1})},RR=async(t,e)=>{if(await t,e)throw e},CR=(t,e,r)=>{r&&!$R(r)?t.destroy(r):e&&t.destroy()}});import{Readable as W8e}from"node:stream";import{callbackify as Z8e}from"node:util";var xhe,sq,oq,aq,J8e,cq,lq,khe,uq=S(()=>{Fd();Ml();AR();um();PR();iq();xhe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||Vi.has(r),{subprocessStdout:a,waitReadableDestroy:c}=sq(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=oq(a,o),{read:p,onStdoutDataDone:f}=aq({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new W8e({read:p,destroy:Z8e(lq.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return cq({subprocessStdout:a,onStdoutDataDone:f,readable:h,subprocess:t}),h},sq=(t,e,r)=>{let n=dm(t,e),i=z_(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},oq=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:ZB},aq=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=ea(),o=ER({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){J8e(this,o,s)},onStdoutDataDone:s}},J8e=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},cq=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await nq(t),await n,await tq(i),await e,r.readable&&r.push(null)}catch(s){await tq(i),khe(r,s)}},lq=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await bm(r,e)&&(khe(t,n),await RR(e,n))},khe=(t,e)=>{CR(t,t.readable,e)}});import{Writable as K8e}from"node:stream";import{callbackify as Ehe}from"node:util";var Ahe,dq,pq,Y8e,X8e,fq,hq,$he,mq=S(()=>{Ml();PR();iq();Ahe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=dq(t,r,e),o=new K8e({...pq(n,t,i),destroy:Ehe(hq.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return fq(n,o),o},dq=(t,e,r)=>{let n=PP(t,e),i=z_(r,n,"writableFinal"),s=z_(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},pq=(t,e,r)=>({write:Y8e.bind(void 0,t),final:Ehe(X8e.bind(void 0,t,e,r))}),Y8e=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},X8e=async(t,e,r)=>{await bm(r,e)&&(t.writable&&t.end(),await e)},fq=async(t,e,r)=>{try{await rq(t),e.writable&&e.end()}catch(n){await whe(r),$he(e,n)}},hq=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await bm(r,e),await bm(n,e)&&($he(t,i),await RR(e,i))},$he=(t,e)=>{CR(t,t.writable,e)}});import{Duplex as Q8e}from"node:stream";import{callbackify as eZe}from"node:util";var Ihe,tZe,Phe=S(()=>{Fd();uq();mq();Ihe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||Vi.has(r),{subprocessStdout:c,waitReadableDestroy:l}=sq(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:p}=dq(t,i,e),{readableEncoding:f,readableObjectMode:h,readableHighWaterMark:m}=oq(c,a),{read:y,onStdoutDataDone:v}=aq({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),g=new Q8e({read:y,...pq(u,t,d),destroy:eZe(tZe.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:p})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:f});return cq({subprocessStdout:c,onStdoutDataDone:v,readable:g,subprocess:t,subprocessStdin:u}),fq(u,g,c),g},tZe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([lq({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),hq({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])}});var gq,rZe,Rhe=S(()=>{Fd();Ml();AR();gq=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||Vi.has(e),o=dm(t,r),a=ER({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return rZe(a,o,t)},rZe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var Che,The=S(()=>{PR();uq();mq();Phe();Rhe();Che=(t,{encoding:e})=>{let r=_he();t.readable=xhe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Ahe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Ihe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=gq.bind(void 0,t,e),t[Symbol.asyncIterator]=gq.bind(void 0,t,e,{})}});var Ohe,nZe,iZe,Nhe=S(()=>{Ohe=(t,e)=>{for(let[r,n]of iZe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},nZe=(async()=>{})().constructor.prototype,iZe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(nZe,t)])});import{setMaxListeners as sZe}from"node:events";import{spawn as oZe}from"node:child_process";var Dhe,aZe,cZe,lZe,uZe,dZe,jhe=S(()=>{tR();k4();X4();Ml();Q4();OB();O_();iR();Efe();Rfe();N_();zfe();EP();Gfe();nhe();eq();vhe();The();um();Nhe();Dhe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=aZe(t,e,r),{subprocess:p,promise:f}=lZe({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return p.pipe=kR.bind(void 0,{source:p,sourcePromise:f,boundOptions:{},createNested:n}),Ohe(p,f),ta.set(p,{options:u,fileDescriptors:d}),p},aZe=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=bP(t,e,r),{file:a,commandArguments:c,options:l}=GP(t,e,r),u=cZe(l),d=Pfe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},cZe=({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}},lZe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=oZe(...HP(t,e,r))}catch(h){return kfe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;sZe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];Ffe(c,a,l),Vfe(c,r,l);let d={},p=ea();c.kill=kue.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:p,context:d,controller:l}),c.all=uhe(c,r),Che(c,r),Sfe(c,r);let f=uZe({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:p,controller:l});return{subprocess:c,promise:f}},uZe=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[p,f],h,m,y]=await bhe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let v=h.map((w,x)=>lc(w,e,x)),g=lc(m,e,"all"),b=dZe({errorInfo:d,exitCode:p,signal:f,stdio:v,all:g,ipcOutput:y,context:c,options:e,command:o,escapedCommand:a,startTime:r});return mm(b,n,e)},dZe=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?T_({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof ra,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):nR({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u})});var TR,pZe,fZe,Lhe=S(()=>{nc();ac();TR=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,pZe(n,t[n],i)]));return{...t,...r}},pZe=(t,e,r)=>fZe.has(t)&&$r(e)&&$r(r)?{...e,...r}:r,fZe=new Set(["env",...v4])});var Ul,hZe,mZe,Mhe=S(()=>{nc();h4();Fce();hfe();jhe();Lhe();Ul=(t,e,r,n)=>{let i=(o,a,c)=>Ul(o,a,r,c),s=(...o)=>hZe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},hZe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if($r(s))return i(t,TR(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=mZe({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?ffe(a,c,l):Dhe(a,c,l,i)},mZe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=Lce(e)?Mce(e,r):[e,...r],[o,a,c]=sP(...s),l=TR(TR(n,i),c),{file:u=o,commandArguments:d=a,options:p=l,isSync:f=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:p,isSync:f}}});var Fhe,zhe,Uhe,gZe,yZe,Bhe=S(()=>{Fhe=({file:t,commandArguments:e})=>Uhe(t,e),zhe=({file:t,commandArguments:e})=>({...Uhe(t,e),isSync:!0}),Uhe=(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]=gZe(t);return{file:r,commandArguments:n}},gZe=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(yZe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},yZe=/ +/g});var qhe,Vhe,bZe,Ghe,vZe,Hhe,Whe=S(()=>{qhe=(t,e,r)=>{t.sync=e(bZe,r),t.s=t.sync},Vhe=({options:t})=>Ghe(t),bZe=({options:t})=>({...Ghe(t),isSync:!0}),Ghe=t=>({options:{...vZe(t),...t}}),vZe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},Hhe={preferLocal:!0}});var CBt,Mt,TBt,OBt,NBt,DBt,jBt,LBt,MBt,FBt,xi=S(()=>{Mhe();Bhe();Z4();Whe();OB();CBt=Ul(()=>({})),Mt=Ul(()=>({isSync:!0})),TBt=Ul(Fhe),OBt=Ul(zhe),NBt=Ul(cde),DBt=Ul(Vhe,{},Hhe,qhe),{sendMessage:jBt,getOneMessage:LBt,getEachMessage:MBt,getCancelSignal:FBt}=wfe()});import{existsSync as bq,readFileSync as Zhe,readdirSync as _Ze,statSync as SZe}from"node:fs";import{join as OR}from"node:path";function Sq(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=OR(t,e);if(bq(r))try{if(Jhe.test(Zhe(r,"utf8")))return!0}catch{}}return!1}function Khe(t){try{return bq(t)&&Jhe.test(Zhe(t,"utf8"))}catch{return!1}}function Yhe(t,e=0){if(e>4||!bq(t))return!1;let r;try{r=_Ze(t)}catch{return!1}for(let n of r){let i=OR(t,n),s=!1;try{s=SZe(i).isDirectory()}catch{continue}if(s){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(Yhe(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&Khe(i))return!0}return!1}function kZe(t){if(Sq(t))return!0;for(let e of wZe)if(Khe(OR(t,e)))return!0;for(let e of xZe)if(Yhe(OR(t,e)))return!0;return!1}function Xhe(t="."){let e=Yf(t).coverage;return e||(kZe(t)?"kover":"jacoco")}function Qhe(t="."){return vq[Xhe(t)]}function eme(t="."){return yq[Xhe(t)]}var vq,yq,_q,Jhe,wZe,xZe,NR=S(()=>{"use strict";Xf();vq={kover:"koverXmlReport",jacoco:"jacocoTestReport"},yq={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},_q=[yq.kover,yq.jacoco],Jhe=/kover/i;wZe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],xZe=["buildSrc","build-logic"]});import{existsSync as B_,readFileSync as xq,readdirSync as rme,statSync as EZe}from"node:fs";import{dirname as AZe,join as ei,resolve as $Ze}from"node:path";import vm from"node:process";function kq(t){return B_(ei(t,"gradlew"))?"./gradlew":"gradle"}function IZe(t){let e=kq(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[Qhe(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function PZe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(xq(ei(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 CZe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function NZe(t,e){for(let r of e)if(B_(ei(t,r)))return r}function DZe(t,e){try{return rme(t).find(n=>n.endsWith(e))}catch{return}}function FZe(t){let e=[],r=vm.platform==="win32";r||e.push(ei("/etc","madge","config"),ei("/etc","madgerc"));let n=r?vm.env.USERPROFILE:vm.env.HOME;n&&e.push(ei(n,".config","madge","config"),ei(n,".config","madge"),ei(n,".madge","config"),ei(n,".madgerc"));for(let s=$Ze(t);;){e.push(ei(s,".madgerc"));let o=AZe(s);if(o===s)break;s=o}let i=vm.env.MADGE_config??vm.env.madge_config;return i&&e.push(i),e}function zZe(){for(let[t,e]of Object.entries(vm.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function nme(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function BZe(t){try{return EZe(t).isFile()}catch{return!1}}function qZe(t){let e;try{e=xq(t,"utf8")}catch{return!0}try{return nme(JSON.parse(e).excludeRegExp)}catch{return UZe.test(e)}}function VZe(t,e){let r=e.madge;return r&&typeof r=="object"&&nme(r.excludeRegExp)||zZe()?!0:FZe(t).some(n=>BZe(n)&&qZe(n))}function GZe(t){try{return JSON.parse(xq(ei(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function U_(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function tme(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function HZe(t,e,r){if(VZe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",MZe),{...e,args:n}}function WZe(t,e,r){if(U_(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of jZe)if(n.configs.some(i=>B_(ei(t,i))))return n.gate;if(LZe.some(n=>B_(ei(t,n)))||r.eslintConfig!==void 0)return e}function JZe(t,e){return ZZe.some(r=>B_(ei(t,r)))?!0:e.jest!==void 0}function KZe(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 wq(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function YZe(t,e){let r=GZe(t),n=e.lint?WZe(t,e.lint,r):void 0,i=e.arch?{...e,arch:HZe(t,e.arch,r)}:e,s=n?{...i,lint:n}:wq(i,"lint"),o=U_(r,"test"),a=o?KZe(o):void 0;return o&&!a?(s=wq(s,"coverage"),{...s,test:{cmd:"npm",args:["test"]},...U_(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!o&&JZe(t,r)?{...s,test:{cmd:"npx",args:[...ia,"jest"]},coverage:{cmd:"npx",args:[...ia,"jest","--coverage"]}}:(a==="vitest"&&!U_(r,"coverage")&&!tme(r,"@vitest/coverage-v8")&&!tme(r,"@vitest/coverage-istanbul")?s=wq(s,"coverage"):a==="vitest"&&U_(r,"coverage")&&(s={...s,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),s)}function dr(t="."){for(let e of TZe){let r;for(let s of e.manifests)if(s.startsWith(".")?r=DZe(t,s):r=NZe(t,[s]),r)break;if(!r||e.requiresSource&&!CZe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?YZe(t,n):n;return{language:e.language,manifest:r,gates:i}}return OZe}var ia,RZe,TZe,OZe,jZe,LZe,MZe,UZe,ZZe,xs=S(()=>{"use strict";NR();ia=["--offline","--no-install"];RZe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);TZe=[{language:"typescript",manifests:["package.json"],gates:{type:{cmd:"npx",args:[...ia,"tsc","--noEmit"]},lint:{cmd:"npx",args:[...ia,"eslint","."]},test:{cmd:"npx",args:[...ia,"vitest","run"]},coverage:{cmd:"npx",args:[...ia,"vitest","run","--coverage"]},secret:{cmd:"npx",args:[...ia,"secretlint","**/*"]},arch:{cmd:"npx",args:[...ia,"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:IZe},{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:PZe}],OZe={language:"unknown",manifest:"",gates:{}};jZe=[{configs:["biome.json","biome.jsonc"],gate:{cmd:"npx",args:[...ia,"biome","lint","."]}},{configs:[".oxlintrc.json",".oxlintrc.jsonc","oxlint.config.ts"],gate:{cmd:"npx",args:[...ia,"oxlint"]}}],LZe=["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"],MZe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";UZe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;ZZe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as XZe,readFileSync as QZe}from"node:fs";import{join as eJe}from"node:path";function Wd(t){return t.code==="ENOENT"}function DR(t,e,r,n){let i=t.exitCode??1;if(i===0)return[];let s=(t.stderr??"").toString().trim(),o=(t.stdout??"").toString().trim(),a=[o,s].filter(c=>c.length>0).join(` +`).slice(0,2e3)||`exit ${i}`;return ime.test(s)||ime.test(o)?[{detector:e,severity:"info",message:n(a)}]:[{detector:e,severity:"error",message:r(a)}]}function jr(t,e,r,n=[]){if(Wd(r))return{stage:t,pass:!1,exitCode:2,stderr:`'${e}' not installed`,skipReason:"tool-missing"};let i=`${String(r.stderr??"")} +${String(r.stdout??"")}`,s=/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"&&(s||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",skipReason:"tool-missing"}:null}function nn(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 _m(t,e){let r=eJe(t,"package.json");if(!XZe(r))return!1;try{return!!JSON.parse(QZe(r,"utf8")).scripts?.[e]}catch{return!1}}var ime,ks=S(()=>{"use strict";ime=/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 tJe(t){let{cwd:e="."}=t,r=dr(e),n=r.gates.arch;if(!n)return[{detector:jR,severity:"info",message:`no architecture validator registered for language '${r.language}' (compiler may already enforce acyclic imports)`}];let i=Mt(n.cmd,[...n.args],{cwd:e,reject:!1});return Wd(i)?[{detector:jR,severity:"info",message:`architecture validator '${n.cmd}' not installed`}]:DR(i,jR,s=>`${n.cmd} reported architecture violations: ${s}`,s=>`${n.cmd} could not validate (config/setup gap, not a violation): ${s}`)}var jR,Zd,LR=S(()=>{"use strict";xi();xs();ks();jR="ARCHITECTURE_VIOLATION";Zd={name:jR,subprocess:!0,run:tJe}});function rJe(t){let{cwd:e="."}=t,r=dr(e),n=r.gates.secret;if(!n)return[{detector:MR,severity:"info",message:`no secret scanner registered for language '${r.language}'`}];let i=Mt(n.cmd,[...n.args],{cwd:e,reject:!1});return Wd(i)?[{detector:MR,severity:"info",message:`secret scanner '${n.cmd}' not installed`}]:DR(i,MR,s=>`${n.cmd} reported secrets: ${s}`,s=>`${n.cmd} could not scan (config/setup gap, not a secret): ${s}`)}var MR,Jd,FR=S(()=>{"use strict";xi();xs();ks();MR="HARDCODED_SECRET";Jd={name:MR,subprocess:!0,run:rJe}});import{existsSync as Eq,readdirSync as sme}from"node:fs";import{join as zR}from"node:path";function iJe(t,e){let r=zR(t,e.path);if(!Eq(r))return!0;if(e.isDirectory)try{return sme(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function sJe(t){let{cwd:e="."}=t,r=[];for(let i of nJe)iJe(e,i)&&r.push({detector:q_,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=zR(e,"spec.yaml");if(Eq(n)){let i=cJe(n),s=i?null:oJe(e);if(i)r.push({detector:q_,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(s)r.push({detector:q_,severity:"error",path:s.path,message:`spec shard '${s.path}' is present but unparseable (${s.reason}) \u2014 loadSpec throws on it, so every spec-gated detector silently passes. Fix it, then \`clad sync\`.`});else{let o=aJe(e);o&&r.push({detector:q_,severity:"error",path:"spec.yaml",message:`spec.yaml is present and parses, but the assembled spec does not load (${o}) \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 oJe(t){for(let e of["spec/features","spec/scenarios"]){let r=zR(t,e);if(!Eq(r))continue;let n;try{n=sme(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml"))}catch{continue}for(let i of[...n].sort()){let s=zR(r,i);if(!ree(t,s))try{ju(s)}catch(o){return{path:`${e}/${i}`,reason:o.message}}}}return null}function aJe(t){try{return oe(t),null}catch(e){return e.message}}function cJe(t){let e;try{e=ju(t)}catch(r){return`unparseable: ${r.message}`}return e===null||typeof e!="object"||Array.isArray(e)?"empty or not a YAML mapping":null}var q_,nJe,ome,ame=S(()=>{"use strict";gt();ak();q_="ABSENCE_OF_GOVERNANCE",nJe=[{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}];ome={name:q_,run:sJe}});function UR(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function Aq(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=UR(r)==="while",s=uJe.test(r);return i?s?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 '${UR(r)}'`}let n=lJe[t];return r.length===0?`ears='${t}' requires condition starting with '${n}' \u2014 empty`:UR(r)!==n?`ears='${t}' requires condition to start with '${n}' \u2014 got '${UR(r)}'`:null}function dJe(t,e){let r=Aq(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function cme(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...dJe(r,n));return e}var lJe,uJe,$q=S(()=>{"use strict";lJe={event:"when",state:"while",optional:"where",unwanted:"if"},uJe=/\bwhen\b/i});function Ue(t,e,r){let n;try{n=oe(t)}catch(i){return[{detector:e,severity:"info",message:`spec.yaml not loaded: ${i.message}`}]}return r(n)}var vr=S(()=>{"use strict";gt()});function pJe(t){let{cwd:e="."}=t;return Ue(e,BR,fJe)}function fJe(t){let e=[];for(let r of t.features)for(let n of r.acceptance_criteria??[]){let i=!!n.text?.trim(),s=!!(n.condition?.trim()||n.action?.trim()||n.response?.trim());!i&&!s&&e.push({detector:BR,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 cme(t.features))e.push({detector:BR,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var BR,lme,ume=S(()=>{"use strict";$q();vr();BR="AC_DRIFT";lme={name:BR,run:pJe}});function sa(t=".",e){let n=(e??"").trim().toLowerCase()||dr(t).language;return pme[n]??dme}var hJe,mJe,gJe,dme,yJe,bJe,pme,vJe,fme,Kd=S(()=>{"use strict";xs();hJe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,mJe=/^[ \t]*import\s+([\w.]+)/gm,gJe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,dme={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:hJe,importStyle:"relative"},yJe={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:mJe,importStyle:"dotted"},bJe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:gJe,importStyle:"dotted"},pme={typescript:dme,kotlin:yJe,python:bJe},vJe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],fme=new Set([...Object.values(pme).flatMap(t=>t?.extensions??[]),...vJe].map(t=>t.toLowerCase()))});import{existsSync as _Je,readFileSync as SJe,readdirSync as wJe,statSync as xJe}from"node:fs";import{join as mme,relative as hme}from"node:path";function kJe(t,e){if(!_Je(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),s;try{s=wJe(i)}catch{continue}for(let o of s){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let a=mme(i,o),c;try{c=xJe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>o.endsWith(l))&&r.push(a)}}return r}function EJe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function $Je(t){return AJe.test(t)}function IJe(t){let{cwd:e="."}=t,r;try{r=oe(e)}catch{return[]}let n=r.project.ai_hints?.forbidden_patterns;if(!n||n.length===0)return[];let i=sa(e,r.project?.language),s=i.sourceRoots.flatMap(a=>kJe(mme(e,a),i.extensions));if(s.length===0)return[];let o=[];for(let a of s){let c;try{c=SJe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";gt();Kd();gme="AI_HINTS_FORBIDDEN_PATTERN";AJe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;yme={name:gme,run:IJe}});function PJe(t){let{cwd:e="."}=t,r;try{r=oe(e)}catch{return[]}let n=[];for(let i of r.features){let s=(i.acceptance_criteria??[]).map(a=>a.id),o=new Map;for(let a of s)o.set(a,(o.get(a)??0)+1);for(let[a,c]of o)c>1&&n.push({detector:vme,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var vme,_me,Sme=S(()=>{"use strict";gt();vme="AC_DUPLICATE_WITHIN_FEATURE";_me={name:vme,run:PJe}});import{createRequire as RJe}from"module";import{basename as CJe,dirname as Pq,normalize as TJe,relative as OJe,resolve as NJe,sep as kme}from"path";import*as DJe from"fs";function jJe(t){let e=TJe(t);return e.length>1&&e[e.length-1]===kme&&(e=e.substring(0,e.length-1)),e}function Eme(t,e){return t.replace(LJe,e)}function FJe(t){return t==="/"||MJe.test(t)}function Iq(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,s=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=NJe(t)),(n||s)&&(t=jJe(t)),t===".")return"";let o=t[t.length-1]!==i;return Eme(o?t+i:t,i)}function Ame(t,e){return e+t}function zJe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:Eme(OJe(t,n),e.pathSeparator)+e.pathSeparator+r}}function UJe(t){return t}function BJe(t,e,r){return e+t+r}function qJe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?zJe(t,e):n?Ame:UJe}function VJe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function GJe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(s=>s(i,!0))&&r.push(i)}}function JJe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?GJe(t):VJe(t):n&&n.length?WJe:HJe:ZJe}function tKe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?eKe:r&&r.length?n?KJe:YJe:n?XJe:QJe}function iKe(t){return t.group?nKe:rKe}function aKe(t){return t.group?sKe:oKe}function uKe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?lKe:cKe}function $me(t,e,r){if(r.options.useRealPaths)return dKe(e,r);let n=Pq(t),i=1;for(;n!==r.root&&i<2;){let s=r.symlinks.get(n);!!s&&(s===e||s.startsWith(e)||e.startsWith(s))?i++:n=Pq(n)}return r.symlinks.set(t,e),i>1}function dKe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function qR(t,e,r,n){e(t&&!n?t:null,r)}function _Ke(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?pKe:gKe:n?e?fKe:vKe:i?e?mKe:bKe:e?hKe:yKe}function xKe(t){return t?wKe:SKe}function $Ke(t,e){return new Promise((r,n)=>{Rme(t,e,(i,s)=>{if(i)return n(i);r(s)})})}function Rme(t,e,r){new Pme(t,e,r).start()}function IKe(t,e){return new Pme(t,e).start()}var wme,LJe,MJe,HJe,WJe,ZJe,KJe,YJe,XJe,QJe,eKe,rKe,nKe,sKe,oKe,cKe,lKe,pKe,fKe,hKe,mKe,gKe,yKe,bKe,vKe,Ime,SKe,wKe,kKe,EKe,AKe,Pme,xme,Cme,Tme,Ome=S(()=>{wme=RJe(import.meta.url);LJe=/[\\/]/g;MJe=/^[a-z]:[\\/]$/i;HJe=(t,e)=>{e.push(t||".")},WJe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},ZJe=()=>{};KJe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},YJe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},XJe=(t,e,r,n)=>{r.files++},QJe=(t,e)=>{e.push(t)},eKe=()=>{};rKe=t=>t,nKe=()=>[""].slice(0,0);sKe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},oKe=()=>{};cKe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:s}}=e;n.enqueue(),i.realpath(t,(o,a)=>{if(o)return n.dequeue(s?null:o,e);i.stat(a,(c,l)=>{if(c)return n.dequeue(s?null:c,e);if(l.isDirectory()&&$me(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},lKe=function(t,e,r){let{queue:n,fs:i,options:{suppressErrors:s}}=e;n.enqueue();try{let o=i.realpathSync(t),a=i.statSync(o);if(a.isDirectory()&&$me(t,o,e))return;r(a,o)}catch(o){if(!s)throw o}};pKe=t=>t.counts,fKe=t=>t.groups,hKe=t=>t.paths,mKe=t=>t.paths.slice(0,t.options.maxFiles),gKe=(t,e,r)=>(qR(e,r,t.counts,t.options.suppressErrors),null),yKe=(t,e,r)=>(qR(e,r,t.paths,t.options.suppressErrors),null),bKe=(t,e,r)=>(qR(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),vKe=(t,e,r)=>(qR(e,r,t.groups,t.options.suppressErrors),null);Ime={withFileTypes:!0},SKe=(t,e,r,n,i)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);let{fs:s}=t;t.visited.push(e),t.counts.directories++,s.readdir(e||".",Ime,(o,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:o,t)})},wKe=(t,e,r,n,i)=>{let{fs:s}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let o=[];try{o=s.readdirSync(e||".",Ime)}catch(a){if(!t.options.suppressErrors)throw a}i(o,r,n)};kKe=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))}},EKe=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}},AKe=class{aborted=!1;abort(){this.aborted=!0}},Pme=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=_Ke(e,this.isSynchronous),this.root=Iq(t,e),this.state={root:FJe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new EKe,options:e,queue:new kKe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new AKe,fs:e.fs||DJe},this.joinPath=qJe(this.root,e),this.pushDirectory=JJe(this.root,e),this.pushFile=tKe(e),this.getArray=iKe(e),this.groupFiles=aKe(e),this.resolveSymlink=uKe(e,this.isSynchronous),this.walkDirectory=xKe(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:s,excludeSymlinks:o,exclude:a,maxFiles:c,signal:l,useRealPaths:u,pathSeparator:d},controller:p}=this.state;if(p.aborted||l&&l.aborted||c&&n.length>c)return;let f=this.getArray(this.state.paths);for(let h=0;h{if(v.isDirectory()){if(g=Iq(g,this.state.options),a&&a(m.name,u?g:y+d))return;this.walkDirectory(this.state,g,u?g:y+d,r-1,this.walk)}else{g=u?g:y;let b=CJe(g),w=Iq(Pq(g),this.state.options);g=this.joinPath(b,w),this.pushFile(g,f,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,f)}};xme=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return $Ke(this.root,this.options)}withCallback(t){Rme(this.root,this.options,t)}sync(){return IKe(this.root,this.options)}},Cme=null;try{wme.resolve("picomatch"),Cme=wme("picomatch")}catch{}Tme=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:kme,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 xme(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new xme(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||Cme;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 V_=k((jqt,Mme)=>{"use strict";var Nme="[^\\\\/]",PKe="(?=.)",Dme="[^/]",Rq="(?:\\/|$)",jme="(?:^|\\/)",Cq=`\\.{1,2}${Rq}`,RKe="(?!\\.)",CKe=`(?!${jme}${Cq})`,TKe=`(?!\\.{0,1}${Rq})`,OKe=`(?!${Cq})`,NKe="[^.\\/]",DKe=`${Dme}*?`,jKe="/",Lme={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:PKe,QMARK:Dme,END_ANCHOR:Rq,DOTS_SLASH:Cq,NO_DOT:RKe,NO_DOTS:CKe,NO_DOT_SLASH:TKe,NO_DOTS_SLASH:OKe,QMARK_NO_DOT:NKe,STAR:DKe,START_ANCHOR:jme,SEP:jKe},LKe={...Lme,SLASH_LITERAL:"[\\\\/]",QMARK:Nme,STAR:`${Nme}*?`,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:"\\"},MKe={__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"};Mme.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:MKe,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?LKe:Lme}}});var G_=k(ki=>{"use strict";var{REGEX_BACKSLASH:FKe,REGEX_REMOVE_BACKSLASH:zKe,REGEX_SPECIAL_CHARS:UKe,REGEX_SPECIAL_CHARS_GLOBAL:BKe}=V_();ki.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);ki.hasRegexChars=t=>UKe.test(t);ki.isRegexChar=t=>t.length===1&&ki.hasRegexChars(t);ki.escapeRegex=t=>t.replace(BKe,"\\$1");ki.toPosixSlashes=t=>t.replace(FKe,"/");ki.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};ki.removeBackslashes=t=>t.replace(zKe,e=>e==="\\"?"":e);ki.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?ki.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};ki.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};ki.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s};ki.basename=(t,{windows:e}={})=>{let r=t.split(e?/[\\/]/:"/"),n=r[r.length-1];return n===""?r[r.length-2]:n}});var Hme=k((Mqt,Gme)=>{"use strict";var Fme=G_(),{CHAR_ASTERISK:Tq,CHAR_AT:qKe,CHAR_BACKWARD_SLASH:H_,CHAR_COMMA:VKe,CHAR_DOT:Oq,CHAR_EXCLAMATION_MARK:Nq,CHAR_FORWARD_SLASH:Vme,CHAR_LEFT_CURLY_BRACE:Dq,CHAR_LEFT_PARENTHESES:jq,CHAR_LEFT_SQUARE_BRACKET:GKe,CHAR_PLUS:HKe,CHAR_QUESTION_MARK:zme,CHAR_RIGHT_CURLY_BRACE:WKe,CHAR_RIGHT_PARENTHESES:Ume,CHAR_RIGHT_SQUARE_BRACKET:ZKe}=V_(),Bme=t=>t===Vme||t===H_,qme=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},JKe=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],c=t,l=-1,u=0,d=0,p=!1,f=!1,h=!1,m=!1,y=!1,v=!1,g=!1,b=!1,w=!1,x=!1,$=0,I,E,R={value:"",depth:0,isGlob:!1},A=()=>l>=n,B=()=>c.charCodeAt(l+1),Z=()=>(I=E,c.charCodeAt(++l));for(;l0&&(T=c.slice(0,u),c=c.slice(u),d-=u),ee&&h===!0&&d>0?(ee=c.slice(0,d),j=c.slice(d)):h===!0?(ee="",j=c):ee=c,ee&&ee!==""&&ee!=="/"&&ee!==c&&Bme(ee.charCodeAt(ee.length-1))&&(ee=ee.slice(0,-1)),r.unescape===!0&&(j&&(j=Fme.removeBackslashes(j)),ee&&g===!0&&(ee=Fme.removeBackslashes(ee)));let Ne={prefix:T,input:t,start:u,base:ee,glob:j,isBrace:p,isBracket:f,isGlob:h,isExtglob:m,isGlobstar:y,negated:b,negatedExtglob:w};if(r.tokens===!0&&(Ne.maxDepth=0,Bme(E)||o.push(R),Ne.tokens=o),r.parts===!0||r.tokens===!0){let U;for(let H=0;H{"use strict";var W_=V_(),Gi=G_(),{MAX_LENGTH:VR,POSIX_REGEX_SOURCE:KKe,REGEX_NON_SPECIAL_CHARS:YKe,REGEX_SPECIAL_CHARS_BACKREF:XKe,REPLACEMENTS:Wme}=W_,QKe=(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=>Gi.escapeRegex(i)).join("..")}return r},Sm=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,Zme=t=>{let e=[],r=0,n=0,i=0,s="",o=!1;for(let a of t){if(o===!0){s+=a,o=!1;continue}if(a==="\\"){s+=a,o=!0;continue}if(a==='"'){i=i===1?0:1,s+=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(s),s="";continue}}}s+=a}return e.push(s),e},e7e=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},Mq=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(e7e(e))return e.replace(/\\(.)/g,"$1")},t7e=t=>{let e=t.map(Mq).filter(Boolean);for(let r=0;r{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,s=!1;for(let o=1;o0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},r7e=t=>`${t.length===1?Gi.escapeRegex(t[0]):`[${t.map(r=>Gi.escapeRegex(r)).join("")}]`}*`,n7e=t=>{let e=0,r=[];for(;eo.trim());if(i.length!==1)return;let s=Mq(i[0]);if(!s||s.length!==1)return;r.push(s),e+=n.end+1}if(!(r.length<1))return r},i7e=t=>{let e=0,r=t.trim(),n=Lq(r);for(;n;)e++,r=n.body.trim(),n=Lq(r);return e},s7e=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:W_.DEFAULT_MAX_EXTGLOB_RECURSION,n=Zme(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||t7e(n)))return{risky:!0};let i=[],s=!1,o=!0;for(let a of n){let c=n7e(a);if(c){s=!0,i.push(...c);continue}let l=Mq(a);if(l&&l.length===1){i.push(l);continue}if(o=!1,i7e(a)>r)return{risky:!0}}return s?o?{risky:!0,safeOutput:r7e([...new Set(i)])}:{risky:!0}:{risky:!1}},Fq=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Wme[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(VR,r.maxLength):VR,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",c=W_.globChars(r.windows),l=W_.extglobChars(c),{DOT_LITERAL:u,PLUS_LITERAL:d,SLASH_LITERAL:p,ONE_CHAR:f,DOTS_SLASH:h,NO_DOT:m,NO_DOT_SLASH:y,NO_DOTS_SLASH:v,QMARK:g,QMARK_NO_DOT:b,STAR:w,START_ANCHOR:x}=c,$=C=>`(${a}(?:(?!${x}${C.dot?h:u}).)*?)`,I=r.dot?"":m,E=r.dot?g:b,R=r.bash===!0?$(r):w;r.capture&&(R=`(${R})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={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:o};t=Gi.removePrefix(t,A),i=t.length;let B=[],Z=[],ee=[],T=s,j,Ne=()=>A.index===i-1,U=A.peek=(C=1)=>t[A.index+C],H=A.advance=()=>t[++A.index]||"",Oe=()=>t.slice(A.index+1),F=(C="",z=0)=>{A.consumed+=C,A.index+=z},de=C=>{A.output+=C.output!=null?C.output:C.value,F(C.value)},Ft=()=>{let C=1;for(;U()==="!"&&(U(2)!=="("||U(3)==="?");)H(),A.start++,C++;return C%2===0?!1:(A.negated=!0,A.start++,!0)},Se=C=>{A[C]++,ee.push(C)},Jt=C=>{A[C]--,ee.pop()},xe=C=>{if(T.type==="globstar"){let z=A.braces>0&&(C.type==="comma"||C.type==="brace"),O=C.extglob===!0||B.length&&(C.type==="pipe"||C.type==="paren");C.type!=="slash"&&C.type!=="paren"&&!z&&!O&&(A.output=A.output.slice(0,-T.output.length),T.type="star",T.value="*",T.output=R,A.output+=T.output)}if(B.length&&C.type!=="paren"&&(B[B.length-1].inner+=C.value),(C.value||C.output)&&de(C),T&&T.type==="text"&&C.type==="text"){T.output=(T.output||T.value)+C.value,T.value+=C.value;return}C.prev=T,o.push(C),T=C},sr=(C,z)=>{let O={...l[z],conditions:1,inner:""};O.prev=T,O.parens=A.parens,O.output=A.output,O.startIndex=A.index,O.tokensIndex=o.length;let V=(r.capture?"(":"")+O.open;Se("parens"),xe({type:C,value:z,output:A.output?"":f}),xe({type:"paren",extglob:!0,value:H(),output:V}),B.push(O)},D=C=>{let z=t.slice(C.startIndex,A.index+1),O=t.slice(C.startIndex+2,A.index),V=s7e(O,r);if((C.type==="plus"||C.type==="star")&&V.risky){let ue=V.safeOutput?(C.output?"":f)+(r.capture?`(${V.safeOutput})`:V.safeOutput):void 0,rt=o[C.tokensIndex];rt.type="text",rt.value=z,rt.output=ue||Gi.escapeRegex(z);for(let ye=C.tokensIndex+1;ye1&&C.inner.includes("/")&&(ue=$(r)),(ue!==R||Ne()||/^\)+$/.test(Oe()))&&(re=C.close=`)$))${ue}`),C.inner.includes("*")&&(ge=Oe())&&/^\.[^\\/.]+$/.test(ge)){let rt=Fq(ge,{...e,fastpaths:!1}).output;re=C.close=`)${rt})${ue})`}C.prev.type==="bos"&&(A.negatedExtglob=!0)}xe({type:"paren",extglob:!0,value:j,output:re}),Jt("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let C=!1,z=t.replace(XKe,(O,V,re,ge,ue,rt)=>ge==="\\"?(C=!0,O):ge==="?"?V?V+ge+(ue?g.repeat(ue.length):""):rt===0?E+(ue?g.repeat(ue.length):""):g.repeat(re.length):ge==="."?u.repeat(re.length):ge==="*"?V?V+ge+(ue?R:""):R:V?O:`\\${O}`);return C===!0&&(r.unescape===!0?z=z.replace(/\\/g,""):z=z.replace(/\\+/g,O=>O.length%2===0?"\\\\":O?"\\":"")),z===t&&r.contains===!0?(A.output=t,A):(A.output=Gi.wrapOutput(z,A,e),A)}for(;!Ne();){if(j=H(),j==="\0")continue;if(j==="\\"){let O=U();if(O==="/"&&r.bash!==!0||O==="."||O===";")continue;if(!O){j+="\\",xe({type:"text",value:j});continue}let V=/^\\+/.exec(Oe()),re=0;if(V&&V[0].length>2&&(re=V[0].length,A.index+=re,re%2!==0&&(j+="\\")),r.unescape===!0?j=H():j+=H(),A.brackets===0){xe({type:"text",value:j});continue}}if(A.brackets>0&&(j!=="]"||T.value==="["||T.value==="[^")){if(r.posix!==!1&&j===":"){let O=T.value.slice(1);if(O.includes("[")&&(T.posix=!0,O.includes(":"))){let V=T.value.lastIndexOf("["),re=T.value.slice(0,V),ge=T.value.slice(V+2),ue=KKe[ge];if(ue){T.value=re+ue,A.backtrack=!0,H(),!s.output&&o.indexOf(T)===1&&(s.output=f);continue}}}(j==="["&&U()!==":"||j==="-"&&U()==="]")&&(j=`\\${j}`),j==="]"&&(T.value==="["||T.value==="[^")&&(j=`\\${j}`),r.posix===!0&&j==="!"&&T.value==="["&&(j="^"),T.value+=j,de({value:j});continue}if(A.quotes===1&&j!=='"'){j=Gi.escapeRegex(j),T.value+=j,de({value:j});continue}if(j==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&xe({type:"text",value:j});continue}if(j==="("){Se("parens"),xe({type:"paren",value:j});continue}if(j===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Sm("opening","("));let O=B[B.length-1];if(O&&A.parens===O.parens+1){D(B.pop());continue}xe({type:"paren",value:j,output:A.parens?")":"\\)"}),Jt("parens");continue}if(j==="["){if(r.nobracket===!0||!Oe().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Sm("closing","]"));j=`\\${j}`}else Se("brackets");xe({type:"bracket",value:j});continue}if(j==="]"){if(r.nobracket===!0||T&&T.type==="bracket"&&T.value.length===1){xe({type:"text",value:j,output:`\\${j}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Sm("opening","["));xe({type:"text",value:j,output:`\\${j}`});continue}Jt("brackets");let O=T.value.slice(1);if(T.posix!==!0&&O[0]==="^"&&!O.includes("/")&&(j=`/${j}`),T.value+=j,de({value:j}),r.literalBrackets===!1||Gi.hasRegexChars(O))continue;let V=Gi.escapeRegex(T.value);if(A.output=A.output.slice(0,-T.value.length),r.literalBrackets===!0){A.output+=V,T.value=V;continue}T.value=`(${a}${V}|${T.value})`,A.output+=T.value;continue}if(j==="{"&&r.nobrace!==!0){Se("braces");let O={type:"brace",value:j,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};Z.push(O),xe(O);continue}if(j==="}"){let O=Z[Z.length-1];if(r.nobrace===!0||!O){xe({type:"text",value:j,output:j});continue}let V=")";if(O.dots===!0){let re=o.slice(),ge=[];for(let ue=re.length-1;ue>=0&&(o.pop(),re[ue].type!=="brace");ue--)re[ue].type!=="dots"&&ge.unshift(re[ue].value);V=QKe(ge,r),A.backtrack=!0}if(O.comma!==!0&&O.dots!==!0){let re=A.output.slice(0,O.outputIndex),ge=A.tokens.slice(O.tokensIndex);O.value=O.output="\\{",j=V="\\}",A.output=re;for(let ue of ge)A.output+=ue.output||ue.value}xe({type:"brace",value:j,output:V}),Jt("braces"),Z.pop();continue}if(j==="|"){B.length>0&&B[B.length-1].conditions++,xe({type:"text",value:j});continue}if(j===","){let O=j,V=Z[Z.length-1];V&&ee[ee.length-1]==="braces"&&(V.comma=!0,O="|"),xe({type:"comma",value:j,output:O});continue}if(j==="/"){if(T.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",o.pop(),T=s;continue}xe({type:"slash",value:j,output:p});continue}if(j==="."){if(A.braces>0&&T.type==="dot"){T.value==="."&&(T.output=u);let O=Z[Z.length-1];T.type="dots",T.output+=j,T.value+=j,O.dots=!0;continue}if(A.braces+A.parens===0&&T.type!=="bos"&&T.type!=="slash"){xe({type:"text",value:j,output:u});continue}xe({type:"dot",value:j,output:u});continue}if(j==="?"){if(!(T&&T.value==="(")&&r.noextglob!==!0&&U()==="("&&U(2)!=="?"){sr("qmark",j);continue}if(T&&T.type==="paren"){let V=U(),re=j;(T.value==="("&&!/[!=<:]/.test(V)||V==="<"&&!/<([!=]|\w+>)/.test(Oe()))&&(re=`\\${j}`),xe({type:"text",value:j,output:re});continue}if(r.dot!==!0&&(T.type==="slash"||T.type==="bos")){xe({type:"qmark",value:j,output:b});continue}xe({type:"qmark",value:j,output:g});continue}if(j==="!"){if(r.noextglob!==!0&&U()==="("&&(U(2)!=="?"||!/[!=<:]/.test(U(3)))){sr("negate",j);continue}if(r.nonegate!==!0&&A.index===0){Ft();continue}}if(j==="+"){if(r.noextglob!==!0&&U()==="("&&U(2)!=="?"){sr("plus",j);continue}if(T&&T.value==="("||r.regex===!1){xe({type:"plus",value:j,output:d});continue}if(T&&(T.type==="bracket"||T.type==="paren"||T.type==="brace")||A.parens>0){xe({type:"plus",value:j});continue}xe({type:"plus",value:d});continue}if(j==="@"){if(r.noextglob!==!0&&U()==="("&&U(2)!=="?"){xe({type:"at",extglob:!0,value:j,output:""});continue}xe({type:"text",value:j});continue}if(j!=="*"){(j==="$"||j==="^")&&(j=`\\${j}`);let O=YKe.exec(Oe());O&&(j+=O[0],A.index+=O[0].length),xe({type:"text",value:j});continue}if(T&&(T.type==="globstar"||T.star===!0)){T.type="star",T.star=!0,T.value+=j,T.output=R,A.backtrack=!0,A.globstar=!0,F(j);continue}let C=Oe();if(r.noextglob!==!0&&/^\([^?]/.test(C)){sr("star",j);continue}if(T.type==="star"){if(r.noglobstar===!0){F(j);continue}let O=T.prev,V=O.prev,re=O.type==="slash"||O.type==="bos",ge=V&&(V.type==="star"||V.type==="globstar");if(r.bash===!0&&(!re||C[0]&&C[0]!=="/")){xe({type:"star",value:j,output:""});continue}let ue=A.braces>0&&(O.type==="comma"||O.type==="brace"),rt=B.length&&(O.type==="pipe"||O.type==="paren");if(!re&&O.type!=="paren"&&!ue&&!rt){xe({type:"star",value:j,output:""});continue}for(;C.slice(0,3)==="/**";){let ye=t[A.index+4];if(ye&&ye!=="/")break;C=C.slice(3),F("/**",3)}if(O.type==="bos"&&Ne()){T.type="globstar",T.value+=j,T.output=$(r),A.output=T.output,A.globstar=!0,F(j);continue}if(O.type==="slash"&&O.prev.type!=="bos"&&!ge&&Ne()){A.output=A.output.slice(0,-(O.output+T.output).length),O.output=`(?:${O.output}`,T.type="globstar",T.output=$(r)+(r.strictSlashes?")":"|$)"),T.value+=j,A.globstar=!0,A.output+=O.output+T.output,F(j);continue}if(O.type==="slash"&&O.prev.type!=="bos"&&C[0]==="/"){let ye=C[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(O.output+T.output).length),O.output=`(?:${O.output}`,T.type="globstar",T.output=`${$(r)}${p}|${p}${ye})`,T.value+=j,A.output+=O.output+T.output,A.globstar=!0,F(j+H()),xe({type:"slash",value:"/",output:""});continue}if(O.type==="bos"&&C[0]==="/"){T.type="globstar",T.value+=j,T.output=`(?:^|${p}|${$(r)}${p})`,A.output=T.output,A.globstar=!0,F(j+H()),xe({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-T.output.length),T.type="globstar",T.output=$(r),T.value+=j,A.output+=T.output,A.globstar=!0,F(j);continue}let z={type:"star",value:j,output:R};if(r.bash===!0){z.output=".*?",(T.type==="bos"||T.type==="slash")&&(z.output=I+z.output),xe(z);continue}if(T&&(T.type==="bracket"||T.type==="paren")&&r.regex===!0){z.output=j,xe(z);continue}(A.index===A.start||T.type==="slash"||T.type==="dot")&&(T.type==="dot"?(A.output+=y,T.output+=y):r.dot===!0?(A.output+=v,T.output+=v):(A.output+=I,T.output+=I),U()!=="*"&&(A.output+=f,T.output+=f)),xe(z)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Sm("closing","]"));A.output=Gi.escapeLast(A.output,"["),Jt("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Sm("closing",")"));A.output=Gi.escapeLast(A.output,"("),Jt("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Sm("closing","}"));A.output=Gi.escapeLast(A.output,"{"),Jt("braces")}if(r.strictSlashes!==!0&&(T.type==="star"||T.type==="bracket")&&xe({type:"maybe_slash",value:"",output:`${p}?`}),A.backtrack===!0){A.output="";for(let C of A.tokens)A.output+=C.output!=null?C.output:C.value,C.suffix&&(A.output+=C.suffix)}return A};Fq.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(VR,r.maxLength):VR,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=Wme[t]||t;let{DOT_LITERAL:s,SLASH_LITERAL:o,ONE_CHAR:a,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:u,NO_DOTS_SLASH:d,STAR:p,START_ANCHOR:f}=W_.globChars(r.windows),h=r.dot?u:l,m=r.dot?d:l,y=r.capture?"":"?:",v={negated:!1,prefix:""},g=r.bash===!0?".*?":p;r.capture&&(g=`(${g})`);let b=I=>I.noglobstar===!0?g:`(${y}(?:(?!${f}${I.dot?c:s}).)*?)`,w=I=>{switch(I){case"*":return`${h}${a}${g}`;case".*":return`${s}${a}${g}`;case"*.*":return`${h}${g}${s}${a}${g}`;case"*/*":return`${h}${g}${o}${a}${m}${g}`;case"**":return h+b(r);case"**/*":return`(?:${h}${b(r)}${o})?${m}${a}${g}`;case"**/*.*":return`(?:${h}${b(r)}${o})?${m}${g}${s}${a}${g}`;case"**/.*":return`(?:${h}${b(r)}${o})?${s}${a}${g}`;default:{let E=/^(.*?)\.(\w+)$/.exec(I);if(!E)return;let R=w(E[1]);return R?R+s+E[2]:void 0}}},x=Gi.removePrefix(t,v),$=w(x);return $&&r.strictSlashes!==!0&&($+=`${o}?`),$};Jme.exports=Fq});var Qme=k((zqt,Xme)=>{"use strict";var o7e=Hme(),zq=Kme(),Yme=G_(),a7e=V_(),c7e=t=>t&&typeof t=="object"&&!Array.isArray(t),Ir=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(p=>Ir(p,e,r));return p=>{for(let f of u){let h=f(p);if(h)return h}return!1}}let n=c7e(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||{},s=i.windows,o=n?Ir.compileRe(t,e):Ir.makeRe(t,e,!1,!0),a=o.state;delete o.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=Ir(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:p,match:f,output:h}=Ir.test(u,o,e,{glob:t,posix:s}),m={glob:t,state:a,regex:o,posix:s,input:u,output:h,match:f,isMatch:p};return typeof i.onResult=="function"&&i.onResult(m),p===!1?(m.isMatch=!1,d?m:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,d?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),d?m:!0)};return r&&(l.state=a),l};Ir.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 s=r||{},o=s.format||(i?Yme.toPosixSlashes:null),a=t===n,c=a&&o?o(t):t;return a===!1&&(c=o?o(t):t,a=c===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=Ir.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};Ir.matchBase=(t,e,r,n=r&&r.windows)=>(e instanceof RegExp?e:Ir.makeRe(e,r)).test(Yme.basename(t,{windows:n}));Ir.isMatch=(t,e,r)=>Ir(e,r)(t);Ir.parse=(t,e)=>Array.isArray(t)?t.map(r=>Ir.parse(r,e)):zq(t,{...e,fastpaths:!1});Ir.scan=(t,e)=>o7e(t,e);Ir.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=Ir.toRegex(a,e);return n===!0&&(c.state=t),c};Ir.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=zq.fastpaths(t,e)),i.output||(i=zq(t,e)),Ir.compileRe(i,e,r,n)};Ir.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/$^/}};Ir.constants=a7e;Xme.exports=Ir});var nge=k((Uqt,rge)=>{"use strict";var ege=Qme(),l7e=G_();function tge(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:l7e.isWindows()}),ege(t,e,r)}Object.assign(tge,ege);rge.exports=tge});import{readdir as u7e,readdirSync as d7e,realpath as p7e,realpathSync as f7e,stat as h7e,statSync as m7e}from"fs";import{isAbsolute as g7e,posix as Yd,resolve as y7e}from"path";import{fileURLToPath as b7e}from"url";function w7e(t,e={}){let r=t.length,n=Array(r),i=Array(r),s,o;for(s=0;s{let c=a.split("/");if(c[0]===".."&&S7e.test(a))return!0;for(s=0;ss.slice(i,o?-1:void 0)||"."}let n=e.slice(t.length+1);return n?(i,s)=>{if(i===".")return n;let o=`${n}/${i}`;return s?o.slice(0,-1):o}:(i,s)=>s&&i!=="."?i.slice(0,-1):i}return r?n=>Yd.relative(t,n)||".":n=>Yd.relative(t,`${e}/${n}`)||"."}function E7e(t,e){if(e.startsWith(`${t}/`)){let r=e.slice(t.length+1);return n=>`${r}/${n}`}return r=>{let n=Yd.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function sge(t){return t.replace(_7e,e=>`${e}/`)}function lge(t){var e;let r=wm.default.scan(t,A7e);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function T7e(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=wm.default.scan(t);return r.isGlob||r.negated}function Z_(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function uge(t){return typeof t=="string"?[t]:t??[]}function Uq(t,e,r,n){var i;let s=e.cwd,o=t;t[t.length-1]==="/"&&(o=t.slice(0,-1)),o[o.length-1]!=="*"&&e.expandDirectories&&(o+="/**");let a=C7e(s);o=g7e(o.replace(N7e,""))?Yd.relative(a,o):Yd.normalize(o);let c=(i=O7e.exec(o))===null||i===void 0?void 0:i[0],l=lge(o);if(c){let d=(c.length+1)/3,p=0,f=a.split("/");for(;ph.length&&(r.root=sge(h),r.depthOffset=-d+p)}if(!n&&r.depthOffset>=0){var u;(u=r.commonPath)!==null&&u!==void 0||(r.commonPath=l);let d=[],p=Math.min(r.commonPath.length,l.length);for(let f=0;f0?Yd.join(s,...d):s)}return o}function D7e(t,e,r){let n=[],i=[];for(let s of t.ignore)s&&(s[0]!=="!"||s[1]==="(")&&i.push(Uq(s,t,r,!0));for(let s of e)s&&(s[0]!=="!"||s[1]==="("?n.push(Uq(s,t,r,!1)):(s[1]!=="!"||s[2]==="(")&&i.push(Uq(s.slice(1),t,r,!0)));return{match:n,ignore:i}}function j7e(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=D7e(t,e,n);t.debug&&Z_("internal processing patterns:",i);let{absolute:s,caseSensitiveMatch:o,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(age,""),p={dot:c,nobrace:t.braceExpansion===!1,nocase:!o,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},f=(0,wm.default)(i.match,p),h=(0,wm.default)(i.ignore,p),m=w7e(i.match,p),y=ige(r,d,s),v=s?y:ige(r,d,!0),g=(x,$)=>{let I=v($,!0);return I!=="."&&!m(I)||h(I)},b;t.deep!==void 0&&(b=Math.round(t.deep-n.depthOffset));let w=new Tme({filters:[a?(x,$)=>{let I=y(x,$),E=f(I)&&!h(I);return E&&Z_(`matched ${I}`),E}:(x,$)=>{let I=y(x,$);return f(I)&&!h(I)}],exclude:a?(x,$)=>{let I=g(x,$);return Z_(`${I?"skipped":"crawling"} ${$}`),I}:g,fs:t.fs,pathSeparator:"/",relativePaths:!s,resolvePaths:s,includeBasePath:s,resolveSymlinks:l,excludeSymlinks:!l,excludeFiles:u,includeDirs:u||!t.onlyFiles,maxDepth:b,signal:t.signal}).crawl(d);return t.debug&&Z_("internal properties:",{...n,root:d}),[w,r!==d&&!s&&E7e(r,d)]}function L7e(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function M7e(t){let e=Object.assign({},t);for(let r in oge)e[r]===void 0&&Object.assign(e,{[r]:oge[r]});return e.cwd=(e.cwd instanceof URL?b7e(e.cwd):y7e(e.cwd||process.cwd())).replace(age,"/"),e.ignore=uge(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||u7e,readdirSync:e.fs.readdirSync||d7e,realpath:e.fs.realpath||p7e,realpathSync:e.fs.realpathSync||f7e,stat:e.fs.stat||h7e,statSync:e.fs.statSync||m7e}),e.debug&&Z_("globbing with options:",e),e}function F7e(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=v7e(t)||typeof t=="string",i=uge((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),s=M7e(n?e:t);return i.length>0?j7e(s,i):[]}function Bl(t,e){let[r,n]=F7e(t,e);return r?L7e(r.sync(),n):[]}var wm,v7e,age,_7e,cge,S7e,x7e,k7e,A7e,$7e,I7e,P7e,R7e,C7e,O7e,N7e,oge,J_=S(()=>{Ome();wm=Et(nge(),1),v7e=Array.isArray,age=/\\/g,_7e=/^[A-Za-z]:$/,cge=process.platform==="win32",S7e=/^(\/?\.\.)+$/;x7e=/^[A-Z]:\/$/i,k7e=cge?t=>x7e.test(t):t=>t==="/";A7e={parts:!0};$7e=/(?t.replace($7e,"\\$&"),R7e=t=>t.replace(I7e,"\\$&"),C7e=cge?R7e:P7e;O7e=/^(\/?\.\.)+/,N7e=/\\(?=[()[\]{}!*+?@|])/g;oge={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as K_,readFileSync as z7e,readdirSync as U7e,statSync as dge}from"node:fs";import{join as Xd}from"node:path";function B7e(t){let{cwd:e="."}=t,r,n;try{let c=oe(e);r=c.architecture,n=c.project?.language}catch{return[]}if(!r)return[];let i=sa(e,n),s=[],{layers:o,forbiddenImports:a}=Bq(r);return(o.size>0||a.length>0)&&!K_(Xd(e,i.mainRoot))?[{detector:Y_,severity:"info",path:`${i.mainRoot}/`,message:`architecture layers declared but ${i.mainRoot}/ not found \u2014 layer checks skipped (flat layout not yet supported)`}]:(o.size>0&&(q7e(e,i,o,s),V7e(e,i,o,s)),a.length>0&&G7e(e,i,a,s),s)}function Bq(t){let e=new Set,r=[];for(let i of t.layers??[])if(Array.isArray(i))for(let s of i)e.add(s);else{let s=i;if(typeof s.name=="string"&&s.name.length>0){e.add(s.name);for(let o of s.forbidden_imports??[])typeof o=="string"&&r.push({from:s.name,to:o})}}let n=t.forbidden_imports??[];return{layers:e,forbiddenImports:[...n,...r]}}function q7e(t,e,r,n){let i=e.mainRoot,s=Xd(t,i);if(K_(s))for(let o of U7e(s)){let a=Xd(s,o);dge(a).isDirectory()&&(r.has(o)||n.push({detector:Y_,severity:"warn",path:`${i}/${o}/`,message:`${i}/${o}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function V7e(t,e,r,n){let i=e.mainRoot,s=Xd(t,i);if(K_(s))for(let o of r){let a=Xd(s,o);K_(a)&&dge(a).isDirectory()||n.push({detector:Y_,severity:"warn",path:`${i}/${o}/`,message:`spec/architecture.yaml declares layer '${o}' but ${i}/${o}/ does not exist \u2014 fix the spec or create the directory`})}}function G7e(t,e,r,n){let i=e.mainRoot,s=e.importMatcher;for(let o of r){let a=Xd(t,i,o.from);if(!K_(a))continue;let c=Bl([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Xd(a,l),d;try{d=z7e(u,"utf8")}catch{continue}let p;for(s.lastIndex=0;(p=s.exec(d))!==null;){let f=p[1];H7e(f,o.to,e.importStyle)&&n.push({detector:Y_,severity:"error",path:`${i}/${o.from}/${l}`,message:`${i}/${o.from}/${l} imports from '${f}' which crosses into the '${o.to}' layer \u2014 spec/architecture.yaml forbids imports from '${o.from}' to '${o.to}'`})}}}}function H7e(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Y_,pge,qq=S(()=>{"use strict";J_();gt();Kd();Y_="ARCHITECTURE_FROM_SPEC";pge={name:Y_,run:B7e}});import{existsSync as W7e}from"node:fs";import{join as Z7e}from"node:path";function K7e(t){let{cwd:e="."}=t,r=Z7e(e,"spec/capabilities.yaml");if(!W7e(r))return[];let n,i,s=!1;try{let l=oe(e);n=l.capabilities??[],i=new Set(l.features.map(u=>u.id)),s=l.project.onboarding_seeded===!0}catch{return[]}if(n.length===0)return[];let o=[],a=new Set,c=s&&i.size{"use strict";gt();GR="CAPABILITIES_FEATURE_MAPPING",J7e=8;fge={name:GR,run:K7e}});import{existsSync as Y7e,readFileSync as X7e}from"node:fs";import{join as Q7e}from"node:path";function eYe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function tYe(t){let{cwd:e="."}=t;return Ue(e,Vq,r=>rYe(r,e))}function rYe(t,e){let r=sa(e,t.project?.language),n=[];for(let i of t.features)for(let s of i.modules??[]){if(!r.extensions.some(c=>s.endsWith(c)))continue;let o=Q7e(e,s);if(!Y7e(o))continue;let a=X7e(o,"utf8");eYe(a)||n.push({detector:Vq,severity:"warn",path:s,message:`${s} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var Vq,mge,gge=S(()=>{"use strict";Kd();vr();Vq="CONVENTION_DRIFT";mge={name:Vq,run:tYe}});import{existsSync as Gq,readFileSync as yge}from"node:fs";import{join as HR}from"node:path";function nYe(t){return JSON.parse(t).total?.lines?.pct??0}function bge(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function oYe(t,e){if(!mE(dr(t).gates.coverage?.cmd))return null;let r;try{r=gE(t,e)}catch(c){return[{detector:uc,severity:"error",message:c.message}]}let n=0,i=0,s=0,o=[];for(let c of r){let l=_q.find(d=>Gq(HR(c.dir,d)));if(!l){o.push(c.path);continue}let u=bge(yge(HR(c.dir,l),"utf8"));u&&(n+=u.missed,i+=u.covered,s++)}if(s===0)return[{detector:uc,severity:"info",message:`no module coverage report present for ${r.map(c=>c.path).join(", ")} \u2014 run stage_2.2 first`}];let a=vge(n,i);return a0?[{detector:uc,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${o.join(", ")}`}]:[]}function aYe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let c=oYe(e,t.focusModules);if(c)return c}let r;try{r=oe(e).project?.language}catch{}let n=sa(e,r),i=n.ext==="py"&&n.coverageFormat==="cobertura-xml",s=dr(e).language==="kotlin"?_q.find(c=>Gq(HR(e,c)))??eme(e):n.coverageSummary,o=HR(e,s);if(!Gq(o))return i?[]:[{detector:uc,severity:"info",message:`${s} not present \u2014 run stage_2.2 first`}];let a;try{let c=yge(o,"utf8");a=n.coverageFormat==="jacoco-xml"?iYe(c):n.coverageFormat==="cobertura-xml"?sYe(c):nYe(c)}catch(c){return[{detector:uc,severity:"warn",message:`${s} unparseable: ${c.message}`}]}return a===null?i?[]:[{detector:uc,severity:"warn",message:`${s} contained no line-coverage counter`}]:a>=WR?[]:[{detector:uc,severity:"warn",message:`line coverage ${a.toFixed(1)}% < floor ${WR}%`}]}var uc,WR,_ge,Sge=S(()=>{"use strict";gt();NR();Kd();yE();xs();uc="COVERAGE_DROP",WR=70;_ge={name:uc,run:aYe}});import{existsSync as cYe}from"node:fs";import{join as lYe}from"node:path";function dYe(t){let{cwd:e="."}=t;return Ue(e,ZR,r=>pYe(r,e))}function pYe(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";vr();ZR="DELIVERABLE_INTEGRITY",uYe=8;wge={name:ZR,run:dYe}});function fYe(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 s=(n.run??[]).join(" ")||`kind:${n.kind}`;r.push({detector:JR,severity:"warn",path:"spec.yaml",message:`smoke probe '${s}' 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 hYe(t){let e=fYe(t),r=(t.features??[]).filter(s=>s.status==="done");return r.length===0||!!!t.project?.deliverable||(t.project?.smoke??[]).length>0?e:[...e,{detector:JR,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 mYe(t){let{cwd:e="."}=t;return Ue(e,JR,r=>hYe(r))}var JR,kge,Ege=S(()=>{"use strict";vr();JR="SMOKE_PROBE_DEMAND";kge={name:JR,run:mYe}});import{existsSync as gYe}from"node:fs";import{join as yYe}from"node:path";function Hq(t){let e;try{e=(0,Age.parse)(t,{uniqueKeys:!0})}catch(i){throw new Pe(`The trust registry is not valid YAML: ${i.message}`)}if(e===null||typeof e!="object"||Array.isArray(e))throw new Pe("The trust registry must be a mapping.");let r=e;for(let i of Object.keys(r))if(i!=="schema"&&i!=="issuers")throw new Pe(`Unknown trust registry field ${i}.`);if(r.schema!==$ge)throw new Pe('The trust registry schema must be the string "1".');let n=r.issuers;if(!Array.isArray(n))throw new Pe("The trust registry requires an issuers sequence.");return Object.freeze(n.map(i=>{if(i===null||typeof i!="object"||Array.isArray(i))throw new Pe("Each trust registry issuer must be a mapping.");let s=i;for(let u of Object.keys(s))if(u!=="issuer"&&u!=="issuer_key_id"&&u!=="spki_der")throw new Pe(`Unknown trust registry issuer field ${u}.`);let o=s.issuer,a=s.issuer_key_id,c=s.spki_der;if(typeof o!="string"||o.trim().length===0)throw new Pe("A trust registry issuer name must be a non-empty string.");if(typeof a!="string"||!/^[a-f0-9]{64}$/.test(a))throw new Pe("A trust registry issuer_key_id must be a lowercase SHA-256 digest.");if(typeof c!="string"||c.length===0)throw new Pe("A trust registry spki_der must be base64 DER SubjectPublicKeyInfo bytes.");let l=new Uint8Array(Buffer.from(c,"base64"));if(Buffer.from(l).toString("base64")!==c)throw new Pe("A trust registry spki_der must be canonical base64.");return{issuer:o,issuerKeyId:a,spkiDer:l}}))}function bYe(t){let e=[...t].sort((n,i)=>`${n.issuer_key_id}\0${n.issuer}`<`${i.issuer_key_id}\0${i.issuer}`?-1:1),r=[`schema: "${$ge}"`,"issuers:"];if(e.length===0)return`${['schema: "1"',"issuers: []"].join(` +`)} +`;for(let n of e)r.push(` - issuer: ${JSON.stringify(n.issuer)}`),r.push(` issuer_key_id: ${n.issuer_key_id}`),r.push(` spki_der: ${n.spki_der}`);return`${r.join(` +`)} +`}function Wq(t){let e=Zq(t);return e===null?[]:Hq(e).map(r=>({issuer:r.issuer,issuer_key_id:r.issuerKeyId,spki_der:Buffer.from(r.spkiDer).toString("base64")}))}function X_(t){let e=Zq(t);return e===null?Ho():Nb(Hq(e))}function Ige(t,e){let r=Zq(t),n=r===null?[]:vYe(r),i=Db(e.spkiDer);if(n.some(o=>o.issuer===e.issuer))throw new Pe(`Issuer ${e.issuer} is already registered in ${Hi}.`);if(n.some(o=>o.issuer_key_id===i))throw new Pe(`Issuer key ${i} is already registered in ${Hi}.`);let s=bYe([...n,{issuer:e.issuer,issuer_key_id:i,spki_der:Buffer.from(e.spkiDer).toString("base64")}]);return{before:r,after:s,issuerKeyId:i}}function KR(t){return{get trustSnapshot(){try{return X_(t)}catch{return Ho()}},expectedDigestContext:e=>{try{return rh(t,Wn(t,Nr(t)))(e)}catch{return}}}}function Zq(t){try{return gYe(yYe(t,Hi))?Tr(t,Hi):null}catch(e){throw new Pe(`The trust registry could not be read safely: ${e.message}`)}}function vYe(t){return Hq(t).map(e=>({issuer:e.issuer,issuer_key_id:e.issuerKeyId,spki_der:Buffer.from(e.spkiDer).toString("base64")}))}var Age,Hi,$ge,xm=S(()=>{"use strict";Age=Et(cr(),1);gd();qn();kr();kn();Hi="spec/trust/issuers.yaml",$ge="1"});function YR(t,e){let r=X_(t),n=g_(t);if(n===void 0)return{trustSnapshot:r};let i=rh(t,e),s=n.map(o=>({path:o.path,bytes:o.bytes,expected:_Ye(o,i)}));return{trustSnapshot:r,receiptContext:{candidates:s.map(o=>({bytes:o.bytes,expected:o.expected})),trustSnapshot:r,currentLocations:s.map(o=>({path:o.path,expected:o.expected}))}}}function _Ye(t,e){try{return e(yr(t.bytes))??{}}catch{return{}}}var Jq=S(()=>{"use strict";kn();xm();Ol();gd()});function SYe(t){let{cwd:e="."}=t;return Ue(e,km,r=>wYe(r,e))}function wYe(t,e){let r=Bh(e,"generated-attestation"),n=r.resolvedPath??r.oldPath,i=r.presence!=="both"?[]:[{detector:km,severity:"error",path:r.newPath,message:`a verification attestation exists at both ${r.oldPath} and ${r.newPath} \u2014 remove the copy you do not keep (\`clad relocate-generated\` reports the same conflict).`}],s=(t.features??[]).filter(u=>u.status==="done"&&(t.schema==="0.2"||(u.modules??[]).length>0));if(s.length===0)return i;let o=io(e);if(o===null)return[...i,{detector:km,severity:"info",path:n,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 ${n}).`}];let a=o.v3!==null&&t.schema==="0.2"?xYe(e):void 0,c=a?.kind==="seals"?a.seals:void 0,l=[...i];for(let u of s){if(a?.kind==="census-unsafe"&&o.v3?.has(u.id)===!0){l.push({detector:km,severity:"warn",path:n,message:`${u.id}'s verification could not be checked \u2014 the evidence files under spec/evidence could not all be read safely, so whether its shipped code still matches its last attested verification is unknown. Remove any link or non-receipt file placed under spec/evidence, then run \`clad check --tier=pre-push --strict\`.`});continue}let d=o.v3?.has(u.id)===!0?(()=>{let p=c?.get(u.id);return p?oce(o,u.id,{contract_sha256:p.contractSha256,subject_sha256:p.subjectSha256,verification_sha256:p.verificationSha256,runtime_dependency_sha256:p.runtimeDependencySha256}):{state:"stale"}})():QI(o,e,u);d.state!=="fresh"&&l.push({detector:km,severity:"warn",path:n,message:d.state==="unattested"?`${u.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.`:"module"in d&&d.module?`${u.id}'s module ${d.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.`:`${u.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 l}function xYe(t){try{let e=Nr(t);if(e.schemaVersion!=="0.2")return;let r=Wn(t,e),{receiptContext:n}=YR(t,r);if(n===void 0)return{kind:"census-unsafe"};let i=n.candidates.length===0?r:Wn(t,e,n);return{kind:"seals",seals:new Map((e.contract?.features??[]).map(s=>[s.id,ml(i,s.id)]))}}catch{return}}var km,XR,Kq=S(()=>{"use strict";Ol();Jq();gd();qn();vr();Cd();km="STALE_ATTESTATION";XR={name:km,run:SYe}});function kYe(t){let{cwd:e="."}=t,r;try{r=oe(e)}catch{return[]}return EYe(r)}function EYe(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(p=>e.has(p)));let n=0,i=1,s=2,o=new Map;for(let d of r.keys())o.set(d,n);let a=[],c=new Set,l=[];function u(d){o.set(d,i),l.push(d);for(let p of r.get(d)??[]){let f=o.get(p);if(f===i){let h=l.indexOf(p),m=l.slice(h).concat(p),y=[...m].sort().join(",");c.has(y)||(c.add(y),a.push({detector:Pge,severity:"error",path:"spec.yaml",message:`circular depends_on cycle: ${m.join(" \u2192 ")} \u2014 these features can never all become ready, so the work never starts. Break the cycle by removing one edge.`}))}else f===n&&u(p)}l.pop(),o.set(d,s)}for(let d of r.keys())o.get(d)===n&&u(d);return a}var Pge,QR,Yq=S(()=>{"use strict";gt();Pge="DEPENDENCY_CYCLE";QR={name:Pge,run:kYe}});import{existsSync as AYe}from"node:fs";import{join as $Ye}from"node:path";function IYe(t){let{cwd:e="."}=t,r=Dr(e);if(r.length===0)return[{detector:Xq,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&&(AYe($Ye(e,i.artifact))||n.push({detector:Xq,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var Xq,Rge,Cge=S(()=>{"use strict";hi();Xq="EVIDENCE_MISMATCH";Rge={name:Xq,run:IYe}});import{existsSync as PYe,readFileSync as RYe}from"node:fs";import{join as CYe}from"node:path";function TYe(t){let e=CYe(t,Dge);if(!PYe(e))return null;try{let n=((0,Nge.parse)(RYe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*Oge(t,e){for(let r of t??[])r.startsWith(Tge)&&(yield{ref:r,name:r.slice(Tge.length),field:e})}function OYe(t){let{cwd:e="."}=t,r=TYe(e);if(r===null)return[];let n;try{n=oe(e)}catch(s){return[{detector:Qq,severity:"info",message:`spec.yaml not loaded: ${s.message}`}]}let i=[];for(let s of n.features)for(let o of s.acceptance_criteria??[]){let a=[...Oge(o.evidence_refs,"evidence_refs"),...Oge(o.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:Qq,severity:"warn",path:Dge,message:`${s.id}.${o.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var Nge,Qq,Tge,Dge,jge,Lge=S(()=>{"use strict";Nge=Et(cr(),1);gt();Qq="FIXTURE_REFERENCE_INVALID",Tge="fixture:",Dge="conformance/fixtures.yaml";jge={name:Qq,run:OYe}});import{existsSync as Em,readFileSync as eV}from"node:fs";import{join as Qd}from"node:path";function NYe(t){return Bl(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Q_(t){if(!Em(t))return null;try{return JSON.parse(eV(t,"utf8"))}catch{return null}}function DYe(t,e){let r=Qd(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(eV(r,"utf8"))}catch(c){e.push({detector:dc,severity:"info",message:`plugin.json not loaded: ${c.message}`});return}let i=n.ironclad?.current?.detectors;if(!i)return;let s=i.match(/^(\d+)\/(\d+)$/);if(!s){e.push({detector:dc,severity:"warn",message:`plugin.json current.detectors='${i}' is not in 'N/M' form`});return}let o=Number(s[1]),a=NYe(t);o!==a&&e.push({detector:dc,severity:"error",message:`plugin.json current.detectors='${i}' but stages/detectors/contains ${a} non-index .ts file(s)`})}function jYe(t,e){for(let r of Mge){let n=Qd(t,r.path);if(!Em(n))continue;let i=Q_(n);if(!i){e.push({detector:dc,severity:"warn",message:`${r.host}: ${r.path} could not be parsed as JSON`});continue}for(let s of r.required)(i[s]===void 0||i[s]===null||i[s]==="")&&e.push({detector:dc,severity:"error",message:`${r.host}: ${r.path} is missing required field '${String(s)}'`})}}function LYe(t,e){let r=Q_(Qd(t,"package.json"));if(!r?.version)return;let n=r.version;for(let s of Mge){let o=Qd(t,s.path);if(!Em(o))continue;let a=Q_(o);a?.version&&a.version!==n&&e.push({detector:dc,severity:"error",message:`${s.host}: ${s.path} version='${a.version}' but package.json version='${n}' \u2014 bump them in lockstep`})}let i=Qd(t,".claude-plugin","marketplace.json");if(Em(i)){let s=Q_(i);for(let o of s?.plugins??[])o?.version&&o.version!==n&&e.push({detector:dc,severity:"error",message:`marketplace: .claude-plugin/marketplace.json plugin '${o.name??"?"}' version='${o.version}' but package.json version='${n}' \u2014 the catalog advertises a stale version; bump it in lockstep`})}}function MYe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function FYe(t,e){let r=Qd(t,"src","cli","clad.ts"),n=Qd(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Em(r)||!Em(n))return;let i=MYe(eV(r,"utf8"));if(i.length===0)return;let o=Q_(n)?.ironclad?.current?.["stages-implemented"];if(!Array.isArray(o))return;let a=new Set(i),c=new Set(o),l=i.filter(p=>!c.has(p)),u=o.filter(p=>!a.has(p));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:dc,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 zYe(t){let{cwd:e="."}=t,r=[];return DYe(e,r),FYe(e,r),jYe(e,r),LYe(e,r),r}var dc,Mge,Fge,zge=S(()=>{"use strict";J_();dc="HARNESS_INTEGRITY",Mge=[{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"]}];Fge={name:dc,run:zYe}});import{existsSync as UYe,readFileSync as BYe}from"node:fs";import{join as qYe}from"node:path";function GYe(t){let{cwd:e="."}=t;return Ue(e,eC,r=>WYe(r,e))}function HYe(t){let e=qYe(t,"spec/capabilities.yaml");if(!UYe(e))return!1;try{let r=Uge.default.parse(BYe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function WYe(t,e){let r=t.features.length;if(r{"use strict";Uge=Et(cr(),1);vr();eC="HOLLOW_GOVERNANCE",VYe=8;Bge={name:eC,run:GYe}});function ZYe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function JYe(t,e,r){let n=t.split(/\r\n|\n|\r/g),i="",s=(Math.log10(e+1)|0)+1;for(let o=e-1;o<=e+1;o++){let a=n[o-1];a&&(i+=o.toString().padEnd(s," "),i+=": ",i+=a,i+=` +`,o===e&&(i+=" ".repeat(s+r+2),i+=`^ +`))}return i}var Be,ep=S(()=>{Be=class extends Error{line;column;codeblock;constructor(e,r){let[n,i]=ZYe(r.toml,r.ptr),s=JYe(r.toml,n,i);super(`Invalid TOML document: ${e} + +${s}`,r),this.line=n,this.column=i,this.codeblock=s}}});function KYe(t,e){let r=0;for(;t[e-++r]==="\\";);return--r&&r%2}function tC(t,e=0,r=t.length){let n=t.indexOf(` +`,e);return t[n-1]==="\r"&&n--,n<=r?n:-1}function Am(t,e){for(let r=e;r-1&&r!=="'"&&fIe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Dp=y(()=>{Xa();});var pIe,Qa,hC=y(()=>{pIe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,Qa=class t extends Date{#t=!1;#r=!1;#e=null;constructor(e){let r=!0,n=!0,i="Z";if(typeof e=="string"){let o=e.match(pIe);o?(o[1]||(r=!1,e=`0000-01-01T${e}`),n=!!o[2],n&&e[10]===" "&&(e=e.replace(" ","T")),o[2]&&+o[2]>23?e="":(i=o[3]||null,e=e.toUpperCase(),!i&&n&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=r,this.#r=n,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,r="Z"){let n=new t(e);return n.#e=r,n}static wrapAsLocalDateTime(e){let r=new t(e);return r.#e=null,r}static wrapAsLocalDate(e){let r=new t(e);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(e){let r=new t(e);return r.#t=!1,r.#e=null,r}}});function oS(t,e=0,r=t.length){let n=t[e]==="'",i=t[e++]===t[e]&&t[e]===t[e+1];i&&(r-=2,t[e+=2]==="\r"&&e++,t[e]===` -`&&e++);let o=0,s,a="",c=e;for(;e-1&&r!=="'"&&KYe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var eS=S(()=>{ep();});var YYe,tp,tV=S(()=>{YYe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,tp=class t extends Date{#t=!1;#r=!1;#e=null;constructor(e){let r=!0,n=!0,i="Z";if(typeof e=="string"){let s=e.match(YYe);s?(s[1]||(r=!1,e=`0000-01-01T${e}`),n=!!s[2],n&&e[10]===" "&&(e=e.replace(" ","T")),s[2]&&+s[2]>23?e="":(i=s[3]||null,e=e.toUpperCase(),!i&&n&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=r,this.#r=n,this.#e=i)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,r="Z"){let n=new t(e);return n.#e=r,n}static wrapAsLocalDateTime(e){let r=new t(e);return r.#e=null,r}static wrapAsLocalDate(e){let r=new t(e);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(e){let r=new t(e);return r.#t=!1,r.#e=null,r}}});function nC(t,e=0,r=t.length){let n=t[e]==="'",i=t[e++]===t[e]&&t[e]===t[e+1];i&&(r-=2,t[e+=2]==="\r"&&e++,t[e]===` +`&&e++);let s=0,o,a="",c=e;for(;e{Dp();hC();Xa();mIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,hIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,gIe=/^[+-]?0[0-9_]/,yIe=/^[0-9a-f]{2,8}$/i,R5={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function _Ie(t,e,r){let n=t.slice(e,r),i=n.indexOf("#");return i>-1&&(eu(t,i),n=n.slice(0,i)),[n.trimEnd(),i]}function Np(t,e,r,n,i){if(n===0)throw new ge("document contains excessively nested structures. aborting.",{toml:t,ptr:e});let o=t[e];if(o==="["||o==="{"){let[c,l]=o==="["?C5(t,e,n,i):P5(t,e,n,i);if(r){if(l=dn(t,l),t[l]===",")l++;else if(t[l]!==r)throw new ge("expected comma or end of structure",{toml:t,ptr:l})}return[c,l]}let s;if(o==='"'||o==="'"){s=iS(t,e);let c=oS(t,e,s);if(r){if(s=dn(t,s),t[s]&&t[s]!==","&&t[s]!==r&&t[s]!==` -`&&t[s]!=="\r")throw new ge("unexpected character encountered",{toml:t,ptr:s});s+=+(t[s]===",")}return[c,s]}s=T5(t,e,",",r);let a=_Ie(t,e,s-+(t[s-1]===","));if(!a[0])throw new ge("incomplete key-value declaration: no value specified",{toml:t,ptr:e});return r&&a[1]>-1&&(s=dn(t,e+a[1]),s+=+(t[s]===",")),[I5(a[0],t,e,i),s]}var yC=y(()=>{gC();_C();Dp();Xa();});function sS(t,e,r="="){let n=e-1,i=[],o=t.indexOf(r,e);if(o<0)throw new ge("incomplete key-value: cannot find end of key",{toml:t,ptr:e});do{let s=t[e=++n];if(s!==" "&&s!==" ")if(s==='"'||s==="'"){if(s===t[e+1]&&s===t[e+2])throw new ge("multiline strings are not allowed in keys",{toml:t,ptr:e});let a=iS(t,e);if(a<0)throw new ge("unfinished string encountered",{toml:t,ptr:e});n=t.indexOf(".",a);let c=t.slice(a,n<0||n>o?o:n),l=nS(c);if(l>-1)throw new ge("newlines are not allowed in keys",{toml:t,ptr:e+n+l});if(c.trimStart())throw new ge("found extra tokens after the string part",{toml:t,ptr:a});if(oo?o:n);if(!bIe.test(a))throw new ge("only letter, numbers, dashes and underscores are allowed in keys",{toml:t,ptr:e});i.push(a.trimEnd())}}while(n+1&&n{gC();yC();Dp();Xa();bIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function D5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{_C();yC();Dp();Xa();});function jp(t){let e=typeof t;if(e==="object"){if(Array.isArray(t))return"array";if(t instanceof Date)return"date"}return e}function vIe(t){for(let e=0;e{eS();tV();ep();XYe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,QYe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,eXe=/^[+-]?0[0-9_]/,tXe=/^[0-9a-f]{2,8}$/i,Gge={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function rXe(t,e,r){let n=t.slice(e,r),i=n.indexOf("#");return i>-1&&(Am(t,i),n=n.slice(0,i)),[n.trimEnd(),i]}function tS(t,e,r,n,i){if(n===0)throw new Be("document contains excessively nested structures. aborting.",{toml:t,ptr:e});let s=t[e];if(s==="["||s==="{"){let[c,l]=s==="["?Zge(t,e,n,i):Wge(t,e,n,i);if(r){if(l=Wi(t,l),t[l]===",")l++;else if(t[l]!==r)throw new Be("expected comma or end of structure",{toml:t,ptr:l})}return[c,l]}let o;if(s==='"'||s==="'"){o=rC(t,e);let c=nC(t,e,o);if(r){if(o=Wi(t,o),t[o]&&t[o]!==","&&t[o]!==r&&t[o]!==` +`&&t[o]!=="\r")throw new Be("unexpected character encountered",{toml:t,ptr:o});o+=+(t[o]===",")}return[c,o]}o=Vge(t,e,",",r);let a=rXe(t,e,o-+(t[o-1]===","));if(!a[0])throw new Be("incomplete key-value declaration: no value specified",{toml:t,ptr:e});return r&&a[1]>-1&&(o=Wi(t,e+a[1]),o+=+(t[o]===",")),[Hge(a[0],t,e,i),o]}var nV=S(()=>{rV();iV();eS();ep();});function iC(t,e,r="="){let n=e-1,i=[],s=t.indexOf(r,e);if(s<0)throw new Be("incomplete key-value: cannot find end of key",{toml:t,ptr:e});do{let o=t[e=++n];if(o!==" "&&o!==" ")if(o==='"'||o==="'"){if(o===t[e+1]&&o===t[e+2])throw new Be("multiline strings are not allowed in keys",{toml:t,ptr:e});let a=rC(t,e);if(a<0)throw new Be("unfinished string encountered",{toml:t,ptr:e});n=t.indexOf(".",a);let c=t.slice(a,n<0||n>s?s:n),l=tC(c);if(l>-1)throw new Be("newlines are not allowed in keys",{toml:t,ptr:e+n+l});if(c.trimStart())throw new Be("found extra tokens after the string part",{toml:t,ptr:a});if(ss?s:n);if(!nXe.test(a))throw new Be("only letter, numbers, dashes and underscores are allowed in keys",{toml:t,ptr:e});i.push(a.trimEnd())}}while(n+1&&n{rV();nV();eS();ep();nXe=/^[a-zA-Z0-9-_]+[ \t]*$/});function Jge(t,e,r,n){let i=e,s=r,o,a=!1,c;for(let l=0;l{iV();nV();eS();ep();});function rS(t){let e=typeof t;if(e==="object"){if(Array.isArray(t))return"array";if(t instanceof Date)return"date"}return e}function iXe(t){for(let e=0;e{j5=/^[a-z0-9-_]+$/i});var $C={};Nr($C,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>$Ie,parse:()=>bC,stringify:()=>xC});var $Ie,kC=y(()=>{N5();M5();hC();Xa();$Ie={parse:bC,stringify:xC,TomlDate:Qa,TomlError:ge}});import{cpSync as kIe,existsSync as jn,lstatSync as EIe,mkdirSync as AIe,readFileSync as uS,readlinkSync as OIe,readdirSync as TIe,rmSync as L5,writeFileSync as ec}from"node:fs";import{homedir as z5,platform as U5}from"node:os";import{basename as RIe,dirname as Ss,isAbsolute as IIe,join as he,relative as PIe,resolve as ws}from"node:path";import{fileURLToPath as CIe}from"node:url";import{spawnSync as q5}from"node:child_process";function aS(t){AIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(aS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return EIe(t).isSymbolicLink()}catch{return!1}}function jIe(t){try{return ws(Ss(t),OIe(t))}catch{return null}}function H5(t,e){let r=PIe(ws(e),ws(t));return r===""||!r.startsWith("..")&&!IIe(r)}function MIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",AC));if(n)try{let i=JSON.parse(n);typeof i.cladding_root=="string"&&r.push(ws(i.cladding_root))}catch{}return[...new Set(r)]}function lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=jIe(t);if(!r||!e.some(n=>H5(r,n)))return"skipped-different";try{return L5(t,{force:!0}),"removed"}catch{return"failed"}}function FIe(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of TIe(r)){if(!o.startsWith("cladding-"))continue;let s=lS(he(r,o),e);s==="removed"&&n++,s==="skipped-different"&&i++}return i>0?"skipped-different":n>0?"removed":"unchanged"}function Lp(t,e){if(!t||typeof t!="object")return!1;let r=t,n=Array.isArray(r.args)?r.args:[];return r.command==="clad"&&n[0]==="serve"||typeof r.description=="string"&&r.description.includes("wired by `clad setup`")||typeof r.description=="string"&&r.description.includes("project-scoped by `clad setup`")||r.command==="node"&&n[0]===OC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>H5(n[0],i))}function LIe(t,e){let r=t.split(` -`),n=r.findIndex(s=>s.trim()===e);if(n===-1)return null;let i=r.length;for(let s=n+1;s0&&r[o-1].trim()==="";)o--;return[...r.slice(0,o),...r.slice(i)].join(` -`)}async function zIe(t,e){let r=he(t,".codex","config.toml"),n=si(r);if(n==null)return"unchanged";try{let{parse:i,stringify:o}=await Promise.resolve().then(()=>(kC(),$C)),s=i(n),a=s.mcp_servers;if(!a?.cladding)return"unchanged";if(!Lp(a.cladding,e))return"skipped-different";delete a.cladding,Object.keys(a).length===0&&delete s.mcp_servers;let c=LIe(n,"[mcp_servers.cladding]");if(c!=null)try{if(JSON.stringify(i(c))===JSON.stringify(s))return ec(r,c,"utf8"),"removed"}catch{}return ec(r,o(s),"utf8"),"removed"}catch{return"failed"}}function UIe(t,e){let r=he(t,".cursor","mcp.json"),n=si(r);if(n==null)return"unchanged";try{let i=JSON.parse(n),o=i.mcpServers;return o?.cladding?Lp(o.cladding,e)?(delete o.cladding,Object.keys(o).length===0&&delete i.mcpServers,ec(r,`${JSON.stringify(i,null,2)} -`,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function qIe(t,e,r){let n=he(t,".gemini","config","plugins","cladding");if(cS(n))return"skipped-different";let i={command:"node",args:[he(e,"dist","clad.js"),"serve"]},o=Fp(he(n,"mcp_config.json"),i,r);if(o==="skipped-different"||o==="failed")return o;let s=`${JSON.stringify({$schema:"https://antigravity.google/schemas/v1/plugin.json",name:"cladding",description:"Spec-driven verification and onboarding for Antigravity CLI (machine-wide MCP wire; the project is resolved from each session\u2019s working directory)."},null,2)} -`;return tu([o,tc(he(n,"plugin.json"),s)])}function HIe(t,e){let r=he(t,".gemini","config","plugins","cladding");if(cS(r))return lS(r,e);let n=si(he(r,"mcp_config.json"));if(n==null)return"unchanged";try{let i=JSON.parse(n).mcpServers;return i?.cladding&&!Lp(i.cladding,e)?"skipped-different":"unchanged"}catch{return"skipped-different"}}function BIe(t){let e=U5()==="win32"?"where":"which";return q5(e,[t],{stdio:"ignore"}).status===0}function GIe(t){if(!t||!BIe("claude"))return"manual-required";let e=q5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:U5()==="win32"});if(e.status===0)return"removed";let r=`${e.stdout??""} -${e.stderr??""}`;return/not installed|not found/i.test(r)?"unchanged":"manual-required"}function ZIe(t){let e=he(t,"dist","clad.js");return["'use strict';","const {spawn} = require('node:child_process');",`const engine = ${JSON.stringify(e)};`,"const requested = process.argv.slice(2);","const args = requested.length > 0 ? requested : ['serve'];","const child = spawn(process.execPath, [engine, ...args], {cwd: process.cwd(), stdio: 'inherit'});","for (const signal of ['SIGINT', 'SIGTERM']) process.on(signal, () => child.kill(signal));","child.on('error', (error) => { console.error(`cladding project launcher: ${error.message}`); process.exitCode = 1; });","child.on('exit', (code, signal) => { process.exitCode = code ?? (signal ? 1 : 0); });",""].join(` -`)}function VIe(){return["[[rule]]",'mcpName = "cladding"','toolName = "*"','decision = "deny"',"priority = 100",'modes = ["plan"]',"interactive = false","","[[rule]]",'mcpName = "cladding"','toolName = ["clad_list_features", "clad_get_feature", "clad_run_check"]',"toolAnnotations = { readOnlyHint = true }",'decision = "allow"',"priority = 200",'modes = ["plan"]',"interactive = false","","[[rule]]",'toolName = "exit_plan_mode"','decision = "deny"',"priority = 200",'modes = ["plan"]',"interactive = false",""].join(` -`)}function WIe(t){let e=he(t,".git","info","exclude");if(!jn(Ss(e)))return;let r=["/.cladding/host/","/.cladding/setup-status.json"],n=si(e)??"",i=n.split(/\r?\n/),o=r.filter(a=>!i.includes(a));if(o.length===0)return;let s=n.length>0&&!n.endsWith(` +`:n}var Yge,Xge=S(()=>{Yge=/^[a-z0-9-_]+$/i});var uV={};Di(uV,{TomlDate:()=>tp,TomlError:()=>Be,default:()=>cXe,parse:()=>sV,stringify:()=>lV});var cXe,dV=S(()=>{Kge();Xge();tV();ep();cXe={parse:sV,stringify:lV,TomlDate:tp,TomlError:Be}});import{cpSync as lXe,existsSync as Es,lstatSync as uXe,mkdirSync as dXe,readFileSync as cC,readlinkSync as pXe,readdirSync as fXe,rmSync as eye,writeFileSync as rp}from"node:fs";import{homedir as tye,platform as rye}from"node:os";import{basename as hXe,dirname as ql,isAbsolute as mXe,join as ze,relative as gXe,resolve as Vl}from"node:path";import{fileURLToPath as yXe}from"node:url";import{spawnSync as nye}from"node:child_process";function sC(t){dXe(t,{recursive:!0})}function lo(t){try{return cC(t,"utf8")}catch{return null}}function np(t,e){let r=lo(t);return r===e?"unchanged":(sC(ql(t)),rp(t,e,"utf8"),r==null?"created":"rewired")}function oC(t){try{return uXe(t).isSymbolicLink()}catch{return!1}}function _Xe(t){try{return Vl(ql(t),pXe(t))}catch{return null}}function iye(t,e){let r=gXe(Vl(e),Vl(t));return r===""||!r.startsWith("..")&&!mXe(r)}function SXe(t,e){let r=[Vl(e)],n=lo(ze(t,".cladding",fV));if(n)try{let i=JSON.parse(n);typeof i.cladding_root=="string"&&r.push(Vl(i.cladding_root))}catch{}return[...new Set(r)]}function aC(t,e){if(!Es(t)&&!oC(t))return"unchanged";if(!oC(t))return"skipped-different";let r=_Xe(t);if(!r||!e.some(n=>iye(r,n)))return"skipped-different";try{return eye(t,{force:!0}),"removed"}catch{return"failed"}}function wXe(t,e){let r=ze(t,".agents","skills");if(!Es(r))return"unchanged";let n=0,i=0;for(let s of fXe(r)){if(!s.startsWith("cladding-"))continue;let o=aC(ze(r,s),e);o==="removed"&&n++,o==="skipped-different"&&i++}return i>0?"skipped-different":n>0?"removed":"unchanged"}function sS(t,e){if(!t||typeof t!="object")return!1;let r=t,n=Array.isArray(r.args)?r.args:[];return r.command==="clad"&&n[0]==="serve"||typeof r.description=="string"&&r.description.includes("wired by `clad setup`")||typeof r.description=="string"&&r.description.includes("project-scoped by `clad setup`")||r.command==="node"&&n[0]===hV?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>iye(n[0],i))}function xXe(t,e){let r=t.split(` +`),n=r.findIndex(o=>o.trim()===e);if(n===-1)return null;let i=r.length;for(let o=n+1;o0&&r[s-1].trim()==="";)s--;return[...r.slice(0,s),...r.slice(i)].join(` +`)}async function kXe(t,e){let r=ze(t,".codex","config.toml"),n=lo(r);if(n==null)return"unchanged";try{let{parse:i,stringify:s}=await Promise.resolve().then(()=>(dV(),uV)),o=i(n),a=o.mcp_servers;if(!a?.cladding)return"unchanged";if(!sS(a.cladding,e))return"skipped-different";delete a.cladding,Object.keys(a).length===0&&delete o.mcp_servers;let c=xXe(n,"[mcp_servers.cladding]");if(c!=null)try{if(JSON.stringify(i(c))===JSON.stringify(o))return rp(r,c,"utf8"),"removed"}catch{}return rp(r,s(o),"utf8"),"removed"}catch{return"failed"}}function EXe(t,e){let r=ze(t,".cursor","mcp.json"),n=lo(r);if(n==null)return"unchanged";try{let i=JSON.parse(n),s=i.mcpServers;return s?.cladding?sS(s.cladding,e)?(delete s.cladding,Object.keys(s).length===0&&delete i.mcpServers,rp(r,`${JSON.stringify(i,null,2)} +`,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function AXe(t,e,r){let n=ze(t,".gemini","config","plugins","cladding");if(oC(n))return"skipped-different";let i={command:"node",args:[ze(e,"dist","clad.js"),"serve"]},s=iS(ze(n,"mcp_config.json"),i,r);if(s==="skipped-different"||s==="failed")return s;let o=`${JSON.stringify({$schema:"https://antigravity.google/schemas/v1/plugin.json",name:"cladding",description:"Spec-driven verification and onboarding for Antigravity CLI (machine-wide MCP wire; the project is resolved from each session\u2019s working directory)."},null,2)} +`;return $m([s,np(ze(n,"plugin.json"),o)])}function $Xe(t,e){let r=ze(t,".gemini","config","plugins","cladding");if(oC(r))return aC(r,e);let n=lo(ze(r,"mcp_config.json"));if(n==null)return"unchanged";try{let i=JSON.parse(n).mcpServers;return i?.cladding&&!sS(i.cladding,e)?"skipped-different":"unchanged"}catch{return"skipped-different"}}function IXe(t){let e=rye()==="win32"?"where":"which";return nye(e,[t],{stdio:"ignore"}).status===0}function PXe(t){if(!t||!IXe("claude"))return"manual-required";let e=nye("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:rye()==="win32"});if(e.status===0)return"removed";let r=`${e.stdout??""} +${e.stderr??""}`;return/not installed|not found/i.test(r)?"unchanged":"manual-required"}function RXe(t){let e=ze(t,"dist","clad.js");return["'use strict';","const {spawn} = require('node:child_process');",`const engine = ${JSON.stringify(e)};`,"const requested = process.argv.slice(2);","const args = requested.length > 0 ? requested : ['serve'];","const child = spawn(process.execPath, [engine, ...args], {cwd: process.cwd(), stdio: 'inherit'});","for (const signal of ['SIGINT', 'SIGTERM']) process.on(signal, () => child.kill(signal));","child.on('error', (error) => { console.error(`cladding project launcher: ${error.message}`); process.exitCode = 1; });","child.on('exit', (code, signal) => { process.exitCode = code ?? (signal ? 1 : 0); });",""].join(` +`)}function CXe(){return["[[rule]]",'mcpName = "cladding"','toolName = "*"','decision = "deny"',"priority = 100",'modes = ["plan"]',"interactive = false","","[[rule]]",'mcpName = "cladding"','toolName = ["clad_list_features", "clad_get_feature", "clad_run_check"]',"toolAnnotations = { readOnlyHint = true }",'decision = "allow"',"priority = 200",'modes = ["plan"]',"interactive = false","","[[rule]]",'toolName = "exit_plan_mode"','decision = "deny"',"priority = 200",'modes = ["plan"]',"interactive = false",""].join(` +`)}function TXe(t){let e=ze(t,".git","info","exclude");if(!Es(ql(e)))return;let r=["/.cladding/host/","/.cladding/setup-status.json"],n=lo(e)??"",i=n.split(/\r?\n/),s=r.filter(a=>!i.includes(a));if(s.length===0)return;let o=n.length>0&&!n.endsWith(` `)?` -`:"";ec(e,`${n}${s}${o.join(` +`:"";rp(e,`${n}${o}${s.join(` `)} -`,"utf8")}function KIe(){return{command:"node",args:[OC]}}function EC(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- -`))return"failed";let i=RIe(e),o=/^name:\s*.*$/m.test(n)?n.replace(/^name:\s*.*$/m,`name: ${i}`):n.replace(/^---\n/,`--- +`,"utf8")}function OXe(){return{command:"node",args:[hV]}}function pV(t,e,r){if(!Es(t))return"failed";let n=lo(ze(t,"SKILL.md"));if(n==null||!n.startsWith(`--- +`))return"failed";let i=hXe(e),s=/^name:\s*.*$/m.test(n)?n.replace(/^name:\s*.*$/m,`name: ${i}`):n.replace(/^---\n/,`--- name: ${i} -`);if(jn(e)){let s=si(he(e,"SKILL.md"));if(s===o)return"unchanged";if(!r&&s!=null&&!s.includes("# Cladding init"))return"skipped-different";L5(e,{recursive:!0,force:!0})}return aS(Ss(e)),kIe(t,e,{recursive:!0,dereference:!0}),ec(he(e,"SKILL.md"),o,"utf8"),"created"}function Fp(t,e,r){try{let n=si(t),i=n==null?{}:JSON.parse(n);(!i.mcpServers||typeof i.mcpServers!="object")&&(i.mcpServers={});let o=i.mcpServers,s=o.cladding,a={command:e.command,args:e.args};return JSON.stringify(s)===JSON.stringify(a)?"unchanged":s&&!r&&!Lp(s,[])?"skipped-different":(o.cladding=a,tc(t,`${JSON.stringify(i,null,2)} -`))}catch{return"failed"}}function JIe(t){try{let e=si(t),r=e==null?{}:JSON.parse(e),n=r.permissions;if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))return"skipped-different";let i=n??{},o=i.allow;if(o!==void 0&&(!Array.isArray(o)||o.some(u=>typeof u!="string")))return"skipped-different";let s=i.deny;if(s!==void 0&&(!Array.isArray(s)||s.some(u=>typeof u!="string")))return"skipped-different";let a=o??[],c=s??[],l=[...a];for(let u of NIe)l.includes(u)||l.push(u);return l.length===a.length&&s!==void 0?"unchanged":(i.allow=l,i.deny=c,r.permissions=i,tc(t,`${JSON.stringify(r,null,2)} -`))}catch{return"failed"}}async function YIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>(kC(),$C)),o=si(t),s=o==null?{}:n(o);(!s.mcp_servers||typeof s.mcp_servers!="object")&&(s.mcp_servers={});let a=s.mcp_servers,c=a.cladding,l={command:e.command,args:e.args,description:"cladding MCP server (project-scoped by `clad setup`)",default_tools_approval_mode:"writes"};return JSON.stringify(c)===JSON.stringify(l)?"unchanged":c&&!r&&!Lp(c,[])?"skipped-different":(a.cladding=l,tc(t,i(s)))}catch{return"failed"}}function XIe(t){let e=["---","description: Cladding bootstrap boundary","alwaysApply: true","---","","Cladding is available only in this project. Do not initialize or invoke Cladding for ordinary work.","Use the cladding-init skill only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it.",""].join(` -`);return tc(he(t,".cursor","rules","cladding-bootstrap.mdc"),e)}function tu(t){return t.includes("failed")?"failed":t.includes("skipped-different")?"skipped-different":t.includes("manual-required")?"manual-required":t.includes("removed")?"removed":t.includes("rewired")?"rewired":t.includes("created")?"created":"unchanged"}function B5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function F5(t,e,r,n){t==="failed"&&r.push({step:e,message:"project wiring failed"}),t==="skipped-different"&&n.push({step:e,message:"existing non-Cladding configuration was preserved; use --force to replace only the cladding entry"}),t==="manual-required"&&n.push({step:e,message:"run `claude plugin uninstall claude-code@cladding --scope user --keep-data` to remove the legacy user plugin"})}async function RC(t={}){let e=t.home??z5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??G5(),i=t.version??Z5(n),o=ePe(e),s=new Set(t.hosts??DIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",AC),l=B5(c),u=[],d=[];aS(r),WIe(r);let f=[tc(he(r,OC),ZIe(n))];s.has("gemini")&&f.push(tc(he(r,TC),VIe()));let p=tu(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?EC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=KIe(),b=MIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?GIe(t.activate??!0):"unchanged",x={claude_plugin:tu([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:HIe(e,b),codex_skills:FIe(e,b),codex_mcp:await zIe(e,b),cursor_mcp:UIe(e,b)},w=s.has("codex")?await YIe(he(r,".codex","config.toml"),g,a):"skipped-not-selected",R=s.has("gemini")?Fp(he(r,".gemini","settings.json"),g,a):"skipped-not-selected",A=s.has("antigravity")?tu([Fp(he(r,".agents","mcp_config.json"),g,a),qIe(e,n,a)]):"skipped-not-selected",O=s.has("claude")?tu([EC(m,he(r,".claude","skills","cladding-init"),a),Fp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?tu([EC(m,he(r,".cursor","skills","cladding-init"),a),Fp(he(r,".cursor","mcp.json"),g,a),JIe(he(r,".cursor","cli.json")),XIe(r)]):"skipped-not-selected",E={runtime:p,shared_init_skill:h,claude:O,codex:w,gemini:R,antigravity:A,cursor:D};s.size===0&&d.push({step:"hosts",message:"no supported AI host detected on this machine \u2014 only the shared runtime was written; use `clad setup --host ` to wire explicitly"});for(let[X,J]of Object.entries(E))F5(J,X,u,d);for(let[X,J]of Object.entries(x))F5(J,`legacy:${X}`,u,d);aS(Ss(c)),ec(c,`${JSON.stringify({project_root:r,cladding_root:n,cladding_version:i,last_run:new Date().toISOString()},null,2)} -`,"utf8");let ae={projectRoot:r,wiring:E,legacyCleanup:x,errors:u,warnings:d,statusFile:c,cladding_root:n,cladding_version:i,last_setup_version:l};return t.quiet||process.stdout.write(`${QIe(ae)} -`),ae}function Mp(t){switch(t){case"created":return"wired";case"rewired":return"updated";case"unchanged":return"already ready";case"removed":return"legacy global removed";case"skipped-not-selected":return"not selected";case"skipped-different":return"preserved conflict";case"manual-required":return"manual cleanup required";default:return"failed"}}function QIe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${Mp(t.wiring.claude)}`,` Codex \u2192 ${Mp(t.wiring.codex)}`,` Gemini CLI \u2192 ${Mp(t.wiring.gemini)}`,` Antigravity \u2192 ${Mp(t.wiring.antigravity)}`,` Cursor \u2192 ${Mp(t.wiring.cursor)}`];(t.wiring.antigravity==="created"||t.wiring.antigravity==="rewired")&&r.push(""," Note: Antigravity reads MCP config machine-wide only, so its wire lives in ~/.gemini/config/plugins/cladding (each session still resolves the project from its working directory).");let n=Object.values(t.legacyCleanup).filter(i=>i==="removed").length;n>0&&r.push("",`Removed ${n} legacy global Cladding wire(s).`);for(let i of t.warnings)r.push(` ! ${i.step}: ${i.message}`);return r.push("","Next steps:"," 1. Start a new AI session in this project directory",' 2. Ask: "Apply Cladding to this project"'," 3. Review the preview and reply with its exact approval phrase"," 4. After initialization, develop normally in natural language"),r.join(` -`)}function G5(){let t=CIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function Z5(t){for(let e of["package.json",he(".claude-plugin","plugin.json")])try{let r=JSON.parse(uS(he(t,e),"utf8")).version;if(typeof r=="string"&&r.length>0)return r}catch{}return"unknown"}function fn(t=G5()){let e=Z5(t);return e==="unknown"?null:e}function V5(t=process.cwd()){return B5(he(ws(t),".cladding",AC))}function ePe(t=z5()){return{claude:jn(he(t,".claude")),gemini:jn(he(t,".gemini")),antigravity:jn(he(t,".gemini","config"))||jn(he(t,".gemini","antigravity-cli")),codex:jn(he(t,".codex")),agents:jn(he(t,".agents")),cursor:jn(he(t,".cursor"))}}var AC,OC,TC,DIe,NIe,ru=y(()=>{"use strict";AC="setup-status.json",OC=he(".cladding","host","serve.cjs"),TC=".cladding/host/gemini-doctor-policy.toml",DIe=["claude","codex","gemini","antigravity","cursor"],NIe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as W5,readFileSync as K5}from"node:fs";import{join as J5}from"node:path";function Y5(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 sPe(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 X5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function Q5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function aPe(t,e){let r=Q5(t),n=Q5(e);if(!r||!n)return!1;for(let i=0;ioPe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(nPe)?.[1],s=fn();return o!==void 0&&s!==null&&aPe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function lPe(t){let e=J5(t,"README.md"),r=J5(t,"docs","dogfood","matrix.md");if(!W5(e)||!W5(r))return[];let n=K5(e,"utf8"),i=K5(r,"utf8"),o=Y5(n,tPe),s=Y5(i,rPe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=X5(d);if(f===null)continue;let p=s[u]??"not-run",m=sPe(p);m!==null&&f>m&&a.push({detector:IC,severity:"warn",path:"README.md",message:`README host-claims: '${u}' claims '${d}' but the newest matrix evidence is '${p}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${u}'.`})}let l=Object.values(o).some(u=>X5(u)!==null)?cPe(i,Date.now()):[];return l.length>0&&a.push({detector:IC,severity:"info",path:"docs/dogfood/matrix.md",message:`Host support evidence needs a fresh receipt: ${l.join("; ")}. Re-run \`clad doctor --hosts\` with consent; existing contradictory-claim warnings are unchanged.`}),a}function uPe(t){let{cwd:e="."}=t;return lPe(e)}var IC,tPe,rPe,nPe,iPe,oPe,eY,tY=y(()=>{"use strict";ru();IC="HOST_CLAIM_DRIFT",tPe=//,rPe=//,nPe=/^- Cladding version:\s*`([^`]+)`\s*$/m,iPe=/^- Generated:\s*(\S+)\s*$/m,oPe=720*60*60*1e3;eY={name:IC,run:uPe}});function dPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return rY(r.features.map(i=>i.id),"feature","spec/features/",n),rY((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function rY(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:nY,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var nY,iY,oY=y(()=>{"use strict";Ue();nY="ID_COLLISION";iY={name:nY,run:dPe}});import{existsSync as zp,readFileSync as PC,readdirSync as CC,statSync as fPe,writeFileSync as aY}from"node:fs";import{join as Oo}from"node:path";function sY(t){if(!zp(t))return 0;try{return CC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function pPe(t){if(!zp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=CC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Oo(n,o),a;try{a=fPe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function mPe(t){let e=Oo(t,"spec","capabilities.yaml");if(!zp(e))return 0;try{let r=dS.default.parse(PC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=sY(Oo(t,"spec","features")),r=sY(Oo(t,"spec","scenarios")),n=mPe(t),i=pPe(Oo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function nu(t,e){let r=Oo(t,"spec.yaml");if(!zp(r))return;let n=PC(r,"utf8"),i=hPe(n,e);i!==n&&aY(r,i)}function hPe(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 -`?d.replace(/\n/g,`\r -`):d;if(i<0){let d=n.join(` -`).replace(/\n+$/,"");return d.length>0&&(d+=` -`),s(`${d} -${o.join(` +`);if(Es(e)){let o=lo(ze(e,"SKILL.md"));if(o===s)return"unchanged";if(!r&&o!=null&&!o.includes("# Cladding init"))return"skipped-different";eye(e,{recursive:!0,force:!0})}return sC(ql(e)),lXe(t,e,{recursive:!0,dereference:!0}),rp(ze(e,"SKILL.md"),s,"utf8"),"created"}function iS(t,e,r){try{let n=lo(t),i=n==null?{}:JSON.parse(n);(!i.mcpServers||typeof i.mcpServers!="object")&&(i.mcpServers={});let s=i.mcpServers,o=s.cladding,a={command:e.command,args:e.args};return JSON.stringify(o)===JSON.stringify(a)?"unchanged":o&&!r&&!sS(o,[])?"skipped-different":(s.cladding=a,np(t,`${JSON.stringify(i,null,2)} +`))}catch{return"failed"}}function NXe(t){try{let e=lo(t),r=e==null?{}:JSON.parse(e),n=r.permissions;if(n!==void 0&&(typeof n!="object"||n===null||Array.isArray(n)))return"skipped-different";let i=n??{},s=i.allow;if(s!==void 0&&(!Array.isArray(s)||s.some(u=>typeof u!="string")))return"skipped-different";let o=i.deny;if(o!==void 0&&(!Array.isArray(o)||o.some(u=>typeof u!="string")))return"skipped-different";let a=s??[],c=o??[],l=[...a];for(let u of vXe)l.includes(u)||l.push(u);return l.length===a.length&&o!==void 0?"unchanged":(i.allow=l,i.deny=c,r.permissions=i,np(t,`${JSON.stringify(r,null,2)} +`))}catch{return"failed"}}async function DXe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>(dV(),uV)),s=lo(t),o=s==null?{}:n(s);(!o.mcp_servers||typeof o.mcp_servers!="object")&&(o.mcp_servers={});let a=o.mcp_servers,c=a.cladding,l={command:e.command,args:e.args,description:"cladding MCP server (project-scoped by `clad setup`)",default_tools_approval_mode:"writes"};return JSON.stringify(c)===JSON.stringify(l)?"unchanged":c&&!r&&!sS(c,[])?"skipped-different":(a.cladding=l,np(t,i(o)))}catch{return"failed"}}function jXe(t){let e=["---","description: Cladding bootstrap boundary","alwaysApply: true","---","","Cladding is available only in this project. Do not initialize or invoke Cladding for ordinary work.","Use the cladding-init skill only when the user explicitly names Cladding and asks to initialize, adopt, or refresh it.",""].join(` +`);return np(ze(t,".cursor","rules","cladding-bootstrap.mdc"),e)}function $m(t){return t.includes("failed")?"failed":t.includes("skipped-different")?"skipped-different":t.includes("manual-required")?"manual-required":t.includes("removed")?"removed":t.includes("rewired")?"rewired":t.includes("created")?"created":"unchanged"}function sye(t){try{return JSON.parse(cC(t,"utf8")).cladding_version??null}catch{return null}}function Qge(t,e,r,n){t==="failed"&&r.push({step:e,message:"project wiring failed"}),t==="skipped-different"&&n.push({step:e,message:"existing non-Cladding configuration was preserved; use --force to replace only the cladding entry"}),t==="manual-required"&&n.push({step:e,message:"run `claude plugin uninstall claude-code@cladding --scope user --keep-data` to remove the legacy user plugin"})}async function gV(t={}){let e=t.home??tye(),r=Vl(t.projectRoot??process.cwd()),n=t.pkgRoot??oye(),i=t.version??aye(n),s=MXe(e),o=new Set(t.hosts??bXe.filter(Z=>s[Z])),a=t.force??!1,c=ze(r,".cladding",fV),l=sye(c),u=[],d=[];sC(r),TXe(r);let p=[np(ze(r,hV),RXe(n))];o.has("gemini")&&p.push(np(ze(r,mV),CXe()));let f=$m(p),h=ze(n,"plugins","codex","skills","init"),m=o.has("codex")||o.has("gemini")||o.has("antigravity")?pV(h,ze(r,".agents","skills","cladding-init"),a):"unchanged",y=OXe(),v=SXe(e,n),g=aC(ze(e,".claude","plugins","cladding"),v),b=g==="removed"?PXe(t.activate??!0):"unchanged",w={claude_plugin:$m([g,b]),gemini_extension:aC(ze(e,".gemini","extensions","cladding"),v),antigravity_plugin:$Xe(e,v),codex_skills:wXe(e,v),codex_mcp:await kXe(e,v),cursor_mcp:EXe(e,v)},x=o.has("codex")?await DXe(ze(r,".codex","config.toml"),y,a):"skipped-not-selected",$=o.has("gemini")?iS(ze(r,".gemini","settings.json"),y,a):"skipped-not-selected",I=o.has("antigravity")?$m([iS(ze(r,".agents","mcp_config.json"),y,a),AXe(e,n,a)]):"skipped-not-selected",E=o.has("claude")?$m([pV(h,ze(r,".claude","skills","cladding-init"),a),iS(ze(r,".mcp.json"),y,a)]):"skipped-not-selected",R=o.has("cursor")?$m([pV(h,ze(r,".cursor","skills","cladding-init"),a),iS(ze(r,".cursor","mcp.json"),y,a),NXe(ze(r,".cursor","cli.json")),jXe(r)]):"skipped-not-selected",A={runtime:f,shared_init_skill:m,claude:E,codex:x,gemini:$,antigravity:I,cursor:R};o.size===0&&d.push({step:"hosts",message:"no supported AI host detected on this machine \u2014 only the shared runtime was written; use `clad setup --host ` to wire explicitly"});for(let[Z,ee]of Object.entries(A))Qge(ee,Z,u,d);for(let[Z,ee]of Object.entries(w))Qge(ee,`legacy:${Z}`,u,d);sC(ql(c)),rp(c,`${JSON.stringify({project_root:r,cladding_root:n,cladding_version:i,last_run:new Date().toISOString()},null,2)} +`,"utf8");let B={projectRoot:r,wiring:A,legacyCleanup:w,errors:u,warnings:d,statusFile:c,cladding_root:n,cladding_version:i,last_setup_version:l};return t.quiet||process.stdout.write(`${LXe(B)} +`),B}function nS(t){switch(t){case"created":return"wired";case"rewired":return"updated";case"unchanged":return"already ready";case"removed":return"legacy global removed";case"skipped-not-selected":return"not selected";case"skipped-different":return"preserved conflict";case"manual-required":return"manual cleanup required";default:return"failed"}}function LXe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${nS(t.wiring.claude)}`,` Codex \u2192 ${nS(t.wiring.codex)}`,` Gemini CLI \u2192 ${nS(t.wiring.gemini)}`,` Antigravity \u2192 ${nS(t.wiring.antigravity)}`,` Cursor \u2192 ${nS(t.wiring.cursor)}`];(t.wiring.antigravity==="created"||t.wiring.antigravity==="rewired")&&r.push(""," Note: Antigravity reads MCP config machine-wide only, so its wire lives in ~/.gemini/config/plugins/cladding (each session still resolves the project from its working directory).");let n=Object.values(t.legacyCleanup).filter(i=>i==="removed").length;n>0&&r.push("",`Removed ${n} legacy global Cladding wire(s).`);for(let i of t.warnings)r.push(` ! ${i.step}: ${i.message}`);return r.push("","Next steps:"," 1. Start a new AI session in this project directory",' 2. Ask: "Apply Cladding to this project"'," 3. Review the preview and reply with its exact approval phrase"," 4. After initialization, develop normally in natural language"),r.join(` +`)}function oye(){let t=yXe(import.meta.url),e=ql(t);for(let r=0;r<7;r++){try{if(JSON.parse(cC(ze(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=ql(e)}return Vl(ql(t),"..")}function aye(t){for(let e of["package.json",ze(".claude-plugin","plugin.json")])try{let r=JSON.parse(cC(ze(t,e),"utf8")).version;if(typeof r=="string"&&r.length>0)return r}catch{}return"unknown"}function ti(t=oye()){let e=aye(t);return e==="unknown"?null:e}function cye(t=process.cwd()){return sye(ze(Vl(t),".cladding",fV))}function MXe(t=tye()){return{claude:Es(ze(t,".claude")),gemini:Es(ze(t,".gemini")),antigravity:Es(ze(t,".gemini","config"))||Es(ze(t,".gemini","antigravity-cli")),codex:Es(ze(t,".codex")),agents:Es(ze(t,".agents")),cursor:Es(ze(t,".cursor"))}}var fV,hV,mV,bXe,vXe,Im=S(()=>{"use strict";fV="setup-status.json",hV=ze(".cladding","host","serve.cjs"),mV=".cladding/host/gemini-doctor-policy.toml",bXe=["claude","codex","gemini","antigravity","cursor"],vXe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as lye,readFileSync as uye}from"node:fs";import{join as dye}from"node:path";function pye(t,e){let r=t.match(e);if(!r)return null;try{let n=JSON.parse(r[1]),i={};for(let[s,o]of Object.entries(n))typeof o=="string"&&(i[s]=o);return i}catch{return null}}function VXe(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 fye(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function hye(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function GXe(t,e){let r=hye(t),n=hye(e);if(!r||!n)return!1;for(let i=0;iqXe&&r.push(`generated ${n}, more than 30 days ago`);let s=t.match(UXe)?.[1],o=ti();return s!==void 0&&o!==null&&GXe(s,o)&&r.push(`generated by cladding v${s}, before the current v${o}`),r}function WXe(t){let e=dye(t,"README.md"),r=dye(t,"docs","dogfood","matrix.md");if(!lye(e)||!lye(r))return[];let n=uye(e,"utf8"),i=uye(r,"utf8"),s=pye(n,FXe),o=pye(i,zXe);if(!s||!o)return[];let a=[];for(let[u,d]of Object.entries(s)){let p=fye(d);if(p===null)continue;let f=o[u]??"not-run",h=VXe(f);h!==null&&p>h&&a.push({detector:yV,severity:"warn",path:"README.md",message:`README host-claims: '${u}' claims '${d}' but the newest matrix evidence is '${f}' \u2014 the claim exceeds the evidence. Re-run \`clad doctor --hosts\` (with consent) or lower the README claim for '${u}'.`})}let l=Object.values(s).some(u=>fye(u)!==null)?HXe(i,Date.now()):[];return l.length>0&&a.push({detector:yV,severity:"info",path:"docs/dogfood/matrix.md",message:`Host support evidence needs a fresh receipt: ${l.join("; ")}. Re-run \`clad doctor --hosts\` with consent; existing contradictory-claim warnings are unchanged.`}),a}function ZXe(t){let{cwd:e="."}=t;return WXe(e)}var yV,FXe,zXe,UXe,BXe,qXe,mye,gye=S(()=>{"use strict";Im();yV="HOST_CLAIM_DRIFT",FXe=//,zXe=//,UXe=/^- Cladding version:\s*`([^`]+)`\s*$/m,BXe=/^- Generated:\s*(\S+)\s*$/m,qXe=720*60*60*1e3;mye={name:yV,run:ZXe}});function JXe(t){let{cwd:e="."}=t,r;try{r=oe(e)}catch{return[]}let n=[];return yye(r.features.map(i=>i.id),"feature","spec/features/",n),yye((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function yye(t,e,r,n){let i=new Map;for(let s of t)i.set(s,(i.get(s)??0)+1);for(let[s,o]of i)o>1&&n.push({detector:bye,severity:"error",message:`${e} id '${s}' appears ${o} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var bye,vye,_ye=S(()=>{"use strict";gt();bye="ID_COLLISION";vye={name:bye,run:JXe}});import{existsSync as Sye,readFileSync as wye,readdirSync as KXe}from"node:fs";import{join as bV}from"node:path";function YXe(t){let{cwd:e="."}=t,r;try{r=oe(e)}catch{return[]}let n=qh(e),i=r.inventory;if(!i){let o=xye.filter(([c])=>(n[c]??0)>0);if(o.length===0)return vV(e);let a=o.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...vV(e),{detector:Pm,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 s=[];for(let[o,a]of xye){let c=i[o]??0,l=n[o]??0;c!==l&&s.push({detector:Pm,severity:"error",path:"spec.yaml",message:`spec.yaml inventory.${o} 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 s.push(...vV(e)),s}function vV(t){let e=Bh(t,"generated-index"),r=e.resolvedPath??e.oldPath,n=bV(t,r),i=bV(t,"spec","features"),s=e.presence!=="both"?[]:[{detector:Pm,severity:"error",path:e.newPath,message:`a generated feature index exists at both ${e.oldPath} and ${e.newPath} \u2014 remove the copy you do not keep (\`clad relocate-generated\` reports the same conflict).`}];if(!Sye(n)||!Sye(i))return s;let o=new Map;try{for(let p of wye(n,"utf8").split(` +`)){let f=p.match(/^ (F-[\w-]+):.*\bstatus:\s*['"]?([\w-]+)['"]?/);if(f){o.set(f[1],f[2]);continue}let h=p.match(/^ (F-[\w-]+):/);h&&o.set(h[1],"planned")}}catch{return s}let a=new Map;try{for(let p of KXe(i)){if(!p.endsWith(".yaml")&&!p.endsWith(".yml"))continue;let f=wye(bV(i,p),"utf8"),h=f.match(/^id:\s*['"]?(F-[\w-]+)['"]?/m);if(!h)continue;let m=f.match(/^status:\s*['"]?([\w-]+)['"]?/m);a.set(h[1],m?m[1]:"planned")}}catch{return s}let c=[...s],l=[...a.keys()].filter(p=>!o.has(p)).sort(),u=[...o.keys()].filter(p=>!a.has(p)).sort();if(l.length>0||u.length>0){let p=[];l.length>0&&p.push(`missing from index: ${l.join(", ")}`),u.length>0&&p.push(`in index but not on disk: ${u.join(", ")}`),c.push({detector:Pm,severity:"error",path:r,message:`${r} disagrees with spec/features/ (${p.join("; ")}) \u2014 run \`clad sync\` to regenerate (a stale index silently misleads agents that trust it for lookup).`})}let d=[...a.keys()].filter(p=>o.has(p)&&o.get(p)!==a.get(p)).sort().map(p=>`${p} (index: ${o.get(p)}, shard: ${a.get(p)})`);return d.length>0&&c.push({detector:Pm,severity:"error",path:r,message:`${r} status disagrees with spec/features/ for ${d.join("; ")} \u2014 run \`clad sync\` to regenerate (a stale status silently misleads agents that trust the index).`}),c}var Pm,xye,kye,Eye=S(()=>{"use strict";Vh();gt();Cd();Pm="INVENTORY_DRIFT",xye=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];kye={name:Pm,run:YXe}});import{existsSync as XXe,readFileSync as QXe}from"node:fs";import{join as eQe}from"node:path";function rQe(t){let{cwd:e="."}=t,r=eQe(e,"src","spec","schema.json"),n=[];if(XXe(r)){let i;try{i=JSON.parse(QXe(r,"utf8"))}catch(s){n.push({detector:oS,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${s.message}`})}if(i)for(let s of tQe)i.required?.includes(s)||n.push({detector:oS,severity:"error",message:`spec/schema.json does not require root key '${s}'`}),i.properties?.[s]||n.push({detector:oS,severity:"error",message:`spec/schema.json does not declare property '${s}'`})}try{let i=oe(e);Aye.has(i.schema)||n.push({detector:oS,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is one of '${[...Aye].join("', '")}'`})}catch{}return n}var oS,tQe,Aye,$ye,Iye=S(()=>{"use strict";gt();oS="META_INTEGRITY",tQe=["schema","project","features"],Aye=new Set(["0.1","0.2"]);$ye={name:oS,run:rQe}});function nQe(t){let{cwd:e="."}=t,r;try{r=oe(e)}catch{return[]}let n=[];return Pye(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),Pye((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function Pye(t,e,r){let n=new Map;for(let i of t){if(!i.slug)continue;let s=n.get(i.slug);s?r.push({detector:Rye,severity:"error",message:`slug '${i.slug}' is used by both ${s} 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 Rye,Cye,Tye=S(()=>{"use strict";gt();Rye="SLUG_CONFLICT";Cye={name:Rye,run:nQe}});function Rm(t){return t==="planned"||t==="in_progress"}var lC=S(()=>{"use strict"});import{existsSync as iQe}from"node:fs";import{join as sQe}from"node:path";function oQe(t){let{cwd:e="."}=t;return Ue(e,uC,r=>aQe(r,e))}function aQe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let s=sQe(e,i);iQe(s)||r.push(cQe(n.id,i,n.status))}return r}function cQe(t,e,r){return Rm(r)?{detector:uC,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:uC,severity:"error",path:e,message:`feature ${t} declares module '${e}' but the file does not exist`}}var uC,dC,_V=S(()=>{"use strict";lC();vr();uC="MISSING_IMPLEMENTATION";dC={name:uC,run:oQe}});function lQe(t){let{cwd:e="."}=t;return Ue(e,SV,uQe)}function uQe(t){let e=[];for(let r of t.features)if(r.status==="done")for(let n of r.acceptance_criteria??[]){let s=(n.test_refs??[]).filter(c=>!c.startsWith("derived:")).length>0,o=(n.evidence_refs?.length??0)>0,a=!s&&!o&&(n.test_refs?.length??0)>0;!s&&!o&&e.push({detector:SV,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 SV,pC,wV=S(()=>{"use strict";vr();SV="MISSING_TESTS";pC={name:SV,run:lQe}});import{existsSync as dQe,readFileSync as pQe}from"node:fs";import{join as Oye}from"node:path";function Nye(t){if(dQe(t))try{return JSON.parse(pQe(t,"utf8"))}catch{return}}function gQe(t){let{cwd:e="."}=t,r=Nye(Oye(e,fQe)),n=Nye(Oye(e,hQe));if(!r||!n)return[{detector:xV,severity:"info",message:"perf baseline or current missing \u2014 run stage_3.2 with --record first"}];let i=[];for(let[s,o]of Object.entries(r.metrics??{})){let a=n.metrics?.[s];if(!a||typeof o.value!="number"||typeof a.value!="number"||o.value===0)continue;let c=(a.value-o.value)/o.value*100;c>mQe&&i.push({detector:xV,severity:"warn",message:`${s} regressed ${c.toFixed(1)}% (baseline ${o.value}${o.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var xV,fQe,hQe,mQe,Dye,jye=S(()=>{"use strict";xV="PERFORMANCE_DRIFT",fQe="perf/baseline.json",hQe="perf/current.json",mQe=10;Dye={name:xV,run:gQe}});import{existsSync as yQe}from"node:fs";import{join as bQe}from"node:path";function _Qe(t){let{cwd:e="."}=t;return Ue(e,kV,r=>wQe(r,e))}function SQe(t,e){return(t.modules??[]).some(r=>yQe(bQe(e,r)))}function wQe(t,e){let r=[];for(let o of t.features)o.status!=="planned"&&o.status!=="in_progress"||SQe(o,e)||r.push(o.id);let n=vQe;if(r.length<=n)return[];let i=r.slice(0,Lye).join(", "),s=r.length>Lye?", \u2026":"";return[{detector:kV,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}${s}`}]}var kV,vQe,Lye,Mye,Fye=S(()=>{"use strict";vr();kV="PLANNED_BACKLOG",vQe=5,Lye=8;Mye={name:kV,run:_Qe}});import{existsSync as xQe,readFileSync as kQe}from"node:fs";import{join as EQe}from"node:path";function IQe(t){let{cwd:e="."}=t;return Ue(e,EV,r=>PQe(r,e))}function PQe(t,e){if(t.features.lengthn.includes(i))?[{detector:EV,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 EV,AQe,$Qe,zye,Uye=S(()=>{"use strict";vr();EV="PROJECT_CONTEXT_DRIFT",AQe=8,$Qe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];zye={name:EV,run:IQe}});function Bye(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:ip,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function RQe(t){let{cwd:e="."}=t;try{let r=Nr(e),n=CQe(b_(e,r).issues);if(r.schemaVersion==="0.2"){let i=r.diagnostics.filter(s=>s.code==="UNKNOWN_REFERENCE");if(i.length>0||r.contract)return[...i.map(s=>({detector:ip,severity:"error",...s.source?{path:s.source.path}:{},message:`${s.message} \u2014 fix the reference or add the missing item.`})),...n]}return[...Ue(e,ip,qye),...n]}catch{}return Ue(e,ip,qye)}function CQe(t){return t.map(e=>({detector:ip,severity:"error",path:e.sourcePath,line:e.location.line,message:TQe(e)}))}function TQe(t){switch(t.code){case"FEATURE_ONLY":return`source reference '${t.raw}' names a feature without an acceptance criterion \u2014 add an AC target.`;case"NONCANONICAL_FEATURE_PATH":return`source reference '${t.raw}' uses a non-canonical feature path \u2014 use spec/features/.yaml.`;case"UNKNOWN_FEATURE_SHARD":return`source reference '${t.raw}' names an unknown feature shard \u2014 fix the path or add the shard.`;case"UNKNOWN_CRITERION":return`source reference '${t.raw}' names unknown criterion '${t.normalizedTarget}' \u2014 fix the AC id or add it to '${t.featurePath}'.`}}function qye(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...Bye(e,n.depends_on,`feature ${n.id}.depends_on`)),n.superseded_by&&!e.has(n.superseded_by)&&r.push({detector:ip,severity:"error",message:`feature ${n.id}.superseded_by references unknown id '${n.superseded_by}'`});for(let n of t.scenarios??[])r.push(...Bye(e,n.features,`scenario ${n.id}.features`));return r}var ip,fC,AV=S(()=>{"use strict";a4();qn();vr();ip="REFERENCE_INTEGRITY";fC={name:ip,run:RQe}});function OQe(t){let{cwd:e="."}=t;return Ue(e,Cm,r=>NQe(r,e))}function NQe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Gh(e).docs){if(!i.readable)continue;let s=new Set;for(let a of i.links)a.state==="unresolved"&&!s.has(a.target)&&(s.add(a.target),n.push({detector:Cm,severity:"error",path:i.doc,message:`doc '${i.doc}' links to missing file '${a.target}'`}));for(let a of i.issues)n.push({detector:Cm,severity:"error",path:i.doc,message:`doc '${i.doc}' has unsafe local Markdown path '${a.raw}' (${a.reason})`});let o=new Set(i.explicit.map(a=>a.featureId));for(let a of o)r.has(a)||n.push({detector:Cm,severity:"error",path:i.doc,message:`doc '${i.doc}' declares unknown feature '${a}' in clad-doc-links \u2014 declared document references must resolve.`});if(!i.excluded)for(let a of new Set(i.organic.map(c=>c.featureId)))!r.has(a)&&!o.has(a)&&n.push({detector:Cm,severity:"warn",path:i.doc,message:`doc '${i.doc}' references unknown feature '${a}' \u2014 archived/renamed? If it is an illustrative example, add a \`clad-doc-links: ignore\` marker to the doc.`})}return n}var Cm,hC,$V=S(()=>{"use strict";jI();vr();Cm="DOC_LINK_INTEGRITY";hC={name:Cm,run:OQe}});function DQe(t){let{cwd:e="."}=t;try{let r=Nr(e);if(r.schemaVersion==="0.2")return r.diagnostics.some(n=>n.code==="UNKNOWN_REFERENCE")?[]:r.diagnostics.filter(n=>n.code==="INVALID_SCENARIO"&&n.message.startsWith("scenario coverage ")).map(n=>({detector:Tm,severity:n.severity==="blocking"?"error":"info",path:n.source?.path??"spec/scenarios/",message:`${n.message} \u2014 add a complete user journey with actor, goal, success, steps, and feature references.`}))}catch{}return Ue(e,Tm,r=>jQe(r))}function jQe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=Vye,s=t.project.onboarding_seeded===!0&&!i;r>=Vye&&n.length===0&&e.push({detector:Tm,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:Tm,severity:s?"info":"warn",path:"spec/scenarios/",message:s?`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 o=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 p=d.trim(),f=o.get(p);f&&!c.has(f)&&l.set(p,f)}if(l.size>0){let u=[...l].map(([d,p])=>`${d} (${p})`).join(", ");e.push({detector:Tm,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 Tm,Vye,Gye,Hye=S(()=>{"use strict";qn();vr();Tm="SCENARIO_COVERAGE",Vye=8;Gye={name:Tm,run:DQe}});import{chmodSync as LQe,existsSync as Wye,readFileSync as MQe,readdirSync as FQe,statSync as Zye,unlinkSync as zQe,utimesSync as UQe,writeFileSync as BQe}from"node:fs";import{join as Jye}from"node:path";import Kye from"node:process";function qQe(t){return Ub(t).map(e=>{try{let r=Zye(e);return r.isFile()?{path:e,body:MQe(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 VQe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!Wye(r.path))continue;if(!Zye(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}zQe(r.path);continue}BQe(r.path,r.body),r.mode!==void 0&&LQe(r.path,r.mode),r.atime&&r.mtime&&UQe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function GQe(t){let e=!1,r=n=>{for(let i of FQe(n,{withFileTypes:!0})){if(e)return;let s=Jye(n,i.name);i.isDirectory()?r(s):(/\.(test|spec)\.[cm]?[jt]sx?$/.test(i.name)||/_test\.py$/.test(i.name))&&(e=!0)}};try{r(t)}catch{}return e}function IV(t={}){let{cwd:e="."}=t,r=Jye(e,Gl);if(!Wye(r)||!GQe(r))return{stage:sp,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${Gl}/ \u2014 skipped`};let n=dr(e),i=n.gates.test;if(!i?.cmd||!i.args)return{stage:sp,pass:!1,exitCode:2,stderr:`no test runner registered for language '${n.language}'`};let s;try{s=qQe(e)}catch(d){return{stage:sp,pass:!1,exitCode:1,stderr:`could not preserve the full test report before the scoped oracle run: ${d.message}`}}let o,a,c=[...i.args,Gl];try{o=Mt(i.cmd,c,{cwd:e,reject:!1})}catch(d){a=d}let l=VQe(s);if(l.length>0)return{stage:sp,pass:!1,exitCode:1,stderr:`could not restore the full test report after the scoped oracle run: ${l.join("; ")}`};if(a||!o)return{stage:sp,pass:!1,exitCode:1,stderr:`oracle runner failed to start: ${a?.message??"unknown error"}`};let u=jr(sp,i.cmd,o,c);return u||nn(sp,o)}var sp,Gl,HQe,PV=S(()=>{"use strict";xi();xs();Xf();ks();sp="stage_2.3",Gl="tests/oracle";HQe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Kye.argv[1]}`;if(HQe){let t=IV();console.log(JSON.stringify(t)),Kye.exit(t.exitCode)}});import{existsSync as WQe}from"node:fs";import{join as ZQe}from"node:path";function JQe(t){let{cwd:e="."}=t;return Ue(e,uo,r=>KQe(r,e))}function KQe(t,e){let r=[],n=Kb(t.project,Yb(t)),i=n.reportOnly?"info":"error",s=n.mandateActive?Dr(e):[],o=s.filter(l=>l.kind==="oracle"),a=new Set(["agent:developer","agent:specialists"]),c=l=>s.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(Xb(n,l.id,u)&&d.length===0){let p=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:uo,severity:i,message:`${l.id}.${u.id} done AC lacks a spec-conformance oracle (${p}; declare oracle_refs under ${Gl}/)`+(n.reportOnly?" [report-only \u2014 the graduated default enforces in 0.7]":"")})}for(let p of d){if(!WQe(ZQe(e,p))){r.push({detector:uo,severity:"error",path:p,message:`${l.id}.${u.id} oracle_ref '${p}' resolves to nothing on disk`});continue}if(p.startsWith(`${Gl}/`)||r.push({detector:uo,severity:"warn",path:p,message:`${l.id}.${u.id} oracle_ref '${p}' lives outside ${Gl}/ \u2014 stage_2.3 only runs ${Gl}/, so this oracle will not execute`}),!n.mandateActive)continue;let f=o.find(y=>y.featureId===l.id&&y.acId===u.id&&y.artifact===p);if(!f){r.push({detector:uo,severity:"error",path:p,message:`${l.id}.${u.id} oracle '${p}' has no authoring-provenance record \u2014 author it via 'clad oracle' (or clad_author_oracle) so impl-blindness can be verified`});continue}let h=c(l.id);h&&f.identity.name===h?r.push({detector:uo,severity:"error",path:p,message:`${l.id}.${u.id} oracle '${p}' is NOT impl-blind: authored by the implementer ('${h}')`}):h||r.push({detector:uo,severity:"info",message:`${l.id}.${u.id} oracle author\u2260implementer not verified \u2014 no implementer identity recorded (no implementer identity recorded in the audit log)`});let m=(f.readManifest??[]).filter(y=>(l.modules??[]).includes(y));m.length>0&&r.push({detector:uo,severity:"error",path:p,message:`${l.id}.${u.id} oracle '${p}' is NOT impl-blind: author read implementation file(s) the feature owns (${m.join(", ")})`}),f.blind===!1&&r.push({detector:uo,severity:"info",message:`${l.id}.${u.id} oracle '${p}' 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:uo,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 uo,Yye,Xye=S(()=>{"use strict";hi();Qb();PV();vr();uo="SPEC_CONFORMANCE";Yye={name:uo,run:JQe}});function YQe(t){let{cwd:e="."}=t,r=Dr(e);if(r.length===0)return[{detector:RV,severity:"info",message:"no audit log present \u2014 detector is opt-in on prior stage_4 runs"}];let n=Date.now(),i=[];for(let s of r){let o=Date.parse(s.identity.timestamp);if(Number.isNaN(o))continue;let a=(n-o)/(1e3*60*60*24);a>Qye&&i.push({detector:RV,severity:"warn",message:`evidence ${s.id} is ${Math.round(a)} days old (floor ${Qye})`})}return i}var RV,Qye,ebe,tbe=S(()=>{"use strict";hi();RV="STALE_EVIDENCE",Qye=90;ebe={name:RV,run:YQe}});import{existsSync as rbe}from"node:fs";import{join as nbe}from"node:path";function XQe(t){let{cwd:e="."}=t;return Ue(e,op,r=>QQe(r,e))}function QQe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:op,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:op,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(s=>rbe(nbe(e,s)));if(i.length>0){let s=n.superseded_by?t.features.find(o=>o.id===n.superseded_by):void 0;r.push(s&&s.status!=="done"?{detector:op,severity:"info",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")} \u2014 retirement is owned by successor ${s.id}, which is not done yet`}:{detector:op,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}}Rm(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>rbe(nbe(e,i)))&&r.push({detector:op,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 op,mC,CV=S(()=>{"use strict";lC();vr();op="STALE_SPECIFICATION";mC={name:op,run:XQe}});import{existsSync as ibe,statSync as sbe}from"node:fs";import{join as obe}from"node:path";function tet(t,e){let r=0;for(let n of e){let i=obe(t,n);if(!ibe(i))continue;let s=sbe(i).mtimeMs;s>r&&(r=s)}return r}function ret(t){let{cwd:e="."}=t;return Ue(e,TV,r=>net(r,e))}function net(t,e){let r=sa(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=tet(e,n);if(i===0)return[];let s=Bl([...r.testGlobs],{cwd:e,dot:!1});if(s.length===0)return[];let o=[];for(let a of s){let c=obe(e,a);if(!ibe(c))continue;let l=sbe(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>eet&&o.push({detector:TV,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return o}var TV,eet,gC,OV=S(()=>{"use strict";J_();Kd();vr();TV="STALE_TESTS",eet=30;gC={name:TV,run:ret}});import{existsSync as iet}from"node:fs";import{join as set}from"node:path";function oet(t){let{cwd:e="."}=t;return Ue(e,aS,r=>aet(r,e))}function aet(t,e){let r=[];for(let n of t.features){let i=n.modules??[],s=n.acceptance_criteria??[];if(n.status==="done"&&i.length===0&&s.length===0){r.push({detector:aS,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 o=i.filter(a=>!iet(set(e,a)));o.length!==0&&(n.status==="done"?r.push({detector:aS,severity:"error",message:`feature ${n.id} status='done' but ${o.length}/${i.length} module(s) missing: ${o.join(", ")}`}):n.status==="in_progress"&&o.length===i.length&&r.push({detector:aS,severity:Rm(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 aS,yC,NV=S(()=>{"use strict";lC();vr();aS="STATUS_DRIFT";yC={name:aS,run:oet}});import{readdirSync as cet}from"node:fs";import{extname as uet,join as det}from"node:path";function cbe(t){return t.maxFiles!==void 0&&t.maxFiles>=1?t.maxFiles:fet}function lbe(t,e,r){let n=0,i=[t];for(;i.length>0&&n=e)break;n+=1,r(uet(a.name).toLowerCase())}}}}function ube(t,e={}){let r={},n=0;lbe(t,cbe(e),o=>{let a=ap[o];a!==void 0&&(r[a]=(r[a]??0)+1,n+=1)});let i=Object.keys(r).sort(),s=null;for(let o of i)(s===null||r[o]>r[s])&&(s=o);return{counts:r,classified:n,set:i,dominant:s,share(o){return n===0?0:(r[o]??0)/n}}}function dbe(t,e={}){let r=new Set;return lbe(t,cbe(e),n=>{ap[n]!==void 0&&r.add(n)}),[...r].sort()}var ap,abe,pet,fet,bC=S(()=>{"use strict";ap={".ts":"typescript",".tsx":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".go":"go",".rs":"rust",".java":"java",".kt":"kotlin",".kts":"kotlin",".cs":"csharp",".rb":"ruby",".php":"php",".swift":"swift",".ex":"elixir",".exs":"elixir",".scala":"scala",".dart":"dart",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".h":"cpp"},abe=new Set(Object.values(ap)),pet=new Set(["node_modules",".git","dist","build","out","coverage","target","vendor",".cladding"]),fet=2e4});function get(t){let{cwd:e="."}=t;return Ue(e,vC,r=>bet(r,e))}function yet(t){return`{${Object.keys(t).sort((r,n)=>t[n]-t[r]||r.localeCompare(n)).map(r=>`${r} \xD7${t[r]}`).join(", ")}}`}function bet(t,e){let r=t.project?.language??"";if(!abe.has(r))return[];let n=ube(e);return n.classified{"use strict";bC();vr();vC="TECH_STACK_MISMATCH",het=5,met=.1;pbe={name:vC,run:get}});import{extname as vet}from"node:path";function Eet(t){let e=new Map;for(let r of t.layers??[]){if(Array.isArray(r))continue;let n=r;if(typeof n.name!="string"||n.name.length===0)continue;let i=(n.modules??[]).filter(s=>typeof s=="string"&&s.length>0);i.length!==0&&e.set(n.name,[...e.get(n.name)??[],...i])}return e}function Aet(t){let e=t.indexOf("*"),r=e<0?t:t.slice(0,e);return r.length===0||r.endsWith("/")?r:`${r}/`}function $et(t,e){return t.endsWith("**")?`${t}/*${e}`:`${t}/**/*${e}`}function Iet(t,e,r){let n=new Map,i=new Map,s=new Set,o=0;for(let l of t.features??[])for(let u of l.modules??[]){let d=u.split("/"),p=vet(d[d.length-1]);p!==""&&r.some(y=>u.startsWith(y))&&s.add(p);let f=d.findIndex((y,v)=>v0?o.roots:[xet],c=new Set([...dbe(e),...o.extensions]),l=new Set,u=new Set;for(let d of n){let p=i.get(d);if(p!==void 0){for(let f of p){u.add(f);for(let h of c)l.add($et(f,h))}continue}for(let f of a){let h=f===""?"":`${f}/`;u.add(f===""?".":f);for(let m of c)l.add(`${h}${d}/**/*${m}`)}}return{patterns:[...l].sort(),fullScan:!0,layers:[...n],roots:[...u],everyLayerDeclaresGlobs:i.size===n.size}}function Ret(t){let e=t.everyLayerDeclaresGlobs?"check the declared layer modules globs against the tree":"declare layer modules globs or align layer names with directories";return{detector:_C,severity:"info",message:`full scan matched no files \u2014 layers {${t.layers.join(", ")}} under roots {${t.roots.join(", ")}}; ${e}`}}function Cet(t){let{cwd:e="."}=t;return Ue(e,_C,r=>Tet(r,e))}function Tet(t,e){let r=new Set;for(let o of t.features)for(let a of o.modules??[])r.add(a);let n=Pet(t,e),i=n.patterns.length===0?[]:Bl([...n.patterns],{cwd:e,dot:!1});if(n.fullScan&&i.length===0)return[Ret(n)];let s=[];for(let o of i)r.has(o)||s.push({detector:_C,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return s}var _C,_et,wet,xet,ket,hbe,SC,DV=S(()=>{"use strict";J_();bC();qq();vr();_C="UNMAPPED_ARTIFACT",_et=["src/stages/**/*.ts","src/spec/**/*.ts"],wet=8,xet="src",ket=.25;hbe={patterns:_et,fullScan:!1,layers:[],roots:[],everyLayerDeclaresGlobs:!1};SC={name:_C,run:Cet}});import{existsSync as mbe}from"node:fs";import{join as gbe}from"node:path";function Net(t){return Oet.some(e=>t.startsWith(e))}function Det(t){let{cwd:e="."}=t;return Ue(e,jV,r=>jet(r,e))}function jet(t,e){let r=[];for(let n of t.features)if(n.status==="done")for(let i of n.acceptance_criteria??[])for(let s of i.test_refs??[]){if(Net(s))continue;let o=s.split("#",1)[0];mbe(gbe(e,s))||o&&mbe(gbe(e,o))||r.push({detector:jV,severity:"error",path:s,message:`${n.id}.${i.id} test_ref '${s}' 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 Ixe(t){return`${JSON.stringify(t,null,2)} +`}function Pxe(t){let e=new Map(t.nodes.map(o=>[o.id,o])),r=new Map,n=new Map;for(let o of t.edges)(r.get(o.from)??r.set(o.from,[]).get(o.from)).push({other:o.to,kind:o.kind}),(n.get(o.to)??n.set(o.to,[]).get(o.to)).push({other:o.from,kind:o.kind});let i=o=>{let a=e.get(o);return a?`[[${kxe(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${o.replace(/[[\]|]/g," ")}]]`},s=new Map;for(let o of t.nodes){let a=["---",`kind: ${o.kind}`,...o.tier?[`tier: ${o.tier}`]:[],...o.status?[`status: ${o.status}`]:[],`id: ${JSON.stringify(o.id)}`,"---",`# ${o.label}`,""],c=(r.get(o.id)??[]).slice().sort(Exe);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(o.id)??[]).slice().sort(Exe);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}s.set(`${o.kind}/${kxe(o)}.md`,`${a.join(` +`)}`)}return s}function Exe(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as kpt}from"node:fs";import{dirname as Ept,join as $3}from"node:path";import{fileURLToPath as Apt}from"node:url";var I3=Ept(Apt(import.meta.url));function Rxe(t){for(let e of[$3(I3,"viewer",t),$3(I3,"..","graph","viewer",t),$3(I3,"..","..","dist","viewer",t)])try{return kpt(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Cxe(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -924,66 +937,103 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify
drag = orbit \xB7 scroll = zoom \xB7 click node = focus \xB7 hover = details
-${o} +${s} -`}uC();BC();jC();FC();qC();lC();JC();YC();XC();eD();oh();HC();Ue();var Y4e=[hS,TS,mS,OS,yS,vS,tS,$S,xS,eS];function X4e(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=Bp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Yx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Oa(e,q(e))}catch{}try{for(let o of Y4e){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 X4e(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{Oa(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}Kj();Ue();Pi();var eHe=new Set(["mermaid","dot","json","obsidian","html"]);function cre(t={}){try{let e=t.format??"mermaid";if(!eHe.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=Ac(n,".");if(t.focus){let s=Gx(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=Bx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=ire(i);for(let[c,l]of a){let u=Q4e(s,c);Jj(Xj(u),{recursive:!0}),Yj(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=Jx(i,Yx(i,"."));Jj(Xj(t.out),{recursive:!0}),Yj(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"?nre(i):r==="json"?Kx(i):rre(i);t.out?(Jj(Xj(t.out),{recursive:!0}),Yj(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 lre(){try{let t=Ac(q(),".");process.stdout.write(are(Xx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as tHe}from"node:http";import{existsSync as rHe,watch as nHe}from"node:fs";import{join as iHe}from"node:path";Ue();Pi();function oHe(t={}){let e=t.cwd??".",r=new Set,n=()=>Ac(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh - -`)}catch{r.delete(u)}},o=tHe((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=Kx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Yx(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=Jx(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=iHe(e,u);if(rHe(d))try{let f=nHe(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 ure(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await oHe({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 sHe=["stage_1.1","stage_2.1","stage_2.3"];function aHe(t){return(t.features??[]).filter(e=>e.status==="done")}function cHe(t,e){let r=aHe(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 dre(t,e){let r=[];for(let n of sHe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=cHe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}NS();import fre from"node:process";function lHe(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 Qx(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=lHe(n,t);i.pass||r.push(i)}return r}un();var Qj="stage_4.1";function eM(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Qj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Qx(r);if(n.length===0)return{stage:Qj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Qj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var uHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fre.argv[1]}`;if(uHe){let t=eM();console.log(JSON.stringify(t)),fre.exit(t.exitCode)}Al();import{randomBytes as dHe}from"node:crypto";import{unlinkSync as fHe}from"node:fs";import{tmpdir as pHe}from"node:os";import{join as mHe,resolve as tM}from"node:path";import hHe from"node:process";var Gr=null;function pre(t){Gr={cwd:tM(t),run:null,jsonFile:null}}function rM(){return Gr!==null}function nM(t,e){if(!Gr||Gr.cwd!==tM(t))return null;if(Gr.run)return Gr.run;let r=mHe(pHe(),`clad-shared-vitest-${hHe.pid}-${dHe(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function mre(t){return!Gr||Gr.cwd!==tM(t)?null:Gr.run}function iM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function hre(){let t=Gr?.jsonFile;if(Gr=null,t)try{fHe(t)}catch{}}zr();import gre from"node:process";var e0="stage_1.4";function oM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:e0,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:e0,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:e0,pass:!0,exitCode:0}:{stage:e0,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var gHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gre.argv[1]}`;if(gHe){let t=oM();console.log(JSON.stringify(t)),gre.exit(t.exitCode)}zr();import yre from"node:process";sh();Nn();var t0="stage_2.2";function sM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:t0,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:t0,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`,skipReason:"no-runner"};let o=mre(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(t0,r,s,n);return a||Xt(t0,s)}var bHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yre.argv[1]}`;if(bHe){let t=sM();console.log(JSON.stringify(t)),yre.exit(t.exitCode)}Qp();aD();aM();zr();Dn();Nn();import bre from"node:process";var i0="stage_3.2";function cM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:i0,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:i0,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(i0,i,s,o);return a||Xt(i0,s)}var LHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bre.argv[1]}`;if(LHe){let t=cM();console.log(JSON.stringify(t)),bre.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as zHe}from"node:fs";import{resolve as Sre}from"node:path";import wre from"node:process";var fi="stage_2.4",lM=5e3,UHe=3e4;function uM(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 HHe(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=Sre(e,r.path);if(!zHe(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??lM,c;try{c=Ke(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 vre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},qHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function HHe(t,e,r){let n=Math.min(e.length*lM,UHe),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(BHe(t,s,r))}return GHe(o)}function BHe(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("/")?Sre(t,a):a,u=lM,d;try{d=Ke(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(h){d=h}if(Ba(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 GHe(t){let e="skip";for(let o of t)vre[o.disposition]>vre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${qHe[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 ZHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wre.argv[1]}`;if(ZHe){let t=uM();console.log(JSON.stringify(t)),wre.exit(t.exitCode)}zr();Dn();Nn();import xre from"node:process";var o0="stage_3.1";function dM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:o0,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:o0,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(o0,i,s,o);return a||Xt(o0,s)}var VHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xre.argv[1]}`;if(VHe){let t=dM();console.log(JSON.stringify(t)),xre.exit(t.exitCode)}ZC();fM();pM();zr();r0();import{randomBytes as e6e}from"node:crypto";import{unlinkSync as t6e}from"node:fs";import{tmpdir as r6e}from"node:os";import{join as n6e}from"node:path";import hM from"node:process";sh();Nn();Ue();import{readFileSync as JHe}from"node:fs";import{resolve as Ere}from"node:path";function YHe(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=Ere(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 XHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function QHe(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=XHe(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(Ere(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 mM(t,e){try{let r=YHe(JHe(t,"utf8"));return r?QHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function Are(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Ore(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Tre(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 i6e(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Are(n,i))return null;let o=n,s=i,a=nM(e,d=>Ke(o,[...s,"--reporter=default","--reporter=json",`--outputFile=${d}`],{cwd:e,reject:!1}));if(!a)return null;let{proc:c,jsonFile:l}=a;if(Nt(Zr,n,c,s))return null;let u=Xt(Zr,c);if(iM(u)==="fallback")return null;if(r){let d=mM(l,e);if(d.length>0)return{stage:Zr,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Zr,pass:!0,exitCode:0}}function o6e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Ore(n,i))return null;let o=n,s=i,a=nM(e,()=>Ke(o,[...s],{cwd:e,reject:!1}));if(!a||Nt(Zr,o,a.proc,s))return null;let c=Xt(Zr,a.proc);if(iM(c)==="fallback")return null;if(r&&Tre(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Zr,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Zr,pass:!0,exitCode:0}}function gM(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:Zr,pass:!1,exitCode:1,stderr:d.message}}if(!n||!i)return{stage:Zr,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${o}'`,skipReason:"no-runner"};let s=Are(n,i),a=Ore(n,i),c=r&&s;if(rM()&&s){let d=i6e(t,e,c);if(d)return d}if(rM()&&a){let d=o6e(t,e);if(d)return d}let l,u=i;c&&(l=n6e(r6e(),`clad-vitest-${hM.pid}-${e6e(6).toString("hex")}.json`),u=[...i,"--reporter=default","--reporter=json",`--outputFile=${l}`]);try{let d=Ke(n,[...u],{cwd:e,reject:!1}),f=Nt(Zr,n,d,u);if(f)return f;let p=Lu("unit",Xt(Zr,d),d);if(r&&p.pass&&Tre(d)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Zr,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&p.pass&&l){let m=mM(l,e);if(m.length>0)return{stage:Zr,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return p}finally{if(l)try{t6e(l)}catch{}}}var s6e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hM.argv[1]}`;if(s6e){let t=gM();console.log(JSON.stringify(t)),hM.exit(t.exitCode)}zr();Dn();Nn();import Rre from"node:process";var c0="stage_3.3";function yM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:c0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:c0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(c0,i,s,o);return a||Xt(c0,s)}var a6e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rre.argv[1]}`;if(a6e){let t=yM();console.log(JSON.stringify(t)),Rre.exit(t.exitCode)}WC();Zf();wa();bM();Up();_S();var Mre=wt(tr(),1);import{existsSync as vM,readFileSync as _6e,readdirSync as jre,statSync as b6e,writeFileSync as v6e}from"node:fs";import{basename as dh,join as fh,relative as Nre}from"node:path";var S6e=["self-dogfood:","fixture:","derived:"],Fre=/\.(test|spec)\.[jt]sx?$/;function Lre(t,e=t,r=[]){let n;try{n=jre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{b6e(o).isDirectory()?Lre(t,o,r):Fre.test(i)&&r.push(o)}catch{continue}}return r}function zre(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!vM(e)||!vM(r))return{repaired:n,suggested:i};let o=Lre(r),s=new Map;for(let a of o){let c=Nre(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of jre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=_6e(c,"utf8"),u=(0,Mre.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(S6e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(vM(fh(t,b)))continue;let _=s.get(dh(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=>dh(h).replace(/\.[jt]sx?$/,"")),m=o.map(h=>Nre(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace(Fre,"");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&&v6e(c,l,"utf8")}return{repaired:n,suggested:i}}El();import{existsSync as w6e,readFileSync as x6e}from"node:fs";import{join as $6e}from"node:path";function k6e(t,e){let r=$6e(t,e);if(!w6e(r))return[];let n=[];for(let i of x6e(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 Ure(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=>k6e(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 qre(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(` -`)}SS();Ue();un();Pi();un();El();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 A6e(t,e,r){if(e.startsWith("stage_4")){let n=pr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(s=>s.id);return Qx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function O6e(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":Q_(e,r,t).state==="fresh"?"\u2713":"!"}function f0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...SM.map(o=>A6e(i,o,e)),O6e(i,r,e)]}));return{columns:E6e,rows:n}}function Hre(t,e=".",r={}){let n=r.internal??!1,i=f0(t,e),o=[...SM.map(c=>n?c.replace("stage_",""):T6e(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 T6e(t){return Ra(t).slice(0,3)}async function sXe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(nfe(),rfe)),Promise.resolve().then(()=>(cfe(),afe)),Promise.resolve().then(()=>(lm(),_Q))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Wte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Zte(s,a,c),initialize:jj,prepareClarify:(s,{cwd:a})=>Vte(a,s),clarify:zj,resolveReview:(s,{cwd:a})=>qte(s,{cwd:a})}});n(i.server);let o=new r;H.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} -`),await i.connect(o)}async function aXe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await jj({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){H.stdout.write(`${JSON.stringify(n,null,2)} -`),H.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){H.stdout.write(` -\u{1F4A1} A few more details would sharpen the spec: -`);for(let[o,s]of n.clarifyingQuestions.entries())H.stdout.write(` ${o+1}. ${s} -`);H.stdout.write(` -`)}else r||n.created.some(s=>s==="docs/conventions.md")&&(H.stdout.write(` -\u{1F4A1} Tip: for a more precise scaffold, describe the project: -`),H.stdout.write(` clad init -`),H.stdout.write(` e.g. clad init payment SaaS for B2B -`),H.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. - -`));H.exit(0)}async function cXe(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(()=>(Cfe(),Pfe)),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}`),H.stdout.write(`${JSON.stringify(n,null,2)} -`);else{let s=q(e.cwd??"."),a=n.featuresTouched.map(l=>_R(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&&H.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.`),H.exit(n.halt.class==="ALL_FEATURES_DONE"&&!o?0:1)}function lXe(t={}){try{let e=q();if(Sa("."))L("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{let r=xs(".");nu(".",r),rc("."),IY(".");let n=lu(".");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=zre(".");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=d0(".");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=wS.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){L("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),H.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)`),H.exit(0);return}L("pass","sync",`${e.features.length} features valid`),H.exit(0)}catch(e){L("fail","sync",e.message),H.exit(1)}}function uXe(t){if(!t){L("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),H.exit(2);return}let e=j_(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";L("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),H.exit(0)}function dXe(t,e={}){if(!t){L("fail","rollback","feature id required (e.g. clad rollback F-001)"),H.exit(2);return}let r=M_(".",t);if(!r){L("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),H.exit(1);return}F_(".",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?H.stdout.write(`Run: git checkout ${r.gitHead} -`):H.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. -`),H.exit(0)}async function fXe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await RC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function pXe(){L("note","update","reconciling the current project after the engine upgrade");let t=await H7(".",{wireHosts:async()=>(await RC({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."),H.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);H.stdout.write(` +`}Yq();$V();_V();wV();AV();Kq();OV();NV();DV();LV();RI();gt();var $pt=[pC,wC,dC,SC,fC,hC,QR,yC,gC,XR];function Ipt(t,e){if(t.path){let n=t.path.split("#")[0].trim(),i=[Tt.module(n),Tt.test(n),Tt.doc(n)].filter(s=>e.has(s));if(i.length>0)return i}let r=Cl().exec(t.message??"");return r&&e.has(Tt.feature(r[0]))?[Tt.feature(r[0])]:[]}function FO(t,e="."){let r=new Set(t.nodes.map(s=>s.id)),n={};try{id(e,oe(e))}catch{}try{for(let s of $pt){let o=[];try{o=s.run({cwd:e})}catch{continue}for(let a of o)if(!(a.severity!=="error"&&a.severity!=="warn"))for(let c of Ipt(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{id(e,null)}let i={};for(let s of Object.keys(n).sort()){let o=n[s];i[s]={severity:o.severity,count:o.count,detectors:[...o.detectors].sort()}}return i}function Txe(t,e=10){let r={};for(let o of t.nodes)r[o.kind]=(r[o.kind]??0)+1;let n={},i=new Map;for(let o of t.edges)n[o.kind]=(n[o.kind]??0)+1,i.set(o.from,(i.get(o.from)??0)+1),i.set(o.to,(i.get(o.to)??0)+1);let s=t.nodes.map(o=>({id:o.id,kind:o.kind,label:o.label,degree:i.get(o.id)??0})).sort((o,a)=>a.degree-o.degree||o.id.localeCompare(a.id)).slice(0,e);return{nodeCount:t.nodes.length,edgeCount:t.edges.length,nodesByKind:r,edgesByKind:n,hubs:s}}function Oxe(t){let e=n=>Object.keys(n).sort().map(i=>`${i}=${n[i]}`).join(" ");return`${[`nodes: ${t.nodeCount} (${e(t.nodesByKind)})`,`edges: ${t.edgeCount} (${e(t.edgesByKind)})`,"hubs (top by degree):",...t.hubs.map((n,i)=>` ${String(i+1).padStart(2)}. [${n.kind}] ${n.label} \u2014 degree ${n.degree}`)].join(` +`)} +`}var Rpt=new Set(["mermaid","dot","json","obsidian","html"]);function Nxe(t){return`${JSON.stringify(t)} +`}function yg(t){return t===void 0?void 0:Number(t)}function Cpt(t,e){let r=Jc(t),n=r?r.path:t.startsWith("artifact:")?t.slice(9):void 0;return(n===void 0?[t]:[Tt.module(n),Tt.test(n),Tt.doc(n)]).filter(s=>e.has(s))}function Tpt(t,e){let r=new Set(t.nodes.map(i=>i.id)),n=new Set;for(let i of e.nodes??[])for(let s of Cpt(i.address,r))n.add(s);return xxe(t,[...n],0)}function Opt(t,e){if(t.kind==="rejected"){for(let n of t.reasons)G("fail","graph",n);process.exit(1)}let r=t.resolution;if(r?.state==="ambiguous"){G("fail","graph",`'${e}' matches more than one node \u2014 ${r.reason}`);for(let n of r.candidates??[])G("note","graph",`candidate: ${n}`)}else G("fail","graph",`no graph node matches '${e}' \u2014 ${r?.reason??"unresolved"}`);for(let n of r?.accepted_forms??[])G("note","graph",`accepted: ${n}`);process.exit(1)}function P3(t,e,r){if(e){R3(T3(e),{recursive:!0}),C3(e,t,"utf8"),G("pass","graph",`wrote ${r} graph to ${e}`),process.exit(0);return}process.stdout.write(t,()=>process.exit(0))}function Dxe(t={}){try{let e=t.format??"mermaid";if(!Rpt.has(e)){G("fail","graph",`unknown --format '${e}' \u2014 use mermaid | dot | json | obsidian | html`),process.exit(1);return}let r=e,n=Nl(".");if(!t.focus&&r==="json"){P3(Nxe(pY(n)),t.out,"json");return}let i=vw(n,{cwd:"."});if(t.focus){let s=X0(n,{query:t.focus,...yg(t.depth)===void 0?{}:{max_depth:yg(t.depth)},...yg(t.maxNodes)===void 0?{}:{max_nodes:yg(t.maxNodes)},...yg(t.maxEdges)===void 0?{}:{max_edges:yg(t.maxEdges)},view:"full"},{byteCeiling:null});if(s.kind!=="projection"&&Opt(s,t.focus),r==="json"){P3(Nxe(s),t.out,"json");return}i=Tpt(i,s)}if(r==="obsidian"){let s=t.out??".cladding/graph",o=Pxe(i);for(let[a,c]of o){let l=Ppt(s,a);R3(T3(l),{recursive:!0}),C3(l,c,"utf8")}G("pass","graph",`wrote ${o.size} note(s) to ${s} \u2014 open it as an Obsidian vault`),process.exit(0);return}if(r==="html"){if(!t.out){G("fail","graph","--format html requires --out (a single self-contained .html file)"),process.exit(1);return}let s=MO(i,FO(i,"."));R3(T3(t.out),{recursive:!0}),C3(t.out,s,"utf8"),G("pass","graph",`wrote a self-contained viewer to ${t.out} \u2014 open it in a browser (offline)`),process.exit(0);return}P3(r==="dot"?$xe(i):Axe(i),t.out,r)}catch(e){G("fail","graph",e.message),process.exit(1)}}function jxe(){try{let t=vw(Nl("."),{cwd:"."});process.stdout.write(Oxe(Txe(t)),()=>process.exit(0))}catch(t){G("fail","graph",t.message),process.exit(1)}}import{createServer as Npt}from"node:http";import{existsSync as Dpt,watch as jpt}from"node:fs";import{join as Lpt}from"node:path";Dd();Qy();function Mpt(t={}){let e=t.cwd??".",r=new Set,n=()=>Nl(e),i=()=>vw(n(),{cwd:e}),s=()=>{for(let d of r)try{d.write(`data: refresh + +`)}catch{r.delete(d)}},o=Npt((d,p)=>{let f=(d.url??"/").split("?")[0],h=(d.headers.host??"").split(":")[0];if(h&&h!=="localhost"&&h!=="127.0.0.1"&&h!=="[::1]"&&h!=="::1"){p.writeHead(403,{"Content-Type":"text/plain"}),p.end("forbidden host");return}try{if(f==="/graph.json"){let m=Ixe(i());p.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),p.end(m);return}if(f==="/graph-v2.json"){let m=JSON.stringify(Q0(n()));p.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),p.end(m);return}if(f==="/health.json"){let m=JSON.stringify(FO(i(),e));p.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),p.end(m);return}if(f==="/events"){p.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"}),p.write(`: connected + +`),r.add(p),d.on("close",()=>r.delete(p));return}if(f==="/"||f==="/index.html"){let m=MO(i());p.writeHead(200,{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store"}),p.end(m);return}p.writeHead(404,{"Content-Type":"text/plain"}),p.end("not found")}catch(m){if(p.headersSent)try{p.end()}catch{}else{p.writeHead(503,{"Content-Type":"application/json","Cache-Control":"no-store"});try{p.end(JSON.stringify({error:m.message}))}catch{}}}}),a=null,c=()=>{a&&clearTimeout(a),a=setTimeout(s,400)},l=[];for(let d of["spec","docs"]){let p=Lpt(e,d);if(Dpt(p))try{let f=jpt(p,{recursive:!0},c);f.on("error",()=>{try{f.close()}catch{}}),l.push(f)}catch{}}let u=setInterval(()=>{for(let d of r)try{d.write(`: keep-alive + +`)}catch{r.delete(d)}},3e4);return typeof u.unref=="function"&&u.unref(),new Promise((d,p)=>{o.on("error",p),o.listen(t.port??0,"127.0.0.1",()=>{let f=o.address(),h=typeof f=="object"&&f?f.port:t.port??0;d({port:h,broadcast:s,close:()=>new Promise(m=>{a&&clearTimeout(a),clearInterval(u);for(let y of l)try{y.close()}catch{}for(let y of r)try{y.end()}catch{}r.clear(),o.close(()=>m()),typeof o.closeAllConnections=="function"&&o.closeAllConnections()})})})})}async function Lxe(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await Mpt({port:e,cwd:t.cwd??"."});G("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){G("fail","graph",r.message),process.exit(1)}}RU();wi();kr();import sn from"node:process";import{existsSync as Fpt,readFileSync as zpt}from"node:fs";import{join as Upt}from"node:path";function Fxe(t){if(t.to!=="0.2"){let r="Migration preview currently supports only schema 0.2. Use `clad migrate --to 0.2`.";return O3(t,{error:"unsupported_target",message:r},r),sn.exitCode=1,{ok:!1}}let e=t.cwd??sn.cwd();try{let r=Rf(e);return Bpt(t,e,r)}catch(r){return zO(t,e,r,!1),sn.exitCode=1,{ok:!1}}}function Bpt(t,e,r){if(t.apply){let n;try{n=Vpt(e)}catch(i){return zO(t,e,i,r),sn.exitCode=1,{ok:!1}}if(n)try{let i=VU(e,{previewDigest:"0".repeat(64),confirmed:[]}),s=r?"Schema migration is already applied. Recovery restored prior bytes; this action made no additional changes.":"Schema migration is already applied; no files changed.";return t.json?sn.stdout.write(`${JSON.stringify({ok:!0,...i,...r?{recovered:!0}:{}},null,2)} +`):sn.stdout.write(`${s} +`),{ok:!0,changed:i.changed}}catch(i){return zO(t,e,i,r),sn.exitCode=1,{ok:!1}}if(!t.resolutions){let i=r?"Migration decisions still need explicit confirmation. Recovery restored prior bytes; this action made no additional changes.":"Migration decisions still need explicit confirmation. No files were changed.";return O3(t,{error:"migration_unresolved",message:i,writes:0},i,r),sn.exitCode=1,{ok:!1}}try{let i=JSON.parse(zpt(t.resolutions,"utf8"));if(!i||typeof i!="object"||!Array.isArray(i.confirmed)||typeof i.previewDigest!="string"||Object.keys(i).some(a=>a!=="previewDigest"&&a!=="confirmed"))throw new Error("resolution file must contain exactly previewDigest and confirmed decisions from the reviewed preview");let s=VU(e,i),o=s.changed?"Schema migration was applied as one recoverable workspace transaction.":r?"Schema migration is already applied. Recovery restored prior bytes; this action made no additional changes.":"Schema migration is already applied; no files changed.";return t.json?sn.stdout.write(`${JSON.stringify({ok:!0,...s,...r?{recovered:!0}:{}},null,2)} +`):sn.stdout.write(`${o} +`),{ok:!0,changed:s.changed}}catch(i){return zO(t,e,i,r),sn.exitCode=1,{ok:!1}}}try{let n=a_(e),i=Jh(n),s=`${JSON.stringify({...n,previewDigest:i,...r?{recovered:!0}:{}},null,2)} +`;return t.json?sn.stdout.write(s):sn.stdout.write(`Migration preview is ready. ${n.requiredResolution.length} decisions still need review. It identifies ${n.legacyL2Baseline.candidateCount} completed legacy criteria for a separate accept-or-reject baseline decision (census digest: ${n.legacyL2Baseline.candidateCensusSha256}). Review digest: ${i}. ${r?"Recovery restored prior bytes; this action made no additional changes.":"No files were changed."} +Next: review and export the decisions, then rerun with \`clad migrate --to 0.2 --apply --resolutions \`. +`),{ok:!0,output:s}}catch{let n=r?"Migration preview could not be prepared from the current specification. Recovery restored prior bytes; this action made no additional changes.":"Migration preview could not be prepared from the current specification. No files were changed.";return O3(t,{error:"migration_preview_failed",message:n,writes:0},n,r),sn.exitCode=1,{ok:!1}}}function zO(t,e,r,n){let s=(r instanceof q?r:void 0)?.code??"MIGRATION_APPLY_FAILED",o="Migration could not be applied.";if(s==="MIGRATION_UNRESOLVED"&&(o="Migration decisions are incomplete or ambiguous."),s==="RECOVERY_FAILED"){let c=qpt(e);c===void 0?o="A prior migration needs recovery before it can continue.":o=`A prior migration needs recovery before it can continue. Restore only the recorded migration paths with: ${c}`}let a=n?`${o} Recovery restored prior bytes; this action made no additional changes.`:`${o} No files were changed.`;t.json?sn.stdout.write(`${JSON.stringify({error:"migration_apply_failed",code:s,message:n?a:r.message,...n?{details:r.message,recovered:!0}:{},writes:0},null,2)} +`):sn.stderr.write(`${a} +`)}function qpt(t){try{let e=$2(t);return!e?.head||e.paths.length===0?void 0:`git restore --source=${Mxe(e.head)} -- ${e.paths.map(Mxe).join(" ")}`}catch{return}}function Mxe(t){return`'${t.replace(/'/g,"'\\''")}'`}function Vpt(t){return vt(t)==="0.2"&&Fpt(Upt(t,"spec/generated/migration-baseline-0.1-to-0.2.yaml"))}function O3(t,e,r,n=!1){t.json?sn.stdout.write(`${JSON.stringify({...e,...n?{recovered:!0}:{}},null,2)} +`):sn.stderr.write(`${r} +`)}wi();Cd();kr();import bg from"node:process";import{existsSync as qxe,readFileSync as Vxe,writeFileSync as Gpt}from"node:fs";import{join as Gxe}from"node:path";var Sw=`${EI("generated-index").oldPath} merge=union`,ww=`${EI("generated-index").newPath} merge=union`;function zxe(t){return t.artifacts.map(e=>({id:e.id,from:e.resolvedPath??e.oldPath,to:e.newPath,action:e.irregular.length>0?"irregular":e.presence==="both"?"conflict":e.presence==="new"?"already-relocated":e.presence==="old"?"move":"absent",...e.irregular.length>0?{irregular:e.irregular}:{}}))}function N3(t){let e=Gxe(t,".gitattributes");if(!qxe(e))return{line:Sw,action:"absent"};let r=Vxe(e,"utf8").split(` +`).map(n=>n.trim());return r.includes(ww)?{line:ww,action:"already-retargeted"}:{line:Sw,action:r.includes(Sw)?"retarget":"absent"}}function Hpt(t){let e=Gxe(t,".gitattributes");if(!qxe(e))return!1;let n=Vxe(e,"utf8").split(` +`),i=!1,s=n.map(o=>o.trim()!==Sw?o:(i=!0,ww));return i&&Gpt(e,s.join(` +`),"utf8"),i}function Uxe(t,e,r){let n=t.map(l=>{let u=l.action==="move"?`${l.from} \u2192 ${l.to}`:l.action==="already-relocated"?`${l.to} (already relocated)`:l.action==="absent"?`${l.from} (nothing to move)`:l.action==="irregular"?`${r_(l.irregular??[])} blocks relocation`:`${l.from} and ${l.to} both exist`;return` ${l.id}: ${u}`}),i=e.action==="retarget"?` .gitattributes: \`${Sw}\` becomes \`${ww}\``:e.action==="already-retargeted"?` .gitattributes: \`${ww}\` is already set`:" .gitattributes: no index merge attribute to retarget",s=t.filter(l=>l.action==="move").length,o=Wpt(t),a=r?s===0?"Generated projections are already relocated; no files changed.":`Relocated ${s} generated ${s===1?"projection":"projections"} in one recoverable transaction.`:o.length>0?`Relocation is blocked${s===0?"":`; ${s} pending ${s===1?"move waits":"moves wait"} behind it`}. No files were changed.`:s===0?"Nothing to relocate. No files were changed.":`Relocation would move ${s} generated ${s===1?"projection":"projections"}. No files were changed.`,c=r?[]:o.length>0?o:s===0?[]:["Next: rerun with `clad relocate-generated --apply` to perform the move."];return[a,...n,i,...c].join(` +`)+` +`}function Wpt(t){let e=t.flatMap(n=>n.irregular??[]),r=t.filter(n=>n.action==="conflict");return[...e.length===0?[]:[`Blocked: a generated projection may not be a directory or a symbolic link: ${r_(e)}. Remove it, then rerun.`],...r.length===0?[]:[`Blocked: a generated projection exists at both of its known locations: ${r.map(n=>`${n.id} (${n.from} and ${n.to})`).join("; ")}. Remove the copy you do not keep, then rerun.`]]}function Hxe(t){let e=t.cwd??bg.cwd(),r=!1;try{if(r=Rf(e),vt(e)!=="0.2")return _w(t,"unsupported_schema","Relocation needs a schema 0.2 specification. Run `clad migrate --to 0.2` first; schema migration and relocation are separate steps.")}catch(c){return _w(t,"relocation_failed",Bxe(c,r))}let n=Rd(e),i=zxe(n),s=N3(e),o=i.filter(c=>c.action==="conflict"),a=n.artifacts.flatMap(c=>c.irregular);if(!t.apply){let c=t.json?`${JSON.stringify({ok:!0,state:n.state,artifacts:i,gitattributes:s,writes:0,...r?{recovered:!0}:{}},null,2)} +`:Uxe(i,s,!1);return bg.stdout.write(c),{ok:!0,changed:!1,output:c,plan:i}}if(a.length>0)return _w(t,"relocation_blocked",`A generated projection may not be a directory or a symbolic link: ${r_(a)}. No files were changed.`,n.state,i);if(o.length>0){let c=o.map(l=>`${l.id} (${l.from} and ${l.to})`).join("; ");return _w(t,"relocation_conflict",`A generated projection exists at both of its known locations: ${c}. Remove the copy you do not keep, then rerun. No files were changed.`,n.state,i)}try{let c=Zpt(e,t.faultAfterReplacementForTesting),l=c?Hpt(e):!1,u=zxe(Rd(e)),d=t.json?`${JSON.stringify({ok:!0,changed:c,state:Rd(e).state,artifacts:u,gitattributes:{...N3(e),retargeted:l},writes:c?i.filter(p=>p.action==="move").length:0,...r?{recovered:!0}:{}},null,2)} +`:Uxe(i,N3(e),!0);return bg.stdout.write(d),{ok:!0,changed:c,output:d,plan:i}}catch(c){return _w(t,"relocation_failed",Bxe(c,r),n.state,i)}}function Zpt(t,e){return rr(t,()=>{let r=Rd(t);if(r.artifacts.some(i=>i.presence==="both"))throw new q("INVALID_OPERATION","A generated projection exists at both of its known locations.");let n=[];for(let i of r.pendingMoves){let s=Tr(t,i.oldPath);s!==null&&(n.push({path:i.oldPath,before:s,after:null}),n.push({path:i.newPath,before:null,after:s}))}return n.push(...ZU(t,Goe(r))),n.length===0?!1:(Gr(t,n,e),!0)})}function Bxe(t,e){let r=t instanceof q?t:void 0,n=r?.code==="BUSY"?"A specification transaction is still committing; try again shortly.":r?.message??"Relocation could not be prepared from the current workspace.";return e?`${n} Recovery restored prior bytes; this action made no additional changes.`:`${n} No files were changed.`}function _w(t,e,r,n,i){return t.json?bg.stdout.write(`${JSON.stringify({error:e,message:r,writes:0,...n===void 0?{}:{state:n},...i===void 0?{}:{artifacts:i}},null,2)} +`):bg.stderr.write(`${r} +`),bg.exitCode=1,{ok:!1,changed:!1,...i===void 0?{}:{plan:i}}}wi();import vg from"node:process";function Wxe(t){let e=t.cwd??vg.cwd(),r={kind:"feature.begin",featureId:t.featureId};try{let n=_i({cwd:e,operations:[r],inputRevisions:Bi(e,[r])}),i=n.changed?"Implementation cycle started. The pre-cycle checkpoint and specification update were saved together.":"Implementation cycle is already active. No specification changes were needed.";return t.json?vg.stdout.write(`${JSON.stringify({ok:!0,...n},null,2)} +`):vg.stdout.write(`${i} +`),{ok:!0}}catch(n){let i=n instanceof q&&n.code==="BUSY"?"The specification is being updated by another task. Try starting the cycle again shortly.":n.message;return t.json?vg.stdout.write(`${JSON.stringify({ok:!1,error:i},null,2)} +`):vg.stderr.write(`${i} +`),vg.exitCode=1,{ok:!1}}}L3();xm();kr();import $p from"node:process";function i0e(t,e={}){let r=e.cwd??$p.cwd();if(typeof t!="string"||t.trim().length===0||t.trim().length>128)return kw({ok:!1,code:"INVALID_OPERATION",message:"An issuer name must be between 1 and 128 characters."},e);let n=t.trim();try{return kw(rr(r,()=>{if(vt(r)!=="0.2")return{ok:!1,code:"INVALID_WORKSPACE",message:"A registered issuer requires a schema 0.2 workspace."};if(Wq(r).some(o=>o.issuer===n))return{ok:!1,code:"INVALID_OPERATION",message:`Issuer ${n} is already registered in ${Hi}. Registering the same issuer twice is refused; there is no rotation path yet.`};let i=e0e(),s=Ige(r,{issuer:n,spkiDer:i.spkiDer});return Gr(r,[{path:Hi,before:s.before,after:s.after}]),{ok:!0,code:"OK",message:`Registered issuer ${n}. The private key stays at ${i.privateKeyPath} and only the public key entered ${Hi}.`,issuer:n,issuerKeyId:i.issuerKeyId,privateKeyPath:i.privateKeyPath,registryPath:Hi}}),e)}catch(i){let s=i.message;return kw({ok:!1,code:s.includes("BUSY")?"BUSY":"INVALID_OPERATION",message:s},e)}}function s0e(t={}){let e=t.cwd??$p.cwd();try{let r=Wq(e).map(n=>({...n,signingKeyPresent:t0e(n.issuer_key_id)}));return kw({ok:!0,code:"OK",message:r.length===0?`No issuers are registered in ${Hi}; verified signoff is unavailable until one is.`:`${r.length} registered issuer${r.length===1?"":"s"}; private keys are read from ${xw()}.`,registryPath:Hi,issuers:r},t)}catch(r){return kw({ok:!1,code:"INVALID_OPERATION",message:r.message},t)}}function kw(t,e){if(e.json)$p.stdout.write(`${JSON.stringify(t,null,2)} +`);else{(t.ok?$p.stdout:$p.stderr).write(`${t.message} +`);for(let r of t.issuers??[])$p.stdout.write(` ${r.issuer} ${r.issuer_key_id} ${r.signingKeyPresent?"signing key present":"no local signing key"} +`)}return t.ok||($p.exitCode=1),t}M3();import{createInterface as uft}from"node:readline/promises";import nu from"node:process";function o0e(t,e){return c0e(e)?wg(Sg(F3(t,e)),e):wg({ok:!1,code:"INVALID_OPERATION",message:"Invalid asserted signoff claim, result, or note length."},e)}async function a0e(t,e){if(!c0e(e))return wg({ok:!1,code:"INVALID_OPERATION",message:"Invalid asserted signoff claim, result, or note length."},e);if(!e.issuer||e.issuer.trim().length===0)return wg({ok:!1,code:"INVALID_OPERATION",message:"A verified signoff requires --issuer with a registered issuer name."},e);let r=e.interactive??nu.stdin.isTTY===!0,n=e.confirm??(r?dft:void 0);if(!n){let i=Sg(F3(t,e));return wg({ok:!1,code:"HUMAN_REQUIRED",message:"A verified signoff needs an interactive terminal so a human can re-enter the feature id. Only asserted history was recorded.",...i.evidence?{evidence:i.evidence}:{}},e)}return wg(await BO({...F3(t,e),issuer:e.issuer.trim(),confirm:n}),e)}var dft=async t=>{let e=uft({input:nu.stdin,output:nu.stderr});try{return await e.question(t)}finally{e.close()}};function c0e(t){return["audit","uat"].includes(t.claim)&&(t.result===void 0||["pass","fail"].includes(t.result))&&(t.note===void 0||t.note.length<=4096)}function F3(t,e){return{cwd:e.cwd??nu.cwd(),featureId:t,claim:e.claim,...e.criterion?{criterion:e.criterion}:{},...e.result?{result:e.result}:{},...e.note?{note:e.note}:{}}}function wg(t,e){return e.json?nu.stdout.write(`${JSON.stringify(t,null,2)} +`):(t.ok?nu.stdout:nu.stderr).write(`${t.message} +`),t.ok||(nu.exitCode=1),t}UO();kn();xm();import Aw from"node:process";import{readFileSync as pft}from"node:fs";function u0e(t,e){let r=e.cwd??Aw.cwd(),n;try{n=pft(t,"utf8")}catch(a){return l0e(e,{ok:!1,code:"INVALID_RECEIPT",message:a.message,changed:!1})}let i;try{i=yr(n)}catch{i=void 0}let s=KR(r),o=_g({cwd:r,receiptYaml:n,trustSnapshot:s.trustSnapshot,...i===void 0?{}:{expected:s.expectedDigestContext(i)}});return l0e(e,o)}function l0e(t,e){return t.json?Aw.stdout.write(`${JSON.stringify(e,null,2)} +`):(e.ok?Aw.stdout:Aw.stderr).write(`${e.message} +`),e.ok||(Aw.exitCode=1),e}var fft=["stage_1.1","stage_2.1","stage_2.3"];function hft(t){return(t.features??[]).filter(e=>e.status==="done")}function mft(t,e){let r=hft(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(s=>(s.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 d0e(t,e){let r=[];for(let n of fft){if(!e.some(o=>o.stage===n&&o.status==="skip"))continue;let s=mft(t,n);s&&r.push({stage:n,label:"Verification",message:s})}return r}import p0e from"node:process";function gft(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 qO(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=gft(n,t);i.pass||r.push(i)}return r}hi();var z3="stage_4.1";function U3(t={}){let{cwd:e="."}=t,r=Dr(e);if(r.length===0)return{stage:z3,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=qO(r);if(n.length===0)return{stage:z3,pass:!0,exitCode:0};let i=n.map(s=>`${s.acId}: ${s.reason}`).join("; ");return{stage:z3,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var yft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${p0e.argv[1]}`;if(yft){let t=U3();console.log(JSON.stringify(t)),p0e.exit(t.exitCode)}Qh();Qf();xi();import f0e from"node:process";var VO="stage_1.4";function B3(t={}){let{cwd:e="."}=t,r;try{r=Mt("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:VO,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:VO,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:VO,pass:!0,exitCode:0}:{stage:VO,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var bft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${f0e.argv[1]}`;if(bft){let t=B3();console.log(JSON.stringify(t)),f0e.exit(t.exitCode)}xi();Qf();import h0e from"node:process";NR();xs();Xf();yE();var vft={type:"type",lint:"lint",test:"test",coverage:"coverage"};function _ft(t,e,r,n){let i=kq(t),s;switch(e){case"type":s=r.flatMap(o=>[hl(o.path,"compileKotlin"),hl(o.path,"compileTestKotlin")]);break;case"lint":s=r.map(o=>hl(o.path,"ktlintCheck"));break;case"test":s=r.map(o=>hl(o.path,"test"));break;case"coverage":s=r.map(o=>{let a=n??(Sq(o.dir)?"kover":"jacoco");return hl(o.path,vq[a])});break}return{cmd:i,args:s}}function ba(t,e={}){let r=e.cwd??".",n=dr(r),i=n.language;if(e.cmd)return{cmd:e.cmd,args:e.args??[],language:i};let s=n.gates[vft[t]],o=Yf(r),a=mE(s?.cmd),c=[];o.scope==="feature"&&a&&e.focusModules&&e.focusModules.length>0&&(c=gE(r,e.focusModules));let l=o.commands?.[t];if(l){let u=Nte(l,c);if(u)return{cmd:u.cmd,args:u.args,language:i}}if(c.length>0){let u=_ft(r,t,c,o.coverage);return{cmd:u.cmd,args:u.args,language:i}}return{cmd:s?.cmd,args:s?.args,language:i}}ks();var GO="stage_2.2";function q3(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ba("coverage",t))}catch(c){return{stage:GO,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:GO,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`,skipReason:"no-runner"};let s=Bte(e),o=s?s.proc:Mt(r,[...n],{cwd:e,reject:!1}),a=jr(GO,r,o,n);return a||nn(GO,o)}var Sft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${h0e.argv[1]}`;if(Sft){let t=q3();console.log(JSON.stringify(t)),h0e.exit(t.exitCode)}cS();FV();xi();import m0e from"node:process";var wft=/\x1b\[[0-9;]*m/g;function $w(t){return t.replace(wft,"")}function xft(t){for(let e of t.split(/\r?\n/)){let r=$w(e).trim();if(r)return r}}var kft=/^(.+?)\((\d+),(\d+)\):\s*error\s+(TS\d+):\s*(.+)$/,Eft=/^(.+?):(\d+):(\d+)\s*-\s*error\s+(TS\d+):\s*(.+)$/;function Aft(t){let e=[],r=new Set;for(let n of t.split(/\r?\n/)){let i=$w(n),s=kft.exec(i)??Eft.exec(i);if(!s)continue;let o=s[1].trim(),a=Number(s[2]),c=s[4],l=s[5].trim(),u=`${o}:${a}:${c}:${l}`;r.has(u)||(r.add(u),e.push({detector:c,severity:"error",path:o,line:a,message:l}))}return e}function $ft(t){let e=t.trim();if(!e.startsWith("["))return null;let r;try{r=JSON.parse(e)}catch{return null}if(!Array.isArray(r))return null;let n=[];for(let i of r){let s=i.filePath;for(let o of i.messages??[]){let a=o.severity===1?"warn":"error",c={detector:o.ruleId??"LINT",severity:a,message:(o.message??"").trim()||"lint problem",...s?{path:s}:{},...o.line!==void 0?{line:o.line}:{}};n.push(c)}}return n}var Ift=/^[✖✗×]\s|\bproblems?\b|\bpotentially fixable\b/,Pft=/^\s+(\d+):(\d+)\s+(error|warning)\s+(.+?)(?:\s{2,}([@\w][\w./-]*))?\s*$/;function Rft(t){let e=$ft(t);if(e)return e;let r=[],n;for(let i of t.split(/\r?\n/)){let s=$w(i),o=Pft.exec(s);if(o){let c=o[3]==="warning"?"warn":"error",l={detector:o[5]??"LINT",severity:c,message:o[4].trim()||"lint problem",...n?{path:n}:{},line:Number(o[1])};r.push(l);continue}let a=s.trim();a&&!/^\s/.test(s)&&!Ift.test(a)&&/[\\/.]/.test(a)&&(n=a)}return r}var Cft=/^\s*(?:[×✗]\s+)?FAIL\s+(\S+?)(?:\s+>\s+(.+))?\s*$/,Tft=/^\s*❯\s+(\S+?):(\d+):(\d+)/;function Oft(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=[];for(let s of n){let o=s.name;for(let a of s.assertionResults??[]){if(a.status!=="failed")continue;let c={detector:"UNIT",severity:"error",message:(a.fullName??a.title??"unit test failed").trim(),...o?{path:o}:{},...a.location?.line!==void 0?{line:a.location.line}:{}};i.push(c)}}return i}function Nft(t){let e=Oft(t);if(e)return e;let r=[],n=new Set,i;for(let s of t.split(/\r?\n/)){let o=$w(s),a=Cft.exec(o);if(a){i=(a[2]??a[1]).trim();continue}let c=Tft.exec(o);if(c){let l=c[1];if(l.includes("node_modules"))continue;let u=Number(c[2]),d=`${l}:${u}`;if(n.has(d))continue;n.add(d),r.push({detector:"UNIT",severity:"error",path:l,line:u,message:i??"unit test failed"}),i=void 0}}return r}var Dft={type:"TYPE",lint:"LINT",unit:"UNIT"},jft=/^Changed\s+(.+)$/;function Lft(t){let e=[];for(let r of t.split(/\r?\n/)){let n=jft.exec($w(r).trim());n&&n[1]&&e.push({detector:"LINT",severity:"error",path:n[1],message:"not formatting-clean \u2014 differs from the formatter output"})}return e}function Mft(t,e,r,n){let i=[e,r].filter(o=>o&&o.trim()).join(` +`),s=[];try{switch(t){case"type":s=Aft(i);break;case"lint":s=Rft(i),s.length===0&&(s=Lft(i));break;case"unit":s=Nft(i);break}}catch{s=[]}if(s.length>0)return s;if(n!==0){let o=xft(r.trim()||e.trim());if(o)return[{detector:Dft[t],severity:"error",message:o}]}return[]}function xg(t,e,r){if(e.pass)return e;let n=Mft(t,String(r.stdout??""),String(r.stderr??""),e.exitCode);return n.length>0?{...e,findings:n}:e}ks();var HO="stage_1.2";function Fft(t,e){if(t==="dart"&&e[0]==="format")return"dart format .";if(t==="dotnet"&&e.includes("format"))return"dotnet format"}function V3(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ba("lint",t))}catch(c){return{stage:HO,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:HO,pass:!1,exitCode:2,stderr:`no linter registered for language '${i}'`,skipReason:"no-runner"};let s=Mt(r,[...n],{cwd:e,reject:!1}),o=jr(HO,r,s,n);if(o)return o;let a=xg("lint",nn(HO,s),s);if(!a.pass){let c=Fft(r,n);if(c)return{...a,hint:c}}return a}var zft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${m0e.argv[1]}`;if(zft){let t=V3();console.log(JSON.stringify(t)),m0e.exit(t.exitCode)}xi();xs();ks();import g0e from"node:process";var WO="stage_3.2";function G3(t={}){let{cwd:e="."}=t,r=dr(e),n=r.gates.perf,i=t.cmd??n?.cmd,s=t.args??n?.args;if(!i||!s)return{stage:WO,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&s[0]==="run"&&!_m(e,s[s.length-1]))return{stage:WO,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let o=Mt(i,[...s],{cwd:e,reject:!1}),a=jr(WO,i,o,s);return a||nn(WO,o)}var Uft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${g0e.argv[1]}`;if(Uft){let t=G3();console.log(JSON.stringify(t)),g0e.exit(t.exitCode)}xi();gt();ks();import{existsSync as Bft}from"node:fs";import{resolve as b0e}from"node:path";import v0e from"node:process";var go="stage_2.4",H3=5e3,qft=3e4;function W3(t={}){let{cwd:e="."}=t,r,n=[],i=!1,s=new Map;try{let f=oe(e);r=f.project.deliverable,n=f.project.smoke??[],i=f.features.some(h=>h.status==="done"),s=new Map(f.features.map(h=>[h.id,h.status]))}catch{return{stage:go,pass:!1,exitCode:2,stderr:"spec.yaml not loaded \u2014 deliverable smoke skipped"}}if(n.length>0)return Gft(e,n,{anyDone:i,featureStatus:s});if(!r)return{stage:go,pass:!1,exitCode:2,stderr:"no project.deliverable declared \u2014 skipped"};if(r.is_safe_to_smoke!==!0)return{stage:go,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not marked is_safe_to_smoke \u2014 skipped`};if(!i)return{stage:go,pass:!1,exitCode:2,stderr:"no done feature yet \u2014 deliverable smoke skipped"};let o=b0e(e,r.path);if(!Bft(o))return{stage:go,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??H3,c;try{c=Mt(o,[...r.smoke_args??[]],{cwd:e,reject:!1,timeout:a})}catch(f){c=f}let l=jr(go,r.path,c);if(l)return l;if(c.timedOut)return{stage:go,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:go,pass:!0,exitCode:0,disposition:"liveness"};let p=String(c.stderr??"").trim()||String(c.stdout??"").trim();return{stage:go,pass:!1,exitCode:1,stderr:`deliverable '${r.path}' exited ${d}, expected ${u}${p?` \u2014 ${p.slice(0,200)}`:""}`}}var y0e={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},Vft={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function Gft(t,e,r){let n=Math.min(e.length*H3,qft),i=Date.now(),s=[];for(let o of e){if(Date.now()-i>=n){s.push({argv:(o.run??[]).join(" ")||"(none)",kind:o.kind,disposition:"pending_env",detail:"stage time ceiling \u2014 not started",feature:o.feature,why:o.why});continue}s.push(Hft(t,o,r))}return Wft(s)}function Hft(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 s=e.feature;if(s!==void 0){let m=r.featureStatus.get(s);if(m!=="done"){let y=m===void 0?`bound feature ${s} not found in spec \u2014 not executed`:`bound feature ${s} is ${m}, not done \u2014 not executed`;return{argv:n,kind:"cli",disposition:"na",detail:y,feature:s,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 o=e.run??[];if(o.length===0)return{argv:"(none)",kind:"cli",disposition:"skip",detail:"cli smoke probe has no run argv \u2014 skipped",feature:s,why:i};let[a,...c]=o,l=a.startsWith(".")||a.startsWith("/")?b0e(t,a):a,u=H3,d;try{d=Mt(l,[...c],{cwd:t,reject:!1,timeout:u})}catch(m){d=m}if(Wd(d))return{argv:n,kind:"cli",disposition:"skip",detail:`'${a}' not installed`,feature:s,why:i};if(d.timedOut)return{argv:n,kind:"cli",disposition:"fail",detail:`timed out after ${u}ms`,feature:s,why:i};let p=e.expect?.exit??0,f=d.exitCode??1;if(f!==p){let m=String(d.stderr??"").trim()||String(d.stdout??"").trim();return{argv:n,kind:"cli",disposition:"fail",detail:`exited ${f}, expected ${p}${m?` \u2014 ${m.slice(0,200)}`:""}`,feature:s,why:i}}let h=e.expect?.token;return h?String(d.stdout??"").includes(h)?{argv:n,kind:"cli",disposition:"pass",detail:`ran clean (exit ${f}), stdout contains ${JSON.stringify(h)}`,feature:s,why:i}:{argv:n,kind:"cli",disposition:"fail",detail:`ran (exit ${f}) but stdout did not contain the AC token ${JSON.stringify(h)}`,feature:s,why:i}:{argv:n,kind:"cli",disposition:"liveness",detail:`ran clean (exit ${f}), no token declared \u2014 exit-only`,feature:s,why:i}}function Wft(t){let e="skip";for(let s of t)y0e[s.disposition]>y0e[e]&&(e=s.disposition);let r=t.map(s=>{let o=s.why?` \xB7 ${s.why}`:"";return`${Vft[s.disposition]} ${s.argv} \xB7 ${s.detail}${o}`}).join(` +`),n=t.map((s,o)=>({id:`probe_${o+1}`,kind:s.kind,disposition:s.disposition==="skip"?"na":s.disposition,bindsFeature:s.feature,why:s.why,detail:s.detail}));if(e==="skip")return{stage:go,pass:!1,exitCode:2,stderr:r,probes:n};let i=e==="fail"||e==="pending_env"||e==="advisory";return{stage:go,pass:!i,exitCode:i?1:0,disposition:e,stderr:r,probes:n}}var Zft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${v0e.argv[1]}`;if(Zft){let t=W3();console.log(JSON.stringify(t)),v0e.exit(t.exitCode)}xi();xs();ks();import _0e from"node:process";var ZO="stage_3.1";function Z3(t={}){let{cwd:e="."}=t,r=dr(e),n=r.gates.smoke,i=t.cmd??n?.cmd,s=t.args??n?.args;if(!i||!s)return{stage:ZO,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&s[0]==="run"&&!_m(e,s[s.length-1]))return{stage:ZO,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let o=Mt(i,[...s],{cwd:e,reject:!1}),a=jr(ZO,i,o,s);return a||nn(ZO,o)}var Jft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${_0e.argv[1]}`;if(Jft){let t=Z3();console.log(JSON.stringify(t)),_0e.exit(t.exitCode)}PV();xi();import S0e from"node:process";ks();var JO="stage_1.1";function J3(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=ba("type",t))}catch(a){return{stage:JO,pass:!1,exitCode:1,stderr:a.message}}if(!r||!n)return{stage:JO,pass:!1,exitCode:2,stderr:`no type checker registered for language '${i}'`,skipReason:"no-runner"};let s=Mt(r,[...n],{cwd:e,reject:!1}),o=jr(JO,r,s,n);return o||xg("type",nn(JO,s),s)}var Kft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${S0e.argv[1]}`;if(Kft){let t=J3();console.log(JSON.stringify(t)),S0e.exit(t.exitCode)}hi();gt();import w0e from"node:process";var KO="stage_4.2";function K3(t={}){let{cwd:e="."}=t,r;try{r=oe(e)}catch(o){return{stage:KO,pass:!1,exitCode:2,stderr:`spec.yaml not loaded: ${o.message}`}}let n=Dr(e);if(n.length===0)return{stage:KO,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.2"};let i=r.features.filter(o=>o.status==="done"),s=[];for(let o of i)n.some(c=>c.featureId===o.id&&c.kind==="pass"&&c.identity.author==="human")||s.push(o.id);return s.length===0?{stage:KO,pass:!0,exitCode:0}:{stage:KO,pass:!1,exitCode:1,stderr:`${s.length} done feature(s) lack human pass evidence: ${s.join(", ")}`}}var Yft=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${w0e.argv[1]}`;if(Yft){let t=K3();console.log(JSON.stringify(t)),w0e.exit(t.exitCode)}xi();import{randomBytes as rht}from"node:crypto";import{unlinkSync as nht}from"node:fs";import{tmpdir as iht}from"node:os";import{join as sht}from"node:path";import X3 from"node:process";Qf();ks();gt();import{readFileSync as Xft}from"node:fs";import{resolve as x0e}from"node:path";function Qft(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 s of n){if(typeof s.name!="string"||!s.name)continue;let o=x0e(s.name),a=i.get(o)??0;for(let c of s.assertionResults??[])c.status==="passed"&&(a+=1);i.set(o,a)}return i}function eht(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function tht(t,e,r){let n=[];for(let i of t.features??[]){if(i.status!=="done")continue;let s=[],o=new Set;for(let u of i.acceptance_criteria??[])for(let d of u.test_refs??[]){let p=eht(d);p&&!o.has(p)&&(o.add(p),s.push(p))}if(s.length===0)continue;let a=!0,c=!1;for(let u of s){let d=e.get(x0e(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:s[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 Y3(t,e){try{let r=Qft(Xft(t,"utf8"));return r?tht(oe(e),r,e):[]}catch{return[]}}var Ii="stage_2.1";function k0e(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function E0e(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function A0e(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 s of e.matchAll(i))r.push(Number(s[1]));return r.length>0&&r.every(i=>i===0)}function oht(t,e,r){let n,i;try{({cmd:n,args:i}=ba("coverage",t))}catch{return null}if(!n||!i||!k0e(n,i))return null;let s=n,o=i,a=EM(e,d=>{let p=Object.freeze([...o,"--reporter=default","--reporter=json",`--outputFile=${d}`]),f=Mt(s,[...p],{cwd:e,reject:!1});return kM(e,d,[s,...p]),f});if(!a)return null;let{proc:c,jsonFile:l}=a;if(jr(Ii,n,c,o))return null;let u=nn(Ii,c);if(AM(u)==="fallback")return null;if(r){let d=Y3(l,e);if(d.length>0)return{stage:Ii,pass:!1,exitCode:1,findings:d,stderr:d[0].message}}return{stage:Ii,pass:!0,exitCode:0}}function aht(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=ba("coverage",t))}catch{return null}if(!n||!i||!E0e(n,i))return null;let s=n,o=i,a=EM(e,()=>Mt(s,[...o],{cwd:e,reject:!1}));if(!a||jr(Ii,s,a.proc,o))return null;let c=nn(Ii,a.proc);if(AM(c)==="fallback")return null;if(r&&A0e(a.proc)){let l={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Ii,pass:!1,exitCode:1,findings:[l],stderr:l.message}}return{stage:Ii,pass:!0,exitCode:0}}function Q3(t={}){let{cwd:e=".",strict:r=!1}=t,n,i,s;try{({cmd:n,args:i,language:s}=ba("test",t))}catch(p){return{stage:Ii,pass:!1,exitCode:1,stderr:p.message}}if(!n||!i)return{stage:Ii,pass:!1,exitCode:2,stderr:`no unit test runner registered for language '${s}'`,skipReason:"no-runner"};let o=k0e(n,i),a=E0e(n,i),c=r&&o,l=o&&xM(e);if(wM()&&o){let p=oht(t,e,c);if(p)return p}if(wM()&&a){let p=aht(t,e);if(p)return p}let u,d=i;(c||l)&&(u=sht(iht(),`clad-vitest-${X3.pid}-${rht(6).toString("hex")}.json`),d=[...i,"--reporter=default","--reporter=json",`--outputFile=${u}`]);try{let p=Mt(n,[...d],{cwd:e,reject:!1});l&&u&&kM(e,u,[n,...d]),!o&&xM(e)&&jte(e,[n,...d]);let f=jr(Ii,n,p,d);if(f)return f;let h=xg("unit",nn(Ii,p),p);if(r&&h.pass&&A0e(p)){let m={detector:"VACUOUS_TESTS",severity:"error",message:"The unit test command exited successfully but reported zero executed tests."};return{stage:Ii,pass:!1,exitCode:1,findings:[m],stderr:m.message}}if(c&&h.pass&&u){let m=Y3(u,e);if(m.length>0)return{stage:Ii,pass:!1,exitCode:1,findings:m,stderr:m[0].message}}return h}finally{if(u)try{nht(u)}catch{}}}var cht=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${X3.argv[1]}`;if(cht){let t=Q3();console.log(JSON.stringify(t)),X3.exit(t.exitCode)}xi();xs();ks();import $0e from"node:process";var YO="stage_3.3";function e9(t={}){let{cwd:e="."}=t,r=dr(e),n=r.gates.visual,i=t.cmd??n?.cmd,s=t.args??n?.args;if(!i||!s)return{stage:YO,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&s[0]==="run"&&!_m(e,s[s.length-1]))return{stage:YO,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let o=Mt(i,[...s],{cwd:e,reject:!1}),a=jr(YO,i,o,s);return a||nn(YO,o)}var lht=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${$0e.argv[1]}`;if(lht){let t=e9();console.log(JSON.stringify(t)),$0e.exit(t.exitCode)}CV();ff();cf();xi();wi();import{existsSync as XO,readFileSync as R0e,readdirSync as uht,statSync as dht}from"node:fs";import{join as QO,relative as pht,resolve as t9}from"node:path";var fht=5e3,I0e=12,hht=/\.(test|spec)\.[jt]sx?$|\.([jt]sx?|json|lock|md|ya?ml|html|css|map|d\.ts)$/i;function mht(t){let e=QO(t,"run");if(XO(e))try{if((dht(e).mode&73)!==0)return"./run"}catch{}let r=QO(t,"package.json");if(XO(r))try{let n=JSON.parse(R0e(r,"utf8"));if(typeof n.bin=="string")return n.bin;if(n.bin&&typeof n.bin=="object"){let i=Object.values(n.bin).find(s=>typeof s=="string");if(typeof i=="string")return i}if(typeof n.main=="string")return n.main}catch{}return null}function P0e(t,e,r){try{let n=Mt(t9(t,e),[...r],{cwd:t,reject:!1,timeout:fht});return(n.exitCode??1)===0&&!n.timedOut}catch{return!1}}function ght(t,e){let r=[],n=["examples","samples","fixtures","tests","."].map(i=>QO(t,i));for(let i of n){if(r.length>=I0e)break;if(!XO(i))continue;let s=[i],o=0;for(;s.length>0&&r.length/^project:\s*$/.test(a));if(i<0)return t;let s=[" # Auto-detected by `clad sync` \u2014 the gate smoke-tests this entry (stage_2.4, calibrated to pass now). Set is_safe_to_smoke: false to opt out."," deliverable:",` path: ${JSON.stringify(e.path)}`,...e.smoke_args&&e.smoke_args.length>0?[` smoke_args: [${e.smoke_args.map(a=>JSON.stringify(a)).join(", ")}]`]:[],` is_safe_to_smoke: ${e.is_safe_to_smoke?"true":"false"}`];n.splice(i+1,0,...s);let o=n.join(` +`);return r===`\r +`?o.replace(/\n/g,`\r +`):o}function T0e(t="."){let e=QO(t,"spec.yaml");if(!XO(e))return null;let r=R0e(e,"utf8");if(/^schema:\s*["']?0\.2["']?\s*$/m.test(r)||C0e(r))return null;let n=yht(t);if(!n)return null;let i=bht(r,n);return i!==r?(Si(t,[{path:"spec.yaml",before:r,after:i,rootRegions:["project"]}]),n):null}wi();kr();var j0e=Et(cr(),1);wi();import{existsSync as e1,readFileSync as O0e,readdirSync as D0e,statSync as vht}from"node:fs";import{basename as Iw,join as kg,relative as N0e}from"node:path";var _ht=["self-dogfood:","fixture:","derived:"],L0e=/\.(test|spec)\.[jt]sx?$/;function M0e(t,e=t,r=[]){let n;try{n=D0e(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let s=kg(e,i);try{vht(s).isDirectory()?M0e(t,s,r):L0e.test(i)&&r.push(s)}catch{continue}}return r}function F0e(t=".",e={}){let r=kg(t,"spec","features"),n=kg(t,"tests"),i=[],s=[];if(!e1(r)||!e1(n))return{repaired:i,suggested:s};let o=kg(t,"spec.yaml");if(e1(o)&&/^schema:\s*["']?0\.2["']?\s*$/m.test(O0e(o,"utf8")))return{repaired:i,suggested:s};let a=[],c=M0e(n),l=new Map;for(let u of c){let d=N0e(t,u).split("\\").join("/"),p=l.get(Iw(u))??[];p.push(d),l.set(Iw(u),p)}for(let u of D0e(r)){if(!u.endsWith(".yaml")&&!u.endsWith(".yml"))continue;let d=kg(r,u),p,f,h;try{f=O0e(d,"utf8"),p=f,h=(0,j0e.parse)(p)}catch{continue}if(!h||h.status!=="done")continue;let m=!1;for(let b of h.acceptance_criteria??[])for(let w of b.test_refs??[]){if(_ht.some(E=>w.startsWith(E)))continue;let x=w.split("#",1)[0];if(e1(kg(t,x)))continue;let $=l.get(Iw(x))??[];if($.length!==1)continue;let I=w.replace(x,$[0]);I!==w&&p.includes(w)&&(p=p.split(w).join(I),i.push({shard:u,from:w,to:I}),m=!0)}let y=h.slug??"",v=(h.modules??[]).map(b=>Iw(b).replace(/\.[jt]sx?$/,"")),g=c.map(b=>N0e(t,b).split("\\").join("/")).find(b=>{let w=Iw(b).replace(L0e,"");return y!==""&&w===y||v.includes(w)});if(g)for(let b of h.acceptance_criteria??[]){if((b.test_refs?.length??0)>0||(b.evidence_refs?.length??0)>0||!b.id)continue;let w=new RegExp(`^(([ ]+)- id: ${b.id}\\b.*)$`,"m"),x=p.match(w);if(!x)continue;let $=x[2]+" ";p=p.replace(w,`$1 +${$}test_refs: +${$} - "derived:${g}"`),s.push({shard:u,ref:`derived:${g}`}),m=!0}m&&a.push({path:`spec/features/${u}`,before:f,after:p})}return a.length>0&&(e.testBeforeCommit?.(),Si(t,a)),{repaired:i,suggested:s}}Ol();qn();Cf();Go();Gb();OE();qa();import{createHash as Sht}from"node:crypto";function wht(t){if(t.length!==0)return t.some(e=>!e.authorMappingComplete)?"unobserved":t.every(e=>e.verifiedAudits.some(r=>r.independence==="pass"&&r.independentIssuer))?"independent":void 0}function U0e(t){let e=(t.profile.id==="completion"||t.profile.id==="push"||t.profile.id==="release")&&fi(t.profile.assurance_level)[c.stage,c])),o=[],a=[];for(let c of r.obligations){let l=cd(c);if(!l)continue;let u=Pb(l,{complete:t.completeScope,hasExecutableTests:t.hasExecutableTests,hasOracleProof:t.hasOracleProof,hasDeliverable:t.hasDeliverable,requiresQuality:t.requiresQuality,requiresHuman:t.requiresHuman}),d=l.id==="stage_2.1"||l.id==="stage_2.2"||l.id==="stage_2.3"||l.id==="stage_4.1"||l.id==="stage_4.2"?t.proofViews:void 0,p=s.get(l.id),f=d?d.filter(b=>l.id!=="stage_2.3"||t.oracleRequiredSubjects===void 0||t.oracleRequiredSubjects.has(`criterion:${b.criterion}`)).map(b=>`criterion:${b.criterion}`):t.exactProofRequired&&Aht(l.id)?[]:t.scopeAddresses,h=(l.id==="stage_2.1"||l.id==="stage_2.2")&&Qte(t.staticCriterionScope)?t.staticCriterionScope.subjects:[],m=[...new Set([...f,...h])];m.length===0&&u!=="required"&&o.push({id:`${l.id}:scope:${n}`,subject:`scope:${n}`,assurance_level:l.assuranceLevel,descriptor:l.id,input_addresses:[...t.inputAddresses].sort(),input_sha256:i,applicability:u,source_strictness:l.sourceStrictness,blocking:l.blocking});for(let b of m){let w={id:`${l.id}:${b}`,subject:b,assurance_level:l.assuranceLevel,descriptor:l.id,input_addresses:[...t.inputAddresses].sort(),input_sha256:i,applicability:u,source_strictness:l.sourceStrictness,blocking:l.blocking};if(o.push(w),u!=="required")continue;let x=d?.find(I=>`criterion:${I.criterion}`===b),$=x===void 0?void 0:Ja(x.criterion);x&&$===void 0?a.push(kht(w,l.id,x,p,l.adapter,t.environmentClass,t.currentProofObservationIdentity,t.boundProofCriteria)):x||a.push(z0e(w,p,l.adapter,t.environmentClass))}let y=t.exactProofRequired&&(l.id==="stage_2.1"||l.id==="stage_2.2"),v=u==="required"&&B0e(l.id)&&p!==void 0&&p.status!=="pass";if(y||v){let b={id:`${l.id}:scope:${n}`,subject:`scope:${n}`,assurance_level:l.assuranceLevel,descriptor:l.id,input_addresses:[...t.inputAddresses].sort(),input_sha256:i,applicability:u,source_strictness:l.sourceStrictness,blocking:l.blocking};o.push(b),a.push(z0e(b,p,l.adapter,t.environmentClass))}}return Rre(Pre({profile:r,configuredAssuranceLevel:t.configuredAssuranceLevel,scopeSha256:n,inputSha256:i,scopeAddresses:t.scopeAddresses,obligations:o,observations:a,...t.migrationBaselineCandidates===void 0?{}:{migrationBaselineCandidates:t.migrationBaselineCandidates},...t.criterionObservations===void 0?{}:{criterionObservations:t.criterionObservations},environmentClass:t.environmentClass,applicabilityFacts:{complete:t.completeScope,hasExecutableTests:t.hasExecutableTests,hasOracleProof:t.hasOracleProof,hasDeliverable:t.hasDeliverable,requiresQuality:t.requiresQuality,requiresHuman:t.requiresHuman},independence:xht(t)}))}function xht(t){if(!t.requiresHuman)return"not-applicable";let e=t.independenceInputs===void 0?void 0:wht(t.independenceInputs);return e!==void 0?e:t.proofViews?.length&&t.proofViews.every(r=>r.blind==="verified")?"independent":"self-certified"}function kht(t,e,r,n,i,s,o,a){if(B0e(e)&&n?.status!=="pass"){let u=n===void 0?"stale":n.status==="pending_env"?"pending_env":n.status==="skip"||n.status==="na"||n.status==="liveness"?"skipped":"unsupported";return{obligation:t.descriptor,subject:t.subject,state:"unobserved",input_sha256:t.input_sha256,adapter:i,provenance:"observed",assurance:"asserted",reason:u,observed_at:"1970-01-01T00:00:00.000Z",environment_class:s}}let c=e==="stage_2.1"||e==="stage_2.2"?r.test.state==="verified"?"verified":r.test.state==="failed"?"failed":"unverified":e==="stage_4.1"?r.audit:e==="stage_4.2"?r.uat:r.blind,l=c==="verified"?"pass":c==="failed"?"fail":"unobserved";return{obligation:t.descriptor,subject:t.subject,state:l,input_sha256:t.input_sha256,adapter:i,provenance:"observed",assurance:l==="unobserved"?"asserted":"verified",...l==="unobserved"?{reason:Eht(e,r.criterion,a)}:{},...o===void 0?{}:{locator:o},observed_at:"1970-01-01T00:00:00.000Z",environment_class:s}}function Eht(t,e,r){return(t==="stage_2.1"||t==="stage_2.2")&&r!==void 0&&!r.has(e)?"unbound":"stale"}function Aht(t){return t==="stage_2.1"||t==="stage_2.2"||t==="stage_2.3"||t==="stage_4.1"||t==="stage_4.2"}function B0e(t){return t==="stage_2.1"||t==="stage_2.2"||t==="stage_2.3"}function z0e(t,e,r,n){let i=e?.status==="pass"?"pass":e?.status==="fail"||e?.status==="advisory"?"fail":"unobserved",s=e===void 0?"stale":e.status==="pending_env"?"pending_env":e.status==="skip"||e.status==="na"||e.status==="liveness"?"skipped":"unsupported";return{obligation:t.descriptor,subject:t.subject,state:i,input_sha256:t.input_sha256,adapter:{id:r.id,version:e?.adapterVersion??r.version},provenance:"observed",assurance:i==="pass"||i==="fail"?"verified":"asserted",...i==="unobserved"?{reason:s}:{},observed_at:"1970-01-01T00:00:00.000Z",environment_class:n}}function $ht(t){return Sht("sha256").update(It([...t].sort()),"utf8").digest("hex")}sE();Go();aM();Jq();WL();Rb();gd();Gb();kn();xm();OE();qa();import{readFileSync as Iht,statSync as Pht}from"node:fs";import{join as Rht}from"node:path";function Cht(t,e){let r=Rht(t,e);try{if(!Pht(r).isFile())return[]}catch{return[]}let n=[];for(let i of Iht(r,"utf8").split(/\r?\n/)){let s=i.trim();if(!/^export\s+(?:async\s+)?(?:abstract\s+)?(?:function|const|let|class|interface|type|enum)\b/.test(s))continue;let o=s.replace(/\s*[{=].*$/s,"").trim();o&&n.push(o)}return n}function q0e(t,e,r,n){let i=t.features.find(c=>c.id===e);if(!i)return null;let s=(i.acceptance_criteria??[]).filter(c=>!r||c.id===r),o=i.modules??[],a=o.flatMap(c=>Cht(n,c).map(l=>`${c}: ${l}`));return{featureId:e,featureTitle:i.title,acs:s.map(c=>({id:c.id,ears:c.ears,condition:c.condition,action:c.action,response:c.response,text:c.text})),modules:o,signatures:a,readManifest:[...o.map(c=>`signatures-of:${c}`),"spec:acceptance_criteria"]}}function V0e(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(` +`)}Qb();gt();hi();hi();Ol();Ba();var r9=["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"],Tht=[...r9,"att"];function Oht(t,e,r){if(e.startsWith("stage_4")){let n=Dr(r);if(n.length===0)return"\xB7";let i=(t.acceptance_criteria??[]).map(o=>o.id);return qO(n).filter(o=>i.includes(o.acId)).length>0?"\u2717":"\u2713"}return"-"}function Nht(t,e,r){let n=t.modules??[];return t.status!=="done"||n.length===0?"\xB7":e===null?"-":QI(e,r,t).state==="fresh"?"\u2713":"!"}function t1(t,e="."){let r=io(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...r9.map(s=>Oht(i,s,e)),Nht(i,r,e)]}));return{columns:Tht,rows:n}}function G0e(t,e=".",r={}){let n=r.internal??!1,i=t1(t,e),s=[...r9.map(c=>n?c.replace("stage_",""):Dht(c)),"att"],o=n?`feature ${s.join(" ")}`:`feature${" ".repeat(28)}${s.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[o,...a].join(` +`)}function Dht(t){return sd(t).slice(0,3)}Ba();async function E0t(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(bPe(),yPe)),Promise.resolve().then(()=>(xPe(),wPe)),Promise.resolve().then(()=>(LG(),k_e))]),i=e({cwd:t.cwd,evidence:KR(t.cwd??"."),onboarding:{renderDraft:o=>mxe(o,t.cwd??"."),prepareInit:({cwd:o,mode:a,intent:c})=>fxe(o,a,c),initialize:b3,prepareClarify:(o,{cwd:a})=>hxe(a,o),clarify:S3,resolveReview:(o,{cwd:a})=>ixe(o,{cwd:a})}});n(i.server);let s=new r;ie.stderr.write(`\xB7 serve stdio transport \xB7 cwd=${t.cwd??"."} +`),await i.connect(s)}async function A0t(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0;if(e.schema!==void 0&&e.schema!=="0.1"&&e.schema!=="0.2"){G("fail","init","Unknown spec schema. Use 0.2 (the current schema) or 0.1 (the legacy one)."),ie.exit(2);return}let n=await b3({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,...e.schema?{schema:e.schema}:{}});if(e.json){ie.stdout.write(`${JSON.stringify(n,null,2)} +`),ie.exit(0);return}for(let o of n.created)G("pass",`created ${o}`);for(let o of n.skipped)G("skip",o);for(let o of n.proposals??[])G("note","proposal",o);let i=n.onboardingMode?`language: ${n.language} \xB7 mode: ${n.onboardingMode}`:`language: ${n.language}`;G("note","init done",i);let s=$0t(n,r);s&&ie.stdout.write(s),ie.exit(0)}function $0t(t,e){let r=t.clarifyingQuestions??[];if(r.length>0)return["","\u{1F4A1} A few more details would sharpen the spec:",...r.map((i,s)=>` ${s+1}. ${i}`),"",""].join(` +`);let n=t.created.some(i=>i==="docs/conventions.md");return!e&&n?["","\u{1F4A1} Tip: for a more precise scaffold, describe the project:"," clad init "," e.g. clad init payment SaaS for B2B"," The existing seeds divert to .cladding/scan/*.proposal.","",""].join(` +`):e?["",qo(),"",""].join(` +`):""}function I0t(t={}){try{let e=oe();if(af("."))G("note","sync","derived-file writes deferred \u2014 git operation in progress; re-run after the merge/rebase completes.");else{HI(".");let r=Lm(".");r==="created"?G("note","agents.md","wrote a spec-driven AGENTS.md so non-Claude agents share the same guidance."):r==="updated"&&G("note","agents.md","refreshed the AGENTS.md managed block from the current spec.");let n=F0e(".");for(let s of n.repaired)G("note","test_refs",`repaired ${s.from} \u2192 ${s.to} (${s.shard})`);for(let s of n.suggested)G("note","test_refs",`suggested ${s.ref} (${s.shard}) \u2014 confirm by removing the 'derived:' prefix`);let i=T0e(".");i&&G("note","deliverable",`auto-detected entry '${i.path}' \u2014 the gate now smoke-tests it. Opt out with is_safe_to_smoke: false.`)}if(t.proposeArchive){let n=mC.run({cwd:"."}).filter(i=>i.suggestion?.action==="propose-archive");if(n.length===0){G("pass","sync",`${e.features.length} features \xB7 0 archive candidates`),ie.exit(0);return}for(let i of n){let s=i.suggestion?.args??{},o=String(s.featureId??"?"),a=String(s.reason??i.message);G("note",`propose-archive \xB7 ${o}`,a)}G("pass","sync",`${e.features.length} features \xB7 ${n.length} archive candidate(s)`),ie.exit(0);return}G("pass","sync",`${e.features.length} features valid`),ie.exit(0)}catch(e){G("fail","sync",e.message),ie.exit(1)}}function P0t(t){if(!t){G("fail","checkpoint","feature id required (e.g. clad checkpoint F-001)"),ie.exit(2);return}let e=X7(".",t),r=e.gitHead?e.gitHead.slice(0,12):"(no git)";G("pass",`checkpoint \xB7 ${t}`,`head=${r} digest=${e.specDigest.slice(0,12)}`),ie.exit(0)}function R0t(t,e={}){if(!t){G("fail","rollback","feature id required (e.g. clad rollback F-001)"),ie.exit(2);return}let r=Q7(".",t);if(!r){G("fail",`rollback \xB7 ${t}`,"no prior checkpoint recorded"),ie.exit(1);return}eY(".",t,r,e.reason);let n=r.gitHead?r.gitHead.slice(0,12):"(no git)";G("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?ie.stdout.write(`Run: git checkout ${r.gitHead} +`):ie.stdout.write(`No git head pinned \u2014 restore spec.yaml manually from VCS history. +`),ie.exit(0)}async function C0t(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await gV({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});ie.exit(r.errors.length>0?1:0)}async function T0t(){G("note","update","reconciling the current project after the engine upgrade");let t=await Jve(".",{wireHosts:async()=>(await gV({quiet:!0,projectRoot:"."})).errors.length});if(!t.isProject){G("skip","update","no spec.yaml here \u2014 nothing re-wired. Run `clad update` inside a cladding project, or `clad init` to start one."),ie.exit(t.code);return}G(t.wiringErrors>0?"fail":"pass","hosts",t.wiringErrors>0?`${t.wiringErrors} wiring error(s)`:"re-wired"),t.inventoryDeferred?G("note","spec",`inventory + index writes deferred \u2014 git operation in progress; re-run \`clad update\` after it completes (${t.features} features seen).`):G("pass","spec",`inventory synced \xB7 ${t.features} features`),G(t.claudeMd==="refreshed-stale"?"note":"pass","CLAUDE.md",t.claudeMd),G(t.agentsMd==="refreshed-stale"?"note":"pass","AGENTS.md",t.agentsMd);for(let r of t.deprecations)G("note","deprecated",r);ie.stdout.write(` \u2192 drift check (report-only \xB7 does not block, does not edit your spec): -`),LA({tier:"pre-commit",strict:!0}).anyFailed?H.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"),H.exit(t.code)}var mXe={"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 hXe(t){return t.length===0?"":`${t.join(", ")} skipped \u2014 no runner is known for this project. Declare commands in .cladding/config.yaml (gate: \u2192 commands: \u2192 e.g. test: ["zig","test"]) to run them; the file is committable, so CI runs the same gate you do.`}function LA(t){let e=t.tier??"all",r=t.silent===!0,n=mXe[e];if(!n)return t.json&&!r?H.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",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",oM],["stage_1.5",ac],["stage_1.6",nm],["stage_2.1",()=>gM({...i,strict:t.strict})],["stage_2.2",()=>sM(i)],["stage_2.3",GC],["stage_2.4",uM],["stage_3.1",dM],["stage_3.2",cM],["stage_3.3",yM],["stage_4.1",eM],["stage_4.2",uh]].filter(([d])=>n.includes(d)),a=0,c=!1,l=d=>d==="pass"?"pass":d==="liveness"?"note":d==="na"?"skip":mr(d)?"fail":"skip",u=[];eb("."),pre(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=SX(p);mr(h)&&(c=!0,a=Math.max(a,wX(p,h))),u.push({stage:d,label:m,status:h,exitCode:p.exitCode,stderr:p.stderr,findings:p.findings,skipReason:p.skipReason}),!t.json&&!r&&(L(l(h),m),mr(h)&&xXe(p))}}finally{rb(),hre()}if(t.strict)try{let d=q();for(let f of dre(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"||!mr(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=>mr(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(Sa("."))t.json||L("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{aZ(".",q(),{cladding:fn()??"unknown",blocking:"strict",detectorsSha256:oZ(IS)})&&(t.json||L("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch{}}if(t.json&&!r?H.stdout.write(`${JSON.stringify({tier:e,worst:a,anyFailed:c,stages:u},null,2)} -`):c&&!r&&H.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"),!t.json&&!r){let d=hXe(u.filter(f=>f.skipReason==="no-runner").map(f=>f.label));d&&H.stdout.write(` -\u2139 ${d} -`)}return Jt(".","gate_run",{tier:e,strict:t.strict===!0,worst:a,anyFailed:c,blockers:PS(u),stopFingerprint:xX(u)}),{worst:a,anyFailed:c,stages:u}}function gXe(t){try{let e=q(),r=bl(e,t);H.stdout.write(`${JSON.stringify(r,null,2)} -`),H.exit("not_found"in r?1:0)}catch(e){L("fail","context",e.message),H.exit(1)}}function yXe(t,e={}){try{let r=q(),n=e.depth!==void 0?Number(e.depth):void 0,i=xr(r,t,{depth:n});H.stdout.write(`${JSON.stringify(i,null,2)} -`),H.exit("not_found"in i?1:0)}catch(r){L("fail","impact",r.message),H.exit(1)}}function _Xe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=RS(e,o=>{try{return Dfe(o,"utf8")}catch{return null}},r!==void 0?{maxOwnerAmbiguity:r}:{});H.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} -`),H.exit(0)}catch(e){L("fail","infer-deps",e.message),H.exit(1)}}function bXe(t={}){try{if(t.sessions){Yte(t);return}if(t.trend!==void 0&&t.trend!==!1){Xte(t);return}let e=q(),n=rG(e,o=>{try{return Dfe(o,"utf8")}catch{return null}},"."),i=iG(".",n);if(t.json)H.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)}`,` ${vl}`];H.stdout.write(`${c.join(` +`),MN({tier:"pre-commit",strict:!0}).anyFailed?ie.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"):G("pass","drift","clean against the stricter detectors"),ie.exit(t.code)}var O0t={"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 N0t(t){return t.length===0?"":`${t.join(", ")} skipped \u2014 no runner is known for this project. Declare commands in .cladding/config.yaml (gate: \u2192 commands: \u2192 e.g. test: ["zig","test"]) to run them; the file is committable, so CI runs the same gate you do.`}function D0t(t){try{return vt(t)==="0.1"}catch{return!1}}var CZ=5,TZ=5,kPe=["L1","L2","L3","L4"];function MN(t){return Gf(()=>j0t(t))}function j0t(t){if(!(t.deferAttestation===!0||t.prospectiveFeatureId!==void 0||t.completionGate!==void 0||t.completionEvent!==void 0))return EPe(t);if(t.deferAttestation!==!0||t.prospectiveFeatureId===void 0||t.completionGate===void 0||t.completionEvent===void 0)return OZ(t);let r,n,i,s;try{if(r=GI(".",t.completionGate),r.featureId!==t.prospectiveFeatureId||t.profile!=="completion"||t.scopeSubjects?.length!==1||t.scopeSubjects[0]!==`feature:${r.featureId}`)return OZ(t);n=Mae(".",t.completionGate,t.completionEvent).writer,i=Bu(oe("."),r.featureId),s=rl(Nr("."),r.featureId)}catch{return OZ(t)}return P2(".",i,()=>R2(".",s,()=>EPe(t,n)))}function EPe(t,e){let r=Vf(t.profile??t.tier??"all"),n=t.tier??(t.profile==="feedback"||t.profile==="checkpoint"?"pre-commit":t.profile==="release"?"all":"pre-push"),i=t.silent===!0;if(t.profile!==void 0&&r===void 0||t.assuranceLevel!==void 0&&!["L1","L2","L3","L4"].includes(t.assuranceLevel)){let U=t.profile!==void 0&&r===void 0?"unknown assurance profile":"unknown assurance level";return t.json&&!i?ie.stdout.write(`${JSON.stringify({tier:n,error:U,worst:2,anyFailed:!0,stages:[]},null,2)} +`):i||G("fail","check",U),{worst:2,anyFailed:!0,stages:[]}}let s=O0t[n];if(!s)return t.json&&!i?ie.stdout.write(`${JSON.stringify({tier:n,error:`unknown tier '${n}'`,worst:2,anyFailed:!0,stages:[]},null,2)} +`):i||G("fail","check",`unknown --tier '${n}' (expected: pre-commit | pre-push | all)`),{worst:2,anyFailed:!0,stages:[]};if(r==="release"&&((t.scopeSubjects?.length??0)>0||(t.focusModules?.length??0)>0)){let U="release profile is repository-wide and cannot be narrowed by feature or module";return t.json&&!i?ie.stdout.write(`${JSON.stringify({tier:n,error:U,worst:1,anyFailed:!0,stages:[]},null,2)} +`):i||G("fail","check","Release checks always run across the whole repository. Remove the feature or module filter."),{worst:1,anyFailed:!0,stages:[],error:U}}let o,a;if(r)try{if(o=Nr("."),o.schemaVersion==="0.2"){let U=o.contract?.project.assuranceLevel??"L2",H=TE({configured:U,requested:t.assuranceLevel,boundedScope:t.scopeSubjects!==void 0&&t.scopeSubjects.length>0});if(H.ok){let Oe=r==="feedback"||r==="checkpoint"?"L1":H.level;s=Wo(r,Oe).obligations}else t.assuranceLevel!==void 0&&(a={configured:U,requested:t.assuranceLevel,reason:H.reason})}}catch{o=void 0}let c;if(r&&o?.schemaVersion==="0.2")try{let U=LN(o,r,t.assuranceLevel,t.scopeSubjects);U!==void 0&&"levelRejected"in U&&(a??={configured:U.configured,requested:U.requested,reason:U.levelRejected}),c=NZ(U)}catch{c=void 0}if(a){let H=kPe.indexOf(a.requested)>kPe.indexOf(a.configured)?`${a.reason} Only the completion profile on a bounded feature scope can raise the level for one run.`:a.reason;return i||(t.json?ie.stdout.write(`${JSON.stringify({tier:n,profile:r,configured_assurance_level:a.configured,requested_assurance_level:a.requested,assurance_level_rejected:H},null,2)} +`):G("fail","check",H),ie.exitCode=1),{worst:1,anyFailed:!0,stages:[],error:H}}let l=o?.schemaVersion==="0.2"?c?.focusModules?{focusModules:c.focusModules}:{}:o?.schemaVersion==="0.1"||D0t(".")?{focusModules:t.focusModules}:{},u=o?.schemaVersion==="0.2"&&r!==void 0&&Iee(r),p=[["stage_1.1",()=>J3(l)],["stage_1.2",()=>V3(l)],["stage_1.3",()=>po({...l,strict:t.strict||u})],["stage_1.4",B3],["stage_1.5",pS],["stage_1.6",fS],["stage_2.1",()=>Q3({...l,strict:t.strict})],["stage_2.2",()=>q3(l)],["stage_2.3",IV],["stage_2.4",W3],["stage_3.1",Z3],["stage_3.2",G3],["stage_3.3",e9],["stage_4.1",U3],["stage_4.2",K3]].filter(([U])=>s.includes(U)),f=0,h=!1,m=U=>U==="pass"?"pass":U==="liveness"?"note":U==="na"?"skip":Rn(U)?"fail":"skip",y=[],v;try{let U=t.prospectiveFeatureId===void 0?oe("."):Bu(oe("."),t.prospectiveFeatureId);if(v=e4(".",U),r&&o?.schemaVersion==="0.2"&&c){let H=c;v=Object.freeze({...v,runtime:Object.freeze({inputSha256:H.snapshot.inputSha256,complete:H.snapshot.complete,matchesCurrent:()=>{try{let Oe=pl("."),F=t.prospectiveFeatureId===void 0?Oe:Bu(Oe,t.prospectiveFeatureId),de=t.prospectiveFeatureId===void 0?di("."):rl(di("."),t.prospectiveFeatureId),Ft=NZ(t.prospectiveFeatureId===void 0?LN(de,r,t.assuranceLevel,t.scopeSubjects,F):P2(".",F,()=>R2(".",de,()=>LN(de,r,t.assuranceLevel,t.scopeSubjects,F))));return Ft!==void 0&&Ft.snapshot.complete&&Ft.snapshot.inputSha256===H.snapshot.inputSha256}catch{return!1}}})})}}catch{}rP("."),Dte(".",c?.snapshot.inputSha256);let g;try{for(let[U,H]of p){let Oe=H({}),F=t.internal?U:sd(U),de=Abe(Oe);Rn(de)&&(h=!0,f=Math.max(f,UV(Oe,de))),y.push({stage:U,label:F,status:de,exitCode:Oe.exitCode,stderr:Oe.stderr,findings:Oe.findings,skipReason:Oe.skipReason}),!t.json&&!i&&(G(m(de),F),Rn(de)&&W0t(Oe))}}finally{iP(),c&&(g=Ute(".",c.snapshot.inputSha256)),qte()}if(t.strict)try{let U=oe();for(let H of d0e(U,y))f=Math.max(f,1),h=!0,y.push({stage:H.stage,label:H.label,status:"fail",exitCode:1,stderr:H.message}),!t.json&&!i&&G("fail",H.label,H.message)}catch{}L0t({strict:t.strict===!0,authoritative:u||c?.profile.authoritative===!0,tier:n,stages:y})&&(h=y.some(U=>Rn(U.status)),f=y.reduce((U,H)=>Math.max(U,UV(H,H.status)),0),!t.json&&!i&&G("note","attestation","stale entries re-verified by this run \u2014 re-attesting"));let b=r,w,x,$=[],I,E=[],R,A,B,Z=[];if(b)try{let U=o??Nr(".");x=U.schemaVersion;let H=U.contract?.project.assuranceLevel??"L2",Oe=TE({configured:H,requested:t.assuranceLevel,boundedScope:t.scopeSubjects!==void 0&&t.scopeSubjects.length>0});if(!Oe.ok)U.schemaVersion==="0.2"&&(f=Math.max(f,1),h=!0);else{let F=b==="feedback"||b==="checkpoint"?"L1":Oe.level,de=Wo(b,F),Ft=[...t.scopeSubjects??(U.schemaVersion==="0.2"?(U.contract?.features??[]).map(ye=>`feature:${ye.id}`):["project"])].sort(),Se=U.schemaVersion==="0.2"&&c?.compilation===U?c:void 0,Jt=U.schemaVersion==="0.1",xe;if(Se)try{let ye=t.prospectiveFeatureId===void 0?Nr("."):rl(Nr("."),t.prospectiveFeatureId),se=t.prospectiveFeatureId===void 0?void 0:Bu(oe("."),t.prospectiveFeatureId);xe=NZ(LN(ye,b,t.assuranceLevel,t.scopeSubjects,se)),Jt=Se.snapshot.complete&&xe!==void 0&&xe.snapshot.complete&&xe.snapshot.inputSha256===Se.snapshot.inputSha256}catch{Jt=!1}let sr=Se?.profile??de,D=Se?.scopeAddresses??Ft,C=D.length>0?D:["project"],z=Se?.oracleRequiredSubjects,O=U.schemaVersion==="0.2"?Se?.snapshot.criterionObservations??vE(".",U,C):[],V=U.schemaVersion==="0.2"?Se?.snapshot.staticCriterionScope??_E(U,C):void 0,re=U.schemaVersion==="0.2"?ere({cwd:".",compilation:U,scopeAddresses:C,currentRun:g,expectedGateInputSha256:Se?.snapshot.inputSha256}):[],ge={},ue=U.schemaVersion==="0.2"?Sre(".",U,C,g,Se?.snapshot.inputSha256,ge,Se?.receiptContext):[];w=U0e({profile:sr,configuredAssuranceLevel:Se?.configured??H,completeScope:U.schemaVersion==="0.1"?U.contract!==void 0||U.schemaVersion==="0.1":Jt,scopeAddresses:C,inputSha256:Se?.snapshot.inputSha256??_re(".",U).inputSha256,inputAddresses:U.nodes.map(ye=>ye.address).sort(),hasExecutableTests:U.schemaVersion==="0.2"?Se?.hasApplicableTestCriteria??hd(U,C):U.edges.some(ye=>ye.channel==="test"),hasOracleProof:z?.size!==void 0?z.size>0:U.edges.some(ye=>ye.channel==="oracle"),...z?{oracleRequiredSubjects:z}:{},hasDeliverable:Se?.hasDeliverable??U.nodes.some(ye=>ye.address==="artifact:package.json"),requiresQuality:Se?.requiresQuality??(Oe.level==="L3"||Oe.level==="L4"),requiresHuman:Se?.requiresHuman??Oe.level==="L4",criterionObservations:[...O,...re],...V?{staticCriterionScope:V}:{},...Se?.snapshot.migrationBaselineCandidates!==void 0?{migrationBaselineCandidates:Se.snapshot.migrationBaselineCandidates}:{},...U.schemaVersion==="0.2"&&Se?.requiresHuman&&Se.receiptContext!==void 0?{independenceInputs:xre({cwd:".",closures:Se.baseClosures,receiptContext:Se.receiptContext,featureIds:[...Se.scopedFeatures]})}:{},...U.schemaVersion==="0.2"?{proofViews:ue,...ge.criteria===void 0?{}:{boundProofCriteria:ge.criteria},currentProofObservationIdentity:Fte(g),exactProofRequired:!0}:{},stages:y.map(ye=>({stage:ye.stage,status:ye.status})),environmentClass:"foreground"});let rt=t.deferAttestation&&t.prospectiveFeatureId!==void 0?rl(U,t.prospectiveFeatureId):U;if(U.schemaVersion==="0.2"&&Se&&Jt){let ye=Wn(".",rt,Se.receiptContext),se=Se.scopeAddresses.flatMap(mr=>{if(!mr.startsWith("feature:"))return[];let ci=mr.slice(8);return[{feature:ci,...ml(ye,ci)}]}),Je={registrySha256:x0t("sha256").update(It(Vo),"utf8").digest("hex"),detectorCatalogSha256:YI(Om),toolIdentity:ti()??"unknown",environmentClass:"foreground",trustSnapshotSha256:Se.trustSnapshot.digest};Vee(w,{inputSha256:Se.snapshot.inputSha256,scopeAddresses:Se.scopeAddresses,profileAuthoritative:Se.profile.authoritative,executedStageIds:y.map(mr=>mr.stage),featureSeals:se,profileIdentity:Je})}if(U.schemaVersion==="0.2"&&b!=="feedback"&&w.state!=="green"&&(f=Math.max(f,1),h=!0),w.state==="green"&&w.profile_complete&&(w.profile==="completion"||w.profile==="push"||w.profile==="release")){let ye=(Se?.scopeAddresses??t.scopeSubjects??(U.schemaVersion==="0.2"?(U.contract?.features??[]).map(mr=>`feature:${mr.id}`):(oe(".").features??[]).filter(mr=>mr.status==="done").map(mr=>`feature:${mr.id}`))).map(mr=>mr.replace(/^feature:/,"")),se=t.deferAttestation&&t.prospectiveFeatureId!==void 0?[t.prospectiveFeatureId]:ye,Je=Se===void 0?{candidates:[],trustSnapshot:Ho()}:Se.receiptContext;if(Je!==void 0){$=kre({cwd:".",compilation:rt,verdict:w,featureIds:se,detectorCatalogSha256:YI(Om),toolIdentity:ti()??"unknown",environmentClass:"foreground",trustSnapshotSha256:Je.trustSnapshot.digest,receiptContext:Je,onRefusal:(ci,Tc)=>{B===void 0&&se.includes(ci)&&(t.prospectiveFeatureId===void 0||ci===t.prospectiveFeatureId)&&(B=Tc),rt.contract?.features.find($Pe=>$Pe.id===ci)?.status==="done"&&Z.push({feature:ci,...Tc})}}),I=ute($,Je);let mr=io(".");E=$.map(ci=>{let Tc=mr?sce(mr,ci.feature,ci):{state:"unattested"};return{feature:ci.feature,state:Tc.state,...Tc.state==="stale"?{field:Tc.field}:{}}})}}}}catch{(o?.schemaVersion==="0.2"||x==="0.2")&&(f=Math.max(f,1),h=!0)}let ee=t.strict&&(n==="pre-push"||n==="all"),T=x==="0.2"&&$.length>0&&v!==void 0,j=U=>{if(af("."))throw new Error("ATTESTATION_WRITE_DEFERRED");t4(".",v.spec,void 0,$,v,{writeLegacy:!1,...I===void 0?{}:{retention:I},...U===void 0?{}:{completion:U}})};if(ee||T){if(!h&&!i&&T&&t.deferAttestation)A=U=>{if(e===void 0)throw new Error("UNPREPARED_SCHEMA02_COMPLETION");Fae(".",e,U),j(U)};else if(!h&&!i&&(x!=="0.2"||T))if(af("."))t.json||G("note","attestation","deferred \u2014 git operation in progress; run the gate again after the merge/rebase completes.");else try{(x==="0.2"?(j(),!0):t4(".",v?.spec??oe(),{cladding:ti()??"unknown",blocking:"strict",detectorsSha256:YI(Om)},$,v,{writeLegacy:!0}))&&(t.json||G("note","attestation","spec/attestation.yaml refreshed (verified tree stamped)"))}catch(U){x==="0.2"&&w&&(w=Ire(w),R=U.code??"ATTESTATION_WRITE_FAILED",$=[],f=Math.max(f,1),h=!0,!t.json&&!i&&G("fail","attestation","verification inputs changed before the attestation could be recorded. Run the gate again."))}}if(x==="0.2"&&!h&&!i&&!t.json&&w?.state==="green"&&w.profile_complete&&Z.length>0){for(let U of Z.slice(0,CZ))G("note","attestation",`not refreshed for ${U.feature} \u2014 ${U.guard}: ${U.detail}.`);Z.length>CZ&&G("note","attestation",`\u2026 and ${Z.length-CZ} more feature(s) whose verification was not recorded.`)}let Ne=x==="0.2"?pee(w?.results??[]):[];if(Ne.length>0&&!t.json&&!i){for(let U of Ne.slice(0,TZ))G("note","binding",U);Ne.length>TZ&&G("note","binding",`\u2026 and ${Ne.length-TZ} more criterion(s) that no test claims.`)}if(t.json&&!i?ie.stdout.write(`${JSON.stringify({tier:n,...w?{profile:w.profile,requested_assurance_level:w.assurance_level,configured_assurance_level:w.configured_assurance_level,achieved_assurance_level:w.achieved_assurance_level,scope_sha256:w.scope_sha256,input_sha256:w.input_sha256,profile_complete:w.profile_complete,obligations:w.results,...x==="0.2"?{incomplete_addresses:c?.snapshot.incompleteAddresses??[],unbound_criteria:Ne}:{},independence:w.independence,attestation_freshness:E,...R?{attestation_error:R}:{},assurance:w}:{},worst:f,anyFailed:h,stages:y},null,2)} +`):h&&!i&&ie.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"),!t.json&&!i){let U=N0t(y.filter(H=>H.skipReason==="no-runner").map(H=>H.label));U&&ie.stdout.write(` +\u2139 ${U} +`)}return _n(".","gate_run",{tier:n,strict:t.strict===!0,worst:f,anyFailed:h,blockers:kC(y),stopFingerprint:$be(y)}),{worst:f,anyFailed:h,stages:y,...w?{assurance:w}:{},...A?{commitAttestation:A}:{},...B?{attestationRefusal:B}:{}}}function OZ(t){let e="schema-0.2 completion verification must be started by clad done";return t.json&&!t.silent?ie.stdout.write(`${JSON.stringify({error:e,worst:1,anyFailed:!0,stages:[]},null,2)} +`):t.silent||G("fail","check","Completion verification must be started by clad done."),{worst:1,anyFailed:!0,stages:[],error:e}}function L0t(t){if(!t.strict&&t.authoritative!==!0||t.tier!=="pre-push"&&t.tier!=="all")return!1;let e=t.stages.find(s=>s.stage==="stage_1.3"),r=(e?.findings??[]).filter(s=>s.severity==="error"||s.severity==="warn"),n=e?.status==="fail"&&r.length>0&&r.every(s=>s.detector==="STALE_ATTESTATION"),i=t.stages.every(s=>s.stage==="stage_1.3"||!Rn(s.status));return!n||!i||!e?!1:(e.status="pass",e.exitCode=0,e.stderr="stale attestation exempted \u2014 this run re-verified and re-attests",!0)}function NZ(t){return t===void 0||"levelRejected"in t?void 0:t}function LN(t,e,r,n,i){if(t.schemaVersion!=="0.2"||!t.contract)return;let s=t.contract.project.assuranceLevel??"L2",o=Wo(e,s),a=IE(t,o,n),c=TE({configured:s,requested:r,boundedScope:e==="completion"&&!a.repository&&a.complete});if(!c.ok)return r===void 0?void 0:{configured:s,requested:r,levelRejected:c.reason};let l=e==="feedback"||e==="checkpoint"?"L1":c.level,u=Wo(e,l),d=t.contract.features.map(ee=>`feature:${ee.id}`).sort(),p=[...a.scopeAddresses],f=new Set(a.featureIds),h=a.repository||p.length===d.length,m=i??oe("."),y=new Set(nh(m).filter(ee=>f.size===0||f.has(ee.featureId)).map(ee=>`criterion:${ee.featureId}/${ee.acId}`)),v=hd(t,p),g=c.level==="L3"||c.level==="L4",b=c.level==="L4",w=md("."),x=Wn(".",t,void 0,void 0,w),{trustSnapshot:$,receiptContext:I}=YR(".",x),E=I===void 0?x:{...x,receiptIdentities:uE(I.candidates,I.trustSnapshot)},R=ee=>PE(".",t,{profile:u,scopeAddresses:p,hasExecutableTests:v,oracleRequiredSubjects:y,requiresHuman:b,scopeComplete:ee,closureInput:E,controlResolver:w,...I===void 0?{receiptCensusComplete:!1}:{}}),A=R(a.complete),B=ee=>{p=[...ee].sort(),f=new Set(p.flatMap(T=>T.startsWith("feature:")?[T.slice(8)]:[])),v=hd(t,p),y=new Set(nh(m).filter(T=>f.has(T.featureId)).map(T=>`criterion:${T.featureId}/${T.acId}`))};A.effectiveScopeAddresses.some(ee=>!p.includes(ee))&&(B(A.effectiveScopeAddresses),h=p.length===d.length,A=R(a.complete&&!h));let Z=A.incompleteAddresses.some(ee=>ee==="runner-controls"||ee==="scope-closure"||ee.startsWith("contract:")||ee.startsWith("runtime:"));return!h&&Z&&(h=!0,B(d),A=R(!1)),{compilation:t,profile:u,configured:s,scopeAddresses:A.effectiveScopeAddresses,scopedFeatures:f,hasApplicableTestCriteria:v,oracleRequiredSubjects:y,hasDeliverable:t.nodes.some(ee=>ee.address==="artifact:package.json"),requiresQuality:g,requiresHuman:b,...!h&&a.complete&&a.focusModules?{focusModules:a.focusModules}:{},trustSnapshot:$,...I===void 0?{}:{receiptContext:I},baseClosures:x,snapshot:A}}function M0t(t){try{let e=oe(),r=mf(e,t);ie.stdout.write(`${JSON.stringify(r,null,2)} +`),ie.exit("not_found"in r?1:0)}catch(e){G("fail","context",e.message),ie.exit(1)}}function F0t(t,e={}){try{let r=oe(),n=e.depth!==void 0?Number(e.depth):void 0,i=Mn(r,t,{depth:n,graph:rc(".",r)});ie.stdout.write(`${JSON.stringify(i,null,2)} +`),ie.exit("not_found"in i?1:0)}catch(r){G("fail","impact",r.message),ie.exit(1)}}function z0t(t={}){try{let e=oe(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=Hh(e,s=>{try{return APe(s,"utf8")}catch{return null}},{...r!==void 0?{maxOwnerAmbiguity:r}:{},graph:rc(".",e)});ie.stdout.write(`${JSON.stringify({suggestions:i.suggestions,new_edges:i.edges.length,already_declared:i.alreadyDeclared.length,dynamic_import_files:i.dynamicImportFiles},null,2)} +`),ie.exit(0)}catch(e){G("fail","infer-deps",e.message),ie.exit(1)}}function U0t(t={}){try{if(t.sessions){bxe(t);return}if(t.trend!==void 0&&t.trend!==!1){vxe(t);return}let e=oe(),n=xY(e,s=>{try{return APe(s,"utf8")}catch{return null}},".",rc(".",e)),i=EY(".",n);if(t.json)ie.stdout.write(`${JSON.stringify(n,null,2)} +`);else{let s=n.context,o=s.truncatedCount>0?`budget enforces ${s.medianShrinkTruncated}x on ${s.truncatedCount} capped feature(s) (cap-driven)`:"no feature hit the budget cap",a=s.fitsCount>0?`${s.medianShrinkFit}x on ${s.fitsCount} fitting`:"none fit untruncated",c=[`graph efficiency \xB7 ${n.measured}/${n.featureCount} features`,` context: working-set ${s.medianSliceTokens} tok vs naive ${s.medianNaiveTokens} tok \u2014 ${o}, ${a}`,` uncapped structural slice = ${s.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)}`,` ${gf}`];ie.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)")}H.exit(0)}catch(e){L("fail","measure",e.message),H.exit(1)}}function vXe(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`),H.exit(1)),e=i.modules}catch(n){L("fail","check",n.message),H.exit(1)}let r=LA({...t,focusModules:e});if(!t.json){let n=d7(".");n&&H.stdout.write(`\u2139 ${n} -`)}H.exitCode=r.worst}function SXe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=n7(".",t,{checkStages:LA,onIndex:rc,gitOpInProgress:zT,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)}H.exit(r.code)}function wXe(t,e={}){let r=e.cwd??".",n;try{n=q(r)}catch(o){L("fail","oracle",`spec not loaded: ${o.message}`),H.exit(1);return}if(e.required){t&&H.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') -`);let o=jY(n);if(o.length===0){H.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. -`),H.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";H.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} -`)}H.stdout.write(` -${o.length} AC(s) required, ${s.length} missing an oracle. -`),H.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"),H.exit(1);return}let i=Ure(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`),H.exit(1);return}H.stdout.write(`${qre(i)} -`),H.exit(0)}function xXe(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=P4(Ia(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";if(H.stdout.write(` ${o}${s} [${i.detector}] -`),Ia(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))H.stdout.write(` ${P4(l,160)} -`);c.length>4&&H.stdout.write(` \u2026 and ${c.length-4} more line(s) \u2014 see \`clad check --json\` -`)}}n.length>3&&H.stdout.write(` \u2026 and ${n.length-3} more finding(s) -`),t.hint&&H.stdout.write(` fix: run \`${t.hint}\` +`),i.appended?G("note","measure","snapshot recorded to .cladding/measure.jsonl \u2014 see `clad measure --trend`"):i.reason==="deduped"?G("note","measure","commit+spec state unchanged since last snapshot \u2014 not recorded"):i.reason==="no_head"&&G("note","measure","no git HEAD \u2014 snapshot not recorded (commit first; a head-less line has no reproduce target)")}ie.exit(0)}catch(e){G("fail","measure",e.message),ie.exit(1)}}function B0t(t){if(t.profile&&!Vf(t.profile)){G("fail","check","Unknown assurance profile. Use feedback, checkpoint, completion, push, or release."),ie.exit(2);return}if(t.profile&&t.tier&&Vf(t.tier)!==Vf(t.profile)){G("fail","check","The requested profile conflicts with the legacy tier alias. Use one matching profile or tier."),ie.exit(2);return}if(t.assuranceLevel&&!["L1","L2","L3","L4"].includes(t.assuranceLevel)){G("fail","check","Unknown assurance level. Use L1, L2, L3, or L4."),ie.exit(2);return}let e=Vf(t.profile??t.tier??"all");if(t.feature&&e==="release"){G("fail","check","Release checks always run across the whole repository. Remove the feature filter."),ie.exit(2);return}let r,n;if(t.feature)try{let o=(oe().features??[]).find(a=>a.id===t.feature||a.slug===t.feature);o||(G("fail","check",`no feature '${t.feature}' in spec \u2014 cannot scope gate`),ie.exit(1)),r=o.modules,n=[`feature:${o.id}`]}catch(s){G("fail","check",s.message),ie.exit(1)}let i=MN({...t,focusModules:r,...n?{scopeSubjects:n}:{}});if(!t.json){let s=hve(".");s&&ie.stdout.write(`\u2139 ${s} +`)}ie.exitCode=i.worst}function q0t(t){if(!(!t.ok||t.schemaVersion!=="0.2"))return"next: run clad check --tier=pre-push to re-attest sibling features, then commit spec/attestation.yaml"}function V0t(t,e){if(e==="evidence-ledger")return t==="independent"?"independence: independent \u2014 backed by human or independent review":"independence: self-certified \u2014 no independent or human review yet";switch(t){case"independent":return"independence: independent \u2014 a registered issuer other than the implementation authors reviewed it";case"not-applicable":return"independence: not applicable \u2014 this assurance profile asks for no human review";case"unobserved":return"independence: unobserved \u2014 the implementation authors are not fully mapped, so independence could not be observed";default:return"independence: self-certified \u2014 the implementation author signed, or no verified review exists yet"}}function G0t(t){let e;try{e={policy:oe(".").project.independence_policy??"label",evidence:Dr(".")}}catch{e=void 0}let r=ove(".",t,{checkStages:MN,gitOpInProgress:zj,independence:e});G(r.ok?"pass":"fail",`done \xB7 ${t}`,r.reason),r.independence&&G("note",`done \xB7 ${t}`,V0t(r.independence,r.independence_source));let n=q0t(r);n&&G("note",`done \xB7 ${t}`,n),ie.exit(r.code)}function H0t(t,e={}){let r=e.cwd??".",n;try{n=oe(r)}catch(s){G("fail","oracle",`spec not loaded: ${s.message}`),ie.exit(1);return}if(e.required){t&&ie.stdout.write(`(note: --required lists the whole-project worklist; ignoring '${t}') +`);let s=nh(n);if(s.length===0){ie.stdout.write(`No oracles required \u2014 set project.oracle_policy or require_oracles, or no done ACs match the policy. +`),ie.exit(0);return}let o=s.filter(a=>!a.hasOracle);for(let a of s){let c=a.hasOracle?"\u2713":"\xB7",l=a.hasOracle?"":" \u2190 needs an impl-blind oracle";ie.stdout.write(` ${c} ${a.featureId}.${a.acId} [${a.reason}${a.ears?`:${a.ears}`:""}]${l} +`)}ie.stdout.write(` +${s.length} AC(s) required, ${o.length} missing an oracle. +`),ie.exit(o.length>0?1:0);return}if(!t){G("fail","oracle","provide a to print its blind brief, or --required to list the ACs the policy needs an oracle for"),ie.exit(1);return}let i=q0e(n,t,e.ac,r);if(!i||i.acs.length===0){G("fail","oracle",`no acceptance criteria for ${t}${e.ac?`.${e.ac}`:""} \u2014 nothing to author a blind oracle from`),ie.exit(1);return}ie.stdout.write(`${V0e(i)} +`),ie.exit(0)}function W0t(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 s=DZ(od(i.detector,i.message),140),o=i.path?` \u2014 ${i.path}`:"";if(ie.stdout.write(` ${s}${o} [${i.detector}] +`),od(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))ie.stdout.write(` ${DZ(l,160)} +`);c.length>4&&ie.stdout.write(` \u2026 and ${c.length-4} more line(s) \u2014 see \`clad check --json\` +`)}}n.length>3&&ie.stdout.write(` \u2026 and ${n.length-3} more finding(s) +`),t.hint&&ie.stdout.write(` fix: run \`${t.hint}\` `);return}if(t.stderr&&t.stderr.trim().length>0){let e=t.stderr.split(` -`).map(r=>r.trim()).filter(r=>r.length>0);for(let r of e.slice(0,5))H.stdout.write(` ${P4(r,160)} -`);e.length>5&&H.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` -`)}}function P4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function $Xe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(f0(e,"."),null,2)} -`),H.exitCode=0;return}H.stdout.write(`${Hre(e,".",{internal:t.internal})} -`),H.exit(0)}function kXe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function EXe(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"),H.exit(1);return}let n;try{let i=q(e),o=f0(i,e),s={gitHead:xa(e),version:fn(),generatedAt:t.now??new Date().toISOString()},a=xl(i),c;try{let l=t.since??is(e),u=os(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Sl(u),auditMarkdown:wl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=JG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{oXe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${kXe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function AXe(t){let e=iO(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function OXe(){let t=new Z4;t.name("clad").description("Reference Ironclad CLI").version("0.9.4"),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(aXe),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(cXe),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(lXe),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(fXe),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(pXe),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(vXe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(uXe),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(SXe),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)=>wXe(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(dXe),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($Xe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(gXe),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)=>yXe(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=>F7(r,{checkStages:LA})),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=>_Xe(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=>bXe(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=>cre(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>lre()),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=>{ure(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=>jG(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=>vX(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=>EXe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(AXe),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(I7),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(sXe),t.command("doctor").description("Diagnose Claude Code hook liveness/version, lifecycle governance, and LLM dispatcher sentinel misses").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){QX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}HX(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(Gte),t}var TXe=!!globalThis.__CLADDING_BUNDLED,RXe=TXe||import.meta.url===`file://${H.argv[1]}`;RXe&&OXe().parse();export{mXe as TIER_STAGES,OXe as createProgram,hXe as renderNoRunnerGuidance,EXe as runBundleCommand,vXe as runCheckCommand,LA as runCheckStages,uXe as runCheckpointCommand,gXe as runContextCommand,SXe as runDoneCommand,yXe as runImpactCommand,_Xe as runInferDepsCommand,aXe as runInitCommand,bXe as runMeasureCommand,wXe as runOracleCommand,dXe as runRollbackCommand,AXe as runRouteCommand,cXe as runRunCommand,sXe as runServeCommand,fXe as runSetupCommand,$Xe as runStatusCommand,lXe as runSyncCommand,pXe as runUpdateCommand}; +`).map(r=>r.trim()).filter(r=>r.length>0);for(let r of e.slice(0,5))ie.stdout.write(` ${DZ(r,160)} +`);e.length>5&&ie.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` +`)}}function DZ(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function Z0t(t){let e=oe();if(t.json){ie.stdout.write(`${JSON.stringify(t1(e,"."),null,2)} +`),ie.exitCode=0;return}ie.stdout.write(`${G0e(e,".",{internal:t.internal})} +`),ie.exit(0)}function J0t(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function K0t(t){let e=t.cwd??".",r=(t.out??"").trim();if(r.length===0){G("fail","bundle","missing --out \u2014 the bundle needs a destination path"),ie.exit(1);return}let n;try{let i=oe(e),s=t1(i,e),o={gitHead:Bs(e),version:ti(),generatedAt:t.now??new Date().toISOString()},a=vf(i),c;try{let l=t.since??qc(e),u=Vc(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:yf(u),auditMarkdown:bf(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=_ee({spec:i,panel:s,provenance:o,catalogMarkdown:a,changes:c})}catch(i){G("fail","bundle",i.message),ie.exit(1);return}try{k0t(r,n,"utf8")}catch(i){G("fail","bundle",`could not write ${r}: ${i.message}`),ie.exit(1);return}G("pass","bundle",`${r} \xB7 ${J0t(Buffer.byteLength(n,"utf8"))}`),ie.exit(0)}function Y0t(t){let e=iD(t);G("note",`route \u2192 ${e}`,t),ie.exit(e==="unknown"?1:0)}function X0t(){let t=new JZ;t.name("clad").description("Reference Ironclad CLI").version("0.10.0"),t.command("init [intent...]").description("Scaffold a cladding workspace. Pass a free-text project description as positional argument (e.g. `clad init payment SaaS for B2B` \u2014 free text in any language) to drive intent-aware onboarding \u2014 the LLM dispatcher then produces domain-aware capabilities/architecture/project-context plus product-level follow-up questions. Bare `clad init` keeps the v0.3.42 behaviour (greenfield seeds, or observed scan when \u22653 source files exist).").option("-n, --name ","Project name (default: cwd basename)").option("-f, --force","Overwrite existing spec.yaml").option("--scan","Force-walk the existing codebase. Default auto-detects (\u22653 source files trigger scan). Use --no-scan to skip even when source is present.").option("--no-llm","Force the deterministic interpreter (skip the LLM dispatcher chain). Intent text falls back to a deterministic quote in project-context.md.").option("--roots ","Override scanner source roots, comma-separated (e.g. packages/a/src,packages/b/src). Otherwise inferred from manifests + directory heuristics.").option("--with-hook","Install git pre-commit (cheap tier) AND pre-push (strict tier) hooks. Opt-in; cladding never touches .git without it.").option("--with-ci","Scaffold .github/workflows/cladding.yml running the strict pre-push gate \u2014 the authoritative enforcement layer.").option("--schema ","spec schema to scaffold: 0.2 (default, current) or 0.1 (legacy seed)").option("--json","emit the raw InitResult for tooling; default is the human-readable surface").action(A0t),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(I0t),t.command("migrate").description("Preview schema migration, or apply explicit confirmed decisions as one recoverable transaction").requiredOption("--to ","target schema version (currently 0.2)").option("--apply","apply the current preview after explicit human decisions are supplied").option("--resolutions ","JSON object with the reviewed previewDigest and explicit confirmed decisions, required by --apply").option("--json","emit the deterministic internal preview for tooling").option("--cwd ","target project directory (default cwd)").action(n=>{Fxe(n)}),t.command("relocate-generated").description("Preview moving the generated projections into spec/generated/, or apply the move as one recoverable transaction").option("--apply","perform the move; without it the command only previews").option("--json","emit the deterministic relocation plan for tooling").option("--cwd ","target project directory (default cwd)").action(n=>{Hxe(n)}),t.command("begin ").description("Start an implementation cycle and save its pre-cycle checkpoint with the feature update").option("--cwd ","target project directory (default cwd)").option("--json","emit internal transaction details for automation").action((n,i)=>{Wxe({featureId:n,cwd:i.cwd,json:i.json})}),t.command("signoff ").description("Record local audit or UAT history. Asserted by default; with --verified --issuer a human re-types the feature id at the terminal and cladding signs a portable receipt with the registered key. Without that confirmation, a registered issuer, or a local signing key it records asserted history only (HUMAN_REQUIRED in --json).").addOption(new nD("--claim ","asserted claim kind: audit or uat").makeOptionMandatory().choices(["audit","uat"])).option("--criterion ","criterion id; required for audit").addOption(new nD("--result ","audit result: pass or fail").choices(["pass","fail"])).option("--note ","optional asserted history note").option("--cwd ","target project directory (default cwd)").option("--json","emit internal asserted-signoff details").option("--verified","request a signed receipt from a registered issuer; a human must confirm at the prompt").option("--issuer ","registered issuer name from spec/trust/issuers.yaml; required with --verified").action(async(n,i)=>{if(!i.verified){o0e(n,i);return}try{await a0e(n,i)}catch(s){ie.stderr.write(`${s.message} +`),ie.exitCode=1}});let e=t.command("key").description("Manage the issuer signing keys and the committed public trust registry.");e.command("create").description("Create one Ed25519 issuer key outside the workspace and register its public half.").requiredOption("--issuer ","issuer name recorded in spec/trust/issuers.yaml").option("--cwd ","target project directory (default cwd)").option("--json","emit issuer registration details").action(n=>{i0e(n.issuer,{cwd:n.cwd,json:n.json})}),e.command("list").description("List registered issuers and whether this machine holds each signing key.").option("--cwd ","target project directory (default cwd)").option("--json","emit issuer registry details").action(n=>{s0e({cwd:n.cwd,json:n.json})}),t.command("ingest-receipt ").description("Create-only ingest of one portable receipt, verified against the committed trust registry (spec/trust/issuers.yaml).").option("--cwd ","target project directory (default cwd)").option("--json","emit receipt-ingestion details").action((n,i)=>{u0e(n,i)}),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(C0t),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(T0t),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("--profile ","assurance profile: feedback | checkpoint | completion | push | release (legacy tiers remain aliases)").option("--assurance-level ","one-run level L1 | L2 | L3 | L4; cannot lower the persisted project level").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(B0t),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(P0t),t.command("done ").description("Mark a feature done through its completion gate (schema 0.2); schema 0.1 keeps strict pre-push compatibility (flip \u2192 gate \u2192 revert-on-red).").action(G0t),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((n,i)=>H0t(n,i)),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(R0t),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(Z0t),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(M0t),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((n,i)=>F0t(n,i)),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(n=>Bve(n,{checkStages:MN})),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(n=>z0t(n)),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(n=>U0t(n));let r=t.command("graph").description("Render the spec\u2194code\u2194doc knowledge graph for a viewer, or report its shape (F-569f4b37)");return r.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). json without --focus is the complete schema_version 2 export; html = a single self-contained offline viewer (requires --out)").option("--focus ","restrict to one node\u2019s bounded, relation-aware projection (canonical address, feature id, slug, or repository path)").option("--depth ","relation hops from --focus, 1 to 3 (default: 1)").option("--max-nodes ","maximum nodes the --focus projection may materialize, 1 to 200 (default: 64)").option("--max-edges ","maximum edges the --focus projection may materialize, 1 to 400 (default: 128)").option("--out ","write to a file (or, for obsidian, a vault dir \u2014 default .cladding/graph)").action(n=>Dxe(n)),r.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>jxe()),r.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(n=>{Lxe(n)}),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(n=>oee(n)),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(n=>Ebe(n)),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(n=>K0t(n)),t.command("route ").description("Classify a natural-language prompt to a verb").action(Y0t),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(Dve),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(E0t),t.command("doctor").description("Diagnose Claude Code hook liveness/version, lifecycle governance, and LLM dispatcher sentinel misses").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(n=>{if(n.hosts||n.matrixOnly){nve({cwd:n.cwd,yes:n.yes,matrixOnly:n.matrixOnly});return}Wbe(n)}),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(lxe),t}var Q0t=!!globalThis.__CLADDING_BUNDLED,ekt=Q0t||import.meta.url===`file://${ie.argv[1]}`;ekt&&X0t().parse();export{O0t as TIER_STAGES,X0t as createProgram,q0t as doneCompletionGuidance,L0t as exemptSolelyStaleAttestation,V0t as independenceNote,$0t as renderInitCompletionHints,N0t as renderNoRunnerGuidance,K0t as runBundleCommand,B0t as runCheckCommand,MN as runCheckStages,P0t as runCheckpointCommand,M0t as runContextCommand,G0t as runDoneCommand,F0t as runImpactCommand,z0t as runInferDepsCommand,A0t as runInitCommand,U0t as runMeasureCommand,H0t as runOracleCommand,R0t as runRollbackCommand,Y0t as runRouteCommand,E0t as runServeCommand,C0t as runSetupCommand,Z0t as runStatusCommand,I0t as runSyncCommand,T0t as runUpdateCommand}; diff --git a/plugins/claude-code/dist/schema.json b/plugins/claude-code/dist/schema.json index ab51e642..9a018237 100644 --- a/plugins/claude-code/dist/schema.json +++ b/plugins/claude-code/dist/schema.json @@ -191,7 +191,7 @@ "required": ["id", "title", "status"], "additionalProperties": false, "properties": { - "id": {"type": "string", "pattern": "^F-(\\d{3,}|[a-f0-9]{6,})$"}, + "id": {"type": "string", "pattern": "^F-(\\d{3,}|[a-f0-9]{6,})$", "description": "F-<8 lowercase hex> for new records; legacy F-<3+ digits> and F-<6+ lowercase hex> remain readable."}, "slug": {"type": "string", "pattern": "^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$"}, "title": {"type": "string", "minLength": 1}, "status": { @@ -229,7 +229,7 @@ "required": ["id"], "additionalProperties": false, "properties": { - "id": {"type": "string", "pattern": "^AC-(\\d{3,}|[a-f0-9]{6,})$"}, + "id": {"type": "string", "pattern": "^AC-(\\d{3,}|[a-f0-9]{6,})$", "description": "AC-<8 lowercase hex> for new records; legacy AC-<3+ digits> and AC-<6+ lowercase hex> remain readable."}, "condition": {"type": "string"}, "action": {"type": "string"}, "response": {"type": "string"}, @@ -265,7 +265,7 @@ "required": ["id", "title"], "additionalProperties": false, "properties": { - "id": {"type": "string", "pattern": "^S-(\\d{3,}|[a-f0-9]{6,})$"}, + "id": {"type": "string", "pattern": "^S-(\\d{3,}|[a-f0-9]{6,})$", "description": "S-<8 lowercase hex> for new records; legacy S-<3+ digits> and S-<6+ lowercase hex> remain readable."}, "slug": {"type": "string", "pattern": "^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$"}, "title": {"type": "string", "minLength": 1}, "flow": {"type": "string"}, diff --git a/plugins/codex/.codex-plugin/plugin.json b/plugins/codex/.codex-plugin/plugin.json index b3084a61..ba612f6a 100644 --- a/plugins/codex/.codex-plugin/plugin.json +++ b/plugins/codex/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.4", + "version": "0.10.0", "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/checkpoint/SKILL.md b/plugins/codex/skills/checkpoint/SKILL.md index fd5cec9c..be3cdd11 100644 --- a/plugins/codex/skills/checkpoint/SKILL.md +++ b/plugins/codex/skills/checkpoint/SKILL.md @@ -8,21 +8,21 @@ Run `clad checkpoint ` from the project root. Iron Law backbone Phase The checkpoint event payload carries: -- `featureId` — the spec id, accepts both `F-NNN` legacy and `F-` (v0.3.9+) shapes. +- `featureId` — the spec id, accepts both `F-NNN` legacy and six-or-more-hex hash shapes; newly authored records emit `F-`. - `gitHead` — full 40-char commit sha at the time of the call (or `null` when the project is not a git repository). - `specDigest` — sha-256 over the merged spec for replay verification. - `timestamp` — ISO 8601. ``` clad checkpoint F-001 -clad checkpoint F-a3f9c2 +clad checkpoint F-a3f9c2e1 ``` The output is a single Pulse line: `✓ checkpoint · head= digest=`. The event lands in `.cladding/events.log.jsonl` as `type: "feature_checkpoint"` and can be inspected with `clad doctor --json` or `clad_get_events` over MCP. ## When to use -- Before invoking `clad run` on a single feature so the loop's `RETRY_THRESHOLD` halt has a target to roll back to. +- Before starting a feature with your AI host so a failed attempt has a known-good target to roll back to. - Before a manual refactor large enough that `git stash` is unwieldy. - Right after `clad sync` reports the spec is valid, so the checkpoint pins exactly the validated spec digest the implementation will start from. diff --git a/plugins/codex/skills/developer/SKILL.md b/plugins/codex/skills/developer/SKILL.md index 97e3a870..32ab7053 100644 --- a/plugins/codex/skills/developer/SKILL.md +++ b/plugins/codex/skills/developer/SKILL.md @@ -36,8 +36,8 @@ You do NOT read Tier D (audit — observability's concern). Follow `docs/conventions.md` — `clad init` always writes it. The auto-generated header at the top of the file tells you which mode is active: -- **Greenfield seed**: toolchain-default 14-signal table (per-language defaults) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. -- **Observed**: the 14-signal table reflects what the scanner found in your code. Follow it verbatim. +- **Greenfield seed**: toolchain-default conventions table (per-language defaults) with the canonical style-guide URL inlined. Use these defaults until you have written enough code that `clad init --scan` can replace them with observed values. +- **Observed**: the conventions table reflects what the scanner found in your code. Follow it verbatim. One cladding-specific addition on top of either mode: @@ -82,4 +82,4 @@ Advisory (no detector enforces it) — but after your edits the hook auto-surfac ## User-facing language (Soft Shell) -Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for v0.3.9+ features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +Any string your code writes to stdout / a log a user reads must use feature titles, never `F-NNN` (or `F-` for current generated features); stage names (`Drift`, `UAT`), never `stage_X.Y`. Use `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). The audit log keeps the raw ids — those are for replay, not for users. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/codex/skills/doctor/SKILL.md b/plugins/codex/skills/doctor/SKILL.md index 5425d651..34975c99 100644 --- a/plugins/codex/skills/doctor/SKILL.md +++ b/plugins/codex/skills/doctor/SKILL.md @@ -31,7 +31,7 @@ The text surface prints: - After `clad init --scan` to confirm the scan refinement ran with full LLM coverage (no `sentinel_miss` events). - After installing or updating the Claude Code plugin to confirm a new session actually fired the shipped hooks and loaded the current engine. -- After `clad run` to confirm the autonomous loop received refined replies from the configured host. +- After a `clad serve` session to confirm the host returned refined replies through the configured dispatcher. - Periodically in CI to track miss rate across sampling-policy changes. - Before reporting "the LLM seems off" to a host (Claude Code / Cursor / Continue) — the breakdown tells you whether the issue is dispatcher transport (`cause: dispatcher_error`) or model output quality (`cause: blank_section`). diff --git a/plugins/codex/skills/observability/SKILL.md b/plugins/codex/skills/observability/SKILL.md index 0b317e03..81c90d67 100644 --- a/plugins/codex/skills/observability/SKILL.md +++ b/plugins/codex/skills/observability/SKILL.md @@ -47,4 +47,4 @@ When summarising or labelling reports, also read `spec.yaml::project.ai_hints`: ## User-facing language (Soft Shell) -The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The source artifacts above are Iron Core — they contain `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. When you produce a report for the user, translate the ids in your row labels and headlines via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`); keep the raw ids only when the user explicitly asked for the Iron Core view. Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/codex/skills/orchestrator/SKILL.md b/plugins/codex/skills/orchestrator/SKILL.md index ad4940fa..80ba02a9 100644 --- a/plugins/codex/skills/orchestrator/SKILL.md +++ b/plugins/codex/skills/orchestrator/SKILL.md @@ -70,4 +70,4 @@ Use the host-neutral MCP prepare/stage/apply loop. For initialization call `clad ## User-facing language (Soft Shell) -Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `haltMessage`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — attestation = sign-off, finding = what drifted and why; never lead with ids. +Surface business titles ("Login flow") to users, never internal ids (`F-049`, `F-a3f9c2e1`, …). The audit log keeps the raw ids; the user surface stays free of `F-NNN` / `F-` / `AC-N` / `stage_X.Y` codes. Use the helpers in `src/ui/softShell.ts` (`featureLabel`, `gateLabel`) wherever your output reaches the user. Translate by meaning in the user's own language — attestation = sign-off, finding = what drifted and why; never lead with ids. diff --git a/plugins/codex/skills/planner/SKILL.md b/plugins/codex/skills/planner/SKILL.md index f3cacac9..d2085ab4 100644 --- a/plugins/codex/skills/planner/SKILL.md +++ b/plugins/codex/skills/planner/SKILL.md @@ -7,40 +7,41 @@ capabilities: [read, write, edit, exec] # Planner -The **Planner** is a selectable role brief (formerly `librarian`) — a scope plus outcome conditions and evidence obligations the host may embody with any agent shape, not an agent cladding mandates spawning. It owns the Tier A spec SSoT — `spec.yaml` + per-feature spec files in `spec/features/` + `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full 4-tier model. +The **Planner** is a selectable role brief (formerly `librarian`), not an agent cladding mandates spawning. It owns the Tier A spec SSoT — `spec.yaml`, `spec/features/`, and `spec/scenarios/`. See [`docs/ssot-model.md`](../../docs/ssot-model.md) for the full model. ## Sources (what you read, by Tier) | Tier | Artifacts | Why you read it | |---|---|---| -| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | +| **A** | `spec.yaml`, `spec/features/-.yaml`, `spec/scenarios/-.yaml` | your write target | | **B** | `spec/architecture.yaml`, `spec/capabilities.yaml`, `docs/project-context.md` | cross-validate when editing A; e.g., new `features[]` binding in capabilities.yaml ↔ feature you just added | You do NOT read Tier C (conventions — developer owns it) or Tier D (audit — observability owns it). ## What you do -- Add new features with hash-based id `F-` (v0.3.9+): filename `-.yaml`, `id: F-`, `slug: `. Legacy `F-NNN` files stay sequential — never migrate. -- Author EARS-compliant ACs (`AC-N`); every feature ships at least one. -- For **load-bearing** decisions (non-obvious ordering, invariant, trade-off a future editor could undo), record WHY in that AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. +- Add `F-` features as `-.yaml`. Legacy `F-NNN` and six-or-more-hex inputs stay readable; do not migrate them for spelling alone. +- Author EARS-compliant `AC-` records; legacy sequential and six-or-more-hex ids remain readable. Every feature needs one. +- For a load-bearing decision, record WHY in the AC's `notes` (`## Decision`/`## Why`/`## Trade-off`); skip obvious ACs. See `docs/ssot-model.md` § Capturing WHY. - Bind new features to existing scenarios via the scenario's `features[]` array (see Scenarios policy below). - When adding user-facing features, update the matching capability's `features[]` in `spec/capabilities.yaml` so `CAPABILITIES_FEATURE_MAPPING` stays clean. - Mark features as `archived` (with `archived_at` + `archive_reason`). - Walk `clad sync --propose-archive` candidates — STALE_SPECIFICATION emits suggestions; you confirm each before writing. +- Treat `clad clarify` as answer collection, not design-impact resolution. When an onboarding artifact could change a registered design decision, record the design impact and ask a human to resolve it before treating the change as approved. - Split `spec.yaml` into per-feature spec files (`spec/features/*.yaml`) when the master crosses ~1k lines. - Edit `spec/architecture.yaml` and `spec/capabilities.yaml` between scans — Tier B, edit-friendly; next scan diverts new body to `.cladding/scan/*.proposal`. - After every edit, validate with `clad sync` and check with `clad check --strict`. ### Scenarios policy (v0.3.45+) -Scenarios are **onboarding output**, not feature-creation side-effect. Onboarding (host MCP flow, or CLI `clad init `) extracts 1-3 user journeys from the user's intent and writes them to `spec/scenarios/-.yaml` with `features: []`. Your job is to bind features to the matching scenario as they're added (or — rarely — author a new scenario by hand when an existing one doesn't fit). +Scenarios are **onboarding output**, not a feature-creation side effect. Onboarding (host MCP flow or `clad init `) writes 1–3 journeys to `spec/scenarios/-.yaml` with `features: []`. Bind a feature to its matching scenario; rarely, author one when none fits. ## Project policy — `spec.yaml::project.ai_hints` When authoring a new feature or scenario, also check `spec.yaml::project.ai_hints`: -- `preferred_patterns` `{when, prefer, over?}` triples — name them in AC notes when relevant (e.g. an AC about a new detector should restate "synchronous + deterministic" if the project's `ai_hints` says so) -- `forbidden_patterns` — never copy one into example code in AC text or scenario flow descriptions (detector #27 still scans those) +- `preferred_patterns` `{when, prefer, over?}` triples — name relevant ones in AC notes +- `forbidden_patterns` — never copy one into AC examples or scenario flows - `preferred_persona` — informational; names the role that will implement what you author `ai_hints` is the project-scoped SSoT for AI behavior policy and overrides this prompt for the specific project. @@ -68,6 +69,10 @@ Before reshaping a feature or scoping a new one, slice the graph instead of read Touching `src/stages/`, `src/hitl/`, or production code is **out of scope**. If a spec edit reveals an implementation gap, file an entry for `developer` and stop. +Design-impact resolution remains human-owned. The planner may identify the affected +decision and prepare the relevant spec change, but it must not clear a pending +design-impact review or infer approval from a clarification answer. + ## User-facing language (Soft Shell) -The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The spec uses `F-NNN` / `F-` and `AC-N` internally — that's Iron Core. When you summarise a change to the user, use the feature title (`spec.features[].title`), not the id. Use the helpers in `src/ui/softShell.ts` (`featureLabel`). Beyond ids, translate by meaning in the user's own language — an acceptance criterion = a testable promise, an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/codex/skills/reviewer/SKILL.md b/plugins/codex/skills/reviewer/SKILL.md index a953dc36..9ac9b38e 100644 --- a/plugins/codex/skills/reviewer/SKILL.md +++ b/plugins/codex/skills/reviewer/SKILL.md @@ -78,4 +78,4 @@ You also own the **advisory half no gate enforces**: confirm the test-author wro ## User-facing language (Soft Shell) -The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. +The audit JSON above is Iron Core — `F-NNN` / `F-` / `stage_X.Y` codes belong in the log. When you write a narrative summary for the user (review brief, hand-off note), translate ids to feature titles via `src/ui/softShell.ts` (`featureLabel`, `gateLabel`). Beyond ids, translate by meaning in the user's own language — an attestation = a signed sign-off, a detector finding = what drifted and why; never lead with internal ids. diff --git a/plugins/codex/skills/rollback/SKILL.md b/plugins/codex/skills/rollback/SKILL.md index 80cfe7b4..aa1656f4 100644 --- a/plugins/codex/skills/rollback/SKILL.md +++ b/plugins/codex/skills/rollback/SKILL.md @@ -10,13 +10,13 @@ Run `clad rollback ` from the project root. The verb is the partner o ``` clad rollback F-001 -clad rollback F-a3f9c2 --reason "specialist dispatched a regression on the L1 lint gate" +clad rollback F-a3f9c2e1 --reason "specialist dispatched a regression on the L1 lint gate" ``` The output is a single Pulse line plus the restoration command: ``` -✓ rollback · F-a3f9c2 target head= ts= +✓ rollback · F-a3f9c2e1 target head= ts= Run: git checkout ``` @@ -30,9 +30,9 @@ When the latest checkpoint has no `gitHead` (the project is not a git repo), the ## When to use -- After an autonomous drive iteration that ended in `RETRY_THRESHOLD`, `GATE_NO_PROGRESS`, or `UNCAUGHT_ERROR`. +- After an attempt that ended with the gate stuck, failing repeatedly, or erroring out. - After a manual implementation attempt that introduced a regression you don't want to bisect. -- Before re-running `clad run` on the same feature so the loop starts from a known-good HEAD instead of an in-progress mess. +- Before retrying the same feature so the next attempt starts from a known-good HEAD instead of an in-progress mess. ## Pair with diff --git a/plugins/codex/skills/run/SKILL.md b/plugins/codex/skills/run/SKILL.md deleted file mode 100644 index 28684de2..00000000 --- a/plugins/codex/skills/run/SKILL.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -description: Run cladding's autonomous loop — iterate ready features, dispatch the developer + reviewer personas through the active host adapter, run L1 gates, halt on HUMAN_REQUIRED or transport failure. Use only when the user explicitly asks for autonomous progress; the loop will modify files. Activate only when the connected project contains spec.yaml or the user explicitly names Cladding; ignore ordinary requests in uninitialized projects. ---- - -# Cladding run (formerly `drive`) - -Run `clad run` from the project root. The autonomous loop: - -1. Pre-flight `adapter.healthCheck()` — fails fast on missing credentials or unreachable host. -2. For each ready feature (status `planned`, `depends_on` satisfied): - - Specialist dispatch authors the implementation. - - Apply mutations to the working tree. - - L1 gates: Type / Lint / Arch. - - Reviewer dispatch — `HUMAN_REQUIRED` halt if reviewer identity equals specialist (anti-self-cert barrier). - - UAT requires a human-pass evidence entry; missing → `HUMAN_REQUIRED` halt. -3. Halt class is one of the 13 enumerated reasons (`ALL_FEATURES_DONE`, `MAX_ITERATIONS`, `WALL_CLOCK`, `BUDGET_EXCEEDED`, `BLOCKED_FEATURE`, `RETRY_THRESHOLD`, `GATE_NO_PROGRESS`, `HUMAN_REQUIRED`, `TRANSPORT_AUTH_FAILED`, `TRANSPORT_RATE_LIMITED`, `TRANSPORT_NETWORK`, `LLM_UNAVAILABLE`, `UNCAUGHT_ERROR`). - -Budget flags: `--max-iterations`, `--max-wall-clock-ms`, `--max-retries`. `--cwd ` targets a project directory other than the current one. `--json` emits the raw Iron Core result; default is the plain Soft Shell summary. - -``` -clad run -clad run --cwd /path/to/project -clad run --max-iterations 10 -clad run --json -``` - -**Heads-up — `run` needs a real LLM, and is for unattended/headless use only.** The host AI (Claude Code, Cursor, …) drives work *naturally in-session*; `clad run` is the entry point for the **opposite** case — autonomous, no-human-in-the-loop progress (CI/cron/SDK). Two requirements: - -- **A real dispatch must be available**: either run inside `clad serve` (MCP sampling) or use SDK mode (`agent.mode = sdk` + an API key). With **neither**, the loop falls back to the **Mock transport** and produces empty module *stubs*, not real implementations — yet still reports a normal halt. Treat a standalone `clad run` with no MCP server and no SDK key as **not doing real work**; verify with `clad doctor` afterward (a deterministic/Mock run is a red flag, not success). -- `run` modifies the working tree. - -> Known gap (tracked): standalone `run` on the Mock fallback should hard-fail with `LLM_UNAVAILABLE` rather than silently stubbing. That change reconciles the adapter `healthCheck` parity contract (F-049 AC-089, which currently treats the Mock fallback as "ready") and is a deliberate follow-up, not yet shipped. - -After a run session, run `clad doctor` over the same `--cwd` to confirm the LLM dispatcher behaved — any `sentinel_miss` events surface as a health summary so you can tell whether the loop ran with full LLM refinement or fell back to deterministic per-artifact. diff --git a/plugins/codex/skills/status/SKILL.md b/plugins/codex/skills/status/SKILL.md index 3544f4e5..6d0b102b 100644 --- a/plugins/codex/skills/status/SKILL.md +++ b/plugins/codex/skills/status/SKILL.md @@ -6,7 +6,7 @@ description: Render the feature × stage integrity matrix — every feature vs e Run `clad status` from the project root. Renders an ASCII matrix: -- Rows: features (business titles by default; raw ids with `--internal` — legacy `F-NNN` for pre-v0.3.9 features, `F-` for v0.3.9+). +- Rows: features (business titles by default; raw ids with `--internal` — legacy `F-NNN` for historical features, and current generated `F-` identifiers). - Columns: 15 Iron Law stages. - Cells: pass · skip · fail · not-yet-attempted. diff --git a/plugins/codex/skills/sync/SKILL.md b/plugins/codex/skills/sync/SKILL.md index 963f625d..eae5c6aa 100644 --- a/plugins/codex/skills/sync/SKILL.md +++ b/plugins/codex/skills/sync/SKILL.md @@ -11,7 +11,7 @@ Run `clad sync` from the project root. The command: - Reports the feature count and any validation failures. - Exits non-zero when the spec is invalid so CI can gate on it. -Spec must be valid before `clad check`, `clad run`, or any stage runner produces meaningful output. If `sync` fails, fix the reported issues first. +Spec must be valid before `clad check` or any stage runner produces meaningful output. If `sync` fails, fix the reported issues first. ``` clad sync diff --git a/plugins/gemini-cli/GEMINI.md b/plugins/gemini-cli/GEMINI.md index a337b8f0..9c192596 100644 --- a/plugins/gemini-cli/GEMINI.md +++ b/plugins/gemini-cli/GEMINI.md @@ -28,21 +28,21 @@ The full prompt body for each persona is exposed as an MCP prompt — Gemini can When you author or modify a feature shard under `spec/features/`, follow the canonical schema. Cladding's `clad sync` will reject anything that strays — schema is enforced via `additionalProperties: false`. -**Filename + id**: hash-based only. `-.yaml`, with `id: F-` (e.g. `checkout-flow-ee2133.yaml` → `id: F-ee2133`). Never hand-author `F-NNN` sequential ids — those are reserved for cladding's own historical features. +**Filename + id**: new records use exactly eight lowercase hexadecimal characters: `-.yaml`, with `id: F-` (for example, `checkout-flow-ee2133a7.yaml` → `id: F-ee2133a7`). Never hand-author a sequential `F-NNN` record; direct sequential IDs and six-or-more-hex historical IDs remain reader-only compatibility forms. -**Generate a hash**: `node -e "console.log(require('node:crypto').randomBytes(3).toString('hex'))"`. +**Generate a hash**: `node -e "console.log(require('node:crypto').randomBytes(4).toString('hex'))"`. **Required body shape**: ```yaml -id: F- +id: F-ee2133a7 # example only; generate a fresh 8-hex ID slug: # matches filename prefix title: "" status: planned # planned | in_progress | done | blocked | archived modules: - acceptance_criteria: - - id: AC-001 + - id: AC-acce5510 # example only; new ACs use a fresh 8-hex ID ears: event # event | state | unwanted | optional | ubiquitous | complex condition: when # omit for `ubiquitous` action: # omit for `ubiquitous` @@ -67,7 +67,7 @@ After authoring, run `clad sync` to validate; the error message names the offend ## Authentication -This extension uses your **Gemini CLI Google account login** (60 req/min · 1000/day free tier). Cladding's host adapter path requires no API key — F-049 AC-091 invariant. The `gemini` slot is reserved in `src/adapters/index.ts` `SDK_REGISTRY` but the SDK adapter body is not yet implemented; if you need direct-SDK dispatch (raised quotas, CI/CD batch), open a feature request before relying on it. +This extension uses your **Gemini CLI Google account login** (60 req/min · 1000/day free tier). Cladding's host adapter path requires no API key. The SDK adapter body is not shipped: the loop-only, mode-keyed SDK registry retired with the headless loop in 0.10.0, so there is no direct-SDK dispatch to fall back to. If you need one (raised quotas, CI/CD batch), open a feature request before relying on it. ## Headless / CI usage diff --git a/plugins/gemini-cli/gemini-extension.json b/plugins/gemini-cli/gemini-extension.json index 4f197a2e..33373a8a 100644 --- a/plugins/gemini-cli/gemini-extension.json +++ b/plugins/gemini-cli/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "cladding", - "version": "0.9.4", + "version": "0.10.0", "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/scripts/ab-abc/README.md b/scripts/ab-abc/README.md new file mode 100644 index 00000000..22c236a7 --- /dev/null +++ b/scripts/ab-abc/README.md @@ -0,0 +1,391 @@ +# A/B/C campaign harness — 0.9.4 vs 0.10.0 + +Runs the release-evidence campaign for 0.10.0: three arms on the identical task, +scored only on what each run leaves behind. The pre-registration — hypotheses, +decision rules, and what a null result buys — lives in +`docs/ab-evaluation/case-version-abc-094-vs-0100.md`. Read that first; this file +is the operating manual. + +## Arms + +| | Engine | Setup | What it isolates | +|---|---|---|---| +| **A** | none | a `clad` stub that logs every call and exits 127 | the model alone, and a contamination detector | +| **B** | `cladding@0.9.4` from the registry | `clad init --no-llm` (schema 0.1) + `clad setup --host claude` | the released engine | +| **C** | 0.10.0 packed from this checkout | `clad init --schema 0.2 --no-llm` + `clad setup --host claude` | the release candidate | + +Every arm gets the same template, the same `TASK.md`, the same prompt bytes, and +the same host flags. Neither the prompt nor the task mentions cladding, a version, +or that a comparison is running. Arm A's stub is deliberate: without it a run with +no engine and a run where the agent quietly reached for a globally installed one +look the same on paper. + +## Safety rules + +- **Sequential, always.** `run-cell.sh` takes a lock in `ABC_ROOT` and refuses to + start while another cell holds it. There is no watch loop and no parallel mode: + a previous campaign lost its wall-clock numbers to a driver that resurrected + itself and ran cells concurrently. +- **Budget before spending.** `budget.json` carries a cumulative total and a + campaign cap (default $40). The check runs *before* the host is spawned and the + ledger is updated immediately after, so a crash can only under-count by the run + that crashed. Each cell also carries its own `--max-budget-usd` (default $6). +- **Fixtures live outside the repo.** Everything is under `ABC_ROOT` + (default `~/abc-0100`). Nothing the campaign runs writes into this checkout. +- **Costs are estimates.** `total_cost_usd` is the host's list-price estimate for + an OAuth session. It is not an amount billed, and every table that reports it + says so. + +## Running it + +```bash +export ABC_ROOT=~/abc-0100 + +bash scripts/ab-abc/freeze.sh # pack C, install B, hash both +npx tsx scripts/ab-abc/sidetable.ts --bootstrap # build the side-table fixtures +npx tsx scripts/ab-abc/sidetable.ts # deterministic rows, no agent + +bash scripts/ab-abc/make-cell.sh A pilot1 # then B pilot1, then C pilot1 +bash scripts/ab-abc/run-cell.sh A pilot1 # one at a time +bash scripts/ab-abc/rescore.sh A pilot1 # re-score a finished cell, no host +npx tsx scripts/ab-abc/render.ts "$ABC_ROOT" --out "$ABC_ROOT/results/report.md" +``` + +Results are written up in +[`docs/ab-evaluation/case-version-abc-094-vs-0100.md`](../../docs/ab-evaluation/case-version-abc-094-vs-0100.md); +the raw artifacts stay outside the repository, under `ABC_ROOT`. + +The deterministic side-table runs first on purpose. It costs nothing, and a row +that comes back wrong is a reason to fix the engine and re-pack *before* spending +anything on live cells. + +The side-table rows read three of their own: `ABC_L4_POLICY=require` switches the +L4 replay to the refusal case, `ABC_L4_ISSUER=` signs it as somebody other +than the committing author (unset, the replay is byte-for-byte what it always +was), and `ABC_HOST_PROBE_TIMEOUT` moves the host probe's per-cell wall clock off +its ten-minute default. + +`ABC_TASK=task2.md` builds a cell around the second, smaller feature, and +`ABC_FROM=/` seeds a cell from a **finished** one instead of the +template — the continuation case, where a second feature lands in a workspace +that already completed one. The whole tree comes across, git history and harness +state included, `node_modules` is symlinked rather than copied, and anything the +source cell left uncommitted is committed so the new baseline is again a clean +HEAD. + +`make-trap-cell.sh ` builds a different kind of cell: the module is written, +the tests pass, the feature is open — and only the *binding* is broken. Arm B's +shard has its `test_refs` emptied; arm C's covers tokens sit at the END of each +title, where they look bound to a human and are invisible to the engine; arm A +has no spec at all. The agent is told the feature is implemented and tested and +asked to finish it. A run that completes without repairing the binding has +claimed something it did not establish. + +`make-done-fixture.sh ` builds the side-table's completed-feature fixture +with no agent at all: template → init → a feature created through the MCP tool → +module and bound tests → sync → strict pre-push → completion, with the completion +output captured verbatim (that capture *is* row L0-5). `sidetable.ts --bootstrap` +calls it for both arms. + +`make-done-fixture.sh C --stop-before-done` builds the same project one step +short of completion, raises it to L4 inside its cycle, and adds the project-owned +`smoke`, `perf` and `visual` scripts an L4 profile calls. Without those three the +stages skip, and a skipped stage is an unobserved obligation — the L4 row would +then fail for a missing runner rather than for a missing receipt. The L4 row runs +the completion itself, which is what publishes the L4 attestation row. + +**Bash 3.2.** The stock macOS shell is bash 3.2, so nothing here uses `mapfile`, +associative arrays, or the other bash-4 conveniences. Where a helper reads one +line of a pipeline it uses `sed -n 1p` rather than `head -1`, because `head` +closes the pipe early and the writer then dies of EPIPE mid-fixture. + +## What gets measured + +Everything is deterministic and computed after the session ends. `run-cell.sh` +runs a **measurement pass** inside the arm's own fixture — `tsc`, ESLint, a JUnit +test run, a coverage run, and the hidden oracle — and `score.ts` turns those +artifacts, the harness event log, the workspace files and git into one +`score.json`. The transcript's prose is never read or scored. + +**1 · What the arm produced — code** (`src/**`): `loc_src` (code lines, blanks +and comment lines excluded), `lint_errors` / `lint_warnings`, `tsc_clean`, +`complexity_max` / `complexity_mean`, `any_count`, `api_conformance` (is +`slugify` exported, does its signature match the brief, is `EmptySlugError` a +real `Error` subclass), `error_class_named`, `comment_density` with the JSDoc +block count beside it, `header_comment_present`, and `files_outside_scope` +(changes outside `src/` and `tests/`). + +**2 · What the arm produced — tests** (`tests/**`): `test_count` from the JUnit +report, `assertion_count`, `ac_titled` (which acceptance criteria are named in a +test title — the one habit the brief asks of every arm), `negative_test_present`, +`skip_or_only`, `coverage_lines_pct` from `coverage-summary.json`, and +`blind_oracle_pass`. + +**3 · Development time**: `duration_ms` and `duration_api_ms` from the host, +`wall_ms` measured by the driver around the call, `num_turns`, +`time_to_first_edit_ms` (from the session's start to the first Write/Edit), and +two ordinals — which tool call first reached for a gate, and which gate run +first came back green. + +**4 · Tokens**: input, output, cache read, cache creation, thinking, their total +and the cache-read ratio, `total_cost_usd`, the per-model split, and +`static_instruction_tokens` — an estimate of the standing instruction bytes each +arm injects (`prompt.txt` plus any `AGENTS.md` / `CLAUDE.md` its setup wrote). +That last one is how much context an arm spends before doing anything. + +**5 · Friction, gates, spec artifacts**: `tool_calls_total` / `tool_calls_mcp` / +`tool_errors` / `permission_denials`, `gate_runs` and `gate_red_then_green` (an +honest red that later became green), `git_commits` with their messages, +`worktree_clean_at_end`, `spec_artifacts` (shards, criteria, how many carry a +statement, an `ears` field, or test refs), the judge's exit and its findings +counted per detector and severity, and `scorer_reproducible` — the driver scores +each cell twice and records whether the two results are byte-identical. + +### The judge + +The arm's **own** engine re-runs `check --tier=pre-push --strict --json` after +the session, so a claim of completion is never taken on the agent's word. Arm A +has no engine, so its judgement is the same fixture's `npm test` and +`npx tsc --noEmit`, plus whether the acceptance criteria are named in the test +titles. + +### The hidden oracle + +`oracle/slugify.oracle.test.ts` is written before the campaign and is never in +any arm's fixture: the driver copies it in after the session, runs it once, +records pass and total, and deletes it. It reaches past the three stated criteria +— trailing separators, idempotence, decomposed Unicode — because it asks what an +arm *built*, not whether it satisfied the brief it read. It imports `slugify` +alone and checks the error by name, so an arm that keeps its error type private +is not penalised for a choice nobody constrained. + +**This axis is pre-registered as reported-only.** Four prior campaigns found +correctness orthogonal to the harness. Whatever the oracle says, it is published +and it does not feed the release verdict. The same holds for the whole +code-quality group. + +### How complexity is counted + +Not with ESLint. The `complexity` rule needs a TypeScript parser, and the fixture +deliberately ships a bare ESLint config so `npm run lint` means the same trivial +thing in all three arms — adding a parser to measure the arms would change what +the arms were asked to do. So `score.ts` states its own count instead: one per +function, plus one for each `if`, `for`, `while`, `case`, `catch`, `&&`, `||`, +`??` and `?:` in its body, with bodies found by brace matching. It is a coarse +measure for comparing three implementations of one small module, never a +pass/fail. For the same reason `lint_errors` will usually be zero: it records +that the fixture's own lint stayed quiet, nothing more. + +### The rubric that is not run + +`judge.sh` would build an arm-blinded snapshot of `src/` and `tests/` and ask a +separate model to score readability, error handling and test design out of five. +It is **secondary and not part of the campaign**: model-graded, non-deterministic, +roughly $0.10 per cell. It refuses to run without `ABC_JUDGE_CONFIRM=yes-spend`. +It exists so its absence is a recorded decision rather than an oversight. + +## Disqualifiers + +`score.json` records these; a disqualified cell is kept as evidence and excluded +from the statistics by hand. + +- an error result, or a subtype other than success (this is also how a + budget-capped run appears — kept, because it is the evidence R2 asks for) +- arm A: the stub was called, or a Bash command reached for the engine directly +- arm B/C: the launcher's engine path falls outside the arm's prefix +- **a cladding tool call was denied** — the arm was prevented from using the very + thing under test +- **models other than the primary carried more than a tenth of the cost** — at + that point the cell is no longer a measurement of the model it names + +Two candidate rules were deliberately **not** adopted, because the reference host +run showed each would disqualify every cell for reasons unrelated to the engine. +A second model appearing in `modelUsage` at all is the host's own auxiliary work +(the reference run showed two models with zero subagents spawned); it is reported +as `secondaryModelCostUsd` instead. And an ordinary permission denial is recorded +as friction, with the denied tools named, rather than thrown away. Host +permissions are the same for all three arms and deliberately wide — +`--permission-mode acceptEdits` with an ordinary shell allowed — because a cell +denied `mkdir` would be measuring the allow-list. Bypassing the permission system +itself is not allowed in any arm. + +## The deterministic side-table + +`expectations.yaml` holds the L0/L3 rows. Four fixture families are kept apart: + +- **shared-0.1** — one schema-0.1 workspace driven by *both* engines, carrying one + feature created once by the released engine so both arms read identical bytes. + A difference here is a back-compatibility change. A row names that feature by + writing `{shared_feature}` in a tool argument; the runner substitutes the id the + bootstrap recorded. +- **per-version-init** — each engine scaffolds its own default from the identical + template. A difference here is the intended 0.2 delta. +- **done** — that project carried to completion by the arm's own engine. +- **inprogress** — the same project stopped one step short of completion and + raised to L4, carrying the project-owned smoke, performance and visual runners + an L4 profile calls for. Two rows use it: the L4 replay, and the same replay + with the independence policy turned up. + +Every row carries a pre-registered `expect`, and **the expectation is itself +under test**. A run fills `observed`; a human then marks each row `match`, +`defect-fixed` (something had to be repaired before the row could be believed), +`expectation-wrong` (the engine is fine, the guess was not), `designed` (a +deliberate 0.2 change, named in the case document before the fact), or `record` +(the row exists to write down what each engine says). A sixth value, `manual`, +belongs to a row that cannot be driven without a model at all: it is recorded +with the reason it is manual and is answered by a live probe instead. An +`expectation-wrong` row also carries `expect_revised` — what is now expected, in +the same shape as the guess, plus a `why` saying what the pre-registration got +wrong. The original `expect` stays where it is, because a corrected guess is only +readable next to the one it corrects. While the file says `status: unlocked` a +mismatch is a finding to classify, never a blocker. + +A row that found a product fault gets neither a classification nor a lock yet. It +carries `defect` — one sentence saying what is wrong — and `rerun`, naming the +repair the row is waiting on. That pairing is a transient state, not a verdict: +the row keeps `classification: null` until the repaired engine is packed and the +row has run against it, and only then is it classified and pinned like any other. +Leaving it unclassified is deliberate — a row cannot be locked against behaviour +that is about to change. + +Once every row is classified, flip the file to `locked`. That is not a label: each +row must then also carry a `lock:` map — one entry per `-` pinning the +exit code, plus the byte count and the literal strings the output must still +carry wherever the substance is in the output rather than the exit. `sidetable.ts` +compares every pin against what it just saw, names each difference in the verdict +column and in `results/sidetable-mismatches.txt`, and exits non-zero. A locked row +that pins nothing, or carries no classification, is itself a mismatch — locking a +row without pinning anything would make the gate vacuous, which is the failure +mode this campaign exists to avoid. Pinned literals are matched against the +artifact's own bytes, so a string that lands inside a JSON payload is pinned in +its escaped form. + +One pin reads a file inside the row's own workspace rather than a captured +artifact — the `file` step kind — so `sidetable-runs/` must still hold that +workspace when the lock is checked. A full run and an `--only` that excludes the +row both satisfy that; deleting the scratch tree by hand between the run and the +check does not, and the pin fails for a reason that has nothing to do with either +engine. + +`sidetable.ts --only L0-1,L0-4` re-runs a few rows and carries the rest of the +table forward from the previous run, so a targeted re-run never blanks the record +of the rows it did not touch. + +A row may also carry its own `status: unlocked` inside a locked file. That only +ever loosens: the row is recorded, counted and named in the run's closing line, +never enforced — so a batch still being read can sit beside pinned rows without +either weakening the gate or blocking on guesses nobody has checked yet. + +**The table is fully locked.** All 44 rows are classified and pinned as of +2026-09-10; none carries its own `status: unlocked`, so a passing run closes with +`every pinned exit, byte count and literal still holds (44 rows)` and no +still-unlocked line. Any difference from a pin fails the run. + +Re-locking after a product change is the same loop the rows were written in. +Repack the candidate engine (`freeze.sh`), run the whole table +(`npx tsx scripts/ab-abc/sidetable.ts`), and read what it names. A mismatch is a +question before it is a fix: if the artifact shows the pin was mis-copied, +correct the pin; if the engine's answer genuinely changed, decide whether the new +answer is right before writing it down, and say so in the row's `observed` and +`classification`. Two things are never the remedy — weakening an `exit` pin, and +weakening a literal that carries the row's substance. A byte count is different: +drop a `bytes` pin when the output legitimately varies between runs, because a +digest or a timestamp moved. Then re-run the table until it is green, and check +the lock in the other direction as well — change one pinned literal to a wrong +value, run `--only `, and confirm the run fails naming it. A lock that +has never been seen to fail is not yet known to be a lock. + +Every row runs automatically. Five fixture families keep the questions apart: +`shared-0.1` (one schema-0.1 workspace both engines drive), `per-version-init` +(each engine's own scaffold from the identical template), `done` and +`inprogress` (a project that has finished a feature, and one stopped a step +short), and `template` — the skeleton before any engine has touched it, which +the onboarding rows scaffold for themselves. The rows that need deliberate +damage name a **mutation** — `strip-module-header`, `covers-token-trailing`, +`require-independence`, `vacuous-green`, `stale-host-section`, +`archive-with-successor`, `missing-module` — so a reader can see what was broken +without reading code, and each mutation is applied to that row's own fresh +workspace so it cannot leak. Several rows are shell scripts of their own, because +they are sequences rather than single calls: the migration (preview, reject, +accept, gate), the stale typed edit, the L4 replay, and the refused L4 cycle. The +last two need `expect` for the interactive signing prompts and record *not run* if +it is absent, rather than guessing. The refused cycle is `row-l4.sh` again with +`ABC_L4_POLICY=require`: same fixture, same signing, and the completion must be +turned down with a refusal that names a registered issuer as the remedy. It +checks the mutation is visible in the workspace's own `spec.yaml` before it +measures anything, and fails the row rather than passing quietly if the +completion succeeds — a policy that never landed and a policy with nothing to +refuse look identical from the outside. + +The runner prints each arm's engine path and version before it records anything: +which engine is which is the one thing this table cannot afford to get wrong. + +## The coverage ledger + +A side-table proves what its rows ask. It does not, on its own, prove that the +rows cover everything the release changed — and "we checked every feature" is +exactly the kind of claim that rots quietly. `coverage.yaml` closes that gap: one +entry per bold lead in the 0.10.0 release notes, per sentence of its heads-up +paragraph, and per feature entry added since 0.9.4, each mapped to the rows that +exercise it, to a live host probe, or to a written reason why a black-box row +would measure nothing. + +`tests/scripts/ab-abc-coverage.test.ts` checks that mapping in CI. It reads only +the release notes, the ledger, the row list and the feature entries — no engine, +no fixtures under `~/abc-0100`, no network — so the coverage claim is re-checked +on every commit rather than on the day it was written. A new bullet with no +entry, a reworded heads-up sentence, a feature entry that is not done, or a row +id nobody wrote all fail it. The ledger carried a `pending_rows:` list while one +round of rows was still being written; every id in it has landed, so the list is +gone and each row the ledger names now exists in `expectations.yaml`. + +## Files + +| File | Role | +|---|---| +| `freeze.sh` | build + pack C, install B, verify versions and dist hashes, open the ledger | +| `make-cell.sh` | build one cell's fixture; the only place the arms differ | +| `run-cell.sh` | budget check → one live session → artifacts → judge → score | +| `budget.mjs` | the cumulative ledger: `check` before, `record` after | +| `score.ts` | one cell's artifacts → `score.json` | +| `rescore.sh` | re-scores a finished cell (no host) and records scorer reproducibility | +| `render.ts` | the campaign root → markdown tables (reads `artifacts/**/score.json` and `results/sidetable.json`) | +| `sidetable.ts` | the agent-free L0/L3 runner and its fixture bootstrap | +| `expectations.yaml` | the side-table rows, their expectations, and the lock | +| `mcp-client.mjs` | stdio MCP client for rows that must exercise the tool surface | +| `oracle/` | the hidden oracle, copied into a cell only after it has finished | +| `lib-fixture.sh` | the shared fixture steps: seed, init, create a feature, bind or unbind | +| `make-done-fixture.sh` | a completed feature, built with no agent — the side-table's hardest input | +| `make-trap-cell.sh` | the completion-claim trap cell, plus `prompt-trap.txt` | +| `write-tests.mjs` | generates the fixture's tests with the binding a row asks for | +| `row-migrate.sh` | the migration row: preview, reject, accept, then the strict gate | +| `row-stale-edit.sh` | the stale typed-edit row | +| `row-l4.sh` | the L4 replay row, driving the signing prompts through `expect`; `ABC_L4_POLICY=require` switches it to the refusal case | +| `row-l4-require.sh` | that switch, as the row's own entry point: a self-signed L4 cycle must be refused | +| `row-init.sh` | what each engine's own scaffold declares and instructs | +| `row-init-compat.sh` | asking the candidate for the old format, compared with the released engine's scaffold | +| `row-begin.sh` | claiming completion before the cycle is opened, and after | +| `row-typed-edit-two.sh` | two edits prepared from one snapshot: one lands, one replays | +| `row-scenario-policy.sh` | an unclaimed journey under the advisory and the required setting | +| `row-capability.sh` | a capability reference that does and does not resolve | +| `row-profiles.sh` | the named check profiles, and the one that refuses uncommitted work | +| `row-attestation.sh` | the shape of the sealed record, and whether a repeat pass rewrites it | +| `row-retired-surfaces.sh` | whether the retired loop is still in the installed package | +| `row-key.sh` | an issuer key's whole lifetime: created outside the workspace, registered once, refused twice | +| `row-signoff-refusals.sh` | the four paths that must not produce a verified receipt | +| `row-receipt-stale.sh` | a signed cycle, the module edited underneath it, and what re-signing restores | +| `row-l4-independent.sh` | `row-l4.sh` signed by someone other than the committing author: the positive half of the independence policy | +| `row-ingest.sh` | ingesting a receipt again, tampered, and from a stranger — with a control pass that says whether the verb verifies at all; the stranger's workspace is built outside the one under test | +| `row-portable-seal.sh` | a record stamped on a machine holding stray files, then the same commit cloned and checked afresh | +| `row-census.sh` | an evidence directory that cannot be read safely, and the gate's answer to it | +| `row-mcp-signoff.sh` | a verified sign-off asked for over MCP by a client that cannot ask a human | +| `row-relocate.sh` | the generated projections' whole move: preview, apply, gate, repeat, conflict, and a 0.1 workspace | +| `row-migrate-guards.sh` | the three refusals around a migration: uncommitted work, a decision already answered, a criterion nobody can parse | +| `host-probe.sh` | the live host-integration probe — real host CLI, three read cells and a minimal write cycle | +| `host-probe.md` | what each probe cell does, how to repeat one by hand, and what the cost cap means | +| `coverage.yaml` | the coverage ledger: every released 0.10.0 item to its rows, a host probe, or a reason it is not a scenario | +| `judge.sh` | the blinded model rubric — secondary, and not run | +| `template/` | the fixture every arm starts from (no `node_modules`; `npm ci` fills it) | +| `prompt.txt`, `task.md`, `task2.md` | the bytes every arm receives | + +Catalogue bytes: `mcp-client.mjs` reports the pretty-printed whole result (158 700 B on 0.10.0) and, inside it, a compact `tools/list` slice of 60 135 B; neither is the release pin, which is `npm run validate:spec-0.2`'s compact `stableJson({tools, resources, prompts})` at 140 498 B over the same 27 tools. diff --git a/scripts/ab-abc/budget.mjs b/scripts/ab-abc/budget.mjs new file mode 100644 index 00000000..7a383353 --- /dev/null +++ b/scripts/ab-abc/budget.mjs @@ -0,0 +1,53 @@ +// Cladding · scripts/ab-abc/budget.mjs — the campaign's cumulative spend ledger +// +// Kept as its own file rather than inline in run-cell.sh so the arithmetic that +// stops the campaign is readable and testable on its own. Two commands: +// +// node budget.mjs check +// exits 1 when this cell could carry the campaign past its cap. Run BEFORE +// the host is spawned — a check after the fact stops nothing. +// +// node budget.mjs record +// adds the host-reported cost of a finished run. Cost is the host's +// list-price estimate for an OAuth session, not an amount billed. + +import fs from 'node:fs'; +import process from 'node:process'; + +const [, , command, ledgerPath, ...rest] = process.argv; +if (!command || !ledgerPath) throw new Error('usage: budget.mjs …'); + +const ledger = JSON.parse(fs.readFileSync(ledgerPath, 'utf8')); +const usd = (n) => `$${n.toFixed(2)}`; + +if (command === 'check') { + const cellCap = Number(rest[0]); + if (!Number.isFinite(cellCap)) throw new Error('check needs a numeric cell cap'); + if (ledger.spentUsd + cellCap > ledger.capUsd) { + process.stderr.write( + `budget stop: ${usd(ledger.spentUsd)} already spent, this cell is capped at ${usd(cellCap)}, campaign cap is ${usd(ledger.capUsd)}\n`, + ); + process.exit(1); + } + process.stdout.write(`budget ok: ${usd(ledger.spentUsd)} spent of ${usd(ledger.capUsd)}\n`); +} else if (command === 'record') { + const [runPath, arm, cell] = rest; + let cost = null; + for (const line of fs.readFileSync(runPath, 'utf8').split('\n')) { + if (line.trim() === '') continue; + try { + const event = JSON.parse(line); + if (event.type === 'result' && typeof event.total_cost_usd === 'number') cost = event.total_cost_usd; + } catch { + // a truncated tail is not a cost + } + } + ledger.runs.push({arm, cell, at: new Date().toISOString(), costUsd: cost}); + if (cost !== null) ledger.spentUsd = Number((ledger.spentUsd + cost).toFixed(6)); + fs.writeFileSync(ledgerPath, `${JSON.stringify(ledger, null, 2)}\n`); + process.stdout.write( + `cell cost ${cost === null ? 'unreported' : usd(cost)}; campaign total ${usd(ledger.spentUsd)} of ${usd(ledger.capUsd)}\n`, + ); +} else { + throw new Error(`unknown command: ${command}`); +} diff --git a/scripts/ab-abc/coverage.yaml b/scripts/ab-abc/coverage.yaml new file mode 100644 index 00000000..512cd231 --- /dev/null +++ b/scripts/ab-abc/coverage.yaml @@ -0,0 +1,176 @@ +# Cladding · scripts/ab-abc/coverage.yaml — the coverage ledger for 0.10.0 +# +# "Every feature was checked" is a claim, and a claim needs something that fails +# when it stops being true. This file is that something: one entry per item the +# 0.10.0 release notes put in front of a user — every bold lead in the Added / +# Changed / Removed / Fixed lists, every sentence of the heads-up paragraph, and +# every feature entry added since 0.9.4 — mapped to the deterministic side-table +# rows that exercise it, to a live host probe, or to a written reason why it is +# not a scenario at all. +# +# `tests/scripts/ab-abc-coverage.test.ts` reads only this file, the release +# notes, the side-table rows and the feature entries, and fails when the mapping +# stops holding. It runs in CI with no engine, no fixtures and no network, so the +# coverage claim is checked on every commit rather than on the day it was made. +# +# An entry carries at least one of: +# rows: side-table row ids that exercise the item +# host_probe: true — the item is about a live host, checked in §Host probes +# not_a_scenario: why a black-box row would measure nothing here +# +# Keys are verbatim: a changelog key is the bold lead exactly as written, and a +# heads-up key is a literal fragment of the sentence it stands for. Rewording the +# release notes therefore breaks the test, which is the point — the ledger tracks +# what the notes actually say, not what they said when it was written. + +changelog: + "Spec schema 0.2.": + rows: [S-A1, S-B1, S-B2, S-B3, S-C2, L0-11] + "One compiled model now answers the questions that used to be asked of four,": + rows: [S-E1, S-E2, L3-2] + "The count sync covers feature counts too.": + not_a_scenario: >- + A repository maintenance script for this project's own readme totals. It + touches no adopter surface, and its behaviour is fixed by the repo's own + tests under tests/scripts. + "`clad relocate-generated` moves the generated files under `spec/generated/`.": + rows: [S-F1] + "A schema 0.2 workspace explains its own generated files.": + rows: [S-A4] + "A release gate for the 0.2 validation work.": + not_a_scenario: >- + The validation ledger governs this release's own evidence, not an adopter + workspace. Its blocking behaviour is fixed by release-boundary.test.ts and + by the release-scoped validator, both of which run in CI. + "The release was measured against the engine it replaces, and against no engine at all.": + not_a_scenario: >- + This lead describes the previous campaign. Making it a row would be the + side-table measuring itself. + "Completeness is judged from structure alone.": + rows: [S-C3, S-C4, S-D6] + "The authoritative profiles block on warnings.": + rows: [S-C1, S-B6, L0-1] + "A project's own instructions now say how a test claims a criterion.": + rows: [S-A1, S-A3, L0-2] + "An archived feature whose successor is not done yet": + rows: [S-B6] + "`clad done` reports how independently the work was verified.": + rows: [S-D4, L0-6, L0-6b] + "The experimental headless loop and its `run` command.": + rows: [S-G1] + "The parts that existed only to serve that loop:": + rows: [S-G1] + "The `run` skill,": + rows: [S-G1] + "The host support table was refreshed against live runs for this release.": + host_probe: true + "Graph code no longer reaches into gate code,": + not_a_scenario: >- + An import rule inside this project's own architecture, enforced by its own + architecture gate. Nothing an adopter can observe from outside. + "A renamed test keeps its binding.": + rows: [L0-11, S-F2] + note: >- + PROVISIONAL. The battery's own list leaves this lead unmapped; it is placed + with the migration rows because the bindings it repairs are the ones the + migration carries forward. The main agent decides whether it earns a row of + its own. + "Patched dependencies.": + not_a_scenario: >- + A dependency version bump. The observable fact is what `npm audit` reports + against this repository's lockfile, which the frozen engines do not carry. + "A workspace holding a signed review could never record a verification.": + rows: [S-D2, S-D3] + "Asking for a different level of assurance for one run now says why it was refused.": + rows: [S-C3] + note: repaired by F-18a5883a during the battery; row re-run after repack + "A receipt imported on the command line is now checked against the project's registered signers,": + rows: [S-D5] + note: repaired by F-18a5883a during the battery; row re-run after repack + "An attestation stamped on a working machine now matches the one a clean checkout computes.": + rows: [S-C5] + +heads_up: + "the migration refuses to touch a path with uncommitted changes on it": + rows: [L0-11, S-F2] + "One of those decisions asks whether your already-completed features may carry their existing proof forward.": + rows: [L0-11] + "Answer no and they carry nothing": + rows: [L0-11] + "changing your mind means undoing the migration and applying it again": + rows: [S-F2] + "The headless loop is gone — start the server with `clad serve`": + rows: [S-G1] + "Moving the generated files into one folder is opt-in through `clad relocate-generated`": + rows: [S-F1] + "the pre-push check rewrites the sealed record of what was verified every time it passes": + rows: [S-C2] + "has to come at the very start of the test's title": + rows: [L0-2, S-A1, S-A3] + +features: + F-6349870d: + rows: [S-A1, S-A3] + F-6f0a2106: + rows: [S-C1, S-C2, S-C3] + F-1a87a6bd: + not_a_scenario: >- + The context envelope is production code with no dispatch wiring in front of + it yet, so no adopter surface reaches it. Recorded as a known orphan rather + than dressed up as a scenario. + F-0a29d024: + not_a_scenario: >- + A design-validation ledger for this release's own work. Its state is fixed + by release-boundary.test.ts, not by anything an adopter runs. + F-8e7f399b: + rows: [S-D4] + F-9fcdd0a0: + rows: [S-G1] + F-f4cfd533: + rows: [S-D1, S-D2, S-D5] + F-b8d77abf: + not_a_scenario: >- + The closure audit for this release's own criteria. A repository fact, + checked by this repository's gate. + F-208eaa79: + rows: [S-E1, S-E2] + F-c4df5fb4: + rows: [S-A1, S-A2] + F-14c9d647: + rows: [S-F2] + F-94285dd8: + rows: [S-B5] + F-2883ff4d: + rows: [L0-2, L0-9, S-D2, S-D3] + not_a_scenario: >- + The proof kernel has no surface of its own — it is what the binding, the + vacuous-green and the evidence rows are all reading through. Listed with the + rows that consume it rather than given one that would only re-ask their + questions. + F-a0bd9c5a: + rows: [S-D3] + F-c2d7dc78: + not_a_scenario: >- + The release ledger for this repository's own validation work. + F-0dafcf9d: + rows: [S-F1] + F-0b8f23c5: + rows: [S-B4] + F-2bbecd83: + not_a_scenario: >- + A test suite. Its subject is this repository's own topology invariance, and + running it is what checks it. + F-4f4a12c3: + rows: [S-B3, L0-8] + F-2f840a6c: + not_a_scenario: >- + A refinement of how this release's own validation findings are reported. + F-182eaa53: + not_a_scenario: >- + The compiler registry every other row reads through. Nothing observable + sits on top of it that some other row does not already ask about. + F-18a5883a: + rows: [S-C3, S-D5] + note: the repair the battery itself demanded — both rows re-ran on the shipped build and are locked on it + F-71da4292: + rows: [S-C5] diff --git a/scripts/ab-abc/expectations.yaml b/scripts/ab-abc/expectations.yaml new file mode 100644 index 00000000..d9a535b9 --- /dev/null +++ b/scripts/ab-abc/expectations.yaml @@ -0,0 +1,2097 @@ +# Cladding · scripts/ab-abc/expectations.yaml — the L0/L3 deterministic side-table +# +# These rows run with no agent: the engine is driven directly, so the same input +# gives the same answer every time. Five fixture families are kept apart on +# purpose, because they answer different questions: +# +# shared-0.1 one schema-0.1 workspace, driven by BOTH engines. Anything +# that differs here is a back-compatibility change: the same +# project, a newer engine, a different answer. +# per-version-init each engine scaffolds its own default from the identical +# template (B: `clad init --no-llm`; C: `clad init --schema 0.2 +# --no-llm`). Differences here are the intended 0.2 delta, not +# a regression. +# done a project that has genuinely finished a feature, per arm — +# the input every question about completion, warn severity, +# independence or migration actually needs. +# inprogress the same project stopped one step short of completion, for +# the questions that are about the cycle rather than its end. +# template the skeleton before any engine has touched it. The +# onboarding rows scaffold it themselves; that is their +# question. +# +# `expect` is the pre-registered guess, and it is itself under test. A run fills +# `observed`, and a human fills `classification` from this vocabulary: +# +# match observed matches expect +# defect-fixed the row found something that had to be repaired before the +# table could be believed, and the repaired run is what the +# row now records +# expectation-wrong the engine's behaviour is defensible; the row's guess was +# not. Correct the expectation, say so in the case doc. +# designed the difference is a deliberate 0.2 change, named in the +# case document's list before the fact +# record the row has nothing to be right or wrong about; it exists +# to write down what each engine says +# manual the question needs a host model, so the table records only +# the part that runs without one and the rest is a host probe +# +# While `status: unlocked` a mismatch is a finding to classify, never a blocker. +# Once a human has classified every row, flip to `status: locked` — from then on +# a mismatch blocks the release, which is the whole point of writing the guesses +# down before looking. +# +# LOCKING is what makes that a machine fact rather than a promise. Each row +# carries a `lock:` map — one entry per `-`, pinning the exit code, and +# where the substance is in the output rather than the exit, the literal strings +# that output must still contain and the byte count it must still have. While the +# file is locked the runner compares every pinned value against what it just saw +# and exits non-zero on the first difference. Prose in `observed` is for the +# reader; `lock:` is what actually blocks. +# +# A row may carry its own `status: unlocked` inside a locked file. That only ever +# loosens: the row is recorded, counted and reported, never enforced, so a batch +# still being read can sit beside pinned rows without either weakening the gate +# or blocking on guesses nobody has checked yet. The run prints how many remain. +# No row carries one now — every row in this file is pinned and enforced. +# +# A pinned literal is matched against the artifact's own bytes, so a string that +# reaches the artifact inside a JSON payload is pinned in its escaped form — +# `schema_version\": 1`, not `"schema_version": 1`. That is deliberate: the pin +# names what is on disk, and nothing re-parses the artifact to make the guess +# look tidier. + +# FIRST RUN, 2026-09-08. Every row ran. Eight rows measured nothing on that run +# — the fault was the harness in every case, not the engine: a mutation that +# stripped one comment style and left another, an arm whose shard bound no +# module, tool calls missing a required argument, a fixture with no feature in +# it, an L4 replay that signed one criterion of three and completed at the wrong +# point in the cycle, and a migration driven with two flags the verb does not +# define. Those are repaired, the rows re-ran, and each row now carries +# `expect_revised` saying whether its guess was corrected before or after the +# repaired run. +# +# LOCKED 2026-09-08, after the corrected table was read row by row and one row +# was added: L0-6b, the refusal case for the independence policy, which closes +# the gap L0-6 recorded. The lock preceded every COMPARISON cell; the one live +# session that ran before it was a single-arm instrumentation check of the driver +# and the scorer, and no row here reads a number from it. +# +# FULLY LOCKED 2026-09-09. The 27 feature-scenario rows (S-*) were read one by +# one and pinned, so all 43 rows in this file are now enforced and none is +# recorded-but-inert. Two of the 27 had found real defects and were held back +# from the lock until they were repaired: S-C3, where a one-run assurance level +# the gate could not honour was refused silently, and S-D5, where the CLI ingest +# path never consulted the committed trust registry. Both were fixed by +# F-18a5883a (commit e32c694) and re-run against the shipped build — the C arm +# repacked from this checkout, dist sha b34e2755… — and it is that repaired run +# the pins record. +# +# RE-LOCKED 2026-09-10, after the seal repair (F-71da4292) was packed into the C +# arm — dist sha 06ec4cab…, the build that now ships. Two rows moved. S-C5, the +# pre-registered row for that repair, ran for the first time, met its guess and +# is pinned, taking the table to 44 rows. S-D5's stranger sub-case was re-pinned: +# its old pin recorded an expected-digest mismatch, which turned out to be an +# artefact of the harness rather than a property of an unregistered issuer — the +# row built the stranger's workspace as a copy INSIDE the workspace under test, +# and the old enumeration walked into it and sealed its files into the original. +# With membership taken from git the copy's files are not members, the digests +# match, and the kernel reaches the issuer lookup: unregistered → stored as +# asserted evidence pending offline resolution, exit 0. The row now builds the +# stranger outside the workspace, so its meaning no longer depends on nested- +# repository semantics, and pins that verdict. +# +# S-A5 changed shape in this round. Its question — the shape a clarify round trip +# hands back — needs an onboarding session, and a session needs a host model, so +# the row cannot be driven here. What can be driven is the refusal that makes it +# manual, and the row now runs and pins that on both engines rather than sitting +# in the table with nothing enforced. The round-trip question stays with the live +# host probes, and the row's classification stays `manual` to say so. + +status: locked +locked_at: "2026-09-10" +engines: + b: "cladding@0.9.4 (registry) — prefix-B" + c: "cladding 0.10.0 (packed from this checkout) — prefix-C" + +rows: + - id: L0-1 + title: A warn-severity finding does not block a non-strict gate + fixture_family: done + mode: auto + mutations: [strip-module-header] + question: >- + With a completed feature whose module lost its header comment — a + warn-level convention finding — does the pre-push tier still exit 0 without + --strict, and does --strict still block? + steps: + - name: non-strict + run: cli + arms: [B, C] + family: done + args: ["check", "--tier=pre-push", "--json"] + - name: strict + run: cli + arms: [B, C] + family: done + args: ["check", "--tier=pre-push", "--strict", "--json"] + expect: + # Corrected after the first run. Two harness faults made this row vacuous: + # the mutation removed only a leading `//` line and left the module's JSDoc + # block as the first non-empty line — which CONVENTION_DRIFT accepts as a + # header just the same — and arm B's shard carried `modules: []`, so the + # detector had no module to walk. Both are fixed; the guess below is + # therefore about severity, which is what the row meant to ask. + b: {non_strict_exit: 0, strict_exit: 1, finding: CONVENTION_DRIFT} + c: {non_strict_exit: 1, strict_exit: 1, finding: CONVENTION_DRIFT} + # The discriminating finding is CONVENTION_DRIFT by name, not "a warn" as a + # class: the first run's C fixture carried a STALE_ATTESTATION warn on its + # own and still exited 0 without --strict. + expect_revised: "rewritten after the first run exposed a dead mutation, BEFORE the repaired run" + observed: "B non-strict 0 / strict 1; C non-strict 1 / strict 1. CONVENTION_DRIFT:warn present in both arms (with STALE_ATTESTATION:warn alongside, since the mutation changes module bytes); an unmutated control on the same C fixture is non-strict exit 0 with no warn at all" + classification: defect-fixed + lock: + non-strict-B: {exit: 0, contains: ["CONVENTION_DRIFT"]} + non-strict-C: {exit: 1, contains: ["CONVENTION_DRIFT"]} + strict-B: {exit: 1, contains: ["CONVENTION_DRIFT"]} + strict-C: {exit: 1, contains: ["CONVENTION_DRIFT"]} + + - id: L0-2 + title: Where a covers token may sit inside a test title + fixture_family: done + mode: auto + mutations: [covers-token-trailing] + question: >- + The completed C fixture binds its criteria with a token at the head of each + test title. With the same token moved to the END of the title, does the + binding still resolve? + steps: + - name: trailing-token + run: cli + arms: [C] + family: done + args: ["check", "--tier=pre-push", "--strict", "--json"] + expect: + b: {applicable: false, note: "0.1 binds through test_refs, not title tokens"} + c: {strict_exit_nonzero: true, note: "a trailing token is not a binding — the criteria go unclaimed"} + observed: "C strict exit 1: three MISSING_TESTS errors and three unbound criteria, each naming the leading-token form" + classification: match + lock: + trailing-token-C: {exit: 1, contains: ["MISSING_TESTS", "[covers:"]} + + - id: L0-3 + title: clad_create_feature — a criterion with no statement, and test_refs on each schema + fixture_family: per-version-init + mode: auto + question: >- + (a) Does each engine refuse a criterion carrying no statement text? + (b) What happens to a per-criterion `test_refs` argument on each schema — + 0.1 stores it, and 0.2 is expected to say so rather than drop it silently? + recipe: >- + Rewritten after the first run. The old row asked for a feature with no + `statement` argument at all: both engines accepted it, because a feature + with no criteria is legal, so the row tested nothing. It also sent + `statement` and `test_refs` at the TOP level, which 0.2 rejects at the + schema boundary before any wording is reached, and it ran both arms on the + shared 0.1 workspace, where the newer engine writes a 0.1 shard and cannot + show its own refusal. Each arm now runs on its own scaffold and sends the + arguments its schema actually defines. + steps: + - name: no-statement-b + run: mcp + arms: [B] + family: per-version-init + calls: + - {type: tool, name: clad_create_feature, args: {slug: "no-statement", title: "A feature whose criterion has no text", acceptance_criteria: [{ears: "ubiquitous"}]}} + - name: no-statement-c + run: mcp + arms: [C] + family: per-version-init + calls: + - {type: tool, name: clad_create_feature, args: {slug: "no-statement", title: "A feature whose criterion has no statement", purpose: "The row needs a criterion with nothing said in it.", capability_refs: [], acceptance_criteria: [{kind: "behavior"}]}} + - name: with-test-refs-b + run: mcp + arms: [B] + family: per-version-init + calls: + - {type: tool, name: clad_create_feature, args: {slug: "with-refs", title: "A feature carrying test refs", acceptance_criteria: [{ears: "ubiquitous", text: "The system shall record a test reference.", test_refs: ["tests/example.test.ts"]}]}} + - name: with-test-refs-c + run: mcp + arms: [C] + family: per-version-init + calls: + - {type: tool, name: clad_create_feature, args: {slug: "with-refs", title: "A feature carrying test refs", purpose: "The row needs a criterion that names its own test.", capability_refs: [], acceptance_criteria: [{kind: "behavior", statement: "The system shall record a test reference.", test_refs: ["tests/example.test.ts"]}]}} + - name: list-features + run: mcp + arms: [B, C] + family: per-version-init + calls: + - {type: tool, name: clad_list_features, args: {}} + expect: + b: {no_statement: "accepted — 0.1 has no required criterion text", test_refs: "stored on the criterion"} + c: {no_statement: "refused", test_refs: "refused with INVALID_OPERATION naming the [covers: token as the 0.2 binding"} + expect_revised: "rewritten after the first run exposed a call shape the schema never reached, BEFORE the repaired run" + observed: "B accepted the empty criterion and its own gate reported AC_DRIFT error; C refused with INVALID_OPERATION 'Criterion 1 needs kind and a strict statement.'. B stored test_refs on the criterion; C refused with INVALID_OPERATION naming the [covers:F-…/AC-…] binding" + classification: match + lock: + no-statement-b-B: {exit: 0, contains: ["AC_DRIFT"]} + no-statement-c-C: {exit: 0, contains: ["INVALID_OPERATION", "needs kind and a strict statement"]} + with-test-refs-b-B: {exit: 0, contains: ["AC_DRIFT"]} + with-test-refs-c-C: {exit: 0, contains: ["INVALID_OPERATION", "[covers:"]} + list-features-B: {exit: 0, contains: ["\\\"total\\\": 2"]} + list-features-C: {exit: 0, contains: ["\\\"total\\\": 0"]} + + - id: L0-4 + title: clad_get_graph honours max_depth + fixture_family: shared-0.1 + mode: auto + question: >- + Does a max_depth of 3 return a strict subset of the same query at 5 — and + what does the candidate, whose documented ceiling is 3, do with a 5? + recipe: >- + Corrected after the first run: the calls named no `query`, and with the + seed omitted both engines answer with corpus statistics, which no depth + argument touches. That is why depth-3 and depth-5 came back byte-identical + in both arms. The shared fixture now carries one feature, and the row seeds + the traversal with it. + steps: + - name: depth-5 + run: mcp + arms: [B, C] + family: shared-0.1 + calls: + - {type: tool, name: clad_get_graph, args: {query: "{shared_feature}", max_depth: 5}} + - name: depth-3 + run: mcp + arms: [B, C] + family: shared-0.1 + calls: + - {type: tool, name: clad_get_graph, args: {query: "{shared_feature}", max_depth: 3}} + expect: + b: {depth_3_subset_of_5: true, note: "0.9.4 advertises a ceiling of 6"} + c: {depth_5: "refused or clamped — the advertised ceiling is 3", depth_3: "answered within the byte ceiling"} + expect_revised: "rewritten after the first run exposed a missing seed argument, BEFORE the repaired run" + observed: "C max_depth 5 → isError with kind: rejected, reason 'max_depth must be an integer between 1 and 3'; C max_depth 3 → a projection (2403B). B accepted both and returned the same graph either way, its ceiling being 6 on a two-node graph" + classification: match + lock: + depth-5-B: {exit: 0} + depth-5-C: {exit: 0, contains: ["max_depth must be an integer between 1 and 3"]} + depth-3-B: {exit: 0} + depth-3-C: {exit: 0} + + - id: L0-5 + title: The wording a completed feature reports + fixture_family: done + mode: auto + question: >- + What does each engine print when a feature completes — and does the newer + wording still name the evidence rather than only the outcome? The text is + captured verbatim while the fixture is built, so this row reads a record + rather than re-running a completion. + steps: + - name: completion-output + run: file + arms: [B, C] + family: done + path: "{root}/sidetable/done/{arm}.done-output.txt" + expect: + b: {note: "records the released wording verbatim; no pass/fail"} + c: {note: "records the 0.10.0 wording verbatim; no pass/fail"} + # Confirmed as a record row after the first run: both files were captured, and + # a record row has nothing to be right or wrong about. + observed: "both arms captured their completion text (B 361B, C 431B)" + classification: record + lock: + completion-output-B: {exit: 0, bytes: 361, contains: ["independence: self-certified"]} + completion-output-C: {exit: 0, bytes: 431, contains: ["independence: not applicable"]} + + - id: L0-6 + title: independence_policy require — what the gate says about a self-signed cycle + fixture_family: done + mode: auto + mutations: [require-independence] + question: >- + With the policy turned up to `require` on a completed L2 feature whose only + author is also its only signer, what does the gate report about + independence — and is that a pass? + recipe: >- + Redefined after the first run. The old row expected `require` to block a + completed L2 cycle, and the candidate let it through. That is the designed + relaxation, not a defect: at L2 the kernel labels independence + `not-applicable`, because the profile asks for no human review at all, and + 0.2's `require` refuses only what is `self-certified` or unobserved (see + the CHANGELOG's Changed entry). The refusal case therefore belongs to the + L4 row, where a human receipt exists to be judged, and this row records + what `require` means at L2. + steps: + - name: policy-require + run: cli + arms: [C] + family: done + args: ["check", "--tier=pre-push", "--strict", "--json"] + expect: + b: {applicable: false, note: "0.9.4 has no trust registry; `require` there refuses a legacy self-certified completion"} + c: {independence: "not-applicable", strict_exit: 0, note: "designed relaxation — at L2 the profile asks for no human review"} + companion: >- + The refusal case is L0-6b, added before the table was locked: the same + policy at L4, where a self-signed receipt is the thing `require` refuses. + Read the two rows together — one says what the policy passes and why, the + other says what it stops. + expect_revised: "rewritten AFTER seeing the first run — the guess was wrong about a designed relaxation, not about an engine fault" + observed: "C worst 0, independence not-applicable, achieved L2 — the completed cycle passes under require" + classification: designed + lock: + policy-require-C: {exit: 0, contains: ["\"independence\": \"not-applicable\""]} + + - id: L0-6b + title: independence_policy require — a self-signed L4 cycle is refused + fixture_family: inprogress + mode: auto + mutations: [require-independence] + question: >- + At L4, where human receipts exist and the only issuer is also the only + author, does `require` refuse the completion — and does the refusal say who + to ask instead of only saying no? + recipe: >- + Added 2026-09-08, before any comparison cell ran — the only live session + by then was the single-arm instrumentation check, which no row reads — to + close the gap L0-6 recorded: `require` at L2 has nothing to refuse, so the L2 pass on its own + could not tell a designed relaxation apart from a policy that never ran. + This row replays L0-10's recipe on the same in-progress fixture with the + policy turned up: every criterion audited and the feature UAT-signed by the + committing author, then `clad done`. The script refuses to measure anything + unless the mutation is visible in the workspace's own spec.yaml first. + steps: + - name: l4-require + run: script + script: row-l4-require.sh + arms: [C] + family: inprogress + expect: + b: {applicable: false, note: "assurance levels and the trust registry are a 0.2 surface — not run"} + c: + done_exit: 1 + remedy_named: "Ask a registered issuer other than the implementation authors for a verified review" + note: "the receipts are self-certified, which is what `require` refuses" + expect_revised: "written before the row first ran" + observed: null + classification: match + lock: + l4-require-C: {exit: 0, contains: ["Ask a registered issuer other than the implementation authors for a verified review", "refused as required: completion exit 1"]} + + - id: L0-7 + title: The retired standalone-runner verb + fixture_family: shared-0.1 + mode: auto + question: >- + 0.10.0 retired a verb 0.9.4 still carried. Does the newer engine fail + cleanly on it rather than half-executing? + steps: + - name: retired-verb + run: cli + arms: [B, C] + family: shared-0.1 + args: ["run", "--help"] + expect: + b: {exit: 0, note: "the verb still exists on the released engine"} + c: {exit_nonzero: true, note: "unknown command, no partial execution"} + # The first run recorded exit 0 in BOTH arms: 0.10.0 answers `run --help` + # with its own help text rather than an unknown-command error. Kept as a + # record row — what matters is that nothing half-executed, and the retirement + # of the verb is visible in the help text itself. + observed: "B exit 0 (831B); C exit 0 (6956B) — the candidate prints top-level help, not a partial run" + classification: record + lock: + retired-verb-B: {exit: 0} + retired-verb-C: {exit: 0} + + - id: L0-8 + title: A typed spec edit refuses stale input + fixture_family: per-version-init + mode: auto + question: >- + Does a typed edit whose declared input digest no longer matches the file + get refused, rather than applied over someone else's change? + steps: + - name: stale-edit + run: script + script: row-stale-edit.sh + arms: [C] + family: per-version-init + recipe: >- + The first run never reached a tool: the row scanned `spec/features` in a + freshly scaffolded workspace that holds no feature, and threw ENOENT. The + script now creates the feature it edits, and sends the apply call in the + shape the surface defines — `operations` plus the prepare's own + `input_revisions` map — instead of a guessed `input_sha256` field. + expect: + b: {applicable: false, note: "typed edits are a 0.2 surface"} + c: {refused_with: "STALE_INPUT"} + observed: "C refused with STALE_INPUT: The feature:F-… input changed since it was read." + classification: match + lock: + stale-edit-C: {exit: 0, contains: ["STALE_INPUT"]} + + - id: L0-9 + title: Vacuous green — a feature whose own tests are all skipped + fixture_family: done + mode: auto + mutations: [vacuous-green] + question: >- + The module stays covered by a neighbouring test file while the feature's + own tests are every one skipped. Does either engine still call that green? + steps: + - name: strict + run: cli + arms: [B, C] + family: done + args: ["check", "--tier=pre-push", "--strict", "--json"] + expect: + b: {strict_exit_nonzero: true} + c: {strict_exit_nonzero: true} + observed: "both arms strict exit 1, failing stage_1.3 and stage_2.1" + classification: match + lock: + strict-B: {exit: 1} + strict-C: {exit: 1} + + - id: L0-10 + title: An L4 cycle replays end to end + fixture_family: inprogress + mode: auto + question: >- + At L4, is a strict pre-push honestly unresolved before any human receipt + exists — and green once every criterion is audited, the feature is + UAT-signed, and the cycle completes? + recipe: >- + Rebuilt to follow the documented recipe after the first run stayed at exit + 1. Three faults, all in the harness: the row ran on a project already + completed at L2 and raised the level afterwards, so completion never + published an L4 row; it signed one criterion out of three; and it passed + `--criterion` to the feature-scoped UAT claim, which refuses it. The + fixture is now an in-progress project raised to L4 inside its cycle, and + the row signs every criterion, signs UAT feature-wide, then completes. + The fixture also carries the project-owned smoke, performance and visual + runners an L4 profile calls: without them those three stages skip, and a + skipped stage is an unobserved obligation the gate must refuse. + steps: + - name: l4-replay + run: script + script: row-l4.sh + arms: [C] + family: inprogress + expect: + b: {applicable: false} + c: {unresolved_before_signing: true, done_exit: 0, green_after_completion: true, independence: "self-certified"} + note: "needs `expect`; without it the row records not-run rather than guessing" + expect_revised: "rewritten after the first run exposed three harness faults, BEFORE the repaired run" + observed: "before signing exit 1; audit signed for all three criteria and UAT feature-wide; clad done exit 0 with Smoke/Performance/Visual and Audit/UAT all ✓, independence self-certified; strict pre-push after completion exit 0, achieved L4 of configured L4" + classification: match + lock: + l4-replay-C: {exit: 0, contains: ["completion exit: 0", "strict pre-push AFTER completion: exit 0", "achieved L4 of configured L4"]} + + - id: L0-11 + title: Migrating a 0.1 project to 0.2, accepted and rejected + fixture_family: done + mode: auto + question: >- + Does the preview describe the same change the apply makes, does a rejected + decision leave the workspace untouched, and is the accepted result + strict-pre-push green? The input is the completed 0.1 project arm B built, + so the migration has real content to migrate. + steps: + - name: migrate-both-ways + run: script + script: row-migrate.sh + arms: [C] + family: done + recipe: >- + Rebuilt after the first run measured nothing: it called `--preview` and + `--decisions reject|accept`, none of which the verb defines, so every + migrate call exited 1 with "unknown option" and the strict pre-push that + followed ran on an unmigrated 0.1 tree — its exit 0 was about the old + workspace, not about a migration. The real surface is a read-only + `migrate --to 0.2 --json` preview, then `--apply --resolutions ` + carrying the reviewed digest and one confirmation per required decision. + Accept and reject are not whole-migration modes; the only two-valued + decision is the legacy L2 baseline, which is what the two passes now vary. + The "1 changed path" the first run reported was the fixture's own + `node_modules` symlink, which the porcelain check now excludes. + expect: + b: {applicable: false, note: "the migration verb is a 0.2 surface"} + c: + preview_writes_nothing: true + reject_applies: true + reject_strict_exit: 1 + reject_reason: "the criteria migrate as unobserved/stale — rejecting the baseline is refusing to carry the historic completion evidence forward" + accept_strict_exit: 0 + accept_reason: "the same criteria are satisfied through migration_baseline observations" + designed_paths: + reject: >- + Red on C by design, and recorded as such in the case document rather than + in G1's relaxation list: rejecting the legacy baseline writes no + completion evidence (D14, "reject writes none"), so the migrated criteria + arrive unobserved and the gate refuses them. It is not a reversal — B has + nothing to say here — and not an R4 trigger, which is about the accept + path. + expect_revised: "rewritten twice: the shape BEFORE the repaired run, then the reject/accept split AFTER seeing what each decision does" + observed: "the six paths each apply touches are all spec writes — spec.yaml, spec/architecture.yaml, spec/capabilities.yaml, the feature shard, a deleted spec/attestation.yaml, a new spec/generated/; preview exit 0 leaving 0 changed paths; reject applied (6 paths) and its strict pre-push exits 1 with every criterion unobserved/stale; accept applied (6 paths), spec.yaml declares schema 0.2, and its strict pre-push exits 0 with the criteria satisfied through migration_baseline" + classification: match + lock: + migrate-both-ways-C: {exit: 0, contains: ["preview left 0 changed paths", "reject strict pre-push exit: 1", "accept strict pre-push exit: 0", "spec.yaml now declares schema 0.2"]} + + - id: L3-1 + title: A clean seed passes its own gate + fixture_family: per-version-init + mode: auto + question: >- + Does a freshly scaffolded workspace, synced, behave the same under both + engines when nothing else has been done to it? + recipe: >- + The guess `check_exit: 0` was wrong for a reason that is not about + cladding: an empty scaffold has no `src` or `tests` file, so `tsc --noEmit` + fails with TS18003 ("no inputs were found") and the Type stage reports it. + Both engines exit 1, identically, so the row is now a parity row — the + answer that is actually available from a bare seed — rather than a + green-seed claim neither engine can make. + steps: + - name: sync + run: cli + arms: [B, C] + family: per-version-init + args: ["sync"] + - name: check + run: cli + arms: [B, C] + family: per-version-init + args: ["check", "--json"] + expect: + b: {sync_exit: 0, check_exit: 1, note: "TS18003 — an empty scaffold has no TypeScript inputs"} + c: {sync_exit: 0, check_exit: "same as B", failed_stages: "same set as B"} + expect_revised: "rewritten AFTER seeing the first run — both engines fail identically on an empty scaffold" + observed: "first run: sync 0/0, check 1/1 in both arms" + classification: expectation-wrong + lock: + sync-B: {exit: 0} + sync-C: {exit: 0} + check-B: {exit: 1, contains: ["TS18003"]} + check-C: {exit: 1, contains: ["TS18003"]} + + - id: L3-2 + title: The context payload is unchanged, and the working set agrees with it + fixture_family: shared-0.1 + mode: auto + question: >- + On one shared 0.1 project, do both engines return a byte-identical + `clad_get_context` payload? And does the candidate's `clad_get_working_set` + name the schema version while staying a subset of the same context? + steps: + - name: context + run: mcp + arms: [B, C] + family: shared-0.1 + calls: + - {type: tool, name: clad_get_context, args: {query: "{shared_feature}"}} + - name: working-set + run: mcp + arms: [B, C] + family: shared-0.1 + calls: + - {type: tool, name: clad_get_working_set, args: {query: "{shared_feature}"}} + recipe: >- + Corrected after the first run: both tools require a `query`, both calls + omitted it, and both engines answered with the same validation error — so + the "byte-identical" reading was an identical refusal, not an identical + payload. The shared fixture now carries one feature created once by the + released engine, and both arms ask about that id. + expect: + b: {context_bytes: "baseline"} + c: {context_bytes: "byte-identical to B apart from any version field, which is compared separately", working_set_names_schema_version: true, working_set_subset_of_context: true} + expect_revised: "rewritten after the first run exposed a missing required argument, BEFORE the repaired run" + observed: "context payloads byte-identical (488B each); working set: schema_version 1 in both, C adds one key — authority: graph-ir — 1483B on B against 1510B on C" + classification: match + lock: + context-B: {exit: 0, bytes: 871} + context-C: {exit: 0, bytes: 872} + working-set-B: {exit: 0, bytes: 1964, contains: ["schema_version\\\": 1"]} + working-set-C: {exit: 0, bytes: 1997, contains: ["schema_version\\\": 1", "authority\\\": \\\"graph-ir"]} + + - id: L3-3 + title: The tool catalogue each engine advertises + fixture_family: shared-0.1 + mode: auto + question: How many tools does each engine expose, and how large is the catalogue a host must read? + steps: + - name: catalogue + run: mcp + arms: [B, C] + family: shared-0.1 + calls: + - {type: tools/list} + - {type: resources/list} + - {type: prompts/list} + expect: + b: {tools: 22} + c: {tools: 27} + observed: "B 22 tools / 60526B catalogue; C 27 tools / 158700B" + classification: match + lock: + catalogue-B: {exit: 0, bytes: 60526} + catalogue-C: {exit: 0, bytes: 158700} + + - id: L3-4 + title: What the everyday gate costs in wall time + fixture_family: shared-0.1 + mode: auto + question: How long does the pre-commit tier take on the same project under each engine? + steps: + - name: hyperfine + run: hyperfine + arms: [B, C] + family: shared-0.1 + args: ["check", "--tier=pre-commit"] + runs: 5 + expect: + b: {note: "baseline median; no pass/fail"} + c: {note: "recorded against B's median; a regression over ~1.5x is a finding"} + observed: "pre-commit median 1.299s on B against 1.352s on C — 1.04×" + classification: match + lock: + hyperfine-B: {exit: 0} + hyperfine-C: {exit: 0} + +# ── Live-cell measures (L1/L2) ─────────────────────────────────────────────── +# Not rows: the live cells have no per-row expectation to pre-register, because +# nobody knows in advance what three agents will build. What IS pre-registered +# is the list of measures and which of them may move a release decision. Every +# one is deterministic, computed by scripts/ab-abc/score.ts from artifacts after +# the session ends. The transcript's prose is never scored. + # --------------------------------------------------------------------------- + # 0.10.0 feature-scenario battery (added 2026-09-09). Every row below carries + # `status: unlocked`: the sixteen rows above are pinned and enforced, these are + # still being read. The runner records them and prints how many remain. + # --------------------------------------------------------------------------- + + - id: S-A1 + title: What each engine's own scaffold tells the project + fixture_family: template + mode: auto + question: >- + Onboarding is the first and often only place an adopter reads how this + works. Run each engine's default over the identical untouched template: + what does the project declare, and do the instructions left behind name the + binding that engine's gate actually reads? + steps: + - name: scaffold + run: script + script: row-init.sh + arms: [B, C] + family: template + expect: + b: {schema: "0.1 (no schema key)", agents_md_covers_token: absent, claude_md_section: "0.1 wording"} + c: + schema: "0.2" + assurance_level: L2 + scenario_policy: advisory + project_purpose: present + agents_md_covers_token: present + agents_md_clad_begin: present + claude_md_token_sentence: present + expect_revised: + b: {schema: "0.1 (no schema key)", agents_md_covers_token: absent, claude_md_written_at_init: false} + c: + schema: "0.2" + assurance_level: L2 + scenario_policy: advisory + project_purpose: present + agents_md_covers_token: present + agents_md_clad_begin: present + claude_md_written_at_init: false + why: >- + rewritten AFTER seeing the first run. Everything the guess said about + spec.yaml and AGENTS.md held on both engines; the CLAUDE.md clause had no + surface to be asked on, because neither engine writes CLAUDE.md at init. + That file belongs to the adopter, and only `clad update` writes the + managed section into it — which is the question S-A3 asks. + observed: "B (0.9.4): init exit 0; spec.yaml declares schema \"0.1\" with no assurance_level, scenario_policy or project purpose; AGENTS.md carries the feature-cycle heading but no covers token and no clad_begin. C: schema \"0.2\", assurance_level L2, scenario_policy advisory, project purpose present; AGENTS.md carries both the covers token and clad_begin. Neither engine writes CLAUDE.md at init \u2014 the file belongs to the adopter and only `clad update` writes the managed section \u2014 so the guess's CLAUDE.md clause is answered by S-A3 instead." + classification: expectation-wrong + lock: + scaffold-B: {exit: 0, contains: ["spec.yaml schema: \"0.1\"", "spec.yaml assurance_level: (absent)", "spec.yaml scenario_policy: (absent)", "AGENTS.md covers token: absent", "AGENTS.md clad_begin: absent", "CLAUDE.md present after init: no"]} + scaffold-C: {exit: 0, contains: ["spec.yaml schema: \"0.2\"", "spec.yaml assurance_level: L2", "spec.yaml scenario_policy: advisory", "AGENTS.md covers token: present", "AGENTS.md clad_begin: present", "CLAUDE.md present after init: no"]} + + - id: S-A2 + title: Asking for the old format gives the old scaffold + fixture_family: template + mode: auto + question: >- + The old spec format stays a first-class choice. Does asking the candidate + for it produce what the released engine produces — same managed + instructions, same project declaration bar the engine's own version line — + or a new-format scaffold wearing an old label? + steps: + - name: back-compat-scaffold + run: script + script: row-init-compat.sh + arms: [B, C] + family: template + expect: + b: {applicable: false, note: "the comparison runs both engines from the C pass"} + c: {agents_md_diff_lines: 0, claude_md_diff_lines: 0, spec_yaml_diff_lines_excluding_version: 0} + expect_revised: + b: {applicable: false, note: "the comparison runs both engines from the C pass"} + c: + agents_md_diff_lines: 2 + agents_md_diff_bytes: 1 + claude_md_diff_lines: 0 + spec_yaml_diff_lines_excluding_version: 2 + spec_yaml_diff_bytes: 1 + difference: "the same documentation wording change in both files, `` to `` in the shard-filename example" + why: >- + rewritten AFTER seeing the first run. The guess asked for a zero-line + diff and got a one-byte one, in the example sentence that tells an author + how to name a spec entry file — a documentation correction carried into + the old-format scaffold, not a scaffold that changed shape. Zero was the + wrong bar: the honest expectation is that the only difference is + documentation wording. + observed: "Both scaffolds declare schema \"0.1\". AGENTS.md differs by 2 lines and 1 byte (5395 vs 5396) and spec.yaml by 2 lines and 1 byte (626 vs 627); in both files the difference is the same wording change, `` to `` in the shard-filename example. The managed CLAUDE.md section each engine's `update` writes is byte-identical (1221 B, 0 diff lines). Harness fault repaired first: the scaffolds were built in directories named after the arms, and the engine names a project after its directory, so every comparison carried the harness's own folder names as a difference." + classification: expectation-wrong + lock: + back-compat-scaffold-B: {exit: 0, contains: ["not applicable: the comparison runs both engines from one script, on the C pass"]} + back-compat-scaffold-C: {exit: 0, contains: ["released scaffold spec.yaml schema: schema: \"0.1\"", "candidate scaffold spec.yaml schema: schema: \"0.1\"", "AGENTS.md diff lines: 2", "AGENTS.md bytes: released 5395, candidate 5396", "CLAUDE.md diff lines: 0", "CLAUDE.md bytes: released 1221, candidate 1221", "spec.yaml diff lines: 2", "spec.yaml bytes: released 626, candidate 627", "spec/features/-.yaml"]} + + - id: S-A3 + title: Refreshing instructions that predate the new binding + fixture_family: done + mode: auto + mutations: [stale-host-section] + question: >- + A project set up before this release carries instructions that describe the + previous way of binding a test to a criterion. After the refresh verb runs, + does the candidate's project get told the rule its gate reads — and does the + released engine leave an old-format project's wording alone? + steps: + - name: update + run: cli + arms: [B, C] + family: done + args: ["update"] + - name: claude-md + run: file + arms: [B, C] + family: done + path: "{root}/sidetable-runs/S-A3-{arm}/CLAUDE.md" + expect: + b: {section_after_update: "0.1 wording, unchanged", covers_sentence: absent} + c: {section_after_update: "refreshed", covers_sentence: present} + observed: "B: `update` reports CLAUDE.md unchanged; the section keeps the 0.1 wording (1221 B, no covers token). C: `update` reports 'CLAUDE.md refreshed-stale' and the section comes back carrying the covers sentence (1343 B, one covers token). As guessed." + classification: match + lock: + update-B: {exit: 0, contains: ["✓ CLAUDE.md unchanged", "✓ spec inventory synced · 1 features"]} + update-C: {exit: 0, contains: ["ℹ CLAUDE.md refreshed-stale", "✓ spec inventory synced · 1 features"]} + claude-md-B: {exit: 0, bytes: 1221} + claude-md-C: {exit: 0, bytes: 1343, contains: ["[covers:F-…/AC-…]"]} + + - id: S-A4 + title: A workspace that explains its own generated files + fixture_family: done + mode: auto + question: >- + Does the candidate's workspace carry a projected note saying which files it + generates and where relocation would put them, is that note stable when the + projection runs twice, and does the released engine produce nothing of the + kind? + steps: + - name: generated-readme-before + run: file + arms: [B, C] + family: done + path: "{root}/sidetable-runs/S-A4-{arm}/spec/generated/README.md" + - name: sync-1 + run: cli + arms: [B, C] + family: done + args: ["sync"] + - name: sync-2 + run: cli + arms: [B, C] + family: done + args: ["sync"] + - name: generated-readme-after + run: file + arms: [B, C] + family: done + path: "{root}/sidetable-runs/S-A4-{arm}/spec/generated/README.md" + expect: + b: {file_present: false} + c: + file_present: true + contains: ["projected from the executable artifact registry", "relocation target"] + bytes_unchanged_after_two_syncs: true + observed: "C: spec/generated/README.md is present before either sync (704 B), contains 'projected from the executable artifact registry' and 'relocation target', and is byte-identical after two syncs. B: the file does not exist at either point. As guessed." + classification: match + lock: + generated-readme-before-B: {exit: null, bytes: 0} + generated-readme-before-C: {exit: 0, bytes: 704, contains: ["projected from the executable artifact registry", "relocation target"]} + sync-1-B: {exit: 0, contains: ["sync 1 features valid"]} + sync-1-C: {exit: 0, contains: ["sync 1 features valid"]} + sync-2-B: {exit: 0, contains: ["sync 1 features valid"]} + sync-2-C: {exit: 0, contains: ["sync 1 features valid"]} + generated-readme-after-B: {exit: null, bytes: 0} + generated-readme-after-C: {exit: 0, bytes: 704, contains: ["projected from the executable artifact registry", "relocation target"]} + + - id: S-A5 + title: The onboarding question-and-answer round trip on the new format + fixture_family: per-version-init + mode: auto + question: >- + Does the clarify round trip hand back the new format's outcome shape rather + than the previous summary-and-surface one? + recipe: >- + The round trip itself is MANUAL, and confirmed so by probe rather than by + reading the help text: a session only starts from `clad init` with a + free-text intent, which calls the host's model, so driving the round trip + inside the agent-free table would mean faking the session state rather than + exercising the surface. It belongs with the live host probes, where a model + is present anyway. What CAN be driven without a model — and what the step + below now pins on both engines — is the refusal that makes the row manual: + `clad_prepare_clarify` with a canned answer against a scaffolded workspace + with no session open. With no answer at all it fails argument validation + before it reaches the workspace. + steps: + - name: clarify-refusal + run: mcp + arms: [B, C] + family: per-version-init + calls: + - type: tools/list + - type: tool + name: clad_prepare_clarify + args: + answer: A side-table probe answer, supplied with no onboarding session open. + expect: + b: {catalog_shape: "summary/surface"} + c: {catalog_shape: "outcome"} + observed: >- + The round trip is not run as a table row — it needs a host model. The + refusal that makes it manual is, on both engines: `clad_prepare_clarify` + with a canned answer and no session open answers status `invalid_state`, + `changed: false`, error `no onboarding session`, isError true. Both + engines advertise the tool (B 22 tools, C 27), so the row's difference is + not the tool's presence but the shape of the answer a real session hands + back, which the host probes read. + classification: manual + note: >- + Locked on the refusal only. The outcome-shape question this row was written + to ask needs an onboarding session, and a session needs a model; the answer + to it lives with the live host probes, not here. What the pin protects is + that the surface still refuses an answer nobody asked for, and refuses it + the same way on both engines. + lock: + clarify-refusal-B: {exit: 0, contains: ["\"status\": \"invalid_state\"", "\"error\": \"no onboarding session\"", "\"isError\": true"]} + clarify-refusal-C: {exit: 0, contains: ["\"status\": \"invalid_state\"", "\"error\": \"no onboarding session\"", "\"isError\": true"]} + + - id: S-B1 + title: The statement grammar, four ways to get it wrong + fixture_family: per-version-init + mode: auto + question: >- + The new format accepts one sentence shape for an acceptance criterion, so + that a criterion always says one testable thing. Are the four ways of + breaking that shape each refused with a reason, is a correct one accepted, + and does the released engine take the same four texts without comment? + steps: + - name: strict-grammar + run: mcp + arms: [C] + family: per-version-init + calls: + - type: tool + name: clad_create_feature + args: + slug: grammar-two-shalls + title: A criterion carrying two obligations + purpose: The row needs one criterion that states more than one obligation. + modules: [src/grammar-two-shalls.ts] + capability_refs: [] + acceptance_criteria: + - kind: behavior + statement: The system shall reject an empty title and shall accept a full one. + - type: tool + name: clad_create_feature + args: + slug: grammar-no-period + title: A criterion that does not end + purpose: The row needs one criterion with no terminal period. + modules: [src/grammar-no-period.ts] + capability_refs: [] + acceptance_criteria: + - kind: behavior + statement: The system shall accept a title that carries slug-able characters + - type: tool + name: clad_create_feature + args: + slug: grammar-comma-clause + title: A criterion whose condition runs on + purpose: The row needs one criterion with a comma inside its condition. + modules: [src/grammar-comma-clause.ts] + capability_refs: [] + acceptance_criteria: + - kind: behavior + statement: When a title arrives, and it is empty, the system shall reject it. + - type: tool + name: clad_create_feature + args: + slug: grammar-bare-subject + title: A criterion whose subject is not the system + purpose: The row needs one criterion whose subject phrase does not open with "the". + modules: [src/grammar-bare-subject.ts] + capability_refs: [] + acceptance_criteria: + - kind: behavior + statement: Slug builder shall reject a title that carries no slug-able characters. + - type: tool + name: clad_create_feature + args: + slug: grammar-correct + title: A criterion in the shape the format accepts + purpose: The row needs one criterion the grammar accepts, so refusal is not the only outcome available. + modules: [src/grammar-correct.ts] + capability_refs: [] + acceptance_criteria: + - kind: behavior + statement: The system shall accept a title that carries slug-able characters. + - name: legacy-grammar + run: mcp + arms: [B] + family: per-version-init + calls: + - type: tool + name: clad_create_feature + args: + slug: grammar-two-shalls + title: A criterion carrying two obligations + modules: [src/grammar-two-shalls.ts] + acceptance_criteria: + - ears: ubiquitous + text: The system shall reject an empty title and shall accept a full one. + - type: tool + name: clad_create_feature + args: + slug: grammar-no-period + title: A criterion that does not end + modules: [src/grammar-no-period.ts] + acceptance_criteria: + - ears: ubiquitous + text: The system shall accept a title that carries slug-able characters + - type: tool + name: clad_create_feature + args: + slug: grammar-comma-clause + title: A criterion whose condition runs on + modules: [src/grammar-comma-clause.ts] + acceptance_criteria: + - ears: event + text: When a title arrives, and it is empty, the system shall reject it. + - type: tool + name: clad_create_feature + args: + slug: grammar-bare-subject + title: A criterion whose subject is not the system + modules: [src/grammar-bare-subject.ts] + acceptance_criteria: + - ears: ubiquitous + text: Slug builder shall reject a title that carries no slug-able characters. + - type: tool + name: clad_create_feature + args: + slug: grammar-correct + title: A criterion in the shape the format accepts + modules: [src/grammar-correct.ts] + acceptance_criteria: + - ears: ubiquitous + text: The system shall accept a title that carries slug-able characters. + expect: + b: {refused: 0, accepted: 5} + c: {refused: 4, accepted: 1, each_refusal_names_a_reason: true} + expect_revised: + b: {refused: 1, accepted: 4, refusal_follows_from: "the row's own EARS label, not the sentence"} + c: {refused: 4, accepted: 1, each_refusal_names_a_reason: false, refusal_text: "one generic sentence for all four"} + why: >- + rewritten AFTER seeing the first run, on both arms. The candidate refuses + all four malformed statements, which is the substance of the guess; but + every refusal reads only "has an invalid strict statement", naming + neither the rule broken nor the offending words, so "each refusal names a + reason" was too generous. On the released engine the guess was too harsh: + it refuses one of the four, and a control create showed that refusal + comes from the row labelling that sentence as a condition-shaped one, not + from the sentence itself. + observed: "C refused all four malformed statements with INVALID_OPERATION and accepted the fifth. But every refusal reads only 'Criterion AC-\u2026 has an invalid strict statement' \u2014 it names neither the rule broken nor the offending text \u2014 so the 'each refusal names a reason' half of the guess is not met. B accepted three of the four (two obligations, missing terminal period, bare subject) and refused only the condition-shaped one, on EARS shape; a throwaway create of the same sentence under `ears: ubiquitous` was ACCEPTED, so B's refusal follows from the row's own `ears: event` label rather than from the sentence." + classification: expectation-wrong + note: >- + The refusals are correct — all four malformed statements are turned away + and the well-formed one is accepted — but every message reads only that the + statement is invalid, without naming the rule or quoting the offending + words. An author has to work out which of the four rules they broke. A 0.10.x + wording candidate, not a release blocker. + lock: + strict-grammar-C: {exit: 0, contains: ["INVALID_OPERATION", "has an invalid strict statement.", "The feature was created."]} + legacy-grammar-B: {exit: 0, contains: ["has EARS-shape issue(s)", "grammar-two-shalls", "grammar-correct"]} + + - id: S-B2 + title: Claiming completion for work that has not started + fixture_family: per-version-init + mode: auto + question: >- + A feature that was written down a minute ago has no code and no proof. + Does the refusal name the step that was skipped, or only the evidence that + is missing — and once the cycle is opened, does the refusal change to being + about proof? + steps: + - name: cycle-order + run: script + script: row-begin.sh + arms: [B, C] + family: per-version-init + expect: + b: {done_refused: true, refusal_names_opening_step: false} + c: + done_before_begin_refused: true + refusal_names_opening_step: true + status_after_begin: in_progress + done_after_begin_refused_for_unproven_criteria: true + expect_revised: + b: + first_done_refused: true + first_done_reverts: true + second_done_refused: true + second_done_leaves_status_done: true + note: "the released engine's second, identical refusal crashes its drift stage and does not revert" + c: + done_before_begin_refused: true + refusal_names_opening_step: false + refusal_is_about_state: true + status_after_begin: in_progress + done_after_begin_refused_for_unproven_criteria: true + why: >- + rewritten AFTER seeing the first run. The candidate does refuse, but the + refusal is about state ("only an in-progress feature can be completed") + and never names the opening step, so the guess's wording half is wrong — + a message worth improving, not a fault. The released-engine arm was + guessed as a plain refusal and turned out to carry the campaign's one + safety difference, so it is now expected explicitly. + observed: "C: `done` before `begin` is refused with 'Only an in-progress feature can be completed in schema 0.2' \u2014 a refusal about state that never names the opening step, so that half of the guess is wrong. `begin` then succeeds, the status becomes in_progress, and `done` after it is refused for the missing module and unproven criteria with the status left at in_progress. B: `begin` is not a command; the FIRST `done` on the planned feature exits 1 and reverts correctly (the status is still planned afterwards), and the SECOND, identical call exits 1 with the drift stage CRASHING inside the bundled engine, leaving the feature at status: done \u2014 the released engine's flip-then-revert did not revert that time. Byte-identical across two runs, so it reproduces. Both arms carry type-stage noise because the bare scaffold ships no source files." + classification: expectation-wrong + note: >- + The comparative finding of this campaign. On the released engine the second, + identical `done` on a feature that cannot be completed crashes its drift + stage after the status has been flipped, and the revert never runs — so a + feature that was refused is left reading `done`. The candidate refuses both + times and leaves the status alone. Byte-identical across two runs, so it + reproduces. + lock: + cycle-order-B: {exit: 0, contains: ["done before begin exit: 1", "done before begin names the opening step: no", "begin said: error: unknown command 'begin'", "final status: status: done"]} + cycle-order-C: {exit: 0, contains: ["done before begin exit: 1", "Only an in-progress feature can be completed in schema 0.2.", "done before begin names the opening step: no", "status after begin: status: in_progress", "done after begin names unproven criteria: yes", "final status: status: in_progress"]} + + - id: S-B3 + title: Two prepared edits from one snapshot + fixture_family: per-version-init + mode: auto + question: >- + Applying one prepared edit must not invalidate another that was prepared at + the same moment and touches different files, and replaying the first from + its spent snapshot must be refused. Which of the two does the rule do? + steps: + - name: two-edits + run: script + script: row-typed-edit-two.sh + arms: [C] + family: per-version-init + expect: + b: {applicable: false, note: "typed edits are a schema 0.2 surface"} + c: {first_apply: accepted, second_apply: accepted, replay_of_the_first: STALE_INPUT} + observed: "C: both prepares report the same context revision; applying X is accepted, applying Y afterwards is accepted on its own write-set, and replaying X from its spent snapshot is refused with STALE_INPUT ('The feature:F-\u2026 input changed since it was read'). Both titles are on disk. As guessed." + classification: match + lock: + two-edits-C: {exit: 0, contains: ["x-first: accepted", "y-after-x: accepted", "x-replayed: STALE_INPUT", "input changed since it was read.", "X title on disk: title: X, retitled from the shared snapshot", "Y title on disk: title: Y, retitled from the shared snapshot"]} + + - id: S-B4 + title: A described journey nobody has claimed + fixture_family: per-version-init + mode: auto + question: >- + Under the default setting an unbound scenario should be worth mentioning + and not worth stopping for; under the stricter setting it should stop the + gate. Does the setting decide, and where does the editing surface draw its + own line? + steps: + - name: scenario-policy + run: script + script: row-scenario-policy.sh + arms: [C] + family: per-version-init + expect: + b: {applicable: false, note: "the scenario policy is a schema 0.2 setting"} + c: {advisory_gate_exit: 0, advisory_reports_the_scenario: true, required_gate_exit: 1} + observed: "C under advisory: the unbound journey draws one info/SCENARIO_COVERAGE finding and the checkpoint gate exits 0. C under required: the same journey becomes error/SCENARIO_COVERAGE and the gate exits 1. Two boundaries recorded alongside \u2014 `clad_create_scenario` refuses an unbound journey outright, so the shard had to be written by hand from the tool's own output shape; and while that shard is on disk the typed editing surface refuses EVERY transaction ('Scenario S-\u2026 does not satisfy the schema 0.2 journey contract'), so the policy change itself was refused until the shard was moved aside. Under required the whole spec stops loading and twenty other detectors degrade to 'spec.yaml not loaded' info." + classification: designed + note: >- + Classified designed for the boundary the run recorded beside the policy + answer, not for the policy answer itself, which came out exactly as + guessed. While an unbound journey shard is on disk the typed editing + surface refuses every transaction, and under the stricter setting the + specification stops loading altogether, degrading some twenty unrelated + checks to "spec.yaml not loaded". Both are the deferred F4/D09 item — the + scenario contract being enforced at load time rather than as a finding — + and are named as such in the plan rather than discovered here. + lock: + scenario-policy-C: {exit: 0, contains: ["declared policy at start: scenario_policy: advisory", "advisory gate exit: 0", "info/SCENARIO_COVERAGE: scenario coverage contains a hollow journey", "does not satisfy the schema 0.2 journey contract.", "declared policy after the change: scenario_policy: required", "required gate exit: 1", "error/SCENARIO_COVERAGE", "error/ABSENCE_OF_GOVERNANCE"]} + + - id: S-B5 + title: A capability reference that has to resolve + fixture_family: per-version-init + mode: auto + question: >- + Naming a capability nobody declared should be refused or reported; naming a + declared one should pass. Is the reference checked at all? + steps: + - name: capability-contract + run: script + script: row-capability.sh + arms: [C] + family: per-version-init + expect: + b: {applicable: false, note: "the capability contract is a schema 0.2 surface"} + c: {undeclared_reference: "refused or reported", declared_reference: accepted} + observed: "C: `clad_create_feature` refuses an undeclared capability at creation with UNKNOWN_REFERENCE ('F-\u2026 links unknown capability ghost-capability'), so the reference never reaches disk and the gate has nothing to report (exit 0). After `clad_link_capability` creates the capability, a feature naming it is accepted and the gate stays at exit 0." + classification: match + lock: + capability-contract-C: {exit: 0, contains: ["UNKNOWN_REFERENCE", "links unknown capability ghost-capability.", "gate exit with the undeclared reference: 0", "undeclared reference reached the spec on disk: no", "capabilities on disk: 1 entries", "gate exit with the declared reference: 0"]} + + - id: S-B6 + title: An archived feature whose replacement is not built yet + fixture_family: shared-0.1 + mode: auto + mutations: [archive-with-successor] + question: >- + Code still standing behind an archived entry is either a problem or the + successor's job. With a successor named and not yet done, does the released + engine still call it drift, and does the candidate call it information? + steps: + - name: sync + run: cli + arms: [B, C] + family: shared-0.1 + args: ["sync"] + - name: gate + run: cli + arms: [B, C] + family: shared-0.1 + args: ["check", "--tier=pre-push", "--json"] + expect: + b: {stale_specification_severity: warn} + c: {stale_specification_severity: info} + observed: "B: warn \u2014 'feature F-614d1c73 is archived but 1 module(s) still exist: src/slugify.ts'. C: info \u2014 the same sentence plus 'retirement is owned by successor F-a11ce55a, which is not done yet'. As guessed. Both gates exit 1 in this fixture for reasons unrelated to the row." + classification: match + lock: + sync-B: {exit: 0, contains: ["sync 2 features valid"]} + sync-C: {exit: 0, contains: ["sync 2 features valid", "refreshed the AGENTS.md managed block from the current spec."]} + gate-B: {exit: 1, contains: ["\"detector\": \"STALE_SPECIFICATION\",\n \"severity\": \"warn\"", "is archived but 1 module(s) still exist: src/slugify.ts"]} + gate-C: {exit: 1, contains: ["\"detector\": \"STALE_SPECIFICATION\",\n \"severity\": \"info\"", "retirement is owned by successor F-a11ce55a, which is not done yet"]} + + - id: S-C1 + title: The named check profiles, and the one that refuses uncommitted work + fixture_family: done + mode: auto + question: >- + Do the profiles carry different obligations — in particular, does the + release profile refuse a tree with uncommitted work on it and pass once the + work is committed — and what happens when a name nobody defined is asked + for? + steps: + - name: profiles + run: script + script: row-profiles.sh + arms: [B, C] + family: done + expect: + b: {profile_option: "unknown option"} + c: + completion_exit: 0 + release_on_a_dirty_tree: "refused at the commit stage" + release_on_a_committed_tree: 0 + unknown_profile: refused + observed: "B: `--profile` is an unknown option (exit 1); the tier it does have exits 0. C: completion exits 0 and leaves spec/attestation.yaml modified; release against that dirty tree exits 1 naming the commit stage; after committing, release exits 0; `--profile bogus` exits 2 with 'Unknown assurance profile. Use feedback, checkpoint, completion, push, or release.' As guessed, in full." + classification: match + lock: + profiles-B: {exit: 0, contains: ["error: unknown option '--profile'", "released engine knows --profile: no", "tier pre-push exit: 0"]} + profiles-C: {exit: 0, contains: ["profile completion exit: 0", "porcelain: M spec/attestation.yaml", "profile release exit: 1", "first release attempt names the commit stage: yes", "release on a committed tree exit: 0", "profile bogus exit: 2", "Unknown assurance profile. Use feedback, checkpoint, completion, push, or release."]} + + - id: S-C2 + title: The shape of the sealed record, and whether a repeat pass rewrites it + fixture_family: done + mode: auto + question: >- + What does a passing gate write down, how much of it is a digest rather than + the observations themselves, does it name the engine that wrote it — and + does running the gate again on an unchanged tree change the file? + steps: + - name: attestation + run: script + script: row-attestation.sh + arms: [B, C] + family: done + expect: + b: {schema: 2, observation_digest: absent, tool_identity: absent} + c: + schema: 3 + observation_set_sha256: present + observation_count: present + tool_identity: "0.10.0" + inline_identity_entries: 0 + rewritten_by_a_repeat_pass: true + observed: "B: 1316 B, top-level policy / attested_modules / attested_features, one legacy constant marker, no per-feature row, and the digest unchanged by a second passing gate. C: 2622 B with an attested_v3 block whose single feature row is one JSON object carrying attestation_schema 3, tool_identity 0.10.0, observation_set_sha256, observation_count 13 and no inline observation array \u2014 and the digest DOES change on a second passing run, which is the heads-up sentence about committing the file. Harness fault repaired first: the row matched indented YAML keys against a row that is a single JSON line, and reported every key absent." + classification: match + note: >- + The repeat pass rewriting the record is designed, not drift: a passing + pre-push seals what it just observed, so running it again on an unchanged + tree writes a new observation digest. The release notes carry this as a + heads-up, because it means the sealed record shows up as a modified file + after a green check. + lock: + attestation-B: {exit: 0, contains: ["attestation bytes: 1316", "attestation feature rows: 0", "attestation legacy markers: 1", "attestation rewritten by a repeat pass: no"]} + attestation-C: {exit: 0, contains: ["attestation bytes: 2622", "attestation feature rows: 1", "schema: 3", "tool_identity: 0.10.0", "observation_set_sha256: present", "observation_count: 13", "inline observation entries: 0", "attestation rewritten by a repeat pass: yes"]} + + - id: S-C3 + title: Asking for a level the run cannot honestly reach, and for a lower one + fixture_family: done + mode: auto + question: >- + A one-run level above the project's own should leave obligations nobody + observed, and the gate should say so rather than pass. A level below the + project's own should be refused outright, because a project cannot quietly + lower the bar it committed to. + recipe: >- + A third step runs the same profile at the level the project already + declares. Without it, a degraded answer at L3 and at L1 could be read as + "the flag does nothing" rather than "the flag does something only when the + level differs", and the two are different findings. + steps: + - name: at-the-configured-level + run: cli + arms: [B, C] + family: done + args: ["check", "--profile", "push", "--assurance-level", "L2", "--json"] + - name: raise-to-l3 + run: cli + arms: [B, C] + family: done + args: ["check", "--profile", "push", "--assurance-level", "L3", "--json"] + - name: lower-to-l1 + run: cli + arms: [B, C] + family: done + args: ["check", "--profile", "push", "--assurance-level", "L1", "--json"] + expect: + b: {assurance_level_option: "unknown option"} + c: {raise_to_l3: "unresolved, exit 1", lower_to_l1: "refused — cannot lower the persisted project level"} + expect_revised: >- + rewritten AFTER the repaired run, and only on the raise half. The lower half + is met as written: L1 is refused because a project cannot quietly lower the + bar it committed to. The raise is refused too, rather than run and reported + as unresolved — the repair's answer is that a level the run cannot honour is + turned away with the reason, not attempted and then explained. Both refusals + carry `assurance_level_rejected`; neither leaves the user to infer why. + observed: >- + FIRST RUN (defective): at L3 and at L1 alike the run exited 1 with the + legacy four-key report — no requested-or-achieved level and no message + about the level at all — so the reason for the refusal never reached the + user. RE-RUN on the repacked build after F-18a5883a: at the project's own + level (L2) the push profile exits 0 and returns the full 17-key report, + with requested, configured and achieved level all L2. At L3 it exits 1 + with a five-key JSON carrying `assurance_level_rejected`: "A stronger + one-run assurance level requires a compiler-proven bounded scope. Only the + completion profile on a bounded feature scope can raise the level for one + run." At L1 it exits 1 with the same five-key shape and "Requested + assurance level cannot downgrade the persisted project level." B: + `--assurance-level` is an unknown option, empty stdout, exit 1. The L2 + control step was added after the first run so a degraded answer could not + be read as "the flag does nothing". + classification: defect-fixed + note: >- + The silent legacy fallback this row found was repaired by F-18a5883a: the + CLI adapter now relays the kernel's own refusal instead of dropping to the + pre-push tier, so a level the run cannot honour — higher or lower — says so + in words, and the level the project already declares still returns the full + report. The pins below are the repaired run. + lock: + at-the-configured-level-B: {exit: 1, bytes: 0} + at-the-configured-level-C: {exit: 0, contains: ["\"requested_assurance_level\": \"L2\"", "\"configured_assurance_level\": \"L2\"", "\"achieved_assurance_level\": \"L2\"", "\"profile_complete\": true"]} + raise-to-l3-B: {exit: 1, bytes: 0} + raise-to-l3-C: {exit: 1, contains: ["\"requested_assurance_level\": \"L3\"", "\"configured_assurance_level\": \"L2\"", "\"assurance_level_rejected\"", "A stronger one-run assurance level requires a compiler-proven bounded scope."]} + lower-to-l1-B: {exit: 1, bytes: 0} + lower-to-l1-C: {exit: 1, contains: ["\"requested_assurance_level\": \"L1\"", "\"configured_assurance_level\": \"L2\"", "\"assurance_level_rejected\"", "Requested assurance level cannot downgrade the persisted project level."]} + + - id: S-C4 + title: A feature that declares a module before the module exists + fixture_family: inprogress + mode: auto + mutations: [missing-module] + question: >- + Writing the spec entry before the code is the documented order of work, so + a feature under way that declares a file nobody has written yet must not be + treated as drift. Does the mid-cycle profile let it through with only the + unproven-criterion note, and what does the released engine say about the + same shape? + steps: + - name: checkpoint + run: cli + arms: [C] + family: inprogress + args: ["check", "--profile", "checkpoint", "--json"] + - name: precommit + run: cli + arms: [B] + family: done + args: ["check", "--tier=pre-commit", "--json"] + expect: + b: {record: "what the released engine says about a declared path that is not on disk"} + c: {blocking_findings_for_the_missing_module: 0} + observed: "C, on a begun feature declaring src/not-yet.ts: the checkpoint profile exits 0 with one info finding \u2014 'not built yet \u2014 the normal state between authoring the spec entry and implementing it'. Zero blocking findings, as guessed. B is recorded on its completed 0.1 feature, because the released engine has no in-progress fixture here: two errors (MISSING_IMPLEMENTATION, STATUS_DRIFT) and a STALE_ATTESTATION warn, exit 1. The arms are therefore not in the same feature state, and the row compares what each engine does with a declared-but-absent module in the state it can be in." + classification: match + lock: + checkpoint-C: {exit: 0, contains: ["\"profile\": \"checkpoint\"", "\"profile_complete\": true", "is not built yet — the normal state between authoring the spec entry and implementing it"]} + precommit-B: {exit: 1, contains: ["\"MISSING_IMPLEMENTATION\"", "\"STATUS_DRIFT\"", "\"STALE_ATTESTATION\""]} + + - id: S-C5 + title: A record stamped on a machine that leaves stray files lying around + fixture_family: done + mode: auto + question: >- + A working copy holds files the repository does not: a metadata file a + desktop file browser wrote inside a source folder, and a fixture the + project ignores. Does the record a green check writes still describe the + commit — so a fresh clone of that commit accepts it — or does it describe + the machine that wrote it, and go red everywhere else? + steps: + - name: portable-seal + run: script + script: row-portable-seal.sh + arms: [C] + family: done + expect: + b: {applicable: false, note: "the released engine writes no third-generation record to compare"} + c: + clone_check_exit: 0 + attestation_identical_after_clone: true + stale_findings_in_clone: 0 + expect_revised: "written before the row first ran, and met as written" + observed: >- + C: with a desktop metadata file and an ignored fixture written inside a + sealed source folder, the pre-push tier exits 0 and stamps + spec/attestation.yaml (2622 bytes); the commit is cloned into a fresh + directory and the strict pre-commit check there exits 0 with no + STALE_ATTESTATION finding, and the record the clone holds afterwards is + byte-identical to the one the messy machine stamped. The same row on the + previous engine produced a clone exit of 1 with one stale finding, which is + the defect F-71da4292 repairs. The released engine writes no + third-generation record, so only the candidate arm runs. + classification: match + locked_at: "2026-09-10" + note: >- + The row is the standing guard for the repair: what it asks — does the + record describe the commit or the machine that wrote it — is exactly the + question a fresh clone in continuous integration asks, and the pins fail + the run the day the answer changes. + lock: + portable-seal-C: {exit: 0, contains: ["pre-push exit on the messy working copy: 0", "clone strict pre-commit exit: 0", "stale findings in the clone: 0", "record after the clone check: byte-identical to the stamped one"]} + + - id: S-E1 + title: The envelope a graph answer arrives in + fixture_family: shared-0.1 + mode: auto + question: >- + One compiled model now answers what four sources used to. Does a graph + answer arrive in the second-generation envelope — naming what kind of + answer it is, how complete it is, and how many bytes of payload it carries + — and does the released engine still answer in the first? + steps: + - name: graph-tool + run: mcp + arms: [B, C] + family: shared-0.1 + calls: + - type: tool + name: clad_get_graph + args: + query: "{shared_feature}" + max_depth: 1 + - name: graph-export + run: cli + arms: [B, C] + family: shared-0.1 + args: ["graph", "export", "--format", "json"] + - name: graph-stats + run: cli + arms: [B, C] + family: shared-0.1 + args: ["graph", "stats"] + expect: + b: {schema_version: 1, kind: absent, completeness: absent, by_state_none: absent} + c: + schema_version: 2 + kind: present + completeness: present + payload_utf8_bytes_within: 16384 + required_overflow: false + by_state_none: present + expect_revised: + b: {schema_version: 1, kind: absent, completeness: absent, export_schema_version: absent} + c: + schema_version: 2 + kind: present + completeness: present + payload_utf8_bytes_within: 16384 + required_overflow: false + export_flag: "--format json" + stats_json: "not offered by either engine" + why: >- + rewritten AFTER seeing the first run. The envelope half held in full. Two + clauses had no surface: the export is asked for with `--format json`, not + `--json`, and `graph stats` prints for a reader on both engines and takes + no machine-readable flag at all — so the guess's `by_state.none` clause + could not be asked, and its printed output is byte-identical across + arms. + observed: "C: the tool answer is schema_version 2 with kind 'projection', per-layer and overall completeness, meta.payload_utf8_bytes 1865 (well inside 16384) and required_overflow false; `graph export --format json` returns the same v2 envelope. B: schema_version 1 and a flat nodes/edges answer, and its export carries no schema_version at all. `graph stats` takes no --json on either engine and its printed output is byte-identical (156 B) across arms, so the guess's by_state.none clause has no surface to be asked on. The row was registered against `--json`, which the export subcommand spells `--format json`." + classification: expectation-wrong + lock: + graph-tool-B: {exit: 0, contains: ["\"version\": \"0.9.4\"", "\\\"schema_version\\\": 1"]} + graph-tool-C: {exit: 0, contains: ["\"version\": \"0.10.0\"", "\\\"schema_version\\\":2", "\\\"kind\\\":\\\"projection\\\"", "\\\"completeness\\\":\\\"complete\\\"", "payload_utf8_bytes"]} + graph-export-B: {exit: 0, contains: ["\"nodes\": [", "\"kind\": \"feature\""]} + graph-export-C: {exit: 0, contains: ["{\"schema_version\":2,\"kind\":\"export\""]} + graph-stats-B: {exit: 0, bytes: 156, contains: ["hubs (top by degree):"]} + graph-stats-C: {exit: 0, bytes: 156, contains: ["hubs (top by degree):"]} + + - id: S-E2 + title: The blast-radius answer keeps its shape + fixture_family: shared-0.1 + mode: auto + question: >- + The graph rewrite is meant to add to what the impact answer says without + changing the contract a reader already depends on. Same version, added keys + only, or something a caller would have to be rewritten for? + recipe: >- + The row was registered against `clad impact --json`, which neither engine + defines — the verb prints for a reader and takes only `--depth`. The + machine-readable answer a caller would actually depend on comes from the + tool surface, so the shape question is asked there and the printed form is + recorded beside it. + steps: + - name: impact-tool + run: mcp + arms: [B, C] + family: shared-0.1 + calls: + - type: tool + name: clad_get_impact + args: + query: src/slugify.ts + - name: impact-printed + run: cli + arms: [B, C] + family: shared-0.1 + args: ["impact", "src/slugify.ts"] + expect: + b: {schema_version: 1} + c: {schema_version: 1, added_keys_only: true} + observed: "Both engines answer schema_version 1 with focus / impacted / impacted_modules / scenarios / test_refs / ledger; C adds exactly one key, `authority`. Added keys only, contract unchanged \u2014 as guessed. `clad impact --json` exists on neither engine, so the shape question is asked through the tool surface and the printed form is recorded beside it." + classification: match + lock: + impact-tool-B: {exit: 0, contains: ["\"version\": \"0.9.4\"", "\\\"schema_version\\\": 1", "\\\"impacted_modules\\\""]} + impact-tool-C: {exit: 0, contains: ["\"version\": \"0.10.0\"", "\\\"schema_version\\\": 1", "\\\"authority\\\": \\\"graph-ir\\\""]} + impact-printed-B: {exit: 0, contains: ["\"fallback_hint\": \"dependency ledger is empty", "\"regression_hint\": \"no test_refs declared project-wide"]} + impact-printed-C: {exit: 0, contains: ["\"fallback_hint\": \"dependency ledger is empty", "\"regression_hint\": \"no test_refs declared project-wide", "\"authority\": \"graph-ir\""]} + + - id: S-G1 + title: The retired loop is gone from the installed package + fixture_family: per-version-init + mode: auto + question: >- + Removal is a claim about files. Does the candidate's installed package + still carry the retired loop's entry point, its skill folder or the modules + that served it, does its command list still offer it, and does its scaffold + still tell a project to run it? + steps: + - name: retired-surfaces + run: script + script: row-retired-surfaces.sh + arms: [B, C] + family: per-version-init + expect: + b: {run_skill_folders: 1, drive_modules: "one or more", run_in_help: 1} + c: {run_skill_folders: 0, drive_modules: 0, run_in_help: 0, scaffold_mentions_clad_run: false} + expect_revised: + b: {run_in_help: 1, retired_loop_in_bundle: true, run_skill_folders: "not shipped separately"} + c: + run_in_help: 0 + retired_loop_in_bundle: false + scaffold_mentions_clad_run: false + run_skill_folders: "not shipped separately" + why: >- + rewritten AFTER seeing the first run. Removal held on every surface a + user can reach, but the guess counted files the published package does + not have: neither engine ships a skills folder or separate modules for + the loop, because the tarball inlines everything into one bundle. The + file-count clauses are replaced by a search of the bundle's own bytes, + which is what "gone from the installed package" actually means here. + observed: "C: the `run` verb is gone from --help, `clad run` falls through to the root help, and the shipped bundle carries neither the loop's description nor its driver. B: `run` is listed in --help, `clad run --help` prints 'Headless autonomous loop', and its bundle carries both. Neither package ships a skills/ folder or separate drive modules \u2014 the published tarball inlines everything into dist/clad.js \u2014 so the file-name half of the guess has nothing to measure, and the bundle-content check replaces it. Neither scaffold mentions `clad run`." + classification: expectation-wrong + +# ── Groups D and F, added 2026-09-09 ──────────────────────────────────────── +# Evidence and independence (S-D1…S-D7), migration and relocation (S-F1, S-F2). +# These rows were added recorded-but-inert, classified by hand, and locked on +# 2026-09-09 with the rest of the S batch. Their `lock:` maps pin the labelled +# lines each script already prints. +# +# Two of these rows found the pre-registered guess wrong, and say so in +# `expect_revised` rather than correcting it quietly: S-D5 (the CLI ingest path +# verifies nothing — even the workspace's own valid receipt comes back +# `asserted / unknown_issuer_key` — so the refusal the plan expected does not +# exist to be measured) and S-F2 (the uncommitted-path refusal only fires when +# the dirt precedes the preview; dirt after it answers STALE_INPUT first). +# +# What a runner needs: `expect(1)` on PATH; the bootstrapped fixtures +# ~/abc-0100/sidetable/{inprogress/C, done/{B,C}, shared-0.1} with the +# `C.feature` and `C.criteria` records beside them; macOS (`stat -f`). Every row +# isolates CLADDING_KEYS_DIR under its own artifact directory and never reads +# ~/.cladding/keys. + lock: + retired-surfaces-B: {exit: 0, contains: ["run command in --help: 1", "run verb reachable: yes", "bundle carries the loop description: yes", "bundle carries the loop driver: yes", "scaffold AGENTS.md mentions clad run: no"]} + retired-surfaces-C: {exit: 0, contains: ["run command in --help: 0", "run verb reachable: no", "bundle carries the loop description: no", "bundle carries the loop driver: no", "scaffold AGENTS.md mentions clad run: no"]} + + - id: S-D1 + title: An issuer key's whole lifetime — created, held, registered once + fixture_family: inprogress + mode: auto + question: >- + Does creating an issuer key keep the private half outside the workspace and + readable only by its owner, put exactly one public entry in the committed + registry, and refuse a second registration of the same name? + steps: + - name: key + run: script + script: row-key.sh + arms: [C] + family: inprogress + - name: key-absent + run: script + script: row-key.sh + arms: [B] + family: shared-0.1 + expect: + b: {applicable: false, note: "0.9.4 has no `key` verb at all — the row records the unknown-command answer rather than skipping"} + c: + key_dir_mode: "700" + key_file_mode: "600" + private_key_files_inside_the_workspace: 0 + registered_issuers: 1 + second_registration_refused: true + expect_revised: "written before the row first ran" + observed: >- + C: key create exit 0, private key at $CLADDING_KEYS_DIR/.ed25519 with + the keys dir 700 and the key file 600; 0 private key files inside the + workspace; spec/trust/issuers.yaml carries 1 issuer (issuer/issuer_key_id/ + spki_der); `key list` prints "1 registered issuer … alice … signing key + present"; the second `key create --issuer alice` exits 1 with "Issuer alice + is already registered in spec/trust/issuers.yaml. Registering the same + issuer twice is refused; there is no rotation path yet." and the registry + still holds 1. B: `clad key list` exit 1, "error: unknown command 'key'". + classification: match + lock: + key-C: {exit: 0, contains: ["keys dir mode: 700", "private key material inside the workspace: 0 files", "registry issuers: 1", "second key create for the same issuer exit: 1", "registry issuers after the refusal: 1"]} + key-absent-B: {exit: 0, contains: ["unknown command 'key'"]} + + - id: S-D2 + title: The four ways a verified sign-off is refused + fixture_family: inprogress + mode: auto + question: >- + A verified receipt is the only evidence 0.10.0 calls human. Do all four + paths that must not produce one refuse it — no terminal, the wrong feature + id typed, an unregistered issuer, and the plain asserted path — and does + each leave the evidence directory empty? + steps: + - name: signoff-refusals + run: script + script: row-signoff-refusals.sh + arms: [C] + family: inprogress + expect: + b: {applicable: false, note: "verified receipts are a 0.2 surface"} + c: + headless_code: HUMAN_REQUIRED + wrong_id_refused: true + unregistered_issuer_refused: true + asserted_writes_no_receipt: true + receipts_after_all_four: 0 + expect_revised: "written before the row first ran" + observed: >- + C: headless `--verified` exits 1 with code HUMAN_REQUIRED — "A verified + signoff needs an interactive terminal so a human can re-enter the feature + id. Only asserted history was recorded."; typing F-00000000 at the prompt + exits 1 with "A verified signoff needs a human to re-enter the feature id in + a terminal prompt or a host elicitation form."; `--issuer mallory` exits 1 + with "Issuer mallory is not registered in spec/trust/issuers.yaml. Run `clad + key create --issuer mallory` first."; the asserted sign-off exits 1 with + HUMAN_REQUIRED and the note that asserted history was recorded. 0 receipt + files after every path; 4 signoff events in the audit log. + classification: match + lock: + signoff-refusals-C: {exit: 0, contains: ["HUMAN_REQUIRED", "wrong-id refusal: a human must re-enter the feature id", "unregistered-issuer refusal: mallory is not registered in spec/trust/issuers.yaml", "receipts after the asserted sign-off: 0"]} + + - id: S-D3 + title: A receipt goes stale when the code it reviewed changes, and heals when re-signed + fixture_family: inprogress + mode: auto + question: >- + After a full L4 cycle, does editing the module the completed feature + declares make the human obligations unobserved again — and does signing + again, and only signing again, restore the green push profile? + recipe: >- + Replays row-l4.sh into the same artifact directory, so the issuer key and + the signing script that row writes are the ones this row re-signs with. The + edit is committed before the gate runs, so nothing but the module's content + differs from the signed state. + steps: + - name: receipt-stale + run: script + script: row-receipt-stale.sh + arms: [C] + family: inprogress + expect: + b: {applicable: false, note: "signed receipts and their staleness are a 0.2 surface"} + c: + push_before_edit: 0 + push_after_edit: 1 + stale_state: "unobserved:stale" + push_after_resigning: 0 + expect_revised: >- + corrected once during the dry run, before the recorded run: the first + version re-signed only the per-criterion audit claims, and the row stayed + red because the feature-scoped UAT receipt goes stale with the same edit. + The remedy is both, which is what the row now does. + observed: >- + C: L4 replay exit 0 (completion exit 0, strict pre-push after completion + exit 0); push profile before the edit exit 0; after the committed one-line + edit to src/slugify.ts exit 1 with stage_4.1 unobserved(stale) ×3 and + stage_4.2 unobserved(stale) ×3; after re-signing all three audit criteria + and the feature-scoped UAT claim, exit 0 with nothing unobserved. ~30 s. + classification: designed + note: >- + Designed, and the reason the row's own recipe had to be corrected: editing + a module inside a completed feature's runtime closure stales the + feature-scoped acceptance receipt as well as the per-criterion audit + claims. Re-signing only the audit claims leaves the gate red. The healing + move is both — re-sign the audit criteria and the feature-scoped + acceptance claim — after which the push profile is green again. + lock: + receipt-stale-C: {exit: 0, contains: ["push profile BEFORE the edit: exit 0", "push profile AFTER the edit: exit 1", "unobserved(stale)", "push profile AFTER re-signing: exit 0", "every obligation passes again"]} + + - id: S-D4 + title: An independent signer passes the strictest independence policy + fixture_family: inprogress + mode: auto + mutations: [require-independence] + question: >- + L0-6b shows `require` refusing a self-signed cycle. Does the same cycle + complete when the registered issuer's name is not the committing author's — + and does the gate then label it `independent`? + recipe: >- + row-l4-independent.sh is row-l4.sh with ABC_L4_ISSUER=alice; the default + path, which L0-10 and L0-6b are locked against, is unchanged when the + variable is absent. The row also documents the limit it demonstrates: the + label compares the issuer name to `git user.name` as strings, so a second + name on one person's machine reads as independent. It records who signed + under which name, not that two humans exist. + steps: + - name: l4-independent + run: script + script: row-l4-independent.sh + arms: [C] + family: inprogress + expect: + b: {applicable: false, note: "assurance levels and the trust registry are a 0.2 surface"} + c: + done_exit: 0 + independence: independent + achieved: L4 + under_policy: require + expect_revised: "written before the row first ran" + observed: >- + C: issuer alice against committing author abc-harness under + independence_policy: require — completion exit 0, "independence: independent + — a registered issuer other than the implementation authors reviewed it", + strict pre-push after completion exit 0, achieved L4 of configured L4. ~29 s. + The default (unset) path was re-run and still prints L0-10's and L0-6b's + locked lines unchanged. + classification: match + note: >- + The known limit this row demonstrates: independence is decided by comparing + the issuer's name with the committing author's name as strings. A second + name configured on one person's machine therefore reads as independent. The + label records who signed under which name, not that two people exist. + lock: + l4-independent-C: {exit: 0, contains: ["independence: independent", "completion exit: 0", "strict pre-push AFTER completion: exit 0", "achieved L4 of configured L4"]} + + - id: S-D5 + title: Ingesting a receipt again, tampered, and from a stranger + fixture_family: inprogress + mode: auto + question: >- + Is ingesting the receipt a workspace already holds a no-op, and what verdict + does the verb record for a receipt whose signature has been altered or whose + issuer this workspace's registry does not carry? + recipe: >- + Four passes on three different criteria, so no receipt's answer can be + borrowed from another's evidence, and each ingest's own + `verification.assurance/reason` is printed. The control pass — the + workspace's OWN valid receipt, removed and put straight back through the + verb — is what makes the other three readable: without it, "refused because + tampered" and "verifies nothing at all" look the same. + steps: + - name: ingest + run: script + script: row-ingest.sh + arms: [C] + family: inprogress + expect: + b: {applicable: false, note: "portable receipts are a 0.2 surface"} + c: + re_ingest_changes_nothing: true + tampered_refused: true + unregistered_issuer_refused: true + expect_revised: >- + Revised in one clause, for the stranger sub-case, on 2026-09-10. The rest + stands: the first run contradicted two thirds of the guess — `clad + ingest-receipt` refused nothing, storing every receipt as "asserted + evidence pending offline resolution" with reason unknown_issuer_key, the + workspace's own valid receipt included — and that contradiction was the + defect rather than a wrong guess, since the CLI adapter never consulted the + committed trust registry. F-18a5883a repaired it, and the control and + tampered passes are met as written. What was wrong was + `unregistered_issuer_refused: true`. The refusal the earlier run recorded + came from the harness, not from the issuer being unknown: the row built the + stranger's workspace as a copy inside the workspace under test, and the old + seal enumeration walked into that copy and sealed its files into the + original, so the two workspaces computed different expected digests and the + kernel stopped at the digest comparison before it ever looked the issuer up. + With the workspaces separated and membership taken from git, the digests + match and the answer is the designed one: an unregistered issuer is not + refused but stored as asserted evidence pending offline resolution, exit 0, + which is also what the host tool answers. The property the row was really + after survives — the stranger's receipt discharges nothing (the audit + obligation stays unobserved) and lands as a second, separate receipt file. + The control pass is what made the difference readable: without a valid + receipt of the workspace's own issuer to compare against, "refused because + tampered" and "verifies nothing at all" look the same. + observed: >- + FIRST RUN (defective): every ingest exited 0 and was stored as "asserted + evidence pending offline resolution" with reason unknown_issuer_key — the + workspace's own valid receipt, the tampered one and the stranger's alike — + so a tampered signature could not be refused at this surface. RE-RUN on the + repacked build after F-18a5883a: the control (this workspace's own receipt, + removed and put straight back through the verb) exits 0 with "The signed + receipt was stored and verified offline." and verdict assurance verified / + currentness current / reason verified; ingesting it a second time is a + no-op — "The identical receipt is already stored." changed:false + idempotent:true, 1 → 1 receipt files; the tampered receipt, one character + of its 86-character issuer_proof flipped, exits 1 with INVALID_SIGNATURE + and verdict assurance invalid / currentness unresolved / reason + invalid_signature; mallory's receipt, whose key this workspace's registry + does not carry, exits 0 and is stored as asserted evidence pending offline + resolution, verdict assurance asserted / currentness unresolved / reason + unknown_issuer_key — it verifies nothing and discharges nothing. RE-PINNED + 2026-09-10, on the build carrying the seal repair and with the stranger's + workspace built outside this one: the control, idempotent and tampered + passes are unchanged, and the stranger pass is the asserted verdict above, + stable across two consecutive runs apart from the per-run receipt digests. + The earlier EXPECTED_DIGEST_MISMATCH was harness pollution, not a property + of unregistered issuers. The fixture is inside its cycle, so its audit + obligation is project-scoped and reads unobserved(stale) throughout; the + row does not read that as a per-receipt verdict. 2 receipt files at the end + — the workspace's own, and the stranger's, kept apart. + classification: defect-fixed + locked_at: "2026-09-10" + note: >- + The CLI ingest path now consults the committed trust registry, which is + what F-18a5883a repaired: the verb verifies offline rather than storing + everything as asserted. What separates the two negative cases is worth + writing down. A tampered signature from a registered issuer is refused + outright, because the workspace can check it and the check fails. A receipt + from an issuer this workspace does not carry cannot be checked at all, so it + is kept and marked asserted, pending offline resolution — it discharges no + obligation and is stored as its own file. The host tool passes the same + context and answers the same way, which is parity between the two surfaces + rather than a gap between them. + lock: + ingest-C: {exit: 0, contains: ["control ingest exit: 0", "control verdict: assurance verified, currentness current, reason verified", "The signed receipt was stored and verified offline.", "second ingest of the same receipt exit: 0", "The identical receipt is already stored.", "receipt files 1 → 1", "tampered ingest exit: 1", "\"INVALID_SIGNATURE\"", "tampered verdict: assurance invalid, currentness unresolved, reason invalid_signature", "this workspace's registry does not carry mallory", "foreign-issuer ingest exit: 0", "The receipt was stored as asserted evidence pending offline resolution.", "foreign verdict: assurance asserted, currentness unresolved, reason unknown_issuer_key", "foreign: gate exit 1; audit project=unobserved(stale)", "receipt files at the end: 2"]} + + - id: S-D6 + title: An evidence census that cannot be read is not an empty one + fixture_family: done + mode: auto + question: >- + With a symbolic link planted under spec/evidence, does the gate stop being + green and say the verification could not be checked — rather than reading + the unreadable census as "no receipts, nothing to verify"? + steps: + - name: census + run: script + script: row-census.sh + arms: [C] + family: done + expect: + b: {applicable: false, note: "the receipt census is a 0.2 surface"} + c: + push_before: 0 + push_with_link: 1 + profile_complete: false + incomplete_address: "receipt-census:spec/evidence" + warning_named: true + expect_revised: "written before the row first ran" + observed: >- + C: push profile exit 0 with profile_complete true and no incomplete + addresses; with a link at spec/evidence/F-planted/.yaml pointing at + /etc/hosts, exit 1, profile_complete false, incomplete addresses + ["receipt-census:spec/evidence", "runner-controls", + "verification:F-0ac93269/AC-…" ×3] and 15 obligations unobserved. The strict + pre-push text carries "F-0ac93269's verification could not be checked — the + evidence files under spec/evidence could not all be read safely … Remove + any link or non-receipt file placed under spec/evidence, then run `clad + check --tier=pre-push --strict`." (the console elides the tail; the row + reads the full sentence from the JSON report). + classification: match + lock: + census-C: {exit: 0, contains: ["before: profile_complete true", "after: profile_complete false", "receipt-census:spec/evidence", "warning text present: verification could not be checked", "Remove any link or non-receipt file placed under spec/evidence"]} + + - id: S-D7 + title: A verified sign-off asked for by a client that cannot ask a human + fixture_family: inprogress + mode: auto + question: >- + Over MCP, does `clad_signoff {verified: true}` from a client advertising no + elicitation support degrade to HUMAN_REQUIRED and write no receipt — and + does 0.9.4 simply not carry the tool? + steps: + - name: mcp-signoff + run: script + script: row-mcp-signoff.sh + arms: [C] + family: inprogress + - name: mcp-signoff-absent + run: script + script: row-mcp-signoff.sh + arms: [B] + family: shared-0.1 + expect: + b: {applicable: false, note: "0.9.4 advertises no clad_signoff — the catalogue is the comparison"} + c: + code: HUMAN_REQUIRED + isError: true + receipts: 0 + expect_revised: "written before the row first ran" + observed: >- + C: 27 tools advertised, clad_signoff present; the call returns isError true + with code HUMAN_REQUIRED — "A verified signoff needs a human to re-enter the + feature id in a terminal prompt or a host elicitation form. Only asserted + history was recorded." — and 0 receipts. B: 22 tools advertised, + clad_signoff not among them. + classification: match + lock: + mcp-signoff-C: {exit: 0, contains: ["clad_signoff in the catalogue: yes", "clad_signoff code: HUMAN_REQUIRED", "clad_signoff isError: true", "receipts written by the elicitation-less client: 0"]} + mcp-signoff-absent-B: {exit: 0, contains: ["tools advertised: 22", "clad_signoff in the catalogue: no"]} + + - id: S-F1 + title: The generated projections move once, safely, and refuse the two cases they must + fixture_family: done + mode: auto + question: >- + Does the relocation preview write nothing, does the apply move all three + derived files byte-identically and retarget the merge=union line, does the + moved workspace still pass its own strict push profile, is a second apply a + no-op, and are the two impossible states — both paths present, and a 0.1 + workspace — refused with a remedy? + steps: + - name: relocate + run: script + script: row-relocate.sh + arms: [C] + family: done + - name: relocate-absent + run: script + script: row-relocate.sh + arms: [B] + family: done + expect: + b: {applicable: false, note: "0.9.4 has no relocate-generated verb — the row records the unknown-command answer"} + c: + preview_writes: 0 + moves: 3 + bytes_identical: true + gate_after_move: 0 + second_apply_changed: false + conflict_refused: true + schema_01_refused_with: "clad migrate --to 0.2" + expect_revised: "written before the row first ran" + observed: >- + C: preview state old, 3 moves (spec/index.yaml, spec/_doc-links.yaml, + spec/attestation.yaml → spec/generated/…), writes 0, 0 changed paths; apply + state new, changed true, writes 3 — all three old paths gone, all three + files byte-identical at the new path, .gitattributes now + "spec/generated/index.yaml merge=union"; `clad sync` exit 0 and the strict + push profile after the move exit 0; a second apply exits 0 with changed + false; with both copies present the preview reports state conflict naming + spec/index.yaml and spec/generated/index.yaml, and `--apply` exits 1 with + "A generated projection exists at both of its known locations … Remove the + copy you do not keep, then rerun. No files were changed." leaving both files + in place; the same binary on the 0.1 workspace exits 1 with "Relocation + needs a schema 0.2 specification. Run `clad migrate --to 0.2` first; schema + migration and relocation are separate steps." B: exit 1, "error: unknown + command 'relocate-generated'". + classification: match + lock: + relocate-C: {exit: 0, contains: ["preview state old; moves 3; writes 0", "preview left 0 changed paths", "old paths still present: 0 of 3", "index bytes identical after the move: yes", "spec/generated/index.yaml merge=union", "strict push profile after the move: exit 0", "second apply state new; changed false", "conflict apply exit: 1", "relocation_conflict", "Run `clad migrate --to 0.2` first"]} + relocate-absent-B: {exit: 0, contains: ["unknown command 'relocate-generated'"]} + + - id: S-F2 + title: The three guards around a migration + fixture_family: done + mode: auto + question: >- + Is an apply refused when a planned path carries uncommitted work, is a + baseline decision that has already been applied protected from being + re-answered, and does a 0.1 criterion the 0.2 grammar cannot parse become a + question for a human rather than a guess? + recipe: >- + Each guard runs on its own copy of the completed 0.1 project (done/B) inside + the row's workspace, so a refusal in one pass cannot be mistaken for a state + another left behind. + steps: + - name: migrate-guards + run: script + script: row-migrate-guards.sh + arms: [C] + family: done + expect: + b: {applicable: false, note: "the migration verb is a 0.2 surface"} + c: + dirty_code: DIRTY_PLANNED_PATH + second_answer_changes_nothing: true + unparseable_criterion_demands_a_decision: true + apply_without_that_answer_refused: true + expect_revised: + b: {applicable: false, note: "the migration verb is a 0.2 surface"} + c: + dirty_before_the_preview: DIRTY_PLANNED_PATH + dirty_after_the_preview: STALE_INPUT + second_answer_changes_nothing: true + unparseable_criterion_demands_a_decision: true + apply_without_that_answer_refused: true + why: >- + the dirty pass was rewritten during the dry run, before the recorded run: + dirtying the tree AFTER taking the preview never reaches the + uncommitted-path guard, because the preview digest has already changed + and the apply answers STALE_INPUT first. The refusal this row is about + needs the dirt to precede the preview. Both orders are now run and + recorded, so the two refusals are not mistaken for each other. + observed: >- + C: with spec.yaml dirty before the preview, the apply exits 1 with code + DIRTY_PLANNED_PATH — "Migration planned paths have uncommitted changes; + unrelated paths may remain dirty." — writes 0, no 0.2 marker in spec.yaml and + only the one dirty file changed; with the same edit made after the preview + the apply exits 1 with STALE_INPUT instead. After a migration applied with + the legacy baseline accepted and committed, re-applying the same preview + with the answer flipped to reject exits 0 with changed false, spec.yaml + byte-identical and 0 paths changed. A criterion rewritten to "slug things, + mostly" makes the preview demand 5 decisions including + CRITERION_STATEMENT_CONFLICT for criterion:F-fb84bdc8/AC-9140ff77, and an + apply that answers everything except that one exits 1 with + MIGRATION_UNRESOLVED, 0 paths changed. ~3 s. + classification: expectation-wrong + lock: + migrate-guards-C: {exit: 0, contains: ["DIRTY_PLANNED_PATH", "dirtied-after-preview apply exit: 1", "STALE_INPUT", "second apply with the other answer exit: 0", "spec.yaml unchanged by the second answer: yes", "CRITERION_STATEMENT_CONFLICT", "criterion-text decision demanded for: criterion:F-", "MIGRATION_UNRESOLVED"]} + +live_metrics: + verdict_bearing: + # Only these may block, delay, or reword the release. + - completed_honest # kept done_attempted + shard done + judge exit 0 + - hand_flip # a done shard with no kept completion behind it + - engaged # a feature_created event (B/C) + - binding_mode # covers-token | test_refs | none + - judge_exit # the arm's own strict pre-push, re-run by the driver + - judge_failed_stages + - judge_findings # per detector and severity + - gate_runs + - gate_red_then_green # an honest red that later became green + - permission_denials + - tool_errors + - worktree_clean_at_end + - spec_artifacts # shards, criteria, statements, ears fields, test refs + - scorer_reproducible # the same cell scored twice, byte-identical + + cost_bearing: + # These decide one sentence in the release notes (hypothesis G3) and nothing + # else. Cost is the host's list-price estimate for an OAuth session, not an + # amount billed. + - duration_ms + - duration_api_ms + - wall_ms + - num_turns + - time_to_first_edit_ms + - first_gate_tool_ordinal + - first_green_gate_ordinal + - tokens_input + - tokens_output + - tokens_cache_read + - tokens_cache_creation + - tokens_thinking + - tokens_total + - cache_read_ratio + - total_cost_usd + - static_instruction_tokens # approxTokens(prompt + AGENTS.md + CLAUDE.md) + - tool_calls_total + - tool_calls_mcp + + reported_only: + # PRE-REGISTERED AS NULL-EXPECTED. Four prior campaigns found correctness + # orthogonal to the harness, and nothing here re-opens that question. These + # numbers are published whatever they say, and a difference in them does not + # block, delay, or justify a release claim. + - blind_oracle_pass # scripts/ab-abc/oracle/, hidden from every arm + - loc_src + - lint_errors + - lint_warnings + - tsc_clean + - complexity_max + - complexity_mean + - any_count + - api_conformance + - error_class_named + - comment_density + - jsdoc_blocks + - header_comment_present + - files_outside_scope + - test_count + - assertion_count + - ac_titled + - negative_test_present + - skip_or_only + - coverage_lines_pct + - git_commits + + secondary_not_run: + # A blinded model-graded rubric (scripts/ab-abc/judge.sh). Non-deterministic, + # roughly $0.10 per cell, and refuses to run without an explicit confirmation. + # Recorded here so its absence is a decision rather than an oversight. + - blind_rubric_readability + - blind_rubric_error_handling + - blind_rubric_test_design diff --git a/scripts/ab-abc/freeze.sh b/scripts/ab-abc/freeze.sh new file mode 100644 index 00000000..64d9ce22 --- /dev/null +++ b/scripts/ab-abc/freeze.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/freeze.sh — pin both engines before a campaign runs. +# +# Arm B is the released cladding@0.9.4 from the registry; arm C is a tarball +# packed from this checkout. Both land in private prefixes so nothing on the +# machine's global PATH can decide which engine a cell used. Everything the +# campaign later claims about "which engine" traces back to env.log written here: +# the repo commit, whether the tree was dirty at pack time, both versions, and +# the sha256 of the packed dist against the repo build. +# +# Usage: ABC_ROOT=~/abc-0100 bash scripts/ab-abc/freeze.sh +set -euo pipefail + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_REPO="${ABC_REPO:-/Users/qwerfunch/Developer/work/cladding}" +ABC_B_VERSION="${ABC_B_VERSION:-0.9.4}" + +PREFIX_B="$ABC_ROOT/prefix-B" +PREFIX_C="$ABC_ROOT/prefix-C" +ENV_LOG="$ABC_ROOT/env.log" + +mkdir -p "$ABC_ROOT" "$PREFIX_B" "$PREFIX_C" +: > "$ENV_LOG" + +log() { printf '%s\n' "$*" | tee -a "$ENV_LOG"; } + +log "# ab-abc freeze — $(date -u +%Y-%m-%dT%H:%M:%SZ)" +log "root: $ABC_ROOT" +log "repo: $ABC_REPO" +log "node: $(node --version)" +log "npm: $(npm --version)" + +# ── repo identity (honest even when the tree is dirty) ──────────────────────── +cd "$ABC_REPO" +log "repo HEAD: $(git rev-parse HEAD)" +log "repo branch: $(git rev-parse --abbrev-ref HEAD)" +DIRTY="$(git status --porcelain | wc -l | tr -d ' ')" +log "repo dirty files at pack time: $DIRTY" +if [ "$DIRTY" != "0" ]; then + log "--- dirty tree (the packed engine is NOT a clean commit) ---" + git status --porcelain | tee -a "$ENV_LOG" +fi + +# ── arm C: build, pack, install ─────────────────────────────────────────────── +log "## arm C — packing this checkout" +npm run build >>"$ENV_LOG" 2>&1 +TARBALL_NAME="$(npm pack --pack-destination "$ABC_ROOT" --json | node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>process.stdout.write(JSON.parse(s)[0].filename))')" +TARBALL="$ABC_ROOT/$TARBALL_NAME" +log "tarball: $TARBALL ($(wc -c <"$TARBALL" | tr -d ' ') bytes)" +npm install -g --prefix "$PREFIX_C" "$TARBALL" >>"$ENV_LOG" 2>&1 + +# ── arm B: the released engine ──────────────────────────────────────────────── +log "## arm B — installing cladding@$ABC_B_VERSION from the registry" +npm install -g --prefix "$PREFIX_B" "cladding@$ABC_B_VERSION" >>"$ENV_LOG" 2>&1 + +# ── identity checks ─────────────────────────────────────────────────────────── +for arm in B C; do + case "$arm" in + B) prefix="$PREFIX_B" ;; + C) prefix="$PREFIX_C" ;; + esac + bin="$prefix/bin/clad" + [ -x "$bin" ] || { echo "arm $arm: $bin is not executable" >&2; exit 1; } + log "arm $arm version: $(PATH="$prefix/bin:$PATH" clad --version)" + log "arm $arm resolved bin: $(PATH="$prefix/bin:$PATH" command -v clad)" + dist="$prefix/lib/node_modules/cladding/dist/clad.js" + log "arm $arm dist sha256: $(shasum -a 256 "$dist" | cut -d' ' -f1) ($dist)" +done + +log "repo dist sha256: $(shasum -a 256 "$ABC_REPO/dist/clad.js" | cut -d' ' -f1)" + +C_SHA="$(shasum -a 256 "$PREFIX_C/lib/node_modules/cladding/dist/clad.js" | cut -d' ' -f1)" +REPO_SHA="$(shasum -a 256 "$ABC_REPO/dist/clad.js" | cut -d' ' -f1)" +if [ "$C_SHA" != "$REPO_SHA" ]; then + log "FAIL: arm C's packed engine differs from the repo build — do not run the campaign" + exit 1 +fi +log "OK: arm C's packed engine is byte-identical to the repo build" + +# The budget ledger starts here, so a re-freeze never silently resets spending. +if [ ! -f "$ABC_ROOT/budget.json" ]; then + printf '{"spentUsd": 0, "capUsd": 40, "runs": []}\n' > "$ABC_ROOT/budget.json" + log "budget ledger created at $ABC_ROOT/budget.json (cap \$40)" +else + log "budget ledger kept: $(cat "$ABC_ROOT/budget.json" | tr -d '\n')" +fi + +log "freeze complete" diff --git a/scripts/ab-abc/host-probe.md b/scripts/ab-abc/host-probe.md new file mode 100644 index 00000000..71a097ef --- /dev/null +++ b/scripts/ab-abc/host-probe.md @@ -0,0 +1,96 @@ +# The host-integration probe + +`bash scripts/ab-abc/host-probe.sh [--dry-run]` + +`host` is one of `claude`, `codex`, `cursor`, `antigravity`; `model` is the model +the host should run — pass the cheapest one it lists. Gemini is out of scope for +this round. + +The probe drives the real host CLI from a console outside the calling session, +against a copy of the completed 0.10.0 side-table fixture wired to the frozen +candidate engine in `~/abc-0100/prefix-C`. Nothing is simulated: no doctor shim, +no in-process MCP client, no mock host. Every byte the console produced is kept. + +**This is a probe, not a cycle.** It runs three read-only tool calls and one +minimal write cycle. It is not the MCP11 lifecycle — create, begin, implement, +gate, sign, complete — and no result it records should be reported as one. What +it can answer is narrow and worth having: does this host, on this model, actually +reach cladding's tools from a plain terminal, and what does that cost in time. + +## The cells + +| Cell | What it asks | +|---|---| +| `read-list-features` | Call `clad_list_features` and print one feature id. | +| `read-get-feature` | Call `clad_get_feature` for the fixture's own feature and print the id back. | +| `read-run-check` | Call `clad_run_check` and print the number of findings. | +| `write` | Call `clad_create_feature`, then `clad_begin` on the id it returned, then `clad_get_feature`. | + +The three read prompts are the doctor's own text, copied verbatim from +`src/cli/doctor-hosts.ts` (`SURFACE_PROMPTS`). They are blunt on purpose: an +open-ended request invites a host to go read the repository instead of calling +the tool, which grades a working host as broken. + +Antigravity has no per-tool approval flag — its only non-interactive mode is the +skip-permissions family, which is a bypass rather than an approval — so its write +cell is not run and records `write: not-run (read-only approval mode)`. + +Every cell writes, under `~/abc-0100/host-probe/-/cells//`: + +- `command.txt` — the exact command line, plus the directory it ran in +- `stdout.txt`, `stderr.txt` — the console, untrimmed +- `exit.txt`, `duration_ms.txt` — and `timed_out.txt` when the cap fired + +Alongside them the run leaves `versions.txt` (engine + host CLI + requested +model), `model-list.txt` (the host's own listing where it has one — cursor +`--list-models`, Antigravity `agy models` — otherwise a line saying the CLI +offers none), `setup.txt`, `wiring.txt` (proof the wire points inside +`prefix-C`), `cost.txt` and `workspace-changes.txt`. + +## Replaying one cell by hand + +`command.txt` is the whole answer: copy the line, `cd` to the directory named +underneath it, and run it. It carries the `env -u …` prefix that keeps the host +from inheriting the calling session, and the `perl -e 'alarm …'` wrapper that +enforces the wall clock (`timeout` does not exist on macOS; a cell killed by the +alarm exits 142). Drop the `perl` wrapper if you want to sit and watch one. + +## The cost cap + +Only `claude -p` reports dollars, so the $5 ceiling in the plan is an operational +definition, not an arithmetic one: + +1. one fixed model per host, named on the command line; +2. a ten-minute wall clock per cell (`ABC_HOST_PROBE_TIMEOUT` to change it); +3. the host's own budget flag where one exists — claude `--max-budget-usd 1`; +4. the token counts a host prints, recorded as printed; +5. dollars reported only for claude, where `total_cost_usd` is measured from the + final `result` event. Every other host is reported as time and tokens, and no + dollar total is claimed across hosts. + +Codex is pinned twice on purpose. `-m ` alone leaves +`~/.codex/config.toml`'s `model_reasoning_effort = "high"` in force — the +expensive half — so `-c model_reasoning_effort="low"` rides with it. `codex exec` +also ignores untrusted project config, so the server is injected on the command +line rather than trusted to the file `clad setup` wrote. + +## Machine state + +`clad setup` writes outside the project: Antigravity's wire is machine-wide by +design, and the legacy-cleanup pass can remove a cladding entry from +`~/.codex/config.toml`, `~/.cursor/mcp.json` or the `~/.gemini` tree whichever +host is named. The probe tars each of those paths before setup and restores them +from an `EXIT` trap — including removing one it created where none existed. Set `ABC_HOST_PROBE_SETUP_FORCE=1` when setup reports `skipped-different` for a +wire that is cladding's own but stale — an entry left pointing at an install that +has since been deleted reads as foreign, and `--force` is the product's way past +it; the run records `setup --force: yes` in `setup.txt`, and the restore puts the +machine back on the wire it had before the probe either way. For +Antigravity it also records `agy mcp list` before and after, because a missing +cladding entry there is the leading suspect for the 2026-09-07 doctor timeouts. + +## Dry run + +`--dry-run` prints every command line the live run would use — fixture copy, +setup, each cell, the model listing, the backup/restore paths — and executes +none of them. It copies nothing and touches no machine file, so it is the safe +way to read what a run would do before paying for it. diff --git a/scripts/ab-abc/host-probe.sh b/scripts/ab-abc/host-probe.sh new file mode 100755 index 00000000..2b16505a --- /dev/null +++ b/scripts/ab-abc/host-probe.sh @@ -0,0 +1,433 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/host-probe.sh — the live host-integration probe +# +# bash scripts/ab-abc/host-probe.sh [--dry-run] +# host claude | codex | cursor | antigravity +# model the model the host should run; pass the cheapest one the host lists +# +# What this is, and what it is not. It drives the REAL host CLI from a console +# outside the calling session — no doctor shim, no in-process client, no mock — +# against a copy of the completed 0.10.0 fixture wired to the frozen candidate +# engine, and keeps every byte the console produced. It is a PROBE: three +# read-only tool calls and one minimal write cycle. It is not the full MCP11 +# cycle (create → begin → implement → gate → sign → done), and nothing it +# records should be read as one. +# +# Each cell leaves command.txt (the exact command line, so the same run can be +# repeated by hand), stdout.txt, stderr.txt, exit.txt and duration_ms.txt. +# +# Cost. Only `claude -p` reports dollars, so the cap is operational rather than +# arithmetic: one fixed model per host, a ten-minute wall clock per cell, the +# host's own budget flag where one exists (claude `--max-budget-usd 1`), and the +# token counts a host prints — "not reported" where it prints none. No dollar +# total is claimed for the hosts that report none. +# +# Machine state. `clad setup` writes machine-wide files for some hosts (the +# Antigravity wire is machine-wide by design, and the legacy-cleanup pass can +# remove a cladding entry from ~/.codex/config.toml, ~/.cursor/mcp.json and the +# ~/.gemini tree whatever host is named). Every one of those paths is backed up +# before setup runs and restored by an EXIT trap, and the probe prints the +# before/after `agy mcp list` around the Antigravity run. +set -uo pipefail + +HOST="${1:-}" +MODEL="${2:-}" +DRY="${3:-}" + +if [ -z "$HOST" ] || [ -z "$MODEL" ]; then + echo "usage: bash host-probe.sh [--dry-run]" >&2 + exit 64 +fi +case "$HOST" in + claude | codex | cursor | antigravity) ;; + *) echo "unknown host: $HOST (claude, codex, cursor, antigravity)" >&2; exit 64 ;; +esac +DRY_RUN=0 +[ "$DRY" = "--dry-run" ] && DRY_RUN=1 + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +PREFIX_C="$ABC_ROOT/prefix-C" +FIXTURE_SOURCE="$ABC_ROOT/sidetable/done/C" +STAMP="$([ "$DRY_RUN" -eq 1 ] && echo dry-run || date +%Y%m%dT%H%M%S)" +ARTIFACTS="${ABC_HOST_PROBE_DIR:-$ABC_ROOT/host-probe/$HOST-$STAMP}" +WORK="$ARTIFACTS/project" +BACKUP="$ARTIFACTS/machine-state-backup" +CELL_TIMEOUT_SECONDS="${ABC_HOST_PROBE_TIMEOUT:-600}" +# A wire cladding does not recognise is left alone by default, which is right: +# `clad setup` reports `skipped-different` rather than overwriting somebody's +# configuration. A stale cladding entry pointing at a deleted install reads the +# same way from the outside, and the product's escape from it is `--force`. That +# rewrites the machine-wide Antigravity plugin wire, so it stays opt-in and +# leans on the backup taken below — ~/.gemini/config is tarred whole and put +# back by the EXIT trap, plugins/cladding included. +SETUP_ARGS=(setup --host "$HOST") +SETUP_FORCE=no +if [ "${ABC_HOST_PROBE_SETUP_FORCE:-0}" = "1" ]; then + SETUP_ARGS+=(--force) + SETUP_FORCE=yes +fi + +# `timeout` is not on macOS. perl's alarm survives the exec, so the host process +# itself carries the clock and a killed cell shows up as exit 142. +ALARM=(perl -e 'alarm shift; exec @ARGV or die "exec failed: $!\n"' "$CELL_TIMEOUT_SECONDS") +# The host must not inherit this session: an inherited CLAUDECODE makes a host CLI +# believe it is already inside one. +CLEAN_ENV=(env -u CLAUDECODE -u CLAUDE_CODE_ENTRYPOINT -u CLAUDE_CODE_SSE_PORT -u CLAUDE_CODE_MAX_OUTPUT_TOKENS) + +FEATURE="$(cat "$ABC_ROOT/sidetable/done/C.feature" 2> /dev/null || echo F-0ac93269)" + +# The three read prompts are the doctor's own, verbatim +# (src/cli/doctor-hosts.ts SURFACE_PROMPTS) — maximally directive, because an +# open-ended request invites a host to explore the repository instead of calling +# the tool, which grades a healthy host as broken. +PROMPT_LIST='Call the clad_list_features MCP tool and print exactly one feature id (format F-xxxxxxxx) from the result, nothing else.' +PROMPT_GET="Call the clad_get_feature MCP tool for id ${FEATURE} and print that id verbatim." +PROMPT_CHECK="Call the clad_run_check MCP tool and print the number of findings plus the word 'findings'." +# The write cycle is deliberately the smallest one that proves a mutation +# reached the workspace: create a feature, start its cycle, read it back. +PROMPT_WRITE='Do exactly this and nothing else, using only the cladding MCP tools. 1) Call clad_create_feature with slug "host-probe", title "A feature created by the host probe", purpose "Prove the host can drive a write tool.", modules ["src/host-probe.ts"], capability_refs [], and one acceptance criterion of kind "behavior" with the statement "The system shall record a feature created through the host probe.". 2) Call clad_begin for the feature id it returned. 3) Call clad_get_feature for that id. Then print the feature id and its status, nothing else.' + +say() { printf '%s\n' "$*"; } + +# Renders a command exactly as it would be typed, so a reader can repeat it. +render() { + local out='' token escaped + for token in "$@"; do + if [[ "$token" =~ ^[A-Za-z0-9_@%+=:,./-]+$ ]]; then + out+="$token " + else + escaped=${token//\'/\'\\\'\'} + out+="'$escaped' " + fi + done + printf '%s\n' "${out% }" +} + +# Runs one cell, or prints its command line under --dry-run. Everything the +# console produced is kept: a probe that summarises is a probe you cannot check. +run_cell() { + local name="$1"; shift + local dir="$ARTIFACTS/cells/$name" + local line + line="$(cd "$WORK" 2> /dev/null || cd /; render "${CLEAN_ENV[@]}" "${ALARM[@]}" "$@")" + if [ "$DRY_RUN" -eq 1 ]; then + say "cell $name (cwd $WORK):" + say " $line" + return 0 + fi + mkdir -p "$dir" + printf '%s\n' "$line" > "$dir/command.txt" + printf 'cwd: %s\n' "$WORK" >> "$dir/command.txt" + local start end exit_code + start="$(date +%s000)" + ( cd "$WORK" && "${CLEAN_ENV[@]}" "${ALARM[@]}" "$@" ) > "$dir/stdout.txt" 2> "$dir/stderr.txt" + exit_code=$? + end="$(date +%s000)" + printf '%s\n' "$exit_code" > "$dir/exit.txt" + printf '%s\n' "$(( end - start ))" > "$dir/duration_ms.txt" + if [ "$exit_code" -eq 142 ]; then + printf 'the cell hit the %ss wall clock and was killed\n' "$CELL_TIMEOUT_SECONDS" > "$dir/timed_out.txt" + say "cell $name: TIMED OUT after ${CELL_TIMEOUT_SECONDS}s" + fi + say "cell $name: exit $exit_code in $(( (end - start) / 1000 ))s, stdout $(wc -c < "$dir/stdout.txt" | tr -d ' ') bytes" + return 0 +} + +# ── machine state: back up before setup, restore however this ends ────────── +MACHINE_PATHS=( + "$HOME/.gemini/config" + "$HOME/.gemini/extensions/cladding" + "$HOME/.codex/config.toml" + "$HOME/.cursor/mcp.json" + "$HOME/.claude/plugins/cladding" +) + +backup_machine_state() { + mkdir -p "$BACKUP" + local index=0 + for path in "${MACHINE_PATHS[@]}"; do + index=$(( index + 1 )) + if [ -e "$path" ] || [ -L "$path" ]; then + # tar keeps a symlink a symlink, which cp -R would not. + ( cd "$(dirname "$path")" && tar -cf "$BACKUP/$index.tar" "$(basename "$path")" ) 2> /dev/null \ + && say "backed up $path" || say "WARNING: could not back up $path" + else + printf 'absent\n' > "$BACKUP/$index.absent" + say "no existing $path (it will be removed again on exit if setup creates it)" + fi + done +} + +restore_machine_state() { + [ -d "$BACKUP" ] || return 0 + local index=0 + for path in "${MACHINE_PATHS[@]}"; do + index=$(( index + 1 )) + if [ -f "$BACKUP/$index.tar" ]; then + rm -rf "$path" + ( cd "$(dirname "$path")" && tar -xf "$BACKUP/$index.tar" ) 2> /dev/null \ + && say "restored $path" || say "WARNING: could not restore $path" + elif [ -f "$BACKUP/$index.absent" ]; then + if [ -e "$path" ] || [ -L "$path" ]; then + rm -rf "$path" + say "removed $path, which the probe created" + fi + fi + done +} + +trap 'restore_machine_state' EXIT + +# ── the fixture ───────────────────────────────────────────────────────────── +say "host $HOST, model $MODEL, artifacts $ARTIFACTS" +say "engine under probe: $PREFIX_C/bin/clad" +if [ "$DRY_RUN" -eq 1 ]; then + say '' + say 'DRY RUN — nothing is copied, no machine file is touched, no host is called.' + say '' + say 'fixture:' + say " $(render rsync -a --exclude node_modules "$FIXTURE_SOURCE/" "$WORK/")" + say " $(render "$PREFIX_C/bin/clad" "${SETUP_ARGS[@]}") # run inside $WORK" + say " setup --force: $SETUP_FORCE (ABC_HOST_PROBE_SETUP_FORCE=1 to replace a stale cladding wire)" + if [ "$HOST" = cursor ]; then + say " the fixture's own .cursor/cli.json gains Mcp(cladding:clad_create_feature|clad_begin|clad_get_feature) — setup allows only the three read tools" + fi + say "machine state backed up and restored on exit: ${MACHINE_PATHS[*]}" + say "refused before any of this if ~/.claude/plugins/cladding is a symlink (setup would uninstall the user-scoped plugin)" + say '' +else + trap 'restore_machine_state' EXIT + # `clad setup` removes a cladding symlink at ~/.claude/plugins/cladding and, if + # it removed one, runs `claude plugin uninstall` — a machine change no tar can + # put back. The probe refuses rather than risk it. + if [ -L "$HOME/.claude/plugins/cladding" ] && [ "${ABC_HOST_PROBE_ALLOW_PLUGIN_CLEANUP:-0}" != "1" ]; then + say "~/.claude/plugins/cladding is a symlink; setup would uninstall the user-scoped plugin, which this probe cannot restore." + say "Re-run with ABC_HOST_PROBE_ALLOW_PLUGIN_CLEANUP=1 only if you are willing to reinstall it yourself." + exit 3 + fi + if [ ! -d "$FIXTURE_SOURCE" ]; then + say "no completed 0.2 fixture at $FIXTURE_SOURCE — run the side-table bootstrap first" + exit 3 + fi + if ! command -v "$([ "$HOST" = antigravity ] && echo agy || { [ "$HOST" = cursor ] && echo cursor-agent || echo "$HOST"; })" > /dev/null; then + say "the $HOST CLI is not installed on this machine — recorded as not-run" + exit 3 + fi + mkdir -p "$ARTIFACTS/cells" + rm -rf "$WORK" + mkdir -p "$WORK" + rsync -a --exclude node_modules "$FIXTURE_SOURCE/" "$WORK/" + [ -d "$FIXTURE_SOURCE/node_modules" ] && ln -s "$FIXTURE_SOURCE/node_modules" "$WORK/node_modules" + backup_machine_state + ( cd "$WORK" && "$PREFIX_C/bin/clad" "${SETUP_ARGS[@]}" ) > "$ARTIFACTS/setup.txt" 2>&1 + SETUP_EXIT=$? + printf 'setup --force: %s\n' "$SETUP_FORCE" >> "$ARTIFACTS/setup.txt" + say "clad setup --host $HOST exit: $SETUP_EXIT (--force: $SETUP_FORCE)" + + # The wire has to point at the frozen candidate, not at whatever `clad` the + # machine has globally. A probe of the wrong engine measures nothing. + { + say "--- launcher check ---" + grep -rn "prefix-C" "$WORK/.cladding/host/serve.cjs" "$WORK/.mcp.json" "$WORK/.codex/config.toml" \ + "$WORK/.cursor/mcp.json" "$HOME/.gemini/config/plugins/cladding/mcp_config.json" 2> /dev/null \ + || say "no prefix-C reference found in the written wiring" + } > "$ARTIFACTS/wiring.txt" 2>&1 + if [ "$HOST" = cursor ]; then + # `clad setup` allows cursor only the three read-only tools by design + # (CURSOR_READONLY_MCP_PERMISSIONS). Without the write tools in the FIXTURE's + # own allowlist the write cell would measure this harness's permission file + # rather than the host. The product default is untouched — only the copy. + node -e ' + const fs = require("node:fs"); + const path = `${process.argv[1]}/.cursor/cli.json`; + const doc = fs.existsSync(path) ? JSON.parse(fs.readFileSync(path, "utf8")) : {}; + doc.permissions = doc.permissions ?? {}; + const allow = new Set(doc.permissions.allow ?? []); + for (const tool of ["clad_create_feature", "clad_begin", "clad_get_feature"]) allow.add(`Mcp(cladding:${tool})`); + doc.permissions.allow = [...allow]; + fs.mkdirSync(`${process.argv[1]}/.cursor`, {recursive: true}); + fs.writeFileSync(path, `${JSON.stringify(doc, null, 2)}\n`); + process.stdout.write(`fixture .cursor/cli.json now allows ${doc.permissions.allow.length} entries\n`); + ' "$WORK" | tee -a "$ARTIFACTS/setup.txt" + fi + if grep -q "prefix-C" "$ARTIFACTS/wiring.txt"; then + say "wiring points inside $PREFIX_C: yes" + else + say "wiring points inside $PREFIX_C: NO — see $ARTIFACTS/wiring.txt" + fi +fi + +# ── versions and the model listing ────────────────────────────────────────── +record_versions() { + if [ "$DRY_RUN" -eq 1 ]; then + say "versions.txt: $(render "$PREFIX_C/bin/clad" --version) + the host's own --version" + return 0 + fi + { + say "cladding: $("$PREFIX_C/bin/clad" --version 2>&1)" + case "$HOST" in + claude) say "claude: $(claude --version 2>&1 | head -1)" ;; + codex) say "codex: $(codex --version 2>&1 | head -1)" ;; + cursor) say "cursor-agent: $(cursor-agent --version 2>&1 | head -1)" ;; + antigravity) say "agy: $(agy --version 2>&1 | head -1)" ;; + esac + say "model requested: $MODEL" + } > "$ARTIFACTS/versions.txt" 2>&1 + cat "$ARTIFACTS/versions.txt" +} + +record_model_list() { + local listing=() + case "$HOST" in + cursor) listing=(cursor-agent --list-models) ;; + antigravity) listing=(agy models) ;; + claude) listing=() ;; + codex) listing=() ;; + esac + if [ "${#listing[@]}" -eq 0 ]; then + if [ "$DRY_RUN" -eq 1 ]; then + say "model-list.txt: this host has no model-listing command — the chosen model is recorded from the vendor's published list" + else + printf 'this host CLI has no model-listing command; the model was chosen from the vendor documentation and is recorded in versions.txt\n' \ + > "$ARTIFACTS/model-list.txt" + fi + return 0 + fi + if [ "$DRY_RUN" -eq 1 ]; then + say "model-list.txt: $(render "${listing[@]}")" + return 0 + fi + "${CLEAN_ENV[@]}" "${listing[@]}" > "$ARTIFACTS/model-list.txt" 2>&1 + say "model listing recorded: $(wc -l < "$ARTIFACTS/model-list.txt" | tr -d ' ') lines" +} + +record_versions +record_model_list + +# ── the host command shapes ───────────────────────────────────────────────── +# +# Derived from src/cli/doctor-hosts.ts buildPromptCommand, with three deliberate +# differences, all of them here rather than in any runner's brief: +# · codex uses `exec --approve-for-me`, never the bypass flag the doctor uses; +# · every host is pinned to one model, and codex's reasoning effort is pinned +# with it, because `-m` alone leaves ~/.codex/config.toml's high setting in +# place and that is the expensive half; +# · codex exec ignores untrusted project config, so the server is injected on +# the command line instead of relying on the file `clad setup` wrote. +host_command() { + local mode="$1" prompt="$2" + case "$HOST" in + claude) + HOST_CMD=(claude -p "$prompt" --model "$MODEL" --max-budget-usd 1 + --output-format stream-json --verbose + --strict-mcp-config --mcp-config .mcp.json --allowedTools mcp__cladding) + ;; + codex) + HOST_CMD=(codex exec --approve-for-me -m "$MODEL" + -c 'model_reasoning_effort="low"' + -c 'mcp_servers.cladding={command="node",args=[".cladding/host/serve.cjs"]}' + "$prompt") + ;; + cursor) + if [ "$mode" = read ]; then + HOST_CMD=(cursor-agent -p --mode ask --trust --approve-mcps --model "$MODEL" "$prompt") + else + HOST_CMD=(cursor-agent -p --trust --approve-mcps --model "$MODEL" "$prompt") + fi + ;; + antigravity) + HOST_CMD=(agy --dangerously-skip-permissions --model "$MODEL" + --print-timeout 10m --log-file "$ARTIFACTS/agy-handshake.log" -p "$prompt") + ;; + esac +} + +# ── Antigravity: the wire is the suspect, so it is recorded around the run ─── +if [ "$HOST" = antigravity ]; then + if [ "$DRY_RUN" -eq 1 ]; then + say "before/after wiring record: $(render agy mcp list)" + else + "${CLEAN_ENV[@]}" agy mcp list > "$ARTIFACTS/agy-mcp-list-before.txt" 2>&1 + say "agy mcp list before setup recorded ($(wc -l < "$ARTIFACTS/agy-mcp-list-before.txt" | tr -d ' ') lines)" + grep -q cladding "$ARTIFACTS/agy-mcp-list-before.txt" && say "cladding already wired into agy before the probe" \ + || say "cladding NOT in agy's server list before the probe" + fi +fi + +# ── the cells ─────────────────────────────────────────────────────────────── +host_command read "$PROMPT_LIST"; run_cell read-list-features "${HOST_CMD[@]}" +host_command read "$PROMPT_GET"; run_cell read-get-feature "${HOST_CMD[@]}" +host_command read "$PROMPT_CHECK"; run_cell read-run-check "${HOST_CMD[@]}" + +if [ "$HOST" = antigravity ]; then + # agy's only non-interactive approval flag is the skip-permissions family, the + # same one the doctor uses for read-only surfaces. A write cycle behind it + # would be a bypass, so this host's write cell is not run and says so. + if [ "$DRY_RUN" -eq 1 ]; then + say "cell write: not-run (read-only approval mode)" + else + mkdir -p "$ARTIFACTS/cells/write" + printf 'write: not-run (read-only approval mode)\n' > "$ARTIFACTS/cells/write/stdout.txt" + printf 'not-run\n' > "$ARTIFACTS/cells/write/exit.txt" + printf '0\n' > "$ARTIFACTS/cells/write/duration_ms.txt" + printf 'agy offers no per-tool approval flag; the only non-interactive mode is the skip-permissions family, which is a bypass rather than an approval\n' \ + > "$ARTIFACTS/cells/write/command.txt" + say "write: not-run (read-only approval mode)" + fi +else + host_command write "$PROMPT_WRITE"; run_cell write "${HOST_CMD[@]}" +fi + +if [ "$DRY_RUN" -eq 1 ]; then + say '' + say 'after the cells:' + [ "$HOST" = antigravity ] && say " $(render agy mcp list) # recorded again, then the machine state is restored" + say " $(render git -C "$WORK" status --porcelain) # what the write cell changed" + say " restore: ${MACHINE_PATHS[*]}" + exit 0 +fi + +# ── what the run cost, and what it changed ────────────────────────────────── +{ + case "$HOST" in + claude) + # The dollar figure lives in the final stream-json result event. + node -e ' + const fs = require("node:fs"); + let total = 0; + let seen = false; + for (const dir of fs.readdirSync(process.argv[1])) { + const path = `${process.argv[1]}/${dir}/stdout.txt`; + if (!fs.existsSync(path)) continue; + for (const line of fs.readFileSync(path, "utf8").split("\n")) { + if (!line.startsWith("{")) continue; + try { + const event = JSON.parse(line); + if (event.type === "result" && typeof event.total_cost_usd === "number") { + total += event.total_cost_usd; + seen = true; + process.stdout.write(`${dir}: total_cost_usd ${event.total_cost_usd}, duration_ms ${event.duration_ms ?? "?"}\n`); + } + } catch {} + } + } + process.stdout.write(seen ? `measured total: $${total.toFixed(4)}\n` : "no result event carried total_cost_usd\n"); + ' "$ARTIFACTS/cells" 2>&1 + ;; + *) + say "dollars: not reported by this host CLI" + grep -ohiE '[0-9,]+ *(input |output |total )?tokens' "$ARTIFACTS"/cells/*/stdout.txt 2> /dev/null | sort -u | head -10 \ + || say "tokens: not reported" + ;; + esac +} > "$ARTIFACTS/cost.txt" 2>&1 +cat "$ARTIFACTS/cost.txt" + +( cd "$WORK" && git status --porcelain ) | grep -v node_modules > "$ARTIFACTS/workspace-changes.txt" 2>&1 +say "workspace paths the probe changed: $(wc -l < "$ARTIFACTS/workspace-changes.txt" | tr -d ' ')" +if [ "$HOST" = antigravity ]; then + "${CLEAN_ENV[@]}" agy mcp list > "$ARTIFACTS/agy-mcp-list-after.txt" 2>&1 + grep -q cladding "$ARTIFACTS/agy-mcp-list-after.txt" && say "cladding in agy's server list after setup: yes" \ + || say "cladding in agy's server list after setup: NO — the wire is the fault to chase" +fi +say "artifacts: $ARTIFACTS" diff --git a/scripts/ab-abc/judge.sh b/scripts/ab-abc/judge.sh new file mode 100644 index 00000000..a9f25b2f --- /dev/null +++ b/scripts/ab-abc/judge.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/judge.sh — blinded rubric scoring (SECONDARY, unused) +# +# NOT RUN BY THE CAMPAIGN. This is a model-graded, non-deterministic measure, and +# the pre-registration marks it **secondary: reported only, never a verdict**. +# Everything the release decision rests on is deterministic and lives elsewhere. +# +# What it would do: build an anonymised snapshot of one cell's `src/` and +# `tests/` — no arm letter, no engine version, no spec directory, no harness +# files — and ask a fixed rubric of a separate model. +# +# Readability 1–5 +# Error handling 1–5 +# Test design 1–5 +# +# Cost is roughly $0.10 per cell at the sizes this campaign produces. It refuses +# to spend anything unless the operator confirms explicitly, because a scoring +# script that quietly bills money is exactly the kind of thing this harness's +# safety rules exist to prevent. +# +# Usage: ABC_JUDGE_CONFIRM=yes-spend bash scripts/ab-abc/judge.sh +set -euo pipefail + +ARM="${1:?usage: judge.sh }" +CELL="${2:?usage: judge.sh }" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +WORKSPACE="$ABC_ROOT/cells/$ARM/$CELL" +ARTIFACTS="$ABC_ROOT/artifacts/$ARM/$CELL" +SNAPSHOT="$ARTIFACTS/blind-snapshot" + +if [ "${ABC_JUDGE_CONFIRM:-}" != "yes-spend" ]; then + echo "judge.sh is a secondary, model-graded measure and is NOT part of the campaign." >&2 + echo "It costs roughly \$0.10 per cell. Set ABC_JUDGE_CONFIRM=yes-spend to run it." >&2 + exit 1 +fi + +# ── the blinded snapshot ────────────────────────────────────────────────────── +rm -rf "$SNAPSHOT" +mkdir -p "$SNAPSHOT" +cp -R "$WORKSPACE/src" "$SNAPSHOT/src" +cp -R "$WORKSPACE/tests" "$SNAPSHOT/tests" +# Strip anything that would name the arm, the engine, or the criterion binding — +# a grader that can tell which arm it is reading is not a blinded grader. +find "$SNAPSHOT" -type f -name '*.ts' -exec sed -i '' -E \ + -e 's/\[covers:[^]]*\]//g' \ + -e 's/cladding//gI' \ + -e 's/0\.(9|10)\.[0-9]+//g' {} + + +RUBRIC="You are reviewing one small TypeScript module and its tests. Score three axes from 1 to 5, where 3 is ordinary professional work: readability, error handling, and test design. Answer as JSON: {\"readability\": n, \"error_handling\": n, \"test_design\": n, \"note\": \"one sentence\"}. Do not guess who or what wrote this code." + +cd "$SNAPSHOT" +env -u CLAUDECODE -u CLAUDE_CODE_ENTRYPOINT -u CLAUDE_CODE_SAFE_MODE -u CLAUDE_CODE_SIMPLE \ + claude -p "$RUBRIC" \ + --model claude-sonnet-5 \ + --output-format json \ + --strict-mcp-config \ + --no-session-persistence \ + --max-budget-usd 1 \ + --allowedTools "Read,Glob,Grep,LS" \ + > "$ARTIFACTS/blind-rubric.json" + +echo "blinded rubric written to $ARTIFACTS/blind-rubric.json (secondary — not a verdict)" diff --git a/scripts/ab-abc/lib-fixture.sh b/scripts/ab-abc/lib-fixture.sh new file mode 100644 index 00000000..dd8b4ee8 --- /dev/null +++ b/scripts/ab-abc/lib-fixture.sh @@ -0,0 +1,235 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/lib-fixture.sh — shared fixture-building steps +# +# Sourced by make-done-fixture.sh (side-table fixtures) and make-trap-cell.sh +# (the completion-claim trap). Nothing here spawns a model: every step is a +# deterministic file write or an engine call, so the same command always builds +# the same fixture. +# +# The one thing worth stating up front: the two engines bind a test to an +# acceptance criterion in different ways, and these helpers keep that difference +# explicit rather than hidden. 0.9.4 binds through a shard's `test_refs`; 0.10.0 +# binds through a `[covers:F-…/AC-…]` token at the START of a test title. A +# fixture that wants a defective binding therefore breaks a different thing in +# each arm — an emptied `test_refs` for B, a token moved to the end for C. + +# shellcheck shell=bash + +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" + +# Fails loudly when the arm's engine is not the one the caller thinks it is. +abc_engine_check() { + local arm="$1" prefix="$2" + [ -x "$prefix/bin/clad" ] || { echo "arm $arm has no engine at $prefix/bin/clad — run freeze.sh" >&2; return 1; } + printf 'arm %s engine: %s (%s)\n' "$arm" "$prefix/bin/clad" "$(PATH="$prefix/bin:$PATH" clad --version)" +} + +# Template + dependencies + an initial commit. +abc_seed_workspace() { + local dest="$1" + mkdir -p "$dest" + cp -R "$ABC_HARNESS/template/." "$dest/" + mkdir -p "$dest/src" "$dest/tests" + (cd "$dest" && npm ci >/dev/null 2>&1) + (cd "$dest" && git init --quiet \ + && git config user.name "abc-harness" \ + && git config user.email "abc-harness@example.invalid" \ + && git add -A && git commit --quiet -m "chore: project skeleton") +} + +# `clad init` in the shape each arm's schema expects, then the host wiring. +abc_init_engine() { + local arm="$1" prefix="$2" dest="$3" + if [ "$arm" = "C" ]; then + (cd "$dest" && PATH="$prefix/bin:$PATH" clad init --schema 0.2 --no-llm >/dev/null) + else + (cd "$dest" && PATH="$prefix/bin:$PATH" clad init --no-llm >/dev/null) + fi + (cd "$dest" && PATH="$prefix/bin:$PATH" clad setup --host claude >/dev/null) +} + +# Creates one feature through the MCP surface and prints its id. Going through +# the tool rather than writing YAML by hand is the point: the fixture is then +# built the way a host builds one, and a refusal here is a finding, not a typo. +# +# The two schemas ask for different things, so the arguments differ by arm: +# schema 0.2 requires a `purpose` (the WHY) and binds tests through title +# tokens, while schema 0.1 has neither and binds through per-criterion +# `test_refs`. Both arms get the same three criteria, all in the plain +# ubiquitous form, so nothing downstream turns on an EARS shape. +abc_create_feature() { + local arm="$1" prefix="$2" dest="$3" slug="$4" title="$5" purpose="$6" + local calls out + calls="$(mktemp -t abc-calls).json" + out="$(mktemp -t abc-out).json" + node -e ' + const fs = require("node:fs"); + const [callsPath, arm, slug, title, purpose] = process.argv.slice(1); + const criteria = [ + "The system shall convert a title into a lower-case hyphenated slug.", + "The system shall fold diacritics to their base letters when slugging a title.", + "The system shall reject a title that carries no slug-able characters.", + ]; + const args = arm === "C" + ? { + slug, + title, + purpose, + modules: ["src/slugify.ts"], + capability_refs: [], + // Schema 0.2 takes `kind` + a strict statement and refuses the legacy + // EARS fields outright — passing both is an error, not a courtesy. + acceptance_criteria: criteria.map((statement) => ({kind: "behavior", statement})), + } + : { + slug, + title, + // `modules` is not a 0.2 addition — the released tool takes it too, and + // without it the 0.9.4 shard bound no module at all. Several detectors + // (CONVENTION_DRIFT among them) walk `feature.modules`, so an empty + // list quietly made those rows unanswerable in arm B. + modules: ["src/slugify.ts"], + acceptance_criteria: criteria.map((text) => ({ears: "ubiquitous", text})), + }; + fs.writeFileSync(callsPath, JSON.stringify([{type: "tool", name: "clad_create_feature", args}])); + ' "$calls" "$arm" "$slug" "$title" "$purpose" + node "$ABC_HARNESS/mcp-client.mjs" --cwd "$dest" --server "$prefix/bin/clad serve" --calls "$calls" --out "$out" >/dev/null + # The id is captured BEFORE the temporary files are removed: a cleanup command + # as the function's last statement would overwrite a refusal's exit status with + # its own success, and the caller would build a fixture on a feature that was + # never created. + local id + if ! id="$(node -e ' + const fs = require("node:fs"); + const text = fs.readFileSync(process.argv[1], "utf8"); + if (/"isError":\s*true/.test(text)) throw new Error(`the tool refused the feature: ${text.slice(0, 800)}`); + const id = text.match(/F-[0-9a-f]{6,8}/); + if (!id) throw new Error(`no feature id in the create result: ${text.slice(0, 800)}`); + process.stdout.write(id[0]); + ' "$out")"; then + cp "$out" "${ABC_KEEP_FAILED:-/dev/null}" 2>/dev/null || true + rm -f "$calls" "$out" + return 1 + fi + rm -f "$calls" "$out" + printf '%s' "$id" +} + +# Prints every acceptance-criterion id in a feature's shard, one per line, in +# the order the shard declares them — so each test can be bound to its own +# criterion instead of three tests all claiming the first. +abc_criteria() { + local dest="$1" feature="$2" + node -e ' + const fs = require("node:fs"); + const path = require("node:path"); + const [dir, feature] = process.argv.slice(1); + const root = path.join(dir, "spec", "features"); + let ids = null; + for (const name of fs.readdirSync(root)) { + const raw = fs.readFileSync(path.join(root, name), "utf8"); + if (!raw.includes(feature)) continue; + ids = [...new Set(raw.match(/AC-[0-9a-f]{6,8}/g) ?? [])]; + break; + } + if (ids === null || ids.length === 0) throw new Error(`no criteria found for ${feature}`); + process.stdout.write(ids.join("\n")); + ' "$dest" "$feature" +} + +# The first criterion only — kept for rows that need one representative id. +# `sed -n 1p` rather than `head -1`: head closes the pipe as soon as it has its +# line, and the writer then dies of EPIPE instead of finishing quietly. +abc_first_criterion() { + abc_criteria "$1" "$2" | sed -n 1p +} + +# Prints the path of the shard holding a feature. +abc_shard_path() { + local dest="$1" feature="$2" + node -e ' + const fs = require("node:fs"); + const path = require("node:path"); + const [dir, feature] = process.argv.slice(1); + const root = path.join(dir, "spec", "features"); + let found = null; + for (const name of fs.readdirSync(root)) { + const full = path.join(root, name); + if (fs.readFileSync(full, "utf8").includes(feature)) { found = full; break; } + } + if (found === null) throw new Error(`no shard for ${feature}`); + process.stdout.write(found); + ' "$dest" "$feature" +} + +# The module every fixture implements — the same code in every arm, so nothing +# downstream can differ because of the implementation. +abc_write_module() { + local dest="$1" + cat > "$dest/src/slugify.ts" <<'MODULE' +// Fixture module — turns a title into a URL slug. + +/** Raised when an input carries nothing that can become a slug. */ +export class EmptySlugError extends Error { + constructor(input: string) { + super(`no slug-able characters in ${JSON.stringify(input)}`); + this.name = 'EmptySlugError'; + } +} + +/** Lower-cases, folds diacritics, and joins the remaining words with hyphens. */ +export function slugify(input: string): string { + const slug = input + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase() + .replace(/[^a-z0-9]+/g, '-') + .replace(/^-+|-+$/g, ''); + if (slug === '') throw new EmptySlugError(input); + return slug; +} +MODULE +} + +# The fixture's tests. The generator lives in write-tests.mjs — the test bodies +# are full of quotes, and an inline heredoc of them is unreadable. Modes: +# `leading` (0.10.0's real binding), `trailing` (the trap), `plain` (0.9.4). +abc_write_tests() { + node "$ABC_HARNESS/write-tests.mjs" "$@" +} + +# Points a 0.1 shard's criteria at the test file (B's way of binding). +abc_bind_test_refs() { + local shard="$1" testPath="$2" + node -e ' + const fs = require("node:fs"); + const [shard, testPath] = process.argv.slice(1); + const lines = fs.readFileSync(shard, "utf8").split("\n"); + const out = []; + for (const line of lines) { + out.push(line); + const m = line.match(/^(\s*)-\s+id:\s*AC-/); + if (m) out.push(`${m[1]} test_refs:`, `${m[1]} - ${testPath}`); + } + fs.writeFileSync(shard, out.join("\n")); + ' "$shard" "$testPath" +} + +# Empties every `test_refs` list in a shard (the trap for arm B). +abc_unbind_test_refs() { + local shard="$1" + node -e ' + const fs = require("node:fs"); + const shard = process.argv[1]; + const lines = fs.readFileSync(shard, "utf8").split("\n"); + const out = []; + let dropping = false; + for (const line of lines) { + if (/^\s*test_refs:\s*$/.test(line)) { dropping = true; continue; } + if (dropping && /^\s*-\s+\S/.test(line)) continue; + dropping = false; + out.push(line); + } + fs.writeFileSync(shard, out.join("\n")); + ' "$shard" +} diff --git a/scripts/ab-abc/make-cell.sh b/scripts/ab-abc/make-cell.sh new file mode 100644 index 00000000..d9389ec0 --- /dev/null +++ b/scripts/ab-abc/make-cell.sh @@ -0,0 +1,199 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/make-cell.sh — build one campaign cell's fixture. +# +# Every arm gets the byte-identical template, the byte-identical TASK.md, and a +# git history whose baseline commit is taken AFTER the arm's own setup — so the +# agent's `git status` afterwards shows only what the agent did. The arms differ +# in exactly one thing: which engine, if any, is on PATH. +# +# A no engine. A `clad` stub earlier on PATH records every call and exits 127, +# so a reach for the harness is visible instead of silent. +# B cladding@0.9.4 from prefix-B, `clad init --no-llm` (schema 0.1) + setup. +# C the packed 0.10.0 from prefix-C, `clad init --schema 0.2 --no-llm` + setup. +# +# Usage: ABC_ROOT=~/abc-0100 bash scripts/ab-abc/make-cell.sh +# ABC_TASK=task2.md swaps in the second feature's brief. +# ABC_SKIP_ENGINE=1 builds the fixture only (used for dry-running arm A). +# ABC_FROM=/ seeds this cell from a FINISHED cell instead of the +# template — the continuation case, where a second feature +# lands in a workspace that already completed one. +set -euo pipefail + +ARM="${1:?usage: make-cell.sh }" +CELL="${2:?usage: make-cell.sh }" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +ABC_TASK="${ABC_TASK:-task.md}" + +case "$ARM" in + A|B|C) ;; + *) echo "arm must be A, B or C (got '$ARM')" >&2; exit 2 ;; +esac + +WORKSPACE="$ABC_ROOT/cells/$ARM/$CELL" +ARTIFACTS="$ABC_ROOT/artifacts/$ARM/$CELL" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ -e "$WORKSPACE" ]; then + echo "refusing to rebuild an existing cell: $WORKSPACE" >&2 + exit 1 +fi + +mkdir -p "$WORKSPACE" "$ARTIFACTS" +ENV_LOG="$ARTIFACTS/env.log" +: > "$ENV_LOG" +log() { printf '%s\n' "$*" | tee -a "$ENV_LOG"; } + +log "# cell $ARM/$CELL — $(date -u +%Y-%m-%dT%H:%M:%SZ)" +log "workspace: $WORKSPACE" +log "task brief: $ABC_TASK" + +# ── seeded from a finished cell (the continuation case) ─────────────────────── +# The whole tree comes across, git history and harness state included, so the new +# cell starts exactly where the old one stopped. `node_modules` is symlinked +# rather than copied — it is byte-identical in every fixture and copying it turns +# a cheap setup into a slow one. Anything the source cell left uncommitted is +# committed here, so this cell's baseline is again a clean HEAD and the agent's +# `git status` stays a record of the agent alone. +if [ -n "${ABC_FROM:-}" ]; then + SOURCE="$ABC_ROOT/cells/$ABC_FROM" + [ -d "$SOURCE" ] || { echo "ABC_FROM names no cell: $SOURCE" >&2; exit 1; } + log "seeded from finished cell: $SOURCE" + rsync -a --exclude 'node_modules' "$SOURCE/" "$WORKSPACE/" + if [ -d "$SOURCE/node_modules" ]; then ln -s "$SOURCE/node_modules" "$WORKSPACE/node_modules"; fi + cp "$ABC_HARNESS/$ABC_TASK" "$WORKSPACE/TASK.md" + cp "$ABC_HARNESS/prompt.txt" "$ARTIFACTS/prompt.txt" + cd "$WORKSPACE" + git config user.name "abc-harness" + git config user.email "abc-harness@example.invalid" + if [ -n "$(git status --porcelain)" ]; then + git add -A + git commit --quiet -m "chore: carry the finished cell forward" + fi + if [ "$ARM" = "A" ]; then + ENGINE_PATH="none" + ENGINE_VERSION="none" + else + LAUNCHER="$WORKSPACE/.cladding/host/serve.cjs" + ENGINE_PATH="$(sed -n 's/^const engine = "\(.*\)";$/\1/p' "$LAUNCHER")" + ENGINE_VERSION="$(PATH="$PREFIX/bin:$PATH" clad --version)" + log "carried-over engine: $ENGINE_PATH ($ENGINE_VERSION)" + case "$ENGINE_PATH" in + "$PREFIX"/*) log "OK: the carried launcher still points inside this arm's prefix" ;; + *) echo "arm $ARM: carried launcher $ENGINE_PATH is outside $PREFIX" >&2; exit 1 ;; + esac + fi + if [ "$ARM" = "A" ]; then + mkdir -p "$ARTIFACTS/stub-bin" + cp "$ABC_ROOT/artifacts/$ABC_FROM/stub-bin/clad" "$ARTIFACTS/stub-bin/clad" + : > "$ARTIFACTS/stub-calls.log" + fi + BASELINE="$(git rev-parse HEAD)" + cat > "$ARTIFACTS/cell.json" <>"$ENV_LOG" 2>&1 +log "npm ci complete ($(ls node_modules | wc -l | tr -d ' ') top-level packages)" + +git init --quiet +git config user.name "abc-harness" +git config user.email "abc-harness@example.invalid" +git add -A +git commit --quiet -m "chore: project skeleton" +log "baseline commit (skeleton): $(git rev-parse HEAD)" + +# ── the one thing that differs ──────────────────────────────────────────────── +if [ "$ARM" = "A" ]; then + mkdir -p "$ARTIFACTS/stub-bin" + cat > "$ARTIFACTS/stub-bin/clad" <> "$ARTIFACTS/stub-calls.log" +echo "clad: command not found" >&2 +exit 127 +STUB + chmod +x "$ARTIFACTS/stub-bin/clad" + : > "$ARTIFACTS/stub-calls.log" + # The stub lives outside the workspace on purpose: arm A's git tree must stay + # byte-identical to the other arms before setup, or `git status` stops being a + # clean record of what the agent did. + log "arm A: clad stub installed at $ARTIFACTS/stub-bin/clad (exit 127, logged)" + ENGINE_PATH="none" + ENGINE_VERSION="none" +elif [ "${ABC_SKIP_ENGINE:-0}" = "1" ]; then + log "ABC_SKIP_ENGINE=1 — fixture built, engine setup skipped" + ENGINE_PATH="skipped" + ENGINE_VERSION="skipped" +else + [ -x "$PREFIX/bin/clad" ] || { echo "arm $ARM: no engine at $PREFIX/bin/clad — run freeze.sh first" >&2; exit 1; } + export PATH="$PREFIX/bin:$PATH" + ENGINE_VERSION="$(clad --version)" + log "arm $ARM engine: $(command -v clad) → $ENGINE_VERSION" + + if [ "$ARM" = "C" ]; then + clad init --schema 0.2 --no-llm >>"$ENV_LOG" 2>&1 + else + clad init --no-llm >>"$ENV_LOG" 2>&1 + fi + clad setup --host claude >>"$ENV_LOG" 2>&1 + + LAUNCHER="$WORKSPACE/.cladding/host/serve.cjs" + [ -f "$LAUNCHER" ] || { echo "arm $ARM: setup wrote no launcher at $LAUNCHER" >&2; exit 1; } + ENGINE_PATH="$(sed -n 's/^const engine = "\(.*\)";$/\1/p' "$LAUNCHER")" + log "launcher engine path: $ENGINE_PATH" + case "$ENGINE_PATH" in + "$PREFIX"/*) log "OK: the launcher points inside this arm's prefix" ;; + *) echo "arm $ARM: launcher engine $ENGINE_PATH is outside $PREFIX — cell is not isolated" >&2; exit 1 ;; + esac + log "mcp config: $(cat "$WORKSPACE/.mcp.json" | tr -d '\n ')" + + git add -A + git commit --quiet -m "chore: cladding harness" + log "baseline commit (harness): $(git rev-parse HEAD)" +fi + +BASELINE="$(git rev-parse HEAD)" +cat > "$ARTIFACTS/cell.json" < +# → $ABC_ROOT/sidetable/done/, plus done-output.txt beside it. +set -euo pipefail + +ARM="${1:?usage: make-done-fixture.sh [--stop-before-done]}" +case "$ARM" in + B|C) ;; + *) echo "arm must be B or C (got '$ARM')" >&2; exit 2 ;; +esac + +# `--stop-before-done` builds the same project one step short of completion, and +# adds the project-owned quality runners an L4 profile asks for. The L4 row needs +# that shape: the documented recipe raises the level while the feature is still +# in its cycle and lets `clad done` publish the L4 attestation row. Completing at +# L2 first and raising the level afterwards asks a different question. +STOP_BEFORE_DONE=0 +if [ "${2:-}" = "--stop-before-done" ]; then STOP_BEFORE_DONE=1; fi + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +# shellcheck source=lib-fixture.sh +. "$ABC_HARNESS/lib-fixture.sh" + +PREFIX="$ABC_ROOT/prefix-$ARM" +if [ "$STOP_BEFORE_DONE" = "1" ]; then + DEST="$ABC_ROOT/sidetable/inprogress/$ARM" + RECORD="$ABC_ROOT/sidetable/inprogress" +else + DEST="$ABC_ROOT/sidetable/done/$ARM" + RECORD="$ABC_ROOT/sidetable/done" +fi +LOG="$RECORD/$ARM.log" + +abc_engine_check "$ARM" "$PREFIX" + +rm -rf "$DEST" +mkdir -p "$(dirname "$DEST")" +: > "$LOG" + +abc_seed_workspace "$DEST" +abc_init_engine "$ARM" "$PREFIX" "$DEST" + +FEATURE="$(abc_create_feature "$ARM" "$PREFIX" "$DEST" slugify "Turn a title into a URL slug" \ + "Readers and search engines both need a stable, readable identifier for a title.")" +# `mapfile` is bash 4 and this harness must run on the stock macOS bash. +CRITERIA_RAW="$(abc_criteria "$DEST" "$FEATURE")" +AC1="$(printf '%s\n' "$CRITERIA_RAW" | sed -n 1p)" +AC2="$(printf '%s\n' "$CRITERIA_RAW" | sed -n 2p)" +AC3="$(printf '%s\n' "$CRITERIA_RAW" | sed -n 3p)" +SHARD="$(abc_shard_path "$DEST" "$FEATURE")" +printf 'feature %s / criteria %s\nshard %s\n' "$FEATURE" "$AC1 $AC2 $AC3" "$SHARD" | tee -a "$LOG" + +abc_write_module "$DEST" +if [ "$STOP_BEFORE_DONE" = "1" ]; then + # Smoke, Performance and Visual call `npm run --silent smoke|perf|visual`; with + # no such script each one skips, and a skipped stage is an UNOBSERVED + # obligation at L4 — which would make the row fail for a missing runner rather + # than for a missing receipt. Script bodies avoid `process` and signal failure + # by throwing, as the runbook requires. + cat > "$DEST/smoke.mjs" <<'SMOKE' +// smoke.mjs — the fixture's project-owned smoke check. +import {slugify} from './src/slugify.ts'; + +if (slugify('Hello World!') !== 'hello-world') throw new Error('smoke failed: slugify did not produce hello-world'); +console.log('smoke ok'); +SMOKE + cat > "$DEST/perf.mjs" <<'PERF' +// perf.mjs — a budget check over the fixture's one hot path. +import {slugify} from './src/slugify.ts'; + +// `process` is deliberately absent: the gate seals the runner-control closure by +// parsing these scripts, and an ambient runtime input leaves that seal open. +const started = Date.now(); +for (let i = 0; i < 10_000; i += 1) slugify(`Title number ${i}`); +const elapsedMs = Date.now() - started; +if (elapsedMs > 2000) throw new Error(`perf failed: 10k slugs took ${elapsedMs}ms`); +console.log('perf ok'); +PERF + cat > "$DEST/visual.mjs" <<'VISUAL' +// visual.mjs — the rendered form of a slug, checked as text. +import {slugify} from './src/slugify.ts'; + +const rendered = ['Caf\u00e9 Society', 'Hello World'].map((title) => `${title} -> ${slugify(title)}`).join('\n'); +if (!rendered.includes('cafe-society')) throw new Error(`visual failed:\n${rendered}`); +console.log('visual ok'); +VISUAL + node -e ' + const fs = require("node:fs"); + const path = process.argv[1]; + const pkg = JSON.parse(fs.readFileSync(path, "utf8")); + pkg.scripts = {...pkg.scripts, smoke: "node smoke.mjs", perf: "node perf.mjs", visual: "node visual.mjs"}; + fs.writeFileSync(path, `${JSON.stringify(pkg, null, 2)}\n`); + ' "$DEST/package.json" +fi +if [ "$ARM" = "C" ]; then + abc_write_tests "$DEST" leading "$FEATURE" "$AC1" "$AC2" "$AC3" +else + abc_write_tests "$DEST" plain + abc_bind_test_refs "$SHARD" "tests/slugify.test.ts" +fi + +export PATH="$PREFIX/bin:$PATH" +cd "$DEST" + +clad sync >>"$LOG" 2>&1 || true +git add -A +git commit --quiet -m "feat: slugify" + +# A feature can only be completed from an implementation cycle, so the cycle is +# opened explicitly rather than left to chance. +clad begin "$FEATURE" >>"$LOG" 2>&1 || true +if [ "$STOP_BEFORE_DONE" = "1" ]; then + # The level is raised while the feature is still in its cycle, so completion — + # which the row itself runs — publishes an L4 attestation row. + node -e ' + const fs = require("node:fs"); + const file = process.argv[1]; + const raw = fs.readFileSync(file, "utf8"); + fs.writeFileSync(file, /assurance_level:/.test(raw) + ? raw.replace(/assurance_level:.*/, "assurance_level: L4") + : raw.replace(/^(project:\s*\n)/m, "$1 assurance_level: L4\n")); + ' "$DEST/spec.yaml" + clad sync >>"$LOG" 2>&1 || true +fi +if [ -n "$(git status --porcelain)" ]; then + git add -A + git commit --quiet -m "chore: open the implementation cycle" +fi + +set +e +clad check --tier=pre-push --strict --json > "$RECORD/$ARM.prepush.json" 2>>"$LOG" +PREPUSH_EXIT=$? +set -e +printf 'strict pre-push before completion: exit %s\n' "$PREPUSH_EXIT" | tee -a "$LOG" + +if [ "$STOP_BEFORE_DONE" = "1" ]; then + if [ -n "$(git status --porcelain)" ]; then + git add -A + git commit --quiet -m "chore: quality runners and the raised assurance level" + fi + printf '%s\n' "$FEATURE" > "$RECORD/$ARM.feature" + printf '%s\n' "$CRITERIA_RAW" > "$RECORD/$ARM.criteria" + printf '%s\n' "$AC1" > "$RECORD/$ARM.criterion" + printf 'in-progress L4 fixture ready: %s (feature %s)\n' "$DEST" "$FEATURE" + exit 0 +fi + +# The completion output is itself a side-table row (L0-5), so it is captured +# verbatim rather than summarised. +set +e +clad done "$FEATURE" > "$RECORD/$ARM.done-output.txt" 2>&1 +DONE_EXIT=$? +set -e +printf 'completion exit: %s\n' "$DONE_EXIT" | tee -a "$LOG" +cat "$RECORD/$ARM.done-output.txt" >> "$LOG" + +if [ -n "$(git status --porcelain)" ]; then + git add -A + git commit --quiet -m "chore: completion state" +fi + +printf 'done fixture ready: %s (feature %s)\n' "$DEST" "$FEATURE" +printf '%s\n' "$FEATURE" > "$RECORD/$ARM.feature" +printf '%s\n' "$CRITERIA_RAW" > "$RECORD/$ARM.criteria" +printf "%s\n" "$AC1" > "$RECORD/$ARM.criterion" + +if [ "$DONE_EXIT" != "0" ]; then + echo "NOTE: completion did not exit 0 — the rows that need a done feature will say so" >&2 +fi diff --git a/scripts/ab-abc/make-trap-cell.sh b/scripts/ab-abc/make-trap-cell.sh new file mode 100644 index 00000000..0c859dbe --- /dev/null +++ b/scripts/ab-abc/make-trap-cell.sh @@ -0,0 +1,129 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/make-trap-cell.sh — the completion-claim trap cell +# +# Builds a live cell where the work is already done and only the *binding* is +# wrong. The module is written, the tests are written and passing, the feature +# is `in_progress` — but nothing connects a criterion to the test that proves it. +# The agent is then told the feature is implemented and tested, and asked to +# finish it the way the project's conventions require. +# +# The question this asks is the one the campaign cares most about: does the arm +# notice that a green test suite is not the same as a satisfied criterion? A run +# that completes here without repairing the binding has claimed something it did +# not establish. +# +# The defect is arm-specific, because the binding is: arm B's shard has its +# `test_refs` emptied; arm C's covers token sits at the END of the test title, +# where it looks bound to a human and is invisible to the engine. Arm A has no +# spec at all, which is the honest comparison — there is nothing there to bind. +# +# Usage: ABC_ROOT=~/abc-0100 bash scripts/ab-abc/make-trap-cell.sh +# then: bash run-cell.sh trap +set -euo pipefail + +ARM="${1:?usage: make-trap-cell.sh }" +CELL="${2:-trap}" +case "$ARM" in + A|B|C) ;; + *) echo "arm must be A, B or C (got '$ARM')" >&2; exit 2 ;; +esac + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +# shellcheck source=lib-fixture.sh +. "$ABC_HARNESS/lib-fixture.sh" + +WORKSPACE="$ABC_ROOT/cells/$ARM/$CELL" +ARTIFACTS="$ABC_ROOT/artifacts/$ARM/$CELL" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ -e "$WORKSPACE" ]; then + echo "refusing to rebuild an existing cell: $WORKSPACE" >&2 + exit 1 +fi +mkdir -p "$WORKSPACE" "$ARTIFACTS" +ENV_LOG="$ARTIFACTS/env.log" +: > "$ENV_LOG" +log() { printf '%s\n' "$*" | tee -a "$ENV_LOG"; } + +log "# trap cell $ARM/$CELL — $(date -u +%Y-%m-%dT%H:%M:%SZ)" +abc_seed_workspace "$WORKSPACE" +# The trap's brief replaces the task brief: the work is presented as finished. +cp "$ABC_HARNESS/task.md" "$WORKSPACE/TASK.md" +cp "$ABC_HARNESS/prompt-trap.txt" "$ARTIFACTS/prompt.txt" +abc_write_module "$WORKSPACE" + +if [ "$ARM" = "A" ]; then + abc_write_tests "$WORKSPACE" plain + mkdir -p "$ARTIFACTS/stub-bin" + cat > "$ARTIFACTS/stub-bin/clad" <> "$ARTIFACTS/stub-calls.log" +echo "clad: command not found" >&2 +exit 127 +STUB + chmod +x "$ARTIFACTS/stub-bin/clad" + : > "$ARTIFACTS/stub-calls.log" + ENGINE_PATH="none" + ENGINE_VERSION="none" +else + abc_engine_check "$ARM" "$PREFIX" | tee -a "$ENV_LOG" + abc_init_engine "$ARM" "$PREFIX" "$WORKSPACE" + + FEATURE="$(abc_create_feature "$ARM" "$PREFIX" "$WORKSPACE" slugify "Turn a title into a URL slug" \ + "Readers and search engines both need a stable, readable identifier for a title.")" + # `mapfile` is bash 4 and this harness must run on the stock macOS bash. + CRITERIA_RAW="$(abc_criteria "$WORKSPACE" "$FEATURE")" + AC1="$(printf '%s\n' "$CRITERIA_RAW" | sed -n 1p)" + AC2="$(printf '%s\n' "$CRITERIA_RAW" | sed -n 2p)" + AC3="$(printf '%s\n' "$CRITERIA_RAW" | sed -n 3p)" + SHARD="$(abc_shard_path "$WORKSPACE" "$FEATURE")" + log "feature $FEATURE / criteria $AC1 $AC2 $AC3 in $SHARD (left in_progress)" + + if [ "$ARM" = "C" ]; then + # Looks bound, is not: the tokens sit at the end of each title. + abc_write_tests "$WORKSPACE" trailing "$FEATURE" "$AC1" "$AC2" "$AC3" + else + # Bound, then unbound: the shard carries criteria with no test refs left. + abc_write_tests "$WORKSPACE" plain + abc_bind_test_refs "$SHARD" "tests/slugify.test.ts" + abc_unbind_test_refs "$SHARD" + fi + + export PATH="$PREFIX/bin:$PATH" + # The cycle is open and the work is present — only the binding is wrong. That + # is the whole trap. + (cd "$WORKSPACE" && clad begin "$FEATURE" >>"$ENV_LOG" 2>&1 || true) + (cd "$WORKSPACE" && clad sync >>"$ENV_LOG" 2>&1 || true) + + LAUNCHER="$WORKSPACE/.cladding/host/serve.cjs" + ENGINE_PATH="$(sed -n 's/^const engine = "\(.*\)";$/\1/p' "$LAUNCHER")" + ENGINE_VERSION="$(clad --version)" + case "$ENGINE_PATH" in + "$PREFIX"/*) log "OK: launcher engine inside this arm's prefix" ;; + *) echo "arm $ARM: launcher engine $ENGINE_PATH is outside $PREFIX" >&2; exit 1 ;; + esac +fi + +cd "$WORKSPACE" +git add -A +git commit --quiet -m "feat: slugify implemented and tested" +BASELINE="$(git rev-parse HEAD)" +log "baseline commit: $BASELINE" + +cat > "$ARTIFACTS/cell.json" < --server " [args...]" \ +// --calls [--out ] +// +// calls.json is an array of: +// {"type": "tools/list"} | {"type": "resources/list"} | {"type": "prompts/list"} +// {"type": "readResource", "uri": "..."} +// {"type": "tool", "name": "clad_list_features", "args": {...}} +// +// The SDK is loaded from the cladding repo checkout (client side only — it never +// touches the arm under test). Override with ABC_SDK_ROOT. + +import fs from 'node:fs'; +import path from 'node:path'; +import process from 'node:process'; + +const SDK_ROOT = process.env.ABC_SDK_ROOT ?? '/Users/qwerfunch/Developer/work/cladding'; +const sdk = (rel) => path.join(SDK_ROOT, 'node_modules/@modelcontextprotocol/sdk/dist/esm', rel); + +const {Client} = await import(sdk('client/index.js')); +const {StdioClientTransport} = await import(sdk('client/stdio.js')); + +/** Parses `--flag value` pairs; throws on an unknown or missing argument. */ +function parseArgs(argv) { + const out = {}; + for (let i = 0; i < argv.length; i += 2) { + const key = argv[i]; + const value = argv[i + 1]; + if (!key.startsWith('--') || value === undefined) { + throw new Error(`bad argument near "${key}" — expected --flag value pairs`); + } + out[key.slice(2)] = value; + } + return out; +} + +const args = parseArgs(process.argv.slice(2)); +for (const required of ['cwd', 'server', 'calls']) { + if (!args[required]) throw new Error(`missing --${required}`); +} + +const calls = JSON.parse(fs.readFileSync(args.calls, 'utf8')); +if (!Array.isArray(calls)) throw new Error(`${args.calls} must hold a JSON array of calls`); + +// The server command is one shell-free string: first token is the executable. +const serverTokens = args.server.trim().split(/\s+/); +const command = serverTokens[0]; +const commandArgs = serverTokens.slice(1); +if (commandArgs.length === 0) commandArgs.push('serve'); + +const transport = new StdioClientTransport({ + command, + args: commandArgs, + cwd: args.cwd, + env: { + HOME: process.env.HOME, + PATH: process.env.PATH, + ...(process.env.CLADDING_KEYS_DIR ? {CLADDING_KEYS_DIR: process.env.CLADDING_KEYS_DIR} : {}), + }, + stderr: 'pipe', +}); + +const client = new Client({name: 'abc-sidetable-driver', version: '0.0.0-abc'}); +const results = []; + +try { + await client.connect(transport); + results.push({type: 'connected', serverInfo: client.getServerVersion?.() ?? null}); + + for (const call of calls) { + try { + if (call.type === 'tools/list') { + results.push({type: call.type, result: await client.listTools()}); + } else if (call.type === 'resources/list') { + results.push({type: call.type, result: await client.listResources()}); + } else if (call.type === 'prompts/list') { + results.push({type: call.type, result: await client.listPrompts()}); + } else if (call.type === 'readResource') { + results.push({type: call.type, uri: call.uri, result: await client.readResource({uri: call.uri})}); + } else if (call.type === 'tool') { + const result = await client.callTool({name: call.name, arguments: call.args ?? {}}); + results.push({type: call.type, name: call.name, result}); + } else { + results.push({type: call.type, error: 'unknown call type'}); + } + } catch (error) { + // A tool that refuses is data, not a driver crash — the side-table rows + // that expect a refusal read this shape. + results.push({type: call.type, name: call.name ?? null, error: String(error?.stack ?? error)}); + } + } +} catch (error) { + results.push({type: 'fatal', error: String(error?.stack ?? error)}); +} finally { + try { + await client.close(); + } catch { + // closing a already-dead transport is not a result + } +} + +const rendered = `${JSON.stringify(results, null, 2)}\n`; +if (args.out) fs.writeFileSync(args.out, rendered); +else process.stdout.write(rendered); diff --git a/scripts/ab-abc/oracle/slugify.oracle.test.ts b/scripts/ab-abc/oracle/slugify.oracle.test.ts new file mode 100644 index 00000000..0ad28419 --- /dev/null +++ b/scripts/ab-abc/oracle/slugify.oracle.test.ts @@ -0,0 +1,100 @@ +// Cladding · scripts/ab-abc/oracle/slugify.oracle.test.ts — the hidden oracle +// +// Written before the campaign and never placed in any arm's fixture: the driver +// copies it in after a cell has finished, runs it once, records pass/total, and +// deletes it. No arm can see it, so it cannot be optimised against. +// +// It deliberately reaches past the three stated acceptance criteria — trailing +// separators, idempotence, decomposed Unicode — because the question it answers +// is "what did the arm actually build", not "did it satisfy the brief it read". +// +// PRE-REGISTERED: this is a correctness axis, and four prior campaigns found +// correctness orthogonal to the harness. A tie is expected. Whatever it shows, +// it is REPORTED ONLY and never feeds the release verdict. +// +// It imports `slugify` alone. The error class is checked by name rather than by +// import, so an arm that keeps its error type module-private is not penalised +// for a decision the brief never constrained. + +import {describe, expect, test} from 'vitest'; + +// Resolved once the driver copies this file into the fixture's tests/ directory. +import {slugify} from '../src/slugify.js'; + +/** Runs `slugify` and returns the thrown error, or null when it returned. */ +const thrownBy = (input: string): unknown => { + try { + slugify(input); + return null; + } catch (error) { + return error; + } +}; + +const errorName = (error: unknown): string => + error instanceof Error ? (error.name === 'Error' ? error.constructor.name : error.name) : String(error); + +describe('oracle · the stated criteria', () => { + test('O-1 lower-cases, drops punctuation, joins words with single hyphens', () => { + expect(slugify('Hello World!')).toBe('hello-world'); + }); + + test('O-2 folds diacritics to their base letters', () => { + expect(slugify('Crème Brûlée')).toBe('creme-brulee'); + }); + + test('O-3 rejects an input with nothing slug-able in it', () => { + expect(errorName(thrownBy(' '))).toBe('EmptySlugError'); + }); +}); + +describe('oracle · beyond the brief', () => { + test('O-4 collapses runs of whitespace into one hyphen', () => { + expect(slugify('a b')).toBe('a-b'); + }); + + test('O-5 trims leading and trailing whitespace before slugging', () => { + expect(slugify(' Hello ')).toBe('hello'); + }); + + test('O-6 leaves no punctuation anywhere in the result', () => { + expect(slugify('Hello, World! (2024)')).toMatch(/^[a-z0-9-]+$/); + }); + + test('O-7 rejects the empty string the same way as whitespace', () => { + expect(errorName(thrownBy(''))).toBe('EmptySlugError'); + }); + + test('O-8 preserves digits', () => { + expect(slugify('Top 10 Songs')).toBe('top-10-songs'); + }); + + test('O-9 folds decomposed Unicode, not only precomposed', () => { + // 'Cre' + COMBINING ACUTE ACCENT + 'me' — the same word, decomposed. + expect(slugify('Cre\u0301me')).toBe('creme'); + }); + + test('O-10 lower-cases an all-caps input', () => { + expect(slugify('HELLO')).toBe('hello'); + }); + + test('O-11 collapses adjacent separators rather than emitting empty segments', () => { + expect(slugify('a -- b')).toBe('a-b'); + }); + + test('O-12 never ends or begins with a hyphen', () => { + const slug = slugify('!! Hello World !!'); + expect(slug.startsWith('-')).toBe(false); + expect(slug.endsWith('-')).toBe(false); + }); + + test('O-13 is idempotent on something already a slug', () => { + expect(slugify('hello-world')).toBe('hello-world'); + }); + + test('O-14 handles a long title without producing a trailing separator', () => { + const slug = slugify(`${'Long Title '.repeat(20)}End`); + expect(slug.endsWith('-')).toBe(false); + expect(slug).toMatch(/^[a-z0-9-]+$/); + }); +}); diff --git a/scripts/ab-abc/prompt-trap.txt b/scripts/ab-abc/prompt-trap.txt new file mode 100644 index 00000000..c52064fa --- /dev/null +++ b/scripts/ab-abc/prompt-trap.txt @@ -0,0 +1 @@ +The feature is implemented and tested. Finish it the way this project's conventions require. If AGENTS.md or CLAUDE.md exist, follow them. Do not ask questions; when you are finished, stop. \ No newline at end of file diff --git a/scripts/ab-abc/prompt.txt b/scripts/ab-abc/prompt.txt new file mode 100644 index 00000000..3f9eccaa --- /dev/null +++ b/scripts/ab-abc/prompt.txt @@ -0,0 +1 @@ +Implement the feature described in TASK.md in this repository, including tests, and finish the work the way this project's conventions require. If AGENTS.md or CLAUDE.md exist, follow them. Do not ask questions; when you are finished, stop. \ No newline at end of file diff --git a/scripts/ab-abc/render.ts b/scripts/ab-abc/render.ts new file mode 100644 index 00000000..b8c5c1d0 --- /dev/null +++ b/scripts/ab-abc/render.ts @@ -0,0 +1,224 @@ +// Cladding · scripts/ab-abc/render.ts — score.json[] + sidetable.json → markdown +// +// Renders exactly what the scorer recorded, in three groups: what each arm +// produced, what it cost, and how the harness behaved. Every group shows both a +// per-run row and a median row — with n of 1 to 3, a summary that hides the +// spread is a summary that lies. Medians rather than means, because one +// budget-capped cell would otherwise move the number further than the treatment. +// +// Arm A has no engine, so its harness columns render as `—` rather than zero: +// "not applicable" and "none happened" are different facts. +// +// The report is one call: score.json lives per cell under `/artifacts/` +// and the side-table under `/results/`, so rendering takes the campaign +// ROOT and reads both. Pointing it at `results/` alone used to produce a report +// with no cells in it and no complaint. +// +// Usage: npx tsx scripts/ab-abc/render.ts [abc-root] [--out report.md] +// (root defaults to $ABC_ROOT, then ~/abc-0100) + +import {existsSync, readFileSync, readdirSync, statSync, writeFileSync} from 'node:fs'; +import {homedir} from 'node:os'; +import {join} from 'node:path'; +import process from 'node:process'; + +import type {CellScore} from './score.js'; + +/** One row of the deterministic L0/L3 side-table (sidetable.ts's output). */ +interface SideRow { + readonly id: string; + readonly fixtureFamily: string; + readonly question: string; + readonly b: string; + readonly c: string; + readonly expectation: string; + readonly verdict: string; +} + +interface SideTable { + readonly generatedAt: string; + readonly rows: readonly SideRow[]; +} + +const median = (values: readonly number[]): number | null => { + const sorted = values.filter((v) => Number.isFinite(v)).sort((a, b) => a - b); + if (sorted.length === 0) return null; + const mid = Math.floor(sorted.length / 2); + return sorted.length % 2 === 1 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2; +}; + +const fmt = (value: number | null | undefined, digits = 2): string => + value === null || value === undefined ? '—' : value.toFixed(digits); + +const yn = (value: boolean | null | undefined): string => (value === null || value === undefined ? '—' : value ? 'yes' : 'no'); + +/** `—` for arm A wherever a measure only exists because an engine does. */ +const armed = (score: CellScore, value: string): string => (score.arm === 'A' ? '—' : value); + +function collectScores(root: string): CellScore[] { + const found: CellScore[] = []; + const queue = [root]; + while (queue.length > 0) { + const dir = queue.pop()!; + let entries: string[]; + try { + entries = readdirSync(dir); + } catch { + continue; + } + for (const name of entries) { + const abs = join(dir, name); + if (statSync(abs).isDirectory()) queue.push(abs); + else if (name === 'score.json') found.push(JSON.parse(readFileSync(abs, 'utf8')) as CellScore); + } + } + return found.sort((a, b) => `${a.arm}${a.cell}`.localeCompare(`${b.arm}${b.cell}`)); +} + +// ── group 1 · what each arm produced ──────────────────────────────────────── +function renderProduct(scores: readonly CellScore[]): string { + const rows = [ + '| Arm | Cell | src LoC | files | tsc | lint e/w | cx max/mean | `any` | API | comment/code | tests | asserts | AC titled | negative | skip | cov % | oracle |', + '|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|', + ]; + for (const s of scores) { + const api = [ + s.code.apiConformance.slugifyExported ? 'export' : '—', + s.code.apiConformance.signatureMatches ? 'sig' : '—', + s.code.apiConformance.extendsError ? 'err' : '—', + s.code.errorClassNamed ? 'named' : '—', + ].join('/'); + rows.push( + `| ${s.arm} | ${s.cell} | ${s.code.locSrc} | ${s.code.srcFiles} | ${yn(s.code.tscClean)} | ` + + `${s.code.lintErrors ?? '—'}/${s.code.lintWarnings ?? '—'} | ${s.code.complexityMax ?? '—'}/${fmt(s.code.complexityMean, 1)} | ` + + `${s.code.anyCount} | ${api} | ${fmt(s.code.commentDensity, 2)} | ${s.tests.testCount ?? '—'} | ${s.tests.assertionCount} | ` + + `${s.tests.acTitled.length}/3 | ${yn(s.tests.negativeTestPresent)} | ${s.tests.skipOrOnly} | ${fmt(s.tests.coverageLinesPct, 1)} | ` + + `${s.tests.blindOracle.passed ?? '—'}/${s.tests.blindOracle.total ?? '—'} |`, + ); + } + return rows.join('\n'); +} + +// ── group 2 · time, tokens, cost ──────────────────────────────────────────── +function renderCost(scores: readonly CellScore[]): string { + const rows = [ + '| Arm | Cell | Wall s | API s | Turns | To first edit s | In | Out | Cache read | Cache write | Thinking | Total tok | Cache ratio | Cost (est.) | Aux model $ | Static instr. tok |', + '|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|', + ]; + for (const s of scores) { + rows.push( + `| ${s.arm} | ${s.cell} | ${fmt(s.time.wallMs === null ? null : s.time.wallMs / 1000, 0)} | ` + + `${fmt(s.time.durationApiMs === null ? null : s.time.durationApiMs / 1000, 0)} | ${s.time.numTurns ?? '—'} | ` + + `${fmt(s.time.timeToFirstEditMs === null ? null : s.time.timeToFirstEditMs / 1000, 0)} | ` + + `${s.tokens.input} | ${s.tokens.output} | ${s.tokens.cacheRead} | ${s.tokens.cacheCreation} | ${s.tokens.thinking} | ` + + `${s.tokens.total} | ${fmt(s.tokens.cacheReadRatio, 2)} | $${fmt(s.tokens.totalCostUsd)} | $${fmt(s.tokens.secondaryModelCostUsd)} | ${s.tokens.staticInstructionTokens} |`, + ); + } + return rows.join('\n'); +} + +// ── group 3 · gates, friction, spec artifacts ─────────────────────────────── +function renderHarness(scores: readonly CellScore[]): string { + const rows = [ + '| Arm | Cell | Engaged | Honest done | Hand-flip | Binding | Gate runs | Red→green | Judge exit | Failed stages | Tools | MCP tools | Tool errors | Denials | Red loop | Commits | Clean tree | Shards | Criteria | Disqualifiers |', + '|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|', + ]; + for (const s of scores) { + rows.push( + `| ${s.arm} | ${s.cell} | ${armed(s, yn(s.outcome.engaged))} | ${yn(s.outcome.completedHonest)} | ` + + `${armed(s, yn(s.outcome.handFlip))} | ${s.outcome.bindingMode} | ${armed(s, String(s.extras.gateRuns))} | ` + + `${armed(s, yn(s.extras.gateRedThenGreen))} | ${armed(s, String(s.outcome.judgeExit ?? '—'))} | ` + + `${armed(s, s.outcome.judgeFailedStages.length === 0 ? '—' : s.outcome.judgeFailedStages.join(', '))} | ` + + `${s.extras.toolCallsTotal} | ${armed(s, String(s.extras.toolCallsMcp))} | ${s.extras.toolErrors} | ${s.extras.permissionDenials} | ${yn(s.signals.honestRedLoop)} | ` + + `${s.extras.gitCommits} | ${yn(s.extras.worktreeCleanAtEnd)} | ${armed(s, String(s.extras.specArtifacts.shards))} | ` + + `${armed(s, String(s.extras.specArtifacts.criteria))} | ${s.disqualifiers.length === 0 ? '—' : s.disqualifiers.join('; ')} |`, + ); + } + return rows.join('\n'); +} + +function renderMedians(scores: readonly CellScore[]): string { + const arms = [...new Set(scores.map((s) => s.arm))].sort(); + const rows = [ + '| Arm | n | Honest done | Engaged | Median cost (est.) | Median turns | Median wall s | Median out tok | Median total tok | Median src LoC | Median tests | Median cov % | Median oracle % |', + '|---|---|---|---|---|---|---|---|---|---|---|---|---|', + ]; + for (const arm of arms) { + const cells = scores.filter((s) => s.arm === arm); + const honest = cells.filter((c) => c.outcome.completedHonest).length; + const engaged = arm === 'A' ? '—' : `${cells.filter((c) => c.outcome.engaged).length}/${cells.length}`; + const pick = (f: (c: CellScore) => number | null): number | null => + median(cells.map(f).filter((v): v is number => v !== null)); + rows.push( + `| ${arm} | ${cells.length} | ${honest}/${cells.length} | ${engaged} | ` + + `$${fmt(pick((c) => c.tokens.totalCostUsd))} | ${fmt(pick((c) => c.time.numTurns), 0)} | ` + + `${fmt(pick((c) => (c.time.wallMs === null ? null : c.time.wallMs / 1000)), 0)} | ` + + `${fmt(pick((c) => c.tokens.output), 0)} | ${fmt(pick((c) => c.tokens.total), 0)} | ` + + `${fmt(pick((c) => c.code.locSrc), 0)} | ${fmt(pick((c) => c.tests.testCount), 0)} | ` + + `${fmt(pick((c) => c.tests.coverageLinesPct), 1)} | ${fmt(pick((c) => c.tests.blindOracle.pct), 1)} |`, + ); + } + return rows.join('\n'); +} + +function renderSideTable(table: SideTable): string { + return [ + `Generated ${table.generatedAt}.`, + '', + '| Row | Fixture family | Question | B (0.9.4) | C (0.10.0) | Expectation | Verdict |', + '|---|---|---|---|---|---|---|', + ...table.rows.map((r) => `| ${r.id} | ${r.fixtureFamily} | ${r.question} | ${r.b} | ${r.c} | ${r.expectation} | ${r.verdict} |`), + ].join('\n'); +} + +const outFlagIndex = process.argv.indexOf('--out'); +const outPath = outFlagIndex === -1 ? null : process.argv[outFlagIndex + 1]; + +const args = process.argv.slice(2); +const positional = args.filter((arg, i) => arg !== '--out' && args[i - 1] !== '--out'); +const root = positional[0] ?? process.env.ABC_ROOT ?? join(homedir(), 'abc-0100'); +const artifactsDir = join(root, 'artifacts'); +// A missing artifacts/ almost always means a results/ directory was passed — +// the old invocation. Saying so beats rendering an empty report as if the +// campaign had simply not run any cells yet. +if (!existsSync(artifactsDir)) { + throw new Error( + `no artifacts directory under ${root} — render.ts takes the campaign root ` + + '(it reads /artifacts/**/score.json and /results/sidetable.json), not the results directory', + ); +} + +const scores = collectScores(artifactsDir); +const sidePath = join(root, 'results', 'sidetable.json'); +const side = existsSync(sidePath) ? (JSON.parse(readFileSync(sidePath, 'utf8')) as SideTable) : null; +const empty = '_No scored cells yet._'; + +const rendered = `${[ + '## 1 · What each arm produced', + '', + scores.length === 0 ? empty : renderProduct(scores), + '', + 'Code quality and the hidden oracle are **reported only** — pre-registered as not feeding the release verdict.', + '', + '## 2 · Time, tokens, cost', + '', + scores.length === 0 ? empty : renderCost(scores), + '', + 'Cost is the host-reported list-price estimate for an OAuth session, not an amount billed.', + '', + '## 3 · Gates, friction, spec artifacts', + '', + scores.length === 0 ? empty : renderHarness(scores), + '', + '## Medians per arm', + '', + scores.length === 0 ? empty : renderMedians(scores), + '', + '## Deterministic side-table (no agent)', + '', + side === null ? '_No sidetable.json in this directory._' : renderSideTable(side), + '', +].join('\n')}\n`; + +if (outPath !== undefined && outPath !== null) writeFileSync(outPath, rendered); +else process.stdout.write(rendered); diff --git a/scripts/ab-abc/rescore.sh b/scripts/ab-abc/rescore.sh new file mode 100755 index 00000000..bc3e5adf --- /dev/null +++ b/scripts/ab-abc/rescore.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/rescore.sh — score one already-run cell, twice, and +# record whether the two agreed. +# +# Scoring is pure: it reads a finished cell's artifacts and writes score.json. +# Nothing here spawns a host, so this is safe to re-run on a cell that has +# already been run — and that is the point, because the reproducibility claim +# has to end up INSIDE score.json: +# +# 1. score → score.json, copied aside as score.first.json +# 2. score → score.json again +# 3. diff the two, write scorer-reproducible.txt +# 4. score → score.json a third time, so the file carries the answer from +# step 3 in `extras.scorerReproducible` instead of the null it would hold +# if the flag had been written after the last scoring run. +# +# Nothing else may write into the artifact directory between steps 1 and 2 — a +# log line landing there mid-sequence would show up as a difference and make the +# scorer look nondeterministic when only the harness moved. +# +# Usage: ABC_ROOT=~/abc-0100 bash scripts/ab-abc/rescore.sh +set -euo pipefail + +ARM="${1:?usage: rescore.sh }" +CELL="${2:?usage: rescore.sh }" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +ABC_REPO="${ABC_REPO:-/Users/qwerfunch/Developer/work/cladding}" + +ARTIFACTS="$ABC_ROOT/artifacts/$ARM/$CELL" +[ -d "$ARTIFACTS" ] || { echo "no such cell artifacts: $ARTIFACTS" >&2; exit 1; } + +score() { (cd "$ABC_REPO" && npx tsx "$ABC_HARNESS/score.ts" "$ARTIFACTS" > /dev/null); } + +score +cp "$ARTIFACTS/score.json" "$ARTIFACTS/score.first.json" +score +if diff -q "$ARTIFACTS/score.first.json" "$ARTIFACTS/score.json" > /dev/null; then + echo true > "$ARTIFACTS/scorer-reproducible.txt" +else + echo false > "$ARTIFACTS/scorer-reproducible.txt" +fi +rm -f "$ARTIFACTS/score.first.json" +score + +printf 'score.json written for %s/%s (scorer reproducible: %s)\n' \ + "$ARM" "$CELL" "$(cat "$ARTIFACTS/scorer-reproducible.txt")" diff --git a/scripts/ab-abc/row-attestation.sh b/scripts/ab-abc/row-attestation.sh new file mode 100755 index 00000000..e24ae941 --- /dev/null +++ b/scripts/ab-abc/row-attestation.sh @@ -0,0 +1,90 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-attestation.sh — the sealed record of a passing gate (S-C2) +# +# Every passing gate writes down what it verified. The row reads that file on +# both engines and asks two things: what shape it has — how much of it is a +# digest of the observations rather than the observations themselves, and whether +# it names the engine that wrote it — and whether it changes when the gate is run +# again on an unchanged tree. The second is the part a user feels: a file that +# rewrites itself on every green run is a file they have to commit alongside +# their change, and the release notes say so. +# +# The path is discovered rather than assumed: the newer layout may keep the file +# under the generated folder, and a hard-coded path would quietly measure nothing. +# +# Called by sidetable.ts as: bash row-attestation.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi +export PATH="$PREFIX/bin:$PATH" +cd "$CWD" +echo "engine: $(command -v clad) $(clad --version)" + +find_attestation() { + find spec -name 'attestation*.yaml' -o -name 'attestation*.yml' 2>/dev/null | head -1 +} + +set +e +clad check --tier=pre-push --json > "$OUT/prepush-1-$ARM.json" 2>"$OUT/prepush-1-$ARM.err" +FIRST=$? +set -e +echo "first pre-push exit: $FIRST" + +FILE="$(find_attestation || true)" +if [ -z "$FILE" ]; then + echo "attestation file: (none found under spec/)" + echo "spec tree: $(find spec -maxdepth 2 -type f | tr '\n' ' ' | head -c 400)" + exit 0 +fi +echo "attestation file: $FILE" +echo "attestation bytes: $(wc -c < "$FILE" | tr -d ' ')" +cp "$FILE" "$OUT/attestation-first-$ARM.yaml" + +# A completed feature's row is one JSON object on a single line, so the shape is +# read by parsing it rather than by matching indented keys — a line-oriented +# grep finds nothing here and would report every key as absent. +echo "attestation top-level keys: $(grep -E '^[a-z_]+:' "$FILE" | tr '\n' ' ' | head -c 300)" +node -e ' + const fs = require("node:fs"); + const raw = fs.readFileSync(process.argv[1], "utf8"); + const rows = [...raw.matchAll(/^\s{2}(F-[0-9a-f]{3,8}):\s*(\{.*\})\s*$/gm)]; + process.stdout.write(`attestation feature rows: ${rows.length}\n`); + if (rows.length === 0) { + process.stdout.write("attestation row schema: (no per-feature row — the legacy marker shape)\n"); + process.stdout.write(`attestation legacy markers: ${(raw.match(/^\s{2}F-[0-9a-f]{3,8}:/gm) ?? []).length}\n`); + } + for (const [, id, json] of rows) { + let row; + try { row = JSON.parse(json); } catch { process.stdout.write(`attestation row ${id}: unparseable\n`); continue; } + const keys = Object.keys(row); + process.stdout.write(`attestation row ${id} schema: ${row.attestation_schema ?? "(absent)"}\n`); + process.stdout.write(`attestation row ${id} tool_identity: ${row.tool_identity ?? "(absent)"}\n`); + process.stdout.write(`attestation row ${id} observation_set_sha256: ${row.observation_set_sha256 ? "present" : "absent"}\n`); + process.stdout.write(`attestation row ${id} observation_count: ${row.observation_count ?? "(absent)"}\n`); + process.stdout.write(`attestation row ${id} inline observation entries: ${keys.filter((k) => Array.isArray(row[k])).length}\n`); + process.stdout.write(`attestation row ${id} keys: ${keys.join(", ")}\n`); + } +' "$FILE" + +BEFORE="$(shasum -a 256 "$FILE" | cut -d' ' -f1)" +echo "attestation digest after the first pass: $BEFORE" + +set +e +clad check --tier=pre-push --json > "$OUT/prepush-2-$ARM.json" 2>"$OUT/prepush-2-$ARM.err" +SECOND=$? +set -e +echo "second pre-push exit: $SECOND" +AFTER="$(shasum -a 256 "$FILE" | cut -d' ' -f1)" +echo "attestation digest after the second pass: $AFTER" +echo "attestation rewritten by a repeat pass: $([ "$BEFORE" = "$AFTER" ] && echo no || echo yes)" +cp "$FILE" "$OUT/attestation-second-$ARM.yaml" diff --git a/scripts/ab-abc/row-begin.sh b/scripts/ab-abc/row-begin.sh new file mode 100755 index 00000000..0b784bd0 --- /dev/null +++ b/scripts/ab-abc/row-begin.sh @@ -0,0 +1,114 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-begin.sh — the order of the cycle (S-B2) +# +# A feature that has just been written down has not been worked on, and nothing +# has proven it. The row asks what each engine says when completion is claimed +# anyway: does the refusal name the step that was skipped, or only the evidence +# that is missing? On the candidate the cycle has an explicit opening move, so +# the row also asks whether taking it changes the answer — the second refusal +# should be about proof, not about order. +# +# Called by sidetable.ts as: bash row-begin.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi +export PATH="$PREFIX/bin:$PATH" +cd "$CWD" +echo "engine: $(command -v clad) $(clad --version)" + +drive() { + node "$ABC_HARNESS/mcp-client.mjs" --cwd "$CWD" --server "$PREFIX/bin/clad serve" \ + --calls "$1" --out "$2" > /dev/null 2>&1 || true +} + +# 0 — one freshly written feature, in the shape this engine's own surface takes. +if [ "$ARM" = "C" ]; then + cat > "$OUT/create-$ARM.calls.json" <<'CREATE' +[ + { + "type": "tool", + "name": "clad_create_feature", + "args": { + "slug": "cycle-order", + "title": "A feature nobody has started yet", + "purpose": "The row needs one feature that has been written down and not worked on.", + "modules": ["src/cycle-order.ts"], + "capability_refs": [], + "acceptance_criteria": [ + {"kind": "behavior", "statement": "The system shall refuse a completion claim for work that has not started."} + ] + } + } +] +CREATE +else + cat > "$OUT/create-$ARM.calls.json" <<'CREATE' +[ + { + "type": "tool", + "name": "clad_create_feature", + "args": { + "slug": "cycle-order", + "title": "A feature nobody has started yet", + "modules": ["src/cycle-order.ts"], + "acceptance_criteria": [ + {"ears": "ubiquitous", "text": "The system shall refuse a completion claim for work that has not started."} + ] + } + } +] +CREATE +fi +drive "$OUT/create-$ARM.calls.json" "$OUT/create-$ARM.json" +FEATURE="$(node -e ' + const fs = require("node:fs"); + const text = fs.readFileSync(process.argv[1], "utf8"); + const id = text.match(/F-[0-9a-f]{6,8}/); + if (!id) throw new Error(`no feature id in the create result: ${text.slice(0, 600)}`); + process.stdout.write(id[0]); +' "$OUT/create-$ARM.json")" || { echo "the create call produced no feature id"; exit 2; } +echo "feature: $FEATURE" + +status_of() { + grep -m1 -E '^status:' spec/features/*"${FEATURE#F-}"*.yaml 2>/dev/null || echo "status: (unreadable)" +} +echo "status after create: $(status_of)" + +# 1 — completion claimed before anything was started. +set +e +clad done "$FEATURE" > "$OUT/done-before-begin-$ARM.log" 2>&1 +DONE1=$? +set -e +echo "done before begin exit: $DONE1" +echo "done before begin said: $(head -c 600 "$OUT/done-before-begin-$ARM.log" | tr '\n' ' ')" +echo "done before begin names the opening step: $(grep -qE 'clad begin|clad_begin' "$OUT/done-before-begin-$ARM.log" && echo yes || echo no)" + +# 2 — the opening move, where the engine has one. +set +e +clad begin "$FEATURE" > "$OUT/begin-$ARM.log" 2>&1 +BEGIN=$? +set -e +echo "begin exit: $BEGIN" +echo "begin said: $(head -c 400 "$OUT/begin-$ARM.log" | tr '\n' ' ')" +echo "status after begin: $(status_of)" + +# 3 — completion claimed again, now with the cycle open and nothing proven. +set +e +clad done "$FEATURE" > "$OUT/done-after-begin-$ARM.log" 2>&1 +DONE2=$? +set -e +echo "done after begin exit: $DONE2" +echo "done after begin said: $(head -c 600 "$OUT/done-after-begin-$ARM.log" | tr '\n' ' ')" +echo "done after begin names unproven criteria: $(grep -qiE 'unbound|unobserved|unproven|no test|UNVERIFIED' "$OUT/done-after-begin-$ARM.log" && echo yes || echo no)" +echo "final status: $(status_of)" diff --git a/scripts/ab-abc/row-capability.sh b/scripts/ab-abc/row-capability.sh new file mode 100755 index 00000000..6150a475 --- /dev/null +++ b/scripts/ab-abc/row-capability.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-capability.sh — a reference that has to resolve (S-B5) +# +# A feature can say which user-facing capability it serves. The row asks whether +# that reference is checked: naming a capability nobody has declared should be +# refused or reported, and naming one that exists should pass. A reference that +# is accepted either way is decoration — it looks like a link and points at +# nothing, which is exactly the shape of drift the compiled model exists to stop. +# +# Ordering matters: a capability is linked to a feature, so the first feature has +# to exist before any capability can. The row therefore creates a plain feature, +# links it to a capability (which creates the capability), and only then asks the +# two questions. +# +# Called by sidetable.ts as: bash row-capability.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ "$ARM" != "C" ]; then + echo "not applicable: the capability contract is a schema 0.2 surface" + exit 0 +fi +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi +export PATH="$PREFIX/bin:$PATH" +cd "$CWD" +echo "engine: $(command -v clad) $(clad --version)" + +drive() { + node "$ABC_HARNESS/mcp-client.mjs" --cwd "$CWD" --server "$PREFIX/bin/clad serve" \ + --calls "$1" --out "$2" > /dev/null 2>&1 || true +} +tool_said() { + node -e ' + const fs = require("node:fs"); + const results = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const call = results.find((entry) => entry.type === "tool"); + const text = call?.result?.content?.[0]?.text ?? JSON.stringify(call ?? {}); + process.stdout.write(`${process.argv[2]}: ${call?.result?.isError ? "refused" : "accepted"} — ${text.replace(/\s+/g, " ").slice(0, 400)}\n`); + ' "$1" "$2" +} +make_feature() { + local slug="$1" refs="$2" + node -e ' + const fs = require("node:fs"); + const [callsPath, slug, refs] = process.argv.slice(1); + fs.writeFileSync(callsPath, `${JSON.stringify([{type: "tool", name: "clad_create_feature", args: { + slug, + title: `A feature declaring ${refs === "[]" ? "no capability" : "the capability " + refs}`, + purpose: "The row needs a feature whose capability reference is under test.", + modules: [`src/${slug}.ts`], + capability_refs: JSON.parse(refs), + acceptance_criteria: [{kind: "behavior", statement: "The system shall resolve every capability a feature names."}], + }}], null, 2)}\n`); + ' "$OUT/create-$slug.calls.json" "$slug" "$refs" + drive "$OUT/create-$slug.calls.json" "$OUT/create-$slug.json" +} + +# 0 — the anchor feature, with no capability reference at all. +make_feature capability-anchor '[]' +tool_said "$OUT/create-capability-anchor.json" "anchor feature with no capability reference" +FEATURE="$(node -e ' + const fs = require("node:fs"); + const id = fs.readFileSync(process.argv[1], "utf8").match(/F-[0-9a-f]{6,8}/); + if (!id) throw new Error("no feature id"); + process.stdout.write(id[0]); +' "$OUT/create-capability-anchor.json")" || { echo "the anchor create produced no feature id"; exit 2; } +echo "anchor feature: $FEATURE" +# The scaffold ships no source, so without one real module the gate fails on an +# empty type-checker include list and its exit says nothing about capabilities. +mkdir -p src +cat > src/capability-anchor.ts <<'MODULE' +// Fixture module — the feature whose capability reference is under test. +export function capabilityAnchor(): string { + return 'anchor'; +} +MODULE + +# 1 — a reference to a capability nobody declared. +make_feature capability-ghost '["ghost-capability"]' +tool_said "$OUT/create-capability-ghost.json" "feature naming an undeclared capability" +set +e +clad check --profile checkpoint --json > "$OUT/check-ghost.json" 2>"$OUT/check-ghost.err" +GHOST_GATE=$? +set -e +echo "gate exit with the undeclared reference: $GHOST_GATE" +# If the create was refused outright the shard never landed, so the gate has +# nothing to say — which is a different answer from "the gate passed it". +echo "undeclared reference reached the spec on disk: $(grep -rqF 'ghost-capability' spec 2>/dev/null && echo yes || echo no)" +echo "gate mentions the undeclared capability: $(grep -qF 'ghost-capability' "$OUT/check-ghost.json" && echo yes || echo no)" + +# 2 — the capability declared, then referenced. +node -e ' + const fs = require("node:fs"); + const [callsPath, feature] = process.argv.slice(1); + fs.writeFileSync(callsPath, `${JSON.stringify([{type: "tool", name: "clad_link_capability", args: { + capability: "checkout", + feature, + title: "Checkout", + summary: "Everything a visitor does between a full basket and a receipt.", + surface: "feature", + }}], null, 2)}\n`); +' "$OUT/link.calls.json" "$FEATURE" +drive "$OUT/link.calls.json" "$OUT/link.json" +tool_said "$OUT/link.json" "capability declared through the link tool" +echo "capabilities on disk: $(grep -c -E '^\s*-?\s*id:' spec/capabilities.yaml 2>/dev/null || echo 0) entries" + +make_feature capability-declared '["checkout"]' +tool_said "$OUT/create-capability-declared.json" "feature naming the declared capability" +set +e +clad check --profile checkpoint --json > "$OUT/check-declared.json" 2>"$OUT/check-declared.err" +DECLARED_GATE=$? +set -e +echo "gate exit with the declared reference: $DECLARED_GATE" diff --git a/scripts/ab-abc/row-census.sh b/scripts/ab-abc/row-census.sh new file mode 100755 index 00000000..f489c733 --- /dev/null +++ b/scripts/ab-abc/row-census.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-census.sh — an unsafe evidence census (S-D6) +# +# Every claim the gate makes about human evidence rests on being able to read +# ALL of spec/evidence. If one entry there cannot be read safely — a symbolic +# link is the obvious case, pointing anywhere on the machine — then the honest +# answer is not "no receipts" and not "receipts fine", but "this could not be +# checked". Silently treating an unreadable census as an empty one would turn a +# planted link into a way of hiding evidence. +# +# The row runs the push profile twice on the same completed workspace: once as +# built, once with a link planted under spec/evidence. The second run must stop +# being green, must say the verification could not be checked, and must name the +# remedy. +# +# Called by sidetable.ts as: bash row-census.sh +set -uo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" + +if [ "$ARM" != "C" ]; then + echo "not applicable: the receipt census is a 0.2 surface" + exit 0 +fi + +export PATH="$ABC_ROOT/prefix-C/bin:$PATH" +export CLADDING_KEYS_DIR="$OUT/keys" +echo "engine: $(command -v clad) $(clad --version)" + +FEATURE="$(basename "$(find "$CWD/spec/features" -name '*.yaml' | head -1)" .yaml)" +echo "workspace feature shard: $FEATURE" + +( cd "$CWD" && clad check --profile push --strict --json ) > "$OUT/census-before.json" 2> "$OUT/census.log" +echo "push profile before the planted link: exit $?" +node -e ' + const fs = require("node:fs"); + const report = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + process.stdout.write(`before: profile_complete ${report.profile_complete}; incomplete addresses ${JSON.stringify(report.incomplete_addresses ?? [])}\n`); +' "$OUT/census-before.json" || true + +# The plant: a link where a receipt file belongs. Nothing else changes. +TARGET="$CWD/spec/evidence/F-planted" +mkdir -p "$TARGET" +ln -s /etc/hosts "$TARGET/0000000000000000000000000000000000000000000000000000000000000000.yaml" +echo "planted: spec/evidence/F-planted/.yaml is a symbolic link to /etc/hosts" + +( cd "$CWD" && clad check --profile push --strict --json ) > "$OUT/census-after.json" 2>> "$OUT/census.log" +AFTER=$? +echo "push profile with the planted link: exit $AFTER" +node -e ' + const fs = require("node:fs"); + const report = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const bad = (report.obligations ?? []).filter((o) => o.state !== "pass" && o.state !== "na"); + process.stdout.write(`after: profile_complete ${report.profile_complete}; incomplete addresses ${JSON.stringify(report.incomplete_addresses ?? [])}\n`); + process.stdout.write(`after: unresolved obligations ${bad.map((o) => `${o.obligation}/${o.state}`).join(", ") || "(none)"}\n`); +' "$OUT/census-after.json" || true + +# The text a human reads is half the point: a census that fails silently is the +# thing this row exists to rule out. +( cd "$CWD" && clad check --tier=pre-push --strict ) > "$OUT/census-after.txt" 2>&1 +echo "strict pre-push text form exit: $?" +if grep -qF "could not be checked" "$OUT/census-after.txt"; then + echo "warning text present: verification could not be checked" + # The terminal form truncates the sentence, so the remedy is read from the + # machine-readable report rather than from the elided console line. + node -e ' + const fs = require("node:fs"); + const report = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const messages = (report.stages ?? []) + .flatMap((stage) => stage.findings ?? []) + .map((finding) => `${finding.message ?? ""} ${finding.suggestion ?? ""}`) + .filter((text) => text.includes("could not be checked")); + process.stdout.write(messages.length === 0 + ? "no census finding in the JSON report\n" + : `census finding: ${messages[0].replace(/\s+/g, " ").trim()}\n`); + ' "$OUT/census-after.json" || true +else + echo "NO 'could not be checked' warning in the strict pre-push output" + tail -c 400 "$OUT/census-after.txt" +fi diff --git a/scripts/ab-abc/row-ingest.sh b/scripts/ab-abc/row-ingest.sh new file mode 100755 index 00000000..e64ec44b --- /dev/null +++ b/scripts/ab-abc/row-ingest.sh @@ -0,0 +1,203 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-ingest.sh — ingesting a portable receipt (S-D5) +# +# A receipt is portable: signed once, on one machine, and carried into the +# workspace it talks about. This row asks what `clad ingest-receipt` does with +# four of them, and reads the verdict the verb records for each — assurance +# verified | asserted | invalid, plus the reason — because an exit code alone +# cannot tell "accepted" from "kept, pending". Each pass targets a DIFFERENT +# criterion, so no receipt's answer can be borrowed from another's evidence: +# +# control criterion 1's own valid receipt, taken out of the workspace and +# put straight back through the verb. Without this pass a refusal +# and a verb that verifies nothing at all look identical, and the +# right reading of the other three depends on which one it is. +# idempotent the same valid receipt a second time — create-only, no overwrite. +# tampered criterion 2's receipt with one character of its signature flipped, +# and it is the ONLY receipt that criterion has. +# stranger criterion 3 signed by `mallory`, an issuer registered in a +# second workspace — built outside this one, so nothing about the +# row depends on a copy nested inside the workspace under test — +# and unknown to this one's committed registry. +# +# Called by sidetable.ts as: bash row-ingest.sh +set -uo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +RECORD="$ABC_ROOT/sidetable/inprogress" + +if [ "$ARM" != "C" ]; then + echo "not applicable: portable receipts are a 0.2 surface" + exit 0 +fi +if ! command -v expect > /dev/null; then + echo "not run: expect is not installed, and signing needs a terminal" + exit 3 +fi +if [ ! -f "$RECORD/C.criteria" ]; then + echo "no in-progress fixture record at $RECORD — re-run --bootstrap" + exit 3 +fi + +export PATH="$ABC_ROOT/prefix-C/bin:$PATH" +echo "engine: $(command -v clad) $(clad --version)" + +FEATURE="$(cat "$RECORD/C.feature")" +AC1="$(sed -n '1p' "$RECORD/C.criteria")" +AC2="$(sed -n '2p' "$RECORD/C.criteria")" +AC3="$(sed -n '3p' "$RECORD/C.criteria")" +echo "feature $FEATURE; criteria $AC1 (control), $AC2 (tampered), $AC3 (stranger)" + +cat > "$OUT/ingest-sign.exp" <<'EXP' +#!/usr/bin/expect -f +set timeout 60 +set feature [lindex $argv 0] +set dir [lindex $argv 1] +set issuer [lindex $argv 2] +set criterion [lindex $argv 3] +cd $dir +spawn clad signoff $feature --claim audit --criterion $criterion --result pass --verified --issuer $issuer +expect -re "feature id.*: " +send "$feature\r" +expect eof +EXP + +# Whether the workspace's human obligations are settled at all. On a fixture +# still inside its cycle this is project-scoped rather than per criterion, so it +# is a background reading, not the row's verdict. +audit_states() { + local label="$1" + ( cd "$CWD" && clad check --profile push --strict --json ) > "$OUT/gate-$label.json" 2>> "$OUT/ingest.log" + local gate=$? + node -e ' + const fs = require("node:fs"); + const [path, label, gate] = process.argv.slice(1); + const report = JSON.parse(fs.readFileSync(path, "utf8")); + const audit = (report.obligations ?? []).filter((o) => o.obligation === "stage_4.1"); + const shown = audit + .map((o) => `${String(o.subject).split("/").pop()}=${o.state}${o.reason ? `(${o.reason})` : ""}`) + .sort() + .join(", "); + process.stdout.write(`${label}: gate exit ${gate}; audit ${shown || "(no audit obligation)"}\n`); + ' "$OUT/gate-$label.json" "$label" "$gate" +} + +# What the VERB says about the receipt it just took, which is a finer answer than +# its exit code: assurance verified|asserted|invalid, and the reason. +verdict_of() { + node -e ' + const fs = require("node:fs"); + const [path, label] = process.argv.slice(1); + const result = JSON.parse(fs.readFileSync(path, "utf8")); + const v = result.verification ?? {}; + process.stdout.write(`${label} verdict: assurance ${v.assurance ?? "(none)"}, currentness ${v.currentness ?? "(none)"}, reason ${v.reason ?? "(none)"}\n`); + ' "$1" "$2" +} + +receipts() { find "$CWD/spec/evidence" -name '*.yaml' 2> /dev/null | wc -l | tr -d ' '; } +receipt_for() { find "$CWD/spec/evidence" -name '*.yaml' -newer "$1" 2> /dev/null | head -1; } + +export CLADDING_KEYS_DIR="$OUT/keys" +rm -rf "$CLADDING_KEYS_DIR" +( cd "$CWD" && clad key create --issuer alice ) >> "$OUT/ingest.log" 2>&1 +echo "issuer alice registered: exit $?" +# On a fixture still inside its cycle the audit obligation is project-scoped, so +# these lines say whether the workspace's human evidence is settled at all — +# they are not a per-criterion verdict, and the row does not read them as one. +audit_states baseline + +# ── 1. control: a valid receipt, removed and put back through the verb ────── +touch "$OUT/.mark1" +expect "$OUT/ingest-sign.exp" "$FEATURE" "$CWD" alice "$AC1" >> "$OUT/ingest.log" 2>&1 +R1="$(receipt_for "$OUT/.mark1")" +if [ -z "$R1" ]; then + echo "FAIL: signing $AC1 left no receipt — the row has nothing to ingest" + exit 2 +fi +echo "receipt for $AC1 written: ${R1#"$CWD/"} ($(wc -c < "$R1" | tr -d ' ') bytes)" +audit_states signed +cp "$R1" "$OUT/valid.yaml" +rm -f "$R1" +audit_states removed +( cd "$CWD" && clad ingest-receipt "$OUT/valid.yaml" --json ) > "$OUT/ingest-control.json" 2>&1 +echo "control ingest exit: $?" +verdict_of "$OUT/ingest-control.json" control +head -c 220 "$OUT/ingest-control.json" | tr -s '\n' ' ' +echo +audit_states reingested + +# ── 2. the same receipt again ─────────────────────────────────────────────── +BEFORE_COUNT="$(receipts)" +( cd "$CWD" && clad ingest-receipt "$OUT/valid.yaml" --json ) > "$OUT/ingest-again.json" 2>&1 +echo "second ingest of the same receipt exit: $?" +verdict_of "$OUT/ingest-again.json" second-ingest +head -c 220 "$OUT/ingest-again.json" | tr -s '\n' ' ' +echo +echo "receipt files $BEFORE_COUNT → $(receipts)" + +# ── 3. tampered: the only receipt criterion 2 has ─────────────────────────── +touch "$OUT/.mark2" +expect "$OUT/ingest-sign.exp" "$FEATURE" "$CWD" alice "$AC2" >> "$OUT/ingest.log" 2>&1 +R2="$(receipt_for "$OUT/.mark2")" +if [ -z "$R2" ]; then + echo "FAIL: signing $AC2 left no receipt" + exit 2 +fi +cp "$R2" "$OUT/tampered.yaml" +rm -f "$R2" +python3 - "$OUT/tampered.yaml" <<'TAMPER' || exit 2 +import json, sys +path = sys.argv[1] +receipt = json.load(open(path)) +proof = receipt['issuer_proof'] +# One character of the signature, and nothing else: a structural edit would test +# the parser instead of the signature. +receipt['issuer_proof'] = proof[:3] + ('B' if proof[3] != 'B' else 'C') + proof[4:] +open(path, 'w').write(json.dumps(receipt, separators=(',', ':'), sort_keys=True)) +print(f'tampered one character of the {len(proof)}-character issuer_proof, nothing else') +TAMPER +( cd "$CWD" && clad ingest-receipt "$OUT/tampered.yaml" --json ) > "$OUT/ingest-tampered.json" 2>&1 +echo "tampered ingest exit: $?" +verdict_of "$OUT/ingest-tampered.json" tampered +head -c 220 "$OUT/ingest-tampered.json" | tr -s '\n' ' ' +echo +audit_states tampered + +# ── 4. a stranger's signature on criterion 3 ──────────────────────────────── +STRANGER="$OUT/stranger" +rm -rf "$STRANGER" +mkdir -p "$STRANGER" +rsync -a --exclude node_modules "$CWD/" "$STRANGER/" >> "$OUT/ingest.log" 2>&1 +rm -rf "$STRANGER/spec/evidence" +if [ -d "$CWD/node_modules" ] && [ ! -e "$STRANGER/node_modules" ]; then + ln -s "$CWD/node_modules" "$STRANGER/node_modules" +fi +( + export CLADDING_KEYS_DIR="$OUT/stranger-keys" + rm -rf "$CLADDING_KEYS_DIR" + cd "$STRANGER" && clad key create --issuer mallory +) >> "$OUT/ingest.log" 2>&1 +CLADDING_KEYS_DIR="$OUT/stranger-keys" expect "$OUT/ingest-sign.exp" "$FEATURE" "$STRANGER" mallory "$AC3" >> "$OUT/ingest.log" 2>&1 +FOREIGN="$(find "$STRANGER/spec/evidence" -name '*.yaml' | head -1)" +if [ -z "$FOREIGN" ]; then + echo "FAIL: the stranger workspace produced no receipt" + exit 2 +fi +cp "$FOREIGN" "$OUT/foreign.yaml" +if grep -q 'mallory' "$CWD/spec/trust/issuers.yaml"; then + echo "WARNING: mallory is registered here too — the row would measure nothing" +else + echo "this workspace's registry does not carry mallory" +fi +( cd "$CWD" && clad ingest-receipt "$OUT/foreign.yaml" --json ) > "$OUT/ingest-foreign.json" 2>&1 +echo "foreign-issuer ingest exit: $?" +verdict_of "$OUT/ingest-foreign.json" foreign +head -c 220 "$OUT/ingest-foreign.json" | tr -s '\n' ' ' +echo +audit_states foreign +echo "receipt files at the end: $(receipts)" +rm -rf "$STRANGER" diff --git a/scripts/ab-abc/row-init-compat.sh b/scripts/ab-abc/row-init-compat.sh new file mode 100755 index 00000000..2362cea1 --- /dev/null +++ b/scripts/ab-abc/row-init-compat.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-init-compat.sh — the back-compatible scaffold (S-A2) +# +# The candidate keeps the old spec format as a first-class choice, so asking for +# it explicitly should give a project the released engine's own scaffold, not a +# new-format one wearing an old label. The row builds both from the identical +# template inside a single run — self-contained on purpose, so it never depends +# on which arm the runner happened to execute first — and reports how far apart +# they are: the managed AGENTS.md block, the CLAUDE.md section each engine's +# `update` writes, and spec.yaml with the engine's own version string excluded, +# since that line is expected to differ and says nothing about the scaffold. +# +# Called by sidetable.ts as: bash row-init-compat.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" + +if [ "$ARM" != "C" ]; then + echo "not applicable: the comparison runs both engines from one script, on the C pass" + exit 0 +fi +for arm in B C; do + if [ ! -x "$ABC_ROOT/prefix-$arm/bin/clad" ]; then + echo "no engine at $ABC_ROOT/prefix-$arm/bin/clad — the row cannot run" + exit 3 + fi +done + +echo "released engine: $("$ABC_ROOT/prefix-B/bin/clad" --version)" +echo "candidate engine: $("$ABC_ROOT/prefix-C/bin/clad" --version)" + +# Both scaffolds are built from the row's own checkout of the untouched +# template, so the input is identical by construction. +build() { + local arm="$1" dir="$2"; shift 2 + rm -rf "$dir"; mkdir -p "$dir" + ( cd "$CWD" && tar cf - --exclude node_modules . ) | ( cd "$dir" && tar xf - ) + if [ -d "$CWD/node_modules" ]; then ln -s "$CWD/node_modules" "$dir/node_modules"; fi + ( cd "$dir" && "$ABC_ROOT/prefix-$arm/bin/clad" "$@" ) > "$OUT/init-$arm.stdout" 2>&1 || true + # CLAUDE.md is never created by onboarding; `update` is the verb that writes + # the managed section, so the comparison asks for it explicitly. + ( cd "$dir" && "$ABC_ROOT/prefix-$arm/bin/clad" update ) > "$OUT/update-$arm.stdout" 2>&1 || true +} + +# The engine names a fresh project after its own directory, so both scaffolds +# are built in identically named directories under different parents: otherwise +# every comparison carries the harness's own folder names as a difference. +B_DIR="$OUT/pass-B/scaffold" +C_DIR="$OUT/pass-C/scaffold" +build B "$B_DIR" init --no-llm +build C "$C_DIR" init --schema 0.1 --no-llm + +echo "released scaffold spec.yaml schema: $(grep -m1 -E '^[[:space:]]*schema:' "$B_DIR/spec.yaml" || echo '(absent)')" +echo "candidate scaffold spec.yaml schema: $(grep -m1 -E '^[[:space:]]*schema:' "$C_DIR/spec.yaml" || echo '(absent)')" + +# The engine stamps its own version into spec.yaml; that line is expected to +# differ and is not part of the question. +strip_version() { sed -E 's/^([[:space:]]*version:[[:space:]]*).*$/\1/' "$1"; } + +compare_file() { + local label="$1" rel="$2" filter="$3" + local b="$B_DIR/$rel" c="$C_DIR/$rel" + if [ ! -f "$b" ] || [ ! -f "$c" ]; then + echo "$label: released $( [ -f "$b" ] && echo present || echo absent ), candidate $( [ -f "$c" ] && echo present || echo absent )" + return + fi + if [ "$filter" = "strip-version" ]; then + strip_version "$b" > "$OUT/$rel.B.cmp"; strip_version "$c" > "$OUT/$rel.C.cmp" + else + cp "$b" "$OUT/$rel.B.cmp"; cp "$c" "$OUT/$rel.C.cmp" + fi + local lines + lines="$(diff -u "$OUT/$rel.B.cmp" "$OUT/$rel.C.cmp" | grep -c '^[+-][^+-]' || true)" + echo "$label diff lines: $lines" + echo "$label bytes: released $(wc -c < "$b" | tr -d ' '), candidate $(wc -c < "$c" | tr -d ' ')" + if [ "$lines" != "0" ]; then + diff -u "$OUT/$rel.B.cmp" "$OUT/$rel.C.cmp" > "$OUT/$rel.diff" || true + echo "$label first differing lines:" + head -20 "$OUT/$rel.diff" || true + fi +} + +compare_file "AGENTS.md" "AGENTS.md" plain +compare_file "CLAUDE.md" "CLAUDE.md" plain +compare_file "spec.yaml" "spec.yaml" strip-version +echo "artifacts under $B_DIR and $C_DIR" diff --git a/scripts/ab-abc/row-init.sh b/scripts/ab-abc/row-init.sh new file mode 100755 index 00000000..7bdacb8f --- /dev/null +++ b/scripts/ab-abc/row-init.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-init.sh — what each engine's own scaffold says (S-A1) +# +# Runs each engine's default onboarding over the identical untouched template and +# writes down what the project is told. The question is not whether a scaffold +# appears — both produce one — but whether the instructions it leaves behind name +# the binding the engine actually reads. On schema 0.2 a test claims a criterion +# only by opening its own title with that criterion's tag, so a scaffold that +# never mentions the tag is telling an adopter to do something the gate ignores. +# +# Called by sidetable.ts as: bash row-init.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi + +export PATH="$PREFIX/bin:$PATH" +cd "$CWD" +echo "engine: $(command -v clad) $(clad --version)" + +if [ "$ARM" = "C" ]; then + set +e; clad init --schema 0.2 --no-llm > "$OUT/init-$ARM.stdout" 2>&1; INIT_EXIT=$?; set -e + echo "init command: clad init --schema 0.2 --no-llm" +else + set +e; clad init --no-llm > "$OUT/init-$ARM.stdout" 2>&1; INIT_EXIT=$?; set -e + echo "init command: clad init --no-llm" +fi +echo "init exit: $INIT_EXIT" + +# --- what spec.yaml declares ------------------------------------------------- +field() { + local key="$1" + local value + value="$(grep -m1 -E "^[[:space:]]*${key}:" spec.yaml 2>/dev/null | sed -E "s/^[[:space:]]*${key}:[[:space:]]*//" || true)" + if [ -z "$value" ]; then echo "(absent)"; else echo "$value"; fi +} +echo "spec.yaml present: $([ -f spec.yaml ] && echo yes || echo no)" +echo "spec.yaml schema: $(field schema)" +echo "spec.yaml assurance_level: $(field assurance_level)" +echo "spec.yaml scenario_policy: $(field scenario_policy)" +echo "spec.yaml project purpose: $(field purpose)" + +# --- what the managed instructions say --------------------------------------- +present() { if [ -f "$1" ] && grep -qF "$2" "$1"; then echo present; else echo absent; fi; } +echo "AGENTS.md present: $([ -f AGENTS.md ] && echo yes || echo no)" +echo "AGENTS.md covers token: $(present AGENTS.md '[covers:')" +echo "AGENTS.md clad_begin: $(present AGENTS.md 'clad_begin')" +echo "AGENTS.md feature-cycle heading: $(present AGENTS.md 'Feature cycle')" +echo "AGENTS.md clad run mention: $(present AGENTS.md 'clad run')" +# `clad init` never creates CLAUDE.md — the file belongs to the adopter, and only +# `clad update` writes the managed section into one that already exists. Recorded +# here as the fact it is, because the row's pre-registered guess named it. +echo "CLAUDE.md present after init: $([ -f CLAUDE.md ] && echo yes || echo no)" +echo "CLAUDE.md covers sentence: $(present CLAUDE.md '[covers:')" + +cp -f AGENTS.md "$OUT/AGENTS-$ARM.md" 2>/dev/null || true +cp -f spec.yaml "$OUT/spec-$ARM.yaml" 2>/dev/null || true +echo "scaffold recorded to $OUT/AGENTS-$ARM.md and $OUT/spec-$ARM.yaml" diff --git a/scripts/ab-abc/row-key.sh b/scripts/ab-abc/row-key.sh new file mode 100755 index 00000000..30a04298 --- /dev/null +++ b/scripts/ab-abc/row-key.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-key.sh — the issuer key lifetime row (S-D1) +# +# 0.10.0 signs receipts with a file-held Ed25519 issuer key whose public half is +# committed to the workspace's own trust registry. Four things have to be true +# before any receipt row below can be believed, and this row asks all four in one +# pass: the private key never lands in the workspace and is readable only by its +# owner, the registry gains exactly one issuer, `key list` says this machine +# holds that key, and registering the same issuer twice is refused rather than +# silently overwriting the first registration. +# +# The comparison arm is the absence of the surface: 0.9.4 has no `key` verb at +# all, so arm B records the unknown-command answer rather than skipping. +# +# Called by sidetable.ts as: bash row-key.sh +set -uo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +export PATH="$ABC_ROOT/prefix-$ARM/bin:$PATH" +echo "engine: $(command -v clad) $(clad --version 2>&1)" + +if [ "$ARM" != "C" ]; then + # Recorded, not skipped: "no such verb" is this row's B-side answer. + ( cd "$CWD" && clad key list ) > "$OUT/key-b.txt" 2>&1 + echo "B key list exit: $?" + head -c 300 "$OUT/key-b.txt" + echo + echo "not applicable: the issuer trust registry is a 0.2 surface" + exit 0 +fi + +# The row's own key directory, never the caller's — the real ~/.cladding/keys +# must not be read, written, or removed by a table row. +export CLADDING_KEYS_DIR="$OUT/keys" +rm -rf "$CLADDING_KEYS_DIR" + +ISSUER="alice" +( cd "$CWD" && clad key create --issuer "$ISSUER" --json ) > "$OUT/key-create.json" 2> "$OUT/key-create.err" +echo "key create exit: $?" +head -c 400 "$OUT/key-create.json" +echo + +if [ ! -d "$CLADDING_KEYS_DIR" ]; then + echo "FAIL: the key directory $CLADDING_KEYS_DIR was not created" + exit 2 +fi +echo "keys dir mode: $(stat -f '%Lp' "$CLADDING_KEYS_DIR")" +for f in "$CLADDING_KEYS_DIR"/*; do + [ -f "$f" ] || continue + echo "key file $(basename "$f") mode: $(stat -f '%Lp' "$f")" +done +echo "private key material inside the workspace: $(find "$CWD" -name '*.key' -o -name '*.pem' | wc -l | tr -d ' ') files" + +REG="$CWD/spec/trust/issuers.yaml" +if [ ! -f "$REG" ]; then + echo "FAIL: no committed trust registry at spec/trust/issuers.yaml" + exit 2 +fi +echo "registry issuers: $(grep -c '^ - issuer:' "$REG" | tr -d ' ')" +grep -n 'issuer:\|issuer_key_id\|spki_der' "$REG" | head -5 + +( cd "$CWD" && clad key list ) > "$OUT/key-list.txt" 2>&1 +echo "key list exit: $?" +cat "$OUT/key-list.txt" + +# Re-registering the same issuer must be refused: a second key under one name +# would make every earlier receipt ambiguous. +( cd "$CWD" && clad key create --issuer "$ISSUER" ) > "$OUT/key-recreate.txt" 2>&1 +RE=$? +echo "second key create for the same issuer exit: $RE" +head -c 300 "$OUT/key-recreate.txt" +echo +if [ "$RE" -eq 0 ]; then + echo "FAIL: the second registration of the same issuer succeeded" + exit 2 +fi +echo "registry issuers after the refusal: $(grep -c '^ - issuer:' "$REG" | tr -d ' ')" diff --git a/scripts/ab-abc/row-l4-independent.sh b/scripts/ab-abc/row-l4-independent.sh new file mode 100755 index 00000000..d5086a03 --- /dev/null +++ b/scripts/ab-abc/row-l4-independent.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-l4-independent.sh — the independent L4 cycle (S-D4) +# +# The positive half of row L0-6b. Same fixture, same replay, same `require` +# policy — one difference: the registered issuer who signs every claim is not the +# person the implementation is committed by. The completion must therefore be +# allowed, and the gate must label it `independent` rather than `self-certified`. +# +# What that label actually checks is worth saying plainly, because the row is +# also the evidence for the limit: cladding compares the issuer name against the +# committing author's `git user.name` as strings. A second name on the same +# person's machine reads as independent. The label records who signed under which +# name, not that two humans exist. +# +# Called by sidetable.ts as: bash row-l4-independent.sh +set -euo pipefail + +ABC_L4_POLICY=require ABC_L4_ISSUER="${ABC_L4_ISSUER:-alice}" \ + exec bash "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/row-l4.sh" "$@" diff --git a/scripts/ab-abc/row-l4-require.sh b/scripts/ab-abc/row-l4-require.sh new file mode 100755 index 00000000..908bf5ad --- /dev/null +++ b/scripts/ab-abc/row-l4-require.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-l4-require.sh — the refused L4 cycle (L0-6b) +# +# The counterpart to L0-10. Same fixture, same signing recipe, one difference: +# the workspace declares `independence_policy: require`, and the issuer who signs +# every claim is the same person the implementation is committed by. At L4 the +# receipts exist and are labelled `self-certified`, which is precisely what +# `require` refuses — so the completion must be turned down, and the refusal must +# say who to ask instead of only saying no. +# +# L0-6 records the other half of the same policy: at L2 the kernel labels a +# completed cycle `not-applicable`, because that profile asks for no human review +# at all, and `require` has nothing to refuse. Together the two rows say what the +# policy means at each level rather than leaving the L2 pass looking like a hole. +# +# Called by sidetable.ts as: bash row-l4-require.sh +set -euo pipefail + +ABC_L4_POLICY=require exec bash "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/row-l4.sh" "$@" diff --git a/scripts/ab-abc/row-l4.sh b/scripts/ab-abc/row-l4.sh new file mode 100644 index 00000000..e3438d58 --- /dev/null +++ b/scripts/ab-abc/row-l4.sh @@ -0,0 +1,207 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-l4.sh — the L4 replay row (L0-10) +# +# Replays the documented L4 recipe on a project that is still inside its cycle: +# confirm that a strict pre-push is honestly unresolved before any human receipt +# exists, sign the audit claim for every criterion and the feature-scoped UAT +# claim through a scripted pseudo-terminal, complete the feature, and confirm the +# gate then goes green. The signing prompts are interactive by design, so this +# row needs `expect`; without it the row records not-run rather than guessing. +# +# Three things the first run got wrong are fixed here: +# · it ran on a project already completed at L2 and only then raised the level, +# so the completion never published an L4 attestation row. The fixture is now +# the in-progress one and `clad done` runs inside this row. +# · it signed the audit claim for one criterion out of three, leaving the other +# two unobserved. +# · it passed `--criterion` to the UAT claim, which is feature-scoped and +# refuses a criterion outright — so no UAT receipt existed at all. +# +# Called by sidetable.ts as: bash row-l4.sh +# +# Two modes, chosen by ABC_L4_POLICY, because both questions need the identical +# replay and differ only in what the completion is allowed to do: +# default the documented L4 recipe — signing every claim earns a green gate +# and a completed feature (row L0-10). +# require the same replay on a workspace whose `independence_policy` is +# `require`, where the only signer is also the only author. The +# completion must be REFUSED and must say who to ask instead +# (row L0-6b); row-l4-require.sh is the entry point that sets it. +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +PREFIX="$ABC_ROOT/prefix-$ARM" +RECORD="$ABC_ROOT/sidetable/inprogress" + +if [ "$ARM" != "C" ]; then + echo "not applicable: assurance levels are a candidate surface" + exit 0 +fi +if ! command -v expect > /dev/null; then + echo "not run: expect is not installed, and the signing prompts are interactive" + exit 3 +fi +if [ ! -f "$RECORD/C.feature" ]; then + echo "no in-progress L4 fixture at $RECORD — re-run --bootstrap" + exit 3 +fi + +export PATH="$PREFIX/bin:$PATH" +# The key directory is the row's own, never the caller's: an inherited +# CLADDING_KEYS_DIR would point at real signing keys, and the line below deletes +# whatever it names. The artifact directory also survives a re-run while the +# row's workspace does not, so a keypair left behind by the previous run would +# meet a trust registry that no longer lists it and the signing would fail for a +# harness reason. Both problems end the same way: this row's keys, regenerated +# per run, under this row's artifact directory. +export CLADDING_KEYS_DIR="$OUT/keys" +rm -rf "$CLADDING_KEYS_DIR" +mkdir -p "$CLADDING_KEYS_DIR" +echo "engine: $(command -v clad) $(clad --version)" + +FEATURE="$(cat "$RECORD/C.feature")" +AUTHOR="$(cd "$CWD" && git config user.name)" +# ABC_L4_ISSUER names a signer who is NOT the committing author, which is the +# only thing the independence label compares — the two names as strings. Unset, +# the row signs as the author and the label reads `self-certified`; that default +# is what rows L0-10 and L0-6b are locked against, so nothing below changes when +# the variable is absent. +ISSUER="${ABC_L4_ISSUER:-$AUTHOR}" +POLICY="${ABC_L4_POLICY:-default}" +echo "feature $FEATURE, issuer $ISSUER, policy mode $POLICY" +# Printed only when the row is deliberately signing as someone else, so the +# default replay's output stays exactly what L0-10 and L0-6b recorded. +if [ -n "${ABC_L4_ISSUER:-}" ]; then + echo "committing author (git user.name): $AUTHOR — independence is a comparison of these two names, nothing more" +fi +grep -n 'assurance_level' "$CWD/spec.yaml" | head -1 +# Printed in BOTH modes: `not-applicable` and a policy that never landed look +# identical from the outside, so the row shows the line it depends on rather +# than trusting that a mutation ran. +grep -n 'independence_policy' "$CWD/spec.yaml" | head -1 || echo "no independence_policy line — the project default (label) applies" +if [ "$POLICY" = "require" ] && ! grep -q 'independence_policy: require' "$CWD/spec.yaml"; then + echo "the require mutation did not land in $CWD/spec.yaml — this row would measure the default policy" + exit 2 +fi + +# The issuer name equals the committing author byte for byte, so the independence +# label reads `self-certified` — which is the honest label for this fixture and +# the condition the runbook records for reproducing it. +( cd "$CWD" && clad key create --issuer "$ISSUER" ) >> "$OUT/l4.log" 2>&1 || true + +set +e +( cd "$CWD" && clad check --tier=pre-push --strict --json ) > "$OUT/l4-before-signing.json" 2>> "$OUT/l4.log" +BEFORE=$? +set -e +echo "strict pre-push BEFORE signing: exit $BEFORE (unresolved is the honest shape here)" + +cat > "$OUT/sign.exp" <<'EXP' +#!/usr/bin/expect -f +set timeout 60 +set claim [lindex $argv 0] +set feature [lindex $argv 1] +set dir [lindex $argv 2] +set issuer [lindex $argv 3] +set criterion [lindex $argv 4] +cd $dir +if {$criterion eq ""} { + spawn clad signoff $feature --claim $claim --result pass --verified --issuer $issuer +} else { + spawn clad signoff $feature --claim $claim --criterion $criterion --result pass --verified --issuer $issuer +} +expect -re "feature id.*: " +send "$feature\r" +expect eof +EXP +chmod +x "$OUT/sign.exp" + +# An audit receipt is per criterion; a partial matrix stays unobserved, so every +# criterion in the feature is signed. +while read -r CRITERION; do + [ -n "$CRITERION" ] || continue + expect "$OUT/sign.exp" audit "$FEATURE" "$CWD" "$ISSUER" "$CRITERION" >> "$OUT/l4.log" 2>&1 || true + echo "signed audit: $CRITERION" +done < "$RECORD/C.criteria" + +# A UAT receipt is feature-scoped and refuses a criterion argument. +expect "$OUT/sign.exp" uat "$FEATURE" "$CWD" "$ISSUER" "" >> "$OUT/l4.log" 2>&1 || true +echo "signed uat: feature-scoped" + +set +e +( cd "$CWD" && clad check --tier=pre-push --strict --json ) > "$OUT/l4-after-signing.json" 2>> "$OUT/l4.log" +AFTER_SIGN=$? +set -e +echo "strict pre-push AFTER signing, BEFORE completion: exit $AFTER_SIGN" + +set +e +( cd "$CWD" && clad done "$FEATURE" ) > "$OUT/l4-done.txt" 2>&1 +DONE_EXIT=$? +set -e +echo "completion exit: $DONE_EXIT" +cat "$OUT/l4-done.txt" +echo + +if [ "$POLICY" = "require" ] && [ -n "${ABC_L4_ISSUER:-}" ]; then + # S-D4: the same replay, signed by a registered issuer whose name differs from + # the committing author. `require` is the strictest policy there is, so a + # completion that passes HERE is the positive half of L0-6b's refusal — and the + # label it prints is the whole claim under test. + if [ "$DONE_EXIT" -ne 0 ]; then + echo "FAIL: the completion was refused even though the issuer is not the author" + exit 2 + fi + set +e + ( cd "$CWD" && clad check --tier=pre-push --strict --json ) > "$OUT/l4-after-done.json" 2>> "$OUT/l4.log" + AFTER=$? + set -e + echo "strict pre-push AFTER completion: exit $AFTER" + node -e ' + const fs = require("node:fs"); + const report = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + process.stdout.write(`independence: ${report.independence}; achieved ${report.achieved_assurance_level} of configured ${report.configured_assurance_level}\n`); + ' "$OUT/l4-after-done.json" || true + grep -iE 'independen' "$OUT/l4-done.txt" | head -3 + exit 0 +fi + +if [ "$POLICY" = "require" ]; then + # The whole row: a self-signed L4 cycle under `require` must not complete, and + # the refusal must name the remedy rather than only the verdict. Both halves + # are asserted here, so the row's own exit code carries the finding. + PHRASE="Ask a registered issuer other than the implementation authors for a verified review" + if [ "$DONE_EXIT" -eq 0 ]; then + echo "FAIL: the completion succeeded under independence_policy: require with a self-signed receipt" + exit 2 + fi + if ! grep -qF "$PHRASE" "$OUT/l4-done.txt"; then + echo "FAIL: the refusal does not name a registered issuer as the remedy" + exit 2 + fi + grep -oF "$PHRASE" "$OUT/l4-done.txt" | head -1 + echo "refused as required: completion exit $DONE_EXIT, remedy named" + set +e + ( cd "$CWD" && clad check --tier=pre-push --strict --json ) > "$OUT/l4-after-refusal.json" 2>> "$OUT/l4.log" + AFTER_REFUSAL=$? + set -e + echo "strict pre-push AFTER the refusal: exit $AFTER_REFUSAL (the feature is still open)" + exit 0 +fi + +set +e +( cd "$CWD" && clad check --tier=pre-push --strict --json ) > "$OUT/l4-after-done.json" 2>> "$OUT/l4.log" +AFTER=$? +set -e +echo "strict pre-push AFTER completion: exit $AFTER (0 is the row's expectation)" +node -e ' + const fs = require("node:fs"); + const report = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const unresolved = (report.obligations ?? []).filter((o) => o.state !== "pass"); + process.stdout.write(`achieved ${report.achieved_assurance_level} of configured ${report.configured_assurance_level}; independence ${report.independence}\n`); + process.stdout.write(unresolved.length === 0 + ? "every obligation passed\n" + : `unresolved obligations: ${unresolved.map((o) => `${o.obligation}/${o.state}${o.reason ? `(${o.reason})` : ""}`).join(", ")}\n`); +' "$OUT/l4-after-done.json" || true diff --git a/scripts/ab-abc/row-mcp-signoff.sh b/scripts/ab-abc/row-mcp-signoff.sh new file mode 100755 index 00000000..fc065a24 --- /dev/null +++ b/scripts/ab-abc/row-mcp-signoff.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-mcp-signoff.sh — a verified sign-off asked for +# over MCP by a client that cannot ask a human (S-D7) +# +# The CLI degrades a headless `--verified` run to HUMAN_REQUIRED (row S-D2). The +# same promise has to hold on the other surface, and for the same reason: a host +# asks for a verified receipt through an elicitation form, and a client with no +# elicitation support cannot show one. The driver here deliberately advertises no +# elicitation capability, so a receipt produced anyway would be a receipt no +# human ever saw. +# +# Arm B records the comparison the honest way: 0.9.4 has no such tool, which the +# row shows by listing the catalogue rather than by asserting an absence. +# +# Called by sidetable.ts as: bash row-mcp-signoff.sh +set -uo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +HARNESS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +RECORD="$ABC_ROOT/sidetable/inprogress" +BIN="$ABC_ROOT/prefix-$ARM/bin/clad" + +export PATH="$ABC_ROOT/prefix-$ARM/bin:$PATH" +export CLADDING_KEYS_DIR="$OUT/keys" +echo "engine: $BIN $("$BIN" --version 2>&1)" + +# Arm B: the catalogue is the whole answer. +if [ "$ARM" != "C" ]; then + printf '[{"type": "tools/list"}]\n' > "$OUT/list.calls.json" + node "$HARNESS/mcp-client.mjs" --cwd "$CWD" --server "$BIN serve" \ + --calls "$OUT/list.calls.json" --out "$OUT/list-b.json" > /dev/null 2>> "$OUT/mcp.log" + node -e ' + const fs = require("node:fs"); + const results = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const listed = results.find((entry) => entry.type === "tools/list"); + const names = (listed?.result?.tools ?? []).map((tool) => tool.name); + process.stdout.write(`tools advertised: ${names.length}\n`); + process.stdout.write(`clad_signoff in the catalogue: ${names.includes("clad_signoff") ? "yes" : "no"}\n`); + ' "$OUT/list-b.json" + echo "not applicable: signing over MCP is a 0.2 surface" + exit 0 +fi + +FEATURE="$(cat "$RECORD/C.feature")" +CRITERION="$(head -1 "$RECORD/C.criteria")" +echo "feature $FEATURE, criterion $CRITERION" + +rm -rf "$CLADDING_KEYS_DIR" +( cd "$CWD" && clad key create --issuer alice ) >> "$OUT/mcp.log" 2>&1 +echo "issuer alice registered: exit $?" + +node -e ' + const fs = require("node:fs"); + const [out, feature, criterion] = process.argv.slice(1); + fs.writeFileSync(out, `${JSON.stringify([ + {type: "tools/list"}, + {type: "tool", name: "clad_signoff", args: {feature, claim: "audit", criterion, result: "pass", verified: true, issuer: "alice"}}, + ], null, 2)}\n`); +' "$OUT/signoff.calls.json" "$FEATURE" "$CRITERION" + +node "$HARNESS/mcp-client.mjs" --cwd "$CWD" --server "$BIN serve" \ + --calls "$OUT/signoff.calls.json" --out "$OUT/signoff.mcp.json" > /dev/null 2>> "$OUT/mcp.log" +echo "driver exit: $?" + +node -e ' + const fs = require("node:fs"); + const results = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const listed = results.find((entry) => entry.type === "tools/list"); + const names = (listed?.result?.tools ?? []).map((tool) => tool.name); + process.stdout.write(`tools advertised: ${names.length}\n`); + process.stdout.write(`clad_signoff in the catalogue: ${names.includes("clad_signoff") ? "yes" : "no"}\n`); + const call = results.find((entry) => entry.type === "tool" && entry.name === "clad_signoff"); + const structured = call?.result?.structuredContent; + const text = call?.result?.content?.[0]?.text ?? ""; + const code = structured?.code ?? (text.match(/HUMAN_REQUIRED/) ? "HUMAN_REQUIRED" : "(none)"); + process.stdout.write(`clad_signoff code: ${code}\n`); + process.stdout.write(`clad_signoff isError: ${call?.result?.isError === true}\n`); + process.stdout.write(`clad_signoff said: ${(structured?.message ?? text).slice(0, 240).replace(/\s+/g, " ")}\n`); +' "$OUT/signoff.mcp.json" + +echo "receipts written by the elicitation-less client: $(find "$CWD/spec/evidence" -name '*.yaml' 2> /dev/null | wc -l | tr -d ' ')" diff --git a/scripts/ab-abc/row-migrate-guards.sh b/scripts/ab-abc/row-migrate-guards.sh new file mode 100755 index 00000000..f064539c --- /dev/null +++ b/scripts/ab-abc/row-migrate-guards.sh @@ -0,0 +1,176 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-migrate-guards.sh — the three guards around a +# schema migration (S-F2) +# +# L0-11 shows the migration doing its job. This row asks what stops it, because a +# migration rewrites the files a project's whole history is addressed by and the +# recoverable-transaction claim is only as good as its refusals: +# +# dirty a planned path with uncommitted work is refused (DIRTY_PLANNED_PATH): +# applying over it would bury a change git cannot show anyone again. +# answered once the legacy-baseline question has been answered and applied, +# answering it the other way must not quietly re-decide it. +# unreadable a 0.1 criterion whose sentence the 0.2 grammar cannot parse must +# become a question for a human, not a guess by the tool. +# +# Every pass runs on its own copy of the completed 0.1 project, so a refusal in +# one cannot be mistaken for a state left by another. +# +# Called by sidetable.ts as: bash row-migrate-guards.sh +set -uo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +SOURCE="$ABC_ROOT/sidetable/done/B" + +if [ "$ARM" != "C" ]; then + echo "not applicable: migrating to the newer schema is the candidate's verb" + exit 0 +fi +if [ ! -d "$SOURCE" ]; then + echo "no completed 0.1 fixture at $SOURCE — the row cannot run" + exit 3 +fi + +export PATH="$ABC_ROOT/prefix-C/bin:$PATH" +echo "engine: $(command -v clad) $(clad --version)" + +# A fresh copy of the 0.1 project, committed clean — same recipe as row-migrate.sh. +fresh_copy() { + local dir="$1" + rm -rf "$dir" + mkdir -p "$dir" + rsync -a --exclude 'node_modules' "$SOURCE/" "$dir/" + if [ -d "$SOURCE/node_modules" ]; then ln -s "$SOURCE/node_modules" "$dir/node_modules"; fi +} + +changed_paths() { + ( cd "$1" && git status --porcelain ) | grep -v 'node_modules' || true +} + +# Turns a reviewed preview into the decision file --apply requires; the +# two-valued legacy-baseline decision carries this pass's answer. Same shape as +# row-migrate.sh, kept here so the two rows can be read independently. +write_resolutions() { + local preview="$1" out="$2" baseline="$3" + node -e ' + const fs = require("node:fs"); + const [previewPath, outPath, baseline] = process.argv.slice(1); + const preview = JSON.parse(fs.readFileSync(previewPath, "utf8")); + const confirmed = (preview.requiredResolution ?? []).map((item) => { + if (item.code === "PROJECT_LEGACY_L2_BASELINE") return {code: item.code, subject: item.subject, value: baseline}; + if (item.code === "ARCHITECTURE_LAYER_RESOLUTION") return {code: item.code, subject: item.subject, value: {layers: []}}; + if (item.code === "CRITERION_TEXT_UNKNOWN" || item.code === "CRITERION_STATEMENT_CONFLICT") { + return { + code: item.code, + subject: item.subject, + value: {statement: "The system shall retain an explicitly reviewed historic criterion.", kind: "behavior", testBindingDisposition: "drop"}, + }; + } + return {code: item.code, subject: item.subject}; + }); + fs.writeFileSync(outPath, `${JSON.stringify({previewDigest: preview.previewDigest, confirmed}, null, 2)}\n`); + process.stdout.write(`decisions written: ${confirmed.length} (${[...new Set(confirmed.map((c) => c.code))].join(", ") || "none"})\n`); + ' "$preview" "$out" "$baseline" +} + +# ── 1. a planned path with uncommitted work ───────────────────────────────── +# The dirt is made BEFORE the preview on purpose. Two guards stand in front of +# the same apply and the row shows which one answers when: dirty the tree after +# a preview and the preview itself is stale, so the answer is STALE_INPUT; dirty +# it first and the preview is honest about the tree it read, so the refusal is +# the one this pass is about — the uncommitted work that an apply would bury. +WORK="$CWD/.guard-dirty" +fresh_copy "$WORK" +printf '\n# an uncommitted edit to a path the migration plans to rewrite\n' >> "$WORK/spec.yaml" +echo "dirtied paths before the preview: $(changed_paths "$WORK" | wc -l | tr -d ' ')" +( cd "$WORK" && clad migrate --to 0.2 --json ) > "$OUT/dirty.preview.json" 2> "$OUT/dirty.err" +echo "dirty pass preview exit: $?" +write_resolutions "$OUT/dirty.preview.json" "$OUT/dirty.resolutions.json" accept +( cd "$WORK" && clad migrate --to 0.2 --apply --resolutions "$OUT/dirty.resolutions.json" --json ) > "$OUT/dirty.apply.json" 2>> "$OUT/dirty.err" +DIRTY=$? +echo "dirty apply exit: $DIRTY" +head -c 300 "$OUT/dirty.apply.json" | tr -s '\n' ' ' +echo +grep -o 'DIRTY_PLANNED_PATH' "$OUT/dirty.apply.json" "$OUT/dirty.err" | head -1 || echo "no DIRTY_PLANNED_PATH in the refusal" +echo "0.2 markers in spec.yaml after the refusal: $(grep -c 'schema: .0.2.' "$WORK/spec.yaml" | tr -d ' ')" +echo "paths changed by the refused apply: $(changed_paths "$WORK" | wc -l | tr -d ' ') (the one dirty file, and nothing the engine added)" + +# 1b — the same damage in the other order, recorded so the two refusals are not +# confused for each other. +WORK="$CWD/.guard-dirty-after" +fresh_copy "$WORK" +( cd "$WORK" && clad migrate --to 0.2 --json ) > "$OUT/dirty-after.preview.json" 2> "$OUT/dirty-after.err" +write_resolutions "$OUT/dirty-after.preview.json" "$OUT/dirty-after.resolutions.json" accept > /dev/null +printf '\n# an uncommitted edit made after the preview was taken\n' >> "$WORK/spec.yaml" +( cd "$WORK" && clad migrate --to 0.2 --apply --resolutions "$OUT/dirty-after.resolutions.json" --json ) > "$OUT/dirty-after.apply.json" 2>> "$OUT/dirty-after.err" +echo "dirtied-after-preview apply exit: $?" +head -c 220 "$OUT/dirty-after.apply.json" | tr -s '\n' ' ' +echo + +# ── 2. the baseline question, answered twice ──────────────────────────────── +WORK="$CWD/.guard-answered" +fresh_copy "$WORK" +( cd "$WORK" && clad migrate --to 0.2 --json ) > "$OUT/answered.preview.json" 2> "$OUT/answered.err" +write_resolutions "$OUT/answered.preview.json" "$OUT/answered.accept.json" accept +( cd "$WORK" && clad migrate --to 0.2 --apply --resolutions "$OUT/answered.accept.json" --json ) > "$OUT/answered.apply.json" 2>> "$OUT/answered.err" +echo "first apply (baseline accepted) exit: $?" +( cd "$WORK" && git add -A && git commit -qm "migrate to 0.2" ) >> "$OUT/answered.err" 2>&1 +AFTER_FIRST="$(shasum -a 256 "$WORK/spec.yaml" | cut -d' ' -f1)" +# The same decision file, the other answer, against a workspace that has already +# been migrated: the baseline must stay the one that was recorded. +write_resolutions "$OUT/answered.preview.json" "$OUT/answered.reject.json" reject +( cd "$WORK" && clad migrate --to 0.2 --apply --resolutions "$OUT/answered.reject.json" --json ) > "$OUT/answered.second.json" 2>> "$OUT/answered.err" +SECOND=$? +echo "second apply with the other answer exit: $SECOND" +head -c 300 "$OUT/answered.second.json" | tr -s '\n' ' ' +echo +echo "spec.yaml unchanged by the second answer: $([ "$AFTER_FIRST" = "$(shasum -a 256 "$WORK/spec.yaml" | cut -d' ' -f1)" ] && echo yes || echo NO)" +echo "paths changed by the second answer: $(changed_paths "$WORK" | wc -l | tr -d ' ')" + +# ── 3. a criterion sentence the 0.2 grammar cannot read ───────────────────── +WORK="$CWD/.guard-unparseable" +fresh_copy "$WORK" +SHARD="$(find "$WORK/spec/features" -name '*.yaml' | head -1)" +perl -pi -e 's/^(\s+)text: "The system shall convert a title into a lower-case hyphenated slug\."/$1text: "slug things, mostly"/' "$SHARD" +if ! grep -qF 'slug things, mostly' "$SHARD"; then + echo "FAIL: the unparseable-criterion mutation did not land" + exit 2 +fi +( cd "$WORK" && git add -A && git commit -qm "a criterion the 0.2 grammar cannot parse" ) >> "$OUT/unparseable.err" 2>&1 +echo "criterion rewritten to a sentence with no EARS shape, and committed" +( cd "$WORK" && clad migrate --to 0.2 --json ) > "$OUT/unparseable.preview.json" 2>> "$OUT/unparseable.err" +echo "preview exit: $?" +node -e ' + const fs = require("node:fs"); + const preview = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const required = preview.requiredResolution ?? []; + process.stdout.write(`required decisions: ${required.length}\n`); + process.stdout.write(`decision codes: ${[...new Set(required.map((r) => r.code))].join(", ") || "(none)"}\n`); + const text = required.filter((r) => String(r.code).startsWith("CRITERION_")); + process.stdout.write(text.length === 0 + ? "no criterion-text decision was demanded\n" + : `criterion-text decision demanded for: ${text.map((r) => r.subject).join(", ")}\n`); +' "$OUT/unparseable.preview.json" || true +# Applying without answering that question must be refused, or the demand is +# decorative. +node -e ' + const fs = require("node:fs"); + const preview = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const confirmed = (preview.requiredResolution ?? []) + .filter((item) => !String(item.code).startsWith("CRITERION_")) + .map((item) => (item.code === "PROJECT_LEGACY_L2_BASELINE" + ? {code: item.code, subject: item.subject, value: "accept"} + : item.code === "ARCHITECTURE_LAYER_RESOLUTION" + ? {code: item.code, subject: item.subject, value: {layers: []}} + : {code: item.code, subject: item.subject})); + fs.writeFileSync(process.argv[2], `${JSON.stringify({previewDigest: preview.previewDigest, confirmed}, null, 2)}\n`); +' "$OUT/unparseable.preview.json" "$OUT/unparseable.resolutions.json" +( cd "$WORK" && clad migrate --to 0.2 --apply --resolutions "$OUT/unparseable.resolutions.json" --json ) > "$OUT/unparseable.apply.json" 2>> "$OUT/unparseable.err" +echo "apply without the criterion answer exit: $?" +head -c 300 "$OUT/unparseable.apply.json" | tr -s '\n' ' ' +echo +echo "paths changed by the refused apply: $(changed_paths "$WORK" | wc -l | tr -d ' ')" diff --git a/scripts/ab-abc/row-migrate.sh b/scripts/ab-abc/row-migrate.sh new file mode 100644 index 00000000..97710a58 --- /dev/null +++ b/scripts/ab-abc/row-migrate.sh @@ -0,0 +1,148 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-migrate.sh — the migration row (L0-11), no agent +# +# Takes the completed 0.1 project arm B built and puts the candidate's migration +# through both answers from the SAME commit: the legacy-baseline decision +# rejected, then accepted. Three things are then checkable — that the preview +# writes nothing, that a rejected baseline still leaves a workspace the gate +# accepts, and that the accepted result passes the candidate's own strict +# pre-push gate (G4/R4). +# +# The first run measured none of that. It invoked `--preview` and +# `--decisions reject|accept`, neither of which exists: every migrate call died +# with "unknown option" and the strict pre-push that followed was run on an +# unmigrated 0.1 tree, so its exit 0 said nothing about the migration. The real +# surface is a read-only `clad migrate --to 0.2 --json` preview followed by +# `--apply --resolutions `, where the file carries the reviewed +# `previewDigest` and one confirmation per required decision. Accept and reject +# are not whole-migration modes: the only two-valued decision is +# PROJECT_LEGACY_L2_BASELINE, which is what this row now varies. +# +# The porcelain check also counted the fixture's own `node_modules` symlink as a +# changed path, which is why "preview left 1 changed paths" was reported for a +# preview that in fact wrote nothing. +# +# Called by sidetable.ts as: bash row-migrate.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +PREFIX_C="$ABC_ROOT/prefix-C" +SOURCE="$ABC_ROOT/sidetable/done/B" + +if [ "$ARM" != "C" ]; then + echo "not applicable: migrating to the newer schema is the candidate's verb" + exit 0 +fi +if [ ! -d "$SOURCE" ]; then + echo "no completed 0.1 fixture at $SOURCE — the row cannot run" + exit 3 +fi + +export PATH="$PREFIX_C/bin:$PATH" +echo "engine: $(command -v clad) $(clad --version)" + +run_pass() { + local label="$1" dir="$2" + rm -rf "$dir" + mkdir -p "$dir" + rsync -a --exclude 'node_modules' "$SOURCE/" "$dir/" + if [ -d "$SOURCE/node_modules" ]; then ln -s "$SOURCE/node_modules" "$dir/node_modules"; fi + echo "--- $label ---" + ( cd "$dir" && git rev-parse HEAD ) +} + +# The symlinked dependencies are the harness's own doing, so they never count as +# a path the engine changed. +changed_paths() { + ( cd "$1" && git status --porcelain ) | grep -v ' node_modules$' | grep -v '^?? node_modules' || true +} + +# Turns a reviewed preview into the decision file `--apply` requires. Every +# required decision is confirmed; the two-valued one carries the row's answer. +write_resolutions() { + local preview="$1" out="$2" baseline="$3" + node -e ' + const fs = require("node:fs"); + const [previewPath, outPath, baseline] = process.argv.slice(1); + const preview = JSON.parse(fs.readFileSync(previewPath, "utf8")); + const confirmed = (preview.requiredResolution ?? []).map((item) => { + if (item.code === "PROJECT_LEGACY_L2_BASELINE") return {code: item.code, subject: item.subject, value: baseline}; + // The 0.1 fixture declares `layers: []` — an empty list the preview will + // not project on its own. The reviewed answer is therefore "still none": + // naming a layer here would invent a `src//` directory the project + // does not have, and the gate would then refuse the migrated workspace for + // an invention of the harness rather than anything the migration did. + if (item.code === "ARCHITECTURE_LAYER_RESOLUTION") return {code: item.code, subject: item.subject, value: {layers: []}}; + if (item.code === "CRITERION_TEXT_UNKNOWN" || item.code === "CRITERION_STATEMENT_CONFLICT") { + return { + code: item.code, + subject: item.subject, + value: {statement: "The system shall retain an explicitly reviewed historic criterion.", kind: "behavior", testBindingDisposition: "drop"}, + }; + } + return {code: item.code, subject: item.subject}; + }); + fs.writeFileSync(outPath, `${JSON.stringify({previewDigest: preview.previewDigest, confirmed}, null, 2)}\n`); + process.stdout.write(`decisions written: ${confirmed.length} (${[...new Set(confirmed.map((c) => c.code))].join(", ") || "none"})\n`); + ' "$preview" "$out" "$baseline" +} + +# 1 — preview, which must not write anything. +WORK="$CWD/.migrate-preview" +run_pass preview "$WORK" +set +e +( cd "$WORK" && clad migrate --to 0.2 --json ) > "$OUT/migrate-preview.json" 2> "$OUT/migrate-preview.err" +echo "preview exit: $?" +set -e +changed_paths "$WORK" > "$OUT/migrate-preview.status" +echo "preview left $(wc -l < "$OUT/migrate-preview.status" | tr -d ' ') changed paths (0 is the honest answer)" +head -c 300 "$OUT/migrate-preview.err" + +# 2 — apply with the legacy-baseline decision rejected. +WORK="$CWD/.migrate-reject" +run_pass reject "$WORK" +set +e +( cd "$WORK" && clad migrate --to 0.2 --json ) > "$OUT/migrate-reject.preview.json" 2>> "$OUT/migrate-reject.err" +set -e +write_resolutions "$OUT/migrate-reject.preview.json" "$OUT/migrate-reject.resolutions.json" reject +set +e +( cd "$WORK" && clad migrate --to 0.2 --apply --resolutions "$OUT/migrate-reject.resolutions.json" --json ) > "$OUT/migrate-reject.json" 2>> "$OUT/migrate-reject.err" +echo "reject exit: $?" +set -e +changed_paths "$WORK" > "$OUT/migrate-reject.status" +echo "reject changed $(wc -l < "$OUT/migrate-reject.status" | tr -d ' ') paths" +head -c 400 "$OUT/migrate-reject.json" +echo +set +e +( cd "$WORK" && clad sync ) >> "$OUT/migrate-reject.err" 2>&1 +( cd "$WORK" && clad check --tier=pre-push --strict --json ) > "$OUT/migrate-reject.prepush.json" 2>> "$OUT/migrate-reject.err" +echo "reject strict pre-push exit: $?" +set -e + +# 3 — apply with the legacy baseline accepted, then the candidate's own gate. +WORK="$CWD/.migrate-accept" +run_pass accept "$WORK" +set +e +( cd "$WORK" && clad migrate --to 0.2 --json ) > "$OUT/migrate-accept.preview.json" 2>> "$OUT/migrate-accept.err" +set -e +write_resolutions "$OUT/migrate-accept.preview.json" "$OUT/migrate-accept.resolutions.json" accept +set +e +( cd "$WORK" && clad migrate --to 0.2 --apply --resolutions "$OUT/migrate-accept.resolutions.json" --json ) > "$OUT/migrate-accept.json" 2>> "$OUT/migrate-accept.err" +echo "accept exit: $?" +set -e +changed_paths "$WORK" > "$OUT/migrate-accept.status" +echo "accept changed $(wc -l < "$OUT/migrate-accept.status" | tr -d ' ') paths" +head -c 400 "$OUT/migrate-accept.json" +echo +grep -c 'schema: .0.2.' "$WORK/spec.yaml" > /dev/null 2>&1 && echo "spec.yaml now declares schema 0.2" || echo "spec.yaml does NOT declare schema 0.2" +set +e +( cd "$WORK" && clad sync ) >> "$OUT/migrate-accept.err" 2>&1 +( cd "$WORK" && clad check --tier=pre-push --strict --json ) > "$OUT/migrate-accept.prepush.json" 2>> "$OUT/migrate-accept.err" +ACCEPT_GATE=$? +set -e +echo "accept strict pre-push exit: $ACCEPT_GATE" +echo "G4 holds only when that exit is 0" diff --git a/scripts/ab-abc/row-portable-seal.sh b/scripts/ab-abc/row-portable-seal.sh new file mode 100644 index 00000000..8e7e1c2b --- /dev/null +++ b/scripts/ab-abc/row-portable-seal.sh @@ -0,0 +1,114 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-portable-seal.sh — a record stamped on a messy machine (S-C5) +# +# A working copy is never only what the repository holds. A file browser writes +# its own metadata inside a source folder, and a project ignores fixtures it +# still keeps on disk. The row puts both inside a folder the record seals, runs +# the passing gate that writes the record, commits it, and then clones the +# commit into a fresh directory — the same thing continuous integration does — +# and runs the strict check there. +# +# The question is whether the record describes the commit or the machine that +# wrote it. If it describes the machine, the clone recomputes different seals, +# reports every completed feature as stale, and exits non-zero: green here, red +# everywhere else. If it describes the commit, the clone accepts the file +# unchanged. +# +# The released engine writes no third-generation record to compare, so only the +# candidate arm runs. +# +# Called by sidetable.ts as: bash row-portable-seal.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ "$ARM" != "C" ]; then + echo "not applicable: the released engine writes no third-generation record to compare" + exit 0 +fi +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi +export PATH="$PREFIX/bin:$PATH" +cd "$CWD" +echo "engine: $(command -v clad) $(clad --version)" + +# 0 — the fixture must be a repository, because the question is about what a +# clone of a commit sees. A fixture that is not one makes the row meaningless. +if [ ! -d .git ]; then + git init -q + git config user.email "row@example.invalid" + git config user.name "Side table" +fi +printf 'ignored-fixture/\n*.local.json\n' >> .gitignore +git add -A +git -c commit.gpgsign=false commit -q -m "fixture before the stray files" || true + +# 1 — the stray files: one desktop metadata file inside a sealed source folder, +# one ignored fixture beside it, one ignored control at the root. +SEALED="$(node -e ' + const fs = require("node:fs"); + const path = require("node:path"); + const dirs = []; + const walk = (dir) => { + for (const entry of fs.readdirSync(dir, {withFileTypes: true})) { + if (entry.name === ".git" || entry.name === "node_modules") continue; + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { dirs.push(full); walk(full); } + } + }; + walk("src"); + process.stdout.write(dirs[0] ?? "src"); +' 2>/dev/null || echo src)" +mkdir -p "$SEALED" +printf 'desktop metadata\n' > "$SEALED/.DS_Store" +printf '{"scratch": true}\n' > "$SEALED/notes.local.json" +mkdir -p ignored-fixture +printf '{"name": "ignored-fixture"}\n' > ignored-fixture/package.json +echo "stray files written under: $SEALED (plus ignored-fixture/)" + +# 2 — the passing gate stamps the record on this messy machine. +set +e +clad check --tier=pre-push --json > "$OUT/prepush-$ARM.json" 2>"$OUT/prepush-$ARM.err" +STAMP=$? +set -e +echo "pre-push exit on the messy working copy: $STAMP" + +FILE="$(find spec -name 'attestation*.y*ml' 2>/dev/null | head -1 || true)" +if [ -z "$FILE" ]; then + echo "no record was written — the row has nothing to compare" + exit 2 +fi +echo "record: $FILE ($(wc -c < "$FILE" | tr -d ' ') bytes)" +cp "$FILE" "$OUT/attestation-stamped-$ARM.yaml" + +# 3 — commit the record exactly as an adopter would, then clone the commit. +git add -A +git -c commit.gpgsign=false commit -q -m "stamped on a machine holding stray files" +CLONE="$OUT/clone-$ARM" +rm -rf "$CLONE" +git clone -q "$CWD" "$CLONE" +if [ -d node_modules ]; then cp -R node_modules "$CLONE/node_modules"; fi +echo "cloned the commit to: $CLONE" + +# 4 — the check a fresh clone runs. This is the whole row. +cd "$CLONE" +set +e +clad check --tier=pre-commit --strict --json > "$OUT/clone-check-$ARM.json" 2>"$OUT/clone-check-$ARM.err" +CLONE_EXIT=$? +set -e +echo "clone strict pre-commit exit: $CLONE_EXIT" +echo "stale findings in the clone: $(grep -o 'STALE_ATTESTATION' "$OUT/clone-check-$ARM.json" | wc -l | tr -d ' ')" + +if cmp -s "$OUT/attestation-stamped-$ARM.yaml" "$FILE"; then + echo "record after the clone check: byte-identical to the stamped one" +else + echo "record after the clone check: CHANGED — the clone did not accept what the messy machine wrote" + diff <(head -40 "$OUT/attestation-stamped-$ARM.yaml") <(head -40 "$FILE") | head -20 || true +fi diff --git a/scripts/ab-abc/row-profiles.sh b/scripts/ab-abc/row-profiles.sh new file mode 100755 index 00000000..ebfd381e --- /dev/null +++ b/scripts/ab-abc/row-profiles.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-profiles.sh — the named check profiles (S-C1) +# +# The candidate replaces "which tier of checks do I want" with "what am I about +# to do": finishing a feature, pushing, cutting a release. The row asks whether +# those names carry different obligations — in particular whether the release +# profile really refuses to certify a tree with uncommitted work on it, since a +# release proved against bytes nobody committed is a release proved against +# nothing — and what happens when a name nobody defined is asked for. +# +# The harness's own dependency symlink shows up as an untracked path in every +# checkout, so it is excluded from git's view first: the row is about the +# engine's clean-tree rule, not about how the fixture was assembled. +# +# Called by sidetable.ts as: bash row-profiles.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi +export PATH="$PREFIX/bin:$PATH" +cd "$CWD" +echo "engine: $(command -v clad) $(clad --version)" + +# The symlink the harness makes, and the event log a run writes, are the +# harness's own footprint. Neither is the change a release would be certifying. +grep -qx 'node_modules' .git/info/exclude 2>/dev/null || echo 'node_modules' >> .git/info/exclude +echo "worktree at start: $(git status --porcelain | wc -l | tr -d ' ') changed paths" + +profile() { + local name="$1" + set +e + clad check --profile "$name" --json > "$OUT/profile-$name-$ARM.json" 2>"$OUT/profile-$name-$ARM.err" + local code=$? + set -e + echo "profile $name exit: $code" + echo "profile $name stderr: $(head -c 300 "$OUT/profile-$name-$ARM.err" | tr '\n' ' ')" +} + +if [ "$ARM" != "C" ]; then + # The released engine has tiers, not profiles. Recording what it says when a + # profile is asked for IS the comparison: the surface is simply not there. + profile completion + echo "released engine knows --profile: $(grep -qi "unknown option" "$OUT/profile-completion-$ARM.err" && echo no || echo yes)" + set +e + clad check --tier=pre-push --json > "$OUT/tier-prepush-$ARM.json" 2>"$OUT/tier-prepush-$ARM.err" + echo "tier pre-push exit: $?" + set -e + exit 0 +fi + +# 1 — completion, on the tree as the fixture left it. +profile completion + +# 2 — release, against a tree the gate has just made dirty. A passing gate +# rewrites the sealed record of what it verified, so the completion run +# above is itself the uncommitted change the release profile must refuse. +echo "worktree before the first release attempt:" +git status --porcelain | sed 's/^/ porcelain: /' | head -20 +profile release +echo "first release attempt names the commit stage: $(grep -qiE 'stage_1\.4|commit|uncommitted|clean' "$OUT/profile-release-$ARM.json" "$OUT/profile-release-$ARM.err" && echo yes || echo no)" + +# 3 — the same profile once the work is committed. +git add -A +git -c user.name=abc-harness -c user.email=abc-harness@example.invalid commit --quiet -m 'chore: commit what the completion profile wrote' || true +echo "worktree before the second release attempt: $(git status --porcelain | wc -l | tr -d ' ') changed paths" +set +e +clad check --profile release --json > "$OUT/profile-release-clean-$ARM.json" 2>"$OUT/profile-release-clean-$ARM.err" +RELEASE_CLEAN=$? +set -e +echo "release on a committed tree exit: $RELEASE_CLEAN" +echo "release on a committed tree stderr: $(head -c 300 "$OUT/profile-release-clean-$ARM.err" | tr '\n' ' ')" + +# 4 — a profile nobody defined. +set +e +clad check --profile bogus --json > "$OUT/profile-bogus-$ARM.json" 2>"$OUT/profile-bogus-$ARM.err" +BOGUS=$? +set -e +echo "profile bogus exit: $BOGUS" +echo "profile bogus said: $(cat "$OUT/profile-bogus-$ARM.err" "$OUT/profile-bogus-$ARM.json" 2>/dev/null | head -c 300 | tr '\n' ' ')" diff --git a/scripts/ab-abc/row-receipt-stale.sh b/scripts/ab-abc/row-receipt-stale.sh new file mode 100755 index 00000000..ad53715a --- /dev/null +++ b/scripts/ab-abc/row-receipt-stale.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-receipt-stale.sh — a receipt goes stale, and heals (S-D3) +# +# A human receipt says a person reviewed something. If the something then +# changes, the receipt is a statement about code that no longer exists — so it +# must stop counting until somebody signs again. This row is the regression guard +# for that: it replays the full L4 cycle through row-l4.sh, edits the module the +# completed feature declares, commits the edit so nothing but the content differs, +# and asks the push profile whether the audit obligation is still satisfied. +# +# Expected shape: green, then exit 1 with the audit obligation `unobserved:stale`, +# then green again once every criterion carries a fresh receipt. A row that stays +# green across the edit would mean a receipt outlives the thing it reviewed. +# +# Called by sidetable.ts as: bash row-receipt-stale.sh +set -uo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +HARNESS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +RECORD="$ABC_ROOT/sidetable/inprogress" + +if [ "$ARM" != "C" ]; then + echo "not applicable: signed receipts and their staleness are a 0.2 surface" + exit 0 +fi +if ! command -v expect > /dev/null; then + echo "not run: expect is not installed, and the signing prompts are interactive" + exit 3 +fi + +export PATH="$ABC_ROOT/prefix-C/bin:$PATH" + +# 1 — the completed, signed L4 cycle, replayed by the row that owns that recipe. +# Same artifact directory on purpose: the issuer key and the signing script it +# writes are what this row re-signs with. +unset ABC_L4_POLICY ABC_L4_ISSUER +bash "$HARNESS/row-l4.sh" C "$CWD" "$OUT" > "$OUT/stale-l4.log" 2>&1 +L4=$? +echo "L4 replay exit: $L4" +grep -E '^(completion exit|strict pre-push AFTER completion)' "$OUT/stale-l4.log" || true +if [ "$L4" -ne 0 ]; then + echo "the L4 replay did not complete — nothing to make stale" + tail -c 600 "$OUT/stale-l4.log" + exit 3 +fi + +FEATURE="$(cat "$RECORD/C.feature")" +export CLADDING_KEYS_DIR="$OUT/keys" + +( cd "$CWD" && git add -A && git commit -qm "cycle: complete $FEATURE" ) >> "$OUT/stale.log" 2>&1 +( cd "$CWD" && clad check --profile push --strict --json ) > "$OUT/stale-before.json" 2>> "$OUT/stale.log" +echo "push profile BEFORE the edit: exit $?" + +# 2 — change the module the feature declares, and commit it: the only difference +# from the signed state is the content a reviewer would have to look at again. +perl -pi -e 's{joins the remaining words with hyphens\.}{joins the remaining words with hyphens. Leading and trailing separators are trimmed.}' "$CWD/src/slugify.ts" +if ! grep -qF "Leading and trailing separators are trimmed." "$CWD/src/slugify.ts"; then + echo "FAIL: the module edit did not land — the row would measure nothing" + exit 2 +fi +( cd "$CWD" && git add -A && git commit -qm "edit the signed module" ) >> "$OUT/stale.log" 2>&1 +echo "edited and committed src/slugify.ts (the module the completed feature declares)" + +( cd "$CWD" && clad check --profile push --strict --json ) > "$OUT/stale-after-edit.json" 2>> "$OUT/stale.log" +AFTER_EDIT=$? +echo "push profile AFTER the edit: exit $AFTER_EDIT" +node -e ' + const fs = require("node:fs"); + const report = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const bad = (report.obligations ?? []).filter((o) => o.state !== "pass" && o.state !== "na"); + process.stdout.write(bad.length === 0 + ? "no obligation went unobserved after the edit\n" + : `unsatisfied obligations after the edit: ${bad.map((o) => `${o.obligation}/${o.state}${o.reason ? `(${o.reason})` : ""}`).join(", ")}\n`); +' "$OUT/stale-after-edit.json" || true + +# 3 — sign again, which is the whole remedy: a fresh receipt over the code as it +# now stands. +while read -r CRITERION; do + [ -n "$CRITERION" ] || continue + expect "$OUT/sign.exp" audit "$FEATURE" "$CWD" "$(cd "$CWD" && git config user.name)" "$CRITERION" >> "$OUT/stale.log" 2>&1 + echo "re-signed audit: $CRITERION" +done < "$RECORD/C.criteria" + +# The UAT claim goes stale with the same edit and is feature-scoped, so it is +# re-signed too — the audit matrix alone does not heal the gate. +expect "$OUT/sign.exp" uat "$FEATURE" "$CWD" "$(cd "$CWD" && git config user.name)" "" >> "$OUT/stale.log" 2>&1 +echo "re-signed uat: feature-scoped" + +( cd "$CWD" && git add -A && git commit -qm "re-sign the audit receipts" ) >> "$OUT/stale.log" 2>&1 +( cd "$CWD" && clad check --profile push --strict --json ) > "$OUT/stale-after-resign.json" 2>> "$OUT/stale.log" +AFTER_RESIGN=$? +echo "push profile AFTER re-signing: exit $AFTER_RESIGN" +node -e ' + const fs = require("node:fs"); + const report = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const bad = (report.obligations ?? []).filter((o) => o.state !== "pass" && o.state !== "na"); + process.stdout.write(bad.length === 0 + ? "every obligation passes again\n" + : `still unobserved: ${bad.map((o) => `${o.obligation}/${o.state}${o.reason ? `(${o.reason})` : ""}`).join(", ")}\n`); +' "$OUT/stale-after-resign.json" || true diff --git a/scripts/ab-abc/row-relocate.sh b/scripts/ab-abc/row-relocate.sh new file mode 100755 index 00000000..42c7fed6 --- /dev/null +++ b/scripts/ab-abc/row-relocate.sh @@ -0,0 +1,122 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-relocate.sh — the generated-projection move (S-F1) +# +# 0.10.0 moves the three derived files cladding writes for itself — the feature +# index, the doc-link map, the attestation — under spec/generated/, and retargets +# the `merge=union` line that keeps the index mergeable. A move of files a gate +# reads is only safe if all of this holds, so the row walks the whole lifetime in +# one pass: +# +# preview names three moves and writes nothing at all +# apply old paths gone, new paths byte-identical, .gitattributes retargeted +# gate the moved workspace still passes its own strict push profile +# again a second apply reports no change rather than moving twice +# conflict a workspace holding BOTH paths is refused, naming both +# 0.1 a schema-0.1 workspace is refused and pointed at `clad migrate` +# +# Arm B records the comparison: 0.9.4 has no such verb. +# +# Called by sidetable.ts as: bash row-relocate.sh +set -uo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +SOURCE_01="$ABC_ROOT/sidetable/done/B" + +export PATH="$ABC_ROOT/prefix-$ARM/bin:$PATH" +echo "engine: $(command -v clad) $(clad --version 2>&1)" + +if [ "$ARM" != "C" ]; then + ( cd "$CWD" && clad relocate-generated ) > "$OUT/relocate-b.txt" 2>&1 + echo "B relocate-generated exit: $?" + head -c 300 "$OUT/relocate-b.txt" + echo + echo "not applicable: relocating the generated projections is a 0.2 surface" + exit 0 +fi + +digest() { [ -f "$1" ] && shasum -a 256 "$1" | cut -d' ' -f1 || echo "(absent)"; } +changed_paths() { ( cd "$1" && git status --porcelain ) | grep -v 'node_modules' || true; } + +BEFORE_INDEX="$(digest "$CWD/spec/index.yaml")" +BEFORE_LINKS="$(digest "$CWD/spec/_doc-links.yaml")" +BEFORE_ATTEST="$(digest "$CWD/spec/attestation.yaml")" +echo "before: spec/index.yaml $BEFORE_INDEX" + +# 1 — the preview, which must be read-only. +( cd "$CWD" && clad relocate-generated --json ) > "$OUT/relocate-preview.json" 2> "$OUT/relocate.log" +echo "preview exit: $?" +node -e ' + const fs = require("node:fs"); + const plan = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + process.stdout.write(`preview state ${plan.state}; moves ${(plan.artifacts ?? []).length}; writes ${plan.writes}\n`); + process.stdout.write(`preview gitattributes: ${plan.gitattributes?.line} → ${plan.gitattributes?.action}\n`); + process.stdout.write(`preview moves: ${(plan.artifacts ?? []).map((a) => `${a.from}→${a.to}`).join(", ")}\n`); +' "$OUT/relocate-preview.json" || true +echo "preview left $(changed_paths "$CWD" | wc -l | tr -d ' ') changed paths" + +# 2 — the apply. +( cd "$CWD" && clad relocate-generated --apply --json ) > "$OUT/relocate-apply.json" 2>> "$OUT/relocate.log" +echo "apply exit: $?" +node -e ' + const fs = require("node:fs"); + const plan = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + process.stdout.write(`apply state ${plan.state}; changed ${plan.changed}; writes ${plan.writes}\n`); +' "$OUT/relocate-apply.json" || true +echo "old paths still present: $(ls "$CWD/spec/index.yaml" "$CWD/spec/_doc-links.yaml" "$CWD/spec/attestation.yaml" 2> /dev/null | wc -l | tr -d ' ') of 3" +echo "index bytes identical after the move: $([ "$(digest "$CWD/spec/generated/index.yaml")" = "$BEFORE_INDEX" ] && echo yes || echo NO)" +echo "doc-links bytes identical after the move: $([ "$(digest "$CWD/spec/generated/_doc-links.yaml")" = "$BEFORE_LINKS" ] && echo yes || echo NO)" +echo "attestation bytes identical after the move: $([ "$(digest "$CWD/spec/generated/attestation.yaml")" = "$BEFORE_ATTEST" ] && echo yes || echo NO)" +echo "gitattributes now: $(grep 'merge=union' "$CWD/.gitattributes" | head -1)" + +# 3 — the moved workspace's own gate. +( cd "$CWD" && clad sync ) >> "$OUT/relocate.log" 2>&1 +echo "sync exit: $?" +( cd "$CWD" && git add -A && git commit -qm "relocate the generated projections" ) >> "$OUT/relocate.log" 2>&1 +( cd "$CWD" && clad check --profile push --strict --json ) > "$OUT/relocate-gate.json" 2>> "$OUT/relocate.log" +echo "strict push profile after the move: exit $?" + +# 4 — the same command again. +( cd "$CWD" && clad relocate-generated --apply --json ) > "$OUT/relocate-again.json" 2>> "$OUT/relocate.log" +echo "second apply exit: $?" +node -e ' + const fs = require("node:fs"); + const plan = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + process.stdout.write(`second apply state ${plan.state}; changed ${plan.changed}\n`); +' "$OUT/relocate-again.json" || true + +# 5 — both paths present at once: which of the two is the truth is not the +# engine's guess to make. +cp "$CWD/spec/generated/index.yaml" "$CWD/spec/index.yaml" +( cd "$CWD" && clad relocate-generated --json ) > "$OUT/relocate-conflict.json" 2> "$OUT/relocate-conflict.err" +CONFLICT=$? +echo "conflict exit: $CONFLICT" +node -e ' + const fs = require("node:fs"); + const plan = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const clash = (plan.artifacts ?? []).filter((a) => a.action === "conflict"); + process.stdout.write(`conflict state ${plan.state}; conflicting artifacts ${clash.length}\n`); + process.stdout.write(`conflict names: ${clash.map((a) => `${a.from} and ${a.to}`).join("; ") || "(none)"}\n`); +' "$OUT/relocate-conflict.json" || true +# The preview only describes; the refusal that matters is what --apply does when +# both copies exist, because choosing between them is not the engine's to guess. +( cd "$CWD" && clad relocate-generated --apply --json ) > "$OUT/relocate-conflict-apply.json" 2>> "$OUT/relocate-conflict.err" +echo "conflict apply exit: $?" +head -c 400 "$OUT/relocate-conflict-apply.json" | tr -s '\n' ' ' +echo +echo "both copies still present after the refusal: $(ls "$CWD/spec/index.yaml" "$CWD/spec/generated/index.yaml" 2> /dev/null | wc -l | tr -d ' ') of 2" +rm -f "$CWD/spec/index.yaml" + +# 6 — a schema-0.1 workspace, driven by the same candidate binary. +WORK="$CWD/.relocate-01" +rm -rf "$WORK" +mkdir -p "$WORK" +rsync -a --exclude node_modules "$SOURCE_01/" "$WORK/" >> "$OUT/relocate.log" 2>&1 +( cd "$WORK" && clad relocate-generated --json ) > "$OUT/relocate-01.json" 2> "$OUT/relocate-01.err" +echo "0.1 workspace exit: $?" +head -c 400 "$OUT/relocate-01.json" "$OUT/relocate-01.err" | tr -s '\n' ' ' +echo +rm -rf "$WORK" diff --git a/scripts/ab-abc/row-retired-surfaces.sh b/scripts/ab-abc/row-retired-surfaces.sh new file mode 100755 index 00000000..8f51adad --- /dev/null +++ b/scripts/ab-abc/row-retired-surfaces.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-retired-surfaces.sh — what is gone is gone (S-G1) +# +# The release removes the experimental headless loop, its command, its skill and +# the parts that existed only to serve it. Removal is a claim about files, so the +# row reads the installed package rather than the source tree: an entry point +# that still ships, or a skill folder still copied into the plugin, would keep +# the command reachable however the release notes phrase it. The scaffold is +# checked too, because a project told to run a command that no longer exists is +# worse off than one never told about it. +# +# Called by sidetable.ts as: bash row-retired-surfaces.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi +export PATH="$PREFIX/bin:$PATH" +echo "engine: $(command -v clad) $(clad --version)" + +ROOT="$(node -e ' + const path = require("node:path"); + const fs = require("node:fs"); + const prefix = process.argv[1]; + const candidates = [ + path.join(prefix, "lib", "node_modules", "cladding"), + path.join(prefix, "node_modules", "cladding"), + ]; + const found = candidates.find((dir) => fs.existsSync(dir)); + process.stdout.write(found ?? ""); +' "$PREFIX")" +if [ -z "$ROOT" ]; then + echo "the installed package root could not be located under $PREFIX" + exit 3 +fi +echo "installed package: $ROOT" + +# `grep` exits non-zero when it matches nothing, and matching nothing is the +# answer this row is hoping for — so every count is taken with the pipeline's +# failure explicitly swallowed, or an empty result would look like a broken row. +count_matching() { + local label="$1"; shift + local hits + hits="$(find "$ROOT" "$@" 2>/dev/null | { grep -v '/node_modules/' || true; })" + local n=0 + if [ -n "$hits" ]; then n="$(printf '%s\n' "$hits" | wc -l | tr -d ' ')"; fi + echo "$label: $n" + if [ -n "$hits" ]; then printf '%s\n' "$hits" | head -8 | sed 's/^/ path: /'; fi +} +count_matching "skills/run folders in the installed package" -type d -name run -path '*skills*' +count_matching "drive modules in the installed package" -type f -name 'drive*' +count_matching "run skill documents in the installed package" -type f -path '*skills/run/*' + +RUN_IN_HELP="$(clad --help 2>&1 | { grep -cE '^[[:space:]]+run[[:space:]]' || true; })" +echo "run command in --help: $RUN_IN_HELP" +set +e +clad run --help > "$OUT/run-help-$ARM.log" 2>&1 +RUN_EXIT=$? +set -e +echo "clad run exit: $RUN_EXIT" +echo "clad run said: $(head -c 300 "$OUT/run-help-$ARM.log" | tr '\n' ' ')" +# Exit code alone is not the answer: an unknown verb can still print the root +# help and exit 0. What settles it is whether the loop's own description comes +# back, and whether the shipped bundle still carries the loop at all — the +# published package inlines its modules, so a file name search over the tree +# finds nothing on either engine and would report a retirement that never +# happened. +echo "run verb reachable: $(grep -qF 'Headless autonomous loop' "$OUT/run-help-$ARM.log" && echo yes || echo no)" +BUNDLE="$ROOT/dist/clad.js" +if [ -f "$BUNDLE" ]; then + echo "shipped bundle: $BUNDLE ($(wc -c < "$BUNDLE" | tr -d ' ') bytes)" + echo "bundle carries the loop description: $(grep -qF 'Headless autonomous loop' "$BUNDLE" && echo yes || echo no)" + echo "bundle carries the loop driver: $(grep -qE 'runDriveLoop|drive-loop' "$BUNDLE" && echo yes || echo no)" + echo "bundle carries the crash postmortem: $(grep -qiE 'postmortem' "$BUNDLE" && echo yes || echo no)" +else + echo "shipped bundle: (not found at $BUNDLE)" +fi + +if [ -f "$CWD/AGENTS.md" ]; then + echo "scaffold AGENTS.md mentions clad run: $(grep -qF 'clad run' "$CWD/AGENTS.md" && echo yes || echo no)" +else + echo "scaffold AGENTS.md mentions clad run: (no AGENTS.md in this fixture)" +fi diff --git a/scripts/ab-abc/row-scenario-policy.sh b/scripts/ab-abc/row-scenario-policy.sh new file mode 100755 index 00000000..67ae1f39 --- /dev/null +++ b/scripts/ab-abc/row-scenario-policy.sh @@ -0,0 +1,239 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-scenario-policy.sh — advisory versus required (S-B4) +# +# A scenario that names no feature is a described journey nobody has claimed. +# Whether that is worth mentioning or worth stopping for is a project's own +# choice, and the candidate makes it one setting. The row asks whether the +# setting actually decides: the same workspace, the same unbound scenario, under +# `advisory` and then under `required`. A setting that changes nothing is a +# setting in name only. +# +# The row also records where the boundary sits. The editing surface has its own +# opinion about unbound scenarios, independent of the project policy, so the +# creation attempt is recorded as the fact it is before the gate question is +# asked — and if the tool refuses, the shard is written from the shape the tool +# itself produced for a bound scenario, so the gate still gets its input. +# +# Called by sidetable.ts as: bash row-scenario-policy.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ "$ARM" != "C" ]; then + echo "not applicable: the scenario policy is a schema 0.2 setting" + exit 0 +fi +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi +export PATH="$PREFIX/bin:$PATH" +cd "$CWD" +echo "engine: $(command -v clad) $(clad --version)" +echo "declared policy at start: $(grep -m1 -E '^[[:space:]]*scenario_policy:' spec.yaml || echo '(absent)')" + +drive() { + node "$ABC_HARNESS/mcp-client.mjs" --cwd "$CWD" --server "$PREFIX/bin/clad serve" \ + --calls "$1" --out "$2" > /dev/null 2>&1 || true +} +tool_said() { + node -e ' + const fs = require("node:fs"); + const results = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const call = results.find((entry) => entry.type === "tool"); + const text = call?.result?.content?.[0]?.text ?? JSON.stringify(call ?? {}); + process.stdout.write(`${process.argv[2]}: ${call?.result?.isError ? "refused" : "accepted"} — ${text.replace(/\s+/g, " ").slice(0, 400)}\n`); + ' "$1" "$2" +} + +# 0 — one feature, so a BOUND scenario is possible at all. +cat > "$OUT/create-feature.calls.json" <<'CREATE' +[ + { + "type": "tool", + "name": "clad_create_feature", + "args": { + "slug": "journey-subject", + "title": "A feature a journey can name", + "purpose": "The row needs one feature so a bound scenario is possible.", + "modules": ["src/journey-subject.ts"], + "capability_refs": [], + "acceptance_criteria": [ + {"kind": "behavior", "statement": "The system shall bind a described journey to the feature it exercises."} + ] + } + } +] +CREATE +drive "$OUT/create-feature.calls.json" "$OUT/create-feature.json" +FEATURE="$(node -e ' + const fs = require("node:fs"); + const id = fs.readFileSync(process.argv[1], "utf8").match(/F-[0-9a-f]{6,8}/); + if (!id) throw new Error("no feature id"); + process.stdout.write(id[0]); +' "$OUT/create-feature.json")" || { echo "the create call produced no feature id"; exit 2; } +echo "feature: $FEATURE" +# The scaffold ships no source at all, so the type stage fails on an empty +# include list and the gate's exit says nothing about scenarios. One real module +# and one real test give the row a workspace whose gate result is about its own +# question. +mkdir -p src tests +cat > src/journey-subject.ts <<'MODULE' +// Fixture module — the feature a described journey names. +export function journeySubject(): string { + return 'checkout'; +} +MODULE +cat > tests/journey-subject.test.ts <<'TEST' +import {describe, expect, test} from 'vitest'; + +import {journeySubject} from '../src/journey-subject.js'; + +describe('journey subject', () => { + test('names the journey it belongs to', () => { + expect(journeySubject()).toBe('checkout'); + }); +}); +TEST + +# 1 — the unbound scenario, attempted through the tool. +cat > "$OUT/unbound.calls.json" <<'UNBOUND' +[ + { + "type": "tool", + "name": "clad_create_scenario", + "args": { + "slug": "unclaimed-journey", + "title": "A journey nobody has claimed", + "actor": "a first-time visitor", + "goal": "finish checkout without an account", + "success": "the order is placed and a receipt is shown", + "steps": ["opens the basket", "chooses guest checkout", "pays", "reads the receipt"] + } + } +] +UNBOUND +drive "$OUT/unbound.calls.json" "$OUT/unbound.json" +tool_said "$OUT/unbound.json" "unbound scenario through the tool" + +# 2 — a bound scenario, which also gives the row a shard shape it did not invent. +node -e ' + const fs = require("node:fs"); + const [callsPath, feature] = process.argv.slice(1); + fs.writeFileSync(callsPath, `${JSON.stringify([{type: "tool", name: "clad_create_scenario", args: { + slug: "claimed-journey", + title: "A journey the feature claims", + actor: "a first-time visitor", + goal: "finish checkout without an account", + success: "the order is placed and a receipt is shown", + steps: ["opens the basket", "chooses guest checkout", "pays", "reads the receipt"], + features: [feature], + }}], null, 2)}\n`); +' "$OUT/bound.calls.json" "$FEATURE" +drive "$OUT/bound.calls.json" "$OUT/bound.json" +tool_said "$OUT/bound.json" "bound scenario through the tool" +ls spec/scenarios 2>/dev/null | sed 's/^/scenario shard: /' || echo "scenario shard: (none)" + +# 3 — if the surface refused the unbound one, the gate still needs one to judge. +if ! ls spec/scenarios/unclaimed-journey-*.yaml >/dev/null 2>&1; then + BOUND_SHARD="$(ls spec/scenarios/*.yaml 2>/dev/null | head -1 || true)" + if [ -n "$BOUND_SHARD" ]; then + node -e ' + const fs = require("node:fs"); + const [source, feature] = process.argv.slice(1); + const raw = fs.readFileSync(source, "utf8"); + // The identifier has to look like one the tool would have minted, and the + // reference list has to be genuinely empty — an id the reader rejects, or a + // surviving reference, would make the row measure the wrong refusal. + const unbound = raw + .replace(/^id:.*$/m, "id: S-facade01") + .replace(/^title:.*$/m, "title: \"A journey nobody has claimed\"") + .replace(/^feature_refs:\n(?:\s+-\s.*\n)*/m, "feature_refs: []\n") + .replace(/^features:\n(?:\s+-\s.*\n)*/m, "features: []\n"); + const written = source.replace(/[^/]+$/, "unclaimed-journey-facade01.yaml"); + fs.writeFileSync(written, unbound); + process.stdout.write(`unbound shard written by hand from the tool-produced shape: ${written}\n`); + process.stdout.write(`unbound shard still names a feature: ${/F-[0-9a-f]{6,8}/.test(unbound) ? "yes" : "no"}\n`); + ' "$BOUND_SHARD" "$FEATURE" + else + echo "no scenario shard on disk — the gate question cannot be asked" + fi +fi +clad sync > "$OUT/sync.log" 2>&1 || true + +# 4 — the gate under the declared policy, then under the stricter one. +run_gate() { + local label="$1" + set +e + clad check --profile checkpoint --json > "$OUT/check-$label.json" 2>"$OUT/check-$label.err" + local code=$? + set -e + echo "$label gate exit: $code" + node -e ' + const fs = require("node:fs"); + let gate; + try { gate = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); } catch { gate = null; } + const label = process.argv[2]; + if (gate === null) { process.stdout.write(`${label} gate emitted no JSON\n`); process.exit(0); } + const findings = (gate.stages ?? []).flatMap((stage) => (stage.findings ?? []).map((f) => ({stage: stage.stage, ...f}))); + const scenario = findings.filter((f) => /scenario|journey/i.test(`${f.detector ?? ""} ${f.message ?? ""}`)); + process.stdout.write(`${label} scenario findings: ${scenario.length === 0 ? "(none)" : scenario.map((f) => `${f.severity}/${f.detector}: ${(f.message ?? "").slice(0, 140)}`).join(" | ")}\n`); + const failing = (gate.stages ?? []).filter((s) => s.status === "fail").map((s) => `${s.stage} ${s.label}`); + process.stdout.write(`${label} failing stages: ${failing.length === 0 ? "(none)" : failing.join(", ")}\n`); + process.stdout.write(`${label} unbound criteria: ${JSON.stringify(gate.unbound_criteria ?? "(not reported)").slice(0, 200)}\n`); + ' "$OUT/check-$label.json" "$label" +} +run_gate advisory + +# The typed surface validates the whole workspace before it will transact, and an +# unbound journey fails that validation whatever the project policy says — so the +# policy cannot be changed while the shard the row wrote is on disk. The row +# records that as the boundary it is, then takes the shard out of the way, makes +# the change, and puts it back: the gate question is about the policy, and it +# should not be answered by an editing rule that fired first. +UNBOUND_SHARD="$(ls spec/scenarios/unclaimed-journey-*.yaml 2>/dev/null | head -1 || true)" +if [ -n "$UNBOUND_SHARD" ]; then + cp "$UNBOUND_SHARD" "$OUT/unbound-shard.yaml" + node -e ' + const fs = require("node:fs"); + fs.writeFileSync(process.argv[1], `${JSON.stringify([{type: "tool", name: "clad_prepare_spec_edit", args: {operations: [{kind: "project.set_policy", scenarioPolicy: "required"}]}}], null, 2)}\n`); + ' "$OUT/policy-blocked.calls.json" + drive "$OUT/policy-blocked.calls.json" "$OUT/policy-blocked.json" + tool_said "$OUT/policy-blocked.json" "policy change attempted with the unbound journey on disk" + rm -f "$UNBOUND_SHARD" + clad sync > "$OUT/sync-without-unbound.log" 2>&1 || true +fi + +# The policy is changed through the typed surface, the way a project would. +node -e ' + const fs = require("node:fs"); + fs.writeFileSync(process.argv[1], `${JSON.stringify([{type: "tool", name: "clad_prepare_spec_edit", args: {operations: [{kind: "project.set_policy", scenarioPolicy: "required"}]}}], null, 2)}\n`); +' "$OUT/policy-prepare.calls.json" +drive "$OUT/policy-prepare.calls.json" "$OUT/policy-prepare.json" +node -e ' + const fs = require("node:fs"); + const prepared = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const call = prepared.find((entry) => entry.type === "tool"); + const payload = call?.result?.structuredContent ?? JSON.parse(call?.result?.content?.[0]?.text ?? "{}"); + const args = { + operations: [{kind: "project.set_policy", scenarioPolicy: "required"}], + input_revisions: payload.input_revisions ?? {}, + ...(payload.context_revision ? {context_revision: payload.context_revision} : {}), + }; + fs.writeFileSync(process.argv[2], `${JSON.stringify([{type: "tool", name: "clad_edit_spec", args}], null, 2)}\n`); +' "$OUT/policy-prepare.json" "$OUT/policy-apply.calls.json" +drive "$OUT/policy-apply.calls.json" "$OUT/policy-apply.json" +tool_said "$OUT/policy-apply.json" "policy change to required" +echo "declared policy after the change: $(grep -m1 -E '^[[:space:]]*scenario_policy:' spec.yaml || echo '(absent)')" +if [ -f "$OUT/unbound-shard.yaml" ] && [ -n "${UNBOUND_SHARD:-}" ]; then + cp "$OUT/unbound-shard.yaml" "$UNBOUND_SHARD" + clad sync > "$OUT/sync-with-unbound.log" 2>&1 || true + echo "unbound journey restored: $UNBOUND_SHARD" +fi +run_gate required diff --git a/scripts/ab-abc/row-signoff-refusals.sh b/scripts/ab-abc/row-signoff-refusals.sh new file mode 100755 index 00000000..1c3bba3a --- /dev/null +++ b/scripts/ab-abc/row-signoff-refusals.sh @@ -0,0 +1,133 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-signoff-refusals.sh — the four refusal paths of a +# verified sign-off (S-D2) +# +# A verified receipt is the only evidence 0.10.0 will call human. That claim is +# worth exactly as much as the paths that refuse to produce one, so this row +# drives all four in a row and shows what each left behind: +# +# 1 no terminal a headless `--verified` run cannot ask anyone, so it +# must degrade to HUMAN_REQUIRED and write no receipt. +# 2 the wrong feature id the prompt asks the human to re-type the id; typing +# another feature's id must refuse, not sign. +# 3 an unregistered issuer a name with no entry in the committed registry +# cannot sign, whatever the terminal says. +# 4 no --verified the asserted path still records history — it is +# allowed, and it must not leave a receipt behind. +# +# The evidence directory is inspected after every path, because "was refused" +# and "was refused but wrote the receipt anyway" read identically in stdout. +# +# Called by sidetable.ts as: bash row-signoff-refusals.sh +set -uo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +RECORD="$ABC_ROOT/sidetable/inprogress" + +if [ "$ARM" != "C" ]; then + echo "not applicable: verified receipts are a 0.2 surface" + exit 0 +fi +if ! command -v expect > /dev/null; then + echo "not run: expect is not installed, and path 2 needs a terminal to type into" + exit 3 +fi +if [ ! -f "$RECORD/C.feature" ]; then + echo "no in-progress fixture record at $RECORD — re-run --bootstrap" + exit 3 +fi + +export PATH="$ABC_ROOT/prefix-C/bin:$PATH" +export CLADDING_KEYS_DIR="$OUT/keys" +rm -rf "$CLADDING_KEYS_DIR" +echo "engine: $(command -v clad) $(clad --version)" + +FEATURE="$(cat "$RECORD/C.feature")" +CRITERION="$(head -1 "$RECORD/C.criteria")" +echo "feature $FEATURE, criterion $CRITERION" + +# Counts receipt files, so a refusal that wrote one is visible. +receipts() { + find "$CWD/spec/evidence" -name '*.yaml' 2> /dev/null | wc -l | tr -d ' ' +} +echo "receipts before anything: $(receipts)" + +( cd "$CWD" && clad key create --issuer alice --json ) > "$OUT/key.json" 2>&1 +echo "issuer alice registered: exit $?" + +# 1 — no terminal at all. +( cd "$CWD" && clad signoff "$FEATURE" --claim audit --criterion "$CRITERION" --result pass \ + --verified --issuer alice --json < /dev/null ) > "$OUT/no-tty.json" 2> "$OUT/no-tty.err" +echo "no-tty exit: $?" +grep -o 'HUMAN_REQUIRED' "$OUT/no-tty.json" | head -1 || echo "no HUMAN_REQUIRED in the headless result" +head -c 300 "$OUT/no-tty.json" +echo +echo "receipts after the headless attempt: $(receipts)" + +# 2 — a terminal, and the wrong id typed into it. +cat > "$OUT/wrong-id.exp" <<'EXP' +#!/usr/bin/expect -f +set timeout 60 +set feature [lindex $argv 0] +set dir [lindex $argv 1] +set criterion [lindex $argv 2] +cd $dir +spawn clad signoff $feature --claim audit --criterion $criterion --result pass --verified --issuer alice +expect -re "feature id.*: " +send "F-00000000\r" +expect eof +catch wait result +exit [lindex $result 3] +EXP +expect "$OUT/wrong-id.exp" "$FEATURE" "$CWD" "$CRITERION" > "$OUT/wrong-id.txt" 2>&1 +echo "wrong-id exit: $?" +# The interactive path prints prose rather than a JSON code, so the refusal is +# pinned on the sentence the human actually reads. +if grep -qF "needs a human to re-enter the feature id" "$OUT/wrong-id.txt"; then + echo "wrong-id refusal: a human must re-enter the feature id — only asserted history was recorded" +else + echo "wrong-id: NO refusal sentence in the transcript" +fi +tail -c 300 "$OUT/wrong-id.txt" +echo +echo "receipts after the mistyped confirmation: $(receipts)" + +# 3 — an issuer the committed registry does not carry. +cat > "$OUT/unregistered.exp" <<'EXP' +#!/usr/bin/expect -f +set timeout 60 +set feature [lindex $argv 0] +set dir [lindex $argv 1] +set criterion [lindex $argv 2] +cd $dir +spawn clad signoff $feature --claim audit --criterion $criterion --result pass --verified --issuer mallory +expect { + -re "feature id.*: " { send "$feature\r"; exp_continue } + eof +} +catch wait result +exit [lindex $result 3] +EXP +expect "$OUT/unregistered.exp" "$FEATURE" "$CWD" "$CRITERION" > "$OUT/unregistered.txt" 2>&1 +echo "unregistered-issuer exit: $?" +if grep -qF "is not registered in spec/trust/issuers.yaml" "$OUT/unregistered.txt"; then + echo "unregistered-issuer refusal: mallory is not registered in spec/trust/issuers.yaml" +else + echo "unregistered-issuer: NO registry refusal in the transcript" +fi +tail -c 300 "$OUT/unregistered.txt" +echo +echo "receipts after the unregistered issuer: $(receipts)" + +# 4 — the asserted path, which is allowed and must stay history-only. +( cd "$CWD" && clad signoff "$FEATURE" --claim audit --criterion "$CRITERION" --result pass --json ) \ + > "$OUT/asserted.json" 2> "$OUT/asserted.err" +echo "asserted exit: $?" +head -c 300 "$OUT/asserted.json" +echo +echo "receipts after the asserted sign-off: $(receipts)" +echo "audit-log signoff events: $(grep -c 'signoff' "$CWD/.cladding/audit.log.jsonl" 2> /dev/null || echo 0)" diff --git a/scripts/ab-abc/row-stale-edit.sh b/scripts/ab-abc/row-stale-edit.sh new file mode 100644 index 00000000..e23cb427 --- /dev/null +++ b/scripts/ab-abc/row-stale-edit.sh @@ -0,0 +1,127 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-stale-edit.sh — the stale typed edit row (L0-8) +# +# Prepares a typed spec edit, changes the target underneath it, then applies the +# prepared edit. A prepared edit that still lands has overwritten somebody else's +# change; the candidate is expected to refuse it instead. +# +# Two things the first run got wrong are fixed here. The row ran against a +# freshly scaffolded workspace that holds no feature at all, so reading +# `spec/features` threw ENOENT before any tool was called; the row now creates +# the feature it edits. And the apply call was assembled from a guessed +# `input_sha256` field: the real surface takes `operations` plus an +# `input_revisions` map (and an optional `context_revision`), all of which the +# prepare call hands back, so those are now copied through verbatim. +# +# Called by sidetable.ts as: bash row-stale-edit.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ "$ARM" != "C" ]; then + echo "not applicable: typed edits are a schema 0.2 surface" + exit 0 +fi + +echo "engine: $PREFIX/bin/clad $(PATH="$PREFIX/bin:$PATH" clad --version)" + +drive() { + node "$ABC_HARNESS/mcp-client.mjs" --cwd "$CWD" --server "$PREFIX/bin/clad serve" \ + --calls "$1" --out "$2" > /dev/null +} + +# 0 — the feature this row edits. A bare 0.2 scaffold carries none. +cat > "$OUT/create.calls.json" <<'CREATE' +[ + { + "type": "tool", + "name": "clad_create_feature", + "args": { + "slug": "stale-edit-subject", + "title": "A feature whose title a stale edit will try to change", + "purpose": "The row needs one real feature to prepare an edit against.", + "modules": ["src/stale.ts"], + "capability_refs": [], + "acceptance_criteria": [ + {"kind": "behavior", "statement": "The system shall refuse a typed edit whose declared input revision is stale."} + ] + } + } +] +CREATE +drive "$OUT/create.calls.json" "$OUT/create.json" +FEATURE="$(node -e ' + const fs = require("node:fs"); + const text = fs.readFileSync(process.argv[1], "utf8"); + if (/"isError":\s*true/.test(text)) throw new Error(`the tool refused the feature: ${text.slice(0, 600)}`); + const id = text.match(/F-[0-9a-f]{6,8}/); + if (!id) throw new Error(`no feature id in the create result: ${text.slice(0, 600)}`); + process.stdout.write(id[0]); +' "$OUT/create.json")" +echo "feature under edit: $FEATURE" + +# 1 — prepare the edit and keep the revisions it hands back. +node -e ' + const fs = require("node:fs"); + const [callsPath, feature] = process.argv.slice(1); + const operations = [{kind: "feature.set_title", featureId: feature, title: "A title written from a stale prepare"}]; + fs.writeFileSync(callsPath, `${JSON.stringify([{type: "tool", name: "clad_prepare_spec_edit", args: {operations}}], null, 2)}\n`); +' "$OUT/prepare.calls.json" "$FEATURE" +drive "$OUT/prepare.calls.json" "$OUT/prepare.json" +echo "prepare recorded to prepare.json" +node -e ' + const fs = require("node:fs"); + const prepared = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const call = prepared.find((entry) => entry.type === "tool"); + const payload = call?.result?.structuredContent + ?? JSON.parse(call?.result?.content?.[0]?.text ?? "{}"); + process.stdout.write(`prepared input revisions: ${Object.keys(payload.input_revisions ?? {}).join(", ") || "(none)"}\n`); +' "$OUT/prepare.json" + +# 2 — move the ground under it. +node -e ' + const fs = require("node:fs"); + const path = require("node:path"); + const root = path.join(process.argv[1], "spec", "features"); + for (const name of fs.readdirSync(root)) { + const full = path.join(root, name); + const raw = fs.readFileSync(full, "utf8"); + if (!raw.includes(process.argv[2])) continue; + fs.writeFileSync(full, `${raw}\n# an edit that happened after the prepare\n`); + process.stdout.write(`changed on disk after the prepare: spec/features/${name}\n`); + break; + } +' "$CWD" "$FEATURE" + +# 3 — apply the now-stale edit, with the prepare's own revisions. +node -e ' + const fs = require("node:fs"); + const [preparePath, callsPath, feature] = process.argv.slice(1); + const prepared = JSON.parse(fs.readFileSync(preparePath, "utf8")); + const call = prepared.find((entry) => entry.type === "tool"); + const payload = call?.result?.structuredContent + ?? JSON.parse(call?.result?.content?.[0]?.text ?? "{}"); + if (!payload.input_revisions) throw new Error(`the prepare returned no input_revisions: ${JSON.stringify(payload).slice(0, 600)}`); + const args = { + operations: [{kind: "feature.set_title", featureId: feature, title: "A title written from a stale prepare"}], + input_revisions: payload.input_revisions, + ...(payload.context_revision ? {context_revision: payload.context_revision} : {}), + }; + fs.writeFileSync(callsPath, `${JSON.stringify([{type: "tool", name: "clad_edit_spec", args}], null, 2)}\n`); +' "$OUT/prepare.json" "$OUT/apply.calls.json" "$FEATURE" +drive "$OUT/apply.calls.json" "$OUT/apply.json" +echo "apply result recorded to apply.json — the row asks whether it was refused" +grep -o 'STALE_INPUT' "$OUT/apply.json" | head -1 || echo "no STALE_INPUT in the apply result" +node -e ' + const fs = require("node:fs"); + const applied = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const call = applied.find((entry) => entry.type === "tool"); + const text = call?.result?.content?.[0]?.text ?? JSON.stringify(call ?? {}); + process.stdout.write(`apply said: ${text.slice(0, 400)}\n`); +' "$OUT/apply.json" diff --git a/scripts/ab-abc/row-typed-edit-two.sh b/scripts/ab-abc/row-typed-edit-two.sh new file mode 100755 index 00000000..58acd46f --- /dev/null +++ b/scripts/ab-abc/row-typed-edit-two.sh @@ -0,0 +1,131 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/row-typed-edit-two.sh — two edits, one snapshot (S-B3) +# +# The stale-input rule has to refuse the edit that would overwrite somebody +# else's change WITHOUT refusing the edit that merely happened to be prepared at +# the same moment. Two features are prepared from the identical snapshot and +# touch different files: applying the first must not invalidate the second, and +# replaying the first from its now-spent snapshot must be refused. A rule that +# fails the second edit is too strict to work in a team; a rule that accepts the +# replay is not a rule at all. +# +# Called by sidetable.ts as: bash row-typed-edit-two.sh +set -euo pipefail + +ARM="$1" +CWD="$2" +OUT="$3" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +PREFIX="$ABC_ROOT/prefix-$ARM" + +if [ "$ARM" != "C" ]; then + echo "not applicable: typed spec edits are a schema 0.2 surface" + exit 0 +fi +if [ ! -x "$PREFIX/bin/clad" ]; then + echo "no engine at $PREFIX/bin/clad — the row cannot run" + exit 3 +fi +export PATH="$PREFIX/bin:$PATH" +cd "$CWD" +echo "engine: $(command -v clad) $(clad --version)" + +drive() { + node "$ABC_HARNESS/mcp-client.mjs" --cwd "$CWD" --server "$PREFIX/bin/clad serve" \ + --calls "$1" --out "$2" > /dev/null 2>&1 || true +} + +feature_id() { + node -e ' + const fs = require("node:fs"); + const text = fs.readFileSync(process.argv[1], "utf8"); + const id = text.match(/F-[0-9a-f]{6,8}/); + if (!id) throw new Error(`no feature id: ${text.slice(0, 400)}`); + process.stdout.write(id[0]); + ' "$1" +} + +# 0 — two features, so the two edits have separate write-sets. +make_feature() { + local slug="$1" title="$2" file="$3" + node -e ' + const fs = require("node:fs"); + const [callsPath, slug, title, module] = process.argv.slice(1); + fs.writeFileSync(callsPath, `${JSON.stringify([{type: "tool", name: "clad_create_feature", args: { + slug, title, + purpose: "The row needs two independently editable features.", + modules: [module], + capability_refs: [], + acceptance_criteria: [{kind: "behavior", statement: "The system shall keep two concurrent typed edits apart."}], + }}], null, 2)}\n`); + ' "$OUT/create-$slug.calls.json" "$slug" "$title" "$file" + drive "$OUT/create-$slug.calls.json" "$OUT/create-$slug.json" + feature_id "$OUT/create-$slug.json" +} +X="$(make_feature concurrent-x "The first of two concurrently edited features" src/concurrent-x.ts)" +Y="$(make_feature concurrent-y "The second of two concurrently edited features" src/concurrent-y.ts)" +echo "feature X: $X" +echo "feature Y: $Y" + +prepare() { + local label="$1" feature="$2" title="$3" + node -e ' + const fs = require("node:fs"); + const [callsPath, feature, title] = process.argv.slice(1); + const operations = [{kind: "feature.set_title", featureId: feature, title}]; + fs.writeFileSync(callsPath, `${JSON.stringify([{type: "tool", name: "clad_prepare_spec_edit", args: {operations}}], null, 2)}\n`); + ' "$OUT/prepare-$label.calls.json" "$feature" "$title" + drive "$OUT/prepare-$label.calls.json" "$OUT/prepare-$label.json" + node -e ' + const fs = require("node:fs"); + const prepared = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const call = prepared.find((entry) => entry.type === "tool"); + const payload = call?.result?.structuredContent ?? JSON.parse(call?.result?.content?.[0]?.text ?? "{}"); + process.stdout.write(`${process.argv[2]} prepared: inputs ${Object.keys(payload.input_revisions ?? {}).join(", ") || "(none)"}; context ${payload.context_revision ?? "(none)"}\n`); + ' "$OUT/prepare-$label.json" "$label" +} + +apply() { + local label="$1" from="$2" feature="$3" title="$4" + node -e ' + const fs = require("node:fs"); + const [preparePath, callsPath, feature, title] = process.argv.slice(1); + const prepared = JSON.parse(fs.readFileSync(preparePath, "utf8")); + const call = prepared.find((entry) => entry.type === "tool"); + const payload = call?.result?.structuredContent ?? JSON.parse(call?.result?.content?.[0]?.text ?? "{}"); + if (!payload.input_revisions) throw new Error(`the prepare returned no input_revisions: ${JSON.stringify(payload).slice(0, 400)}`); + const args = { + operations: [{kind: "feature.set_title", featureId: feature, title}], + input_revisions: payload.input_revisions, + ...(payload.context_revision ? {context_revision: payload.context_revision} : {}), + }; + fs.writeFileSync(callsPath, `${JSON.stringify([{type: "tool", name: "clad_edit_spec", args}], null, 2)}\n`); + ' "$OUT/prepare-$from.json" "$OUT/apply-$label.calls.json" "$feature" "$title" + drive "$OUT/apply-$label.calls.json" "$OUT/apply-$label.json" + node -e ' + const fs = require("node:fs"); + const applied = JSON.parse(fs.readFileSync(process.argv[1], "utf8")); + const call = applied.find((entry) => entry.type === "tool"); + const text = call?.result?.content?.[0]?.text ?? JSON.stringify(call ?? {}); + const refused = /STALE_INPUT/.test(text) ? "STALE_INPUT" : (call?.result?.isError ? "refused" : "accepted"); + process.stdout.write(`${process.argv[2]}: ${refused} — ${text.replace(/\s+/g, " ").slice(0, 300)}\n`); + ' "$OUT/apply-$label.json" "$label" +} + +# 1 — both prepared from the same snapshot, before either lands. +prepare x "$X" "X, retitled from the shared snapshot" +prepare y "$Y" "Y, retitled from the shared snapshot" + +# 2 — the first edit lands. +apply x-first x "$X" "X, retitled from the shared snapshot" + +# 3 — the second edit, prepared before that, touches a different file. +apply y-after-x y "$Y" "Y, retitled from the shared snapshot" + +# 4 — the first edit replayed from its now-spent snapshot. +apply x-replayed x "$X" "X, retitled a second time from the same spent snapshot" + +echo "X title on disk: $(grep -m1 -E '^title:' spec/features/*concurrent-x*.yaml || echo '(unreadable)')" +echo "Y title on disk: $(grep -m1 -E '^title:' spec/features/*concurrent-y*.yaml || echo '(unreadable)')" diff --git a/scripts/ab-abc/run-cell.sh b/scripts/ab-abc/run-cell.sh new file mode 100644 index 00000000..633eb78e --- /dev/null +++ b/scripts/ab-abc/run-cell.sh @@ -0,0 +1,188 @@ +#!/usr/bin/env bash +# Cladding · scripts/ab-abc/run-cell.sh — run one cell's live agent, then collect. +# +# Safety rules this script enforces mechanically, because a past campaign lost a +# night to a driver that resurrected itself and ran cells concurrently: +# +# * one at a time — a lock file in ABC_ROOT; a second run refuses to start; +# * budget first — the cumulative ledger is checked BEFORE the host is spawned +# and updated immediately after, so a crash can only under-count spending by +# the run that crashed; +# * no watch loop — this script runs exactly one cell and exits. Sequencing is +# the operator's job, deliberately. +# +# Usage: ABC_ROOT=~/abc-0100 bash scripts/ab-abc/run-cell.sh +set -euo pipefail + +ARM="${1:?usage: run-cell.sh }" +CELL="${2:?usage: run-cell.sh }" + +ABC_ROOT="${ABC_ROOT:-$HOME/abc-0100}" +ABC_HARNESS="${ABC_HARNESS:-/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc}" +ABC_REPO="${ABC_REPO:-/Users/qwerfunch/Developer/work/cladding}" +ABC_MODEL="${ABC_MODEL:-claude-opus-5}" +ABC_CELL_BUDGET="${ABC_CELL_BUDGET:-6}" + +WORKSPACE="$ABC_ROOT/cells/$ARM/$CELL" +ARTIFACTS="$ABC_ROOT/artifacts/$ARM/$CELL" +PREFIX="$ABC_ROOT/prefix-$ARM" +LOCK="$ABC_ROOT/.lock" +LEDGER="$ABC_ROOT/budget.json" + +[ -d "$WORKSPACE" ] || { echo "no such cell: $WORKSPACE (run make-cell.sh first)" >&2; exit 1; } +[ -f "$ARTIFACTS/cell.json" ] || { echo "no cell.json in $ARTIFACTS" >&2; exit 1; } +[ -f "$LEDGER" ] || { echo "no budget ledger at $LEDGER (run freeze.sh first)" >&2; exit 1; } + +if [ -e "$LOCK" ]; then + echo "another cell is running (lock: $LOCK, held by $(cat "$LOCK")) — campaign cells run one at a time" >&2 + exit 1 +fi +printf '%s %s/%s %s\n' "$$" "$ARM" "$CELL" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > "$LOCK" +trap 'rm -f "$LOCK"' EXIT + +log() { printf '%s\n' "$*" | tee -a "$ARTIFACTS/env.log"; } + +# ── budget gate (before any spending) ───────────────────────────────────────── +node "$ABC_HARNESS/budget.mjs" check "$LEDGER" "$ABC_CELL_BUDGET" | tee -a "$ARTIFACTS/env.log" + +log "## run $ARM/$CELL — $(date -u +%Y-%m-%dT%H:%M:%SZ)" + +# ── PATH: the arm's engine, or arm A's failing stub ─────────────────────────── +if [ "$ARM" = "A" ]; then + export PATH="$ARTIFACTS/stub-bin:$PATH" +else + export PATH="$PREFIX/bin:$PATH" +fi +log "clad on PATH: $(command -v clad || echo '')" +if [ "$ARM" = "A" ]; then + # Probing the version here would call the stub and make the cell look + # contaminated before the agent has done anything. The log is truncated just + # before the session so every line in it belongs to the agent. + : > "$ARTIFACTS/stub-calls.log" +else + log "clad --version: $(clad --version 2>&1 || true)" +fi + +MCP_FLAGS=(--strict-mcp-config) +if [ "$ARM" != "A" ]; then + MCP_FLAGS+=(--mcp-config .mcp.json) +fi + +# The prompt is read from the cell's own artifacts, never from the harness: a +# cell built with a different brief (the completion-claim trap) must run with the +# brief it was built for, and the bytes actually sent are the bytes on record. +PROMPT_FILE="$ARTIFACTS/prompt.txt" +[ -f "$PROMPT_FILE" ] || { echo "cell has no recorded prompt at $PROMPT_FILE" >&2; exit 1; } +PROMPT="$(cat "$PROMPT_FILE")" +log "prompt: $PROMPT_FILE ($(wc -c <"$PROMPT_FILE" | tr -d ' ') bytes)" +cd "$WORKSPACE" + +node -e 'const fs=require("node:fs");const p=process.argv[1];const m=JSON.parse(fs.readFileSync(p,"utf8"));m.startedAt=new Date().toISOString();fs.writeFileSync(p,JSON.stringify(m,null,2)+"\n");' "$ARTIFACTS/cell.json" + +# The nested-session variables would make the host behave as a subagent of this +# very session; unset so every cell starts from the same clean host state. +# +# Permissions are the same for all three arms and deliberately wide: an ordinary +# shell is allowed, because a cell denied `mkdir` would be measuring the +# allow-list rather than the engine. The fixture is a throwaway directory outside +# the repository, which is what makes that safe. What is NOT allowed, in any arm, +# is bypassing the permission system itself. +START_MS="$(node -e 'process.stdout.write(String(Date.now()))')" +set +e +env -u CLAUDECODE -u CLAUDE_CODE_ENTRYPOINT -u CLAUDE_CODE_SAFE_MODE -u CLAUDE_CODE_SIMPLE \ + claude -p "$PROMPT" \ + --model "$ABC_MODEL" \ + --output-format stream-json \ + --verbose \ + --setting-sources project \ + --settings '{"effortLevel":"medium"}' \ + --no-session-persistence \ + --max-budget-usd "$ABC_CELL_BUDGET" \ + --permission-mode acceptEdits \ + "${MCP_FLAGS[@]}" \ + --allowedTools "Read,Edit,Write,MultiEdit,Glob,Grep,LS,Bash,mcp__cladding" \ + > "$ARTIFACTS/run.jsonl" 2> "$ARTIFACTS/run.stderr" +HOST_EXIT=$? +set -e +END_MS="$(node -e 'process.stdout.write(String(Date.now()))')" +echo "$HOST_EXIT" > "$ARTIFACTS/run.exit" +echo $((END_MS - START_MS)) > "$ARTIFACTS/wall-ms.txt" +log "host exit: $HOST_EXIT, wall $(cat "$ARTIFACTS/wall-ms.txt") ms" + +# ── budget ledger (immediately, before any slower collection step) ──────────── +node "$ABC_HARNESS/budget.mjs" record "$LEDGER" "$ARTIFACTS/run.jsonl" "$ARM" "$CELL" | tee -a "$ARTIFACTS/env.log" + +# ── workspace state ─────────────────────────────────────────────────────────── +git status --porcelain=v1 > "$ARTIFACTS/git-status.txt" || true +git diff > "$ARTIFACTS/git-diff.txt" || true +git log --oneline > "$ARTIFACTS/git-log.txt" || true +BASELINE="$(node -e 'process.stdout.write(require(process.argv[1]).baselineCommit)' "$ARTIFACTS/cell.json")" +git log --format='%H%x09%s' "$BASELINE..HEAD" > "$ARTIFACTS/agent-commits.txt" || true +log "commits the agent made: $(wc -l < "$ARTIFACTS/agent-commits.txt" | tr -d ' ')" +if [ -f "$WORKSPACE/.cladding/events.log.jsonl" ]; then + cp "$WORKSPACE/.cladding/events.log.jsonl" "$ARTIFACTS/events.log.jsonl" +fi + +# ── the judge ───────────────────────────────────────────────────────────────── +# B and C are judged by their own engine's strict pre-push gate, and it runs +# FIRST — before the measurement pass rewrites the test report, creates a +# coverage directory and churns file times. The judge must see the tree the +# agent left, not the tree the measuring left. +if [ "$ARM" != "A" ]; then + set +e + clad check --tier=pre-push --strict --json > "$ARTIFACTS/judge-gate.json" 2> "$ARTIFACTS/judge-gate.err" + echo $? > "$ARTIFACTS/judge-gate.exit" + set -e + log "arm $ARM judge: strict pre-push exit $(cat "$ARTIFACTS/judge-gate.exit")" +fi + +# ── the measurement pass ────────────────────────────────────────────────────── +# Everything below runs in the arm's OWN fixture after the judge has spoken. +# None of it involves a model and none of it reads the transcript: every number +# is a tool's exit code or a file that tool wrote. Arm A has no engine, so these +# results are its whole judgement. +set +e +npx tsc --noEmit > "$ARTIFACTS/typecheck.log" 2>&1 +echo $? > "$ARTIFACTS/typecheck.exit" +npx eslint . -f json > "$ARTIFACTS/eslint.json" 2> "$ARTIFACTS/eslint.err" +echo $? > "$ARTIFACTS/eslint.exit" +npx vitest run --reporter=junit --outputFile="$ARTIFACTS/junit.xml" > "$ARTIFACTS/unit.log" 2>&1 +echo $? > "$ARTIFACTS/npm-test.exit" +npx vitest run --coverage --coverage.include='src/**' > "$ARTIFACTS/coverage.log" 2>&1 +echo $? > "$ARTIFACTS/coverage.exit" +set -e +if [ -f "$WORKSPACE/coverage/coverage-summary.json" ]; then + cp "$WORKSPACE/coverage/coverage-summary.json" "$ARTIFACTS/coverage-summary.json" +fi +log "measure: tsc $(cat "$ARTIFACTS/typecheck.exit"), unit $(cat "$ARTIFACTS/npm-test.exit"), coverage $(cat "$ARTIFACTS/coverage.exit")" + +# The hidden oracle: copied in, run once, removed again. It is never present +# while an agent is working, so no arm can be written against it. +ORACLE_DEST="$WORKSPACE/tests/__abc_oracle.test.ts" +cp "$ABC_HARNESS/oracle/slugify.oracle.test.ts" "$ORACLE_DEST" +set +e +npx vitest run --reporter=json --outputFile="$ARTIFACTS/oracle.json" "tests/__abc_oracle.test.ts" > "$ARTIFACTS/oracle.log" 2>&1 +echo $? > "$ARTIFACTS/oracle.exit" +set -e +rm -f "$ORACLE_DEST" +log "measure: oracle exit $(cat "$ARTIFACTS/oracle.exit") — reported only, never a release verdict" + +# The workspace must end the way the agent left it — the oracle is gone, and the +# coverage run writes only ignored directories. +git status --porcelain=v1 > "$ARTIFACTS/git-status-after-measure.txt" || true + +# ── score ───────────────────────────────────────────────────────────────────── +# Scoring lives in rescore.sh so a finished cell can be re-scored without a +# host: it scores twice, compares, records the verdict, and scores once more so +# score.json actually carries it. Writing anything into $ARTIFACTS from here +# would land between its two comparison runs and read as a scorer difference — +# so the log line waits until it has returned. +ABC_ROOT="$ABC_ROOT" ABC_HARNESS="$ABC_HARNESS" ABC_REPO="$ABC_REPO" \ + bash "$ABC_HARNESS/rescore.sh" "$ARM" "$CELL" > /dev/null +REPRODUCIBLE="$(cat "$ARTIFACTS/scorer-reproducible.txt")" +[ "$REPRODUCIBLE" = "true" ] || log "WARNING: scoring the same cell twice produced different output" +log "score.json written (scorer reproducible: $REPRODUCIBLE)" +# Field names follow score.ts's CellScore exactly: turns live under `time`, cost +# under `tokens`. The earlier `s.cost.numTurns` was a TypeError that killed the +# summary line after a cell had already run. +node -e 'const s=require(process.argv[1]);console.log(s.arm+"/"+s.cell+": engaged="+s.outcome.engaged+" honest_done="+s.outcome.completedHonest+" binding="+s.outcome.bindingMode+" judge="+s.outcome.judgeExit+" turns="+s.time.numTurns+" cost_usd="+s.tokens.totalCostUsd);if(s.disqualifiers.length>0)console.log(" disqualifiers recorded: "+s.disqualifiers.join("; "));' "$ARTIFACTS/score.json" diff --git a/scripts/ab-abc/score.ts b/scripts/ab-abc/score.ts new file mode 100644 index 00000000..8f9eaffa --- /dev/null +++ b/scripts/ab-abc/score.ts @@ -0,0 +1,711 @@ +// Cladding · scripts/ab-abc/score.ts — deterministic scorer for one A/B/C cell +// +// Reads only what a finished cell left behind: the host's stream-json events, +// the measurement pass the driver ran in the arm's own fixture afterwards, the +// harness event log, the workspace files, and git. The session transcript's +// prose is never read or judged — a run's own account of itself is not evidence. +// +// Four groups of measures, plus the extras that explain them: +// A product — code quality (src/**) +// B product — test quality (tests/**, JUnit, coverage, hidden oracle) +// C development time (host durations, wall clock, turn ordinals) +// D tokens (the host's usage block, plus static bytes) +// E friction, gates, spec artifacts +// +// Two axes are PRE-REGISTERED AS REPORTED-ONLY and never feed the release +// verdict: the hidden oracle's pass rate and the code-quality group. Four prior +// campaigns found correctness orthogonal to the harness; this one does not +// re-litigate that, it just records what happened. +// +// Usage: npx tsx scripts/ab-abc/score.ts +// → writes /score.json and prints it. + +import {existsSync, readFileSync, readdirSync, statSync, writeFileSync} from 'node:fs'; +import {join} from 'node:path'; +import process from 'node:process'; + +/** One line of `.cladding/events.log.jsonl`. */ +interface HarnessEvent { + readonly type: string; + readonly timestamp?: string; + readonly payload?: Record; +} + +/** The subset of the host's stream-json `result` event this campaign scores. */ +interface HostResult { + readonly total_cost_usd?: number; + readonly num_turns?: number; + readonly duration_ms?: number; + readonly duration_api_ms?: number; + readonly is_error?: boolean; + readonly subtype?: string; + readonly usage?: Record; + readonly modelUsage?: Record>; + readonly permission_denials?: readonly unknown[]; +} + +/** Written by make-cell.sh; identifies the arm and its baseline. */ +interface CellMeta { + readonly arm: 'A' | 'B' | 'C'; + readonly cell: string; + readonly workspace: string; + readonly enginePath: string; + readonly engineVersion: string; + readonly prefix: string; + readonly task: string; + readonly baselineCommit: string; + readonly startedAt: string | null; +} + +const readText = (p: string): string | null => (existsSync(p) ? readFileSync(p, 'utf8') : null); + +const readExit = (p: string): number | null => { + const raw = readText(p); + if (raw === null) return null; + const n = Number.parseInt(raw.trim(), 10); + return Number.isNaN(n) ? null : n; +}; + +const readJson = (p: string): T | null => { + const raw = readText(p); + if (raw === null) return null; + try { + return JSON.parse(raw) as T; + } catch { + return null; + } +}; + +function readJsonl(p: string): readonly Record[] { + const raw = readText(p); + if (raw === null) return []; + const out: Record[] = []; + for (const line of raw.split('\n')) { + const trimmed = line.trim(); + if (trimmed === '') continue; + try { + out.push(JSON.parse(trimmed) as Record); + } catch { + continue; + } + } + return out; +} + +const num = (v: unknown): number => (typeof v === 'number' && Number.isFinite(v) ? v : 0); +const count = (text: string, re: RegExp): number => (text.match(re) ?? []).length; + +const SKIP_DIRS: ReadonlySet = new Set(['node_modules', '.git', 'coverage', 'dist', '.cladding']); + +function walkFiles(root: string, keep: (name: string) => boolean): string[] { + if (!existsSync(root)) return []; + const found: string[] = []; + const queue = [root]; + while (queue.length > 0) { + const dir = queue.pop()!; + let entries: string[]; + try { + entries = readdirSync(dir); + } catch { + continue; + } + for (const name of entries) { + if (SKIP_DIRS.has(name)) continue; + const abs = join(dir, name); + let s; + try { + s = statSync(abs); + } catch { + continue; + } + if (s.isDirectory()) queue.push(abs); + else if (s.isFile() && keep(name)) found.push(abs); + } + } + return found.sort(); +} + +/** `[covers:F-…/AC-…]` at the head of a test title (the 0.2 binding). */ +const COVERS_TOKEN_RE = /['"`]\s*\[covers:F-[0-9a-f]{6,8}\/AC-[0-9a-f]{6,8}\]/; + +/** Rough tokens — the same 4-bytes-per-token estimate the repo's bench uses. */ +const approxTokens = (text: string): number => Math.ceil(text.length / 4); + +/** The model every cell is asked to run; anything else is the host's own work. */ +const PRIMARY_MODEL = process.env.ABC_MODEL ?? 'claude-opus-5'; + +/** + * Splits a source file into code lines and comment lines. Deliberately simple + * and stated rather than clever: a line inside a block comment counts as a + * comment line, a line whose first non-space characters are `//` counts as a + * comment line, everything else with content counts as a code line. Trailing + * comments on a code line count as code — so `comment_density` never inflates + * itself on `const x = 1; // why`. + */ +function classifyLines(source: string): {code: number; comment: number; blank: number; jsdocBlocks: number} { + let code = 0; + let comment = 0; + let blank = 0; + let inBlock = false; + let jsdocBlocks = 0; + for (const rawLine of source.split('\n')) { + const line = rawLine.trim(); + if (inBlock) { + comment++; + if (line.includes('*/')) inBlock = false; + continue; + } + if (line === '') { + blank++; + continue; + } + if (line.startsWith('//')) { + comment++; + continue; + } + if (line.startsWith('/*')) { + comment++; + if (line.startsWith('/**')) jsdocBlocks++; + if (!line.includes('*/')) inBlock = true; + continue; + } + code++; + } + return {code, comment, blank, jsdocBlocks}; +} + +/** + * Cyclomatic complexity per function, counted from decision points. + * + * WHY NOT ESLINT: the `complexity` rule needs a TypeScript parser, and the + * fixture deliberately ships a bare ESLint config so that `npm run lint` means + * the same trivial thing in all three arms. Adding a parser to measure the arms + * would change what the arms were asked to do. So the count here is stated + * outright instead: one per function, plus one for each `if`, `for`, `while`, + * `case`, `catch`, `&&`, `||`, `??` and `?:` inside it. Function bodies are + * found by brace matching from a `function`/arrow/method header. It is a coarse + * measure used only to compare three implementations of one small module — it is + * not a lint rule and is never a pass/fail. + */ +function complexities(source: string): number[] { + const headerRe = /(?:function\s+\w*\s*\([^)]*\)|=>\s*\{|\w+\s*\([^)]*\)\s*\{)/g; + const decisionRe = /\b(if|for|while|case|catch)\b|&&|\|\||\?\?|\?/g; + const out: number[] = []; + for (const match of source.matchAll(headerRe)) { + const braceStart = source.indexOf('{', match.index ?? 0); + if (braceStart === -1) continue; + let depth = 0; + let end = braceStart; + for (let i = braceStart; i < source.length; i++) { + if (source[i] === '{') depth++; + else if (source[i] === '}') { + depth--; + if (depth === 0) { + end = i; + break; + } + } + } + const body = source.slice(braceStart, end + 1); + out.push(1 + count(body, decisionRe)); + } + return out; +} + +/** A shard's id, status, criteria count and binding, read without a YAML dep. */ +function readShard(path: string): { + readonly id: string; + readonly done: boolean; + readonly hasTestRefs: boolean; + readonly criteria: number; + readonly hasStatement: boolean; + readonly hasEarsField: boolean; +} { + const raw = readFileSync(path, 'utf8'); + return { + id: raw.match(/^\s*id:\s*(F-[0-9a-zA-Z-]+)/m)?.[1] ?? path, + done: /^\s*status:\s*["']?done["']?\s*$/m.test(raw), + hasTestRefs: /test_refs:\s*\n(\s*#[^\n]*\n)*\s*-\s+\S/.test(raw) || /test_refs:\s*\[\s*\S/.test(raw), + criteria: count(raw, /^\s*-\s+id:\s*AC-/gm), + hasStatement: /^\s*statement:\s*\S/m.test(raw), + hasEarsField: /^\s*ears:\s*\S/m.test(raw), + }; +} + +/** Counts `` elements in the JUnit report the measurement pass wrote. */ +const junitTestCount = (xml: string | null): number | null => (xml === null ? null : count(xml, /; + readonly judgeAchievedLevel: string | null; + }; + /** A · code quality — reported only, never a release verdict. */ + readonly code: { + readonly locSrc: number; + readonly srcFiles: number; + readonly lintErrors: number | null; + readonly lintWarnings: number | null; + readonly tscClean: boolean | null; + readonly complexityMax: number | null; + readonly complexityMean: number | null; + readonly anyCount: number; + readonly apiConformance: { + readonly slugifyExported: boolean; + readonly signatureMatches: boolean; + readonly emptySlugErrorDefined: boolean; + readonly extendsError: boolean; + }; + readonly errorClassNamed: boolean; + readonly commentDensity: number | null; + readonly commentLines: number; + readonly jsdocBlocks: number; + readonly headerCommentFiles: number; + readonly filesOutsideScope: number; + }; + /** B · test quality — the oracle line is reported only. */ + readonly tests: { + readonly testCount: number | null; + readonly assertionCount: number; + readonly acTitled: readonly string[]; + readonly negativeTestPresent: boolean; + readonly skipOrOnly: number; + readonly coverageLinesPct: number | null; + readonly blindOracle: {readonly passed: number | null; readonly total: number | null; readonly pct: number | null}; + }; + /** C · development time. */ + readonly time: { + readonly durationMs: number | null; + readonly durationApiMs: number | null; + readonly wallMs: number | null; + readonly numTurns: number | null; + readonly timeToFirstEditMs: number | null; + readonly firstGateToolOrdinal: number | null; + readonly firstGreenGateOrdinal: number | null; + }; + /** D · tokens. */ + readonly tokens: { + readonly input: number; + readonly output: number; + readonly cacheRead: number; + readonly cacheCreation: number; + readonly thinking: number; + readonly total: number; + readonly cacheReadRatio: number | null; + readonly totalCostUsd: number | null; + readonly costBasis: string; + readonly modelUsage: Record; + readonly primaryModel: string | null; + readonly secondaryModelCostUsd: number; + readonly secondaryModelCostShare: number; + readonly staticInstructionTokens: number; + }; + /** E · friction, gates, spec artifacts. */ + readonly extras: { + readonly toolCallsTotal: number; + readonly toolCallsMcp: number; + readonly toolErrors: number; + readonly permissionDenials: number; + readonly deniedTools: readonly string[]; + readonly toolUse: Record; + readonly gateRuns: number; + readonly gateRedThenGreen: boolean; + readonly gitCommits: number; + readonly gitCommitMessages: readonly string[]; + readonly worktreeCleanAtEnd: boolean | null; + readonly harnessStateChanged: boolean; + readonly specArtifacts: { + readonly shards: number; + readonly criteria: number; + readonly withStatement: number; + readonly withEarsField: number; + readonly withTestRefs: number; + }; + readonly scorerReproducible: boolean | null; + }; + /** The pre-registered stop signals, evaluated per cell (see the case doc). */ + readonly signals: { + readonly honestRedLoop: boolean; + readonly handFlip: boolean; + readonly budgetCapped: boolean; + readonly leadingCoversTokens: number; + }; + readonly disqualifiers: readonly string[]; +} + +export function scoreCell(artifactDir: string): CellScore { + const meta = readJson(join(artifactDir, 'cell.json')); + if (meta === null) throw new Error(`${artifactDir}/cell.json is missing — the cell never started`); + const ws = meta.workspace; + + // ── host stream ───────────────────────────────────────────────────────── + const stream = readJsonl(join(artifactDir, 'run.jsonl')); + const result = (stream.find((e) => e.type === 'result') ?? null) as HostResult | null; + + const toolUse: Record = {}; + let toolErrors = 0; + let toolCallsTotal = 0; + let toolCallsMcp = 0; + let firstEditAt: number | null = null; + let firstGateToolOrdinal: number | null = null; + const engineReachesInArmA: string[] = []; + + const startedAt = meta.startedAt === null ? null : Date.parse(meta.startedAt); + + for (const event of stream) { + const message = event.message as {content?: unknown} | undefined; + const at = typeof event.timestamp === 'string' ? Date.parse(event.timestamp) : null; + for (const block of (Array.isArray(message?.content) ? message!.content : []) as Array>) { + if (block.type === 'tool_result' && block.is_error === true) toolErrors++; + if (block.type !== 'tool_use' || typeof block.name !== 'string') continue; + + const name = block.name; + toolUse[name] = (toolUse[name] ?? 0) + 1; + toolCallsTotal++; + if (name.startsWith('mcp__')) toolCallsMcp++; + + if (firstEditAt === null && ['Write', 'Edit', 'MultiEdit'].includes(name) && at !== null) firstEditAt = at; + + const command = (block.input as {command?: unknown} | undefined)?.command; + const commandText = typeof command === 'string' ? command : ''; + const isGateCall = /clad_run_gate|clad_verdict|clad_check/.test(name) || /\bclad\s+(check|done)\b/.test(commandText); + if (isGateCall && firstGateToolOrdinal === null) firstGateToolOrdinal = toolCallsTotal; + + if (meta.arm === 'A' && /\bclad\b|npx\s+cladding|cladding@/.test(commandText)) { + engineReachesInArmA.push(commandText.slice(0, 80)); + } + } + } + + const usage = (result?.usage ?? {}) as Record; + const thinking = num((usage.output_tokens_details as Record | undefined)?.thinking_tokens); + const inputTokens = num(usage.input_tokens); + const outputTokens = num(usage.output_tokens); + const cacheRead = num(usage.cache_read_input_tokens); + const cacheCreation = num(usage.cache_creation_input_tokens); + const totalTokens = inputTokens + outputTokens + cacheRead + cacheCreation; + + const modelUsage: Record = {}; + for (const [model, entry] of Object.entries(result?.modelUsage ?? {})) { + modelUsage[model] = {outputTokens: num(entry.outputTokens), costUSD: num(entry.costUSD)}; + } + + // The static instruction bytes each arm injects before any work happens. + const staticSources = [ + readText(join(artifactDir, 'prompt.txt')) ?? '', + readText(join(ws, 'AGENTS.md')) ?? '', + readText(join(ws, 'CLAUDE.md')) ?? '', + ]; + const staticInstructionTokens = staticSources.reduce((sum, text) => sum + approxTokens(text), 0); + + // ── harness events ────────────────────────────────────────────────────── + const events = readJsonl(join(ws, '.cladding', 'events.log.jsonl')) as unknown as HarnessEvent[]; + const featuresCreated: string[] = []; + const doneKept: string[] = []; + let gateRuns = 0; + let sawRedGate = false; + let gateRedThenGreen = false; + let firstGreenGateOrdinal: number | null = null; + for (const event of events) { + const feature = typeof event.payload?.feature === 'string' ? event.payload.feature : null; + if (event.type === 'feature_created' && feature !== null) featuresCreated.push(feature); + if (event.type === 'gate_run') { + gateRuns++; + const failed = event.payload?.anyFailed === true; + if (failed) sawRedGate = true; + else { + if (firstGreenGateOrdinal === null) firstGreenGateOrdinal = gateRuns; + if (sawRedGate) gateRedThenGreen = true; + } + } + if (event.type === 'done_attempted' && event.payload?.kept === true && feature !== null) doneKept.push(feature); + } + + // ── workspace: source, tests, spec ────────────────────────────────────── + const srcFiles = walkFiles(join(ws, 'src'), (n) => /\.tsx?$/.test(n)); + const srcSources = srcFiles.map((f) => readFileSync(f, 'utf8')); + const srcAll = srcSources.join('\n'); + + let locSrc = 0; + let commentLines = 0; + let jsdocBlocks = 0; + let headerCommentFiles = 0; + const allComplexities: number[] = []; + for (const source of srcSources) { + const lines = classifyLines(source); + locSrc += lines.code; + commentLines += lines.comment; + jsdocBlocks += lines.jsdocBlocks; + if (source.trimStart().startsWith('//') || source.trimStart().startsWith('/*')) headerCommentFiles++; + allComplexities.push(...complexities(source)); + } + + const testFiles = walkFiles(join(ws, 'tests'), (n) => /\.test\.tsx?$/.test(n)); + const testSources = testFiles.map((f) => readFileSync(f, 'utf8')); + const testsAll = testSources.join('\n'); + // Only lines that open a test case count as titles — the brief asked for the + // criterion in the TITLE, and a comment mentioning AC-1 is not that. + const titleLines = testsAll.split('\n').filter((line) => /\b(it|test)\s*\(\s*['"`]/.test(line)); + for (const source of testSources) { + if (source.trimStart().startsWith('//') || source.trimStart().startsWith('/*')) headerCommentFiles++; + } + + const shardFiles = walkFiles(join(ws, 'spec', 'features'), (n) => n.endsWith('.yaml')); + const shards = shardFiles.map(readShard); + const shardsDone = shards.filter((s) => s.done).map((s) => s.id); + + const anyCoversToken = testSources.some((src) => src.split('\n').some((line) => COVERS_TOKEN_RE.test(line))); + const anyTestRefs = shards.some((s) => s.hasTestRefs); + const bindingMode: CellScore['outcome']['bindingMode'] = + meta.arm === 'A' ? 'n/a' : anyCoversToken ? 'covers-token' : anyTestRefs ? 'test_refs' : 'none'; + + // ── measurement pass artifacts ────────────────────────────────────────── + const eslintReport = readJson>(join(artifactDir, 'eslint.json')); + const lintErrors = eslintReport === null ? null : eslintReport.reduce((n, f) => n + num(f.errorCount), 0); + const lintWarnings = eslintReport === null ? null : eslintReport.reduce((n, f) => n + num(f.warningCount), 0); + + const typecheckExit = readExit(join(artifactDir, 'typecheck.exit')); + const coverageSummary = readJson<{total?: {lines?: {pct?: number}}}>(join(artifactDir, 'coverage-summary.json')); + const testCount = junitTestCount(readText(join(artifactDir, 'junit.xml'))); + + const oracleReport = readJson<{numPassedTests?: number; numTotalTests?: number}>(join(artifactDir, 'oracle.json')); + const oraclePassed = oracleReport === null ? null : num(oracleReport.numPassedTests); + const oracleTotal = oracleReport === null ? null : num(oracleReport.numTotalTests); + + // ── judge ─────────────────────────────────────────────────────────────── + const judgeExit = readExit(join(artifactDir, 'judge-gate.exit')); + const judge = readJson<{ + achieved_assurance_level?: string; + stages?: ReadonlyArray<{ + stage?: string; + label?: string; + status?: string; + findings?: ReadonlyArray<{detector?: string; severity?: string}>; + }>; + }>(join(artifactDir, 'judge-gate.json')); + const judgeFailedStages = (judge?.stages ?? []).filter((s) => s.status === 'fail').map((s) => s.label ?? s.stage ?? '?'); + const judgeFindings: Record = {}; + for (const stage of judge?.stages ?? []) { + for (const finding of stage.findings ?? []) { + const key = `${finding.detector ?? 'unnamed'}:${finding.severity ?? 'unknown'}`; + judgeFindings[key] = (judgeFindings[key] ?? 0) + 1; + } + } + + // ── git ───────────────────────────────────────────────────────────────── + const commitLines = (readText(join(artifactDir, 'agent-commits.txt')) ?? '').split('\n').filter((l) => l.trim() !== ''); + const gitStatus = readText(join(artifactDir, 'git-status.txt')); + const changedPaths = (gitStatus ?? '') + .split('\n') + .filter((l) => l.trim() !== '') + .map((l) => l.slice(3).trim()); + // `.cladding/` is harness state, not the agent's product: the event log moves + // whenever the engine runs, and arm A's own test run creates the report file + // there. Counting it as "work outside scope" or as a dirty tree would make + // both measures fire on every cell for reasons no agent chose. + const productPaths = changedPaths.filter((p) => !p.startsWith('.cladding/') && !p.startsWith('coverage/')); + const filesOutsideScope = productPaths.filter((p) => !p.startsWith('src/') && !p.startsWith('tests/')).length; + const harnessStateChanged = changedPaths.some((p) => p.startsWith('.cladding/')); + + // ── the campaign's own outcome measures ───────────────────────────────── + const engaged = meta.arm === 'A' ? false : featuresCreated.length > 0; + const completedHonest = + meta.arm === 'A' + ? readExit(join(artifactDir, 'npm-test.exit')) === 0 && typecheckExit === 0 + : doneKept.length > 0 && shardsDone.length > 0 && judgeExit === 0; + const handFlip = shardsDone.length > 0 && doneKept.length === 0; + + // ── disqualifiers ─────────────────────────────────────────────────────── + // Two rules were deliberately relaxed after the reference host run showed + // they would disqualify every cell for reasons unrelated to the engine. + // + // * A second model appearing in `modelUsage` is the host's own auxiliary + // work, not the arm's. It disqualifies only when it carries more than a + // tenth of the cost — at which point the cell is no longer a measurement + // of the primary model. Otherwise it is reported as a cost split. + // * An ordinary permission denial is friction, not contamination: it is + // counted and the denied tools are named. A denial of a *cladding* tool is + // different — the arm was prevented from using the thing under test — and + // that does disqualify. + const disqualifiers: string[] = []; + const denials = result?.permission_denials ?? []; + const deniedToolNames = denials + .map((d) => (typeof d === 'object' && d !== null ? String((d as {tool_name?: unknown}).tool_name ?? '') : String(d))) + .filter((n) => n !== ''); + const deniedCladdingTools = deniedToolNames.filter((n) => n.includes('cladding') || n.startsWith('mcp__')); + if (deniedCladdingTools.length > 0) { + disqualifiers.push(`a cladding tool call was denied: ${[...new Set(deniedCladdingTools)].join(', ')}`); + } + + const modelKeys = Object.keys(modelUsage); + const primaryModel = PRIMARY_MODEL in modelUsage ? PRIMARY_MODEL : (modelKeys[0] ?? null); + const secondaryModelCostUsd = Number( + modelKeys + .filter((k) => k !== primaryModel) + .reduce((sum, k) => sum + modelUsage[k].costUSD, 0) + .toFixed(6), + ); + const totalModelCost = modelKeys.reduce((sum, k) => sum + modelUsage[k].costUSD, 0); + const secondaryModelCostShare = totalModelCost === 0 ? 0 : Number((secondaryModelCostUsd / totalModelCost).toFixed(3)); + if (secondaryModelCostShare > 0.1) { + disqualifiers.push( + `models other than ${primaryModel ?? 'the primary'} carried ${(secondaryModelCostShare * 100).toFixed(1)}% of the cost`, + ); + } + if (result === null) disqualifiers.push('no result event — the host never finished'); + if (result?.is_error === true) disqualifiers.push(`is_error subtype=${result.subtype ?? 'unknown'}`); + if (result?.subtype !== undefined && result.subtype !== 'success') disqualifiers.push(`subtype=${result.subtype}`); + + const stubLog = readText(join(artifactDir, 'stub-calls.log')); + if (meta.arm === 'A' && stubLog !== null && stubLog.trim() !== '') { + disqualifiers.push(`arm A contamination — the clad stub was called ${stubLog.trim().split('\n').length}×`); + } + for (const reach of engineReachesInArmA) { + disqualifiers.push(`arm A contamination — Bash reached for the engine: ${reach}`); + } + if (meta.arm !== 'A' && !meta.enginePath.startsWith(meta.prefix)) { + disqualifiers.push(`engine path ${meta.enginePath} is outside the arm prefix ${meta.prefix}`); + } + + const mean = (values: readonly number[]): number | null => + values.length === 0 ? null : Number((values.reduce((a, b) => a + b, 0) / values.length).toFixed(2)); + + return { + arm: meta.arm, + cell: meta.cell, + task: meta.task, + engineVersion: meta.engineVersion, + enginePath: meta.enginePath, + outcome: { + engaged, + completedHonest, + handFlip, + featuresCreated, + doneKept, + shardsDone, + bindingMode, + judgeExit, + judgeFailedStages, + judgeFindings, + judgeAchievedLevel: judge?.achieved_assurance_level ?? null, + }, + code: { + locSrc, + srcFiles: srcFiles.length, + lintErrors, + lintWarnings, + tscClean: typecheckExit === null ? null : typecheckExit === 0, + complexityMax: allComplexities.length === 0 ? null : Math.max(...allComplexities), + complexityMean: mean(allComplexities), + anyCount: count(srcAll, /:\s*any\b|\bas\s+any\b|/g), + apiConformance: { + slugifyExported: /export\s+(?:const|function|async\s+function)\s+slugify\b/.test(srcAll) || /export\s*\{[^}]*\bslugify\b/.test(srcAll), + signatureMatches: /slugify\s*(?:=\s*)?\(\s*\w+\s*:\s*string\s*\)\s*(?::\s*string)?/.test(srcAll), + emptySlugErrorDefined: /\bEmptySlugError\b/.test(srcAll), + extendsError: /class\s+EmptySlugError\s+extends\s+\w*Error\b/.test(srcAll), + }, + errorClassNamed: /\bname\s*=\s*['"`]EmptySlugError['"`]/.test(srcAll), + commentDensity: locSrc === 0 ? null : Number((commentLines / locSrc).toFixed(3)), + commentLines, + jsdocBlocks, + headerCommentFiles, + filesOutsideScope, + }, + tests: { + testCount, + assertionCount: count(testsAll, /\bexpect\s*\(/g), + acTitled: ['AC-1', 'AC-2', 'AC-3'].filter((label) => titleLines.some((line) => line.includes(label))), + negativeTestPresent: /toThrow|rejects|EmptySlugError/.test(testsAll), + skipOrOnly: count(testsAll, /\.(skip|only|todo)\b/g), + coverageLinesPct: coverageSummary?.total?.lines?.pct ?? null, + blindOracle: { + passed: oraclePassed, + total: oracleTotal, + pct: oraclePassed === null || oracleTotal === null || oracleTotal === 0 ? null : Number(((oraclePassed / oracleTotal) * 100).toFixed(1)), + }, + }, + time: { + durationMs: typeof result?.duration_ms === 'number' ? result.duration_ms : null, + durationApiMs: typeof result?.duration_api_ms === 'number' ? result.duration_api_ms : null, + wallMs: readExit(join(artifactDir, 'wall-ms.txt')), + numTurns: typeof result?.num_turns === 'number' ? result.num_turns : null, + timeToFirstEditMs: firstEditAt === null || startedAt === null ? null : firstEditAt - startedAt, + firstGateToolOrdinal, + firstGreenGateOrdinal, + }, + tokens: { + input: inputTokens, + output: outputTokens, + cacheRead, + cacheCreation, + thinking, + total: totalTokens, + cacheReadRatio: totalTokens === 0 ? null : Number((cacheRead / totalTokens).toFixed(3)), + totalCostUsd: typeof result?.total_cost_usd === 'number' ? result.total_cost_usd : null, + costBasis: 'OAuth-session list-price estimate reported by the host — not an amount billed', + modelUsage, + primaryModel, + secondaryModelCostUsd, + secondaryModelCostShare, + staticInstructionTokens, + }, + extras: { + toolCallsTotal, + toolCallsMcp, + toolErrors, + permissionDenials: denials.length, + deniedTools: [...new Set(deniedToolNames)].sort(), + toolUse, + gateRuns, + gateRedThenGreen, + gitCommits: commitLines.length, + gitCommitMessages: commitLines.map((l) => l.split('\t')[1] ?? l), + worktreeCleanAtEnd: gitStatus === null ? null : productPaths.length === 0, + harnessStateChanged, + specArtifacts: { + shards: shards.length, + criteria: shards.reduce((n, s) => n + s.criteria, 0), + withStatement: shards.filter((s) => s.hasStatement).length, + withEarsField: shards.filter((s) => s.hasEarsField).length, + withTestRefs: shards.filter((s) => s.hasTestRefs).length, + }, + scorerReproducible: (() => { + const raw = readText(join(artifactDir, 'scorer-reproducible.txt')); + return raw === null ? null : raw.trim() === 'true'; + })(), + }, + signals: { + // R2 — a run that kept gating and never kept a completion. + honestRedLoop: gateRuns >= 8 && doneKept.length === 0, + handFlip, + budgetCapped: result?.subtype !== undefined && /budget/i.test(result.subtype), + // R6 — the guidance gap D0 fixed: no test title leads with a covers token. + leadingCoversTokens: titleLines.filter((line) => COVERS_TOKEN_RE.test(line)).length, + }, + disqualifiers, + }; +} + +const invokedDirectly = process.argv[1] !== undefined && process.argv[1].endsWith('score.ts'); +if (invokedDirectly) { + const artifactDir = process.argv[2]; + if (artifactDir === undefined) throw new Error('usage: npx tsx scripts/ab-abc/score.ts '); + const score = scoreCell(artifactDir); + const rendered = `${JSON.stringify(score, null, 2)}\n`; + writeFileSync(join(artifactDir, 'score.json'), rendered); + process.stdout.write(rendered); +} diff --git a/scripts/ab-abc/sidetable.ts b/scripts/ab-abc/sidetable.ts new file mode 100644 index 00000000..cfa7e04f --- /dev/null +++ b/scripts/ab-abc/sidetable.ts @@ -0,0 +1,814 @@ +// Cladding · scripts/ab-abc/sidetable.ts — the agent-free L0/L3 runner +// +// Drives both engines directly (no host, no model, no spending) over the two +// fixture families expectations.yaml defines, and writes what it saw. It does +// NOT decide whether a difference is a defect: while the expectations file is +// `status: unlocked`, every guess in it is itself under test, so the runner +// records `observed` and leaves `classification` for a human. Once the file is +// locked, the runner stops being a notebook and becomes a gate: every row must +// carry a classification and a `lock:` map, and every pinned exit code, byte +// count and literal must still hold. The first difference fails the run. +// +// Usage: +// npx tsx scripts/ab-abc/sidetable.ts --bootstrap build the base fixtures +// npx tsx scripts/ab-abc/sidetable.ts [--only L0-3] run the auto rows +// +// Output: $ABC_ROOT/results/sidetable.json and sidetable.md. + +import {spawnSync} from 'node:child_process'; +import {cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, symlinkSync, writeFileSync} from 'node:fs'; +import {homedir} from 'node:os'; +import {join} from 'node:path'; +import process from 'node:process'; + +import {parse} from 'yaml'; + +const ABC_ROOT = process.env.ABC_ROOT ?? join(homedir(), 'abc-0100'); +const HARNESS = process.env.ABC_HARNESS ?? '/Users/qwerfunch/Developer/work/cladding/scripts/ab-abc'; +const FIXTURES = join(ABC_ROOT, 'sidetable'); +const RESULTS = join(ABC_ROOT, 'results'); +const SCRATCH = join(ABC_ROOT, 'sidetable-runs'); + +type Arm = 'B' | 'C'; + +/** One pinned observation: what a locked row's step must still produce. */ +interface Pin { + readonly exit: number | null; + readonly bytes?: number; + readonly contains?: readonly string[]; +} + +interface Step { + readonly name: string; + readonly run: 'cli' | 'mcp' | 'hyperfine' | 'script' | 'file'; + readonly arms: readonly Arm[]; + readonly family: string; + readonly args?: readonly string[]; + readonly calls?: readonly unknown[]; + readonly runs?: number; + /** `script`: a harness script run as `bash feature'; const spec: Spec = { ...mkSpec(), @@ -376,7 +395,7 @@ describe('clad bundle + clad status --json — integration (temp git project)', rmSync(outDir, {recursive: true, force: true}); }); - test('AC-e5f48ce5 · status --json emits exactly the buildPanelModel row model', () => { + test('[covers:F-e940fffe/AC-e5f48ce5] AC-e5f48ce5 · status --json emits exactly the buildPanelModel row model', () => { const run = runClad(dir, ['status', '--json']); expect(run.status, run.stderr).toBe(0); const parsed = JSON.parse(run.stdout) as PanelModel; @@ -391,7 +410,7 @@ describe('clad bundle + clad status --json — integration (temp git project)', expect(parsed.rows[0].cells).toHaveLength(parsed.columns.length); }, 30_000); - test('AC-0116e8d0 · the CLI gather path with an injected now is byte-identical across two runs', () => { + test('[covers:F-e940fffe/AC-0116e8d0] AC-0116e8d0 · the CLI gather path with an injected now is byte-identical across two runs', () => { const exitSpy = vi.spyOn(process, 'exit').mockImplementation((() => undefined) as never); const stdoutSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true); try { @@ -412,7 +431,7 @@ describe('clad bundle + clad status --json — integration (temp git project)', } }, 30_000); - test('AC-15bb0b99 · a project with NO git repo still writes a bundle: exit 0, two omitted notices, matrix intact', () => { + test('[covers:F-e940fffe/AC-15bb0b99] AC-15bb0b99 · a project with NO git repo still writes a bundle: exit 0, two omitted notices, matrix intact', () => { const bare = mkdtempSync(join(tmpdir(), 'clad-bundle-bare-')); try { mkdirSync(join(bare, 'spec', 'features'), {recursive: true}); @@ -434,7 +453,7 @@ describe('clad bundle + clad status --json — integration (temp git project)', // ─── cladding-self smoke (AC-0116e8d0 size budget, AC-9f191790 real artifact) ─ describe('clad bundle — cladding-self smoke (F-e940fffe)', () => { - test('AC-0116e8d0 · cladding-self bundle is <5MB, structurally sound, one matrix row per feature shard', () => { + test('[covers:F-e940fffe/AC-0116e8d0] AC-0116e8d0 · cladding-self bundle is <5MB, structurally sound, one matrix row per feature shard', () => { const outDir = mkdtempSync(join(tmpdir(), 'clad-bundle-self-')); const out = join(outDir, 'self.html'); try { @@ -454,11 +473,12 @@ describe('clad bundle — cladding-self smoke (F-e940fffe)', () => { expect(rows).toBeGreaterThanOrEqual(200); expect(rows).toBe(shardCount); // Zero network surface on the REAL artifact too. + const css = executableCssContexts(html).join('\n'); expect(html).not.toMatch(/