@rpamis/comet 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +372 -332
- package/assets/manifest.json +1 -1
- package/assets/skills/comet/scripts/comet-archive.mjs +113 -97
- package/assets/skills/comet/scripts/comet-check.mjs +117 -104
- package/assets/skills/comet/scripts/comet-entry-runtime.mjs +59 -59
- package/assets/skills/comet/scripts/comet-guard.mjs +170 -157
- package/assets/skills/comet/scripts/comet-handoff.mjs +110 -97
- package/assets/skills/comet/scripts/comet-hook-guard.mjs +110 -97
- package/assets/skills/comet/scripts/comet-hook-router.mjs +272 -153
- package/assets/skills/comet/scripts/comet-intent.mjs +31 -31
- package/assets/skills/comet/scripts/comet-resume-probe.mjs +104 -91
- package/assets/skills/comet/scripts/comet-runtime.mjs +311 -296
- package/assets/skills/comet/scripts/comet-state.mjs +221 -207
- package/assets/skills/comet/scripts/comet-yaml-validate.mjs +25 -25
- package/assets/skills/comet-archive/SKILL.md +13 -9
- package/assets/skills/comet-build/SKILL.md +4 -6
- package/assets/skills/comet-classic/SKILL.md +1 -1
- package/assets/skills/comet-classic/reference/scripts.md +9 -1
- package/assets/skills/comet-design/SKILL.md +0 -2
- package/assets/skills/comet-hotfix/SKILL.md +1 -3
- package/assets/skills/comet-native/SKILL.md +8 -7
- package/assets/skills/comet-native/reference/artifacts.md +51 -7
- package/assets/skills/comet-native/reference/clarification.md +5 -5
- package/assets/skills/comet-native/reference/commands.md +15 -13
- package/assets/skills/comet-native/reference/recovery.md +3 -3
- package/assets/skills/comet-native/reference/workspace.md +10 -4
- package/assets/skills/comet-native/scripts/comet-native-archive.mjs +257 -169
- package/assets/skills/comet-native/scripts/comet-native-doctor.mjs +238 -153
- package/assets/skills/comet-native/scripts/comet-native-hook-guard.mjs +241 -124
- package/assets/skills/comet-native/scripts/comet-native-init.mjs +189 -108
- package/assets/skills/comet-native/scripts/comet-native-new.mjs +220 -139
- package/assets/skills/comet-native/scripts/comet-native-next.mjs +245 -160
- package/assets/skills/comet-native/scripts/comet-native-root.mjs +210 -129
- package/assets/skills/comet-native/scripts/comet-native-runtime.mjs +284 -196
- package/assets/skills/comet-native/scripts/comet-native-select.mjs +212 -128
- package/assets/skills/comet-native/scripts/comet-native-show.mjs +207 -126
- package/assets/skills/comet-native/scripts/comet-native-spec.mjs +203 -118
- package/assets/skills/comet-native/scripts/comet-native-status.mjs +208 -124
- package/assets/skills/comet-open/SKILL.md +0 -2
- package/assets/skills/comet-tweak/SKILL.md +1 -1
- package/assets/skills/comet-verify/SKILL.md +0 -2
- package/assets/skills-zh/comet-archive/SKILL.md +13 -9
- package/assets/skills-zh/comet-build/SKILL.md +4 -6
- package/assets/skills-zh/comet-classic/SKILL.md +1 -1
- package/assets/skills-zh/comet-classic/reference/scripts.md +9 -1
- package/assets/skills-zh/comet-design/SKILL.md +0 -2
- package/assets/skills-zh/comet-hotfix/SKILL.md +1 -3
- package/assets/skills-zh/comet-native/SKILL.md +8 -7
- package/assets/skills-zh/comet-native/reference/artifacts.md +51 -7
- package/assets/skills-zh/comet-native/reference/clarification.md +5 -5
- package/assets/skills-zh/comet-native/reference/commands.md +16 -10
- package/assets/skills-zh/comet-native/reference/recovery.md +3 -3
- package/assets/skills-zh/comet-native/reference/workspace.md +10 -4
- package/assets/skills-zh/comet-open/SKILL.md +0 -2
- package/assets/skills-zh/comet-tweak/SKILL.md +1 -1
- package/assets/skills-zh/comet-verify/SKILL.md +0 -2
- package/bin/comet-daemon-router.js +23 -7
- package/bin/fast-runtime-router.js +1 -1
- package/dist/app/cli/index.js +1 -0
- package/dist/app/cli/index.js.map +1 -1
- package/dist/app/commands/daemon-server.d.ts.map +1 -1
- package/dist/app/commands/daemon-server.js +13 -2
- package/dist/app/commands/daemon-server.js.map +1 -1
- package/dist/app/commands/doctor.d.ts.map +1 -1
- package/dist/app/commands/doctor.js +17 -10
- package/dist/app/commands/doctor.js.map +1 -1
- package/dist/app/commands/i18n.d.ts +1 -1
- package/dist/app/commands/i18n.d.ts.map +1 -1
- package/dist/app/commands/i18n.js +4 -0
- package/dist/app/commands/i18n.js.map +1 -1
- package/dist/app/commands/project-knowledge.d.ts +2 -0
- package/dist/app/commands/project-knowledge.d.ts.map +1 -1
- package/dist/app/commands/project-knowledge.js +64 -7
- package/dist/app/commands/project-knowledge.js.map +1 -1
- package/dist/app/commands/uninstall.d.ts +1 -0
- package/dist/app/commands/uninstall.d.ts.map +1 -1
- package/dist/app/commands/uninstall.js +65 -10
- package/dist/app/commands/uninstall.js.map +1 -1
- package/dist/domains/agent-learning/coordinator.d.ts +8 -1
- package/dist/domains/agent-learning/coordinator.d.ts.map +1 -1
- package/dist/domains/agent-learning/coordinator.js +58 -0
- package/dist/domains/agent-learning/coordinator.js.map +1 -1
- package/dist/domains/agent-learning/experience-journal.d.ts +21 -1
- package/dist/domains/agent-learning/experience-journal.d.ts.map +1 -1
- package/dist/domains/agent-learning/experience-journal.js +190 -11
- package/dist/domains/agent-learning/experience-journal.js.map +1 -1
- package/dist/domains/bundle/bundle-platform.d.ts.map +1 -1
- package/dist/domains/bundle/bundle-platform.js +6 -1
- package/dist/domains/bundle/bundle-platform.js.map +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-archive-entry.js +5 -2
- package/dist/domains/comet-classic/classic-archive-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-archive.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-archive.js +5 -1
- package/dist/domains/comet-classic/classic-archive.js.map +1 -1
- package/dist/domains/comet-classic/classic-branch-binding.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-branch-binding.js +5 -4
- package/dist/domains/comet-classic/classic-branch-binding.js.map +1 -1
- package/dist/domains/comet-classic/classic-check-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-check-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-check-entry.js +5 -2
- package/dist/domains/comet-classic/classic-check-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-check-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-check-snapshot.js +68 -26
- package/dist/domains/comet-classic/classic-check-snapshot.js.map +1 -1
- package/dist/domains/comet-classic/classic-design-readiness.d.ts +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-guard-entry.js +5 -2
- package/dist/domains/comet-classic/classic-guard-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-handoff-entry.js +5 -2
- package/dist/domains/comet-classic/classic-handoff-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-progress.d.ts +60 -2
- package/dist/domains/comet-classic/classic-progress.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-progress.js +199 -22
- package/dist/domains/comet-classic/classic-progress.js.map +1 -1
- package/dist/domains/comet-classic/classic-recovery.d.ts +20 -1
- package/dist/domains/comet-classic/classic-recovery.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-resume-probe.js +3 -2
- package/dist/domains/comet-classic/classic-resume-probe.js.map +1 -1
- package/dist/domains/comet-classic/classic-script-entry.d.ts +3 -1
- package/dist/domains/comet-classic/classic-script-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-script-entry.js +34 -3
- package/dist/domains/comet-classic/classic-script-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-state-command.js +3 -2
- package/dist/domains/comet-classic/classic-state-command.js.map +1 -1
- package/dist/domains/comet-classic/classic-state-entry.d.ts +1 -1
- package/dist/domains/comet-classic/classic-state-entry.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-state-entry.js +5 -2
- package/dist/domains/comet-classic/classic-state-entry.js.map +1 -1
- package/dist/domains/comet-classic/classic-store.d.ts.map +1 -1
- package/dist/domains/comet-classic/classic-store.js +67 -1
- package/dist/domains/comet-classic/classic-store.js.map +1 -1
- package/dist/domains/comet-entry/resume-probe.d.ts.map +1 -1
- package/dist/domains/comet-entry/resume-probe.js +3 -2
- package/dist/domains/comet-entry/resume-probe.js.map +1 -1
- package/dist/domains/comet-native/native-acceptance.d.ts +5 -1
- package/dist/domains/comet-native/native-acceptance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-acceptance.js +13 -2
- package/dist/domains/comet-native/native-acceptance.js.map +1 -1
- package/dist/domains/comet-native/native-archive-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-archive-command.js +167 -37
- package/dist/domains/comet-native/native-archive-command.js.map +1 -1
- package/dist/domains/comet-native/native-artifact-language.d.ts +10 -1
- package/dist/domains/comet-native/native-artifact-language.d.ts.map +1 -1
- package/dist/domains/comet-native/native-artifact-language.js +65 -12
- package/dist/domains/comet-native/native-artifact-language.js.map +1 -1
- package/dist/domains/comet-native/native-artifacts.d.ts +10 -1
- package/dist/domains/comet-native/native-artifacts.d.ts.map +1 -1
- package/dist/domains/comet-native/native-artifacts.js +130 -21
- package/dist/domains/comet-native/native-artifacts.js.map +1 -1
- package/dist/domains/comet-native/native-builder-acceptance-review.d.ts +16 -0
- package/dist/domains/comet-native/native-builder-acceptance-review.d.ts.map +1 -0
- package/dist/domains/comet-native/native-builder-acceptance-review.js +65 -0
- package/dist/domains/comet-native/native-builder-acceptance-review.js.map +1 -0
- package/dist/domains/comet-native/native-cli-help.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli-help.js +8 -4
- package/dist/domains/comet-native/native-cli-help.js.map +1 -1
- package/dist/domains/comet-native/native-cli-shared.d.ts +4 -2
- package/dist/domains/comet-native/native-cli-shared.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli-shared.js +37 -9
- package/dist/domains/comet-native/native-cli-shared.js.map +1 -1
- package/dist/domains/comet-native/native-cli.d.ts +4 -1
- package/dist/domains/comet-native/native-cli.d.ts.map +1 -1
- package/dist/domains/comet-native/native-cli.js +9 -5
- package/dist/domains/comet-native/native-cli.js.map +1 -1
- package/dist/domains/comet-native/native-doctor-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-doctor-command.js +144 -3
- package/dist/domains/comet-native/native-doctor-command.js.map +1 -1
- package/dist/domains/comet-native/native-git-provenance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-git-provenance.js +3 -2
- package/dist/domains/comet-native/native-git-provenance.js.map +1 -1
- package/dist/domains/comet-native/native-hook-guard.d.ts.map +1 -1
- package/dist/domains/comet-native/native-hook-guard.js +57 -26
- package/dist/domains/comet-native/native-hook-guard.js.map +1 -1
- package/dist/domains/comet-native/native-local-execution.d.ts +1 -0
- package/dist/domains/comet-native/native-local-execution.d.ts.map +1 -1
- package/dist/domains/comet-native/native-local-execution.js +7 -0
- package/dist/domains/comet-native/native-local-execution.js.map +1 -1
- package/dist/domains/comet-native/native-lock.d.ts.map +1 -1
- package/dist/domains/comet-native/native-lock.js +12 -0
- package/dist/domains/comet-native/native-lock.js.map +1 -1
- package/dist/domains/comet-native/native-loop-runtime.d.ts +2 -0
- package/dist/domains/comet-native/native-loop-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-loop-runtime.js +6 -0
- package/dist/domains/comet-native/native-loop-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-next-command.d.ts.map +1 -1
- package/dist/domains/comet-native/native-next-command.js +57 -28
- package/dist/domains/comet-native/native-next-command.js.map +1 -1
- package/dist/domains/comet-native/native-output-language.d.ts.map +1 -1
- package/dist/domains/comet-native/native-output-language.js +7 -0
- package/dist/domains/comet-native/native-output-language.js.map +1 -1
- package/dist/domains/comet-native/native-portable-acceptance.d.ts +2 -0
- package/dist/domains/comet-native/native-portable-acceptance.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-acceptance.js +11 -1
- package/dist/domains/comet-native/native-portable-acceptance.js.map +1 -1
- package/dist/domains/comet-native/native-portable-archive.d.ts +1 -0
- package/dist/domains/comet-native/native-portable-archive.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-archive.js +3 -0
- package/dist/domains/comet-native/native-portable-archive.js.map +1 -1
- package/dist/domains/comet-native/native-portable-checks.d.ts +14 -4
- package/dist/domains/comet-native/native-portable-checks.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-checks.js +159 -60
- package/dist/domains/comet-native/native-portable-checks.js.map +1 -1
- package/dist/domains/comet-native/native-portable-continuation.d.ts +2 -1
- package/dist/domains/comet-native/native-portable-continuation.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-continuation.js +121 -39
- package/dist/domains/comet-native/native-portable-continuation.js.map +1 -1
- package/dist/domains/comet-native/native-portable-requirements.d.ts +1 -0
- package/dist/domains/comet-native/native-portable-requirements.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-requirements.js +68 -18
- package/dist/domains/comet-native/native-portable-requirements.js.map +1 -1
- package/dist/domains/comet-native/native-portable-shape-coordination.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-shape-coordination.js +18 -5
- package/dist/domains/comet-native/native-portable-shape-coordination.js.map +1 -1
- package/dist/domains/comet-native/native-portable-state.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-state.js +12 -3
- package/dist/domains/comet-native/native-portable-state.js.map +1 -1
- package/dist/domains/comet-native/native-portable-status.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-status.js +10 -4
- package/dist/domains/comet-native/native-portable-status.js.map +1 -1
- package/dist/domains/comet-native/native-portable-types.d.ts +2 -1
- package/dist/domains/comet-native/native-portable-types.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-types.js.map +1 -1
- package/dist/domains/comet-native/native-portable-verification.d.ts +3 -0
- package/dist/domains/comet-native/native-portable-verification.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-verification.js +28 -35
- package/dist/domains/comet-native/native-portable-verification.js.map +1 -1
- package/dist/domains/comet-native/native-portable-verifier-coordination.d.ts +2 -0
- package/dist/domains/comet-native/native-portable-verifier-coordination.d.ts.map +1 -1
- package/dist/domains/comet-native/native-portable-verifier-coordination.js +9 -0
- package/dist/domains/comet-native/native-portable-verifier-coordination.js.map +1 -1
- package/dist/domains/comet-native/native-runner-input-artifacts.d.ts +9 -0
- package/dist/domains/comet-native/native-runner-input-artifacts.d.ts.map +1 -0
- package/dist/domains/comet-native/native-runner-input-artifacts.js +102 -0
- package/dist/domains/comet-native/native-runner-input-artifacts.js.map +1 -0
- package/dist/domains/comet-native/native-runner-input.d.ts +90 -64
- package/dist/domains/comet-native/native-runner-input.d.ts.map +1 -1
- package/dist/domains/comet-native/native-runner-input.js +107 -22
- package/dist/domains/comet-native/native-runner-input.js.map +1 -1
- package/dist/domains/comet-native/native-script-entry.d.ts.map +1 -1
- package/dist/domains/comet-native/native-script-entry.js +9 -3
- package/dist/domains/comet-native/native-script-entry.js.map +1 -1
- package/dist/domains/comet-native/native-snapshot.d.ts.map +1 -1
- package/dist/domains/comet-native/native-snapshot.js +7 -2
- package/dist/domains/comet-native/native-snapshot.js.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.d.ts.map +1 -1
- package/dist/domains/comet-native/native-verification-receipt-runtime.js +5 -4
- package/dist/domains/comet-native/native-verification-receipt-runtime.js.map +1 -1
- package/dist/domains/comet-native/native-workspace-finish.d.ts +26 -0
- package/dist/domains/comet-native/native-workspace-finish.d.ts.map +1 -1
- package/dist/domains/comet-native/native-workspace-finish.js +520 -15
- package/dist/domains/comet-native/native-workspace-finish.js.map +1 -1
- package/dist/domains/comet-plugin/integration.d.ts +1 -0
- package/dist/domains/comet-plugin/integration.d.ts.map +1 -1
- package/dist/domains/comet-plugin/integration.js +20 -10
- package/dist/domains/comet-plugin/integration.js.map +1 -1
- package/dist/domains/comet-plugin/plugin-runtime.d.ts +8 -2
- package/dist/domains/comet-plugin/plugin-runtime.d.ts.map +1 -1
- package/dist/domains/comet-plugin/plugin-runtime.js +18 -4
- package/dist/domains/comet-plugin/plugin-runtime.js.map +1 -1
- package/dist/domains/dashboard/project-directory.d.ts +4 -0
- package/dist/domains/dashboard/project-directory.d.ts.map +1 -1
- package/dist/domains/dashboard/project-directory.js +30 -2
- package/dist/domains/dashboard/project-directory.js.map +1 -1
- package/dist/domains/dashboard/server.d.ts.map +1 -1
- package/dist/domains/dashboard/server.js +28 -3
- package/dist/domains/dashboard/server.js.map +1 -1
- package/dist/domains/dashboard/web/assets/{abnfDiagram-VCTEODGH-qlcciI25.js → abnfDiagram-VCTEODGH-m9_t3fwH.js} +1 -1
- package/dist/domains/dashboard/web/assets/{arc-KVm4k9kp.js → arc-CDiwRrMg.js} +1 -1
- package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-ypJOsR2Y.js +1 -0
- package/dist/domains/dashboard/web/assets/{architectureDiagram-5GKGNRK7-C366RdBK.js → architectureDiagram-5GKGNRK7-Xwj-hlQB.js} +1 -1
- package/dist/domains/dashboard/web/assets/{blockDiagram-I7D4REHJ-DAuTc2OO.js → blockDiagram-I7D4REHJ-Cme6qNK_.js} +1 -1
- package/dist/domains/dashboard/web/assets/{c4Diagram-7LVT6UL2-CFB0RZmL.js → c4Diagram-7LVT6UL2-Cxs1dU7y.js} +1 -1
- package/dist/domains/dashboard/web/assets/channel-BFTjR7Ng.js +1 -0
- package/dist/domains/dashboard/web/assets/{chunk-4HAMMTFA-DTV6lyGQ.js → chunk-4HAMMTFA-DBQykIWE.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-75Z2AOVW-DgJm4cEX.js → chunk-75Z2AOVW-Dh-E6TAx.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-DU6HZSFF-NAtcgGZr.js → chunk-DU6HZSFF-W3lPaoVP.js} +2 -2
- package/dist/domains/dashboard/web/assets/{chunk-F27PBJKO-BcFXHZMJ.js → chunk-F27PBJKO-dzf1fpYi.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-GMAD6QVW-wNemar9b.js → chunk-GMAD6QVW-CeuSGVHV.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-GVQU2GXP-BiVCDO9d.js → chunk-GVQU2GXP-BrGrIBgk.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-IMKFNOWR-D9GDj4b6.js → chunk-IMKFNOWR-DXiTC1Xo.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-L3NEJ4N5-DkPl5vac.js → chunk-L3NEJ4N5-DnyD3Ocj.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-OSK3NFVY-RbbxGqtJ.js → chunk-OSK3NFVY-6vxhPm51.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-P2QGCYS3-B9_X57eT.js → chunk-P2QGCYS3-DChNsVqO.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-POPQ4Y6H-DE4bOH0D.js → chunk-POPQ4Y6H-RBgha6dE.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-PWAF6VOD-Bo-W1iA1.js → chunk-PWAF6VOD-CayoKmnh.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-SHT3W25Y-BhLxs4rZ.js → chunk-SHT3W25Y-sOkLJZoB.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-SVP7TREG-BCXfn8uF.js → chunk-SVP7TREG-j0QRwmsq.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-TICWLB2K-DqSBgE5L.js → chunk-TICWLB2K-D7Re_d_T.js} +1 -1
- package/dist/domains/dashboard/web/assets/{chunk-XXDRQBXY-Dbkt1xEZ.js → chunk-XXDRQBXY-BFV70fKF.js} +1 -1
- package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-gDSLbV2K.js +1 -0
- package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-gDSLbV2K.js +1 -0
- package/dist/domains/dashboard/web/assets/{cose-bilkent-JH36ORCC-DrwNpMyX.js → cose-bilkent-JH36ORCC-k7gqx2Br.js} +1 -1
- package/dist/domains/dashboard/web/assets/{cynefin-OW5HDTMX-BbDlivxs.js → cynefin-OW5HDTMX-CWI6FZT8.js} +1 -1
- package/dist/domains/dashboard/web/assets/{cynefinDiagram-5FMLGOSQ-DmLmRN42.js → cynefinDiagram-5FMLGOSQ-D-O3RrOu.js} +1 -1
- package/dist/domains/dashboard/web/assets/{dagre-GXQ25YYZ-Cgm5DNgI.js → dagre-GXQ25YYZ-BR1jxWfn.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-S7CK7UJ4-Bnht1X2m.js → diagram-S7CK7UJ4-B6gXFYBj.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-UQ7AKVKN-LELTI4PR.js → diagram-UQ7AKVKN-BBW6aRk8.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-VSXAHHWV-Do0fZuNG.js → diagram-VSXAHHWV-BC0CZeyH.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-VX7I27RA-B0rZTUwt.js → diagram-VX7I27RA-BmwBIkwS.js} +1 -1
- package/dist/domains/dashboard/web/assets/{diagram-Z3DM3KII-wn8xCc_j.js → diagram-Z3DM3KII-DTZgX9SF.js} +1 -1
- package/dist/domains/dashboard/web/assets/{dist-CYwDKy2m.js → dist-brXLwleg.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ebnfDiagram-PWID7BFC-CMDOpP2T.js → ebnfDiagram-PWID7BFC-CsMXo0C6.js} +1 -1
- package/dist/domains/dashboard/web/assets/{erDiagram-RLTQ6QDP-C2d43bdq.js → erDiagram-RLTQ6QDP-DQ9ewX94.js} +1 -1
- package/dist/domains/dashboard/web/assets/{es-BzaOcXwu.js → es-CgcAhzLf.js} +1 -1
- package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-Ll12Q19y.js +1 -0
- package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-Bf2-9XUn.js +1 -0
- package/dist/domains/dashboard/web/assets/{ganttDiagram-EL5Y4UJY-hTH7TzhY.js → ganttDiagram-EL5Y4UJY-DIFkXe6G.js} +1 -1
- package/dist/domains/dashboard/web/assets/{gitGraph-4MIJSDKK-C3CCywb-.js → gitGraph-4MIJSDKK-BHY8ZnpE.js} +1 -1
- package/dist/domains/dashboard/web/assets/{gitGraphDiagram-WWUBYQGX-DW6jDckj.js → gitGraphDiagram-WWUBYQGX-cBn9dMzs.js} +1 -1
- package/dist/domains/dashboard/web/assets/{index-CTZPz_mx.js → index-C_6nf1Fw.js} +3 -3
- package/dist/domains/dashboard/web/assets/{index-CWNqBYyI.css → index-Gaxnq6Jd.css} +1 -1
- package/dist/domains/dashboard/web/assets/{info-A6RAGUB7-Bg3eKis8.js → info-A6RAGUB7-DtUaS9jN.js} +1 -1
- package/dist/domains/dashboard/web/assets/{infoDiagram-27XIBGKW-7zk6ytVJ.js → infoDiagram-27XIBGKW-CIl0e_EN.js} +1 -1
- package/dist/domains/dashboard/web/assets/{ishikawaDiagram-5VMMS53U-CGDCTmCQ.js → ishikawaDiagram-5VMMS53U-DAdtPZ_c.js} +1 -1
- package/dist/domains/dashboard/web/assets/{journeyDiagram-3NMN7TZE-C8_L_e8a.js → journeyDiagram-3NMN7TZE-CBokRgde.js} +1 -1
- package/dist/domains/dashboard/web/assets/{kanban-definition-UXKFOSKX-D5x6qTgM.js → kanban-definition-UXKFOSKX-DrqCYJ-7.js} +1 -1
- package/dist/domains/dashboard/web/assets/katex-D29apahB.js +257 -0
- package/dist/domains/dashboard/web/assets/{line-DC93oja4.js → line-BDlVqlh4.js} +1 -1
- package/dist/domains/dashboard/web/assets/{linear-81TNubkB.js → linear-DTAzui9x.js} +1 -1
- package/dist/domains/dashboard/web/assets/{mermaid-parser.core-D60d8uy9.js → mermaid-parser.core-CFw-xbYY.js} +3 -3
- package/dist/domains/dashboard/web/assets/{mermaid.core-l4Wgjz2Q.js → mermaid.core-Ck7fB8UD.js} +4 -4
- package/dist/domains/dashboard/web/assets/{mindmap-definition-YA3MSWOX-Dfqu1201.js → mindmap-definition-YA3MSWOX-C7kb9KL9.js} +1 -1
- package/dist/domains/dashboard/web/assets/{packet-AYTQ26CC-CsFZBhTs.js → packet-AYTQ26CC-P8Mtt0tp.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pegDiagram-XKGWAZYB-myFMaA7n.js → pegDiagram-XKGWAZYB-DUDD9qv5.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pie-WAS4IAKB-FMuCTNSk.js → pie-WAS4IAKB-dEmLxiDR.js} +1 -1
- package/dist/domains/dashboard/web/assets/{pieDiagram-E7YTZNPT-CSR4B4Z1.js → pieDiagram-E7YTZNPT-BUssAcqk.js} +1 -1
- package/dist/domains/dashboard/web/assets/purify.es-Bvo9QlJ8.js +3 -0
- package/dist/domains/dashboard/web/assets/{quadrantDiagram-AXDQQJYC-BiE4kEeP.js → quadrantDiagram-AXDQQJYC-BzaAWdQL.js} +1 -1
- package/dist/domains/dashboard/web/assets/{radar-RG4KPBEZ-BZ-n7JtG.js → radar-RG4KPBEZ-mqtvaz9w.js} +1 -1
- package/dist/domains/dashboard/web/assets/{railroad-74A4TZTK-CWVtRfHu.js → railroad-74A4TZTK-7tTnGpoz.js} +1 -1
- package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CpJvyBJM.js +1 -0
- package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-BJ5g77l6.js +1 -0
- package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-BslCK-Gr.js +1 -0
- package/dist/domains/dashboard/web/assets/{railroadDiagram-O6MQD6OU-CBj7v1de.js → railroadDiagram-O6MQD6OU-DM1AKXm0.js} +1 -1
- package/dist/domains/dashboard/web/assets/{requirementDiagram-BXWQKSXE-DSDgb54n.js → requirementDiagram-BXWQKSXE--H5KiPSc.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sankeyDiagram-P5KCCOFB-1-oXLUAP.js → sankeyDiagram-P5KCCOFB-JweUq_u2.js} +1 -1
- package/dist/domains/dashboard/web/assets/{sequenceDiagram-WJ2MYXX4-DAF4nGs_.js → sequenceDiagram-WJ2MYXX4-pxb1iTGb.js} +1 -1
- package/dist/domains/dashboard/web/assets/{src-CTWLVUqE.js → src-joFOxopw.js} +1 -1
- package/dist/domains/dashboard/web/assets/{stateDiagram-D77RDMKH-DzENBaJT.js → stateDiagram-D77RDMKH-CDu5crd8.js} +1 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-wV5AqWaM.js +1 -0
- package/dist/domains/dashboard/web/assets/{swimlanes-42K2YHIH-CnxFUZJc.js → swimlanes-42K2YHIH-ioSqowJ4.js} +1 -1
- package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-DOPLn-V5.js +8 -0
- package/dist/domains/dashboard/web/assets/{timeline-definition-24CTP7MA-KtvPzpZM.js → timeline-definition-24CTP7MA-2YXSYkS3.js} +1 -1
- package/dist/domains/dashboard/web/assets/{treeView-Q6P3EWNA-Bdu3P9iY.js → treeView-Q6P3EWNA-DEGims38.js} +1 -1
- package/dist/domains/dashboard/web/assets/{treemap-WGGIJYW6-DFnn23JR.js → treemap-WGGIJYW6-CJvBhTlR.js} +1 -1
- package/dist/domains/dashboard/web/assets/{vennDiagram-4TSXK5OY-BjpviP26.js → vennDiagram-4TSXK5OY-CHdNWhBK.js} +1 -1
- package/dist/domains/dashboard/web/assets/{wardley-WFR3VGLG-CEo4a-j4.js → wardley-WFR3VGLG-CVO9PCjo.js} +1 -1
- package/dist/domains/dashboard/web/assets/{wardleyDiagram-VM6X3IG4-Bf54n6im.js → wardleyDiagram-VM6X3IG4-RToPmij6.js} +1 -1
- package/dist/domains/dashboard/web/assets/{xychartDiagram-S5SC5T6Z-CU-hI0Cm.js → xychartDiagram-S5SC5T6Z-DaWHnpHE.js} +1 -1
- package/dist/domains/dashboard/web/index.html +2 -2
- package/dist/domains/project-knowledge/host-review.d.ts +15 -2
- package/dist/domains/project-knowledge/host-review.d.ts.map +1 -1
- package/dist/domains/project-knowledge/host-review.js +65 -25
- package/dist/domains/project-knowledge/host-review.js.map +1 -1
- package/dist/domains/project-knowledge/index.d.ts +1 -0
- package/dist/domains/project-knowledge/index.d.ts.map +1 -1
- package/dist/domains/project-knowledge/index.js +1 -0
- package/dist/domains/project-knowledge/index.js.map +1 -1
- package/dist/domains/project-knowledge/learning.d.ts +2 -1
- package/dist/domains/project-knowledge/learning.d.ts.map +1 -1
- package/dist/domains/project-knowledge/learning.js +6 -0
- package/dist/domains/project-knowledge/learning.js.map +1 -1
- package/dist/domains/project-knowledge/plugin.d.ts.map +1 -1
- package/dist/domains/project-knowledge/plugin.js +3 -1
- package/dist/domains/project-knowledge/plugin.js.map +1 -1
- package/dist/domains/skill/dsh-adapter.d.ts +5 -1
- package/dist/domains/skill/dsh-adapter.d.ts.map +1 -1
- package/dist/domains/skill/dsh-adapter.js +222 -87
- package/dist/domains/skill/dsh-adapter.js.map +1 -1
- package/dist/domains/skill/platform-inspect.d.ts +1 -0
- package/dist/domains/skill/platform-inspect.d.ts.map +1 -1
- package/dist/domains/skill/platform-inspect.js +8 -4
- package/dist/domains/skill/platform-inspect.js.map +1 -1
- package/dist/domains/skill/platform-install.d.ts.map +1 -1
- package/dist/domains/skill/platform-install.js +7 -7
- package/dist/domains/skill/platform-install.js.map +1 -1
- package/dist/domains/workflow-contract/hook-target-scope.d.ts.map +1 -1
- package/dist/domains/workflow-contract/hook-target-scope.js +2 -1
- package/dist/domains/workflow-contract/hook-target-scope.js.map +1 -1
- package/dist/platform/fs/file-system.d.ts +2 -0
- package/dist/platform/fs/file-system.d.ts.map +1 -1
- package/dist/platform/fs/file-system.js +11 -0
- package/dist/platform/fs/file-system.js.map +1 -1
- package/dist/platform/install/dsh-profiles.d.ts +3 -0
- package/dist/platform/install/dsh-profiles.d.ts.map +1 -0
- package/dist/platform/install/dsh-profiles.js +40 -0
- package/dist/platform/install/dsh-profiles.js.map +1 -0
- package/dist/platform/install/platforms.d.ts.map +1 -1
- package/dist/platform/install/platforms.js +1 -0
- package/dist/platform/install/platforms.js.map +1 -1
- package/dist/platform/install/project-registry.d.ts +7 -1
- package/dist/platform/install/project-registry.d.ts.map +1 -1
- package/dist/platform/install/project-registry.js +49 -5
- package/dist/platform/install/project-registry.js.map +1 -1
- package/dist/platform/paths/git-worktree-cache.d.ts +3 -0
- package/dist/platform/paths/git-worktree-cache.d.ts.map +1 -0
- package/dist/platform/paths/git-worktree-cache.js +109 -0
- package/dist/platform/paths/git-worktree-cache.js.map +1 -0
- package/dist/platform/paths/git-worktree.d.ts +6 -0
- package/dist/platform/paths/git-worktree.d.ts.map +1 -1
- package/dist/platform/paths/git-worktree.js +191 -30
- package/dist/platform/paths/git-worktree.js.map +1 -1
- package/dist/platform/paths/project-worktree-root.d.ts +3 -0
- package/dist/platform/paths/project-worktree-root.d.ts.map +1 -0
- package/dist/platform/paths/project-worktree-root.js +14 -0
- package/dist/platform/paths/project-worktree-root.js.map +1 -0
- package/dist/platform/process/comet-daemon.d.ts +3 -0
- package/dist/platform/process/comet-daemon.d.ts.map +1 -1
- package/dist/platform/process/comet-daemon.js +8 -6
- package/dist/platform/process/comet-daemon.js.map +1 -1
- package/dist/platform/process/external-command.d.ts +3 -0
- package/dist/platform/process/external-command.d.ts.map +1 -1
- package/dist/platform/process/external-command.js +69 -2
- package/dist/platform/process/external-command.js.map +1 -1
- package/dist/platform/process/git.d.ts.map +1 -1
- package/dist/platform/process/git.js +3 -4
- package/dist/platform/process/git.js.map +1 -1
- package/dist/platform/process/hook-adapter.d.ts +2 -0
- package/dist/platform/process/hook-adapter.d.ts.map +1 -1
- package/dist/platform/process/hook-adapter.js +45 -3
- package/dist/platform/process/hook-adapter.js.map +1 -1
- package/dist/platform/process/hook-read-cache.d.ts +2 -0
- package/dist/platform/process/hook-read-cache.d.ts.map +1 -1
- package/dist/platform/process/hook-read-cache.js +25 -13
- package/dist/platform/process/hook-read-cache.js.map +1 -1
- package/dist/platform/process/process-identity.d.ts.map +1 -1
- package/dist/platform/process/process-identity.js +18 -51
- package/dist/platform/process/process-identity.js.map +1 -1
- package/dist/platform/process/runtime-metrics.d.ts +10 -1
- package/dist/platform/process/runtime-metrics.d.ts.map +1 -1
- package/dist/platform/process/runtime-metrics.js +37 -2
- package/dist/platform/process/runtime-metrics.js.map +1 -1
- package/dist/platform/process/windows-process-broker.d.ts +1 -0
- package/dist/platform/process/windows-process-broker.d.ts.map +1 -1
- package/dist/platform/process/windows-process-broker.js +70 -11
- package/dist/platform/process/windows-process-broker.js.map +1 -1
- package/dist/platform/process/windows-process-identity.d.ts +6 -0
- package/dist/platform/process/windows-process-identity.d.ts.map +1 -0
- package/dist/platform/process/windows-process-identity.js +190 -0
- package/dist/platform/process/windows-process-identity.js.map +1 -0
- package/eval/local/tasks/comet-classic-layout-lifecycle/environment/current-comet-package.json +11 -3
- package/eval/local/tasks/comet-native-wave-f-dashboard-readonly/environment/current-comet-package.json +11 -3
- package/eval/local/tests/scaffold/test_task_resolution.py +6 -2
- package/package.json +14 -8
- package/dist/domains/dashboard/web/assets/architecture-7GRP2DOG-QeljAKq2.js +0 -1
- package/dist/domains/dashboard/web/assets/channel-_AqwP0KA.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-ZZMXUADV-CRo4aB_7.js +0 -1
- package/dist/domains/dashboard/web/assets/classDiagram-v2-VYDZK3BY-CRo4aB_7.js +0 -1
- package/dist/domains/dashboard/web/assets/eventmodeling-NTZA5JFV-KYANo3DQ.js +0 -1
- package/dist/domains/dashboard/web/assets/flowDiagram-HODETNUW-CSROlLuj.js +0 -1
- package/dist/domains/dashboard/web/assets/katex-CXMH3UgJ.js +0 -257
- package/dist/domains/dashboard/web/assets/purify.es-ChwZkWde.js +0 -3
- package/dist/domains/dashboard/web/assets/railroad-abnf-HS5TGJTU-CkHwwI2i.js +0 -1
- package/dist/domains/dashboard/web/assets/railroad-ebnf-LZEXJU2U-8xzEHL6v.js +0 -1
- package/dist/domains/dashboard/web/assets/railroad-peg-WCYAUIDC-nSHBw0tH.js +0 -1
- package/dist/domains/dashboard/web/assets/stateDiagram-v2-MP3YSRHH-CNw52Fkn.js +0 -1
- package/dist/domains/dashboard/web/assets/swimlanesDiagram-VR7AAH4N-6TRvbqqI.js +0 -8
|
@@ -1,166 +1,179 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cometCreateRequire } from 'module';
|
|
3
3
|
const require = __cometCreateRequire(import.meta.url);
|
|
4
|
-
var
|
|
5
|
-
`)}};
|
|
6
|
-
`)?
|
|
4
|
+
var cd=Object.create;var pi=Object.defineProperty;var ld=Object.getOwnPropertyDescriptor;var ud=Object.getOwnPropertyNames;var fd=Object.getPrototypeOf,dd=Object.prototype.hasOwnProperty;var Nr=(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 A=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var w=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},md=(t,e)=>{for(var r in e)pi(t,r,{get:e[r],enumerable:!0})},pd=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ud(e))!dd.call(t,i)&&i!==r&&pi(t,i,{get:()=>e[i],enumerable:!(n=ld(e,i))||n.enumerable});return t};var Ve=(t,e,r)=>(r=t!=null?cd(fd(t)):{},pd(e||!t||!t.__esModule?pi(r,"default",{value:t,enumerable:!0}):r,t));import{AsyncLocalStorage as hd}from"node:async_hooks";function na(){let t=gd.getStore();return t?.active?t:null}function ia(t,e){let r=t;for(let n of e)r+="\0"+(typeof n=="string"?n:JSON.stringify(n));return r}function _e(t,e){return(...r)=>{let n=na();if(n===null)return e(...r);let i=ia(`async:${t}`,r),o=n.entries.get(i);if(o)return o.value;let s=e(...r).catch(a=>{throw n.entries.get(i)?.value===s&&n.entries.delete(i),a});return n.entries.set(i,{value:s}),s}}function gi(t,e){return(...r)=>{let n=na();if(n===null)return e(...r);let i=ia(`sync:${t}`,r),o=n.entries.get(i);if(o)return o.value;let s=e(...r);return n.entries.set(i,{value:s}),s}}var gd,Lt=A(()=>{"use strict";gd=new hd});var _=w(D=>{"use strict";var vi=Symbol.for("yaml.alias"),oa=Symbol.for("yaml.document"),Ir=Symbol.for("yaml.map"),sa=Symbol.for("yaml.pair"),bi=Symbol.for("yaml.scalar"),jr=Symbol.for("yaml.seq"),we=Symbol.for("yaml.node.type"),vd=t=>!!t&&typeof t=="object"&&t[we]===vi,bd=t=>!!t&&typeof t=="object"&&t[we]===oa,kd=t=>!!t&&typeof t=="object"&&t[we]===Ir,Cd=t=>!!t&&typeof t=="object"&&t[we]===sa,aa=t=>!!t&&typeof t=="object"&&t[we]===bi,Sd=t=>!!t&&typeof t=="object"&&t[we]===jr;function ca(t){if(t&&typeof t=="object")switch(t[we]){case Ir:case jr:return!0}return!1}function Ed(t){if(t&&typeof t=="object")switch(t[we]){case vi:case Ir:case bi:case jr:return!0}return!1}var _d=t=>(aa(t)||ca(t))&&!!t.anchor;D.ALIAS=vi;D.DOC=oa;D.MAP=Ir;D.NODE_TYPE=we;D.PAIR=sa;D.SCALAR=bi;D.SEQ=jr;D.hasAnchor=_d;D.isAlias=vd;D.isCollection=ca;D.isDocument=bd;D.isMap=kd;D.isNode=Ed;D.isPair=Cd;D.isScalar=aa;D.isSeq=Sd});var $t=w(ki=>{"use strict";var I=_(),K=Symbol("break visit"),la=Symbol("skip children"),ue=Symbol("remove node");function Lr(t,e){let r=ua(e);I.isDocument(t)?mt(null,t.contents,r,Object.freeze([t]))===ue&&(t.contents=null):mt(null,t,r,Object.freeze([]))}Lr.BREAK=K;Lr.SKIP=la;Lr.REMOVE=ue;function mt(t,e,r,n){let i=fa(t,e,r,n);if(I.isNode(i)||I.isPair(i))return da(t,n,i),mt(t,i,r,n);if(typeof i!="symbol"){if(I.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let s=mt(o,e.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===K)return K;s===ue&&(e.items.splice(o,1),o-=1)}}}else if(I.isPair(e)){n=Object.freeze(n.concat(e));let o=mt("key",e.key,r,n);if(o===K)return K;o===ue&&(e.key=null);let s=mt("value",e.value,r,n);if(s===K)return K;s===ue&&(e.value=null)}}return i}async function $r(t,e){let r=ua(e);I.isDocument(t)?await pt(null,t.contents,r,Object.freeze([t]))===ue&&(t.contents=null):await pt(null,t,r,Object.freeze([]))}$r.BREAK=K;$r.SKIP=la;$r.REMOVE=ue;async function pt(t,e,r,n){let i=await fa(t,e,r,n);if(I.isNode(i)||I.isPair(i))return da(t,n,i),pt(t,i,r,n);if(typeof i!="symbol"){if(I.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let s=await pt(o,e.items[o],r,n);if(typeof s=="number")o=s-1;else{if(s===K)return K;s===ue&&(e.items.splice(o,1),o-=1)}}}else if(I.isPair(e)){n=Object.freeze(n.concat(e));let o=await pt("key",e.key,r,n);if(o===K)return K;o===ue&&(e.key=null);let s=await pt("value",e.value,r,n);if(s===K)return K;s===ue&&(e.value=null)}}return i}function ua(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function fa(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(I.isMap(e))return r.Map?.(t,e,n);if(I.isSeq(e))return r.Seq?.(t,e,n);if(I.isPair(e))return r.Pair?.(t,e,n);if(I.isScalar(e))return r.Scalar?.(t,e,n);if(I.isAlias(e))return r.Alias?.(t,e,n)}function da(t,e,r){let n=e[e.length-1];if(I.isCollection(n))n.items[t]=r;else if(I.isPair(n))t==="key"?n.key=r:n.value=r;else if(I.isDocument(n))n.contents=r;else{let i=I.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}ki.visit=Lr;ki.visitAsync=$r});var Ci=w(pa=>{"use strict";var ma=_(),xd=$t(),Pd={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Rd=t=>t.replace(/[!,[\]{}]/g,e=>Pd[e]),Wt=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+Rd(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&&ma.isNode(e.contents)){let o={};xd.visit(e.contents,(s,a)=>{ma.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(`
|
|
5
|
+
`)}};Wt.defaultYaml={explicit:!1,version:"1.2"};Wt.defaultTags={"!!":"tag:yaml.org,2002:"};pa.Directives=Wt});var Wr=w(Dt=>{"use strict";var ha=_(),Od=$t();function Ad(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 ga(t){let e=new Set;return Od.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function wa(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Td(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=ga(t));let s=wa(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(ha.isScalar(s.node)||ha.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}}Dt.anchorIsValid=Ad;Dt.anchorNames=ga;Dt.createNodeAnchors=Td;Dt.findNewAnchor=wa});var Si=w(ya=>{"use strict";function qt(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i<o;++i){let s=n[i],a=qt(t,n,String(i),s);a===void 0?delete n[i]:a!==s&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let o=n.get(i),s=qt(t,n,i,o);s===void 0?n.delete(i):s!==o&&n.set(i,s)}else if(n instanceof Set)for(let i of Array.from(n)){let o=qt(t,n,i,i);o===void 0?n.delete(i):o!==i&&(n.delete(i),n.add(o))}else for(let[i,o]of Object.entries(n)){let s=qt(t,n,i,o);s===void 0?delete n[i]:s!==o&&(n[i]=s)}return t.call(e,r,n)}ya.applyReviver=qt});var xe=w(ba=>{"use strict";var Nd=_();function va(t,e,r){if(Array.isArray(t))return t.map((n,i)=>va(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Nd.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}ba.toJS=va});var Dr=w(Ca=>{"use strict";var Id=Si(),ka=_(),jd=xe(),Ei=class{constructor(e){Object.defineProperty(this,ka.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(!ka.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=jd.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?Id.applyReviver(o,{"":a},"",a):a}};Ca.NodeBase=Ei});var Mt=w(Sa=>{"use strict";var Ld=Wr(),$d=$t(),ht=_(),Wd=Dr(),Dd=xe(),_i=class extends Wd.NodeBase{constructor(e){super(ht.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=[],$d.visit(e,{Node:(o,s)=>{(ht.isAlias(s)||ht.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||(Dd.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=qr(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(Ld.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 qr(t,e,r){if(ht.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(ht.isCollection(e)){let n=0;for(let i of e.items){let o=qr(t,i,r);o>n&&(n=o)}return n}else if(ht.isPair(e)){let n=qr(t,e.key,r),i=qr(t,e.value,r);return Math.max(n,i)}return 1}Sa.Alias=_i});var T=w(xi=>{"use strict";var qd=_(),Md=Dr(),Fd=xe(),Bd=t=>!t||typeof t!="function"&&typeof t!="object",Pe=class extends Md.NodeBase{constructor(e){super(qd.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Fd.toJS(this.value,e,r)}toString(){return String(this.value)}};Pe.BLOCK_FOLDED="BLOCK_FOLDED";Pe.BLOCK_LITERAL="BLOCK_LITERAL";Pe.PLAIN="PLAIN";Pe.QUOTE_DOUBLE="QUOTE_DOUBLE";Pe.QUOTE_SINGLE="QUOTE_SINGLE";xi.Scalar=Pe;xi.isScalarValue=Bd});var Ft=w(_a=>{"use strict";var Ud=Mt(),Xe=_(),Ea=T(),Gd="tag:yaml.org,2002:";function Kd(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 Hd(t,e,r){if(Xe.isDocument(t)&&(t=t.contents),Xe.isNode(t))return t;if(Xe.isPair(t)){let f=r.schema[Xe.MAP].createNode?.(r.schema,null,r);return f.items.push(t),f}(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 Ud.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Gd+e.slice(2));let l=Kd(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let f=new Ea.Scalar(t);return c&&(c.node=f),f}l=t instanceof Map?s[Xe.MAP]:Symbol.iterator in Object(t)?s[Xe.SEQ]:s[Xe.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 Ea.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}_a.createNode=Hd});var Fr=w(Mr=>{"use strict";var zd=Ft(),fe=_(),Jd=Dr();function Pi(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 zd.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 xa=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Ri=class extends Jd.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=>fe.isNode(n)||fe.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(xa(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(fe.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,Pi(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(fe.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&&fe.isScalar(o)?o.value:o:fe.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!fe.isPair(r))return!1;let n=r.value;return n==null||e&&fe.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 fe.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(fe.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,Pi(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Mr.Collection=Ri;Mr.collectionFromPath=Pi;Mr.isEmptyPath=xa});var Bt=w(Br=>{"use strict";var Yd=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function Oi(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Vd=(t,e,r)=>t.endsWith(`
|
|
6
|
+
`)?Oi(r,e):r.includes(`
|
|
7
7
|
`)?`
|
|
8
|
-
`+
|
|
9
|
-
`)r===
|
|
8
|
+
`+Oi(r,e):(t.endsWith(" ")?"":" ")+r;Br.indentComment=Oi;Br.lineComment=Vd;Br.stringifyComment=Yd});var Ra=w(Ut=>{"use strict";var Xd="flow",Ai="block",Ur="quoted";function Qd(t,e,r="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let c=Math.max(1+o,1+i-e.length);if(t.length<=c)return t;let l=[],u={},f=i-e.length;typeof n=="number"&&(n>i-Math.max(2,o)?l.push(0):f=i-n);let d,p,h=!1,m=-1,g=-1,y=-1;r===Ai&&(m=Pa(t,m,e.length),m!==-1&&(f=m+c));for(let k;k=t[m+=1];){if(r===Ur&&k==="\\"){switch(g=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}y=m}if(k===`
|
|
9
|
+
`)r===Ai&&(m=Pa(t,m,e.length)),f=m+e.length+c,d=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
|
|
10
10
|
`&&p!==" "){let C=t[m+1];C&&C!==" "&&C!==`
|
|
11
|
-
`&&C!==" "&&(d=m)}if(m>=f)if(d)l.push(d),f=d+c,d=void 0;else if(r===
|
|
12
|
-
${e}${t.slice(0,S)}`:(r===
|
|
13
|
-
${e}${t.slice(C+1,S)}`)}return b}function
|
|
14
|
-
`);n=e,i=e+1,o=t[i]}return n}
|
|
15
|
-
`){if(o-s>n)return!0;if(s=o+1,i-s<=n)return!1}return!0}function
|
|
11
|
+
`&&C!==" "&&(d=m)}if(m>=f)if(d)l.push(d),f=d+c,d=void 0;else if(r===Ur){for(;p===" "||p===" ";)p=k,k=t[m+=1],h=!0;let C=m>y+1?m-2:g-1;if(u[C])return t;l.push(C),u[C]=!0,f=C+c,d=void 0}else h=!0}p=k}if(h&&a&&a(),l.length===0)return t;s&&s();let b=t.slice(0,l[0]);for(let k=0;k<l.length;++k){let C=l[k],S=l[k+1]||t.length;C===0?b=`
|
|
12
|
+
${e}${t.slice(0,S)}`:(r===Ur&&u[C]&&(b+=`${t[C]}\\`),b+=`
|
|
13
|
+
${e}${t.slice(C+1,S)}`)}return b}function Pa(t,e,r){let n=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+r)o=t[++e];else{do o=t[++e];while(o&&o!==`
|
|
14
|
+
`);n=e,i=e+1,o=t[i]}return n}Ut.FOLD_BLOCK=Ai;Ut.FOLD_FLOW=Xd;Ut.FOLD_QUOTED=Ur;Ut.foldFlowLines=Qd});var Kt=w(Oa=>{"use strict";var ce=T(),Re=Ra(),Kr=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Hr=t=>/^(%|---|\.\.\.)/m.test(t);function Zd(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;o<i;++o)if(t[o]===`
|
|
15
|
+
`){if(o-s>n)return!0;if(s=o+1,i-s<=n)return!1}return!0}function Gt(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Hr(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<i)c+=1;else{for(s+=r.slice(a,c)+`
|
|
16
16
|
|
|
17
17
|
`;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)s+=`
|
|
18
|
-
`,c+=2;s+=o,r[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+r.slice(a):r,n?s:
|
|
19
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return
|
|
20
|
-
${r}`)+"'";return e.implicitKey?n:
|
|
18
|
+
`,c+=2;s+=o,r[c+2]===" "&&(s+="\\"),c+=1,a=c+1}break;default:c+=1}return s=a?s+r.slice(a):r,n?s:Re.foldFlowLines(s,o,Re.FOLD_QUOTED,Kr(e,!1))}function Ti(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
19
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return Gt(t,e);let r=e.indent||(Hr(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
20
|
+
${r}`)+"'";return e.implicitKey?n:Re.foldFlowLines(n,r,Re.FOLD_FLOW,Kr(e,!1))}function gt(t,e){let{singleQuote:r}=e.options,n;if(r===!1)n=Gt;else{let i=t.includes('"'),o=t.includes("'");i&&!o?n=Ti:o&&!i?n=Gt:n=r?Ti:Gt}return n(t,e)}var Ni;try{Ni=new RegExp(`(^|(?<!
|
|
21
21
|
))
|
|
22
22
|
+(?!
|
|
23
|
-
|$)`,"g")}catch{
|
|
23
|
+
|$)`,"g")}catch{Ni=/\n+(?!\n|$)/g}function Gr({comment:t,type:e,value:r},n,i,o){let{blockQuote:s,commentString:a,lineWidth:c}=n.options;if(!s||/\n[\t ]+$/.test(r))return gt(r,n);let l=n.indent||(n.forceBlockIndent||Hr(r)?" ":""),u=s==="literal"?!0:s==="folded"||e===ce.Scalar.BLOCK_FOLDED?!1:e===ce.Scalar.BLOCK_LITERAL?!0:!Zd(r,c,l.length);if(!r)return u?`|
|
|
24
24
|
`:`>
|
|
25
25
|
`;let f,d;for(d=r.length;d>0;--d){let S=r[d-1];if(S!==`
|
|
26
26
|
`&&S!==" "&&S!==" ")break}let p=r.substring(d),h=p.indexOf(`
|
|
27
27
|
`);h===-1?f="-":r===p||h!==p.length-1?(f="+",o&&o()):f="",p&&(r=r.slice(0,-p.length),p[p.length-1]===`
|
|
28
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
29
|
-
`)
|
|
30
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,P=
|
|
31
|
-
${l}${
|
|
32
|
-
${l}${b}${r}${p}`}function
|
|
33
|
-
`)||u&&/[[\]{},]/.test(o))return
|
|
34
|
-
`)?
|
|
35
|
-
`))return
|
|
36
|
-
${c}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:h}=e.doc.schema;if(h.some(d)||p?.some(d))return
|
|
37
|
-
${e.indent}${a}`:a}
|
|
38
|
-
${a}:`):(g=`${g}:`,d&&(g
|
|
28
|
+
`&&(p=p.slice(0,-1)),p=p.replace(Ni,`$&${l}`));let m=!1,g,y=-1;for(g=0;g<r.length;++g){let S=r[g];if(S===" ")m=!0;else if(S===`
|
|
29
|
+
`)y=g;else break}let b=r.substring(0,y<g?y+1:g);b&&(r=r.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let C=(m?l?"2":"1":"")+f;if(t&&(C+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let S=r.replace(/\n+/g,`
|
|
30
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),E=!1,P=Kr(n,!0);s!=="folded"&&e!==ce.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{E=!0});let v=Re.foldFlowLines(`${b}${S}${p}`,l,Re.FOLD_BLOCK,P);if(!E)return`>${C}
|
|
31
|
+
${l}${v}`}return r=r.replace(/\n+/g,`$&${l}`),`|${C}
|
|
32
|
+
${l}${b}${r}${p}`}function em(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(`
|
|
33
|
+
`)||u&&/[[\]{},]/.test(o))return gt(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(`
|
|
34
|
+
`)?gt(o,e):Gr(t,e,r,n);if(!a&&!u&&i!==ce.Scalar.PLAIN&&o.includes(`
|
|
35
|
+
`))return Gr(t,e,r,n);if(Hr(o)){if(c==="")return e.forceBlockIndent=!0,Gr(t,e,r,n);if(a&&c===l)return gt(o,e)}let f=o.replace(/\n+/g,`$&
|
|
36
|
+
${c}`);if(s){let d=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:p,tags:h}=e.doc.schema;if(h.some(d)||p?.some(d))return gt(o,e)}return a?f:Re.foldFlowLines(f,c,Re.FOLD_FLOW,Kr(e,!1))}function tm(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!==ce.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=ce.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case ce.Scalar.BLOCK_FOLDED:case ce.Scalar.BLOCK_LITERAL:return i||o?gt(s.value,e):Gr(s,e,r,n);case ce.Scalar.QUOTE_DOUBLE:return Gt(s.value,e);case ce.Scalar.QUOTE_SINGLE:return Ti(s.value,e);case ce.Scalar.PLAIN:return em(s,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:f}=e.options,d=i&&u||f;if(l=c(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}Oa.stringifyString=tm});var Ht=w(Ii=>{"use strict";var rm=Wr(),Oe=_(),nm=Bt(),im=Kt();function om(t,e){let r=Object.assign({blockQuote:!0,commentString:nm.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 sm(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(Oe.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 am(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Oe.isScalar(t)||Oe.isCollection(t))&&t.anchor;o&&rm.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 cm(t,e,r,n){if(Oe.isPair(t))return t.toString(e,r,n);if(Oe.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=Oe.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i??(i=sm(e.doc.schema.tags,o));let s=am(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):Oe.isScalar(o)?im.stringifyString(o,e,r,n):o.toString(e,r,n);return s?Oe.isScalar(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
|
|
37
|
+
${e.indent}${a}`:a}Ii.createStringifyContext=om;Ii.stringify=cm});var Ia=w(Na=>{"use strict";var ye=_(),Aa=T(),Ta=Ht(),zt=Bt();function lm({key:t,value:e},r,n,i){let{allNullValues:o,doc:s,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:f}}=r,d=ye.isNode(t)&&t.comment||null;if(f){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ye.isCollection(t)||!ye.isNode(t)&&typeof t=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let p=!f&&(!t||d&&e==null&&!r.inFlow||ye.isCollection(t)||(ye.isScalar(t)?t.type===Aa.Scalar.BLOCK_FOLDED||t.type===Aa.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(f||!o),indent:a+c});let h=!1,m=!1,g=Ta.stringify(t,r,()=>h=!0,()=>m=!0);if(!p&&!r.inFlow&&g.length>1024){if(f)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 h&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(o&&!f||e==null&&p)return g=`? ${g}`,d&&!h?g+=zt.lineComment(g,r.indent,l(d)):m&&i&&i(),g;h&&(d=null),p?(d&&(g+=zt.lineComment(g,r.indent,l(d))),g=`? ${g}
|
|
38
|
+
${a}:`):(g=`${g}:`,d&&(g+=zt.lineComment(g,r.indent,l(d))));let y,b,k;ye.isNode(e)?(y=!!e.spaceBefore,b=e.commentBefore,k=e.comment):(y=!1,b=null,k=null,e&&typeof e=="object"&&(e=s.createNode(e))),r.implicitKey=!1,!p&&!d&&ye.isScalar(e)&&(r.indentAtStart=g.length+1),m=!1,!u&&c.length>=2&&!r.inFlow&&!p&&ye.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let C=!1,S=Ta.stringify(e,r,()=>C=!0,()=>m=!0),E=" ";if(d||y||b){if(E=y?`
|
|
39
39
|
`:"",b){let P=l(b);E+=`
|
|
40
|
-
${
|
|
40
|
+
${zt.indentComment(P,r.indent)}`}S===""&&!r.inFlow?E===`
|
|
41
41
|
`&&k&&(E=`
|
|
42
42
|
|
|
43
43
|
`):E+=`
|
|
44
|
-
${r.indent}`}else if(!p&&
|
|
45
|
-
`),O=
|
|
44
|
+
${r.indent}`}else if(!p&&ye.isCollection(e)){let P=S[0],v=S.indexOf(`
|
|
45
|
+
`),O=v!==-1,se=r.inFlow??e.flow??e.items.length===0;if(O||!se){let pe=!1;if(O&&(P==="&"||P==="!")){let R=S.indexOf(" ");P==="&"&&R!==-1&&R<v&&S[R+1]==="!"&&(R=S.indexOf(" ",R+1)),(R===-1||v<R)&&(pe=!0)}pe||(E=`
|
|
46
46
|
${r.indent}`)}}else(S===""||S[0]===`
|
|
47
|
-
`)&&(E="");return g+=E+S,r.inFlow?C&&n&&n():k&&!C?g
|
|
47
|
+
`)&&(E="");return g+=E+S,r.inFlow?C&&n&&n():k&&!C?g+=zt.lineComment(g,r.indent,l(k)):m&&i&&i(),g}Na.stringifyPair=lm});var Li=w(ji=>{"use strict";var ja=Nr("process");function um(t,...e){t==="debug"&&console.log(...e)}function fm(t,e){(t==="debug"||t==="warn")&&(typeof ja.emitWarning=="function"?ja.emitWarning(e):console.warn(e))}ji.debug=um;ji.warn=fm});var Xr=w(Vr=>{"use strict";var Yr=_(),La=T(),zr="<<",Jr={identify:t=>t===zr||typeof t=="symbol"&&t.description===zr,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new La.Scalar(Symbol(zr)),{addToJSMap:$a}),stringify:()=>zr},dm=(t,e)=>(Jr.identify(e)||Yr.isScalar(e)&&(!e.type||e.type===La.Scalar.PLAIN)&&Jr.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Jr.tag&&r.default);function $a(t,e,r){let n=Wa(t,r);if(Yr.isSeq(n))for(let i of n.items)$i(t,e,i);else if(Array.isArray(n))for(let i of n)$i(t,e,i);else $i(t,e,n)}function $i(t,e,r){let n=Wa(t,r);if(!Yr.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 Wa(t,e){return t&&Yr.isAlias(e)?e.resolve(t.doc,t):e}Vr.addMergeToJSMap=$a;Vr.isMergeKey=dm;Vr.merge=Jr});var Di=w(Ma=>{"use strict";var mm=Li(),Da=Xr(),pm=Ht(),qa=_(),Wi=xe();function hm(t,e,{key:r,value:n}){if(qa.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(Da.isMergeKey(t,r))Da.addMergeToJSMap(t,e,n);else{let i=Wi.toJS(r,"",t);if(e instanceof Map)e.set(i,Wi.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=gm(r,i,t),s=Wi.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 gm(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(qa.isNode(t)&&r?.doc){let n=pm.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)+'..."'),mm.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)}Ma.addPairToJSMap=hm});var Ae=w(qi=>{"use strict";var Fa=Ft(),wm=Ia(),ym=Di(),Qr=_();function vm(t,e,r){let n=Fa.createNode(t,void 0,r),i=Fa.createNode(e,void 0,r);return new Zr(n,i)}var Zr=class t{constructor(e,r=null){Object.defineProperty(this,Qr.NODE_TYPE,{value:Qr.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return Qr.isNode(r)&&(r=r.clone(e)),Qr.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return ym.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?wm.stringifyPair(this,e,r,n):JSON.stringify(this)}};qi.Pair=Zr;qi.createPair=vm});var Mi=w(Ua=>{"use strict";var Qe=_(),Ba=Ht(),en=Bt();function bm(t,e,r){return(e.inFlow??t.flow?Cm:km)(t,e,r)}function km({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}),f=!1,d=[];for(let h=0;h<e.length;++h){let m=e[h],g=null;if(Qe.isNode(m))!f&&m.spaceBefore&&d.push(""),tn(r,d,m.commentBefore,f),m.comment&&(g=m.comment);else if(Qe.isPair(m)){let b=Qe.isNode(m.key)?m.key:null;b&&(!f&&b.spaceBefore&&d.push(""),tn(r,d,b.commentBefore,f))}f=!1;let y=Ba.stringify(m,u,()=>g=null,()=>f=!0);g&&(y+=en.lineComment(y,o,l(g))),f&&g&&(f=!1),d.push(n+y)}let p;if(d.length===0)p=i.start+i.end;else{p=d[0];for(let h=1;h<d.length;++h){let m=d[h];p+=m?`
|
|
48
48
|
${c}${m}`:`
|
|
49
49
|
`}}return t?(p+=`
|
|
50
|
-
`+
|
|
51
|
-
`)),h<t.length-1?
|
|
50
|
+
`+en.indentComment(l(t),c),a&&a()):f&&s&&s(),p}function Cm({items:t},e,{flowChars:r,itemIndent:n}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),l=!1,u=0,f=[];for(let h=0;h<t.length;++h){let m=t[h],g=null;if(Qe.isNode(m))m.spaceBefore&&f.push(""),tn(e,f,m.commentBefore,!1),m.comment&&(g=m.comment);else if(Qe.isPair(m)){let b=Qe.isNode(m.key)?m.key:null;b&&(b.spaceBefore&&f.push(""),tn(e,f,b.commentBefore,!1),b.comment&&(l=!0));let k=Qe.isNode(m.value)?m.value:null;k?(k.comment&&(g=k.comment),k.commentBefore&&(l=!0)):m.value==null&&b?.comment&&(g=b.comment)}g&&(l=!0);let y=Ba.stringify(m,c,()=>g=null);l||(l=f.length>u||y.includes(`
|
|
51
|
+
`)),h<t.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(l||(l=f.reduce((b,k)=>b+k.length+2,2)+(y.length+2)>e.options.lineWidth)),l&&(y+=",")),g&&(y+=en.lineComment(y,n,a(g))),f.push(y),u=f.length}let{start:d,end:p}=r;if(f.length===0)return d+p;if(!l){let h=f.reduce((m,g)=>m+g.length+2,2);l=e.options.lineWidth>0&&h>e.options.lineWidth}if(l){let h=d;for(let m of f)h+=m?`
|
|
52
52
|
${o}${i}${m}`:`
|
|
53
53
|
`;return`${h}
|
|
54
|
-
${i}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function
|
|
55
|
-
`:" ")}return
|
|
54
|
+
${i}${p}`}else return`${d}${s}${f.join(" ")}${s}${p}`}function tn({indent:t,options:{commentString:e}},r,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){let o=en.indentComment(e(n),t);r.push(o.trimStart())}}Ua.stringifyCollection=bm});var Ne=w(Bi=>{"use strict";var Sm=Mi(),Em=Di(),_m=Fr(),Te=_(),rn=Ae(),xm=T();function Jt(t,e){let r=Te.isScalar(e)?e.value:e;for(let n of t)if(Te.isPair(n)&&(n.key===e||n.key===r||Te.isScalar(n.key)&&n.key.value===r))return n}var Fi=class extends _m.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Te.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(rn.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;Te.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new rn.Pair(e,e?.value):n=new rn.Pair(e.key,e.value);let i=Jt(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Te.isScalar(i.value)&&xm.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=Jt(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=Jt(this.items,e)?.value;return(!r&&Te.isScalar(i)?i.value:i)??void 0}has(e){return!!Jt(this.items,e)}set(e,r){this.add(new rn.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)Em.addPairToJSMap(r,i,o);return i}toString(e,r,n){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Te.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})),Sm.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};Bi.YAMLMap=Fi;Bi.findPair=Jt});var wt=w(Ka=>{"use strict";var Pm=_(),Ga=Ne(),Rm={collection:"map",default:!0,nodeClass:Ga.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return Pm.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>Ga.YAMLMap.from(t,e,r)};Ka.map=Rm});var Ie=w(Ha=>{"use strict";var Om=Ft(),Am=Mi(),Tm=Fr(),on=_(),Nm=T(),Im=xe(),Ui=class extends Tm.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(on.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=nn(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=nn(e);if(typeof n!="number")return;let i=this.items[n];return!r&&on.isScalar(i)?i.value:i}has(e){let r=nn(e);return typeof r=="number"&&r<this.items.length}set(e,r){let n=nn(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[n];on.isScalar(i)&&Nm.isScalarValue(r)?i.value=r:this.items[n]=r}toJSON(e,r){let n=[];r?.onCreate&&r.onCreate(n);let i=0;for(let o of this.items)n.push(Im.toJS(o,String(i++),r));return n}toString(e,r,n){return e?Am.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(e,r,n){let{replacer:i}=n,o=new this(e);if(r&&Symbol.iterator in Object(r)){let s=0;for(let a of r){if(typeof i=="function"){let c=r instanceof Set?a:String(s++);a=i.call(r,c,a)}o.items.push(Om.createNode(a,void 0,n))}}return o}};function nn(t){let e=on.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}Ha.YAMLSeq=Ui});var yt=w(Ja=>{"use strict";var jm=_(),za=Ie(),Lm={collection:"seq",default:!0,nodeClass:za.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return jm.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>za.YAMLSeq.from(t,e,r)};Ja.seq=Lm});var Yt=w(Ya=>{"use strict";var $m=Kt(),Wm={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),$m.stringifyString(t,e,r,n)}};Ya.string=Wm});var sn=w(Qa=>{"use strict";var Va=T(),Xa={identify:t=>t==null,createNode:()=>new Va.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Va.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&Xa.test.test(t)?t:e.options.nullStr};Qa.nullTag=Xa});var Gi=w(ec=>{"use strict";var Dm=T(),Za={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Dm.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&Za.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};ec.boolTag=Za});var vt=w(tc=>{"use strict";function qm({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}tc.stringifyNumber=qm});var Hi=w(an=>{"use strict";var Mm=T(),Ki=vt(),Fm={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:Ki.stringifyNumber},Bm={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():Ki.stringifyNumber(t)}},Um={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 Mm.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:Ki.stringifyNumber};an.float=Um;an.floatExp=Bm;an.floatNaN=Fm});var Ji=w(ln=>{"use strict";var rc=vt(),cn=t=>typeof t=="bigint"||Number.isInteger(t),zi=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function nc(t,e,r){let{value:n}=t;return cn(n)&&n>=0?r+n.toString(e):rc.stringifyNumber(t)}var Gm={identify:t=>cn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>zi(t,2,8,r),stringify:t=>nc(t,8,"0o")},Km={identify:cn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>zi(t,0,10,r),stringify:rc.stringifyNumber},Hm={identify:t=>cn(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>zi(t,2,16,r),stringify:t=>nc(t,16,"0x")};ln.int=Km;ln.intHex=Hm;ln.intOct=Gm});var oc=w(ic=>{"use strict";var zm=wt(),Jm=sn(),Ym=yt(),Vm=Yt(),Xm=Gi(),Yi=Hi(),Vi=Ji(),Qm=[zm.map,Ym.seq,Vm.string,Jm.nullTag,Xm.boolTag,Vi.intOct,Vi.int,Vi.intHex,Yi.floatNaN,Yi.floatExp,Yi.float];ic.schema=Qm});var cc=w(ac=>{"use strict";var Zm=T(),ep=wt(),tp=yt();function sc(t){return typeof t=="bigint"||Number.isInteger(t)}var un=({value:t})=>JSON.stringify(t),rp=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:un},{identify:t=>t==null,createNode:()=>new Zm.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:un},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:un},{identify:sc,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})=>sc(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:un}],np={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},ip=[ep.map,tp.seq].concat(rp,np);ac.schema=ip});var Qi=w(lc=>{"use strict";var Vt=Nr("buffer"),Xi=T(),op=Kt(),sp={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Vt.Buffer=="function")return Vt.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<r.length;++i)n[i]=r.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},n,i,o){if(!r)return"";let s=r,a;if(typeof Vt.Buffer=="function")a=s instanceof Vt.Buffer?s.toString("base64"):Vt.Buffer.from(s.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let l=0;l<s.length;++l)c+=String.fromCharCode(s[l]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Xi.Scalar.BLOCK_LITERAL),e!==Xi.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),l=Math.ceil(a.length/c),u=new Array(l);for(let f=0,d=0;f<l;++f,d+=c)u[f]=a.substr(d,c);a=u.join(e===Xi.Scalar.BLOCK_LITERAL?`
|
|
55
|
+
`:" ")}return op.stringifyString({comment:t,type:e,value:a},n,i,o)}};lc.binary=sp});var mn=w(dn=>{"use strict";var fn=_(),Zi=Ae(),ap=T(),cp=Ie();function uc(t,e){if(fn.isSeq(t))for(let r=0;r<t.items.length;++r){let n=t.items[r];if(!fn.isPair(n)){if(fn.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let i=n.items[0]||new Zi.Pair(new ap.Scalar(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
|
|
56
56
|
${i.key.commentBefore}`:n.commentBefore),n.comment){let o=i.value??i.key;o.comment=o.comment?`${n.comment}
|
|
57
|
-
${o.comment}`:n.comment}n=i}t.items[r]=en.isPair(n)?n:new Di.Pair(n)}}else e("Expected a sequence for this tag");return t}function za(t,e,r){let{replacer:n}=r,i=new $m.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(Di.createPair(a,c,r))}return i}var Dm={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ha,createNode:za};tn.createPairs=za;tn.pairs=Dm;tn.resolvePairs=Ha});var Mi=w(qi=>{"use strict";var Ya=_(),Wi=ve(),Mt=_e(),Wm=xe(),Ja=rn(),Ke=class t extends Wm.YAMLSeq{constructor(){super(),this.add=Mt.YAMLMap.prototype.add.bind(this),this.delete=Mt.YAMLMap.prototype.delete.bind(this),this.get=Mt.YAMLMap.prototype.get.bind(this),this.has=Mt.YAMLMap.prototype.has.bind(this),this.set=Mt.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(Ya.isPair(i)?(o=Wi.toJS(i.key,"",r),s=Wi.toJS(i.value,o,r)):o=Wi.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=Ja.createPairs(e,r,n),o=new this;return o.items=i.items,o}};Ke.tag="tag:yaml.org,2002:omap";var qm={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ke,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=Ja.resolvePairs(t,e),n=[];for(let{key:i}of r.items)Ya.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ke,r)},createNode:(t,e,r)=>Ke.from(t,e,r)};qi.YAMLOMap=Ke;qi.omap=qm});var ec=w(Fi=>{"use strict";var Va=T();function Xa({value:t,source:e},r){return e&&(t?Qa:Za).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var Qa={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 Va.Scalar(!0),stringify:Xa},Za={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 Va.Scalar(!1),stringify:Xa};Fi.falseTag=Za;Fi.trueTag=Qa});var tc=w(nn=>{"use strict";var Mm=T(),Bi=ft(),Fm={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:Bi.stringifyNumber},Bm={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():Bi.stringifyNumber(t)}},Um={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 Mm.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:Bi.stringifyNumber};nn.float=Um;nn.floatExp=Bm;nn.floatNaN=Fm});var nc=w(Bt=>{"use strict";var rc=ft(),Ft=t=>typeof t=="bigint"||Number.isInteger(t);function on(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 Ui(t,e,r){let{value:n}=t;if(Ft(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return rc.stringifyNumber(t)}var Km={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>on(t,2,2,r),stringify:t=>Ui(t,2,"0b")},Gm={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>on(t,1,8,r),stringify:t=>Ui(t,8,"0")},Hm={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>on(t,0,10,r),stringify:rc.stringifyNumber},zm={identify:Ft,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>on(t,2,16,r),stringify:t=>Ui(t,16,"0x")};Bt.int=Hm;Bt.intBin=Km;Bt.intHex=zm;Bt.intOct=Gm});var Gi=w(Ki=>{"use strict";var cn=_(),sn=Se(),an=_e(),Ge=class t extends an.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;cn.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new sn.Pair(e.key,null):r=new sn.Pair(e,null),an.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=an.findPair(this.items,e);return!r&&cn.isPair(n)?cn.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=an.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new sn.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(sn.createPair(s,null,n));return o}};Ge.tag="tag:yaml.org,2002:set";var Ym={collection:"map",identify:t=>t instanceof Set,nodeClass:Ge,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>Ge.from(t,e,r),resolve(t,e){if(cn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new Ge,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Ki.YAMLSet=Ge;Ki.set=Ym});var zi=w(ln=>{"use strict";var Jm=ft();function Hi(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 ic(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Jm.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 Vm={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})=>Hi(t,r),stringify:ic},Xm={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=>Hi(t,!1),stringify:ic},oc={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(oc.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 f=Hi(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ln.floatTime=Xm;ln.intTime=Vm;ln.timestamp=oc});var cc=w(ac=>{"use strict";var Qm=lt(),Zm=Jr(),ep=ut(),tp=Wt(),rp=$i(),sc=ec(),Yi=tc(),un=nc(),np=Fr(),ip=Mi(),op=rn(),sp=Gi(),Ji=zi(),ap=[Qm.map,ep.seq,tp.string,Zm.nullTag,sc.trueTag,sc.falseTag,un.intBin,un.intOct,un.int,un.intHex,Yi.floatNaN,Yi.floatExp,Yi.float,rp.binary,np.merge,ip.omap,op.pairs,sp.set,Ji.intTime,Ji.floatTime,Ji.timestamp];ac.schema=ap});var yc=w(Qi=>{"use strict";var dc=lt(),cp=Jr(),mc=ut(),lp=Wt(),up=Ri(),Vi=Ai(),Xi=Ni(),fp=Fa(),dp=Ka(),pc=$i(),Ut=Fr(),hc=Mi(),gc=rn(),lc=cc(),wc=Gi(),fn=zi(),uc=new Map([["core",fp.schema],["failsafe",[dc.map,mc.seq,lp.string]],["json",dp.schema],["yaml11",lc.schema],["yaml-1.1",lc.schema]]),fc={binary:pc.binary,bool:up.boolTag,float:Vi.float,floatExp:Vi.floatExp,floatNaN:Vi.floatNaN,floatTime:fn.floatTime,int:Xi.int,intHex:Xi.intHex,intOct:Xi.intOct,intTime:fn.intTime,map:dc.map,merge:Ut.merge,null:cp.nullTag,omap:hc.omap,pairs:gc.pairs,seq:mc.seq,set:wc.set,timestamp:fn.timestamp},mp={"tag:yaml.org,2002:binary":pc.binary,"tag:yaml.org,2002:merge":Ut.merge,"tag:yaml.org,2002:omap":hc.omap,"tag:yaml.org,2002:pairs":gc.pairs,"tag:yaml.org,2002:set":wc.set,"tag:yaml.org,2002:timestamp":fn.timestamp};function pp(t,e,r){let n=uc.get(e);if(n&&!t)return r&&!n.includes(Ut.merge)?n.concat(Ut.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(uc.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(Ut.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?fc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(fc).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},[])}Qi.coreKnownTags=mp;Qi.getTags=pp});var to=w(vc=>{"use strict";var Zi=_(),hp=lt(),gp=ut(),wp=Wt(),dn=yc(),yp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,eo=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?dn.getTags(e,"compat"):e?dn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?dn.coreKnownTags:{},this.tags=dn.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Zi.MAP,{value:hp.map}),Object.defineProperty(this,Zi.SCALAR,{value:wp.string}),Object.defineProperty(this,Zi.SEQ,{value:gp.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?yp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};vc.Schema=eo});var kc=w(bc=>{"use strict";var vp=_(),ro=jt(),Kt=Tt();function bp(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=ro.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Kt.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(vp.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(Kt.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=ro.stringify(t.contents,i,()=>a=null,c);a&&(l+=Kt.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(ro.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
58
|
-
`)?(r.push("..."),r.push(
|
|
57
|
+
${o.comment}`:n.comment}n=i}t.items[r]=fn.isPair(n)?n:new Zi.Pair(n)}}else e("Expected a sequence for this tag");return t}function fc(t,e,r){let{replacer:n}=r,i=new cp.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(Zi.createPair(a,c,r))}return i}var lp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:uc,createNode:fc};dn.createPairs=fc;dn.pairs=lp;dn.resolvePairs=uc});var ro=w(to=>{"use strict";var dc=_(),eo=xe(),Xt=Ne(),up=Ie(),mc=mn(),Ze=class t extends up.YAMLSeq{constructor(){super(),this.add=Xt.YAMLMap.prototype.add.bind(this),this.delete=Xt.YAMLMap.prototype.delete.bind(this),this.get=Xt.YAMLMap.prototype.get.bind(this),this.has=Xt.YAMLMap.prototype.has.bind(this),this.set=Xt.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(dc.isPair(i)?(o=eo.toJS(i.key,"",r),s=eo.toJS(i.value,o,r)):o=eo.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=mc.createPairs(e,r,n),o=new this;return o.items=i.items,o}};Ze.tag="tag:yaml.org,2002:omap";var fp={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ze,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=mc.resolvePairs(t,e),n=[];for(let{key:i}of r.items)dc.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ze,r)},createNode:(t,e,r)=>Ze.from(t,e,r)};to.YAMLOMap=Ze;to.omap=fp});var yc=w(no=>{"use strict";var pc=T();function hc({value:t,source:e},r){return e&&(t?gc:wc).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var gc={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 pc.Scalar(!0),stringify:hc},wc={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 pc.Scalar(!1),stringify:hc};no.falseTag=wc;no.trueTag=gc});var vc=w(pn=>{"use strict";var dp=T(),io=vt(),mp={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},pp={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():io.stringifyNumber(t)}},hp={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 dp.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:io.stringifyNumber};pn.float=hp;pn.floatExp=pp;pn.floatNaN=mp});var kc=w(Zt=>{"use strict";var bc=vt(),Qt=t=>typeof t=="bigint"||Number.isInteger(t);function hn(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 oo(t,e,r){let{value:n}=t;if(Qt(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return bc.stringifyNumber(t)}var gp={identify:Qt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>hn(t,2,2,r),stringify:t=>oo(t,2,"0b")},wp={identify:Qt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>hn(t,1,8,r),stringify:t=>oo(t,8,"0")},yp={identify:Qt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>hn(t,0,10,r),stringify:bc.stringifyNumber},vp={identify:Qt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>hn(t,2,16,r),stringify:t=>oo(t,16,"0x")};Zt.int=yp;Zt.intBin=gp;Zt.intHex=vp;Zt.intOct=wp});var ao=w(so=>{"use strict";var yn=_(),gn=Ae(),wn=Ne(),et=class t extends wn.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;yn.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new gn.Pair(e.key,null):r=new gn.Pair(e,null),wn.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=wn.findPair(this.items,e);return!r&&yn.isPair(n)?yn.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=wn.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new gn.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(gn.createPair(s,null,n));return o}};et.tag="tag:yaml.org,2002:set";var bp={collection:"map",identify:t=>t instanceof Set,nodeClass:et,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>et.from(t,e,r),resolve(t,e){if(yn.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new et,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};so.YAMLSet=et;so.set=bp});var lo=w(vn=>{"use strict";var kp=vt();function co(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 Cc(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return kp.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 Cp={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})=>co(t,r),stringify:Cc},Sp={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=>co(t,!1),stringify:Cc},Sc={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(Sc.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 f=co(u,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};vn.floatTime=Sp;vn.intTime=Cp;vn.timestamp=Sc});var xc=w(_c=>{"use strict";var Ep=wt(),_p=sn(),xp=yt(),Pp=Yt(),Rp=Qi(),Ec=yc(),uo=vc(),bn=kc(),Op=Xr(),Ap=ro(),Tp=mn(),Np=ao(),fo=lo(),Ip=[Ep.map,xp.seq,Pp.string,_p.nullTag,Ec.trueTag,Ec.falseTag,bn.intBin,bn.intOct,bn.int,bn.intHex,uo.floatNaN,uo.floatExp,uo.float,Rp.binary,Op.merge,Ap.omap,Tp.pairs,Np.set,fo.intTime,fo.floatTime,fo.timestamp];_c.schema=Ip});var $c=w(ho=>{"use strict";var Ac=wt(),jp=sn(),Tc=yt(),Lp=Yt(),$p=Gi(),mo=Hi(),po=Ji(),Wp=oc(),Dp=cc(),Nc=Qi(),er=Xr(),Ic=ro(),jc=mn(),Pc=xc(),Lc=ao(),kn=lo(),Rc=new Map([["core",Wp.schema],["failsafe",[Ac.map,Tc.seq,Lp.string]],["json",Dp.schema],["yaml11",Pc.schema],["yaml-1.1",Pc.schema]]),Oc={binary:Nc.binary,bool:$p.boolTag,float:mo.float,floatExp:mo.floatExp,floatNaN:mo.floatNaN,floatTime:kn.floatTime,int:po.int,intHex:po.intHex,intOct:po.intOct,intTime:kn.intTime,map:Ac.map,merge:er.merge,null:jp.nullTag,omap:Ic.omap,pairs:jc.pairs,seq:Tc.seq,set:Lc.set,timestamp:kn.timestamp},qp={"tag:yaml.org,2002:binary":Nc.binary,"tag:yaml.org,2002:merge":er.merge,"tag:yaml.org,2002:omap":Ic.omap,"tag:yaml.org,2002:pairs":jc.pairs,"tag:yaml.org,2002:set":Lc.set,"tag:yaml.org,2002:timestamp":kn.timestamp};function Mp(t,e,r){let n=Rc.get(e);if(n&&!t)return r&&!n.includes(er.merge)?n.concat(er.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Rc.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(er.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?Oc[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(Oc).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},[])}ho.coreKnownTags=qp;ho.getTags=Mp});var yo=w(Wc=>{"use strict";var go=_(),Fp=wt(),Bp=yt(),Up=Yt(),Cn=$c(),Gp=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,wo=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Cn.getTags(e,"compat"):e?Cn.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Cn.coreKnownTags:{},this.tags=Cn.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,go.MAP,{value:Fp.map}),Object.defineProperty(this,go.SCALAR,{value:Up.string}),Object.defineProperty(this,go.SEQ,{value:Bp.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Gp:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};Wc.Schema=wo});var qc=w(Dc=>{"use strict";var Kp=_(),vo=Ht(),tr=Bt();function Hp(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=vo.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(tr.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Kp.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(tr.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=vo.stringify(t.contents,i,()=>a=null,c);a&&(l+=tr.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(vo.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
58
|
+
`)?(r.push("..."),r.push(tr.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(tr.indentComment(o(c),"")))}return r.join(`
|
|
59
59
|
`)+`
|
|
60
|
-
`}
|
|
60
|
+
`}Dc.stringifyDocument=Hp});var rr=w(Mc=>{"use strict";var zp=Mt(),bt=Fr(),ne=_(),Jp=Ae(),Yp=xe(),Vp=yo(),Xp=qc(),bo=Wr(),Qp=Si(),Zp=Ft(),ko=Ci(),Co=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ne.NODE_TYPE,{value:ne.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 ko.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,{[ne.NODE_TYPE]:{value:ne.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=ne.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){kt(this.contents)&&this.contents.add(e)}addIn(e,r){kt(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=bo.anchorNames(this);e.anchor=!r||n.has(r)?bo.findNewAnchor(r||"a",n):r}return new zp.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=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=r.filter(g).map(String);y.length>0&&(r=r.concat(y)),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:f,setAnchors:d,sourceObjects:p}=bo.createNodeAnchors(this,s||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:f,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},m=Zp.createNode(e,u,h);return a&&ne.isCollection(m)&&(m.flow=!0),d(),m}createPair(e,r,n={}){let i=this.createNode(e,null,n),o=this.createNode(r,null,n);return new Jp.Pair(i,o)}delete(e){return kt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return bt.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):kt(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return ne.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return bt.isEmptyPath(e)?!r&&ne.isScalar(this.contents)?this.contents.value:this.contents:ne.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return ne.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return bt.isEmptyPath(e)?this.contents!==void 0:ne.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=bt.collectionFromPath(this.schema,[e],r):kt(this.contents)&&this.contents.set(e,r)}setIn(e,r){bt.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=bt.collectionFromPath(this.schema,Array.from(e),r):kt(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 ko.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 ko.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 Vp.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=Yp.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"?Qp.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 Xp.stringifyDocument(this,e)}};function kt(t){if(ne.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}Mc.Document=Co});var or=w(ir=>{"use strict";var nr=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},So=class extends nr{constructor(e,r,n){super("YAMLParseError",e,r,n)}},Eo=class extends nr{constructor(e,r,n){super("YAMLWarning",e,r,n)}},eh=(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="…"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"…"),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)+`…
|
|
61
61
|
`),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+=`:
|
|
62
62
|
|
|
63
63
|
${s}
|
|
64
64
|
${l}
|
|
65
|
-
`}};
|
|
66
|
-
`))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(
|
|
67
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||
|
|
68
|
-
`+k.comment:b.comment=k.comment);let C=new
|
|
69
|
-
`+E.comment:l.comment=E.comment),f=E.end;continue}!s&&r.options.strict&&
|
|
70
|
-
`+P:
|
|
71
|
-
`+O.comment:
|
|
72
|
-
`+g.comment:l.comment=g.comment),l.range=[n.offset,m,g.offset]}else l.range=[n.offset,m,m];return l}
|
|
73
|
-
`.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:m,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let m=0;m<a;++m){let[g,
|
|
74
|
-
`;for(let m=u;m<a;++m){let[g,
|
|
75
|
-
`):g.length>c||
|
|
65
|
+
`}};ir.YAMLError=nr;ir.YAMLParseError=So;ir.YAMLWarning=Eo;ir.prettifyError=eh});var sr=w(Fc=>{"use strict";function th(t,{flow:e,indicator:r,next:n,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let c=!1,l=a,u=a,f="",d="",p=!1,h=!1,m=null,g=null,y=null,b=null,k=null,C=null,S=null;for(let v of t)switch(h&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&o(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(l&&v.type!=="comment"&&v.type!=="newline"&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),v.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&v.source.includes(" ")&&(m=v),u=!0;break;case"comment":{u||o(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let O=v.source.substring(1)||" ";f?f+=d+O:f=O,d="",l=!1;break}case"newline":l?f?f+=v.source:(!C||r!=="seq-item-ind")&&(c=!0):d+=v.source,l=!0,p=!0,(g||y)&&(b=v),u=!0;break;case"anchor":g&&o(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&o(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=v,S??(S=v.offset),l=!1,u=!1,h=!0;break;case"tag":{y&&o(v,"MULTIPLE_TAGS","A node can have at most one tag"),y=v,S??(S=v.offset),l=!1,u=!1,h=!0;break}case r:(g||y)&&o(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),C&&o(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${e??"collection"}`),C=v,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){k&&o(v,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),k=v,l=!1,u=!1;break}default:o(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),l=!1,u=!1}let E=t[t.length-1],P=E?E.offset+E.source.length:i;return h&&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"),m&&(l&&m.indent<=s||n?.type==="block-map"||n?.type==="block-seq")&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:C,spaceBefore:c,comment:f,hasNewline:p,anchor:g,tag:y,newlineAfterProp:b,end:P,start:S??P}}Fc.resolveProps=th});var Sn=w(Bc=>{"use strict";function _o(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
66
|
+
`))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(_o(e.key)||_o(e.value))return!0}return!1;default:return!0}}Bc.containsNewline=_o});var xo=w(Uc=>{"use strict";var rh=Sn();function nh(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&rh.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Uc.flowIndentCheck=nh});var Po=w(Kc=>{"use strict";var Gc=_();function ih(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||Gc.isScalar(o)&&Gc.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}Kc.mapIncludes=ih});var Xc=w(Vc=>{"use strict";var Hc=Ae(),oh=Ne(),zc=sr(),sh=Sn(),Jc=xo(),ah=Po(),Yc="All mapping items must start at the same column";function ch({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??oh.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:f,key:d,sep:p,value:h}=u,m=zc.resolveProps(f,{indicator:"explicit-key-ind",next:d??p?.[0],offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!m.found;if(g){if(d&&(d.type==="block-seq"?i(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==n.indent&&i(c,"BAD_INDENT",Yc)),!m.anchor&&!m.tag&&!p){l=m.end,m.comment&&(a.comment?a.comment+=`
|
|
67
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||sh.containsNewline(d))&&i(d??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==n.indent&&i(c,"BAD_INDENT",Yc);r.atKey=!0;let y=m.end,b=d?t(r,d,m,i):e(r,y,f,null,m,i);r.schema.compat&&Jc.flowIndentCheck(n.indent,d,i),r.atKey=!1,ah.mapIncludes(r,a.items,b)&&i(y,"DUPLICATE_KEY","Map keys must be unique");let k=zc.resolveProps(p??[],{indicator:"map-value-ind",next:h,offset:b.range[2],onError:i,parentIndent:n.indent,startOnNewline:!d||d.type==="block-scalar"});if(c=k.end,k.found){g&&(h?.type==="block-map"&&!k.hasNewline&&i(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&m.start<k.found.offset-1024&&i(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let C=h?t(r,h,k,i):e(r,c,p,null,k,i);r.schema.compat&&Jc.flowIndentCheck(n.indent,h,i),c=C.range[2];let S=new Hc.Pair(b,C);r.options.keepSourceTokens&&(S.srcToken=u),a.items.push(S)}else{g&&i(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(b.comment?b.comment+=`
|
|
68
|
+
`+k.comment:b.comment=k.comment);let C=new Hc.Pair(b);r.options.keepSourceTokens&&(C.srcToken=u),a.items.push(C)}}return l&&l<c&&i(l,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,c,l??c],a}Vc.resolveBlockMap=ch});var Zc=w(Qc=>{"use strict";var lh=Ie(),uh=sr(),fh=xo();function dh({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??lh.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:f}of n.items){let d=uh.resolveProps(u,{indicator:"seq-item-ind",next:f,offset:c,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||f)f?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(c,"MISSING_CHAR","Sequence item without - indicator");else{l=d.end,d.comment&&(a.comment=d.comment);continue}let p=f?t(r,f,d,i):e(r,d.end,u,null,d,i);r.schema.compat&&fh.flowIndentCheck(n.indent,f,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}Qc.resolveBlockSeq=dh});var Ct=w(el=>{"use strict";function mh(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}}el.resolveEnd=mh});var il=w(nl=>{"use strict";var ph=_(),hh=Ae(),tl=Ne(),gh=Ie(),wh=Ct(),rl=sr(),yh=Sn(),vh=Po(),Ro="Block collections are not allowed within flow collections",Oo=t=>t&&(t.type==="block-map"||t.type==="block-seq");function bh({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?tl.YAMLMap:gh.YAMLSeq),l=new c(r.schema);l.flow=!0;let u=r.atRoot;u&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let f=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){let y=n.items[g],{start:b,key:k,sep:C,value:S}=y,E=rl.resolveProps(b,{flow:a,indicator:"explicit-key-ind",next:k??C?.[0],offset:f,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!C&&!S){g===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<n.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(l.comment?l.comment+=`
|
|
69
|
+
`+E.comment:l.comment=E.comment),f=E.end;continue}!s&&r.options.strict&&yh.containsNewline(k)&&i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let P="";e:for(let v of b)switch(v.type){case"comma":case"space":break;case"comment":P=v.source.substring(1);break e;default:break e}if(P){let v=l.items[l.items.length-1];ph.isPair(v)&&(v=v.value??v.key),v.comment?v.comment+=`
|
|
70
|
+
`+P:v.comment=P,E.comment=E.comment.substring(P.length+1)}}if(!s&&!C&&!E.found){let P=S?t(r,S,E,i):e(r,E.end,C,null,E,i);l.items.push(P),f=P.range[2],Oo(S)&&i(P.range,"BLOCK_IN_FLOW",Ro)}else{r.atKey=!0;let P=E.end,v=k?t(r,k,E,i):e(r,P,b,null,E,i);Oo(k)&&i(v.range,"BLOCK_IN_FLOW",Ro),r.atKey=!1;let O=rl.resolveProps(C??[],{flow:a,indicator:"map-value-ind",next:S,offset:v.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(O.found){if(!s&&!E.found&&r.options.strict){if(C)for(let R of C){if(R===O.found)break;if(R.type==="newline"){i(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<O.found.offset-1024&&i(O.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?i(S,"MISSING_CHAR",`Missing space after : in ${a}`):i(O.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let se=S?t(r,S,O,i):O.found?e(r,O.end,C,null,O,i):null;se?Oo(S)&&i(se.range,"BLOCK_IN_FLOW",Ro):O.comment&&(v.comment?v.comment+=`
|
|
71
|
+
`+O.comment:v.comment=O.comment);let pe=new hh.Pair(v,se);if(r.options.keepSourceTokens&&(pe.srcToken=y),s){let R=l;vh.mapIncludes(r,R.items,v)&&i(P,"DUPLICATE_KEY","Map keys must be unique"),R.items.push(pe)}else{let R=new tl.YAMLMap(r.schema);R.flow=!0,R.items.push(pe);let N=(se??v).range;R.range=[v.range[0],N[1],N[2]],l.items.push(R)}f=se?se.range[2]:O.end}}let d=s?"}":"]",[p,...h]=n.end,m=f;if(p?.source===d)m=p.offset+p.source.length;else{let g=a[0].toUpperCase()+a.substring(1),y=u?`${g} must end with a ${d}`:`${g} in block collection must be sufficiently indented and end with a ${d}`;i(f,u?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1&&h.unshift(p)}if(h.length>0){let g=wh.resolveEnd(h,m,r.options.strict,i);g.comment&&(l.comment?l.comment+=`
|
|
72
|
+
`+g.comment:l.comment=g.comment),l.range=[n.offset,m,g.offset]}else l.range=[n.offset,m,m];return l}nl.resolveFlowCollection=bh});var sl=w(ol=>{"use strict";var kh=_(),Ch=T(),Sh=Ne(),Eh=Ie(),_h=Xc(),xh=Zc(),Ph=il();function Ao(t,e,r,n,i,o){let s=r.type==="block-map"?_h.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?xh.resolveBlockSeq(t,e,r,n,o):Ph.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 Rh(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(r.type==="block-seq"){let{anchor:d,newlineAfterProp:p}=n,h=d&&o?d.offset>o.offset?d:o:d??o;h&&(!p||p.offset<h.offset)&&i(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===Sh.YAMLMap.tagName&&a==="map"||s===Eh.YAMLSeq.tagName&&a==="seq")return Ao(t,e,r,i,s);let c=e.schema.tags.find(d=>d.tag===s&&d.collection===a);if(!c){let d=e.schema.knownTags[s];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),c=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Ao(t,e,r,i,s)}let l=Ao(t,e,r,i,s,c),u=c.resolve?.(l,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??l,f=kh.isNode(u)?u:new Ch.Scalar(u);return f.range=l.range,f.tag=s,c?.format&&(f.format=c.format),f}ol.composeCollection=Rh});var No=w(al=>{"use strict";var To=T();function Oh(t,e,r){let n=e.offset,i=Ah(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?To.Scalar.BLOCK_FOLDED:To.Scalar.BLOCK_LITERAL,s=e.source?Th(e.source):[],a=s.length;for(let m=s.length-1;m>=0;--m){let g=s[m][1];if(g===""||g==="\r")a=m;else break}if(a===0){let m=i.chomp==="+"&&s.length>0?`
|
|
73
|
+
`.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:m,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let m=0;m<a;++m){let[g,y]=s[m];if(y===""||y==="\r")i.indent===0&&g.length>c&&(c=g.length);else{g.length<c&&r(l+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(c=g.length),u=m,c===0&&!t.atRoot&&r(l,"BAD_INDENT","Block scalar values in collections must be indented");break}l+=g.length+y.length+1}for(let m=s.length-1;m>=a;--m)s[m][0].length>c&&(a=m+1);let f="",d="",p=!1;for(let m=0;m<u;++m)f+=s[m][0].slice(c)+`
|
|
74
|
+
`;for(let m=u;m<a;++m){let[g,y]=s[m];l+=g.length+y.length+1;let b=y[y.length-1]==="\r";if(b&&(y=y.slice(0,-1)),y&&g.length<c){let C=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;r(l-y.length-(b?2:1),"BAD_INDENT",C),g=""}o===To.Scalar.BLOCK_LITERAL?(f+=d+g.slice(c)+y,d=`
|
|
75
|
+
`):g.length>c||y[0]===" "?(d===" "?d=`
|
|
76
76
|
`:!p&&d===`
|
|
77
77
|
`&&(d=`
|
|
78
78
|
|
|
79
|
-
`),f+=d+g.slice(c)+
|
|
80
|
-
`,p=!0):
|
|
79
|
+
`),f+=d+g.slice(c)+y,d=`
|
|
80
|
+
`,p=!0):y===""?d===`
|
|
81
81
|
`?f+=`
|
|
82
82
|
`:d=`
|
|
83
|
-
`:(f+=d+
|
|
83
|
+
`:(f+=d+y,d=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let m=a;m<s.length;++m)f+=`
|
|
84
84
|
`+s[m][0].slice(c);f[f.length-1]!==`
|
|
85
85
|
`&&(f+=`
|
|
86
86
|
`);break;default:f+=`
|
|
87
|
-
`}let h=n+i.length+e.source.length;return{value:f,type:o,comment:i.comment,range:[n,h,h]}}function
|
|
87
|
+
`}let h=n+i.length+e.source.length;return{value:f,type:o,comment:i.comment,range:[n,h,h]}}function Ah({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],s=0,a="",c=-1;for(let d=1;d<i.length;++d){let p=i[d];if(!a&&(p==="-"||p==="+"))a=p;else{let h=Number(p);!s&&h?s=h:c===-1&&(c=t+d)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",f=i.length;for(let d=1;d<e.length;++d){let p=e[d];switch(p.type){case"space":l=!0;case"newline":f+=p.source.length;break;case"comment":r&&!l&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{let h=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",h);let m=p.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:o,indent:s,chomp:a,comment:u,length:f}}function Th(t){let e=t.split(/\n( *)/),r=e[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}al.resolveBlockScalar=Oh});var jo=w(ll=>{"use strict";var Io=T(),Nh=Ct();function Ih(t,e,r){let{offset:n,type:i,source:o,end:s}=t,a,c,l=(d,p,h)=>r(n+d,p,h);switch(i){case"scalar":a=Io.Scalar.PLAIN,c=jh(o,l);break;case"single-quoted-scalar":a=Io.Scalar.QUOTE_SINGLE,c=Lh(o,l);break;case"double-quoted-scalar":a=Io.Scalar.QUOTE_DOUBLE,c=$h(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,f=Nh.resolveEnd(s,u,e,r);return{value:c,type:a,comment:f.comment,range:[n,u,f.offset]}}function jh(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}`),cl(t)}function Lh(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),cl(t.slice(1,-1)).replace(/''/g,"'")}function cl(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
88
88
|
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
89
89
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let i=n[1],o=" ",s=e.lastIndex;for(r.lastIndex=s;n=r.exec(t);)n[1]===""?o===`
|
|
90
90
|
`?i+=o:o=`
|
|
91
|
-
`:(i+=o+n[1],o=" "),s=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,n=a.exec(t),i+o+(n?.[1]??"")}function
|
|
91
|
+
`:(i+=o+n[1],o=" "),s=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=s,n=a.exec(t),i+o+(n?.[1]??"")}function $h(t,e){let r="";for(let n=1;n<t.length-1;++n){let i=t[n];if(!(i==="\r"&&t[n+1]===`
|
|
92
92
|
`))if(i===`
|
|
93
|
-
`){let{fold:o,offset:s}=
|
|
93
|
+
`){let{fold:o,offset:s}=Wh(t,n);r+=o,n=s}else if(i==="\\"){let o=t[++n],s=Dh[o];if(s)r+=s;else if(o===`
|
|
94
94
|
`)for(o=t[n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="\r"&&t[n+1]===`
|
|
95
|
-
`)for(o=t[++n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=
|
|
95
|
+
`)for(o=t[++n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;r+=qh(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 o=n,s=t[n+1];for(;s===" "||s===" ";)s=t[++n+1];s!==`
|
|
96
96
|
`&&!(s==="\r"&&t[n+2]===`
|
|
97
|
-
`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function
|
|
97
|
+
`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Wh(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===`
|
|
98
98
|
`||n==="\r")&&!(n==="\r"&&t[e+2]!==`
|
|
99
99
|
`);)n===`
|
|
100
100
|
`&&(r+=`
|
|
101
|
-
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var
|
|
102
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
101
|
+
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var Dh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
102
|
+
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function qh(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}}ll.resolveFlowScalar=Ih});var dl=w(fl=>{"use strict";var tt=_(),ul=T(),Mh=No(),Fh=jo();function Bh(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Mh.resolveBlockScalar(t,e,n):Fh.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,f=>n(r,"TAG_RESOLVE_FAILED",f)):null,l;t.options.stringKeys&&t.atKey?l=t.schema[tt.SCALAR]:c?l=Uh(t.schema,i,c,r,n):e.type==="scalar"?l=Gh(t,i,e,n):l=t.schema[tt.SCALAR];let u;try{let f=l.resolve(i,d=>n(r??e,"TAG_RESOLVE_FAILED",d),t.options);u=tt.isScalar(f)?f:new ul.Scalar(f)}catch(f){let d=f instanceof Error?f.message:String(f);n(r??e,"TAG_RESOLVE_FAILED",d),u=new ul.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 Uh(t,e,r,n,i){if(r==="!")return t[tt.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[tt.SCALAR])}function Gh({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[tt.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[tt.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}fl.composeScalar=Bh});var pl=w(ml=>{"use strict";function Kh(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}ml.emptyScalarPosition=Kh});var wl=w($o=>{"use strict";var Hh=Mt(),zh=_(),Jh=sl(),hl=dl(),Yh=Ct(),Vh=pl(),Xh={composeNode:gl,composeEmptyNode:Lo};function gl(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=Qh(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=hl.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Jh.composeCollection(Xh,t,e,r,n),a&&(l.anchor=a.source.substring(1))}catch(f){let d=f instanceof Error?f.message:String(f);n(e,"RESOURCE_EXHAUSTION",d)}break;default:{let f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",f),u=!1}}return l??(l=Lo(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&&(!zh.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 Lo(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Vh.emptyScalarPosition(e,r,n),indent:-1,source:""},f=hl.composeScalar(t,u,a,l);return s&&(f.anchor=s.source.substring(1),f.anchor===""&&l(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),o&&(f.comment=o,f.range[2]=c),f}function Qh({options:t},{offset:e,source:r,end:n},i){let o=new Hh.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=Yh.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}$o.composeEmptyNode=Lo;$o.composeNode=gl});var bl=w(vl=>{"use strict";var Zh=rr(),yl=wl(),eg=Ct(),tg=sr();function rg(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Zh.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=tg.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?yl.composeNode(l,i,u,s):yl.composeEmptyNode(l,u.end,n,null,u,s);let f=c.contents.range[2],d=eg.resolveEnd(o,f,!1,s);return d.comment&&(c.comment=d.comment),c.range=[r,f,d.offset],c}vl.composeDoc=rg});var Do=w(Sl=>{"use strict";var ng=Nr("process"),ig=Ci(),og=rr(),ar=or(),kl=_(),sg=bl(),ag=Ct();function cr(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 Cl(t){let e="",r=!1,n=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":n?`
|
|
103
103
|
|
|
104
104
|
`:`
|
|
105
|
-
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var
|
|
106
|
-
${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(
|
|
105
|
+
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var Wo=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=cr(r);o?this.warnings.push(new ar.YAMLWarning(s,n,i)):this.errors.push(new ar.YAMLParseError(s,n,i))},this.directives=new ig.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=Cl(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment}
|
|
106
|
+
${n}`:n;else if(i||e.directives.docStart||!o)e.commentBefore=n;else if(kl.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];kl.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n}
|
|
107
107
|
${a}`:n}else{let s=o.commentBefore;o.commentBefore=s?`${n}
|
|
108
|
-
${s}`:n}}if(r){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
109
|
-
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new
|
|
108
|
+
${s}`:n}}if(r){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Cl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,r=!1,n=-1){for(let i of e)yield*this.next(i);yield*this.end(r,n)}*next(e){switch(ng.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(r,n,i)=>{let o=cr(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=sg.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 ar.YAMLParseError(cr(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 ar.YAMLParseError(cr(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=ag.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}
|
|
109
|
+
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new ar.YAMLParseError(cr(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 og.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}}};Sl.Composer=Wo});var xl=w(En=>{"use strict";var cg=No(),lg=jo(),ug=or(),El=Kt();function fg(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 ug.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return lg.resolveFlowScalar(t,e,n);case"block-scalar":return cg.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function dg(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=El.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:`
|
|
110
110
|
`}];switch(a[0]){case"|":case">":{let l=a.indexOf(`
|
|
111
111
|
`),u=a.substring(0,l),f=a.substring(l+1)+`
|
|
112
|
-
`,d=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return
|
|
113
|
-
`}),{type:"block-scalar",offset:o,indent:n,props:d,source:f}}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
|
|
112
|
+
`,d=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return _l(d,c)||d.push({type:"newline",offset:-1,indent:n,source:`
|
|
113
|
+
`}),{type:"block-scalar",offset:o,indent:n,props:d,source:f}}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 mg(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=El.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">":pg(t,c);break;case'"':qo(t,c,"double-quoted-scalar");break;case"'":qo(t,c,"single-quoted-scalar");break;default:qo(t,c,"scalar")}}function pg(t,e){let r=e.indexOf(`
|
|
114
114
|
`),n=e.substring(0,r),i=e.substring(r+1)+`
|
|
115
|
-
`;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}];
|
|
116
|
-
`});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
|
|
117
|
-
`};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})}}}
|
|
115
|
+
`;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}];_l(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:s,source:`
|
|
116
|
+
`});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 _l(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 qo(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:`
|
|
117
|
+
`};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})}}}En.createScalarToken=dg;En.resolveAsScalar=fg;En.setScalarValue=mg});var Rl=w(Pl=>{"use strict";var hg=t=>"type"in t?xn(t):_n(t);function xn(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=xn(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=_n(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=_n(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=_n(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 _n({start:t,key:e,sep:r,value:n}){let i="";for(let o of t)i+=o.source;if(e&&(i+=xn(e)),r)for(let o of r)i+=o.source;return n&&(i+=xn(n)),i}Pl.stringify=hg});var Nl=w(Tl=>{"use strict";var Mo=Symbol("break visit"),gg=Symbol("skip children"),Ol=Symbol("remove item");function rt(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Al(Object.freeze([]),t,e)}rt.BREAK=Mo;rt.SKIP=gg;rt.REMOVE=Ol;rt.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};rt.parentCollection=(t,e)=>{let r=rt.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 Al(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<o.items.length;++s){let a=Al(Object.freeze(t.concat([[i,s]])),o.items[s],r);if(typeof a=="number")s=a-1;else{if(a===Mo)return Mo;a===Ol&&(o.items.splice(s,1),s-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}Tl.visit=rt});var Pn=w(H=>{"use strict";var Fo=xl(),wg=Rl(),yg=Nl(),Bo="\uFEFF",Uo="",Go="",Ko="",vg=t=>!!t&&"items"in t,bg=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function kg(t){switch(t){case Bo:return"<BOM>";case Uo:return"<DOC>";case Go:return"<FLOW_END>";case Ko:return"<SCALAR>";default:return JSON.stringify(t)}}function Cg(t){switch(t){case Bo:return"byte-order-mark";case Uo:return"doc-mode";case Go:return"flow-error-end";case Ko:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
118
118
|
`:case`\r
|
|
119
|
-
`: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}
|
|
120
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
121
|
-
\r `),
|
|
119
|
+
`: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}H.createScalarToken=Fo.createScalarToken;H.resolveAsScalar=Fo.resolveAsScalar;H.setScalarValue=Fo.setScalarValue;H.stringify=wg.stringify;H.visit=yg.visit;H.BOM=Bo;H.DOCUMENT=Uo;H.FLOW_END=Go;H.SCALAR=Ko;H.isCollection=vg;H.isScalar=bg;H.prettyToken=kg;H.tokenType=Cg});var Jo=w(jl=>{"use strict";var lr=Pn();function le(t){switch(t){case void 0:case" ":case`
|
|
120
|
+
`:case"\r":case" ":return!0;default:return!1}}var Il=new Set("0123456789ABCDEFabcdef"),Sg=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Rn=new Set(",[]{}"),Eg=new Set(` ,[]{}
|
|
121
|
+
\r `),Ho=t=>!t||Eg.has(t),zo=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===`
|
|
122
122
|
`?!0:r==="\r"?this.buffer[e+1]===`
|
|
123
123
|
`:!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===`
|
|
124
124
|
`||!i&&!this.atEnd)return e+n+1}return r===`
|
|
125
|
-
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&
|
|
126
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
125
|
+
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&le(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
126
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===lr.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let o=e[n-1];if(o===" "||o===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let o=e[r-1];if(o===" "||o===" ")r-=1;else break}let i=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield lr.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&le(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!le(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===":")&&le(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Ho),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&le(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield lr.FLOW_END,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Ho),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||le(s)||s===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),r=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),i=n.indexOf(`
|
|
127
127
|
`,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=n.indexOf(`
|
|
128
|
-
`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>
|
|
128
|
+
`,o)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>le(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`
|
|
129
129
|
`:e=o,r=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
|
|
130
130
|
`)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(`
|
|
131
131
|
`,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===`
|
|
132
132
|
`;)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===`
|
|
133
|
-
`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield
|
|
133
|
+
`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield lr.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(le(o)||e&&Rn.has(o))break;r=n}else if(le(i)){let o=this.buffer[n+1];if(i==="\r"&&(o===`
|
|
134
134
|
`?(n+=1,i=`
|
|
135
|
-
`,o=this.buffer[n+1]):r=n),o==="#"||e&&
|
|
136
|
-
`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&
|
|
135
|
+
`,o=this.buffer[n+1]):r=n),o==="#"||e&&Rn.has(o))break;if(i===`
|
|
136
|
+
`){let s=this.continueScalar(n+1);if(s===-1)break;n=Math.max(n,s-2)}}else{if(e&&Rn.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield lr.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Ho),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let r=this.flowLevel>0,n=this.charAt(1);if(le(n)||r&&Rn.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(;!le(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(Sg.has(r))r=this.buffer[++e];else if(r==="%"&&Il.has(this.buffer[e+1])&&Il.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===`
|
|
137
137
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
138
|
-
`?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)}};
|
|
138
|
+
`?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)}};jl.Lexer=zo});var Vo=w(Ll=>{"use strict";var Yo=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r<n;){let o=r+n>>1;this.lineStarts[o]<e?r=o+1:n=o}if(this.lineStarts[r]===e)return{line:r+1,col:1};if(r===0)return{line:0,col:e};let i=this.lineStarts[r-1];return{line:r,col:e-i+1}}}};Ll.LineCounter=Yo});var Qo=w(Ml=>{"use strict";var _g=Nr("process"),$l=Pn(),xg=Jo();function je(t,e){for(let r=0;r<t.length;++r)if(t[r].type===e)return!0;return!1}function Wl(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function ql(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function On(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function St(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=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 An(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let r=0;r<e.length;++r)t.push(e[r])}function Dl(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!je(e.start,"explicit-key-ind")&&!je(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ql(e.value)?e.value.end?An(e.value.end,e.sep):e.value.end=e.sep:An(e.start,e.sep),delete e.sep)}var Xo=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new xg.Lexer,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,r))yield*this.next(n);r||(yield*this.end())}*next(e){if(this.source=e,_g.env.LOG_TOKENS&&console.log("|",$l.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=$l.tokenType(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)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"&&Dl(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&&Wl(i.start)===-1&&(r.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Wl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let r=On(this.peek(2)),n=St(r),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
|
139
139
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
140
|
-
`,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)){
|
|
140
|
+
`,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)){An(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&r.sep&&!r.value){let s=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":s.push(a);break;case"space":break;case"comment":c.indent>e.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(je(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(ql(r.key)&&!je(r.sep,"newline")){let s=St(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(je(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let s=St(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]}):je(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&&!je(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)){An(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||je(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=On(n),o=St(i);Dl(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(`
|
|
141
141
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
142
|
-
`,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=vn(e),n=ht(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=vn(e),n=ht(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())}}};Cl.Parser=jo});var Pl=w(er=>{"use strict";var Sl=Co(),tg=Gt(),Zt=Yt(),rg=vi(),ng=_(),ig=Lo(),El=$o();function _l(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new ig.LineCounter||null,prettyErrors:e}}function og(t,e={}){let{lineCounter:r,prettyErrors:n}=_l(e),i=new El.Parser(r?.addNewLine),o=new Sl.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(Zt.prettifyError(t,r)),a.warnings.forEach(Zt.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function xl(t,e={}){let{lineCounter:r,prettyErrors:n}=_l(e),i=new El.Parser(r?.addNewLine),o=new Sl.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 Zt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(Zt.prettifyError(t,r)),s.warnings.forEach(Zt.prettifyError(t,r))),s}function sg(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=xl(t,r);if(!i)return null;if(i.warnings.forEach(o=>rg.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 ag(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 ng.isDocument(t)&&!n?t.toString(r):new tg.Document(t,n,r).toString(r)}er.parse=sg;er.parseAllDocuments=og;er.parseDocument=xl;er.stringify=ag});var Oe=w(x=>{"use strict";var cg=Co(),lg=Gt(),ug=to(),Do=Yt(),fg=Ot(),Re=_(),dg=Se(),mg=T(),pg=_e(),hg=xe(),gg=wn(),wg=No(),yg=Lo(),vg=$o(),kn=Pl(),Rl=_t();x.Composer=cg.Composer;x.Document=lg.Document;x.Schema=ug.Schema;x.YAMLError=Do.YAMLError;x.YAMLParseError=Do.YAMLParseError;x.YAMLWarning=Do.YAMLWarning;x.Alias=fg.Alias;x.isAlias=Re.isAlias;x.isCollection=Re.isCollection;x.isDocument=Re.isDocument;x.isMap=Re.isMap;x.isNode=Re.isNode;x.isPair=Re.isPair;x.isScalar=Re.isScalar;x.isSeq=Re.isSeq;x.Pair=dg.Pair;x.Scalar=mg.Scalar;x.YAMLMap=pg.YAMLMap;x.YAMLSeq=hg.YAMLSeq;x.CST=gg;x.Lexer=wg.Lexer;x.LineCounter=yg.LineCounter;x.Parser=vg.Parser;x.parse=kn.parse;x.parseAllDocuments=kn.parseAllDocuments;x.parseDocument=kn.parseDocument;x.stringify=kn.stringify;x.visit=Rl.visit;x.visitAsync=Rl.visitAsync});import Ae from"path";function Eg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||Ae.posix.isAbsolute(r)||Ae.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be a project-relative path`);if(r===".")return[];let n=r.replaceAll("\\","/").split("/");if(n.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function rr(t){let e=Eg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function Dl(t,e="docs"){let r=t??e;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function gt(t,e,r=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||Ae.posix.isAbsolute(n)||Ae.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let i=n.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!r&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function pe(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Wl(t,e,r){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return n}function ql(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>Wo)throw new Error(`${e} exceeds ${Wo} characters`);let r=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?r+=1:t[n]==="*"&&(r+=1,t[n+1]==="*"&&(n+=1));if(r>qo)throw new Error(`${e} contains more than ${qo} wildcard tokens`);return t}function Il(t,e,r){if(t===void 0)return[...r];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>ql(n,e)))].sort((n,i)=>n.localeCompare(i,"en"))}function tr(t,e,r){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${r} must be a positive integer`);return n}function Ll(t,e,r){let n=tr(t,e,r);if(n>Math.floor(Number.MAX_SAFE_INTEGER/(1024*1024)))throw new Error(`${r} is too large to convert to bytes safely`);return n}function _g(t){if(t===void 0)return{...J,include:[...J.include],exclude:[...J.exclude]};let e=pe(t,"native.snapshot");return{include:Il(e.include,"native.snapshot.include",J.include),exclude:Il(e.exclude,"native.snapshot.exclude",J.exclude),max_files:tr(e.max_files,J.max_files,"native.snapshot.max_files"),max_total_bytes:tr(e.max_total_bytes,J.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:tr(e.max_duration_ms,J.max_duration_ms,"native.snapshot.max_duration_ms"),max_selection_records:tr(e.max_selection_records,J.max_selection_records,"native.snapshot.max_selection_records")}}function xg(t){if(t===void 0)return;let e=pe(t,"native.pending_root_move"),r=e.id,n=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=pe(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:u}}return{id:r,fromArtifactRoot:rr(n),toArtifactRoot:rr(i),stage:o,...s?{cleanup:s}:{}}}function Pg(t){if(t===void 0)return;let e=pe(t,"native.finish");if(e.pull_request===void 0)return{};let r=pe(e.pull_request,"native.finish.pull_request");if(r.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(r.command)||r.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(r.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let n=r.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(Ae.posix.isAbsolute(n[0])||Ae.win32.isAbsolute(n[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=r.timeout_ms??bg;if(!Number.isSafeInteger(i)||i<1||i>Nl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Nl}`);return{pull_request:{provider:"repository-command",command:n,timeout_ms:i}}}function Rg(t,e={}){let r=pe(t,"native"),n=r.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let i=r.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=r.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=r.max_verify_failures??jl;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=r.document_writes??"allow";if(a!=="allow"&&a!=="revert")throw new Error("native.document_writes must be allow or revert");let c=xg(r.pending_root_move),l=Pg(r.finish);return{artifact_root:rr(n),language:Wl(r.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,...a==="revert"?{document_writes:a}:{},snapshot:_g(r.snapshot),...l?{finish:l}:{},...c?{pending_root_move:c}:{}}}function Og(t){let e=pe(t,"classic"),r=e.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");let o=e.document_evidence??"neutral";if(o!=="neutral"&&o!=="strict")throw new Error("classic.document_evidence must be neutral or strict");return{artifact_layout:Dl(e.artifact_layout),language:Wl(e.language,"zh-CN","classic.language"),context_compression:r,review_mode:n,auto_transition:i,...o==="strict"?{document_evidence:o}:{}}}function Ag(t){let r=pe(t,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((n,i)=>gt(n,`hook.allow_paths[${i}]`)))]}}function Tg(t){if(t===void 0)return{...Cn};let e=pe(t,"memory"),r=e.learning??Cn.learning,n=e.retrieval??Cn.retrieval;if(typeof r!="boolean")throw new Error("memory.learning must be true or false");if(typeof n!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:r,retrieval:n}}function Fo(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function Ng(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||r.includes("\\")||r.includes("\0")||Ae.posix.isAbsolute(r)||Ae.win32.isAbsolute(r)||r.startsWith("~")||r.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!r.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(r.length>Ol)throw new Error(`${e} exceeds ${Ol} characters`);let n=0;for(let i=0;i<r.length;i+=1)r[i]==="?"?n+=1:r[i]==="*"&&(n+=1,r[i+1]==="*"&&(i+=1));if(n>Al)throw new Error(`${e} contains more than ${Al} wildcard tokens`);return r}function Ig(t){let e=Fo(t,"knowledge.local"),r=e.include??[];if(!Array.isArray(r))throw new Error("knowledge.local.include must be an array");let n={include:[...new Set(r.map((i,o)=>Ng(i,`knowledge.local.include[${o}]`)))],max_file_mb:Ll(e.max_file_mb,Tl.max_file_mb,"knowledge.local.max_file_mb"),max_total_mb:Ll(e.max_total_mb,Tl.max_total_mb,"knowledge.local.max_total_mb")};if(n.max_file_mb>n.max_total_mb)throw new Error("knowledge.local.max_file_mb must not exceed max_total_mb");return n}function Lg(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let r=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),n=r==="localhost"||r==="127.0.0.1"||r==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&n))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function jg(t){let e=Fo(t,"knowledge.remote"),r=Lg(e.endpoint),n=e.token_env;if(n!==void 0&&(typeof n!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(n)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:r,...n===void 0?{}:{token_env:n},...i===void 0?{}:{scope:i},timeout_ms:o}}function $g(t){if(t===void 0)return{...$l};let e=Fo(t,"knowledge"),r=e.provider??"local";if(r!=="local"&&r!=="remote")throw new Error("knowledge.provider must be local or remote");let n=e.local===void 0?void 0:Ig(e.local);if(r==="local")return{provider:r,...n?{local:n}:{}};let i=e.remote===void 0?void 0:jg(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:r,...n?{local:n}:{},remote:i}}function Dg(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function Wg(t,e,r,n,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let f=[...new Set(u)];if(!f.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(f.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:f,ambient_resume:s,...e?{hook:e}:{},memory:r,knowledge:n,...i?{native:i}:{},...o?{classic:o}:{}}}function Te(t,e={}){let r=(0,Mo.parseDocument)(t,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let n=r.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=n,o=Dg(i.ambient_resume),s=i.hook===void 0?void 0:Ag(i.hook),a=Tg(i.memory),c=$g(i.knowledge),l=i.native===void 0?void 0:Rg(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=i.classic===void 0?void 0:Og(i.classic),f=Wg(i,s,a,c,l,u,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:f,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function Bo(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...Cn},knowledge:{...$l},native:{artifact_root:rr(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:jl,snapshot:{...J,include:[...J.include],exclude:[...J.exclude]}}}}var Mo,Ye,Wo,qo,Ol,Al,jl,Cn,Tl,$l,bg,Nl,kg,Cg,Sg,J,he=A(()=>{"use strict";Mo=Fe(Oe(),1),Ye=Number.MAX_SAFE_INTEGER,Wo=1024,qo=64,Ol=1024,Al=64,jl=5,Cn={learning:!0,retrieval:!0},Tl={include:[],max_file_mb:1,max_total_mb:32},$l={provider:"local"},bg=12e4,Nl=6e5,kg=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Cg=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],Sg=[...kg,...Cg].sort((t,e)=>t.localeCompare(e,"en")),J={include:["**/*"],exclude:[...Sg],max_files:1e4,max_total_bytes:1024*1024*1024,max_duration_ms:6e4,max_selection_records:2e4}});function Ne(t){return t!==0&&t!==0n&&t!=="0"}function Ml(t,e){return Ne(t.dev)&&Ne(e.dev)&&Ne(t.ino)&&Ne(e.ino)}function Ie(t,e){let r=Ne(t.dev)&&Ne(e.dev);if(r&&t.dev!==e.dev)return!1;let n=Ne(t.ino)&&Ne(e.ino);return n&&t.ino!==e.ino?!1:r&&n?!0:t.birthtime===e.birthtime}var Sn=A(()=>{"use strict"});import{constants as En,promises as Je}from"fs";function Uo(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function Fl(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function nr(t){return{dev:t.dev,ino:t.ino,birthtime:Uo(t)}}function _n(t,e){let r=nr(t),n=nr(e);return Ml(r,n)?Ie(r,n):Ie(r,n)&&Uo(t)===Uo(e)&&Fl(t)===Fl(e)&&t.size===e.size}async function xn(t,e,r={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=r.label??"file",i=r.bigint===!0,o=await Je.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new Le("not-regular-file",`${n} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new Le("too-large",`${n} exceeds ${e} bytes`);let s=await Je.realpath(t);await r.verify?.("pre-open",{realPath:s,identity:nr(o)});let a=process.platform==="win32"?En.O_RDONLY:En.O_RDONLY|En.O_NOFOLLOW|En.O_NONBLOCK,c;try{c=await Je.open(t,a)}catch(l){throw l.code==="ELOOP"?new Le("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:i}),Je.lstat(t,{bigint:i}),Je.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!_n(o,l)||!_n(o,u))throw new Le("changed",`${n} changed while opening`);await r.verify?.("post-open",{realPath:f,identity:nr(l)}),await r.hooks?.afterOpen?.();let d=[],p=0,h=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-p,{bytesRead:k}=await c.read(h,0,Math.min(h.length,b),null);if(k===0)break;if(p+=k,p>e)throw new Le("too-large",`${n} exceeds ${e} bytes`);d.push(Buffer.from(h.subarray(0,k)))}await r.hooks?.beforeFinalCheck?.();let[m,g,v]=await Promise.all([c.stat({bigint:i}),Je.lstat(t,{bigint:i}),Je.realpath(t)]);if(!g.isFile()||g.isSymbolicLink()||v!==s||!_n(o,m)||!_n(o,g))throw new Le("changed",`${n} changed while reading`);return await r.verify?.("post-read",{realPath:v,identity:nr(m)}),{bytes:Buffer.concat(d,p),stat:m,realPath:v}}finally{await c.close()}}var Le,Ko=A(()=>{"use strict";Sn();Le=class extends Error{reason;constructor(e,r,n){super(r,n),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Pn}from"fs";import je from"path";function qg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Go(t,e){let r=je.relative(t,e);return r===""||!je.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${je.sep}`)}async function Bl(t,e){let r=je.resolve(t),n=await Pn.lstat(r);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Pn.realpath(r)}async function Ul(t,e,r,n){let i=t;for(let o=0;o<r.length;o++){i=je.join(i,r[o]);let s;try{s=await Pn.lstat(i)}catch(u){if(qg(u))return{exists:!1,kind:"missing"};throw u}let a=je.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${a}`);let c=o===r.length-1;if(!c&&!s.isDirectory())throw new Error(`${n.label} ancestor ${a} must be a real directory`);if(c&&(n.expected==="file"&&!s.isFile()||n.expected==="directory"&&!s.isDirectory()||n.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await Pn.realpath(i);if(!Go(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function D(t,e,r){let n=gt(e,r.label),i=je.resolve(t),o=await Bl(i,r.label),s=n.split("/"),a=je.resolve(i,...s);if(!Go(i,a))throw new Error(`${r.label} must stay inside the project root`);let c=await Ul(i,o,s,r);return{projectRoot:i,target:a,relative:n,exists:c.exists,kind:c.kind}}async function j(t,e,r,n){let i=await D(t,e,{label:n.label,expected:"file"});if(!i.exists){let s=new Error(`${n.label} does not exist`);throw s.code="ENOENT",s}let o=await Bl(i.projectRoot,n.label);return xn(i.target,r,{...n,verify:async(s,a)=>{if(!Go(o,a.realPath))throw new Error(`${n.label} resolves outside the project root`);await Ul(i.projectRoot,o,i.relative.split("/"),{label:n.label,expected:"file"})}})}var V=A(()=>{"use strict";Ko();he()});import{createHash as Mg}from"crypto";function Fg(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Ve(t,e={}){return(await Rn(t,e)).document}async function Bg(t){try{return(await j(t,ir,Ye,{label:ir})).bytes}catch(e){if(Fg(e))return null;throw e}}function Ug(t){return t?{exists:!0,sha256:Mg("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Rn(t,e={}){let r=await Bg(t);return{document:r?Te(r.toString("utf8"),e):null,identity:Ug(r)}}async function Ho(t){return(await Ve(t))?.config??null}var ir,$e=A(()=>{"use strict";he();V();ir=".comet/config.yaml"});import{promises as Yo}from"node:fs";async function Jo(t,e){let r;for(let n=0;n<=zo.length;n+=1)try{return await t()}catch(i){r=i;let o=i.code;if(n===zo.length||!Kg.has(o??""))throw i;await new Promise(s=>setTimeout(s,zo[n]))}throw r}async function Kl(t,e){await Jo(()=>Yo.rename(t,e),`rename ${e}`)}async function On(t){await Jo(()=>Yo.unlink(t),`unlink ${t}`)}async function Gl(t,e){await Jo(()=>Yo.link(t,e),`link ${e}`)}var Kg,zo,Vo=A(()=>{"use strict";Kg=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),zo=[50,100,200]});import{randomUUID as Gg}from"crypto";import{constants as Hg,promises as I}from"fs";import W from"path";async function Xo(t,e){try{return await Gl(t,e),{linked:!0}}catch(r){let n=r.code;if(n!=="ENOTSUP"&&n!=="EOPNOTSUPP")throw r}return await I.copyFile(t,e,Hg.COPYFILE_EXCL),{linked:!1}}function Xe(t,e){let r=W.relative(t,e);return r===""||!W.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${W.sep}`)}function An(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function zg(t,e){return Ie(t,An(e))}function Tn(t,e){return Ie(An(t),An(e))}function Hl(t,e){return Tn(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Nn(t){let e=await I.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await I.realpath(t),...An(e)}}async function ge(t){for(let e of t){let r=await I.lstat(e.path);if(!r.isDirectory()||r.isSymbolicLink()||!zg(e,r)||await I.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function Yg(t,e,r){let[n,i]=await Promise.all([I.lstat(t),I.realpath(t),ge(r)]);if(!n.isFile()||n.isSymbolicLink()||!Tn(n,e)||!Xe(r[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return n}async function Jg(t,e){let r=W.resolve(t),n=W.resolve(e);if(!Xe(r,n))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await Nn(r)],o=W.relative(r,n).split(W.sep).filter(Boolean),s=r;for(let a of o){await ge(i),s=W.join(s,a);try{await I.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Nn(s);if(!Xe(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await ge(i),i}async function Vg(t,e){let r=W.resolve(t),n=W.resolve(e);if(!Xe(r,n))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await Nn(r)],o=W.relative(r,n).split(W.sep).filter(Boolean),s=r;for(let a of o){s=W.join(s,a);try{let c=await Nn(s);if(!Xe(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await ge(i),i}async function zl(t){let e;try{e=await I.open(t,"r"),await e.sync()}catch(r){let n=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw r}finally{await e?.close()}}async function Xg(t,e,r){let n=W.dirname(t),i=await Jg(r.containedRoot,n),o=W.join(n,`.${W.basename(t)}.${Gg()}.tmp`),s,a,c;try{await r.beforeTemporaryOpen?.(),s=await I.open(o,"wx"),a=await s.stat();let[l,u]=await Promise.all([I.lstat(o),I.realpath(o)]);if(await ge(i),!l.isFile()||l.isSymbolicLink()||!Tn(a,l)||!Xe(i[0].realPath,u))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!Tn(a,c))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await r.afterTemporaryClose?.(),!c)throw new Error("Contained atomic write temporary file was not written");c=await Yg(o,c,i),await r.beforeCommit?.(),await ge(i);let f=await I.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!c||!Hl(f,c))throw new Error("Contained atomic write temporary file changed before commit");r.exclusive?(await Xo(o,t),await I.unlink(o)):await Kl(o,t),await zl(n)}catch(l){await s?.close();try{await ge(i),await I.rm(o,{force:!0})}catch{}throw l}}async function X(t,e,r){await Xg(t,e,r)}async function or(t,e){let r=W.dirname(t),n=await Vg(e.containedRoot,r);if(!n)return!1;let i,o;try{i=await I.lstat(t),o=await I.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!Xe(n[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await ge(n);let[s,a]=await Promise.all([I.lstat(t),I.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!Hl(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await On(t),await ge(n),await zl(r),!0}var se=A(()=>{"use strict";Vo();Sn()});var Ak,Qo=A(()=>{"use strict";se();$e();V();Ak=16*1024});var In=A(()=>{"use strict";se();he();$e();V();Qo()});import F from"path";function su(t,e){let r=F.relative(t,e);return r===""||!F.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${F.sep}`)}function pw(t,e){let r=F.isAbsolute(e)?F.resolve(e):F.resolve(t,e),n=F.relative(F.resolve(t),r);return n===""||F.isAbsolute(n)||n===".."||n.startsWith(`..${F.sep}`)?null:n.replaceAll("\\","/")}function au(t){return process.platform==="win32"?t.toLowerCase():t}async function os(t,e,r=[]){let n=F.isAbsolute(e)?F.resolve(e):F.resolve(t,e),i=F.resolve(t);if(!su(i,n)||r.some(c=>su(F.resolve(c),n)))return null;let o=pw(t,e);if(!o)return null;let a=(await mw(t)).allow_paths.find(c=>{let l=au(o),u=au(c);return l===u||l.startsWith(`${u}/`)});return a?`${o} (configured Hook allow path: ${a})`:null}var mw,ss=A(()=>{"use strict";Et();$e();mw=ye("hookWritePolicy",async t=>(await Ho(t))?.hook??{allow_paths:[]})});var Dn=A(()=>{"use strict"});var bu=A(()=>{"use strict"});var us=A(()=>{"use strict";Dn()});var ku=A(()=>{"use strict";Dn();us()});function Fw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function Bw(t){let e=(0,Cu.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let r=e.toJS();if(r==null)return{};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid global Comet config: root must be a mapping");return r}function Eu(t){if(t.native?.pending_root_move)throw new Error("Global Comet config cannot contain native.pending_root_move");let e=t.native?(({pending_root_move:r,...n})=>n)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function Uw(t){let e=Te(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return Eu(e)}function Kw(t){let e=Te(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let r=e.native?"native":"classic",n=e.native?.language??e.classic?.language??"en",i=Bo(e.native?.artifact_root??"docs",n);return{schema:"comet.global.v1",default_workflow:r,workflows:[r],ambient_resume:e.ambient_resume,...e.native?{native:{...i.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function _u(t){let e=Bw(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return Kw(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return Uw(e)}async function fs(t){try{let e=await j(t,Su,Ye,{label:"global Comet config"});return _u(e.bytes.toString("utf8"))}catch(e){if(Fw(e))return null;throw e}}var Cu,Su,ds=A(()=>{"use strict";Cu=Fe(Oe(),1);se();he();V();Su=".comet/config.yaml"});var BC,xu=A(()=>{"use strict";se();V();BC=4*1024*1024});import Gw from"node:path";function ms(t){return Gw.join(t,".comet","current-change.json")}function Hw(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Pu(t){return t===null||typeof t=="string"}function zw(t){let e;try{e=JSON.parse(t)}catch(r){throw new Error(`current change selection contains invalid JSON: ${r instanceof Error?r.message:String(r)}`,{cause:r})}if(!Hw(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Pu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Wn,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Wn)throw new Error(`current change selection schema must be ${Wn}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Pu(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function ps(t){let e;try{let n=ms(t),{bytes:i}=await xn(n,Ru,{label:"current change selection"});e=i.toString("utf8")}catch(n){if(n.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${n instanceof Error?n.message:String(n)}`,{cause:n})}return{status:"selected",...zw(e)}}var Wn,Ru,hs=A(()=>{"use strict";Ko();Wn="comet.selection.v2",Ru=16*1024});var Ou=A(()=>{"use strict";Dn();se();bu();ku();he();ds();V();$e();In();xu();ss();hs();Qo();us()});import{TextDecoder as Xw}from"util";function Au(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Qw(t,e){try{return new Xw("utf-8",{fatal:!0}).decode(t.bytes)}catch(r){throw new Error(`${e} is not valid UTF-8`,{cause:r})}}async function gs(t,e,r,n,i={}){try{let o=await j(t,e,r,{label:n,hooks:i.hooks});return{result:o,text:Qw(o,n)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function Tu(t,e,r,n,i={}){return(await gs(t,e,r,n,i))?.text??null}async function Nu(t,e,r,n,i,o={}){if(Buffer.byteLength(r,"utf8")>n)throw new Error(`${i} exceeds ${n} bytes`);let s=await gs(t,e,n,i),a=await D(t,e,{label:i,expected:"file"});await X(a.target,r,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await gs(t,e,n,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!Ie(Au(s.result.stat),Au(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function Iu(t,e,r,n={}){let i=await D(t,e,{label:r,expected:"file"});return i.exists?or(i.target,{containedRoot:i.projectRoot,beforeRemove:n.beforeRemove}):!1}var Lu=A(()=>{"use strict";Ou();Sn()});var Wu={};Uf(Wu,{RUN_STATE_FILE:()=>qn,applyRunStateToDocument:()=>$u,readRunState:()=>ws,removeRunState:()=>ys,runStateFromDocument:()=>bt,writeRunState:()=>Mn});import Zw from"path";function fr(t,e){let r=t[e];if(typeof r!="string"||r.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return r}function ur(t,e){let r=fr(t,e);if(Zw.isAbsolute(r)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return r}function ey(t){let e=t.run_retries??"{}",r;try{r=typeof e=="string"?JSON.parse(e):e}catch(n){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:n})}if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let n of Object.values(r))if(!Number.isInteger(n)||Number(n)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return r}function bt(t){if(!t.run_id)return null;let e=fr(t,"run_id"),r=fr(t,"skill"),n=fr(t,"skill_version"),i=fr(t,"skill_hash"),o=ur(t,"pending_ref"),s=ur(t,"trajectory_ref"),a=ur(t,"context_ref"),c=ur(t,"artifacts_ref"),l=ur(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:r,skillVersion:n,skillHash:i,orchestration:t.orchestration,currentStep:ju(t,"current_step"),iteration:u,pending:ju(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:ey(t)}}function $u(t,e){e?t.run_id=e.runId:delete t.run_id}function ty(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function ry(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return bt(e)}async function ws(t,e={}){let r=await Tu(t,qn,Du,"Run state",e);if(r===null)return null;let n=JSON.parse(r);return ry(n)}async function Mn(t,e,r={}){await Nu(t,qn,JSON.stringify(ty(e),null,2),Du,"Run state",r)}async function ys(t,e={}){await Iu(t,qn,"Run state",e)}var ju,qn,Du,Fn=A(()=>{"use strict";Lu();ju=(t,e)=>{let r=t[e];return r==null?null:String(r)};qn=".comet/run-state.json",Du=Number.MAX_SAFE_INTEGER});import{promises as Jn}from"fs";import z from"path";function Ds(t){return t.charCodeAt(0)===65279?t.slice(1):t}Et();async function Ms(t=2e3){return process.stdin.isTTY?{text:""}:!Number.isFinite(t)||t<1?{text:null}:process.stdin.readableEnded?{text:""}:await new Promise(e=>{let r=!1,n=0,i=[],o=setTimeout(()=>s({text:null}),Math.ceil(t)),s=f=>{r||(r=!0,clearTimeout(o),process.stdin.removeListener("data",a),process.stdin.removeListener("end",c),process.stdin.removeListener("close",l),process.stdin.removeListener("error",u),process.stdin.pause(),e(f))},a=f=>{let d=Buffer.isBuffer(f)?f:Buffer.from(f),p=1048576-n;if(p<=0){s({text:null});return}let h=d.subarray(0,p);i.push(h),n+=h.length,d.length>h.length&&s({text:null})},c=()=>s({text:Buffer.concat(i,n).toString("utf8")}),l=()=>{process.stdin.readableEnded||s({text:null})},u=()=>s({text:null});process.stdin.on("data",a),process.stdin.once("end",c),process.stdin.once("close",l),process.stdin.once("error",u),o.unref(),process.stdin.resume()})}import{promises as tw}from"fs";import H from"path";import{promises as Gf}from"fs";async function ri(t){try{return await Gf.access(t),!0}catch(e){if(Hf(e))return!1;throw e}}function Hf(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}he();$e();In();V();var wt=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},Vl=".comet/config.yaml";function rw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function nw(t){await D(t,Vl,{label:Vl,expected:"file"})}function es(t,e){let r=H.resolve(t),n=e==="docs"?H.join(r,"docs"):r,i=H.join(n,"openspec"),o=H.join(r,"docs","superpowers");return{projectRoot:r,artifactLayout:e,openSpecBase:n,openSpecRoot:i,changesDir:H.join(i,"changes"),archiveDir:H.join(i,"changes","archive"),specsDir:H.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:H.join(o,"specs"),superpowersPlansDir:H.join(o,"plans"),superpowersReportsDir:H.join(o,"reports")}}async function Ql(t){await nw(t);let e=await Ve(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new wt;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new wt("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function Zl(t,e){return es(t,e??await Ql(t))}async function iw(t){try{return await tw.lstat(t),!0}catch(e){if(rw(e))return!1;throw e}}async function ow(t,e){let r=await Zl(t,e),n=r.artifactLayout==="legacy"?"docs":"legacy",i=es(t,n).openSpecRoot,[o,s]=await Promise.all([D(r.projectRoot,L(r.projectRoot,r.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),iw(i)]),a=o.exists;return{paths:r,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function sw(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let r of e){let n=L(t.projectRoot,r);await D(t.projectRoot,n,{label:`Classic managed physical path ${n}`,expected:"directory"})}}async function De(t,e){let r=await ow(t,e);if(await sw(r.paths),!r.configuredRootExists){let n=L(r.paths.projectRoot,r.paths.openSpecRoot),i=L(r.paths.projectRoot,r.alternateRoot);throw new wt(`Configured Classic OpenSpec root is missing: ${n} (alternate ${i} is ${r.alternateRootExists?"present":"missing"})`)}return r.paths}async function ts(t,e){let r=H.join(H.resolve(t),".comet","classic-root-move.json");if(await ri(r))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let n=await De(t,e);if(!await ri(n.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${L(n.projectRoot,n.openSpecRoot)}`);return n}function L(t,e){return H.relative(H.resolve(t),e).replaceAll("\\","/")}import{promises as lw}from"fs";import ar from"path";se();he();V();import sr from"path";var rs=Number.MAX_SAFE_INTEGER;function eu(t,e,r){let n=sr.resolve(t),i=sr.isAbsolute(e)?sr.resolve(e):sr.resolve(n,e),o=sr.relative(n,i).replaceAll("\\","/");return{root:n,relative:gt(o,r),target:i}}async function We(t,e,r){let n=eu(t,e,r.label);return D(n.root,n.relative,r)}async function Qe(t,e,r){return(await We(t,e,{label:r.label,expected:r.expected??"any"})).exists}async function tu(t,e,r,n){return await Qe(t,e,{label:r,expected:"file"})?(await ru(t,e,{label:r,hooks:n})).byteLength>0:!1}async function qe(t,e,r){return(await ru(t,e,r)).toString("utf8")}async function ru(t,e,r){let n=eu(t,e,r.label);return(await j(n.root,n.relative,r.maxBytes??rs,{label:r.label,hooks:r.hooks})).bytes}function jn(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
|
|
143
|
-
Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function
|
|
144
|
-
`)}}function vu(t){try{let e=JSON.parse(t);return Number.isSafeInteger(e.pid)&&Number(e.pid)>0&&typeof e.nonce=="string"&&e.nonce.length>0&&typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)&&(e.hostname===void 0||typeof e.hostname=="string"&&e.hostname.length>0)&&(e.processIdentity===void 0||typeof e.processIdentity=="string"&&e.processIdentity.length>0)?{pid:Number(e.pid),nonce:e.nonce,createdAt:e.createdAt,...e.hostname===void 0?{}:{hostname:e.hostname},...e.processIdentity===void 0?{}:{processIdentity:e.processIdentity}}:null}catch{return null}}V();var Un=Fe(Oe(),1);se();V();Fn();var ks=["full","hotfix","tweak"],qu=1,Fu=["open","design","build","verify","archive"],ny=["en","zh-CN"],iy=["off","beta"],oy=["subagent-driven-development","executing-plans","direct","autonomous"],sy=["plan-ready"],ay=["confirmed"],cy=["tdd","direct"],ly=["off","standard","thorough"],uy=["current","branch","worktree"],fy=["light","full"],dy=["pending","pass","fail"],my=["pending","handled"],py=["pending","confirmed"],tt=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","check_epoch","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],dr=["run_id"],Bu=new Set([...tt,...dr]),hy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function vs(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function kt(t,e){let r=t[e];if(r==null||r==="")return null;if(typeof r!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return r}function B(t,e,r,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!r.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${r.join(", ")}${n?" or null":""}`);return i}function bs(t,e,r=!0){let n=t[e];if(n==null||n===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof n!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return n}function Mu(t,e,r=0){let n=t[e];if(n==null||n==="")return r;if(typeof n!="number"||!Number.isSafeInteger(n)||n<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return n}function Bn(t,e){let r=kt(t,e);if(r===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return r}function gy(t,e){let r=kt(t,e);if(r!==null&&!/^[a-f0-9]{64}$/u.test(r))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return r}function wy(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==qu)throw new Error(`Invalid Classic state: classic_migration must be ${qu}`);return e}function yy(t){if(!tt.some(r=>vs(t,r)))return null;for(let r of hy)if(!vs(t,r))return null;return{workflow:B(t,"workflow",ks,!1),language:B(t,"language",ny),phase:B(t,"phase",Fu,!1),contextCompression:B(t,"context_compression",iy),buildMode:B(t,"build_mode",oy),buildPause:B(t,"build_pause",sy),subagentDispatch:B(t,"subagent_dispatch",ay),tddMode:B(t,"tdd_mode",cy),reviewMode:B(t,"review_mode",ly),isolation:B(t,"isolation",uy),boundBranch:kt(t,"bound_branch"),verifyMode:B(t,"verify_mode",fy),autoTransition:bs(t,"auto_transition"),baseRef:kt(t,"base_ref"),designDoc:Bn(t,"design_doc"),plan:Bn(t,"plan"),verifyResult:B(t,"verify_result",dy,!1),verifyFailures:Mu(t,"verify_failures"),...vs(t,"check_epoch")?{checkEpoch:Mu(t,"check_epoch")}:{},verificationReport:Bn(t,"verification_report"),branchStatus:B(t,"branch_status",my),createdAt:kt(t,"created_at"),verifiedAt:kt(t,"verified_at"),archiveConfirmation:B(t,"archive_confirmation",py),archived:bs(t,"archived",!1),directOverride:bs(t,"direct_override"),handoffContext:Bn(t,"handoff_context"),handoffHash:gy(t,"handoff_hash"),classicProfile:B(t,"classic_profile",ks),classicMigration:wy(t)}}function Uu(t,e){let r=e??null;if(r===null&&e===void 0&&t.run_id&&t.skill)try{r=bt(t)}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:n})}return{classic:yy(t),run:r,unknownKeys:Object.keys(t).filter(n=>!Bu.has(n))}}function Ku(t){let e=t.workflow,r=t.phase,n=t.archived,i=t.design_doc;return{workflow:typeof e=="string"&&ks.includes(e)?e:null,phase:typeof r=="string"&&Fu.includes(r)?r:null,archived:n===!0,designDoc:typeof i=="string"&&i!==""?i:null,unknownKeys:Object.keys(t).filter(o=>!Bu.has(o))}}Fn();var Gu=new vy,Hu=".comet-state-transaction.json";async function Kn(t,e){let r=rt.resolve(t);return Gu.getStore()===r?e():(await D(r,".comet-state.lock",{label:"Classic state lock",expected:"file"}),yu(rt.join(r,".comet-state.lock"),()=>Gu.run(r,async()=>(await ky(r),e()))))}async function zu(t,e){try{return(await j(t,e,Number.MAX_SAFE_INTEGER,{label:"Classic state transaction"})).bytes.toString("utf8")}catch(r){if(r.code==="ENOENT")return null;throw r}}function by(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid Classic transaction Run");let e=t,r=bt({run_id:e.runId,skill:e.skill,skill_version:e.skillVersion,skill_hash:e.skillHash,orchestration:e.orchestration,current_step:e.currentStep,iteration:e.iteration,pending:e.pending,pending_ref:e.pendingRef,trajectory_ref:e.trajectoryRef,context_ref:e.contextRef,artifacts_ref:e.artifactsRef,checkpoint_ref:e.checkpointRef,run_status:e.status,run_retries:e.retries});if(!r)throw new Error("Invalid Classic transaction Run identity");return r}async function ky(t){let e=await zu(t,Hu);if(e===null)return;let r=JSON.parse(e);if(!r||r.schema!=="comet.classic.state-transaction.v1"||r.beforeYaml!==null&&typeof r.beforeYaml!="string"||typeof r.afterYaml!="string")throw new Error("Invalid Classic state transaction");let n=await zu(t,".comet.yaml");if(n!==r.beforeYaml&&n!==r.afterYaml)throw new Error("Classic state transaction conflicts with current YAML; preserve files for recovery");let i=by(n===r.afterYaml?r.afterRun:r.beforeRun);i?await Mn(t,i):await ys(t),await or(rt.join(t,Hu),{containedRoot:t})}function mr(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function Cy(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let r of e)t.delete(r)}function Sy(t){let e=!1;for(let r of["build_command","verify_command"])t.has(r)&&(t.delete(r),e=!0);return e}async function Yu(t){let e;try{e=(await j(rt.dirname(t),rt.basename(t),Number.MAX_SAFE_INTEGER,{label:"Classic state document"})).bytes.toString("utf8")}catch(n){if(n.code!=="ENOENT")throw n;return new Un.Document({})}let r=(0,Un.parseDocument)(e);if(r.errors.length>0)throw new Error(`Invalid Classic state document: ${r.errors[0].message}`);return mr(r),r}async function pr(t,e={}){return Kn(t,()=>Ey(t,e))}async function Ey(t,e){let r=e.migrate!==!1,n=rt.join(t,".comet.yaml"),i=await Yu(n),o=mr(i),s=Sy(i);s&&(o=mr(i));let a=await ws(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(Fn(),Wu));a=c(o),a&&r&&(await Mn(t,a),Cy(i),s=!0)}return s&&r&&await X(n,i.toString(),{containedRoot:t}),Uu(mr(i),a)}async function Ju(t){let e=await Yu(rt.join(t,".comet.yaml"));return Ku(mr(e))}se();V();function xy(t){try{let e=Xu("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim();return e&&e!=="HEAD"?e:null}catch{return null}}var Py=ti("liveGitBranch",t=>xy(t));function Ry(t){try{return Xu("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim()==="true"}catch{return!1}}var Oy=ti("isGitWorkTree",t=>Ry(t)),Ay=["current","branch","worktree"];function Zu(t){return Ay.includes(t)}function Ty(t){return Zu(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function hr(t,e){return e.heal?Kn(t,()=>Vu(t,e)):Vu(t,e)}async function Vu(t,e){let r=Qu.join(t,".comet.yaml"),n=(0,Cs.parseDocument)(await _y.readFile(r,"utf8"),{uniqueKeys:!1});if(n.errors.length>0)throw new Error(`Invalid .comet.yaml: ${n.errors[0].message}`);let i=n.toJS()??{},o=typeof i.isolation=="string"?i.isolation:null,s=typeof i.bound_branch=="string"&&i.bound_branch!==""?i.bound_branch:null,a=Zu(o),c=Py(e.cwd),l=a&&s===null&&c===null?Oy(e.cwd):!0,u=Ty({isolation:o,boundBranch:s,currentBranch:c,gitWorkTree:l});return u.status==="needs-heal"&&e.heal?(await Ny(t,u.branch),{status:"healed",branch:u.branch,bindingRequired:a,currentBranch:c}):{...u,bindingRequired:a,currentBranch:c}}async function Ny(t,e){return Kn(t,()=>Iy(t,e))}async function Iy(t,e){let r=Qu.join(t,".comet.yaml"),n=(await j(t,".comet.yaml",rs,{label:"Classic branch binding"})).bytes.toString("utf8"),i=(0,Cs.parseDocument)(n,{uniqueKeys:!1});if(i.errors.length)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);i.set("bound_branch",e),await X(r,i.toString(),{containedRoot:t})}function Ly(t){return t??"detached HEAD"}function gr(t,e,r){return`change '${t}' is bound to branch '${e}', but current branch is '${Ly(r)}'. Next: switch to branch '${e}' and rerun, or run comet state rebind ${t} after the user explicitly confirms this branch should take over the change`}function wr(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}hs();Et();var of=Fe(Oe(),1);import ce from"node:path";import{createHash as zn,randomUUID as fE}from"node:crypto";var jy=new Set(["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_GRAFT_FILE","GIT_SHALLOW_FILE","GIT_PREFIX","GIT_IMPLICIT_WORK_TREE","GIT_NO_REPLACE_OBJECTS","GIT_REPLACE_REF_BASE","GIT_CONFIG","GIT_CONFIG_PARAMETERS","GIT_CONFIG_COUNT"]);function $y(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>{let r=e.toUpperCase();return!jy.has(r)&&!/^GIT_CONFIG_(KEY|VALUE)_\d+$/u.test(r)}))}function ef(t){return{...$y(t.environment),...t.authentication?{}:{GIT_CONFIG_GLOBAL:process.platform==="win32"?"NUL":"/dev/null",GIT_CONFIG_NOSYSTEM:"1"},GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",SSH_ASKPASS_REQUIRE:"never",GIT_NO_REPLACE_OBJECTS:"1",GH_PROMPT_DISABLED:"1"}}function nt(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Classic progress requires a JSON object");return t}function Es(t,e){let r=Object.keys(t).filter(n=>!e.includes(n));if(r.length)throw new Error(`Unknown Classic progress field(s): ${r.join(", ")}; allowed fields: ${e.join(", ")}`)}function ae(t,e){if(typeof t!="string"||!t.trim()||t.length>4096||[...t].some(r=>r.charCodeAt(0)<32||r.charCodeAt(0)===127))throw new Error(`Invalid Classic progress ${e}`);return t}async function Dy(t,e,r){let n=ce.join(e,".comet",r);if(await Qe(t,n,{label:"Classic progress",expected:"file"}))return JSON.parse(await qe(t,n,{label:"Classic progress"}))}function Wy(t,e){let r=zn("sha256").update(e).digest("hex");return ce.join(t,".comet","runtime","classic-delivery",`${r}.json`)}async function qy(t,e){let r=Wy(t,e);if(!await Qe(t,r,{label:"Classic delivery reauthorization",expected:"file"}))return null;let n=nt(JSON.parse(await qe(t,r,{label:"Classic delivery reauthorization"})));if(Es(n,["schemaVersion","changeIdentity","previousAuthorizationId","authorizationId","action","targetBranch","remote","authorizedRemoteUrl"]),n.schemaVersion!==1||n.changeIdentity!==e)throw new Error("Classic delivery reauthorization identity is invalid");let i=_s({action:n.action,targetBranch:n.targetBranch,...n.remote===void 0?{}:{remote:n.remote}},!0);if(i.commit!==void 0||i.prUrl!==void 0)throw new Error("Classic delivery reauthorization cannot change sealed commit or PR evidence");return{schemaVersion:1,changeIdentity:e,previousAuthorizationId:ae(n.previousAuthorizationId,"previousAuthorizationId"),authorizationId:ae(n.authorizationId,"authorizationId"),...i,...n.authorizedRemoteUrl===void 0?{}:{authorizedRemoteUrl:ae(n.authorizedRemoteUrl,"authorizedRemoteUrl")}}}function _s(t,e=!1){let r=nt(t);if(Es(r,["action","targetBranch","remote","commit","prUrl",...e?["schemaVersion","changeIdentity","authorizedRemoteUrl","authorizationId"]:[]]),!["local","push","pr"].includes(r.action))throw new Error(`Invalid Classic delivery action '${String(r.action)}'; actions: local|push|pr`);let n=ae(r.targetBranch,"targetBranch");if(n.startsWith("-")||/[~^:?*[\\\s]/u.test(n)||n.includes("..")||n.includes("@{"))throw new Error("Invalid Classic delivery targetBranch");let i={action:r.action,targetBranch:n};if(r.remote!==void 0){let o=ae(r.remote,"remote");if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/u.test(o))throw new Error("Classic delivery remote must be a name, not a URL");i.remote=o}if(r.commit!==void 0){let o=ae(r.commit,"commit");if(!/^(?:[a-fA-F0-9]{40}|[a-fA-F0-9]{64})$/u.test(o))throw new Error("Classic delivery commit must be a full object ID");i.commit=o.toLowerCase()}if(r.prUrl!==void 0){let o=ae(r.prUrl,"prUrl"),s=new URL(o);if(s.protocol!=="https:"||s.username||s.password)throw new Error("Invalid Classic delivery prUrl");i.prUrl=o}return i}function sf(t){let e=(0,of.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length)throw new Error("Invalid Classic delivery change state");return nt(e.toJS())}function af(t,e){if(typeof t.run_id=="string"&&t.run_id)return`run:${t.run_id}`;let r=t.archived===!0?ce.basename(e).replace(/^\d{4}-\d{2}-\d{2}-/u,""):ce.basename(e);if(typeof t.created_at!="string"||typeof t.base_ref!="string")throw new Error("Classic delivery requires stable change identity");return`legacy:${zn("sha256").update(JSON.stringify([r,t.created_at,t.base_ref])).digest("hex")}`}async function My(t,e){return sf(await qe(t,ce.join(e,".comet.yaml"),{label:"Classic delivery state"}))}var Hn=class extends Error{constructor(e,r){super(`Classic delivery git command timed out: ${[e,...r].join(" ")}`)}};function Ss(t,e,r,n){return vt(e,r,{cwd:t,timeoutMs:5e3,env:ef({authentication:n})}).trim()}function br(t,e,r,n=!1){try{return Ss(t,e,r,n)}catch{return null}}function Fy(t,e,r,n=!1){try{return Ss(t,e,r,n)}catch(i){if(!(i instanceof yt)||!i.timedOut)return null;try{return Ss(t,e,r,n)}catch(o){if(o instanceof yt&&o.timedOut)throw new Hn(e,r);return null}}}function yr(t,e){return br(t,"git",["-C",t,...e])}function vr(t,e){return Fy(t,"git",["-C",t,...e])}function tf(t,e,r=!1){return br(t,"git",["-C",t,"remote","get-url",...r?["--push"]:[],e],!0)}function By(t,e){let r=ce.relative(t,e).replaceAll("\\","/");return[`:(literal)${r}`,...[".comet-state.lock",".comet-state-transaction.json"].map(n=>`:(exclude,literal)${r}/${n}`)]}function rf(t,e,r,n){let i=ce.relative(t,e).replaceAll("\\","/"),o=By(t,e),s=vr(t,["show",`${r}:${i}/.comet.yaml`]);if(!s)return!1;try{let a=sf(s);return a.archived===!0&&af(a,e)===n&&vr(t,["merge-base","--is-ancestor",r,"HEAD"])!==null&&vr(t,["diff","--quiet","--no-ext-diff","--no-textconv",r,"--",...o])!==null&&vr(t,["ls-files","--others","--exclude-standard","--",...o])===""}catch(a){if(a instanceof Hn)throw a;return!1}}function Uy(t,e){let r=`${zn("sha256").update(e).digest("hex")}.json`,n=vr(t,["rev-parse","--path-format=absolute","--git-common-dir"]);return[{root:t,file:ce.join(t,".comet","classic-deliveries",r)},...n?[{root:n,file:ce.join(n,"comet","classic-deliveries",r)}]:[]]}async function Ky(t,e){let r=null;for(let n of Uy(t,e)){if(!await Qe(n.root,n.file,{label:"Classic delivery receipt",expected:"file"}))continue;let i=nt(JSON.parse(await qe(n.root,n.file,{label:"Classic delivery receipt"})));if(Es(i,["schemaVersion","changeIdentity","authorizationId","invalidated","commit","prUrl"]),i.schemaVersion!==1||i.changeIdentity!==e)throw new Error("Invalid Classic delivery receipt schema or identity");if(i.invalidated!==void 0&&typeof i.invalidated!="boolean")throw new Error("Invalid Classic delivery receipt invalidation");let o=_s({action:"local",targetBranch:"main",...i.commit!==void 0?{commit:i.commit}:{},...i.prUrl!==void 0?{prUrl:i.prUrl}:{}}),s={schemaVersion:1,changeIdentity:e,authorizationId:ae(i.authorizationId,"authorizationId"),...i.invalidated===!0?{invalidated:!0}:{},...o.commit?{commit:o.commit}:{},...o.prUrl?{prUrl:o.prUrl}:{}};if(r&&JSON.stringify(r)!==JSON.stringify(s))throw new Error("Conflicting Classic delivery receipts");r=s}return r}function Gy(t){return t.authorizationId===void 0?`legacy:${zn("sha256").update(JSON.stringify(t)).digest("hex")}`:ae(t.authorizationId,"authorizationId")}function nf(t,e,r){return e===r||yr(t,["merge-base","--is-ancestor",e,r])!==null}function Hy(t){let e=/^git@([^:/]+):([^/]+\/[^/]+)$/u.exec(t);try{let r=new URL(e?`ssh://git@${e[1]}/${e[2]}`:t);if(!["https:","ssh:"].includes(r.protocol)||r.password||r.search||r.hash||r.port||r.protocol==="https:"&&r.username)return null;let n=r.pathname.replace(/\.git\/?$/u,"").replace(/\/$/u,"").split("/").filter(Boolean);return n.length!==2||n.some(i=>!/^[a-zA-Z0-9_.-]+$/u.test(i))?null:`${r.hostname}/${n.join("/")}`.toLowerCase()}catch{return null}}function Gn(t,e){try{let r=new URL(t);if(r.protocol!=="https:"||r.username||r.password||r.port||r.search||r.hash)return null;let n=/^\/([^/]+)\/([^/]+)\/pull\/([1-9]\d*)\/?$/u.exec(r.pathname);return n&&`${r.hostname}/${n[1]}/${n[2]}`.toLowerCase()===e?`https://${r.hostname}/${n[1]}/${n[2]}/pull/${n[3]}`:null}catch{return null}}async function xs(t,e,r={}){let n=await Dy(t,e,"delivery.json");if(n===void 0)return{delivery:null,verification:{status:"needsAuthorization"}};let i=nt(n);if(i.schemaVersion!==1)throw new Error("Unsupported Classic delivery schemaVersion");let o=_s(i,!0),s=await My(t,e),a=af(s,e);if(i.changeIdentity!==a)throw new Error("Classic delivery change identity mismatch");let c=Gy(i),l=await qy(t,a);if(l&&l.previousAuthorizationId!==c)throw new Error("Classic delivery reauthorization is stale for the sealed authorization");let u=l?{action:l.action,targetBranch:l.targetBranch,...l.remote===void 0?{}:{remote:l.remote}}:o,f=l?.authorizationId??c,d=await Ky(t,a),p=d?.authorizationId===f?d:null;if(p?.invalidated)return{delivery:null,verification:{status:"needsAuthorization",invalidated:!0}};for(let M of["commit","prUrl"]){if(M==="commit"&&p?.[M]&&u[M]&&p[M]!==u[M])throw new Error("Classic delivery receipt conflicts with authorization evidence");p?.[M]&&(u[M]=p[M])}let h=i.authorizedRemoteUrl===void 0?void 0:ae(i.authorizedRemoteUrl,"authorizedRemoteUrl"),m=l?.authorizedRemoteUrl??h,g={...u,schemaVersion:1,changeIdentity:a,authorizationId:f,...m?{authorizedRemoteUrl:m}:{}},v=yr(t,["symbolic-ref","--quiet","--short","HEAD"]),b=ce.relative(t,e).replaceAll("\\","/"),k=null;!u.commit&&s.archived===!0&&(k=yr(t,["log","-20","--format=%H","HEAD","--",`:(literal)${b}/.comet.yaml`])?.split(/\r?\n/u).find(we=>/^[a-f0-9]{40,64}$/u.test(we)&&rf(t,e,we,a))??null);let C=u.commit??k,S=!!C&&yr(t,["cat-file","-t",C])==="commit",E=s.archived===!0&&S&&rf(t,e,C,a),P=v===u.targetBranch&&(!s.bound_branch||l!==null||s.bound_branch===v)&&E,y=!1,O=!1,te=null,le=r.verifyRemote&&u.action!=="local"?"unavailable":"notChecked",R="notChecked";if(r.verifyRemote&&P&&u.action!=="local"&&u.remote&&m&&tf(t,u.remote)===m&&tf(t,u.remote,!0)===m){let M=`refs/heads/${u.targetBranch}`,we=br(t,"git",["-C",t,"-c","protocol.allow=never","-c","protocol.https.allow=always","-c","protocol.ssh.allow=always","-c","protocol.file.allow=always","ls-remote","--refs",u.remote,M],!0),Ls=we?.split(/\r?\n/u)??[],js=Ls.length===1?/^([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(Ls[0]):null,St=js?.[2]===M?js[1]:null;y=!!C&&!!St&&nf(t,C,St),le=y?"verified":we===""?"missing":we===null||!St||yr(t,["cat-file","-t",St])!=="commit"?"unavailable":"missing";let ue=Hy(m),Vn=ue&&u.prUrl?Gn(u.prUrl,ue):null,Xn=y||we==="",$s=Y=>Y.headRefName===u.targetBranch&&typeof Y.headRefOid=="string"&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(Y.headRefOid)&&(y?Y.headRefOid===St&&["OPEN","MERGED"].includes(Y.state):we===""&&Y.state==="MERGED"&&!!C&&nf(t,C,Y.headRefOid));if(Xn&&u.action==="pr"&&(R="unavailable"),Xn&&u.action==="pr"&&Vn&&ue){let Y=br(t,"gh",["pr","view",Vn,"--repo",ue,"--json","url,headRefName,headRefOid,state"],!0);try{let fe=Y?nt(JSON.parse(Y)):null;O=!!fe&&typeof fe.url=="string"&&Gn(fe.url,ue)===Vn&&$s(fe),R=O?"verified":fe?"missing":"unavailable"}catch{O=!1,R="unavailable"}}else if(Xn&&u.action==="pr"&&!u.prUrl&&ue){let Y=br(t,"gh",["pr","list","--repo",ue,"--head",u.targetBranch,"--state","all","--json","url,headRefName,headRefOid,state","--limit","100"],!0);try{let fe=Y===null?null:JSON.parse(Y);if(!Array.isArray(fe)||fe.length>=100)throw new Error("Incomplete PR discovery");let Qn=fe.map(nt).filter(Zn=>typeof Zn.url=="string"&&Gn(Zn.url,ue)&&$s(Zn));Qn.length===1?(te=Gn(Qn[0].url,ue),O=!0,R="verified"):R=Qn.length===0?"missing":"unavailable"}catch{R="unavailable"}}}return{delivery:g,verification:{status:P&&(u.action==="local"||(u.action==="push"?y:O))?"complete":"needsVerification",currentBranch:v,commitExists:S,archiveCommitted:E,observedCommit:k,observedPrUrl:te,remoteVerified:y,prVerified:O,remoteStatus:le,prStatus:R}}}var zy=Fe(Oe(),1);var bE=8*1024*1024;$e();In();V();he();se();var Yy=ye("readCometCurrentSelection",t=>ps(t));async function Jy(t,e){cr(e);let r=await Ze(e,t);if(!r.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let n=await pr(r.directory,{migrate:!1});if(!n.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(n.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return r.directory}async function cf(t){let e;try{e=await Yy(t)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let r=e.selection,n;try{n=await Jy(t,r.change)}catch(o){try{let s=await ns(r.change,t);if(!s)throw o;let a=await pr(s.directory,{migrate:!1}),c=await xs(t,s.directory);if(!a.classic?.archived||["complete","local-verified"].includes(c.verification.status))throw o;n=s.directory}catch(s){return{status:"stale",reason:s instanceof Error?s.message:String(s)}}}let i=await hr(n,{heal:!1,cwd:t});return i.status==="drift"?{status:"stale",reason:gr(r.change,i.boundBranch,i.currentBranch)}:i.status==="unbound-detached"?{status:"stale",reason:wr(r.change)}:i.status==="ok"?{status:"selected",selection:r}:r.branch!==null&&i.currentBranch!==r.branch?{status:"stale",reason:`current change '${r.change}' was selected on branch '${r.branch}', current branch is '${i.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:r}}function Ps(t){return t==="zh-CN"?"zh-CN":"en"}function lf(t,e,r){return t==="zh-CN"?r:e}function uf(t,e){let n={open:{en:"Source code edits are paused while the request is still being clarified.",zh:"需求仍在澄清中,暂时不修改源代码。"},design:{en:"Source code edits are paused until the design is agreed and recorded.",zh:"方案确定并记录之前,暂不修改源代码。"},build:{en:"A required design or plan record is missing, so source edits stay paused.",zh:"缺少必需的设计或计划记录,源代码修改暂被搁置。"},verify:{en:"Implementation edits are paused during verification; only verification output is accepted.",zh:"验证期间暂停修改实现,仅接受验证产出。"},archive:{en:"Source code edits are paused while the change is being archived.",zh:"归档期间暂不修改源代码。"}}[t]??{en:"This write is paused by the current workflow stage.",zh:"当前工作流阶段暂不允许这次写入。"};return{summary:lf(e,"This write was blocked on purpose, not by an error.","这次写入是被有意拦下的,不是发生了错误。"),user_message:lf(e,n.en,n.zh)}}function ff(t){if(t.workflow!=="full")return{missingFields:[],invalidFields:[]};let e=[],r=[];return t.buildMode||e.push("build_mode"),t.tddMode||e.push("tdd_mode"),t.reviewMode||e.push("review_mode"),t.buildMode==="subagent-driven-development"&&t.subagentDispatch!=="confirmed"&&e.push("subagent_dispatch"),t.buildMode==="autonomous"&&t.reviewMode==="off"&&r.push({field:"review_mode",reason:"autonomous full build requires review_mode=standard or thorough"}),t.buildMode==="direct"&&t.directOverride!==!0&&r.push({field:"direct_override",reason:"full workflow direct execution requires direct_override=true"}),{missingFields:e,invalidFields:r}}var df=Fe(Oe(),1);import it from"node:path";async function Rs(t,e,r,n={}){if(r.workflow!=="full"||r.buildMode!=="autonomous")return[];let i=[];if(n.requirePlan!==!1){let o=ff(r);o.missingFields.includes("tdd_mode")&&i.push("tdd_mode must be selected for autonomous full build"),o.missingFields.includes("review_mode")&&i.push("review_mode must be selected for autonomous full build"),o.invalidFields.some(({field:s})=>s==="review_mode")&&i.push("review_mode must be standard or thorough for autonomous full build"),r.isolation||i.push("isolation must be selected for autonomous full build")}if(!r.designDoc||!await tu(t,r.designDoc,"Classic autonomous design"))i.push("design_doc must reference a nonempty technical design for autonomous full build");else{let s=(await qe(t,r.designDoc,{label:"Classic autonomous design"})).replace(/^\uFEFF/u,"").match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/u),a=s?(0,df.parseDocument)(s[1]):null;(!a||a.errors.length||a.get("comet_change")!==e||a.get("role")!=="technical-design"||a.get("canonical_spec")!=="openspec")&&i.push("design_doc must link the current change and declare role: technical-design and canonical_spec: openspec")}return n.requirePlan!==!1&&(await Os(t,r.plan,{requireNonempty:!0})).status!=="ready"&&i.push("plan must reference a nonempty implementation plan in the configured plans directory"),i}async function Os(t,e,r={}){if(!e||e==="null")return{status:"missing",recordedPath:null};let n=await De(t),i=it.resolve(t,e),o=it.relative(n.superpowersPlansDir,i);return it.isAbsolute(e)||!o||o.startsWith(`..${it.sep}`)||it.isAbsolute(o)||o.includes(it.sep)||it.extname(o).toLowerCase()!==".md"?{status:"broken",recordedPath:e}:await Qe(t,e,{label:`Classic build plan ${e}`,expected:"file"})&&(!r.requireNonempty||(await qe(t,e,{label:`Classic build plan ${e}`})).trim().length>0)?{status:"ready",recordedPath:e}:{status:"broken",recordedPath:e}}var Vy=new Set([".md",".markdown"]),Xy=new Set([".md",".markdown",".rst",".txt"]),Qy=new Set(["docs","doc","documentation",".github"]),Zy=[/^LICENSE(?:[.-]|$)/u,/^NOTICE$/u,/^AUTHORS$/u];function mf(t){return t.replaceAll("\\","/").replace(/^\.\//u,"")}function ev(t,e){for(let r of e){let n=mf(r).replace(/\/+$/u,"");if(n&&(t===n||t.startsWith(`${n}/`)))return!0}return!1}function pf(t,e=[]){let r=mf(t);if(!r||r.endsWith("/")||ev(r,e))return!1;let n=r.split("/"),i=n[n.length-1],o=i.lastIndexOf("."),s=o===-1?"":i.slice(o).toLowerCase();return n.length===1?Vy.has(s)||Zy.some(a=>a.test(i)):Qy.has(n[0])&&Xy.has(s)}ds();$e();import tv from"os";import Yn from"path";function rv(t={}){let e=t.cwd??process.cwd(),r=t.homeDir??tv.homedir(),n=[{file:Yn.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:Yn.resolve(r,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return n.filter((i,o)=>n.findIndex(s=>s.file===i.file)===o)}async function hf(t,e={}){for(let r of rv(e)){let n=Yn.dirname(Yn.dirname(r.file)),i=r.scope==="global"?(await fs(n))?.classic:(await Ve(n,{allowPartialProject:!0}))?.value.classic;if(!i||typeof i!="object"||Array.isArray(i))continue;let o=i[t];if(o!=null)return{value:String(o),source:r.source}}return null}async function nv(t){let e=await hf("document_evidence",{cwd:t});if(!e)return"neutral";if(e.value==="neutral"||e.value==="strict")return e.value;throw new Error(`classic.document_evidence must be neutral or strict, got '${e.value}' (${e.source})`)}function iv(t,e){return[L(t,e.openSpecRoot),L(t,e.superpowersRoot)]}async function gf(t,e,r){return await nv(t)==="strict"?!1:pf(r,iv(t,e))}function q(t,e){return{exitCode:t,stderr:e+`
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
142
|
+
`,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=On(e),n=St(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=On(e),n=St(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())}}};Ml.Parser=Xo});var Kl=w(fr=>{"use strict";var Fl=Do(),Pg=rr(),ur=or(),Rg=Li(),Og=_(),Ag=Vo(),Bl=Qo();function Ul(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Ag.LineCounter||null,prettyErrors:e}}function Tg(t,e={}){let{lineCounter:r,prettyErrors:n}=Ul(e),i=new Bl.Parser(r?.addNewLine),o=new Fl.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(ur.prettifyError(t,r)),a.warnings.forEach(ur.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function Gl(t,e={}){let{lineCounter:r,prettyErrors:n}=Ul(e),i=new Bl.Parser(r?.addNewLine),o=new Fl.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 ur.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(ur.prettifyError(t,r)),s.warnings.forEach(ur.prettifyError(t,r))),s}function Ng(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=Gl(t,r);if(!i)return null;if(i.warnings.forEach(o=>Rg.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 Ig(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 Og.isDocument(t)&&!n?t.toString(r):new Pg.Document(t,n,r).toString(r)}fr.parse=Ng;fr.parseAllDocuments=Tg;fr.parseDocument=Gl;fr.stringify=Ig});var $e=w(x=>{"use strict";var jg=Do(),Lg=rr(),$g=yo(),Zo=or(),Wg=Mt(),Le=_(),Dg=Ae(),qg=T(),Mg=Ne(),Fg=Ie(),Bg=Pn(),Ug=Jo(),Gg=Vo(),Kg=Qo(),Tn=Kl(),Hl=$t();x.Composer=jg.Composer;x.Document=Lg.Document;x.Schema=$g.Schema;x.YAMLError=Zo.YAMLError;x.YAMLParseError=Zo.YAMLParseError;x.YAMLWarning=Zo.YAMLWarning;x.Alias=Wg.Alias;x.isAlias=Le.isAlias;x.isCollection=Le.isCollection;x.isDocument=Le.isDocument;x.isMap=Le.isMap;x.isNode=Le.isNode;x.isPair=Le.isPair;x.isScalar=Le.isScalar;x.isSeq=Le.isSeq;x.Pair=Dg.Pair;x.Scalar=qg.Scalar;x.YAMLMap=Mg.YAMLMap;x.YAMLSeq=Fg.YAMLSeq;x.CST=Bg;x.Lexer=Ug.Lexer;x.LineCounter=Gg.LineCounter;x.Parser=Kg.Parser;x.parse=Tn.parse;x.parseAllDocuments=Tn.parseAllDocuments;x.parseDocument=Tn.parseDocument;x.stringify=Tn.stringify;x.visit=Hl.visit;x.visitAsync=Hl.visitAsync});import We from"path";function Vg(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||We.posix.isAbsolute(r)||We.win32.isAbsolute(r)||/^(?:~|[\\/])/u.test(r))throw new Error(`${e} must be a project-relative path`);if(r===".")return[];let n=r.replaceAll("\\","/").split("/");if(n.some(i=>i===".."))throw new Error(`${e} must stay inside the project root`);if(n.some(i=>i===""||i==="."))throw new Error(`${e} must not contain empty or dot path segments`);return n}function mr(t){let e=Vg(t,"native.artifact_root");return e.length===0?".":e.join("/")}function tu(t,e="docs"){let r=t??e;if(r!=="legacy"&&r!=="docs")throw new Error("classic.artifact_layout must be legacy or docs");return r}function Et(t,e,r=!1){if(typeof t!="string")throw new Error(`${e} must be a string`);let n=t.trim().replaceAll("\\","/");if(n.length===0||We.posix.isAbsolute(n)||We.win32.isAbsolute(n)||/^(?:~|[\\/])/u.test(n))throw new Error(`${e} must be relative to its declared path base`);let i=n.split("/");if(i.some(o=>o===".."))throw new Error(`${e} must stay inside its declared path base`);if(i.some(o=>o===""||o==="."))throw new Error(`${e} must not contain empty or dot path segments`);if(!r&&/[*?]/u.test(n))throw new Error(`${e} cannot contain wildcards`);return i.join("/")}function ve(t,e){if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function ru(t,e,r){let n=t??e;if(n!=="en"&&n!=="zh-CN")throw new Error(`${r} must be en or zh-CN`);return n}function nu(t,e){if(typeof t!="string"||t.length===0||t.includes("\\")||t.includes("\0")||t.startsWith("/")||t.split("/").includes(".."))throw new Error(`${e} contains an unsafe pattern`);if(t.length>es)throw new Error(`${e} exceeds ${es} characters`);let r=0;for(let n=0;n<t.length;n+=1)t[n]==="?"?r+=1:t[n]==="*"&&(r+=1,t[n+1]==="*"&&(n+=1));if(r>ts)throw new Error(`${e} contains more than ${ts} wildcard tokens`);return t}function Xl(t,e,r){if(t===void 0)return[...r];if(!Array.isArray(t))throw new Error(`${e} contains an unsafe pattern`);return[...new Set(t.map(n=>nu(n,e)))].sort((n,i)=>n.localeCompare(i,"en"))}function dr(t,e,r){let n=t??e;if(!Number.isSafeInteger(n)||n<1)throw new Error(`${r} must be a positive integer`);return n}function Ql(t,e,r){let n=dr(t,e,r);if(n>Math.floor(Number.MAX_SAFE_INTEGER/(1024*1024)))throw new Error(`${r} is too large to convert to bytes safely`);return n}function Xg(t){if(t===void 0)return{...Z,include:[...Z.include],exclude:[...Z.exclude]};let e=ve(t,"native.snapshot");return{include:Xl(e.include,"native.snapshot.include",Z.include),exclude:Xl(e.exclude,"native.snapshot.exclude",Z.exclude),max_files:dr(e.max_files,Z.max_files,"native.snapshot.max_files"),max_total_bytes:dr(e.max_total_bytes,Z.max_total_bytes,"native.snapshot.max_total_bytes"),max_duration_ms:dr(e.max_duration_ms,Z.max_duration_ms,"native.snapshot.max_duration_ms"),max_selection_records:dr(e.max_selection_records,Z.max_selection_records,"native.snapshot.max_selection_records")}}function Qg(t){if(t===void 0)return;let e=ve(t,"native.pending_root_move"),r=e.id,n=e.from_artifact_root,i=e.to_artifact_root,o=e.stage;if(typeof r!="string"||!/^[a-f0-9-]{8,}$/u.test(r))throw new Error("native.pending_root_move.id is invalid");if(typeof n!="string"||typeof i!="string")throw new Error("native.pending_root_move roots must be strings");if(o!=="copying"&&o!=="ready"&&o!=="switched")throw new Error("native.pending_root_move.stage is invalid");let s;if(e.cleanup!==void 0){let a=ve(e.cleanup,"native.pending_root_move.cleanup"),c=a.kind,l=a.state,u=a.manifest_hash;if(c!=="forward-source"&&c!=="restart-staging"&&c!=="rollback-destination"&&c!=="rollback-staging")throw new Error("native.pending_root_move.cleanup.kind is invalid");if(l!=="prepared"&&l!=="quarantined"&&l!=="deleting")throw new Error("native.pending_root_move.cleanup.state is invalid");if(typeof u!="string"||!/^[a-f0-9]{64}$/u.test(u))throw new Error("native.pending_root_move.cleanup.manifest_hash is invalid");s={kind:c,state:l,manifestHash:u}}return{id:r,fromArtifactRoot:mr(n),toArtifactRoot:mr(i),stage:o,...s?{cleanup:s}:{}}}function Zg(t){if(t===void 0)return;let e=ve(t,"native.finish");if(e.pull_request===void 0)return{};let r=ve(e.pull_request,"native.finish.pull_request");if(r.provider!=="repository-command")throw new Error("native.finish.pull_request.provider must be repository-command");if(!Array.isArray(r.command)||r.command.length===0)throw new Error("native.finish.pull_request.command must be a non-empty array");if(r.command.length>64)throw new Error("native.finish.pull_request.command must contain at most 64 arguments");let n=r.command.map((o,s)=>{if(typeof o!="string"||o.trim().length===0||o.length>4096||/[\0\r\n]/u.test(o))throw new Error(`native.finish.pull_request.command[${s}] must be a non-empty single-line string of at most 4096 characters`);return o});if(We.posix.isAbsolute(n[0])||We.win32.isAbsolute(n[0]))throw new Error("native.finish.pull_request.command[0] must be a bare executable name or a project-relative path");let i=r.timeout_ms??Hg;if(!Number.isSafeInteger(i)||i<1||i>Vl)throw new Error(`native.finish.pull_request.timeout_ms must be an integer between 1 and ${Vl}`);return{pull_request:{provider:"repository-command",command:n,timeout_ms:i}}}function ew(t,e={}){let r=ve(t,"native"),n=r.artifact_root??(e.allowMissingArtifactRoot?"docs":void 0);if(typeof n!="string")throw new Error("native.artifact_root must be a string");let i=r.clarification_mode??"batch";if(i!=="sequential"&&i!=="batch")throw new Error("native.clarification_mode must be sequential or batch");let o=r.archive_confirmation??"automatic";if(o!=="automatic"&&o!=="required")throw new Error("native.archive_confirmation must be automatic or required");let s=r.max_verify_failures??Zl;if(!Number.isSafeInteger(s)||s<1)throw new Error("native.max_verify_failures must be a positive integer");let a=r.document_writes??"allow";if(a!=="allow"&&a!=="revert")throw new Error("native.document_writes must be allow or revert");let c=Qg(r.pending_root_move),l=Zg(r.finish);return{artifact_root:mr(n),language:ru(r.language,"en","native.language"),clarification_mode:i,archive_confirmation:o,max_verify_failures:s,...a==="revert"?{document_writes:a}:{},snapshot:Xg(r.snapshot),...l?{finish:l}:{},...c?{pending_root_move:c}:{}}}function tw(t){let e=ve(t,"classic"),r=e.context_compression??"off";if(r!=="off"&&r!=="beta")throw new Error("classic.context_compression must be off or beta");let n=e.review_mode??"standard";if(n!=="off"&&n!=="standard"&&n!=="thorough")throw new Error("classic.review_mode must be off, standard, or thorough");let i=e.auto_transition??!0;if(typeof i!="boolean")throw new Error("classic.auto_transition must be true or false");let o=e.document_evidence??"neutral";if(o!=="neutral"&&o!=="strict")throw new Error("classic.document_evidence must be neutral or strict");return{artifact_layout:tu(e.artifact_layout),language:ru(e.language,"zh-CN","classic.language"),context_compression:r,review_mode:n,auto_transition:i,...o==="strict"?{document_evidence:o}:{}}}function rw(t){let r=ve(t,"hook").allow_paths??[];if(!Array.isArray(r))throw new Error("hook.allow_paths must be an array");return{allow_paths:[...new Set(r.map((n,i)=>Et(n,`hook.allow_paths[${i}]`)))]}}function nw(t){if(t===void 0)return{...Nn};let e=ve(t,"memory"),r=e.learning??Nn.learning,n=e.retrieval??Nn.retrieval;if(typeof r!="boolean")throw new Error("memory.learning must be true or false");if(typeof n!="boolean")throw new Error("memory.retrieval must be true or false");return{learning:r,retrieval:n}}function ns(t,e){if(t===null||typeof t!="object"||Array.isArray(t))throw new Error(`${e} must be a mapping`);return t}function iw(t,e){if(typeof t!="string")throw new Error(`${e} must be a string`);let r=t.trim();if(r.length===0||r.includes("\\")||r.includes("\0")||We.posix.isAbsolute(r)||We.win32.isAbsolute(r)||r.startsWith("~")||r.split("/").some(i=>i===""||i==="."||i===".."))throw new Error(`${e} must be a safe project-relative glob`);if(!r.toLowerCase().endsWith(".md"))throw new Error(`${e} must target a Markdown file ending in .md`);if(r.length>zl)throw new Error(`${e} exceeds ${zl} characters`);let n=0;for(let i=0;i<r.length;i+=1)r[i]==="?"?n+=1:r[i]==="*"&&(n+=1,r[i+1]==="*"&&(i+=1));if(n>Jl)throw new Error(`${e} contains more than ${Jl} wildcard tokens`);return r}function ow(t){let e=ns(t,"knowledge.local"),r=e.include??[];if(!Array.isArray(r))throw new Error("knowledge.local.include must be an array");let n={include:[...new Set(r.map((i,o)=>iw(i,`knowledge.local.include[${o}]`)))],max_file_mb:Ql(e.max_file_mb,Yl.max_file_mb,"knowledge.local.max_file_mb"),max_total_mb:Ql(e.max_total_mb,Yl.max_total_mb,"knowledge.local.max_total_mb")};if(n.max_file_mb>n.max_total_mb)throw new Error("knowledge.local.max_file_mb must not exceed max_total_mb");return n}function sw(t){if(typeof t!="string"||t.trim().length===0)throw new Error("knowledge.remote.endpoint must be a non-empty URL");let e;try{e=new URL(t)}catch{throw new Error("knowledge.remote.endpoint must be a valid URL")}let r=e.hostname.toLowerCase().replace(/^\[|\]$/gu,""),n=r==="localhost"||r==="127.0.0.1"||r==="::1";if(e.protocol!=="https:"&&!(e.protocol==="http:"&&n))throw new Error("knowledge.remote.endpoint must use HTTPS (HTTP is allowed for loopback)");return e.toString()}function aw(t){let e=ns(t,"knowledge.remote"),r=sw(e.endpoint),n=e.token_env;if(n!==void 0&&(typeof n!="string"||!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(n)))throw new Error("knowledge.remote.token_env must be an environment variable name");let i=e.scope;if(i!==void 0&&(typeof i!="string"||i.length>512))throw new Error("knowledge.remote.scope must be a string of at most 512 characters");let o=e.timeout_ms??5e3;if(typeof o!="number"||!Number.isSafeInteger(o)||o<100||o>3e4)throw new Error("knowledge.remote.timeout_ms must be an integer between 100 and 30000");return{endpoint:r,...n===void 0?{}:{token_env:n},...i===void 0?{}:{scope:i},timeout_ms:o}}function cw(t){if(t===void 0)return{...eu};let e=ns(t,"knowledge"),r=e.provider??"local";if(r!=="local"&&r!=="remote")throw new Error("knowledge.provider must be local or remote");let n=e.local===void 0?void 0:ow(e.local);if(r==="local")return{provider:r,...n?{local:n}:{}};let i=e.remote===void 0?void 0:aw(e.remote);if(i===void 0)throw new Error("knowledge.remote must be configured when knowledge.provider is remote");return{provider:r,...n?{local:n}:{},remote:i}}function lw(t){let e=t??!0;if(typeof e!="boolean")throw new Error("ambient_resume must be true or false");return e}function uw(t,e,r,n,i,o,s,a){let c=t.schema!==void 0;if(!(c||t.default_workflow!==void 0||t.workflows!==void 0||!a.allowPartialProject&&t.native!==void 0)||a.allowPartialProject&&!c)return null;if(t.schema!=="comet.project.v1")throw new Error("Unsupported Comet project schema");if(t.default_workflow!=="native"&&t.default_workflow!=="classic")throw new Error("default_workflow must be native or classic");let u=t.workflows??[t.default_workflow];if(!Array.isArray(u)||u.length===0||u.some(d=>d!=="native"&&d!=="classic"))throw new Error("workflows must contain native and/or classic");let f=[...new Set(u)];if(!f.includes(t.default_workflow))throw new Error("workflows must include default_workflow");if(f.includes("native")&&!i)throw new Error("native must be a mapping");return{schema:"comet.project.v1",default_workflow:t.default_workflow,workflows:f,ambient_resume:s,...e?{hook:e}:{},memory:r,knowledge:n,...i?{native:i}:{},...o?{classic:o}:{}}}function De(t,e={}){let r=(0,rs.parseDocument)(t,{uniqueKeys:!0});if(r.errors.length>0)throw new Error(`Invalid .comet/config.yaml: ${r.errors[0].message}`);let n=r.toJS();if(n==null)return{value:{},config:null,ambient_resume:!0};if(typeof n!="object"||Array.isArray(n))throw new Error("Invalid .comet/config.yaml: root must be a mapping");let i=n,o=lw(i.ambient_resume),s=i.hook===void 0?void 0:rw(i.hook),a=nw(i.memory),c=cw(i.knowledge),l=i.native===void 0?void 0:ew(i.native,{allowMissingArtifactRoot:e.allowMissingNativeFields}),u=i.classic===void 0?void 0:tw(i.classic),f=uw(i,s,a,c,l,u,o,{allowPartialProject:e.allowPartialProject??!1});return{value:i,config:f,ambient_resume:o,memory:a,knowledge:c,...s?{hook:s}:{},...l?{native:l}:{},...u?{classic:u}:{}}}function is(t="docs",e="en"){return{schema:"comet.project.v1",default_workflow:"native",ambient_resume:!0,memory:{...Nn},knowledge:{...eu},native:{artifact_root:mr(t),language:e,clarification_mode:"batch",archive_confirmation:"automatic",max_verify_failures:Zl,snapshot:{...Z,include:[...Z.include],exclude:[...Z.exclude]}}}}var rs,nt,es,ts,zl,Jl,Zl,Nn,Yl,eu,Hg,Vl,zg,Jg,Yg,Z,be=A(()=>{"use strict";rs=Ve($e(),1),nt=Number.MAX_SAFE_INTEGER,es=1024,ts=64,zl=1024,Jl=64,Zl=5,Nn={learning:!0,retrieval:!0},Yl={include:[],max_file_mb:1,max_total_mb:32},eu={provider:"local"},Hg=12e4,Vl=6e5,zg=[".agents/skills/**",".amazonq/skills/**",".augment/skills/**",".bob/skills/**",".claude/skills/**",".cline/skills/**",".codebuddy/skills/**",".workbuddy/skills/**",".continue/skills/**",".cospec/skills/**",".crush/skills/**",".cursor/skills/**",".devin/skills/**",".dsh/skills/**",".factory/skills/**",".forge/skills/**",".gemini/skills/**",".github/skills/**",".grok/skills/**",".iflow/skills/**",".junie/skills/**",".kilocode/skills/**",".kimi-code/skills/**",".kiro/skills/**",".lingma/skills/**",".mimocode/skills/**",".opencode/skills/**",".omp/skills/**",".pi/skills/**",".qoder/skills/**",".qwen/skills/**",".roo/skills/**",".trae-cn/skills/**",".trae/skills/**",".windsurf/skills/**",".zcode/skills/**"],Jg=["**/.idea/**","**/.vscode/**",".codex/skills/**","**/node_modules/**","**/.next/**","**/.nuxt/**","**/.output/**","**/.svelte-kit/**","**/.vite/**","**/.parcel-cache/**","**/.turbo/**","**/.nx/cache/**","**/dist/**","**/build/**","**/out/**","**/coverage/**","**/.nyc_output/**","**/target/**","**/.gradle/**","**/.cxx/**","**/.externalNativeBuild/**","**/captures/**","**/__pycache__/**","**/.pytest_cache/**","**/.mypy_cache/**","**/.ruff_cache/**","**/.tox/**","**/.nox/**","**/.venv/**","**/venv/**","**/obj/**","**/CMakeFiles/**","**/cmake-build-*/**","**/.cache/**","**/tmp/**","**/temp/**","**/logs/**","**/*.tsbuildinfo","**/*.log","**/.DS_Store","**/Thumbs.db"],Yg=[...zg,...Jg].sort((t,e)=>t.localeCompare(e,"en")),Z={include:["**/*"],exclude:[...Yg],max_files:1e4,max_total_bytes:1024*1024*1024,max_duration_ms:6e4,max_selection_records:2e4}});function qe(t){return t!==0&&t!==0n&&t!=="0"}function iu(t,e){return qe(t.dev)&&qe(e.dev)&&qe(t.ino)&&qe(e.ino)}function Me(t,e){let r=qe(t.dev)&&qe(e.dev);if(r&&t.dev!==e.dev)return!1;let n=qe(t.ino)&&qe(e.ino);return n&&t.ino!==e.ino?!1:r&&n?!0:t.birthtime===e.birthtime}var In=A(()=>{"use strict"});import{constants as Fe,promises as z}from"fs";import{createHash as fw}from"node:crypto";function os(t){return"birthtimeNs"in t&&typeof t.birthtimeNs=="bigint"?t.birthtimeNs:t.birthtimeMs}function ou(t){return"ctimeNs"in t&&typeof t.ctimeNs=="bigint"?t.ctimeNs:t.ctimeMs}function Ue(t){return{dev:t.dev,ino:t.ino,birthtime:os(t)}}function Be(t,e){let r=Ue(t),n=Ue(e);return iu(r,n)?Me(r,n):Me(r,n)&&os(t)===os(e)&&ou(t)===ou(e)&&t.size===e.size}async function jn(t,e,r={}){if(!Number.isSafeInteger(e)||e<1)throw new Error("race-safe read byte limit must be a positive integer");let n=r.label??"file",i=r.bigint===!0,o=await z.lstat(t,{bigint:i});if(!o.isFile()||o.isSymbolicLink())throw new ie("not-regular-file",`${n} must be a regular file`);if(BigInt(o.size)>BigInt(e))throw new ie("too-large",`${n} exceeds ${e} bytes`);let s=await z.realpath(t);await r.verify?.("pre-open",{realPath:s,identity:Ue(o)});let a=process.platform==="win32"?Fe.O_RDONLY:Fe.O_RDONLY|Fe.O_NOFOLLOW|Fe.O_NONBLOCK,c;try{c=await z.open(t,a)}catch(l){throw l.code==="ELOOP"?new ie("not-regular-file",`${n} must be a regular file`,{cause:l}):l}try{let[l,u,f]=await Promise.all([c.stat({bigint:i}),z.lstat(t,{bigint:i}),z.realpath(t)]);if(!l.isFile()||!u.isFile()||u.isSymbolicLink()||f!==s||!Be(o,l)||!Be(o,u))throw new ie("changed",`${n} changed while opening`);await r.verify?.("post-open",{realPath:f,identity:Ue(l)}),await r.hooks?.afterOpen?.();let d=[],p=0,h=Buffer.allocUnsafe(Math.min(64*1024,e+1));for(;;){let b=e+1-p,{bytesRead:k}=await c.read(h,0,Math.min(h.length,b),null);if(k===0)break;if(p+=k,p>e)throw new ie("too-large",`${n} exceeds ${e} bytes`);d.push(Buffer.from(h.subarray(0,k)))}await r.hooks?.beforeFinalCheck?.();let[m,g,y]=await Promise.all([c.stat({bigint:i}),z.lstat(t,{bigint:i}),z.realpath(t)]);if(!g.isFile()||g.isSymbolicLink()||y!==s||!Be(o,m)||!Be(o,g))throw new ie("changed",`${n} changed while reading`);return await r.verify?.("post-read",{realPath:y,identity:Ue(m)}),{bytes:Buffer.concat(d,p),stat:m,realPath:y}}finally{await c.close()}}async function su(t,e={}){let r=e.label??"file",n=e.bigint===!0,i=await z.lstat(t,{bigint:n});if(!i.isFile()||i.isSymbolicLink())throw new ie("not-regular-file",`${r} must be a regular file`);let o=await z.realpath(t);await e.verify?.("pre-open",{realPath:o,identity:Ue(i)});let s=process.platform==="win32"?Fe.O_RDONLY:Fe.O_RDONLY|Fe.O_NOFOLLOW|Fe.O_NONBLOCK,a;try{a=await z.open(t,s)}catch(c){throw c.code==="ELOOP"?new ie("not-regular-file",`${r} must be a regular file`,{cause:c}):c}try{let[c,l,u]=await Promise.all([a.stat({bigint:n}),z.lstat(t,{bigint:n}),z.realpath(t)]);if(!c.isFile()||!l.isFile()||l.isSymbolicLink()||u!==o||!Be(i,c)||!Be(i,l))throw new ie("changed",`${r} changed while opening`);await e.verify?.("post-open",{realPath:u,identity:Ue(c)}),await e.hooks?.afterOpen?.();let f=fw(e.algorithm??"sha256"),d=Buffer.allocUnsafe(64*1024);for(;;){let{bytesRead:g}=await a.read(d,0,d.length,null);if(g===0)break;f.update(d.subarray(0,g))}await e.hooks?.beforeFinalCheck?.();let[p,h,m]=await Promise.all([a.stat({bigint:n}),z.lstat(t,{bigint:n}),z.realpath(t)]);if(!h.isFile()||h.isSymbolicLink()||m!==o||!Be(i,p)||!Be(i,h))throw new ie("changed",`${r} changed while reading`);return await e.verify?.("post-read",{realPath:m,identity:Ue(p)}),{digest:f.digest("hex"),stat:p,realPath:m}}finally{await a.close()}}var ie,ss=A(()=>{"use strict";In();ie=class extends Error{reason;constructor(e,r,n){super(r,n),this.name="RaceSafeReadError",this.reason=e}}});import{promises as Ln}from"fs";import Ge from"path";async function au(t,e,r){let n=await j(t,e,{label:r.label,expected:"file"});if(!n.exists){let o=new Error(`${r.label} does not exist`);throw o.code="ENOENT",o}let i=await as(n.projectRoot,r.label);return su(n.target,{...r,verify:async(o,s)=>{if(!$n(i,s.realPath))throw new Error(`${r.label} resolves outside the project root`);await cs(n.projectRoot,i,n.relative.split("/"),{label:r.label,expected:"file"})}})}function dw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function $n(t,e){let r=Ge.relative(t,e);return r===""||!Ge.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${Ge.sep}`)}async function as(t,e){let r=Ge.resolve(t),n=await Ln.lstat(r);if(!n.isDirectory()||n.isSymbolicLink())throw new Error(`${e} project root must be a real directory`);return Ln.realpath(r)}async function cs(t,e,r,n){let i=t;for(let o=0;o<r.length;o++){i=Ge.join(i,r[o]);let s;try{s=await Ln.lstat(i)}catch(u){if(dw(u))return{exists:!1,kind:"missing"};throw u}let a=Ge.relative(t,i).replaceAll("\\","/");if(s.isSymbolicLink())throw new Error(`${n.label} crosses a symbolic link or junction at ${a}`);let c=o===r.length-1;if(!c&&!s.isDirectory())throw new Error(`${n.label} ancestor ${a} must be a real directory`);if(c&&(n.expected==="file"&&!s.isFile()||n.expected==="directory"&&!s.isDirectory()||n.expected==="any"&&!s.isFile()&&!s.isDirectory()))throw new Error(`${n.label} must be a real ${n.expected}`);let l=await Ln.realpath(i);if(!$n(e,l))throw new Error(`${n.label} resolves outside the project root`);if(c)return{exists:!0,kind:s.isFile()?"file":s.isDirectory()?"directory":"missing"}}return{exists:!0,kind:"directory"}}async function j(t,e,r){let n=Et(e,r.label),i=Ge.resolve(t),o=await as(i,r.label),s=n.split("/"),a=Ge.resolve(i,...s);if(!$n(i,a))throw new Error(`${r.label} must stay inside the project root`);let c=await cs(i,o,s,r);return{projectRoot:i,target:a,relative:n,exists:c.exists,kind:c.kind}}async function L(t,e,r,n){let i=await j(t,e,{label:n.label,expected:"file"});if(!i.exists){let s=new Error(`${n.label} does not exist`);throw s.code="ENOENT",s}let o=await as(i.projectRoot,n.label);return jn(i.target,r,{...n,verify:async(s,a)=>{if(!$n(o,a.realPath))throw new Error(`${n.label} resolves outside the project root`);await cs(i.projectRoot,o,i.relative.split("/"),{label:n.label,expected:"file"})}})}var J=A(()=>{"use strict";ss();be()});import{createHash as mw}from"crypto";function pw(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function it(t,e={}){return(await Wn(t,e)).document}async function hw(t){try{return(await L(t,pr,nt,{label:pr})).bytes}catch(e){if(pw(e))return null;throw e}}function gw(t){return t?{exists:!0,sha256:mw("sha256").update(t).digest("hex")}:{exists:!1,sha256:null}}async function Wn(t,e={}){let r=await hw(t);return{document:r?De(r.toString("utf8"),e):null,identity:gw(r)}}async function ls(t){return(await it(t))?.config??null}var pr,Ke=A(()=>{"use strict";be();J();pr=".comet/config.yaml"});import{promises as fs}from"node:fs";async function ds(t,e){let r;for(let n=0;n<=us.length;n+=1)try{return await t()}catch(i){r=i;let o=i.code;if(n===us.length||!ww.has(o??""))throw i;await new Promise(s=>setTimeout(s,us[n]))}throw r}async function cu(t,e){await ds(()=>fs.rename(t,e),`rename ${e}`)}async function Dn(t){await ds(()=>fs.unlink(t),`unlink ${t}`)}async function lu(t,e){await ds(()=>fs.link(t,e),`link ${e}`)}var ww,us,ms=A(()=>{"use strict";ww=new Set(["EPERM","EACCES","EBUSY","ENOTEMPTY"]),us=[50,100,200]});import{randomUUID as yw}from"crypto";import{constants as vw,promises as $}from"fs";import q from"path";async function ps(t,e){try{return await lu(t,e),{linked:!0}}catch(r){let n=r.code;if(n!=="ENOTSUP"&&n!=="EOPNOTSUPP")throw r}return await $.copyFile(t,e,vw.COPYFILE_EXCL),{linked:!1}}function ot(t,e){let r=q.relative(t,e);return r===""||!q.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${q.sep}`)}function qn(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function bw(t,e){return Me(t,qn(e))}function Mn(t,e){return Me(qn(t),qn(e))}function uu(t,e){return Mn(t,e)&&t.birthtimeMs===e.birthtimeMs&&t.ctimeMs===e.ctimeMs&&t.mtimeMs===e.mtimeMs&&t.size===e.size}async function Fn(t){let e=await $.lstat(t);if(!e.isDirectory()||e.isSymbolicLink())throw new Error(`Contained atomic write parent must be a real directory: ${t}`);return{path:t,realPath:await $.realpath(t),...qn(e)}}async function ke(t){for(let e of t){let r=await $.lstat(e.path);if(!r.isDirectory()||r.isSymbolicLink()||!bw(e,r)||await $.realpath(e.path)!==e.realPath)throw new Error(`Contained atomic write parent changed before commit: ${e.path}`)}}async function kw(t,e,r){let[n,i]=await Promise.all([$.lstat(t),$.realpath(t),ke(r)]);if(!n.isFile()||n.isSymbolicLink()||!Mn(n,e)||!ot(r[0].realPath,i))throw new Error("Contained atomic write temporary file changed after close");return n}async function Cw(t,e){let r=q.resolve(t),n=q.resolve(e);if(!ot(r,n))throw new Error(`Contained atomic write parent is outside its managed root: ${e}`);let i=[await Fn(r)],o=q.relative(r,n).split(q.sep).filter(Boolean),s=r;for(let a of o){await ke(i),s=q.join(s,a);try{await $.mkdir(s)}catch(l){if(l.code!=="EEXIST")throw l}let c=await Fn(s);if(!ot(i[0].realPath,c.realPath))throw new Error(`Contained atomic write parent resolves outside its managed root: ${s}`);i.push(c)}return await ke(i),i}async function Sw(t,e){let r=q.resolve(t),n=q.resolve(e);if(!ot(r,n))throw new Error(`Contained file parent is outside its managed root: ${e}`);let i=[await Fn(r)],o=q.relative(r,n).split(q.sep).filter(Boolean),s=r;for(let a of o){s=q.join(s,a);try{let c=await Fn(s);if(!ot(i[0].realPath,c.realPath))throw new Error(`Contained file parent resolves outside its managed root: ${s}`);i.push(c)}catch(c){if(c.code==="ENOENT")return null;throw c}}return await ke(i),i}async function fu(t){let e;try{e=await $.open(t,"r"),await e.sync()}catch(r){let n=r.code;if(!["EACCES","EBADF","EINVAL","EISDIR","ENOTSUP","EPERM"].includes(n??""))throw r}finally{await e?.close()}}async function Ew(t,e,r){let n=q.dirname(t),i=await Cw(r.containedRoot,n),o=q.join(n,`.${q.basename(t)}.${yw()}.tmp`),s,a,c;try{await r.beforeTemporaryOpen?.(),s=await $.open(o,"wx"),a=await s.stat();let[l,u]=await Promise.all([$.lstat(o),$.realpath(o)]);if(await ke(i),!l.isFile()||l.isSymbolicLink()||!Mn(a,l)||!ot(i[0].realPath,u))throw new Error("Contained atomic write temporary file opened outside its managed parent");if(typeof e=="string"?await s.writeFile(e,"utf8"):await s.writeFile(e),await s.sync(),c=await s.stat(),!Mn(a,c))throw new Error("Contained atomic write temporary file changed while writing");if(await s.close(),s=void 0,await r.afterTemporaryClose?.(),!c)throw new Error("Contained atomic write temporary file was not written");c=await kw(o,c,i),await r.beforeCommit?.(),await ke(i);let f=await $.lstat(o);if(!f.isFile()||f.isSymbolicLink()||!c||!uu(f,c))throw new Error("Contained atomic write temporary file changed before commit");r.exclusive?(await ps(o,t),await $.unlink(o)):await cu(o,t),await fu(n)}catch(l){await s?.close();try{await ke(i),await $.rm(o,{force:!0})}catch{}throw l}}async function ee(t,e,r){await Ew(t,e,r)}async function hr(t,e){let r=q.dirname(t),n=await Sw(e.containedRoot,r);if(!n)return!1;let i,o;try{i=await $.lstat(t),o=await $.realpath(t)}catch(c){if(c.code==="ENOENT")return!1;throw c}if(!i.isFile()||i.isSymbolicLink()||!ot(n[0].realPath,o))throw new Error("Contained file removal target must be a regular file inside its managed root");await e.beforeRemove?.(),await ke(n);let[s,a]=await Promise.all([$.lstat(t),$.realpath(t)]);if(!s.isFile()||s.isSymbolicLink()||!uu(i,s)||a!==o)throw new Error("Contained file removal target changed before removal");return await Dn(t),await ke(n),await fu(r),!0}var de=A(()=>{"use strict";ms();In()});var yC,hs=A(()=>{"use strict";de();Ke();J();yC=16*1024});var Bn=A(()=>{"use strict";de();be();Ke();J();hs()});import F from"path";function _u(t,e){let r=F.relative(t,e);return r===""||!F.isAbsolute(r)&&r!==".."&&!r.startsWith(`..${F.sep}`)}function Bw(t,e){let r=F.isAbsolute(e)?F.resolve(e):F.resolve(t,e),n=F.relative(F.resolve(t),r);return n===""||F.isAbsolute(n)||n===".."||n.startsWith(`..${F.sep}`)?null:n.replaceAll("\\","/")}function xu(t){return process.platform==="win32"?t.toLowerCase():t}async function Cs(t,e,r=[]){let n=F.isAbsolute(e)?F.resolve(e):F.resolve(t,e),i=F.resolve(t);if(!_u(i,n)||r.some(c=>_u(F.resolve(c),n)))return null;let o=Bw(t,e);if(!o)return null;let a=(await Fw(t)).allow_paths.find(c=>{let l=xu(o),u=xu(c);return l===u||l.startsWith(`${u}/`)});return a?`${o} (configured Hook allow path: ${a})`:null}var Fw,Ss=A(()=>{"use strict";Lt();Ke();Fw=_e("hookWritePolicy",async t=>(await ls(t))?.hook??{allow_paths:[]})});var Vn=A(()=>{"use strict"});var Ku=A(()=>{"use strict"});var As=A(()=>{"use strict";Vn()});var Hu=A(()=>{"use strict";Vn();As()});function by(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}function ky(t){let e=(0,zu.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length>0)throw new Error(`Invalid global Comet config: ${e.errors[0].message}`);let r=e.toJS();if(r==null)return{};if(typeof r!="object"||Array.isArray(r))throw new Error("Invalid global Comet config: root must be a mapping");return r}function Yu(t){if(t.native?.pending_root_move)throw new Error("Global Comet config cannot contain native.pending_root_move");let e=t.native?(({pending_root_move:r,...n})=>n)(t.native):void 0;return{...t,schema:"comet.global.v1",...e?{native:e}:{}}}function Cy(t){let e=De(JSON.stringify({...t,schema:"comet.project.v1"})).config;if(!e)throw new Error("Invalid global Comet config: workflow template is incomplete");return Yu(e)}function Sy(t){let e=De(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e.native&&!e.classic)return null;let r=e.native?"native":"classic",n=e.native?.language??e.classic?.language??"en",i=is(e.native?.artifact_root??"docs",n);return{schema:"comet.global.v1",default_workflow:r,workflows:[r],ambient_resume:e.ambient_resume,...e.native?{native:{...i.native,...e.native}}:{},...e.classic?{classic:e.classic}:{}}}function Vu(t){let e=ky(t);if(Object.keys(e).length===0)return null;if(e.schema===void 0)return Sy(t);if(e.schema!=="comet.global.v1")throw new Error("Unsupported Comet global schema");return Cy(e)}async function Ts(t){try{let e=await L(t,Ju,nt,{label:"global Comet config"});return Vu(e.bytes.toString("utf8"))}catch(e){if(by(e))return null;throw e}}var zu,Ju,Ns=A(()=>{"use strict";zu=Ve($e(),1);de();be();J();Ju=".comet/config.yaml"});var KS,Xu=A(()=>{"use strict";de();J();KS=4*1024*1024});import Ey from"node:path";function Is(t){return Ey.join(t,".comet","current-change.json")}function _y(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Qu(t){return t===null||typeof t=="string"}function xy(t){let e;try{e=JSON.parse(t)}catch(r){throw new Error(`current change selection contains invalid JSON: ${r instanceof Error?r.message:String(r)}`,{cause:r})}if(!_y(e))throw new Error("current change selection must be a JSON object");if(e.version===1){if(typeof e.change!="string")throw new Error("legacy current change selection change must be a string");if(e.branch!==void 0&&!Qu(e.branch))throw new Error("legacy current change selection branch must be a string or null");return{selection:{schema:Xn,workflow:"classic",change:e.change,branch:e.branch??null},legacy:!0}}if(e.schema!==Xn)throw new Error(`current change selection schema must be ${Xn}`);if(e.workflow!=="native"&&e.workflow!=="classic")throw new Error("current change selection workflow must be native or classic");if(typeof e.change!="string")throw new Error("current change selection change must be a string");if(!Qu(e.branch))throw new Error("current change selection branch must be a string or null");if(e.workflow==="native"&&e.branch!==null)throw new Error("Native current change selection branch must be null");return{selection:e,legacy:!1}}async function js(t){let e;try{let n=Is(t),{bytes:i}=await jn(n,Zu,{label:"current change selection"});e=i.toString("utf8")}catch(n){if(n.code==="ENOENT")return{status:"missing"};throw new Error(`cannot read current change selection: ${n instanceof Error?n.message:String(n)}`,{cause:n})}return{status:"selected",...xy(e)}}var Xn,Zu,Ls=A(()=>{"use strict";ss();Xn="comet.selection.v2",Zu=16*1024});var ef=A(()=>{"use strict";Vn();de();Ku();Hu();be();Ns();J();Ke();Bn();Xu();Ss();Ls();hs();As()});import{TextDecoder as Ay}from"util";function tf(t){return{dev:t.dev,ino:t.ino,birthtime:t.birthtimeMs}}function Ty(t,e){try{return new Ay("utf-8",{fatal:!0}).decode(t.bytes)}catch(r){throw new Error(`${e} is not valid UTF-8`,{cause:r})}}async function $s(t,e,r,n,i={}){try{let o=await L(t,e,r,{label:n,hooks:i.hooks});return{result:o,text:Ty(o,n)}}catch(o){let s=o.code;if(s==="ENOENT"||s==="ENOTDIR")return null;throw o}}async function rf(t,e,r,n,i={}){return(await $s(t,e,r,n,i))?.text??null}async function nf(t,e,r,n,i,o={}){if(Buffer.byteLength(r,"utf8")>n)throw new Error(`${i} exceeds ${n} bytes`);let s=await $s(t,e,n,i),a=await j(t,e,{label:i,expected:"file"});await ee(a.target,r,{containedRoot:a.projectRoot,beforeCommit:async()=>{await o.beforeCommit?.();let c=await $s(t,e,n,i);if(!(!s&&!c)){if(!s||!c)throw new Error(`${i} changed before commit`);if(s.result.realPath!==c.result.realPath||!Me(tf(s.result.stat),tf(c.result.stat))||s.text!==c.text)throw new Error(`${i} changed before commit`)}}})}async function of(t,e,r,n={}){let i=await j(t,e,{label:r,expected:"file"});return i.exists?hr(i.target,{containedRoot:i.projectRoot,beforeRemove:n.beforeRemove}):!1}var sf=A(()=>{"use strict";ef();In()});var uf={};md(uf,{RUN_STATE_FILE:()=>Pt,applyRunStateToDocument:()=>cf,readRunState:()=>Qn,removeRunState:()=>Ws,runStateFromDocument:()=>xt,writeRunState:()=>Zn});import Ny from"path";function Cr(t,e){let r=t[e];if(typeof r!="string"||r.length===0)throw new Error(`Invalid Run state: ${e} must be a non-empty string`);return r}function kr(t,e){let r=Cr(t,e);if(Ny.isAbsolute(r)||/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Run state: ${e} must stay inside the change directory`);return r}function Iy(t){let e=t.run_retries??"{}",r;try{r=typeof e=="string"?JSON.parse(e):e}catch(n){throw new Error("Invalid Run state: run_retries must be a JSON object",{cause:n})}if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Invalid Run state: run_retries must be a JSON object");for(let n of Object.values(r))if(!Number.isInteger(n)||Number(n)<0)throw new Error("Invalid Run state: retry counts must be non-negative integers");return r}function xt(t){if(!t.run_id)return null;let e=Cr(t,"run_id"),r=Cr(t,"skill"),n=Cr(t,"skill_version"),i=Cr(t,"skill_hash"),o=kr(t,"pending_ref"),s=kr(t,"trajectory_ref"),a=kr(t,"context_ref"),c=kr(t,"artifacts_ref"),l=kr(t,"checkpoint_ref"),u=Number(t.iteration);if(!Number.isInteger(u)||u<0)throw new Error("Invalid Run state: iteration must be a non-negative integer");if(t.orchestration!=="deterministic"&&t.orchestration!=="adaptive")throw new Error("Invalid Run state: orchestration must be deterministic or adaptive");if(t.run_status!=="running"&&t.run_status!=="waiting"&&t.run_status!=="completed"&&t.run_status!=="failed")throw new Error("Invalid Run state: run_status is invalid");return{runId:e,skill:r,skillVersion:n,skillHash:i,orchestration:t.orchestration,currentStep:af(t,"current_step"),iteration:u,pending:af(t,"pending"),pendingRef:o,trajectoryRef:s,contextRef:a,artifactsRef:c,checkpointRef:l,status:t.run_status,retries:Iy(t)}}function cf(t,e){e?t.run_id=e.runId:delete t.run_id}function jy(t){return{runId:t.runId,skill:t.skill,skillVersion:t.skillVersion,skillHash:t.skillHash,orchestration:t.orchestration,currentStep:t.currentStep,iteration:t.iteration,pending:t.pending,pendingRef:t.pendingRef,trajectoryRef:t.trajectoryRef,contextRef:t.contextRef,artifactsRef:t.artifactsRef,checkpointRef:t.checkpointRef,status:t.status,retries:t.retries}}function Ly(t){let e={run_id:t.runId,skill:t.skill,skill_version:t.skillVersion,skill_hash:t.skillHash,orchestration:t.orchestration,current_step:t.currentStep,iteration:t.iteration,pending:t.pending,pending_ref:t.pendingRef,trajectory_ref:t.trajectoryRef,context_ref:t.contextRef,artifacts_ref:t.artifactsRef,checkpoint_ref:t.checkpointRef,run_status:t.status,run_retries:JSON.stringify(t.retries)};return xt(e)}async function Qn(t,e={}){let r=await rf(t,Pt,lf,"Run state",e);if(r===null)return null;let n=JSON.parse(r);return Ly(n)}async function Zn(t,e,r={}){await nf(t,Pt,JSON.stringify(jy(e),null,2),lf,"Run state",r)}async function Ws(t,e={}){await of(t,Pt,"Run state",e)}var af,Pt,lf,ei=A(()=>{"use strict";sf();af=(t,e)=>{let r=t[e];return r==null?null:String(r)};Pt=".comet/run-state.json",lf=Number.MAX_SAFE_INTEGER});import{promises as li}from"fs";import X from"path";function hi(t){return t.charCodeAt(0)===65279?t.slice(1):t}Lt();async function wi(t=2e3){return process.stdin.isTTY?{text:""}:!Number.isFinite(t)||t<1?{text:null}:process.stdin.readableEnded?{text:""}:await new Promise(e=>{let r=!1,n=0,i=[],o=setTimeout(()=>s({text:null}),Math.ceil(t)),s=f=>{r||(r=!0,clearTimeout(o),process.stdin.removeListener("data",a),process.stdin.removeListener("end",c),process.stdin.removeListener("close",l),process.stdin.removeListener("error",u),process.stdin.pause(),e(f))},a=f=>{let d=Buffer.isBuffer(f)?f:Buffer.from(f),p=1048576-n;if(p<=0){s({text:null});return}let h=d.subarray(0,p);i.push(h),n+=h.length,d.length>h.length&&s({text:null})},c=()=>s({text:Buffer.concat(i,n).toString("utf8")}),l=()=>{process.stdin.readableEnded||s({text:null})},u=()=>s({text:null});process.stdin.on("data",a),process.stdin.once("end",c),process.stdin.once("close",l),process.stdin.once("error",u),o.unref(),process.stdin.resume()})}import{promises as Rw}from"fs";import Y from"path";import{promises as wd}from"fs";async function yi(t){try{return await wd.access(t),!0}catch(e){if(yd(e))return!1;throw e}}function yd(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}be();Ke();Bn();J();var _t=class extends Error{code="classic-layout-unavailable";constructor(e="Classic artifact layout is unavailable from .comet/config.yaml"){super(e),this.name="ClassicLayoutUnavailableError"}},pu=".comet/config.yaml";function Ow(t){let e=t?.code;return e==="ENOENT"||e==="ENOTDIR"}async function Aw(t){await j(t,pu,{label:pu,expected:"file"})}function ws(t,e){let r=Y.resolve(t),n=e==="docs"?Y.join(r,"docs"):r,i=Y.join(n,"openspec"),o=Y.join(r,"docs","superpowers");return{projectRoot:r,artifactLayout:e,openSpecBase:n,openSpecRoot:i,changesDir:Y.join(i,"changes"),archiveDir:Y.join(i,"changes","archive"),specsDir:Y.join(i,"specs"),superpowersRoot:o,superpowersSpecsDir:Y.join(o,"specs"),superpowersPlansDir:Y.join(o,"plans"),superpowersReportsDir:Y.join(o,"reports")}}async function gu(t){await Aw(t);let e=await it(t,{allowPartialProject:!0,allowMissingNativeFields:!0});if(!e?.config)throw new _t;if(!(e.config.workflows??[e.config.default_workflow]).includes("classic"))throw new _t("Classic artifact layout is unavailable because Classic is not enabled");return e.classic?.artifact_layout??"legacy"}async function wu(t,e){return ws(t,e??await gu(t))}async function Tw(t){try{return await Rw.lstat(t),!0}catch(e){if(Ow(e))return!1;throw e}}async function Nw(t,e){let r=await wu(t,e),n=r.artifactLayout==="legacy"?"docs":"legacy",i=ws(t,n).openSpecRoot,[o,s]=await Promise.all([j(r.projectRoot,W(r.projectRoot,r.openSpecRoot),{label:"Configured Classic OpenSpec root",expected:"directory"}),Tw(i)]),a=o.exists;return{paths:r,configuredRootExists:a,alternateRoot:i,alternateRootExists:s,dualRoots:a&&s}}async function Iw(t){let e=[t.openSpecRoot,t.changesDir,t.archiveDir,t.specsDir,t.superpowersRoot,t.superpowersSpecsDir,t.superpowersPlansDir,t.superpowersReportsDir];for(let r of e){let n=W(t.projectRoot,r);await j(t.projectRoot,n,{label:`Classic managed physical path ${n}`,expected:"directory"})}}async function He(t,e){let r=await Nw(t,e);if(await Iw(r.paths),!r.configuredRootExists){let n=W(r.paths.projectRoot,r.paths.openSpecRoot),i=W(r.paths.projectRoot,r.alternateRoot);throw new _t(`Configured Classic OpenSpec root is missing: ${n} (alternate ${i} is ${r.alternateRootExists?"present":"missing"})`)}return r.paths}async function ys(t,e){let r=Y.join(Y.resolve(t),".comet","classic-root-move.json");if(await yi(r))throw new Error("Classic root move transaction is incomplete; inspect it with comet doctor and recover it explicitly before writing");let n=await He(t,e);if(!await yi(n.openSpecRoot))throw new Error(`Configured Classic OpenSpec root is missing: ${W(n.projectRoot,n.openSpecRoot)}`);return n}function W(t,e){return Y.relative(Y.resolve(t),e).replaceAll("\\","/")}import{promises as $w}from"fs";import wr from"path";de();be();J();import gr from"path";var vs=Number.MAX_SAFE_INTEGER;function yu(t,e,r){let n=gr.resolve(t),i=gr.isAbsolute(e)?gr.resolve(e):gr.resolve(n,e),o=gr.relative(n,i).replaceAll("\\","/");return{root:n,relative:Et(o,r),target:i}}async function Ce(t,e,r){let n=yu(t,e,r.label);return j(n.root,n.relative,r)}async function st(t,e,r){return(await Ce(t,e,{label:r.label,expected:r.expected??"any"})).exists}async function vu(t,e,r,n){return await st(t,e,{label:r,expected:"file"})?(await bu(t,e,{label:r,hooks:n})).byteLength>0:!1}async function ze(t,e,r){return(await bu(t,e,r)).toString("utf8")}async function bu(t,e,r){let n=yu(t,e,r.label);return(await L(n.root,n.relative,r.maxBytes??vs,{label:r.label,hooks:r.hooks})).bytes}function Gn(t){return t?/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(t)?t.includes("..")?"Change name cannot contain '..' (path traversal not allowed)":null:`Invalid change name: '${t}'
|
|
143
|
+
Valid format: lowercase kebab-case (a-z, 0-9, single hyphens)`:"Change name cannot be empty"}function yr(t){let e=Gn(t);if(e)throw new Error(e)}function Ww(t,e){return{label:W(t,e),directory:e}}async function Un(t,e,r){let n=Ww(t,e);if(!(await Ce(t,e,{label:r,expected:"directory"})).exists)return{change:n,exists:!1,stateExists:!1};let o=await Ce(t,wr.join(e,".comet.yaml"),{label:`${r} state`,expected:"file"});return{change:n,exists:!0,stateExists:o.exists}}function ku(t,e){let r=e.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`^\\d{4}-\\d{2}-\\d{2}-${r}$`,"u").test(t)}async function Dw(t,e,r,n={}){if(!n.skipExactCompatibility){let s=await Un(t,wr.join(e,r),`Classic archived change ${r}`);if(s.exists)return s.change}if(!(await Ce(t,e,{label:"Classic archive directory",expected:"directory"})).exists)return null;let o=[];for(let s of await $w.readdir(e,{withFileTypes:!0})){if(!ku(s.name,r))continue;let a=await Un(t,wr.join(e,s.name),`Classic archived change ${s.name}`);a.exists&&a.stateExists&&o.push(a.change)}return o.sort((s,a)=>a.directory.localeCompare(s.directory))[0]??null}async function at(t,e=process.cwd()){yr(t);let r=await He(e),n=await Un(r.projectRoot,wr.join(r.changesDir,t),`Classic active change ${t}`);return{...n.change,exists:n.exists,stateExists:n.stateExists}}async function bs(t,e=process.cwd(),r={}){yr(t);let n=await He(e);if(r.preferredArchiveName!==void 0){let i=r.preferredArchiveName;if(i!==t&&!ku(i,t))throw new Error(`Classic preferred archive name '${i}' does not belong to change '${t}'`);let o=await Un(n.projectRoot,wr.join(n.archiveDir,i),`Classic preferred archived change ${i}`);return o.exists&&o.stateExists?o.change:null}return Dw(n.projectRoot,n.archiveDir,t,r)}import{promises as ks}from"fs";import te from"path";import{fileURLToPath as qw}from"node:url";function Cu(t){return[...new Set(t.flatMap(e=>{let r=e.trim();if(!r)return[];if(/^file:/iu.test(r))try{return[qw(r)]}catch{return[r]}return/^[A-Za-z]:/u.test(r)?[r]:/^[A-Za-z][A-Za-z0-9+.-]*:/u.test(r)?[]:[r]}))]}function Su(t,e){let r=te.relative(t,e);return r===""||r!==".."&&!r.startsWith(`..${te.sep}`)&&!te.isAbsolute(r)}async function Mw(t){let e=te.resolve(t),r=te.parse(e).root,n=[],i=e;for(;i&&i!==r;)try{let o=await ks.realpath(i);return te.join(o,...n.reverse())}catch(o){let s=o.code;if(s!=="ENOENT"&&s!=="ENOTDIR")throw o;n.push(te.basename(i)),i=te.dirname(i)}try{let o=await ks.realpath(r);return te.join(o,...n.reverse())}catch{return null}}async function Eu(t,e){let r=te.resolve(t),n=await ks.realpath(r),i=[],o=[];for(let s of Cu(e)){let a=te.isAbsolute(s)?te.resolve(s):te.resolve(r,s),c=await Mw(a);((c?Su(n,c):Su(r,a))?i:o).push(s)}return{projectTargets:i,externalTargets:o}}Ss();import{AsyncLocalStorage as Uw}from"node:async_hooks";import{performance as Kn}from"node:perf_hooks";var Gw=0,Kw=0,Hw=new Uw;function Pu(t=0){Gw+=1,Kw+=t;let e=Hw.getStore();e&&(e.gitCommands+=1,e.gitDurationMs+=t)}function ct(t){let e=Kn.now();try{return t()}finally{Pu(Kn.now()-e)}}async function Ru(t){let e=Kn.now();try{return await t()}finally{Pu(Kn.now()-e)}}var Gs=Ve($e(),1);Lt();import{execFileSync as bf}from"child_process";import{promises as sv}from"fs";import kf from"path";import Ee from"path";import{promises as Qy}from"node:fs";import{AsyncLocalStorage as Zy}from"node:async_hooks";ms();import{randomUUID as cy}from"node:crypto";import{promises as lt}from"node:fs";import Bu from"node:os";import Fu from"node:path";import{promises as Du}from"node:fs";import{execFile as Xw,execFileSync as Qw}from"node:child_process";import br from"node:path";import{existsSync as zw}from"node:fs";import vr from"node:path";var Jw=/[&|<>()^%"!\r\n]/u,cS=["$ProgressPreference = 'SilentlyContinue'","$encoded = $env:COMET_COMMAND_PAYLOAD","Remove-Item Env:COMET_COMMAND_PAYLOAD -ErrorAction SilentlyContinue","$json = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($encoded))","$payload = ConvertFrom-Json $json","$commandArgs = @($payload.arguments)","& $payload.command @commandArgs","if ($null -eq $LASTEXITCODE) { if ($?) { exit 0 } else { exit 1 } }","exit $LASTEXITCODE"].join("; ");function Ou(t,e){let r=e.toLowerCase();return Object.entries(t).find(([n,i])=>n.toLowerCase()===r&&i!==void 0)?.[1]}function Yw(t){let e=(Ou(t,"PATHEXT")??".COM;.EXE;.BAT;.CMD").split(";").map(r=>r.trim().toLowerCase()).filter(Boolean);return[...new Set([...e,".ps1"])]}function Vw(t,e,r){let i=vr.win32.isAbsolute(t)||/[\\/]/u.test(t)?[""]:(Ou(e,"PATH")??"").split(vr.delimiter).map(a=>a.trim().replace(/^"(.*)"$/u,"$1")).filter(Boolean),s=vr.win32.extname(t)?[t]:Yw(e).map(a=>`${t}${a}`);return i.flatMap(a=>s.map(c=>a?vr.join(a,c):vr.resolve(r,c)))}function Hn(t,e,r){return Vw(t,e,r).find(n=>zw(n))??t}function Es(t){if(t.some(e=>Jw.test(e)))throw new Error("Windows batch check arguments must not contain shell syntax")}var Au=6e4,Tu=8*1024*1024;async function Je(t,e,r={}){let n=r.timeoutMs??Au,i=r.maxBufferBytes??Tu;if(!Number.isSafeInteger(n)||n<1||!Number.isSafeInteger(i)||i<1)throw new Error("External command limits must be positive integers");let o=br.resolve(r.cwd??process.cwd()),s=r.env??process.env,a=process.platform==="win32"?Hn(t,s,o):t,c=process.platform==="win32"&&/\.(?:bat|cmd)$/iu.test(a);c&&Es(e);let l=()=>new Promise((u,f)=>{let d=!1,p=Xw(a,[...e],{cwd:o,env:s,encoding:"utf8",maxBuffer:i,windowsHide:!0,shell:c},(y,b,k)=>{d||(d=!0,clearTimeout(g),r.signal?.removeEventListener("abort",m),y?f(new Se(t,e,k.trim(),{cause:y,timedOut:Nu(y)})):u(b))}),h=y=>{d||(d=!0,clearTimeout(g),r.signal?.removeEventListener("abort",m),p.kill("SIGKILL"),p.stdin?.destroy(),p.stdout?.destroy(),p.stderr?.destroy(),p.unref(),f(new Se(t,e,"",{timedOut:y})))},m=()=>h(!1),g=setTimeout(()=>h(!0),n);r.signal?.addEventListener("abort",m,{once:!0}),r.signal?.aborted&&m(),p.stdin?.end(r.input)});return/^(?:git|git\.exe)$/iu.test(br.win32.basename(t))?Ru(l):l()}var Se=class extends Error{constructor(r,n,i,o){super(`${r} ${n.join(" ")} failed${i?`: ${i}`:""}`,o);this.command=r;this.args=n;this.stderr=i;this.name="ExternalCommandError",this.timedOut=o?.timedOut===!0}command;args;stderr;timedOut};function Nu(t){return t instanceof Error&&(t.code==="ETIMEDOUT"||t.killed===!0&&t.signal==="SIGTERM")}function Iu(t,e,r={}){let n=r.timeoutMs??Au,i=r.maxBufferBytes??Tu;if(!Number.isSafeInteger(n)||n<1)throw new Error("External command timeout must be a positive integer");if(!Number.isSafeInteger(i)||i<1)throw new Error("External command max buffer must be a positive integer");let o=br.resolve(r.cwd??process.cwd()),s=r.env??process.env,a=process.platform==="win32"?Hn(t,s,o):t,c=br.win32.extname(a).toLowerCase(),l=c===".bat"||c===".cmd";process.platform==="win32"&&l&&Es(e);try{let u=()=>Qw(a,[...e],{cwd:o,env:s,...r.input!==void 0?{input:r.input}:{},encoding:"utf8",stdio:[r.input===void 0?"ignore":"pipe","pipe","pipe"],timeout:n,maxBuffer:i,windowsHide:!0,shell:process.platform==="win32"&&l});return/^(?:git|git\.exe)$/iu.test(br.win32.basename(t))?ct(u):u()}catch(u){let f=typeof u.stderr=="string"?u.stderr.trim():Buffer.isBuffer(u.stderr)?u.stderr.toString("utf8").trim():"";throw new Se(t,e,f,{cause:u,timedOut:Nu(u)})}}import{createHash as xs,randomUUID as Zw}from"node:crypto";import{promises as re}from"node:fs";import ey from"node:os";import V from"node:path";var Lu=`using System;
|
|
144
|
+
using System.Runtime.InteropServices;
|
|
145
|
+
class CometProcessIdentity {
|
|
146
|
+
[DllImport("kernel32.dll")] static extern IntPtr OpenProcess(uint access, bool inherit, int pid);
|
|
147
|
+
[DllImport("kernel32.dll")] static extern bool GetProcessTimes(IntPtr process, out long creation, out long exit, out long kernel, out long user);
|
|
148
|
+
[DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr handle);
|
|
149
|
+
static int Main(string[] args) {
|
|
150
|
+
int pid; if(args.Length != 1 || !int.TryParse(args[0], out pid) || pid <= 0) return 1;
|
|
151
|
+
IntPtr handle=OpenProcess(0x1000, false, pid); if(handle == IntPtr.Zero) return 1;
|
|
152
|
+
try { long creation, exit, kernel, user; if(!GetProcessTimes(handle,out creation,out exit,out kernel,out user)) return 1;
|
|
153
|
+
Console.WriteLine(DateTime.FromFileTimeUtc(creation).Ticks.ToString(System.Globalization.CultureInfo.InvariantCulture)); return 0;
|
|
154
|
+
} finally { CloseHandle(handle); }
|
|
155
|
+
}
|
|
156
|
+
}`,ty=xs("sha256").update(Lu).digest("hex"),ry=1e4,zn=new Map;async function _s(t,e){let r=await re.lstat(t,{bigint:!0});if(!r.isFile()||r.isSymbolicLink()||r.size>BigInt(e))throw new Error("Invalid process probe cache");let n=await re.readFile(t),i=await re.lstat(t,{bigint:!0});if(r.ino!==i.ino||r.ctimeNs!==i.ctimeNs||r.size!==i.size)throw new Error("Process probe cache changed");return n}async function $u(t){try{let e=JSON.parse((await _s(V.join(t,"probe.json"),4096)).toString("utf8"));if(!/^probe-[a-f0-9-]+\.exe$/u.test(e.file??""))return null;let r=V.join(t,e.file),n=await _s(r,65536);return xs("sha256").update(n).digest("hex")===e.hash?r:null}catch{return null}}async function ny(t,e){let r,n=Zw(),i=V.join(t,`probe-${n}.cs`),o=V.join(t,`probe-${n}.exe`),s=V.join(t,`probe-${n}.json`);try{if(await re.mkdir(t,{recursive:!0,mode:448}),(await re.lstat(t)).isSymbolicLink())return null;r=await re.open(V.join(t,"prepare.lock"),"wx",384);let a=await $u(t);if(a)return a;await re.writeFile(i,Lu,{flag:"wx",mode:384});let c;for(let u of["Framework64","Framework"]){let f=V.join(e,"Microsoft.NET",u,"v4.0.30319","csc.exe");try{await re.access(f),c=f;break}catch{}}if(!c)return null;await Je(c,["/nologo","/target:exe","/platform:anycpu",`/out:${o}`,i],{timeoutMs:1500,maxBufferBytes:4096});let l=xs("sha256").update(await _s(o,65536)).digest("hex");return await re.writeFile(s,JSON.stringify({file:V.basename(o),hash:l}),{flag:"wx",mode:384}),await re.rename(s,V.join(t,"probe.json")),o}catch{return null}finally{await re.unlink(i).catch(()=>{}),await re.unlink(s).catch(()=>{}),r&&(await r.close().catch(()=>{}),await re.unlink(V.join(t,"prepare.lock")).catch(()=>{}))}}async function ju(t,e,r){try{let n=await Je(V.join(e,"System32","wbem","WMIC.exe"),["process","where",`processid=${t}`,"get","creationdate","/value"],{timeoutMs:300,maxBufferBytes:4096,signal:r}),i=/^CreationDate=(\S+)/mu.exec(n);if(i)return`win32-wmic:${i[1]}`}catch{}if(r.aborted)return null;try{let i=(await Je(V.join(e,"System32","WindowsPowerShell","v1.0","powershell.exe"),["-NoLogo","-NoProfile","-NonInteractive","-Command",`(Get-Process -Id ${t} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks.ToString()`],{timeoutMs:1e3,maxBufferBytes:4096,signal:r})).trim();return/^\d+$/u.test(i)?`win32-ps:${i}`:null}catch{return null}}function iy(t,e){let r=zn.get(t);if(r&&performance.now()<r.retryAfter)return r.promise;let n={promise:ny(t,e),retryAfter:1/0};return zn.set(t,n),n.promise.then(i=>{zn.get(t)===n&&(i?zn.delete(t):n.retryAfter=performance.now()+ry)}),n.promise}async function Wu(t,e={}){if(!Number.isSafeInteger(t)||t<=0)return null;let r=e.systemRoot??process.env.SystemRoot??"C:\\Windows",n=V.join(e.cacheRoot??V.join(ey.tmpdir(),"comet-process-identity"),ty),i=async l=>{if(!l)return null;try{let f=(await Je(l,[String(t)],{timeoutMs:1e3,maxBufferBytes:4096})).trim();return/^\d+$/u.test(f)?`win32-ps:${f}`:null}catch{return null}},o=await $u(n);if(o){let l=await i(o);return l||ju(t,r,new AbortController().signal)}let s=iy(n,r),a=new AbortController,c=l=>{if(!l)throw new Error("Probe unavailable");return l};try{return await Promise.any([s.then(i).then(c),ju(t,r,a.signal).then(c)])}catch{return null}finally{a.abort()}}var Ps=null,oy=1e4,Rs=new Map,Jn=new Map;function sy(t){let e=Rs.get(t);if(e){if(Date.now()-e.at>oy){Rs.delete(t);return}return e.value}}async function Os(t){if(t===process.pid&&Ps!==null)return Ps;let e=sy(t);if(e!==void 0)return e;let r=Jn.get(t);r||(r=ay(t),Jn.set(t,r));let n=await r;return Jn.get(t)===r&&Jn.delete(t),t===process.pid&&n!==null&&(Ps=n),n===null&&Rs.set(t,{value:null,at:Date.now()}),n}async function ay(t){if(!Number.isSafeInteger(t)||t<=0)return null;try{if(process.platform==="linux"){let[e,r]=await Promise.all([Du.readFile(`/proc/${t}/stat`,"utf8"),Du.readFile("/proc/sys/kernel/random/boot_id","utf8")]),n=e.slice(e.lastIndexOf(")")+2).trim().split(/\s+/u)[19];return/^\d+$/u.test(n??"")?`linux:${r.trim()}:${n}`:null}if(process.platform==="win32")return await Wu(t);if(process.platform==="darwin"){let e=(await Je("/bin/ps",["-p",String(t),"-o","lstart="],{timeoutMs:5e3,maxBufferBytes:4096,env:{...process.env,LC_ALL:"C",TZ:"UTC0"}})).trim();return e?`darwin:${e}`:null}}catch{}return null}var qu=new Set(["win32-wmic","win32-ps"]);function Yn(t){let e=t.indexOf(":");return e===-1?"":t.slice(0,e)}async function Mu(t,e){if(!Number.isSafeInteger(t)||t<=0)return"alive";try{process.kill(t,0)}catch(n){if(n.code==="ESRCH")return"dead"}if(!e)return"unknown";let r=await Os(t);return r===e?"alive":r===null||Yn(r)!==Yn(e)&&qu.has(Yn(r))&&qu.has(Yn(e))?"unknown":"dead"}var ly=3e4,uy=20,fy=5*6e4,dy=1e4;async function Uu(t,e,r={}){let n=Fu.resolve(t);await lt.mkdir(Fu.dirname(n),{recursive:!0});let i=Date.now(),o=r.timeoutMs??ly,s=r.retryMs??uy,a=r.malformedLockStaleMs??fy,c=await Os(process.pid),l={pid:process.pid,nonce:cy(),createdAt:Date.now(),hostname:Bu.hostname(),...c===null?{}:{processIdentity:c}},u=!1;for(;!u;){let f;try{f=await lt.open(n,"wx"),await f.writeFile(JSON.stringify(l),"utf8"),u=!0}catch(d){if(d.code!=="EEXIST")throw d;if(await my(n,a))continue;if(Date.now()-i>=o)throw new Error(`Timed out waiting for file lock: ${n}`,{cause:d});await new Promise(p=>setTimeout(p,s))}finally{await f?.close()}}try{return await e()}finally{await py(n,l.nonce)}}async function my(t,e){let r,n;try{[r,n]=await Promise.all([lt.readFile(t,"utf8"),lt.stat(t)])}catch(o){return o.code==="ENOENT"}let i=Gu(r);if(i!==null&&(i.hostname!==void 0&&i.hostname!==Bu.hostname()||await Mu(i.pid,i.processIdentity)!=="dead"))return!1;if(i===null){let o=r.trim().length===0?dy:e;if(Date.now()-Number(n.mtimeMs)<o)return!1}try{return await lt.readFile(t,"utf8")!==r?!1:(await lt.rm(t),!0)}catch(o){return o.code==="ENOENT"}}async function py(t,e){try{if(Gu(await lt.readFile(t,"utf8"))?.nonce!==e)return;await Dn(t)}catch(r){let n=r.code;if(n==="ENOENT")return;process.stderr.write(`[comet] warning: could not remove lock file ${t} (${n??r}); it will be recovered automatically
|
|
157
|
+
`)}}function Gu(t){try{let e=JSON.parse(t);return Number.isSafeInteger(e.pid)&&Number(e.pid)>0&&typeof e.nonce=="string"&&e.nonce.length>0&&typeof e.createdAt=="number"&&Number.isFinite(e.createdAt)&&(e.hostname===void 0||typeof e.hostname=="string"&&e.hostname.length>0)&&(e.processIdentity===void 0||typeof e.processIdentity=="string"&&e.processIdentity.length>0)?{pid:Number(e.pid),nonce:e.nonce,createdAt:e.createdAt,...e.hostname===void 0?{}:{hostname:e.hostname},...e.processIdentity===void 0?{}:{processIdentity:e.processIdentity}}:null}catch{return null}}J();var ni=Ve($e(),1);de();J();ei();var Ms=["full","hotfix","tweak"],ff=1,mf=["open","design","build","verify","archive"],$y=["en","zh-CN"],Wy=["off","beta"],Dy=["subagent-driven-development","executing-plans","direct","autonomous"],qy=["plan-ready"],My=["confirmed"],Fy=["tdd","direct"],By=["off","standard","thorough"],Uy=["current","branch","worktree"],Gy=["light","full"],Ky=["pending","pass","fail"],Hy=["pending","handled"],zy=["pending","confirmed"],ut=["workflow","language","phase","context_compression","build_mode","build_pause","subagent_dispatch","tdd_mode","review_mode","isolation","bound_branch","verify_mode","auto_transition","base_ref","design_doc","plan","verify_result","verify_failures","check_epoch","verification_report","branch_status","created_at","verified_at","archive_confirmation","archived","direct_override","handoff_context","handoff_hash","classic_profile","classic_migration"],Sr=["run_id"],pf=new Set([...ut,...Sr]),Jy=["workflow","phase","design_doc","plan","build_mode","isolation","verify_mode","verify_result","verified_at","archived"];function Ds(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Rt(t,e){let r=t[e];if(r==null||r==="")return null;if(typeof r!="string")throw new Error(`Invalid Classic state: ${e} must be a string or null`);return r}function B(t,e,r,n=!0){let i=t[e];if(i==null||i===""){if(n)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof i!="string"||!r.includes(i))throw new Error(`Invalid Classic state: ${e} must be one of ${r.join(", ")}${n?" or null":""}`);return i}function qs(t,e,r=!0){let n=t[e];if(n==null||n===""){if(r)return null;throw new Error(`Invalid Classic state: ${e} is required`)}if(typeof n!="boolean")throw new Error(`Invalid Classic state: ${e} must be true or false`);return n}function df(t,e,r=0){let n=t[e];if(n==null||n==="")return r;if(typeof n!="number"||!Number.isSafeInteger(n)||n<0)throw new Error(`Invalid Classic state: ${e} must be a non-negative integer`);return n}function ti(t,e){let r=Rt(t,e);if(r===null)return null;if(/^(?:[A-Za-z]:|[\\/]|~)/u.test(r)||r.split(/[\\/]/u).includes(".."))throw new Error(`Invalid Classic state: ${e} must be a relative repository path`);return r}function Yy(t,e){let r=Rt(t,e);if(r!==null&&!/^[a-f0-9]{64}$/u.test(r))throw new Error(`Invalid Classic state: ${e} must be a sha256 hex digest`);return r}function Vy(t){let e=t.classic_migration;if(e==null||e==="")return null;if(e!==ff)throw new Error(`Invalid Classic state: classic_migration must be ${ff}`);return e}function Xy(t){if(!ut.some(r=>Ds(t,r)))return null;for(let r of Jy)if(!Ds(t,r))return null;return{workflow:B(t,"workflow",Ms,!1),language:B(t,"language",$y),phase:B(t,"phase",mf,!1),contextCompression:B(t,"context_compression",Wy),buildMode:B(t,"build_mode",Dy),buildPause:B(t,"build_pause",qy),subagentDispatch:B(t,"subagent_dispatch",My),tddMode:B(t,"tdd_mode",Fy),reviewMode:B(t,"review_mode",By),isolation:B(t,"isolation",Uy),boundBranch:Rt(t,"bound_branch"),verifyMode:B(t,"verify_mode",Gy),autoTransition:qs(t,"auto_transition"),baseRef:Rt(t,"base_ref"),designDoc:ti(t,"design_doc"),plan:ti(t,"plan"),verifyResult:B(t,"verify_result",Ky,!1),verifyFailures:df(t,"verify_failures"),...Ds(t,"check_epoch")?{checkEpoch:df(t,"check_epoch")}:{},verificationReport:ti(t,"verification_report"),branchStatus:B(t,"branch_status",Hy),createdAt:Rt(t,"created_at"),verifiedAt:Rt(t,"verified_at"),archiveConfirmation:B(t,"archive_confirmation",zy),archived:qs(t,"archived",!1),directOverride:qs(t,"direct_override"),handoffContext:ti(t,"handoff_context"),handoffHash:Yy(t,"handoff_hash"),classicProfile:B(t,"classic_profile",Ms),classicMigration:Vy(t)}}function Fs(t,e){let r=e??null;if(r===null&&e===void 0&&t.run_id&&t.skill)try{r=xt(t)}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(i.replace(/^Invalid Run state:/u,"Invalid Classic state:"),{cause:n})}return{classic:Xy(t),run:r,unknownKeys:Object.keys(t).filter(n=>!pf.has(n))}}function hf(t){let e=t.workflow,r=t.phase,n=t.archived,i=t.design_doc;return{workflow:typeof e=="string"&&Ms.includes(e)?e:null,phase:typeof r=="string"&&mf.includes(r)?r:null,archived:n===!0,designDoc:typeof i=="string"&&i!==""?i:null,unknownKeys:Object.keys(t).filter(o=>!pf.has(o))}}ei();var Bs=new Zy,ri=".comet-state-transaction.json";async function ii(t,e){let r=Ee.resolve(t);return Bs.getStore()===r?e():(await j(r,".comet-state.lock",{label:"Classic state lock",expected:"file"}),Uu(Ee.join(r,".comet-state.lock"),()=>Bs.run(r,async()=>(await tv(r),e()))))}async function gf(t,e){try{return(await L(t,e,Number.MAX_SAFE_INTEGER,{label:"Classic state transaction"})).bytes.toString("utf8")}catch(r){if(r.code==="ENOENT")return null;throw r}}function ev(t){if(t===null)return null;if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid Classic transaction Run");let e=t,r=xt({run_id:e.runId,skill:e.skill,skill_version:e.skillVersion,skill_hash:e.skillHash,orchestration:e.orchestration,current_step:e.currentStep,iteration:e.iteration,pending:e.pending,pending_ref:e.pendingRef,trajectory_ref:e.trajectoryRef,context_ref:e.contextRef,artifacts_ref:e.artifactsRef,checkpoint_ref:e.checkpointRef,run_status:e.status,run_retries:e.retries});if(!r)throw new Error("Invalid Classic transaction Run identity");return r}async function tv(t){let e=await gf(t,ri);if(e===null)return;let r=JSON.parse(e);if(!r||r.schema!=="comet.classic.state-transaction.v1"||r.beforeYaml!==null&&typeof r.beforeYaml!="string"||typeof r.afterYaml!="string")throw new Error("Invalid Classic state transaction");let n=await gf(t,".comet.yaml");if(n!==r.beforeYaml&&n!==r.afterYaml)throw new Error("Classic state transaction conflicts with current YAML; preserve files for recovery");let i=ev(n===r.afterYaml?r.afterRun:r.beforeRun);i?await Zn(t,i):await Ws(t),await hr(Ee.join(t,ri),{containedRoot:t})}function At(t){let e=t.toJS();if(e===null)return{};if(typeof e!="object"||Array.isArray(e))throw new Error("Invalid Classic state document: root must be a mapping");return e}function rv(t){let e=["skill","skill_version","skill_hash","orchestration","current_step","iteration","pending","pending_ref","trajectory_ref","context_ref","artifacts_ref","checkpoint_ref","run_status","run_retries"];for(let r of e)t.delete(r)}function nv(t){let e=!1;for(let r of["build_command","verify_command"])t.has(r)&&(t.delete(r),e=!0);return e}async function Us(t){let e;try{e=(await L(Ee.dirname(t),Ee.basename(t),Number.MAX_SAFE_INTEGER,{label:"Classic state document"})).bytes.toString("utf8")}catch(n){if(n.code!=="ENOENT")throw n;return new ni.Document({})}let r=(0,ni.parseDocument)(e);if(r.errors.length>0)throw new Error(`Invalid Classic state document: ${r.errors[0].message}`);return At(r),r}async function Er(t,e={}){if(Bs.getStore()!==Ee.resolve(t)){let r=await iv(t);if(r!==null)return r}return ii(t,()=>ov(t,e))}async function Ot(t,e){let r=await j(t,e,{label:"Classic state snapshot",expected:"file"});if(!r.exists)return{stamp:"missing",comparable:!0};let n=await Qy.lstat(r.target,{bigint:!0});if(!n.isFile()||n.isSymbolicLink())throw new Error("Classic state file changed");return{stamp:[n.dev,n.ino,n.birthtimeNs,n.ctimeNs,n.mtimeNs,n.size].join(":"),comparable:n.dev!==0n&&n.ino!==0n&&n.ctimeNs>0n}}async function wf(t){if((await Ot(t,".comet-state.lock")).stamp!=="missing"||(await Ot(t,ri)).stamp!=="missing")return null;let n=await Ot(t,".comet.yaml"),i=await Ot(t,Pt);return!n.comparable||!i.comparable?null:{yaml:n.stamp,run:i.stamp}}async function iv(t){try{let e=await wf(t);if(e===null)return null;let r=await Us(Ee.join(t,".comet.yaml")),n=At(r);if(r.has("build_command")||r.has("verify_command"))return null;let i=await Qn(t);if(!i&&n.run_id&&n.skill)return null;let o=Fs(n,i),s=await wf(t);return s===null||e.yaml!==s.yaml||e.run!==s.run||(await Ot(t,ri)).stamp!=="missing"||(await Ot(t,".comet-state.lock")).stamp!=="missing"?null:o}catch{return null}}async function ov(t,e){let r=e.migrate!==!1,n=Ee.join(t,".comet.yaml"),i=await Us(n),o=At(i),s=nv(i);s&&(o=At(i));let a=await Qn(t);if(!a&&o.run_id&&o.skill){let{runStateFromDocument:c}=await Promise.resolve().then(()=>(ei(),uf));a=c(o),a&&r&&(await Zn(t,a),rv(i),s=!0)}return s&&r&&await ee(n,i.toString(),{containedRoot:t}),Fs(At(i),a)}async function yf(t){let e=await Us(Ee.join(t,".comet.yaml"));return hf(At(e))}de();J();function av(t){try{let e=ct(()=>bf("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim());return e&&e!=="HEAD"?e:null}catch{return null}}var cv=gi("liveGitBranch",t=>av(t));function lv(t){try{return ct(()=>bf("git",["rev-parse","--is-inside-work-tree"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:1e4,windowsHide:!0}).trim())==="true"}catch{return!1}}var uv=gi("isGitWorkTree",t=>lv(t)),fv=["current","branch","worktree"];function Cf(t){return fv.includes(t)}function dv(t){return Cf(t.isolation)?t.boundBranch===null&&t.currentBranch===null&&t.gitWorkTree===!1?{status:"not-applicable"}:t.boundBranch===null?t.currentBranch===null?{status:"unbound-detached"}:{status:"needs-heal",branch:t.currentBranch}:t.currentBranch===t.boundBranch?{status:"ok"}:{status:"drift",boundBranch:t.boundBranch,currentBranch:t.currentBranch}:{status:"not-applicable"}}async function _r(t,e){return e.heal?ii(t,()=>vf(t,e)):vf(t,e)}async function vf(t,e){let r=kf.join(t,".comet.yaml"),n=(0,Gs.parseDocument)(await sv.readFile(r,"utf8"),{uniqueKeys:!1});if(n.errors.length>0)throw new Error(`Invalid .comet.yaml: ${n.errors[0].message}`);let i=n.toJS()??{},o=typeof i.isolation=="string"?i.isolation:null,s=typeof i.bound_branch=="string"&&i.bound_branch!==""?i.bound_branch:null,a=Cf(o),c=cv(e.cwd),l=a&&s===null&&c===null?uv(e.cwd):!0,u=dv({isolation:o,boundBranch:s,currentBranch:c,gitWorkTree:l});return u.status==="needs-heal"&&e.heal?(await mv(t,u.branch),{status:"healed",branch:u.branch,bindingRequired:a,currentBranch:c}):{...u,bindingRequired:a,currentBranch:c}}async function mv(t,e){return ii(t,()=>pv(t,e))}async function pv(t,e){let r=kf.join(t,".comet.yaml"),n=(await L(t,".comet.yaml",vs,{label:"Classic branch binding"})).bytes.toString("utf8"),i=(0,Gs.parseDocument)(n,{uniqueKeys:!1});if(i.errors.length)throw new Error(`Invalid .comet.yaml: ${i.errors[0].message}`);i.set("bound_branch",e),await ee(r,i.toString(),{containedRoot:t})}function hv(t){return t??"detached HEAD"}function xr(t,e,r){return`change '${t}' is bound to branch '${e}', but current branch is '${hv(r)}'. Next: switch to branch '${e}' and rerun, or run comet state rebind ${t} after the user explicitly confirms this branch should take over the change`}function Pr(t){return`change '${t}' uses a branch-bound workspace mode but has no bound branch and HEAD is detached; checkout a branch first before continuing.`}Ls();Lt();var Pf=Ve($e(),1);J();import U from"node:path";import{createHash as ai,randomUUID as g_}from"node:crypto";import{promises as yv}from"node:fs";var gv=new Set(["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_GRAFT_FILE","GIT_SHALLOW_FILE","GIT_PREFIX","GIT_IMPLICIT_WORK_TREE","GIT_NO_REPLACE_OBJECTS","GIT_REPLACE_REF_BASE","GIT_CONFIG","GIT_CONFIG_PARAMETERS","GIT_CONFIG_COUNT"]);function wv(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>{let r=e.toUpperCase();return!gv.has(r)&&!/^GIT_CONFIG_(KEY|VALUE)_\d+$/u.test(r)}))}function Sf(t){return{...wv(t.environment),...t.authentication?{}:{GIT_CONFIG_GLOBAL:process.platform==="win32"?"NUL":"/dev/null",GIT_CONFIG_NOSYSTEM:"1"},GIT_TERMINAL_PROMPT:"0",GCM_INTERACTIVE:"never",SSH_ASKPASS_REQUIRE:"never",GIT_NO_REPLACE_OBJECTS:"1",GH_PROMPT_DISABLED:"1"}}function ft(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Classic progress requires a JSON object");return t}function Hs(t,e){let r=Object.keys(t).filter(n=>!e.includes(n));if(r.length)throw new Error(`Unknown Classic progress field(s): ${r.join(", ")}; allowed fields: ${e.join(", ")}`)}function me(t,e){if(typeof t!="string"||!t.trim()||t.length>4096||[...t].some(r=>r.charCodeAt(0)<32||r.charCodeAt(0)===127))throw new Error(`Invalid Classic progress ${e}`);return t}async function vv(t,e,r){let n=U.join(e,".comet",r);if(await st(t,n,{label:"Classic progress",expected:"file"}))return JSON.parse(await ze(t,n,{label:"Classic progress"}))}function bv(t,e){let r=ai("sha256").update(e).digest("hex");return U.join(t,".comet","runtime","classic-delivery",`${r}.json`)}async function kv(t,e){let r=bv(t,e);if(!await st(t,r,{label:"Classic delivery reauthorization",expected:"file"}))return null;let n=ft(JSON.parse(await ze(t,r,{label:"Classic delivery reauthorization"})));if(Hs(n,["schemaVersion","changeIdentity","previousAuthorizationId","authorizationId","action","targetBranch","remote","authorizedRemoteUrl"]),n.schemaVersion!==1||n.changeIdentity!==e)throw new Error("Classic delivery reauthorization identity is invalid");let i=zs({action:n.action,targetBranch:n.targetBranch,...n.remote===void 0?{}:{remote:n.remote}},!0);if(i.action==="archive-only")throw new Error("Classic archive-only delivery cannot be reauthorized");if(i.commit!==void 0||i.prUrl!==void 0)throw new Error("Classic delivery reauthorization cannot change sealed commit or PR evidence");return{schemaVersion:1,changeIdentity:e,previousAuthorizationId:me(n.previousAuthorizationId,"previousAuthorizationId"),authorizationId:me(n.authorizationId,"authorizationId"),...i,targetBranch:i.targetBranch,...n.authorizedRemoteUrl===void 0?{}:{authorizedRemoteUrl:me(n.authorizedRemoteUrl,"authorizedRemoteUrl")}}}function zs(t,e=!1){let r=ft(t);if(Hs(r,["action","targetBranch","remote","commit","prUrl",...e?["schemaVersion","changeIdentity","authorizedRemoteUrl","authorizationId"]:[]]),!["local","push","pr","archive-only"].includes(r.action))throw new Error(`Invalid Classic delivery action '${String(r.action)}'; actions: local|push|pr|archive-only`);if(r.action==="archive-only"){if(r.targetBranch!==void 0||r.remote!==void 0||r.commit!==void 0||r.prUrl!==void 0)throw new Error("Classic archive-only delivery cannot claim a Git branch, remote, commit, or PR");return{action:"archive-only"}}let n=me(r.targetBranch,"targetBranch");if(n.startsWith("-")||/[~^:?*[\\\s]/u.test(n)||n.includes("..")||n.includes("@{"))throw new Error("Invalid Classic delivery targetBranch");let i={action:r.action,targetBranch:n};if(r.remote!==void 0){let o=me(r.remote,"remote");if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]{0,99}$/u.test(o))throw new Error("Classic delivery remote must be a name, not a URL");i.remote=o}if(r.commit!==void 0){let o=me(r.commit,"commit");if(!/^(?:[a-fA-F0-9]{40}|[a-fA-F0-9]{64})$/u.test(o))throw new Error("Classic delivery commit must be a full object ID");i.commit=o.toLowerCase()}if(r.prUrl!==void 0){let o=me(r.prUrl,"prUrl"),s=new URL(o);if(s.protocol!=="https:"||s.username||s.password)throw new Error("Invalid Classic delivery prUrl");i.prUrl=o}return i}function Rf(t){let e=(0,Pf.parseDocument)(t,{uniqueKeys:!0});if(e.errors.length)throw new Error("Invalid Classic delivery change state");return ft(e.toJS())}function Cv(t,e,r){return typeof t.run_id=="string"&&t.run_id?`run:${t.run_id}`:Of(t,e,r)}function Of(t,e,r){let n=t.archived===!0||U.basename(U.dirname(e))==="archive"?U.basename(e).replace(/^\d{4}-\d{2}-\d{2}-/u,""):U.basename(e);if(typeof t.created_at!="string"||typeof t.base_ref!="string"&&t.base_ref!==null)throw new Error("Classic delivery requires stable change identity");return`legacy:${ai("sha256").update(JSON.stringify([n,t.created_at,t.base_ref??U.resolve(r)])).digest("hex")}`}function Af(t,e,r,n){let i=Cv(e,r,n);if(t===i)return i;if(typeof t=="string"&&t.startsWith("legacy:")&&t===Of(e,r,n))return t;throw new Error("Classic delivery change identity mismatch")}async function Sv(t,e){return Rf(await ze(t,U.join(e,".comet.yaml"),{label:"Classic delivery state"}))}var si=class extends Error{constructor(e,r){super(`Classic delivery git command timed out: ${[e,...r].join(" ")}`)}};function Ks(t,e,r,n){return Iu(e,r,{cwd:t,timeoutMs:5e3,env:Sf({authentication:n})}).trim()}function Ar(t,e,r,n=!1){try{return Ks(t,e,r,n)}catch{return null}}function Ev(t,e,r,n=!1){try{return Ks(t,e,r,n)}catch(i){if(!(i instanceof Se)||!i.timedOut)return null;try{return Ks(t,e,r,n)}catch(o){if(o instanceof Se&&o.timedOut)throw new si(e,r);return null}}}function Rr(t,e){return Ar(t,"git",["-C",t,...e])}function Or(t,e){return Ev(t,"git",["-C",t,...e])}function Ef(t,e,r=!1){return Ar(t,"git",["-C",t,"remote","get-url",...r?["--push"]:[],e],!0)}function _v(t,e){let r=U.relative(t,e).replaceAll("\\","/");return[`:(literal)${r}`,...[".comet-state.lock",".comet-state-transaction.json"].map(n=>`:(exclude,literal)${r}/${n}`)]}function _f(t,e,r,n){let i=U.relative(t,e).replaceAll("\\","/"),o=_v(t,e),s=Or(t,["show",`${r}:${i}/.comet.yaml`]);if(!s)return!1;try{let a=Rf(s);return a.archived===!0&&Af(n,a,e,t)===n&&Or(t,["merge-base","--is-ancestor",r,"HEAD"])!==null&&Or(t,["diff","--quiet","--no-ext-diff","--no-textconv",r,"--",...o])!==null&&Or(t,["ls-files","--others","--exclude-standard","--",...o])===""}catch(a){if(a instanceof si)throw a;return!1}}async function xv(t,e){let r={},n=async i=>{await Ce(t,i,{label:"Classic document archive",expected:"directory"});let o=(await yv.readdir(i,{withFileTypes:!0})).sort((s,a)=>s.name<a.name?-1:s.name>a.name?1:0);for(let s of o){if([".comet-state.lock",".comet-state-transaction.json"].includes(s.name))continue;let a=U.join(i,s.name);if(s.isDirectory())await n(a);else if(s.isFile()){let c=U.relative(t,a).replaceAll("\\","/"),l=await au(t,c,{label:"Classic document archive file"});r[c]=l.digest}else throw new Error(`Classic document archive contains unsupported entry: ${a}`);if(Object.keys(r).length>1e4)throw new Error("Classic document archive has too many files")}};return await n(e),r}function Pv(t,e){let r=Object.keys(t);return r.length===Object.keys(e).length&&r.every(n=>t[n]===e[n])}function Rv(t,e){let r=`${ai("sha256").update(e).digest("hex")}.json`,n=Or(t,["rev-parse","--path-format=absolute","--git-common-dir"]);return[{root:t,file:U.join(t,".comet","classic-deliveries",r)},...n?[{root:n,file:U.join(n,"comet","classic-deliveries",r)}]:[]]}async function Ov(t,e){let r=null;for(let n of Rv(t,e)){if(!await st(n.root,n.file,{label:"Classic delivery receipt",expected:"file"}))continue;let i=ft(JSON.parse(await ze(n.root,n.file,{label:"Classic delivery receipt"})));if(Hs(i,["schemaVersion","changeIdentity","authorizationId","invalidated","commit","prUrl","archiveFiles"]),i.schemaVersion!==1||i.changeIdentity!==e)throw new Error("Invalid Classic delivery receipt schema or identity");if(i.invalidated!==void 0&&typeof i.invalidated!="boolean")throw new Error("Invalid Classic delivery receipt invalidation");let o=zs({action:"local",targetBranch:"main",...i.commit!==void 0?{commit:i.commit}:{},...i.prUrl!==void 0?{prUrl:i.prUrl}:{}}),s={schemaVersion:1,changeIdentity:e,authorizationId:me(i.authorizationId,"authorizationId"),...i.invalidated===!0?{invalidated:!0}:{},...o.commit?{commit:o.commit}:{},...o.prUrl?{prUrl:o.prUrl}:{},...i.archiveFiles===void 0?{}:{archiveFiles:Av(i.archiveFiles)}};if(r&&JSON.stringify(r)!==JSON.stringify(s))throw new Error("Conflicting Classic delivery receipts");r=s}return r}function Av(t){if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Invalid Classic document archive receipt");let e=t;if(Object.keys(e).length===0||Object.keys(e).length>1e4||Object.entries(e).some(([r,n])=>r.startsWith("/")||r.includes("\\")||r.split("/").some(i=>!i||i==="."||i==="..")||typeof n!="string"||!/^[a-f0-9]{64}$/u.test(n)))throw new Error("Invalid Classic document archive receipt");return e}function Tv(t){return t.authorizationId===void 0?`legacy:${ai("sha256").update(JSON.stringify(t)).digest("hex")}`:me(t.authorizationId,"authorizationId")}function xf(t,e,r){return e===r||Rr(t,["merge-base","--is-ancestor",e,r])!==null}function Nv(t){let e=/^git@([^:/]+):([^/]+\/[^/]+)$/u.exec(t);try{let r=new URL(e?`ssh://git@${e[1]}/${e[2]}`:t);if(!["https:","ssh:"].includes(r.protocol)||r.password||r.search||r.hash||r.port||r.protocol==="https:"&&r.username)return null;let n=r.pathname.replace(/\.git\/?$/u,"").replace(/\/$/u,"").split("/").filter(Boolean);return n.length!==2||n.some(i=>!/^[a-zA-Z0-9_.-]+$/u.test(i))?null:`${r.hostname}/${n.join("/")}`.toLowerCase()}catch{return null}}function oi(t,e){try{let r=new URL(t);if(r.protocol!=="https:"||r.username||r.password||r.port||r.search||r.hash)return null;let n=/^\/([^/]+)\/([^/]+)\/pull\/([1-9]\d*)\/?$/u.exec(r.pathname);return n&&`${r.hostname}/${n[1]}/${n[2]}`.toLowerCase()===e?`https://${r.hostname}/${n[1]}/${n[2]}/pull/${n[3]}`:null}catch{return null}}async function Js(t,e,r={}){let n=await vv(t,e,"delivery.json");if(n===void 0)return{delivery:null,verification:{status:"needsAuthorization"}};let i=ft(n);if(i.schemaVersion!==1)throw new Error("Unsupported Classic delivery schemaVersion");let o=zs(i,!0),s=await Sv(t,e),a=Af(i.changeIdentity,s,e,t),c=Tv(i),l=await kv(t,a);if(l&&l.previousAuthorizationId!==c)throw new Error("Classic delivery reauthorization is stale for the sealed authorization");let u=l?{action:l.action,targetBranch:l.targetBranch,...l.remote===void 0?{}:{remote:l.remote}}:o,f=l?.authorizationId??c,d=await Ov(t,a),p=d?.authorizationId===f?d:null;if(p?.invalidated)return{delivery:null,verification:{status:"needsAuthorization",invalidated:!0}};for(let N of["commit","prUrl"]){if(N==="commit"&&p?.[N]&&u[N]&&p[N]!==u[N])throw new Error("Classic delivery receipt conflicts with authorization evidence");p?.[N]&&(u[N]=p[N])}let h=i.authorizedRemoteUrl===void 0?void 0:me(i.authorizedRemoteUrl,"authorizedRemoteUrl"),m=l?.authorizedRemoteUrl??h,g={...u,schemaVersion:1,changeIdentity:a,authorizationId:f,...m?{authorizedRemoteUrl:m}:{}};if(u.action==="archive-only"){let N=!1;if(s.archived===!0&&p?.archiveFiles!==void 0){let ae=await xv(t,e).catch(Nt=>{let It=Nt?.code;if(It==="ENOENT"||It==="ENOTDIR")return null;throw Nt});N=ae!==null&&Pv(p.archiveFiles,ae)}return{delivery:g,verification:{status:N?"complete":"needsVerification",archiveVerified:N}}}let y=Rr(t,["symbolic-ref","--quiet","--short","HEAD"]),b=U.relative(t,e).replaceAll("\\","/"),k=null;!u.commit&&s.archived===!0&&(k=Rr(t,["log","-20","--format=%H","HEAD","--",`:(literal)${b}/.comet.yaml`])?.split(/\r?\n/u).find(ae=>/^[a-f0-9]{40,64}$/u.test(ae)&&_f(t,e,ae,a))??null);let C=u.commit??k,S=!!C&&Rr(t,["cat-file","-t",C])==="commit",E=s.archived===!0&&S&&_f(t,e,C,a),P=y===u.targetBranch&&(!s.bound_branch||l!==null||s.bound_branch===y)&&E,v=!1,O=!1,se=null,pe=r.verifyRemote&&u.action!=="local"?"unavailable":"notChecked",R="notChecked";if(r.verifyRemote&&P&&u.action!=="local"&&u.remote&&m&&Ef(t,u.remote)===m&&Ef(t,u.remote,!0)===m){let N=`refs/heads/${u.targetBranch}`,ae=Ar(t,"git",["-C",t,"-c","protocol.allow=never","-c","protocol.https.allow=always","-c","protocol.ssh.allow=always","-c","protocol.file.allow=always","ls-remote","--refs",u.remote,N],!0),Nt=ae?.split(/\r?\n/u)??[],It=Nt.length===1?/^([a-f0-9]{40}|[a-f0-9]{64})\t(.+)$/u.exec(Nt[0]):null,jt=It?.[2]===N?It[1]:null;v=!!C&&!!jt&&xf(t,C,jt),pe=v?"verified":ae===""?"missing":ae===null||!jt||Rr(t,["cat-file","-t",jt])!=="commit"?"unavailable":"missing";let he=Nv(m),ui=he&&u.prUrl?oi(u.prUrl,he):null,fi=v||ae==="",ra=Q=>Q.headRefName===u.targetBranch&&typeof Q.headRefOid=="string"&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u.test(Q.headRefOid)&&(v?Q.headRefOid===jt&&["OPEN","MERGED"].includes(Q.state):ae===""&&Q.state==="MERGED"&&!!C&&xf(t,C,Q.headRefOid));if(fi&&u.action==="pr"&&(R="unavailable"),fi&&u.action==="pr"&&ui&&he){let Q=Ar(t,"gh",["pr","view",ui,"--repo",he,"--json","url,headRefName,headRefOid,state"],!0);try{let ge=Q?ft(JSON.parse(Q)):null;O=!!ge&&typeof ge.url=="string"&&oi(ge.url,he)===ui&&ra(ge),R=O?"verified":ge?"missing":"unavailable"}catch{O=!1,R="unavailable"}}else if(fi&&u.action==="pr"&&!u.prUrl&&he){let Q=Ar(t,"gh",["pr","list","--repo",he,"--head",u.targetBranch,"--state","all","--json","url,headRefName,headRefOid,state","--limit","100"],!0);try{let ge=Q===null?null:JSON.parse(Q);if(!Array.isArray(ge)||ge.length>=100)throw new Error("Incomplete PR discovery");let di=ge.map(ft).filter(mi=>typeof mi.url=="string"&&oi(mi.url,he)&&ra(mi));di.length===1?(se=oi(di[0].url,he),O=!0,R="verified"):R=di.length===0?"missing":"unavailable"}catch{R="unavailable"}}}return{delivery:g,verification:{status:P&&(u.action==="local"||(u.action==="push"?v:O))?"complete":"needsVerification",currentBranch:y,commitExists:S,archiveCommitted:E,observedCommit:k,observedPrUrl:se,remoteVerified:v,prVerified:O,remoteStatus:pe,prStatus:R}}}var Iv=Ve($e(),1);var __=8*1024*1024;import{AsyncLocalStorage as Tf}from"node:async_hooks";var j_=new Tf,L_=new Tf;Ke();Bn();J();be();de();var jv=_e("readCometCurrentSelection",t=>js(t));async function Lv(t,e){yr(e);let r=await at(e,t);if(!r.stateExists)throw new Error(`Cannot select current change '${e}': active change state not found`);let n=await Er(r.directory,{migrate:!1});if(!n.classic)throw new Error(`Cannot select current change '${e}': Classic state is incomplete`);if(n.classic.archived)throw new Error(`Cannot select current change '${e}': change is archived`);return r.directory}async function Nf(t){let e;try{e=await jv(t)}catch(o){return{status:"stale",reason:o instanceof Error?o.message:String(o)}}if(e.status==="missing")return{status:"missing"};if(e.selection.workflow!=="classic")return{status:"stale",reason:`current change '${e.selection.change}' belongs to Native, not Classic`};let r=e.selection,n;try{n=await Lv(t,r.change)}catch(o){try{let s=await bs(r.change,t);if(!s)throw o;let a=await Er(s.directory,{migrate:!1}),c=await Js(t,s.directory);if(!a.classic?.archived||["complete","local-verified"].includes(c.verification.status))throw o;n=s.directory}catch(s){return{status:"stale",reason:s instanceof Error?s.message:String(s)}}}let i=await _r(n,{heal:!1,cwd:t});return i.status==="drift"?{status:"stale",reason:xr(r.change,i.boundBranch,i.currentBranch)}:i.status==="unbound-detached"?{status:"stale",reason:Pr(r.change)}:i.status==="ok"?{status:"selected",selection:r}:r.branch!==null&&i.currentBranch!==r.branch?{status:"stale",reason:`current change '${r.change}' was selected on branch '${r.branch}', current branch is '${i.currentBranch??"detached HEAD"}'`}:{status:"selected",selection:r}}function Ys(t){return t==="zh-CN"?"zh-CN":"en"}function If(t,e,r){return t==="zh-CN"?r:e}function jf(t,e){let n={open:{en:"Source code edits are paused while the request is still being clarified.",zh:"需求仍在澄清中,暂时不修改源代码。"},design:{en:"Source code edits are paused until the design is agreed and recorded.",zh:"方案确定并记录之前,暂不修改源代码。"},build:{en:"A required design or plan record is missing, so source edits stay paused.",zh:"缺少必需的设计或计划记录,源代码修改暂被搁置。"},verify:{en:"Implementation edits are paused during verification; only verification output is accepted.",zh:"验证期间暂停修改实现,仅接受验证产出。"},archive:{en:"Source code edits are paused while the change is being archived.",zh:"归档期间暂不修改源代码。"}}[t]??{en:"This write is paused by the current workflow stage.",zh:"当前工作流阶段暂不允许这次写入。"};return{summary:If(e,"This write was blocked on purpose, not by an error.","这次写入是被有意拦下的,不是发生了错误。"),user_message:If(e,n.en,n.zh)}}function Lf(t){if(t.workflow!=="full")return{missingFields:[],invalidFields:[]};let e=[],r=[];return t.buildMode||e.push("build_mode"),t.tddMode||e.push("tdd_mode"),t.reviewMode||e.push("review_mode"),t.buildMode==="subagent-driven-development"&&t.subagentDispatch!=="confirmed"&&e.push("subagent_dispatch"),t.buildMode==="autonomous"&&t.reviewMode==="off"&&r.push({field:"review_mode",reason:"autonomous full build requires review_mode=standard or thorough"}),t.buildMode==="direct"&&t.directOverride!==!0&&r.push({field:"direct_override",reason:"full workflow direct execution requires direct_override=true"}),{missingFields:e,invalidFields:r}}var $f=Ve($e(),1);import dt from"node:path";async function Vs(t,e,r,n={}){if(r.workflow!=="full"||r.buildMode!=="autonomous")return[];let i=[];if(n.requirePlan!==!1){let o=Lf(r);o.missingFields.includes("tdd_mode")&&i.push("tdd_mode must be selected for autonomous full build"),o.missingFields.includes("review_mode")&&i.push("review_mode must be selected for autonomous full build"),o.invalidFields.some(({field:s})=>s==="review_mode")&&i.push("review_mode must be standard or thorough for autonomous full build"),r.isolation||i.push("isolation must be selected for autonomous full build")}if(!r.designDoc||!await vu(t,r.designDoc,"Classic autonomous design"))i.push("design_doc must reference a nonempty technical design for autonomous full build");else{let s=(await ze(t,r.designDoc,{label:"Classic autonomous design"})).replace(/^\uFEFF/u,"").match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/u),a=s?(0,$f.parseDocument)(s[1]):null;(!a||a.errors.length||a.get("comet_change")!==e||a.get("role")!=="technical-design"||a.get("canonical_spec")!=="openspec")&&i.push("design_doc must link the current change and declare role: technical-design and canonical_spec: openspec")}return n.requirePlan!==!1&&(await Xs(t,r.plan,{requireNonempty:!0})).status!=="ready"&&i.push("plan must reference a nonempty implementation plan in the configured plans directory"),i}async function Xs(t,e,r={}){if(!e||e==="null")return{status:"missing",recordedPath:null};let n=await He(t),i=dt.resolve(t,e),o=dt.relative(n.superpowersPlansDir,i);return dt.isAbsolute(e)||!o||o.startsWith(`..${dt.sep}`)||dt.isAbsolute(o)||o.includes(dt.sep)||dt.extname(o).toLowerCase()!==".md"?{status:"broken",recordedPath:e}:await st(t,e,{label:`Classic build plan ${e}`,expected:"file"})&&(!r.requireNonempty||(await ze(t,e,{label:`Classic build plan ${e}`})).trim().length>0)?{status:"ready",recordedPath:e}:{status:"broken",recordedPath:e}}var $v=new Set([".md",".markdown"]),Wv=new Set([".md",".markdown",".rst",".txt"]),Dv=new Set(["docs","doc","documentation",".github"]),qv=[/^LICENSE(?:[.-]|$)/u,/^NOTICE$/u,/^AUTHORS$/u];function Wf(t){return t.replaceAll("\\","/").replace(/^\.\//u,"")}function Mv(t,e){for(let r of e){let n=Wf(r).replace(/\/+$/u,"");if(n&&(t===n||t.startsWith(`${n}/`)))return!0}return!1}function Df(t,e=[]){let r=Wf(t);if(!r||r.endsWith("/")||Mv(r,e))return!1;let n=r.split("/"),i=n[n.length-1],o=i.lastIndexOf("."),s=o===-1?"":i.slice(o).toLowerCase();return n.length===1?$v.has(s)||qv.some(a=>a.test(i)):Dv.has(n[0])&&Wv.has(s)}Ns();Ke();import Fv from"os";import ci from"path";function Bv(t={}){let e=t.cwd??process.cwd(),r=t.homeDir??Fv.homedir(),n=[{file:ci.resolve(e,".comet","config.yaml"),source:".comet/config.yaml",scope:"project"},{file:ci.resolve(r,".comet","config.yaml"),source:"~/.comet/config.yaml",scope:"global"}];return n.filter((i,o)=>n.findIndex(s=>s.file===i.file)===o)}async function qf(t,e={}){for(let r of Bv(e)){let n=ci.dirname(ci.dirname(r.file)),i=r.scope==="global"?(await Ts(n))?.classic:(await it(n,{allowPartialProject:!0}))?.value.classic;if(!i||typeof i!="object"||Array.isArray(i))continue;let o=i[t];if(o!=null)return{value:String(o),source:r.source}}return null}async function Uv(t){let e=await qf("document_evidence",{cwd:t});if(!e)return"neutral";if(e.value==="neutral"||e.value==="strict")return e.value;throw new Error(`classic.document_evidence must be neutral or strict, got '${e.value}' (${e.source})`)}function Gv(t,e){return[W(t,e.openSpecRoot),W(t,e.superpowersRoot)]}async function Mf(t,e,r){return await Uv(t)==="strict"?!1:Df(r,Gv(t,e))}function M(t,e){return{exitCode:t,stderr:e+`
|
|
158
|
+
`}}function oe(t){return M(0,`[COMET-HOOK] allowed: ${t}`)}async function Kv(){if(process.env.FILE_PATH)return process.env.FILE_PATH;if(process.stdin.isTTY)return"";let t=await wi();t.text===null&&(process.stderr.write(`[COMET-HOOK] stdin timeout: the host did not provide hook input within the expected window
|
|
159
|
+
`),process.exit(1));let e=hi(t.text);if(!e)return"";try{let r=JSON.parse(e);return typeof r.tool_input?.file_path=="string"?r.tool_input.file_path:""}catch{return""}}function Tr(t){return t.replaceAll("\\","/").replace(/\/+/gu,"/")}function G(t){let e=Tr(t);return process.platform==="win32"?e.toLowerCase():e}function Hv(t){let e=t.indexOf("--project-root"),r=e>=0?t[e+1]:void 0;return X.resolve(r&&!r.startsWith("--")?r:process.cwd())}function Ff(t,e){let r=Tr(X.relative(e,t));return r===""?"":r.startsWith("../")||r===".."||X.isAbsolute(r)?null:r}async function zv(t){let e=X.resolve(t),r=X.parse(e).root,n=[],i=e;for(;i&&i!==r;)try{let o=await li.realpath(i);return X.join(o,...n.reverse())}catch(o){let s=o.code;if(s!=="ENOENT"&&s!=="ENOTDIR")throw o;n.push(X.basename(i)),i=X.dirname(i)}try{let o=await li.realpath(r);return X.join(o,...n.reverse())}catch{return null}}async function Jv(t,e){let r=X.isAbsolute(t)?t:X.resolve(e,t),n=Tr(r),i=Ff(r,e);if(i!==null)return i;try{let o=await zv(r),s=await li.realpath(e);if(o){let a=Ff(o,s);if(a!==null)return a;n=Tr(o)}}catch{if(!X.isAbsolute(t))return Tr(t).replace(/^\.\//u,"")}return n.replace(/^\.\//u,"")}async function Qs(t){try{let e=await Er(t,{migrate:!1}),r=Array.from(new Set(e.unknownKeys)).sort();if(r.length>0)throw new Error(`Invalid Classic state: unknown field(s): ${r.join(", ")}`);if(!e.classic)throw new Error("Classic state projection is unavailable");return{changeDir:t,phase:e.classic.phase,classic:e.classic,archived:e.classic.archived}}catch(e){let r=await yf(t);return r.phase?{changeDir:t,phase:r.phase,classic:null,archived:r.archived,invalidState:e instanceof Error&&e.message.includes("unknown field")}:null}}async function Yv(t){let e=(await He(t)).changesDir,r=[];if(!(await Ce(t,e,{label:"Classic changes directory",expected:"directory"})).exists)return r;for(let i of(await li.readdir(e,{withFileTypes:!0})).sort((o,s)=>o.name.localeCompare(s.name))){if(i.name==="archive"||Gn(i.name))continue;let o=await at(i.name,t);if(!o.exists||!o.stateExists)continue;let s=await Qs(o.directory);!s||s.archived||r.push(s)}return r}var Zs=_e("classicActiveChanges",t=>Yv(t)),ea=_e("classicActiveChange",async(t,e)=>{let r=await at(e,t);if(!r.exists||!r.stateExists)return null;let n=await Qs(r.directory);return!n||n.archived?null:n}),Kf=_e("classicPlanReadiness",Xs);function Hf(t,e){return`${W(t,e.superpowersRoot)}/`}function zf(t,e){return G(t).startsWith(G(e))}function Jf(t,e){return[{prefix:`${W(t,e.superpowersSpecsDir)}/`,field:"designDoc",wireField:"design_doc",phase:"design"},{prefix:`${W(t,e.superpowersPlansDir)}/`,field:"plan",wireField:"plan",phase:"build"},{prefix:`${W(t,e.superpowersReportsDir)}/`,field:"verificationReport",wireField:"verification_report",phase:"verify"}]}function Yf(t,e){let r=G(t),n=e.find(o=>r.startsWith(G(o.prefix)));if(!n)return null;let i=r.slice(G(n.prefix).length);return!i||i.includes("/")||!i.endsWith(".md")?null:n}function Vf(t,e){return t.classic?.[e.field]??null}function Vv(t,e){return t.classic!==null&&t.phase===e.phase&&!Vf(t,e)}async function Bf(t,e,r){return Vv(e,r)?!0:r.field!=="plan"||e.phase!=="build"?!1:(await Kf(t,e.classic?.plan??null,{requireNonempty:e.classic?.buildMode==="autonomous"})).status==="broken"}function Xf(t){return t.phase==="design"||t.phase==="build"||t.phase==="verify"}function Ye(t){return t.changeDir?X.basename(t.changeDir):null}var Xv=new Set(["design","plan","verify","verification","verification-report","report"]);function Uf(t){return t.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&")}function Qv(t,e){return[e.classic?.designDoc,e.classic?.plan,e.classic?.verificationReport].some(n=>n&&G(n)===G(t))}function Zv(t,e){let n=(t.split("/").at(-1)??t).replace(/\.[^.]+$/u,"");if(n===e)return!0;let i=[...Xv].map(Uf).join("|");return new RegExp(`(^|[-_.])${Uf(e)}[-_.](${i})$`,"u").test(n)}async function eb(t,e,r){let n=r?[await ea(e,r)].filter(a=>a!==null):await Zs(e),i=n.find(a=>Qv(t,a));if(i)return{governing:i,match:"recorded"};let s=n.filter(Xf).filter(a=>{let c=Ye(a);return c!==null&&Zv(t,c)}).sort((a,c)=>(Ye(c)?.length??0)-(Ye(a)?.length??0))[0];return s?{governing:s,match:"named"}:null}async function Gf(t,e,r){if(r)return await ea(t,r)??{blockedResult:Tt(e,`selected change '${r}' is no longer active`)};let n=await Zs(t);if(n.length===0)return null;let i=await Nf(t);if(i.status==="stale")return{blockedResult:Tt(e,i.reason)};if(i.status==="selected"){let o=n.find(s=>Ye(s)===i.selection.change);return o||{blockedResult:Tt(e,`selected change '${i.selection.change}' is no longer active`)}}if(n.length===1){let o=n[0];if(o.changeDir!==null){let s=await _r(o.changeDir,{heal:!1,cwd:t}),a=Ye(o)??"unknown";if(s.status==="drift")return{blockedResult:Tt(e,xr(a,s.boundBranch,s.currentBranch))};if(s.status==="unbound-detached")return{blockedResult:Tt(e,Pr(a))}}return o}return{blockedResult:fb(e,n.map(o=>Ye(o)).filter(Boolean))}}function tb(t){let r=/^\d{4}-\d{2}-\d{2}-(.+)$/u.exec(t)?.[1]??t;return Gn(r)?null:r}function Qf(t,e,r){let n=`${W(e,r.changesDir)}/`;if(!G(t).startsWith(G(n)))return null;let i=t.slice(n.length).split("/").filter(Boolean),[o,s]=i;return o?G(o)===G("archive")?{kind:"archive",archiveName:s??null,changeName:s?tb(s):null}:{kind:"active",changeName:o}:null}function Zf(t,e,r){return e?.kind==="archive"?mb(t,e.archiveName,e.changeName,r):e?.kind==="active"&&r&&G(e.changeName)!==G(r)?db(t,e.changeName,r):null}async function rb(t,e,r,n){let i=Qf(t,e,r),o=Zf(t,i,n);if(o)return{blockedResult:o};if(i?.kind==="active"){let s=i.changeName,a=await at(s,e);if(a.stateExists){let c=await Qs(a.directory);return c||{changeDir:a.directory,phase:"open",classic:null,archived:!1}}return{changeDir:a.directory,phase:"open",classic:null,archived:!1}}if(zf(t,Hf(e,r))){let s=await eb(t,e,n);if(s?.match==="recorded")return{...s.governing,superpowersArtifact:"matched"};let a=Yf(t,Jf(e,r));if(s)return a?{...s.governing,superpowersArtifact:await Bf(e,s.governing,a)?"matched":"unmatched",superpowersSlot:a}:{...s.governing,superpowersArtifact:"matched"};if(a){let l=await Gf(e,t,n);return!l||"blockedResult"in l?l:{...l,superpowersArtifact:await Bf(e,l,a)?"matched":"unmatched",superpowersSlot:a}}let c=n?await ea(e,n):(await Zs(e))[0]??null;return c?{...c,superpowersArtifact:"unmatched"}:null}return Gf(e,t,n)}function nb(t){return!t.includes("/")&&t.endsWith(".md")}function ib(t){return t.startsWith(".comet/")||t.includes("/.comet/")}function ob(t){return t===".superpowers"||t.startsWith(".superpowers/")}function sb(t,e,r){let n=G(t);if(!n.startsWith(G(r)))return null;let i=n.endsWith("/.comet.yaml")||n.endsWith("/.openspec.yaml"),o=n.endsWith("/proposal.md")||n.endsWith("/design.md")||n.endsWith("/tasks.md"),s=n.includes("/.comet/"),a=n.includes("/specs/");return e==="open"&&(o||i||s||a)?`${t} (phase: open, openspec artifacts)`:e==="design"&&(o||i||s||a)?`${t} (phase: design, handoff/spec)`:e==="build"&&(n.endsWith("/tasks.md")||i||a)?`${t} (phase: build, spec/tasks)`:e==="verify"&&i?`${t} (phase: verify, state)`:e==="archive"&&i?`${t} (phase: archive, state)`:null}function ab(t,e,r,n){let i=e==="open"?[" BLOCKED: source writes are not allowed during open"," This phase does not allow source writes"," ALLOWED: create proposal/design/tasks artifacts and run guard",` NEXT: finish clarification and artifacts, then run comet guard ${r} open --apply`]:e==="design"?[" BLOCKED: source writes are not allowed during design"," This phase does not allow source writes"," ALLOWED: run brainstorming, create the Design Doc, and run guard",` NEXT: finish the Design Doc, then run comet guard ${r} design --apply to enter build`]:e==="verify"?[" BLOCKED: implementation writes are not allowed during verify"," This phase allows verification reports and state updates only",` NEXT: run comet state transition ${r} verify-fail, then retry the implementation edit in Build`]:[" BLOCKED: source writes are not allowed during archive"," This phase does not allow source writes",` NEXT: run comet archive ${r} to complete Archive; use the reported recovery action if Archive is blocked`];return ed(t,e,e,n,i)}function ed(t,e,r,n,i){let o=jf(r,n);return M(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` Current phase: ${e}`,` Target file: ${t}`,"",` ${o.summary}`,` RELAY TO USER: ${o.user_message}`,"",...i,""].join(`
|
|
160
|
+
`))}function cb(t,e,r){return ed(t,"build (workflow: full), but design_doc is empty","build",r,[" BLOCKED: full workflow source writes require a recorded Design Doc"," This phase does not allow source writes until design_doc is recorded",` NEXT: create the Design Doc, run comet state complete-design ${e} --design-doc <repo-relative-ref>, then retry the original write`])}function lb(t,e,r,n,i){let o=Ye(e)??"<change-name>",s=r.status==="missing",a=s?"classic-build-plan-missing":"classic-build-plan-broken",c=s?"plan is not recorded":"the recorded plan path does not resolve to a file",l=s?[]:[`RECORDED_PLAN: ${r.recordedPath}`],u=e.changeDir?W(n,e.changeDir):"<classic-change-dir>",f=W(n,i.superpowersPlansDir),d=e.classic?.buildMode==="autonomous",p=s?`comet state set ${o} plan <repository-relative-plan-path>`:`comet state set ${o} plan <new-repository-relative-plan-path>`,h=s?[d?"2. Plan the implementation autonomously from the confirmed design and task IDs.":"2. Load the Superpowers writing-plans Skill.",`3. Read the Design Doc path from "comet state get ${o} design_doc" and read ${u}/tasks.md.`,`4. Create the implementation plan under ${f}/.`,"5. Record the plan path:",` ${p}`]:[d?`2. Restore the plan file at ${r.recordedPath}, or create a replacement autonomously under ${f}/.`:`2. Restore the plan file at ${r.recordedPath}, or load the Superpowers writing-plans Skill and create a replacement under ${f}/.`,"3. When creating a replacement, record its path:",` ${p}`];return M(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",`ERROR_CODE: ${a}`,`CHANGE: ${o}`,"WORKFLOW: full","PHASE: build",`TARGET: ${t}`,`STATE: ${c}`,...l,"",d?"BLOCKED: project source writes require a ready implementation plan.":"BLOCKED: project source writes require a ready Superpowers implementation plan.","","ALLOWED_RECOVERY_WRITES:",`- ${f}/<plan-file>.md`,"- Comet state updates performed by the comet CLI",`- ${u} artifacts allowed by the build phase`,"","RECOVERY:",`1. Invoke /comet-build for ${o} and resume Step 1.`,...h,`${s?"6":"4"}. Verify recovery:`,` comet state check ${o} build --recover`,"","SUCCESS: plan is reported as DONE and recovery advances beyond plan creation.",`RETRY: retry the original Write/Edit for ${t} only after SUCCESS.`,"PROHIBITED: do not treat tasks.md as the implementation plan or write project source before SUCCESS.",d?"Autonomous planning does not require an external Skill; all normal acceptance checks still apply.":"If writing-plans is unavailable, stop and report the missing Skill instead of bypassing this check.",""].join(`
|
|
161
|
+
`))}function ub(t,e){let r=e.superpowersSlot,n=r?Vf(e,r):null,i=r?e.phase!==r.phase?[` BLOCKED: ${r.wireField} cannot be first-written in phase ${e.phase}`,` Expected phase: ${r.phase}`," NEXT: resume the matching Comet phase or use an already recorded artifact path"]:n?[` BLOCKED: ${r.wireField} is already recorded for this change`,` Recorded path: ${n}`," NEXT: write the recorded artifact or explicitly correct the state path"]:[" BLOCKED: standard Superpowers artifact state is incomplete"," NEXT: validate the active change state, then retry the matching phase"]:[" BLOCKED: unmatched Superpowers artifact"," This docs/superpowers/ path does not match any active change artifact"," NEXT: use a recorded artifact path or a standard phase artifact directory"];return M(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` Current phase: ${e.phase}`,` Target file: ${t}`,"",...i,""].join(`
|
|
162
|
+
`))}function fb(t,e){return M(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," BLOCKED: multiple active changes require a current change",` Target file: ${t}`,` Active changes: ${e.join(", ")}`,"",` NEXT: choose the intended change, run one of: ${e.map(r=>`comet state select ${r}`).join(" | ")}, then retry the source write`,""].join(`
|
|
163
|
+
`))}function Tt(t,e){return M(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝",""," BLOCKED: current change selection is stale or invalid",` Target file: ${t}`,` Reason: ${e}`,""," NEXT: run comet state current --json, follow its exact selection recovery action, then retry the source write",""].join(`
|
|
164
|
+
`))}function db(t,e,r){return M(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` BLOCKED: target belongs to Classic change '${e}', but the current selection is '${r}'`,` Target file: ${t}`,"",` NEXT: write the matching artifact for '${r}', or run comet state select ${e} before modifying this target`,""].join(`
|
|
165
|
+
`))}function mb(t,e,r,n){let i=r?`archived Classic change '${r}'`:e?`Classic archive entry '${e}'`:"the Classic archive",o=n?`, but the current selection is '${n}'`:"";return M(2,["","╔══════════════════════════════════════════╗","║ COMET PHASE GUARD — WRITE BLOCKED ║","╚══════════════════════════════════════════╝","",` BLOCKED: target belongs to ${i}${o}; archived artifacts are immutable`,` Target file: ${t}`,""," NEXT: modify the active change artifact instead; if follow-up work is required, create or select an active change and retry there",""].join(`
|
|
166
|
+
`))}async function pb(t,e,r,n=Eu){try{if((await n(t,[e])).projectTargets.length===0)return oe(`${e} (outside guarded project)`)}catch(h){return M(2,[`[COMET-HOOK] blocked: scope could not be determined safely for ${e}.`,`REASON: ${h instanceof Error?h.message:String(h)}`,"NEXT: verify that the project root is accessible, then retry the write."].join(`
|
|
167
|
+
`))}let i=await Jv(e,t),o;try{o=await ys(t)}catch(h){return M(2,`[COMET-HOOK] blocked: ${h instanceof Error?h.message:String(h)}`)}let s=Qf(i,t,o),a=Zf(i,s,r);if(a)return a;if(ib(i))return oe(`${i} (whitelist: comet config)`);if(ob(i))return oe(`${i} (whitelist: superpowers workspace)`);if(await Mf(t,o,i))return oe(`${i} (whitelist: neutral document)`);if(i==="CLAUDE.md"||i==="CHANGELOG.md"||i==="README.md"||nb(i))return oe(`${i} (whitelist: root markdown)`);let c=await Cs(t,e,[X.join(t,".comet"),o.openSpecRoot,o.superpowersRoot]);if(c)return oe(c);let l;try{l=await rb(i,t,o,r)}catch(h){return M(2,`[COMET-HOOK] blocked: ${h instanceof Error?h.message:String(h)}`)}if(!l)return oe("no active comet change");if("blockedResult"in l)return l.blockedResult;if(l.archived)return oe(`${i} (own change archived)`);let u=l.phase,f=Ye(l)??r;if(!f)return Tt(i,"active Classic change name cannot be resolved");if(l.classic?.buildMode==="autonomous"&&l.changeDir)try{let h=await _r(l.changeDir,{heal:!1,cwd:t});if(h.status==="drift")return M(2,xr(f,h.boundBranch,h.currentBranch));if(h.status==="unbound-detached")return M(2,Pr(f))}catch(h){return M(2,h instanceof Error?h.message:String(h))}let d=Yf(i,Jf(t,o));if(u==="build"&&l.classic?.buildMode==="autonomous"&&d?.field==="plan"){let h=await Vs(t,f,l.classic,{requirePlan:!1});if(h.length)return M(2,h.join(`
|
|
168
|
+
`))}let p=sb(i,u,`${W(t,o.openSpecRoot)}/`);if(p)return oe(p);if(zf(i,Hf(t,o))){if(l.superpowersArtifact==="matched"&&Xf(l))return oe(`${i} (phase: ${u}, superpowers)`);if(l.superpowersArtifact==="unmatched")return ub(i,l)}if(l.invalidState)return M(2,`[COMET-HOOK] blocked: active Classic state is invalid; run comet classic validate ${f}, repair only the reported fields, then run comet state next ${f} --json before retrying ${i}`);if(u==="build"&&l.classic?.workflow==="full"&&!l.classic.designDoc)return cb(i,f,Ys(l.classic?.language));if(u==="build"&&l.classic?.workflow==="full"){let h=await Kf(t,l.classic.plan,{requireNonempty:l.classic.buildMode==="autonomous"});if(h.status!=="ready")return lb(i,l,h,t,o)}if(u==="build"){if(l.classic?.buildMode==="autonomous"){let h=await Vs(t,f,l.classic);if(h.length)return M(2,h.join(`
|
|
169
|
+
`))}return oe(`${i} (phase: ${u})`)}return ab(i,u,f,Ys(l.classic?.language))}var td=async t=>{let e=Hv(t),r=await Kv();return r?pb(e,r):oe("no file path in tool input")};var rd=["open-complete","design-complete","build-complete","verify-pass","verify-fail","archive-confirm","archive-reopen","archived","preset-escalate"];var hb=new Set([...Sr,"archive_confirmation","verify_failures","check_epoch","classic_profile","classic_migration","bound_branch"]),nd=new Set(ut.filter(t=>!hb.has(t))),ta={workflow:["full","hotfix","tweak"],phase:["open","design","build","verify","archive"],context_compression:["off","beta"],build_mode:["subagent-driven-development","executing-plans","direct","autonomous"],build_pause:["null","plan-ready"],subagent_dispatch:["null","confirmed"],tdd_mode:["tdd","direct"],review_mode:["off","standard","thorough"],isolation:["current","branch","worktree"],verify_mode:["light","full"],auto_transition:["true","false"],verify_result:["pending","pass","fail"],branch_status:["pending","handled"],archive_confirmation:["pending","confirmed"],archived:["true","false"],direct_override:["true","false"],classic_profile:["full","hotfix","tweak"],classic_migration:["1"]};var gb=`
|
|
157
170
|
Options: --json (machine-readable output), --help
|
|
158
171
|
JSON: one object with command and exitCode; data, stdout, stderr, summary and next are optional.
|
|
159
172
|
Use exitCode for success; do not parse human-readable stdout. Help text is in stdout in JSON mode.
|
|
160
|
-
`;function Lf(t,e){let r=e.indexOf("--"),n=r<0?e:e.slice(0,r);if(!n.includes("--help")&&!n.includes("-h"))return;let i={check:["comet check run <change> <build|verify> [--local] [--incremental] [--cwd <path>] [--timeout-ms <ms>] -- <program> [args...]","comet check rerun <change> <build|verify>","--local opts deterministic local checks into same-input reuse; other checks are single-use.","--incremental records phase-local evidence: guard previews accept it, --apply requires a full rerun.","Arguments after -- belong to the child. Windows batch arguments containing shell syntax are rejected.","","Executes a program for an active change and stores its log and input-bound evidence.","--local is not a location switch: all checks execute locally. It asserts deterministic inputs.","Use --local only when no network, external state or untracked ignored inputs affect the result.","Default evidence is single-use; reusable evidence requires matching inputs, environment and log.","--cwd: relative to the project root; default is the invocation directory; must stay inside the project.","Guard reuses evidence only when its cwd matches the guard invocation directory, or the command is declared with that cwd in a v2 check policy.","--timeout-ms: default 300000; integer range 1..3600000.","Place Comet options, including --json, before --. Child --help and --json after -- are forwarded.","","Result: data.scope, data.argv, data.cwd, data.exitCode, data.logRef, data.reusable; data.reused is optional.","Exit: 0 = success with stable inputs; child failures propagate; timeout = 124; invalid invocation/runtime error = 70.","A child exit of 0 with changed inputs returns exitCode 1. Use top-level exitCode, not data.exitCode.","On failure inspect data.logRef or stderr, fix the cause, then rerun. Recovery revalidates local evidence.","rerun repeats the latest Runtime-recorded argv, cwd, timeout and reuse tier without reconstructing shell syntax.","Optional .comet/check-policy.json binds declared deterministic commands by exact argv and cwd.",'A v1 single-command object stays valid; v2 {"commands":[...]} scopes each command separately.',"Editing one v2 command entry invalidates only that command's evidence; unmatched commands stay conservative.",'Default inputs are the working-tree files. Declare git: "all" for builds that read HEAD or the index,','env variable names whose values affect the result, and taskCheckboxes: "include" when completion marks matter.',"files accept literal paths and * ? ** globs; a new file matching a glob is checked without re-declaring.","Declare every real input; do not infer dependencies from the current diff.",'Policy example: {"version":2,"commands":[{"argv":["node","scripts/build.mjs"],"cwd":".","files":["src/**","package.json"],"git":"all"},{"argv":["node","--test"],"cwd":".","files":["src/**","test/**"],"taskCheckboxes":"ignore"}]}',"Build evidence does not substitute for verify evidence. A successful check does not advance the phase.","","Examples: (replace demo with your active change; these commands execute code)"," comet check run demo verify --json -- node --test"," comet check run demo build --local --cwd . -- npm run build"," comet check rerun demo build"],state:["comet state <command> [args]","init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","get <change-name> <field>","set <change-name> <field> <value> [<field> <value> ...]","complete-design <change-name> --design-doc <repo-relative-ref>","transition <change-name> <event>","check <change-name> <phase> [--recover] [--details]","scale <change-name>","artifacts <change-name>","record-check <change-name> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","task-checkoff <file> <task-text>","tasks <change-name> [--assign-ids]","task-complete <change-name> <task-id> --expect <revision>","sync-plan <change-name>","checkpoint <change-name> [--file <json>]","delivery <change-name> [--file <json> | --verify]","select <change-name> | rebind <change-name> | next <change-name>","current | clear-selection","","Start with current or next <change-name> to inspect workflow guidance.","Advanced writes: init, set, transition, task-checkoff, select, rebind, clear-selection.","Use comet state <command> --help for details. --recover is for cold recovery, not normal progression.","After explicit design confirmation, complete-design registers the reference, refreshes handoff, and applies the guard; interrupted retries retain completed work.","Use data.artifactRefs for state references and task-authority markers; absolute paths are for file operations."],guard:["comet guard <change-name> <open|design|build|verify|archive> [--apply]","Validates phase requirements; --apply advances the phase after all checks pass.","Without --apply the phase stays unchanged, but this is NOT a read-only preview:","Build validation may execute a detected build and write evidence/logs.","Preview does not consume single-use evidence. Successful phase advancement consumes it atomically.","Failed or repeated previews preserve evidence; changed inputs still require a new check.","Do not poll guard for status. Use comet state next <change-name> for guidance.","On failure follow the reported next action; do not blindly retry side-effecting checks.","","Examples:"," comet guard demo build --apply --json"," comet state next demo --json"],handoff:["comet handoff <change-name> design --write [--full]","comet handoff <change-name> --hash-only"],archive:["comet archive <change-name> [--dry-run]"],validate:["comet classic validate <change-name>"],workspace:["comet classic workspace prepare <change-name> --isolation <current|branch|worktree> [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]","comet classic workspace resolve <change-name>"]},o={current:["comet state current","Reports the selected Classic change. Does not advance the phase."],next:["comet state next <change-name>","Reports the next workflow action. Does not execute build or verification checks."],select:["comet state select <change-name>","Writes the current change selection used by workflow routing."],rebind:["comet state rebind <change-name>","Updates the change branch binding to the current Git branch after validation."],"clear-selection":["comet state clear-selection","Clears the current change selection; does not delete change artifacts."],init:["comet state init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","Creates Classic workflow state. Follow the Open workflow for required user decisions."],scale:["comet state scale <change-name>","Reports a verification recommendation without changing verify_mode.","JSON: data.recommendation, data.selected and data.metrics. Scale is not a risk assessment.","Preserve an existing selection; record a new decision explicitly with state set when needed."],artifacts:["comet state artifacts <change-name>","Inspects the OpenSpec apply dependency closure, including dependencies of already-complete artifacts.","JSON: data.source, required, skipped, designRequired, files and problems. This does not execute implementation or verification.","Optional design is omitted only when the active schema excludes it from the required closure.","Skipped specs require explicit skip_specs: true, upstream support and no conflicting spec files.","Legacy changes without .openspec.yaml retain the existing Classic artifact requirements."],"task-checkoff":["comet state task-checkoff <file> <task-text>","Checks that exactly one matching task is already checked. Does not write the task file or execute the task."],tasks:["comet state tasks <change-name> [--assign-ids]","Reads tasks.md as the task completion authority. Fenced examples are excluded.","--assign-ids persists IDs for legacy/new tasks in Open, Design or Build; existing IDs remain unchanged.","Assign IDs before generating the design handoff and plan. ID assignment changes task requirements.","JSON: data.authority, data.revision, data.needsIds, data.tasks and data.progress.","Each task has id, text, completed and line. Never use line/order as task identity.","Example: comet state tasks demo --assign-ids --json"],"task-complete":["comet state task-complete <change-name> <task-id> --expect <revision>","Records accepted task completion during Build; does not execute or independently verify work.","Use the revision returned by state tasks. Changed requirements reject the write; refresh and reassess the task.","Writes tasks.md under the state lock and synchronizes explicitly ID-mapped legacy plan checkboxes. Retries repair interrupted projection writes.","Reconcile code, checks and review evidence before recording completion; unchecked does not mean unimplemented.","Unmapped legacy items are preserved and reported as mapping-required; never match tasks by position or wording."],"sync-plan":["comet state sync-plan <change-name>","Synchronizes legacy plan checkboxes from tasks.md by explicit comet-task IDs; does not execute or accept work.","Rejects missing or unknown plan IDs. Reconcile extra requirements into tasks.md before mapping.","New plans should reference task IDs without a second completion checklist."],checkpoint:["comet state checkpoint <change-name> [--file <json>]","Reads a structured coordination checkpoint, or records an explicitly bounded work package during Build.","Input: taskIds, revision, stage, sessionId, evidence, unresolved, reviewRounds.","Include schemaVersion: 1. JSON state is .comet/coordination.json, separate from the Engine checkpoint.","Stages: implementing|task-review|checkoff|done|blocked. Evidence is a coordination record, not automatic acceptance.","Runtime checks task IDs and revision and renders subagent-progress.md. Do not maintain its projection manually."],delivery:["comet state delivery <change-name> [--file <json> | --verify]","Reads delivery authorization and observed progress, or records the user-authorized local|push|pr action.","Input: action, targetBranch, optional remote, commit and prUrl. Recording never performs remote writes.","First authorization requires Archive with passing verification before archival. Missing legacy authorization is never inferred.","Resume only authorized unfinished steps; supplied commit or PR text alone does not prove delivery.","--verify performs bounded read-only remote/PR verification; normal entry never contacts the network."],get:["comet state get <change-name> <field>","Reads one stored field. The field value is returned in stdout, including in JSON mode.",`Fields: ${[...tt,...dr].join(", ")}`,"Example: comet state get demo phase --json"],set:["comet state set <change-name> <field> <value> [<field> <value> ...]","Advanced: validates all fields, then commits one atomic state update and reconciles Runtime state.","Invalid values or duplicate fields reject the whole update. Do not bypass workflow confirmations.","JSON: data.change and data.updated contain the committed field values.","Writable fields (enum values shown where applicable):",...[...If].map(c=>` ${c}${Is[c]?`: ${Is[c].join("|")}`:c==="language"?": en|zh-CN":""}`),"Other Runtime-owned fields cannot be set manually. Artifact paths must stay within the project.","Example: comet state set demo verify_mode full","Example: comet state set demo build_mode executing-plans tdd_mode direct review_mode standard --json"],check:["comet state check <change-name> <open|design|build|verify|archive> [--recover] [--details]","Checks phase entry requirements; this is not a build/test execution command.","--recover is for cold recovery after context loss, not normal phase progression.","Recovery revalidates reusable local evidence and invalidates stale, damaged or single-use evidence.","It preserves completed work; resume from the checkpoint and rerun required checks before progressing.","JSON entry data includes layout, configuration, configurationReadiness, nextAction, compact taskState, planMapping and checks.","--recover additionally revalidates evidence and includes checkpoint references; --details expands tasks and checkpoint content.","Reconcile existing implementation and acceptance before dispatching work; unchecked tasks are not proof of missing implementation.","Read fresh state after changing configuration or advancing phases; do not reuse an earlier entry snapshot.","","Examples:"," comet state check demo build --json"," comet state check demo build --recover --json"],"record-check":["comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","Advanced: writes a manual attestation; does not execute the command.","A manual attestation cannot satisfy Runtime build/verify evidence requirements, even with exit code 0.","Use comet check run to execute a check and obtain evidence that guard can validate.","--cwd: relative to project root, defaults to .; must stay inside the project.","","Examples:",' comet state record-check demo verify --command "external test run" --exit-code 1'," comet check run demo verify --json -- node --test"],transition:["comet state transition <change-name> <event>",`Events: ${Nf.join(", ")}`,"Advanced: applies a state-machine event and writes workflow state. Required confirmations still apply.","This is not a substitute for the workflow Skill or phase guard. Use state next for the next action."]},s=n.find(c=>!c.startsWith("-")),a=t==="state"&&s&&o[s]||i[t];return a?`Usage: ${a.join(`
|
|
173
|
+
`;function id(t,e){let r=e.indexOf("--"),n=r<0?e:e.slice(0,r);if(!n.includes("--help")&&!n.includes("-h"))return;let i={check:["comet check run <change> <build|verify> [--local] [--incremental] [--cwd <path>] [--timeout-ms <ms>] -- <program> [args...]","comet check rerun <change> <build|verify>","--local opts deterministic local checks into same-input reuse; other checks are single-use.","--incremental records phase-local evidence: guard previews accept it, --apply requires a full rerun.","Arguments after -- belong to the child. Windows batch arguments containing shell syntax are rejected.","","Executes a program for an active change and stores its log and input-bound evidence.","--local is not a location switch: all checks execute locally. It asserts deterministic inputs.","Use --local only when no network, external state or untracked ignored inputs affect the result.","Default evidence is single-use; reusable evidence requires matching inputs, environment and log.","--cwd: relative to the project root; default is the invocation directory; must stay inside the project.","Guard reuses evidence only when its cwd matches the guard invocation directory, or the command is declared with that cwd in a v2 check policy.","--timeout-ms: default 300000; integer range 1..3600000.","Place Comet options, including --json, before --. Child --help and --json after -- are forwarded.","","Result: data.scope, data.argv, data.cwd, data.exitCode, data.logRef, data.reusable; data.reused is optional.","Exit: 0 = success with stable inputs; child failures propagate; timeout = 124; invalid invocation/runtime error = 70.","A child exit of 0 with changed inputs returns exitCode 1. Use top-level exitCode, not data.exitCode.","On failure inspect data.logRef or stderr, fix the cause, then rerun. Recovery revalidates local evidence.","rerun repeats the latest Runtime-recorded argv, cwd, timeout and reuse tier without reconstructing shell syntax.","Optional .comet/check-policy.json binds declared deterministic commands by exact argv and cwd.",'A v1 single-command object stays valid; v2 {"commands":[...]} scopes each command separately.',"Editing one v2 command entry invalidates only that command's evidence; unmatched commands stay conservative.",'Default inputs are the working-tree files. Declare git: "all" for builds that read HEAD or the index,','env variable names whose values affect the result, and taskCheckboxes: "include" when completion marks matter.',"files accept literal paths and * ? ** globs; a new file matching a glob is checked without re-declaring.","Declare every real input; do not infer dependencies from the current diff.",'Policy example: {"version":2,"commands":[{"argv":["node","scripts/build.mjs"],"cwd":".","files":["src/**","package.json"],"git":"all"},{"argv":["node","--test"],"cwd":".","files":["src/**","test/**"],"taskCheckboxes":"ignore"}]}',"Build evidence does not substitute for verify evidence. A successful check does not advance the phase.","","Examples: (replace demo with your active change; these commands execute code)"," comet check run demo verify --json -- node --test"," comet check run demo build --local --cwd . -- npm run build"," comet check rerun demo build"],state:["comet state <command> [args]","init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","get <change-name> <field>","set <change-name> <field> <value> [<field> <value> ...]","complete-design <change-name> --design-doc <repo-relative-ref>","transition <change-name> <event>","check <change-name> <phase> [--recover] [--details]","scale <change-name>","artifacts <change-name>","record-check <change-name> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","task-checkoff <file> <task-text>","tasks <change-name> [--assign-ids]","task-complete <change-name> <task-id> --expect <revision>","sync-plan <change-name>","checkpoint <change-name> [--file <json>]","delivery <change-name> [--file <json> | --verify]","select <change-name> | rebind <change-name> | next <change-name>","current | clear-selection","","Start with current or next <change-name> to inspect workflow guidance.","Advanced writes: init, set, transition, task-checkoff, select, rebind, clear-selection.","Use comet state <command> --help for details. --recover is for cold recovery, not normal progression.","After explicit design confirmation, complete-design registers the reference, refreshes handoff, and applies the guard; interrupted retries retain completed work.","Use data.artifactRefs for state references and task-authority markers; absolute paths are for file operations."],guard:["comet guard <change-name> <open|design|build|verify|archive> [--apply]","Validates phase requirements; --apply advances the phase after all checks pass.","Without --apply the phase stays unchanged, but this is NOT a read-only preview:","Build validation may execute a detected build and write evidence/logs.","Preview does not consume single-use evidence. Successful phase advancement consumes it atomically.","Failed or repeated previews preserve evidence; changed inputs still require a new check.","Do not poll guard for status. Use comet state next <change-name> for guidance.","On failure follow the reported next action; do not blindly retry side-effecting checks.","","Examples:"," comet guard demo build --apply --json"," comet state next demo --json"],handoff:["comet handoff <change-name> design --write [--full]","comet handoff <change-name> --hash-only"],archive:["comet archive <change-name> [--dry-run]"],validate:["comet classic validate <change-name>"],workspace:["comet classic workspace prepare <change-name> --isolation <current|branch|worktree> [--change-branch <branch>] [--target-branch <branch>] [--worktree-path <path>]","comet classic workspace resolve <change-name>"]},o={current:["comet state current","Reports the selected Classic change. Does not advance the phase."],next:["comet state next <change-name>","Reports the next workflow action. Does not execute build or verification checks."],select:["comet state select <change-name>","Writes the current change selection used by workflow routing."],rebind:["comet state rebind <change-name>","Updates the change branch binding to the current Git branch after validation."],"clear-selection":["comet state clear-selection","Clears the current change selection; does not delete change artifacts."],init:["comet state init <change-name> <full|hotfix|tweak> [--isolation <current|branch|worktree>]","Creates Classic workflow state. Follow the Open workflow for required user decisions."],scale:["comet state scale <change-name>","Reports a verification recommendation without changing verify_mode.","JSON: data.recommendation, data.selected and data.metrics. Scale is not a risk assessment.","Preserve an existing selection; record a new decision explicitly with state set when needed."],artifacts:["comet state artifacts <change-name>","Inspects the OpenSpec apply dependency closure, including dependencies of already-complete artifacts.","JSON: data.source, required, skipped, designRequired, files and problems. This does not execute implementation or verification.","Optional design is omitted only when the active schema excludes it from the required closure.","Skipped specs require explicit skip_specs: true, upstream support and no conflicting spec files.","Legacy changes without .openspec.yaml retain the existing Classic artifact requirements."],"task-checkoff":["comet state task-checkoff <file> <task-text>","Checks that exactly one matching task is already checked. Does not write the task file or execute the task."],tasks:["comet state tasks <change-name> [--assign-ids]","Reads tasks.md as the task completion authority. Fenced examples are excluded.","--assign-ids persists IDs for legacy/new tasks in Open, Design or Build; existing IDs remain unchanged.","Assign IDs before generating the design handoff and plan. ID assignment changes task requirements.","JSON: data.authority, data.revision, data.needsIds, data.tasks and data.progress.","Each task has id, text, completed and line. Never use line/order as task identity.","Example: comet state tasks demo --assign-ids --json"],"task-complete":["comet state task-complete <change-name> <task-id> --expect <revision>","Records accepted task completion during Build; does not execute or independently verify work.","Use the revision returned by state tasks. Changed requirements reject the write; refresh and reassess the task.","Writes tasks.md under the state lock and synchronizes explicitly ID-mapped legacy plan checkboxes. Retries repair interrupted projection writes.","Reconcile code, checks and review evidence before recording completion; unchecked does not mean unimplemented.","Unmapped legacy items are preserved and reported as mapping-required; never match tasks by position or wording."],"sync-plan":["comet state sync-plan <change-name>","Synchronizes legacy plan checkboxes from tasks.md by explicit comet-task IDs; does not execute or accept work.","Rejects missing or unknown plan IDs. Reconcile extra requirements into tasks.md before mapping.","New plans should reference task IDs without a second completion checklist."],checkpoint:["comet state checkpoint <change-name> [--file <json>]","Reads a structured coordination checkpoint, or records an explicitly bounded work package during Build.","Input: taskIds, revision, stage, sessionId, evidence, unresolved, reviewRounds.","Include schemaVersion: 1. JSON state is .comet/coordination.json, separate from the Engine checkpoint.","Stages: implementing|task-review|checkoff|done|blocked. Evidence is a coordination record, not automatic acceptance.","Runtime checks task IDs and revision and renders subagent-progress.md. Do not maintain its projection manually."],delivery:["comet state delivery <change-name> [--file <json> | --verify]","Reads delivery authorization and observed progress, or records the user-authorized local|push|pr action.","Input: action, targetBranch, optional remote, commit and prUrl. Recording never performs remote writes.","First authorization requires Archive with passing verification before archival. Missing legacy authorization is never inferred.","Resume only authorized unfinished steps; supplied commit or PR text alone does not prove delivery.","--verify performs bounded read-only remote/PR verification; normal entry never contacts the network."],get:["comet state get <change-name> <field>","Reads one stored field. The field value is returned in stdout, including in JSON mode.",`Fields: ${[...ut,...Sr].join(", ")}`,"Example: comet state get demo phase --json"],set:["comet state set <change-name> <field> <value> [<field> <value> ...]","Advanced: validates all fields, then commits one atomic state update and reconciles Runtime state.","Invalid values or duplicate fields reject the whole update. Do not bypass workflow confirmations.","JSON: data.change and data.updated contain the committed field values.","Writable fields (enum values shown where applicable):",...[...nd].map(c=>` ${c}${ta[c]?`: ${ta[c].join("|")}`:c==="language"?": en|zh-CN":""}`),"Other Runtime-owned fields cannot be set manually. Artifact paths must stay within the project.","Example: comet state set demo verify_mode full","Example: comet state set demo build_mode executing-plans tdd_mode direct review_mode standard --json"],check:["comet state check <change-name> <open|design|build|verify|archive> [--recover] [--details]","Checks phase entry requirements; this is not a build/test execution command.","--recover is for cold recovery after context loss, not normal phase progression.","Recovery revalidates reusable local evidence and invalidates stale, damaged or single-use evidence.","It preserves completed work; resume from the checkpoint and rerun required checks before progressing.","JSON entry data includes layout, configuration, configurationReadiness, nextAction, compact taskState, planMapping and checks.","--recover additionally revalidates evidence and includes checkpoint references; --details expands tasks and checkpoint content.","Reconcile existing implementation and acceptance before dispatching work; unchecked tasks are not proof of missing implementation.","Read fresh state after changing configuration or advancing phases; do not reuse an earlier entry snapshot.","","Examples:"," comet state check demo build --json"," comet state check demo build --recover --json"],"record-check":["comet state record-check <change> <build|verify> --command <text> --exit-code <int> [--cwd <path>]","Advanced: writes a manual attestation; does not execute the command.","A manual attestation cannot satisfy Runtime build/verify evidence requirements, even with exit code 0.","Use comet check run to execute a check and obtain evidence that guard can validate.","--cwd: relative to project root, defaults to .; must stay inside the project.","","Examples:",' comet state record-check demo verify --command "external test run" --exit-code 1'," comet check run demo verify --json -- node --test"],transition:["comet state transition <change-name> <event>",`Events: ${rd.join(", ")}`,"Advanced: applies a state-machine event and writes workflow state. Required confirmations still apply.","This is not a substitute for the workflow Skill or phase guard. Use state next for the next action."]},s=n.find(c=>!c.startsWith("-")),a=t==="state"&&s&&o[s]||i[t];return a?`Usage: ${a.join(`
|
|
161
174
|
`)}
|
|
162
|
-
${
|
|
163
|
-
`:void 0}function
|
|
164
|
-
`,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function
|
|
175
|
+
${gb}Command placeholders must be replaced with actual values.
|
|
176
|
+
`:void 0}function od(t,e){let r=u=>u!==null&&typeof u=="object"&&!Array.isArray(u)?u:{},n=r(t),i=r(n.entry),o=r(n.state??i.state??n),s=r(n.preparation??n.workspace??i.workspace),a=r(n.continuation??i.continuation),c=typeof s.projectRoot=="string"&&s.projectRoot!=="."?s.projectRoot:e??null,l=o.stateVersion??o.state_version;return{phase:typeof o.phase=="string"?o.phase:null,status:typeof o.status=="string"?o.status:null,stateVersion:typeof l=="number"?l:null,workspace:{cwd:c},continuation:Object.keys(a).length?{...a,cwd:c}:null}}import{stripVTControlCharacters as wb}from"node:util";function sd(t,e={}){return{code:"CLASSIC_COMMAND_FAILED",message:wb(t instanceof Error?t.message:String(t)),...e}}function yb(t,e){return{exitCode:e.exitCode,stdout:JSON.stringify({command:t,exitCode:e.exitCode,agent:od(e.data),...e.data===void 0?{}:{data:e.data},...e.envelope===void 0?{}:{summary:e.envelope.summary,...e.envelope.next===void 0?{}:{next:e.envelope.next},...e.envelope.user_message===void 0?{}:{user_message:e.envelope.user_message}},...e.stdout===void 0?{}:{stdout:e.stdout},...e.stderr===void 0?{}:{stderr:e.stderr}})+`
|
|
177
|
+
`,...e.envelope===void 0?{}:{envelope:e.envelope}}}async function vb(t,e,r,n={}){let i=r.indexOf("--"),o=l=>i<0||l<i,s=r.some((l,u)=>o(u)&&l==="--json"),a=r.filter((l,u)=>!o(u)||l!=="--json"),c;try{let l=id(t,a);c=l?{exitCode:0,stdout:l}:await e(a,{json:s,invocationCwd:n.invocationCwd??process.cwd(),...n.projectRoot?{projectRoot:n.projectRoot}:{}})}catch(l){c={exitCode:70,stderr:l instanceof Error?l.message:String(l),data:{issues:[sd(l)]}}}return s?yb(t,c):c}async function ad(t,e,r=process.argv.slice(2)){let n=await vb(t,e,r);return n.stdout&&process.stdout.write(n.stdout),n.stderr&&process.stderr.write(n.stderr+(n.stderr.endsWith(`
|
|
165
178
|
`)?"":`
|
|
166
|
-
`)),
|
|
179
|
+
`)),n.exitCode}process.exitCode=await ad("hook-guard",td);
|