@visulima/vis 2.0.2 → 3.0.1
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/CHANGELOG.md +28 -0
- package/LICENSE.md +5395 -4307
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +6 -6
- package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -1
- package/dist/packem_chunks/agent-instructions.js +7 -7
- package/dist/packem_chunks/bloom-status.js +2 -2
- package/dist/packem_chunks/bloom-sync.js +2 -2
- package/dist/packem_chunks/cache-attestation.js +1 -1
- package/dist/packem_chunks/catalog-detector.js +1 -1
- package/dist/packem_chunks/catalog.js +87 -111
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +192 -217
- package/dist/packem_chunks/defineReleasePlugin.js +3 -3
- package/dist/packem_chunks/detect.js +8 -3
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_chunks/discord.js +4 -4
- package/dist/packem_chunks/dispatch.js +4 -4
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/extra-files.js +3 -3
- package/dist/packem_chunks/fix.js +11 -11
- package/dist/packem_chunks/git.js +3 -3
- package/dist/packem_chunks/group-tags.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +5 -5
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +16 -16
- package/dist/packem_chunks/handler13.js +5 -5
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +5 -5
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +8 -8
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -5
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +3 -3
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +2 -2
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler31.js +2 -2
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +2 -2
- package/dist/packem_chunks/handler34.js +3 -3
- package/dist/packem_chunks/handler35.js +5 -5
- package/dist/packem_chunks/handler36.js +1 -1
- package/dist/packem_chunks/handler37.js +2 -2
- package/dist/packem_chunks/handler38.js +6 -6
- package/dist/packem_chunks/handler39.js +8 -8
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler40.js +34 -34
- package/dist/packem_chunks/handler41.js +5 -5
- package/dist/packem_chunks/handler42.js +4 -4
- package/dist/packem_chunks/handler43.js +3 -3
- package/dist/packem_chunks/handler44.js +2 -2
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +3 -3
- package/dist/packem_chunks/handler49.js +1 -1
- package/dist/packem_chunks/handler5.js +6 -6
- package/dist/packem_chunks/handler50.js +6 -6
- package/dist/packem_chunks/handler51.js +13 -13
- package/dist/packem_chunks/handler52.js +3 -3
- package/dist/packem_chunks/handler53.js +5 -5
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +4 -4
- package/dist/packem_chunks/handler57.js +5 -5
- package/dist/packem_chunks/handler58.js +5 -5
- package/dist/packem_chunks/handler59.js +8 -8
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +3 -3
- package/dist/packem_chunks/handler61.js +21 -21
- package/dist/packem_chunks/handler62.js +12 -12
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +5 -5
- package/dist/packem_chunks/handler65.js +8 -8
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +21 -21
- package/dist/packem_chunks/handler68.js +21 -21
- package/dist/packem_chunks/handler69.js +30 -30
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +9 -9
- package/dist/packem_chunks/handler71.js +17 -17
- package/dist/packem_chunks/handler72.js +104 -104
- package/dist/packem_chunks/handler73.js +20 -20
- package/dist/packem_chunks/handler74.js +45 -45
- package/dist/packem_chunks/handler75.js +27 -3
- package/dist/packem_chunks/handler76.js +3 -27
- package/dist/packem_chunks/handler77.js +68 -68
- package/dist/packem_chunks/handler78.js +30 -30
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +9 -9
- package/dist/packem_chunks/heal.js +11 -11
- package/dist/packem_chunks/help-command.js +7 -63
- package/dist/packem_chunks/index.js +1 -1
- package/dist/packem_chunks/index2.js +48 -802
- package/dist/packem_chunks/index3.js +3 -7
- package/dist/packem_chunks/index4.js +803 -134
- package/dist/packem_chunks/index5.js +7 -73
- package/dist/packem_chunks/index6.js +73 -0
- package/dist/packem_chunks/index7.js +135 -0
- package/dist/packem_chunks/interface.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +4 -4
- package/dist/packem_chunks/lean.js +3 -3
- package/dist/packem_chunks/list.js +3 -3
- package/dist/packem_chunks/loader.js +4 -4
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/orchestrator.js +27 -27
- package/dist/packem_chunks/pre-mode.js +2 -2
- package/dist/packem_chunks/print-config.js +1 -1
- package/dist/packem_chunks/prompts.js +7 -7
- package/dist/packem_chunks/prune.js +3 -3
- package/dist/packem_chunks/publish-guards.js +1 -1
- package/dist/packem_chunks/resolveFormatter.js +5 -5
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/security.js +1 -1
- package/dist/packem_chunks/shell-runner.js +1 -1
- package/dist/packem_chunks/slack.js +2 -2
- package/dist/packem_chunks/snapshot.js +2 -2
- package/dist/packem_chunks/stage-publisher.js +1 -1
- package/dist/packem_chunks/staged-registry.js +2 -2
- package/dist/packem_chunks/state.js +3 -3
- package/dist/packem_chunks/status.js +2 -2
- package/dist/packem_chunks/success-walk.js +4 -4
- package/dist/packem_chunks/sync.js +2 -2
- package/dist/packem_chunks/sync2.js +2 -2
- package/dist/packem_chunks/tar.js +3 -3
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/ts-loader.js +5 -9
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_chunks/version-resolver.js +2 -2
- package/dist/packem_chunks/webhook.js +1 -1
- package/dist/packem_chunks/workflow-templates.js +5 -5
- package/dist/packem_chunks/workspace.js +2 -2
- package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +1 -0
- package/dist/packem_shared/Table-DyORjLji-CC9cYgCG.js +11 -0
- package/dist/packem_shared/{VisReleaseError-DMGRBTNO.js → VisReleaseError-DZtgcKf8.js} +1 -1
- package/dist/packem_shared/_commonjsHelpers-DTfxOvZk.js +1 -0
- package/dist/packem_shared/advisories-CyDqzi5j.js +1 -0
- package/dist/packem_shared/affected-selection-DPQR-Bd3.js +1 -0
- package/dist/packem_shared/affected-shas-Dd0P7fGD.js +1 -0
- package/dist/packem_shared/ai-analysis-DSQQDFU9.js +68 -0
- package/dist/packem_shared/ai-fix-6nXZbecQ.js +43 -0
- package/dist/packem_shared/augment-COAiXSIx.js +4 -0
- package/dist/packem_shared/bin-wafzkjaB.js +1 -0
- package/dist/packem_shared/build-scripts-pdVmqXRm.js +1 -0
- package/dist/packem_shared/clean-DRiLimTx.js +1 -0
- package/dist/packem_shared/command-runtime-CiLVo4ED.js +1 -0
- package/dist/packem_shared/{compile-cache-B_Vf_WxT.js → compile-cache-DoMHRsRZ.js} +1 -1
- package/dist/packem_shared/createAdapter-F7GidOzU.js +1 -0
- package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +1 -0
- package/dist/packem_shared/cyclonedx-C_ezHg8b.js +4 -0
- package/dist/packem_shared/dependency-scan-DBH2Qo4I.js +1 -0
- package/dist/packem_shared/docker-Br_iFmI-.js +59 -0
- package/dist/packem_shared/failure-log-D92tM0ie.js +2 -0
- package/dist/packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js +4 -0
- package/dist/packem_shared/getRandomSpinner-4ZEcbTYv-DCyIuj19.js +1 -0
- package/dist/packem_shared/giget-CVyyR7x8.js +2 -0
- package/dist/packem_shared/glob-Cyk1H9ZL-ox19CSsT.js +1 -0
- package/dist/packem_shared/index-B4AjSxHU.js +1 -0
- package/dist/packem_shared/index-BisalDCf.js +39 -0
- package/dist/packem_shared/{index-BWl4DbMp.js → index-BjdW45xX.js} +1 -1
- package/dist/packem_shared/index-DHD8wb6Z.js +22 -0
- package/dist/packem_shared/index-DXPSWMbG.js +1 -0
- package/dist/packem_shared/index.server-CwSgbeN7.js +2 -0
- package/dist/packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js +1 -0
- package/dist/packem_shared/license-DvlYdo6T.js +1 -0
- package/dist/packem_shared/lifecycle-CfTZQHOG.js +2 -0
- package/dist/packem_shared/lockfile-35RFsJDs.js +1 -0
- package/dist/packem_shared/lockfile-DhHAaHN5.js +1 -0
- package/dist/packem_shared/main-BjJN8kWj.js +1 -0
- package/dist/packem_shared/manifests-BNSmpPF_.js +1 -0
- package/dist/packem_shared/min-release-age-ChzTC7_I.js +34 -0
- package/dist/packem_shared/missing-package-json-C0keIt78.js +1 -0
- package/dist/packem_shared/native-config-sync-BSzU4qUO.js +21 -0
- package/dist/packem_shared/osv-bloom-5wDAoZ1e.js +2 -0
- package/dist/packem_shared/otelPlugin-D8LL2-4L.js +1 -0
- package/dist/packem_shared/package-version-BJkg7-6H.js +4 -0
- package/dist/packem_shared/packument-C55kVxcQ.js +1 -0
- package/dist/packem_shared/{peer-warnings-BXAzXqY3.js → peer-warnings-CmYSxvql.js} +1 -1
- package/dist/packem_shared/pm-runner-de-jCq8q.js +1 -0
- package/dist/packem_shared/project-name-filter-BeREbPMI.js +7 -0
- package/dist/packem_shared/{prompt-BSAy8SMH.js → prompt-DMzaQEVa.js} +1 -1
- package/dist/packem_shared/provenance-CvfQEJPQ.js +1 -0
- package/dist/packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js +1 -0
- package/dist/packem_shared/registry-keys-DmBrAlhg.js +1 -0
- package/dist/packem_shared/resolve-explicit-COmP7eqr.js +5 -0
- package/dist/packem_shared/resolve-runtime-C7NBCA1C.js +1 -0
- package/dist/packem_shared/run-file-jMngGQhs.js +1 -0
- package/dist/packem_shared/runtime-check-BklgEMkC.js +1 -0
- package/dist/packem_shared/s1ngularity-RZOHbGrE.js +1 -0
- package/dist/packem_shared/scan-progress-C9nMDLis.js +2 -0
- package/dist/packem_shared/selectors-B7lSFz7l.js +3 -0
- package/dist/packem_shared/signatures-oZ_2IneN.js +2 -0
- package/dist/packem_shared/{slug-DoueYuLo.js → slug-OBHcH7wV.js} +1 -1
- package/dist/packem_shared/spinner-CbJfWYwB.js +1 -0
- package/dist/packem_shared/sticky-comment-DjhyCIZt.js +1 -0
- package/dist/packem_shared/subtree-DtmcKAJK.js +2 -0
- package/dist/packem_shared/symbols-BXDZ_sKt.js +1 -0
- package/dist/packem_shared/tabs-BilwonkM.js +1 -0
- package/dist/packem_shared/target-merge-D1xbylFw.js +4 -0
- package/dist/packem_shared/target-options-d_rIrLyq.js +1 -0
- package/dist/packem_shared/toolchain-DY11tPCw.js +5 -0
- package/dist/packem_shared/typosquats-D8ppc5kr.js +1 -0
- package/dist/packem_shared/use-measured-height-BPQg2q_p.js +1 -0
- package/dist/packem_shared/utils-DQFHJn72.js +1 -0
- package/dist/packem_shared/verify-D8wYvB85.js +1 -0
- package/dist/packem_shared/vis-update-app-ngwL2mRv.js +1 -0
- package/dist/packem_shared/vis-user-error-jhNwmkZp.js +30 -0
- package/dist/packem_shared/watch-Dswvj6Zp.js +1 -0
- package/dist/packem_shared/watch-loop-COWvvSbR.js +11 -0
- package/dist/packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js +1 -0
- package/dist/release/core/changelog/index.d.ts +62 -2
- package/dist/release/core/package-managers/index.d.ts +25 -1
- package/dist/release/core/package-managers/index.js +1 -1
- package/dist/release/core/version-actions/index.d.ts +47 -2
- package/dist/release/core/version-actions/index.js +1 -1
- package/dist/release/index.d.ts +100 -1
- package/dist/release/index.js +1 -1
- package/dist/release/plugin-sdk.d.ts +16 -1
- package/dist/release/plugin-sdk.js +1 -1
- package/dist/release/presets.js +1 -1
- package/dist/release/types.js +1 -1
- package/dist/runtime/preload.js +1 -1
- package/index.d.ts +204 -204
- package/index.js +26 -26
- package/package.json +13 -13
- package/dist/packem_chunks/detect2.js +0 -8
- package/dist/packem_chunks/registry.js +0 -48
- package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +0 -1
- package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +0 -1
- package/dist/packem_shared/advisories-CCBGdU8U.js +0 -1
- package/dist/packem_shared/affected-selection-Dj-ymxhw.js +0 -1
- package/dist/packem_shared/affected-shas-PwkVbPch.js +0 -1
- package/dist/packem_shared/ai-analysis-bGCAc1jR.js +0 -68
- package/dist/packem_shared/ai-fix-DV5-dHBY.js +0 -43
- package/dist/packem_shared/augment-24KX2nkI.js +0 -4
- package/dist/packem_shared/bin-CtzhnYMp.js +0 -1
- package/dist/packem_shared/build-scripts-w4SNeR7D.js +0 -1
- package/dist/packem_shared/clean-DWjQl14S.js +0 -1
- package/dist/packem_shared/command-runtime-BLFPUYAT.js +0 -1
- package/dist/packem_shared/createAdapter-bU4DIP3F.js +0 -1
- package/dist/packem_shared/createVersionActions-BK43SNDH.js +0 -1
- package/dist/packem_shared/cyclonedx-C4KaVTn1.js +0 -4
- package/dist/packem_shared/dependency-scan-D_ona0Qm.js +0 -1
- package/dist/packem_shared/docker-DaVs-9wK.js +0 -59
- package/dist/packem_shared/en-D3CfXlO7.js +0 -27
- package/dist/packem_shared/failure-log-CTneNcio.js +0 -2
- package/dist/packem_shared/giget-CAxjpwew.js +0 -2
- package/dist/packem_shared/glob-BUjyjdE8-C4M8e02u.js +0 -1
- package/dist/packem_shared/index-BAe6e0XE.js +0 -1
- package/dist/packem_shared/index-CTMU29dI.js +0 -1
- package/dist/packem_shared/index-uBVnF4ji.js +0 -35
- package/dist/packem_shared/index.server-CusjRLCh.js +0 -2
- package/dist/packem_shared/license-t5KnNX6v.js +0 -1
- package/dist/packem_shared/lifecycle-B8A2T3gx.js +0 -2
- package/dist/packem_shared/lockfile-Bccery3L.js +0 -1
- package/dist/packem_shared/main-D_cam4hv.js +0 -1
- package/dist/packem_shared/manifests-BDkwiVbh.js +0 -1
- package/dist/packem_shared/min-release-age-OaYpLwux.js +0 -34
- package/dist/packem_shared/missing-package-json-BqS-OnKd.js +0 -1
- package/dist/packem_shared/native-config-sync-Ds1FtcrM.js +0 -21
- package/dist/packem_shared/osv-bloom-pKp7urSB.js +0 -2
- package/dist/packem_shared/otelPlugin-DmKDBaPo.js +0 -1
- package/dist/packem_shared/package-version-C47v64aB.js +0 -4
- package/dist/packem_shared/packument-HBVbyf7x.js +0 -1
- package/dist/packem_shared/pm-runner-C6eTANt1.js +0 -1
- package/dist/packem_shared/project-name-filter-CJ3XX2TI.js +0 -7
- package/dist/packem_shared/provenance-D4Cza8cp.js +0 -1
- package/dist/packem_shared/public-api-WqUCiyIe.js +0 -131
- package/dist/packem_shared/readJsonSync-DweZd5ZA-0eZh9sGm.js +0 -1
- package/dist/packem_shared/registry-keys-C0ez2VND.js +0 -1
- package/dist/packem_shared/resolve-explicit-BbT764KS.js +0 -5
- package/dist/packem_shared/resolve-runtime-D_vZovbB.js +0 -1
- package/dist/packem_shared/run-file-DyPFFN9U.js +0 -1
- package/dist/packem_shared/runtime-check-D4um-yQq.js +0 -1
- package/dist/packem_shared/s1ngularity-St6dhKiq.js +0 -1
- package/dist/packem_shared/scan-progress-q-N2JtIp.js +0 -2
- package/dist/packem_shared/selectors-Ce_6UAoY.js +0 -3
- package/dist/packem_shared/signatures-Dyeyg1q9.js +0 -2
- package/dist/packem_shared/sticky-comment-D6_7-w8T.js +0 -1
- package/dist/packem_shared/subtree-DSm0QEoE.js +0 -2
- package/dist/packem_shared/symbols-DPTlrJ3B.js +0 -1
- package/dist/packem_shared/target-merge-Cfy7c__2.js +0 -11
- package/dist/packem_shared/target-options-7XcbqGDe.js +0 -1
- package/dist/packem_shared/toolchain-C_pNMBM6.js +0 -5
- package/dist/packem_shared/typosquats-xzcAGPiM.js +0 -1
- package/dist/packem_shared/use-measured-height-CBjN0fle.js +0 -1
- package/dist/packem_shared/utils-CRueU43T.js +0 -1
- package/dist/packem_shared/verify-Dve9PQj3.js +0 -1
- package/dist/packem_shared/vis-update-app-DMAC2pPf.js +0 -1
- package/dist/packem_shared/vis-user-error-xmha3L4n.js +0 -30
- package/dist/packem_shared/watch-BXOOX7lx.js +0 -1
- package/dist/packem_shared/watch-loop-Q7UpkVbr.js +0 -11
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import{createRequire as Ot}from"node:module";import{a as he,g as Mt,u as W,b as Ut,t as Ae,l as Vt,h as jt,c as Dt,v as Oe}from"./package-version-C47v64aB.js";let It;const Lt=t=>(It??=Ot(import.meta.url))(t),ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,St=t=>{if(typeof ne<"u"&&ne.versions&&ne.versions.node){const[e,n]=ne.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ne.getBuiltinModule(t)}return Lt(t)},{createRequire:Pt}=St("node:module"),Tt=16,fe=32,Rt=64,T=128,le="positionals";class te extends Error{loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:s,name:o,stack:c,title:a}){super(s,{cause:e}),this.title=a,this.name=o,this.stack=c??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}}class A extends te{code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}}const tt=String.raw,Ie=tt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Bt=()=>new RegExp(tt`\p{RI}{2}|(?)${Ie}(?:\u200D${Ie})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const Go=/^[ \t]*(?:\r\n|\r|\n)/,Ho=/(?:\r\n|\r|\n)[ \t]*$/,Jo=/^(?:[\r\n]|$)/,Ko=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,Zo=/^[ \t]*[\r\n][ \t\r\n]*$/,Xo=/\r\n|\n|\r/g,Yo=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Qo=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,F=Bt(),zt=/[-_./\s]+/g,ce=/(\u001B\[[0-9;]*[a-z])/i,Le=new RegExp("\\p{Script=Arabic}","u"),Wt=new RegExp("\\p{Script=Bengali}","u"),Y=new RegExp("\\p{Script=Cyrillic}","u"),Ft=new RegExp("\\p{Script=Devanagari}","u"),qt=new RegExp("\\p{Script=Ethiopic}","u"),me=new RegExp("\\p{Script=Greek}","u"),Se=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),Gt=new RegExp("\\p{Script=Gujarati}","u"),Ht=new RegExp("\\p{Script=Gurmukhi}","u"),Pe=new RegExp("\\p{Script=Hangul}","u"),Me=new RegExp("\\p{Script=Hebrew}","u"),Jt=new RegExp("\\p{Script=Hiragana}","u"),Ue=new RegExp("\\p{Script=Han}","u"),Kt=new RegExp("\\p{Script=Kannada}","u"),Zt=new RegExp("\\p{Script=Katakana}","u"),Xt=new RegExp("\\p{Script=Khmer}","u"),Yt=new RegExp("\\p{Script=Lao}","u"),S=new RegExp("\\p{Script=Latin}","u"),Qt=new RegExp("\\p{Script=Malayalam}","u"),en=new RegExp("\\p{Script=Myanmar}","u"),tn=new RegExp("\\p{Script=Oriya}","u"),nn=new RegExp("\\p{Script=Sinhala}","u"),on=new RegExp("\\p{Script=Tamil}","u"),sn=new RegExp("\\p{Script=Telugu}","u"),rn=new RegExp("\\p{Script=Thai}","u"),an=new RegExp("\\p{Script=Tibetan}","u"),Ve=/[\u02BB\u02BC\u0027]/u,ln=t=>t.replace(F,"");let cn=class{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}};const un=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),hn=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(un,"")},ge=new cn(1e3),pn=/[.*+?^${}()|[\]\\]/g,dn=t=>{const e=t.join("");if(ge.has(e)){const s=ge.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(pn,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return ge.set(e,i),i},fn=t=>{const e=[];let n=0,i;for(F.lastIndex=0;(i=F.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=F.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},mn=/[ČŠŽĐ]/i,nt=new Uint8Array(128),it=new Uint8Array(128),ot=new Uint8Array(128);for(let t=0;t<128;t++)nt[t]=t>=65&&t<=90?1:0,it[t]=t>=97&&t<=122?1:0,ot[t]=t>=48&&t<=57?1:0;const we=t=>nt[t],je=t=>it[t],ye=t=>ot[t],B=(t,e,n,i,s)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const f of c)if(f(t[0])){o=!0;break}if(!o&&!n)return[t];const a=[...t],u=[];let r=a[0],l="other";const d=Object.entries(e);for(const f of d){const[p,w]=f;if(w(a[0])){l=p;break}}let h=n&&i?a[0]===a[0].toLocaleUpperCase(i):!1;for(let f=1;f<a.length;f++){const p=a[f];let w="other";for(const v of d){const[b,C]=v;if(C(p)){w=b;break}}const $=n&&i?p===p.toLocaleUpperCase(i):!1;let m=!1;s?m=s(l,w,h,$,p,f,a):(l!==w&&l!=="other"&&w!=="other"&&(m=!0),n&&w!=="other"&&!h&&$&&(m=!0)),m?(u.push(r),r=p):r+=p,l=w,n&&(h=$)}return r&&r.length>0&&u.push(r),u.length>0?u:[t]},gn=(t,e,n,i)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return i.push(s),e+s.length;return e},st=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],s=t.length;for(let o=1;o<s;o++){const c=gn(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const a=t.codePointAt(o-1),u=t.codePointAt(o),r=a&&a<128&&we(a),l=u&&u<128&&we(u),d=a&&a<128&&je(a),h=a&&a<128&&ye(a),f=u&&u<128&&ye(u);if(d&&l){i.push(t.slice(n,o)),n=o;continue}if(h&&!f||!h&&f){i.push(t.slice(n,o)),n=o;continue}if(f&&!h){let p=!1,w=!1;if(o+1<s){const $=t.codePointAt(o+1);p=$&&$<128&&we($),w=$&&$<128&&ye($)}if(!w&&p){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<s){const p=t.codePointAt(o+1),w=p&&p<128&&je(p);if(r&&l&&w){const $=t.slice(n,o+1);e.has($)||(i.push(t.slice(n,o)),n=o)}}}return n<s&&i.push(t.slice(n)),i.filter(o=>o!=="")},rt=(t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e),p=f,w=f?0:-1;for(let $=1;$<l;$++){const m=r[$],v=m===m.toLocaleUpperCase(e);if(v===f)h+=m;else if(v)h&&h.length>0&&(d.push(h),h=m),p=!0,w=$;else{if(p&&$-w>1){const b=r[$-1],C=h.slice(0,-1);C&&C.length>0&&d.push(C),h=b+m}else h+=m;p=!1,w=-1}f=v}return h&&h.length>0&&d.push(h),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!Y.test(t)&&!S.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0];const f=r[0];let p;Y.test(f)?p=1:S.test(f)?p=2:p=0;let w=f===f.toLocaleUpperCase(e);for(let m=1;m<l;m++){const v=r[m];let b;Y.test(v)?b=1:S.test(v)?b=2:b=0;const C=v===v.toLocaleUpperCase(e);p!==b&&(p===1||p===2)&&(b===1||b===2)||b===p&&!w&&C?(d.push(h),h=v):h+=v,p=b,w=C}h&&h.length>0&&d.push(h);const $=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&S.test(d[m])&&Y.test(d[m+1][0])?($.push(d[m]+d[m+1]),m+=1):$.push(d[m]);return $}if(e.startsWith("el")){if(!me.test(t)&&!S.test(t))return[t];const r=[];Se.lastIndex=0;let l;for(;(l=Se.exec(t))!==null;)r.push(l[0]);r.length===0&&r.push(t);const d=[];if(r.length===1){const h=r[0];if(!h||!me.test(h[0])||h.length===1)return[h??t]}for(const h of r){if(!h)continue;if(!me.test(h[0])||h.length===1){d.push(h);continue}const f=h.length;let p=h[0],w=h[0]===h[0].toLocaleUpperCase(e);for(let $=1;$<f;$++){const m=h[$],v=m===m.toLocaleUpperCase(e);!w&&v?(d.push(p),p=m):p+=m,w=v}p&&d.push(p)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),l=r?{hiragana:h=>Jt.test(h),kanji:h=>Ue.test(h),katakana:h=>Zt.test(h),latin:h=>S.test(h)}:{hangul:h=>Pe.test(h),latin:h=>S.test(h)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const h=B(t,l,!1,e,(p,w)=>p==="hiragana"&&w==="katakana"||p==="katakana"&&w==="hiragana"||p==="hiragana"&&w==="latin"||p==="katakana"&&w==="latin"||p==="kanji"&&w==="latin"||p==="latin"&&(w==="hiragana"||w==="katakana"||w==="kanji")),f=[];for(const p of h){const w=p;w.length===1&&d.has(w)&&f.length>0?f[f.length-1]=f.at(-1)+w:f.push(w)}return f.length>0?f:[t]}return B(t,l,!1,e,(h,f)=>h==="hangul"&&f==="latin"||h==="latin"&&f==="hangul")}if(e.startsWith("sl")){const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const w=r[p],$=w===w.toLocaleUpperCase(e),m=mn.test(w),v=p<l-1&&r[p+1]===r[p+1].toLocaleUpperCase(e);!f&&$||m&&v?(d.push(h),h=w,m&&v&&(d.push(h),h="")):h+=w,f=$}return h&&h.length>0&&d.push(h),d}if(e.startsWith("zh"))return B(t,{han:r=>Ue.test(r),latin:r=>S.test(r)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=l=>Me.test(l)||Le.test(l);return B(t,{latin:l=>S.test(l),rtl:l=>r(l)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const r=l=>Ft.test(l)||Wt.test(l)||Gt.test(l)||Ht.test(l)||Kt.test(l)||on.test(l)||sn.test(l)||Qt.test(l)||nn.test(l)||rn.test(l)||Yt.test(l)||an.test(l)||en.test(l)||qt.test(l)||Xt.test(l)||tn.test(l);return B(t,{indic:l=>r(l),latin:l=>S.test(l)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return B(t,{cyrillic:r=>Y.test(r),latin:r=>S.test(r)},!0,e);if(["ar","fa","he"].includes(e))return B(t,{latin:r=>S.test(r),rtl:r=>Me.test(r)||Le.test(r)},!1,e);if(e.startsWith("ko"))return B(t,{hangul:r=>Pe.test(r),latin:r=>S.test(r)},!1,e);if(e.startsWith("uz")){if(!Y.test(t)&&!S.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const w=r[p],$=w===w.toLocaleUpperCase(e);if(Ve.test(w)||Ve.test(r[p-1])){h+=w;continue}!f&&$?(d.push(h),h=w):h+=w,f=$}return h&&h.length>0&&d.push(h),d}const s=[...t],o=s.length,c=[];let a=s[0],u=s[0]===s[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){c.push(r),a=s[r.length],u=a===a.toLocaleUpperCase(e);break}for(let r=1;r<o;r++){const l=s[r],d=l===l.toLocaleUpperCase(e);let h=0;for(const f of n)if(t.startsWith(f,r)){c.push(a,f),h=f.length,a="";const p=f.at(-1);p&&(u=p===p.toLocaleUpperCase(e));break}if(h>0){r+=h-1;continue}!u&&d?(c.push(a),a=l):a+=l,u=d}return a&&c.push(a),c},wn=(t,e,n)=>{const i=[],s=ce.test(t)?t.split(ce).filter(Boolean):[t];for(const o of s){const c=o;if(ce.test(c))i.push(c);else{F.lastIndex=0;const a=F.test(c)?fn(c).filter(Boolean):[c];for(const u of a)if(F.lastIndex=0,F.test(u))i.push(u);else if(e){const r=e.toLowerCase().split("-")[0];i.push(...rt(u,r,n))}else i.push(...st(u,n))}}return i},yn=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:s=[],locale:o,normalize:c=!1,separators:a,stripAnsi:u=!1,stripEmoji:r=!1}=e,l=new Set([...s].toSorted((m,v)=>v.length-m.length));let d=t;u&&(d=hn(d)),r&&(d=ln(d));let h;Array.isArray(a)?h=dn(a):a instanceof RegExp?h=a:h=zt;const f=[];let p=d;const w=h.flags.includes("g")?h:new RegExp(h.source,`${h.flags}g`);for(;p.length>0;){const m=w.exec(p);if(!m){p===".."?f.push(".."):p==="."?f.push("."):p.length>0&&f.push(p);break}const v=m.index,b=m[0],C=b.length,k=p.slice(0,v),V=p.slice(v+C);if(b.startsWith("../"))f.push(".."),p=p.slice(v+3);else if(b.startsWith("./"))f.push("."),p=p.slice(v+2);else if(v===0&&b==="..")f.push(".."),p=p.slice(2);else if(v===0&&b===".")f.push("."),p=p.slice(1);else{k.length>0&&f.push(k);let O=0;for(;(O=b.indexOf("../",O))!==-1;)f.push(".."),O+=3;for(O=0;(O=b.indexOf("./",O))!==-1;)(O===0||b[O-1]!==".")&&f.push("."),O+=2;let g=V;for(;g.startsWith("../");)f.push(".."),g=g.slice(3);for(;g.startsWith("./");)f.push("."),g=g.slice(2);if(g===".."){f.push("..");break}else if(g==="."){f.push(".");break}else p=g}w.lastIndex=0}if(f.length===0){const m=d.split(h).filter(Boolean);f.push(...m)}let $=[];for(const m of f)n||i?$.push(...wn(m,o,l)):o?$.push(...rt(m,o,l)):$.push(...st(m,l));return c&&($=$.map(m=>l.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!l.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),$},R=new Uint32Array(65536),vn=(t,e)=>{const n=t.length,i=e.length,s=1<<n-1;let o=-1,c=0,a=n,u=n;for(;u--;)R[t.charCodeAt(u)]|=1<<u;for(u=0;u<i;u++){let r=R[e.charCodeAt(u)];const l=r|c;r|=(r&o)+o^o,c|=~(r|o),o&=r,c&s&&a++,o&s&&a--,c=c<<1|1,o=o<<1|~(l|c),c&=l}for(u=n;u--;)R[t.charCodeAt(u)]=0;return a},$n=(t,e)=>{const n=e.length,i=t.length,s=[],o=[],c=Math.ceil(n/32),a=Math.ceil(i/32);for(let p=0;p<c;p++)o[p]=-1,s[p]=0;let u=0;for(;u<a-1;u++){let p=0,w=-1;const $=u*32,m=Math.min(32,i)+$;for(let v=$;v<m;v++)R[t.charCodeAt(v)]|=1<<v;for(let v=0;v<n;v++){const b=R[e.charCodeAt(v)],C=o[v/32|0]>>>v&1,k=s[v/32|0]>>>v&1,V=b|p,O=((b|k)&w)+w^w|b|k;let g=p|~(O|w),y=w&O;g>>>31^C&&(o[v/32|0]^=1<<v),y>>>31^k&&(s[v/32|0]^=1<<v),g=g<<1|C,y=y<<1|k,w=y|~(V|g),p=g&V}for(let v=$;v<m;v++)R[t.charCodeAt(v)]=0}let r=0,l=-1;const d=u*32,h=Math.min(32,i-d)+d;for(let p=d;p<h;p++)R[t.charCodeAt(p)]|=1<<p;let f=i;for(let p=0;p<n;p++){const w=R[e.charCodeAt(p)],$=o[p/32|0]>>>p&1,m=s[p/32|0]>>>p&1,v=w|r,b=((w|m)&l)+l^l|w|m;let C=r|~(b|l),k=l&b;f+=C>>>i-1&1,f-=k>>>i-1&1,C>>>31^$&&(o[p/32|0]^=1<<p),k>>>31^m&&(s[p/32|0]^=1<<p),C=C<<1|$,k=k<<1|m,l=k|~(v|C),r=C&v}for(let p=d;p<h;p++)R[t.charCodeAt(p)]=0;return f},xn=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?vn(t,e):$n(t,e)};let bn;const Nn=t=>(bn??=Pt(import.meta.url))(t),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,An=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,n]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ie.getBuiltinModule(t)}return Nn(t)},{writeFile:kn,stat:Cn,rm:En,readFile:De,readdir:_n,mkdir:On,access:In}=An("node:fs/promises"),re=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let G=class extends A{commandName;constructor(e,n=[]){const i=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(i,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}},at=class extends A{option1;option2;constructor(t,e){super(`Options "${t}" and "${e}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:t,option2:e}),this.name="ConflictingOptionsError",this.option1=t,this.option2=e,this.hint=`Remove either --${t} or --${e}`}},Ln=class extends A{unknownOptions;constructor(t,e){const n=t.join(", "),i=`Found unknown ${t.length===1?"option":"options"}: ${n}`;super(i,"UNKNOWN_OPTION",{suggestions:e,unknownOptions:t}),this.name="UnknownOptionError",this.unknownOptions=t,e&&e.length>0&&(this.hint=`Did you mean: ${e.join(", ")}?`)}},Sn=class extends A{pluginName;constructor(t,e,n){super(`Plugin "${t}" error: ${e}`,"PLUGIN_ERROR",{originalError:n,pluginName:t}),this.name="PluginError",this.pluginName=t,n&&(this.cause=n)}},Pn=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(t){this.logger=t}hasPlugins(){return this.plugins.size>0}register(t){if(this.initialized)throw new Error(`Cannot register plugin "${t.name}" after initialization`);if(this.plugins.has(t.name))throw new Error(`Plugin "${t.name}" is already registered`);he().CEREBRO_OUTPUT_LEVEL===String(T)&&this.logger.debug(`registering plugin: ${t.name}`),this.plugins.set(t.name,t),this.cachedDependencyOrder=void 0}async init(t){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const e=this.getDependencyOrder();this.logger.debug(`initializing ${String(e.length)} plugin(s)...`);for(const n of e)if(typeof n.init=="function"){this.logger.debug(`initializing plugin: ${n.name}`);try{await n.init(t)}catch(i){const s=new Sn(n.name,`Failed to initialize: ${i instanceof Error?i.message:String(i)}`,i instanceof Error?i:void 0);throw this.logger.error(s.message),s}}this.initialized=!0}async executeLifecycle(t,e,n){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const i=this.getDependencyOrder();for(const s of i){const o=s[t];if(typeof o=="function"){this.logger.debug(`executing ${t} hook for plugin: ${s.name}`);try{await(t==="afterCommand"?o(e,n):o(e))}catch(c){throw this.logger.error(`Error in ${t} hook for plugin "${s.name}":`,c),c}}}}async executeErrorHandlers(t,e){if(!this.initialized||this.plugins.size===0)return;const n=this.getDependencyOrder();for(const i of n)if(typeof i.onError=="function"){this.logger.debug(`executing error handler for plugin: ${i.name}`);try{await i.onError(t,e)}catch(s){this.logger.error(`Error in error handler for plugin "${i.name}":`,s)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,i=s=>{if(e.has(s))return;if(n.has(s))throw new Error(`Circular dependency detected involving plugin "${s}"`);const o=this.plugins.get(s);if(!o)throw new Error(`Plugin "${s}" not found`);if(n.add(s),o.dependencies)for(const c of o.dependencies)i(c);n.delete(s),e.add(s),t.push(o)};for(const s of this.plugins.keys())i(s);return this.cachedDependencyOrder=t,t}validateDependencies(){for(const t of this.plugins.values())if(t.dependencies){for(const e of t.dependencies)if(!this.plugins.has(e))throw new Error(`Plugin "${t.name}" depends on "${e}" which is not registered`)}}};const oe=t=>t.type?.name==="Boolean",Mn=t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},Te=t=>(oe(t)||(t.typeLabel=t.typeLabel??Mn(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Un=new RegExp(/^-([^\d-])$/),Vn=new RegExp(/^--(\S+)/),jn=new RegExp(/^-([^\d-]{2,})$/),Dn=t=>Un.test(t)||Vn.test(t)||jn.test(t),Tn=(t,e)=>{const n=e[0]&&Dn(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}};let Rn=class lt extends te{optionName;value;constructor(e,n,i){super({hint:`Pass a valid ${i} value for '${e}'.`,message:`Invalid ${i} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,lt.prototype)}},Bn=class ct extends te{optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,ct.prototype)}},Re=class ut extends te{optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,ut.prototype)}},zn=class ht extends te{value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,ht.prototype)}},P=class pt extends te{constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,pt.prototype)}};const J=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",ke=t=>t===Number||typeof t=="function"&&t.name==="Number",Be=t=>t===String||typeof t=="function"&&t.name==="String",ze=(t,e,n)=>{const i=Number(t);if(e&&Number.isNaN(i)&&String(t).trim().toLowerCase()!=="nan")throw new Rn(n??"",String(t),"Number");return i},Wn=(t,e,n={})=>{const{optionName:i,strictTypes:s}=n;return Array.isArray(t)?J(e)?t.map(Boolean):ke(e)?t.map(o=>ze(o,s,i)):Be(e)?t.map(String):t.map(o=>e(String(o))):t===null?null:J(e)?!!t:ke(e)?ze(t,s,i):Be(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},_=(t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},Fn=/-([a-z])/g,qn=/^\d+$/,Gn=t=>t.codePointAt(0)===95,We=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],Fe=t=>t==="__proto__"||t==="constructor"||t==="prototype",ve=(t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},qe=(t,e,n,i,s)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??s?.get(c)}return o},Hn=(t,e,n,i)=>{const s=n.debug??!1;_(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),_(s,"Starting argument resolution","resolver"),_(s,"Tokens:","resolver",t),_(s,"Definitions:","resolver",e),_(s,"Processing tokens...","resolver");const o=new Map,c=new Map,a=n.caseInsensitive?new Map:void 0,u=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,l=n.camelCase?new Map:void 0;for(const g of e)if(o.set(g.name,g),g.alias&&c.set(g.alias,g),n.caseInsensitive&&a&&(a.set(g.name.toLowerCase(),g),g.alias&&u&&u.set(g.alias.toLowerCase(),g)),n.camelCase&&r&&l){const y=g.name.replaceAll(Fn,(x,I)=>I.toUpperCase());r.set(g.name,y),l.set(y,g.name)}const d=Object.create(null),h=Object.create(null),f=[],p=[],w=new Set;let $=!1;const m=e.find(g=>g.defaultOption),v=e.some(g=>g.group),b=e.find(g=>ke(g.type));for(let g=0;g<t.length;g++){const y=t[g];if(y.kind==="option-terminator"){d._unknown=i.slice(y.index),$=!0;break}if(y.kind==="option"&&y.name){let x=qe(y.name,o,c,a,u);!x&&y.value===void 0&&b&&qn.test(y.name)&&(x=b,y.value=y.name,y.name=b.name);let I=!1;if(!x&&n.negation&&y.value===void 0&&y.name.startsWith("no-")){const E=y.name.slice(3),U=qe(E,o,c,a,u);U?.type&&J(U.type)&&(x=U,I=!0)}const N=x?x.name:y.name,L=x?.multiple,M=x?.lazyMultiple;if(Object.hasOwn(h,N)&&h[N]!==void 0&&!L&&!M&&!n.partial)throw new Bn(N);if(!x&&n.partial){const E=y.rawName??`--${y.name}${y.value!==void 0&&y.inlineValue?`=${y.value}`:""}`;f.push({index:y.index,value:E});continue}if(!x&&n.stopAtFirstUnknown){d._unknown=i.slice(y.index);break}if(!x&&!n.partial)throw new Re(y.name);if(y.value===void 0){const E=t[g+1],U=E?.kind==="option"&&!("name"in E)&&E.value!==void 0,j=E&&x&&!(x.type&&J(x.type))&&(E.kind==="positional"||U),_t=x&&x.defaultOption&&!x.multiple&&!x.lazyMultiple;if(j&&(!x?.defaultOption||_t))if(L){let D=g+1;const de=[];for(;D<t.length&&(t[D].kind==="positional"||t[D].kind==="option"&&!("name"in t[D])&&t[D].value!==void 0);)de.push(t[D].value),w.add(t[D].index),D++;h[N]=h[N]===void 0?de:We(h[N],de),g=D-1}else M?(ve(h,N,E.value,!0),w.add(E.index),g++):(h[N]=E.value,w.add(E.index),g++);else x?.type&&J(x.type)?ve(h,N,!I,L):(L||M)&&h[N]!==void 0?ve(h,N,null,!0):h[N]=L?[]:null}else{let{value:E}=y;if(x?.type&&J(x.type))switch(E){case"":{if(n.partial){const j=`${y.rawName??`--${y.name}`}${y.value?`=${y.value}`:""}`;p.push({index:y.index,value:j}),E=!0}else throw new Re(y.name);break}case"false":{E=!1;break}case"true":{E=!0;break}default:E=!0}const U=[E];if(L){let j=g+1;for(;j<t.length&&t[j].kind==="positional";)U.push(t[j].value),w.add(t[j].index),j++;g=j-1}h[N]===void 0?h[N]=L||M?U:E:L||M?h[N]=We(h[N],U):h[N]=E}}else if(y.kind==="positional"&&n.stopAtFirstUnknown&&!w.has(y.index)&&!m){_(s,`Found unconsumed positional token at index ${String(y.index)}, stopping processing`,"resolver"),d._unknown=i.slice(y.index);break}}for(const[g,y]of Object.entries(h)){const x=o.get(g);x&&(x.multiple||x.lazyMultiple)&&!Array.isArray(y)&&(h[g]=[y])}const C=g=>g.kind==="option"&&!o.has(g.name??"")&&!c.has(g.name??"")&&(!n.caseInsensitive||!a?.has(g.name?.toLowerCase()??"")&&!u?.has(g.name?.toLowerCase()??""));let k=-1,V=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!$&&(k=t.findIndex(g=>C(g)),k!==-1&&(V=t[k].index)),m){const g=[],y=[];for(const x of t)x.kind==="positional"&&!w.has(x.index)&&x.index<V&&(g.push(x.value),y.push(x));if(g.length>0){const x=h[m.name],I=m.multiple??m.lazyMultiple;x===void 0?I?(y.forEach(N=>w.add(N.index)),h[m.name]=g):(w.add(y[0].index),h[m.name]=g[0]):I&&(y.forEach(N=>w.add(N.index)),h[m.name]=Array.isArray(x)?[...g,...x]:[...g,x])}}if(!n.partial){for(const g of t)if(g.kind==="positional"&&!w.has(g.index))throw new zn(i[g.index])}if(n.partial&&!n.stopAtFirstUnknown){const g=[...f];for(const y of p)g.push({index:y.index,value:y.value});for(const y of t)y.kind==="positional"&&!w.has(y.index)&&g.push({index:y.index,value:i[y.index]});g.length>0&&(g.sort((y,x)=>y.index-x.index),d._unknown=g.map(y=>y.value))}if(n.stopAtFirstUnknown&&!$){const g=t.findIndex(x=>x.kind==="positional"&&!w.has(x.index));let y=-1;if(k!==-1&&g!==-1?y=Math.min(k,g):k!==-1?y=k:g!==-1&&(y=g),y>=0){const x=t[y].index;d._unknown=i.slice(x)}}for(const[g,y]of Object.entries(h)){const x=n.camelCase?r?.get(g)??g:g,I=o.get(g);I?.type?d[x]=Wn(y,I.type,{optionName:I.name,strictTypes:n.strictTypes}):d[x]=y===void 0?null:y}for(const g of e){const y=n.camelCase?r?.get(g.name)??g.name:g.name;!(y in d)&&g.defaultValue!==void 0&&(g.multiple??g.lazyMultiple?d[y]=Array.isArray(g.defaultValue)?[...g.defaultValue]:[g.defaultValue]:d[y]=g.defaultValue)}if(v){const g={},y={},x={};for(const N of e)if(N.group){const L=Array.isArray(N.group)?N.group:[N.group];for(const M of L)Fe(M)||(g[M]??={})}for(const N of Object.keys(d))if(!Gn(N)){y[N]=d[N];let L=N;n.camelCase&&(L=l?.get(N)??N);const M=o.get(L);if(M?.group){const E=Array.isArray(M.group)?M.group:[M.group];for(const U of E)Fe(U)||g[U]&&(g[U][N]=d[N])}else x[N]=d[N]}const I={_all:y};for(const[N,L]of Object.entries(g))I[N]=L;Object.keys(x).length>0&&(I._none=x),d._unknown&&(I._unknown=d._unknown),Object.keys(d).forEach(N=>delete d[N]),Object.assign(d,I)}const O=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));return _(s,"Final parsed result:","resolver",O),O},ee="-".codePointAt(0),K="=",Jn=K.codePointAt(0),Kn="--",Zn="-",Xn="--",dt=t=>t.length>2&&t.startsWith(Xn),Yn=t=>dt(t)&&!t.includes(K,3),Qn=t=>dt(t)&&t.includes(K,3),ei=t=>{if(t.length!==2||t.codePointAt(0)!==ee||t.codePointAt(1)===ee)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},ti=t=>{if(t.length<=2||t.codePointAt(0)!==ee||t.codePointAt(1)===ee)return!1;const e=t.codePointAt(1);return!(e!==void 0&&e>=48&&e<=57)},ni=t=>{const e=[];let n=0,i=[],s=0,o=-1,c=0;for(;s<i.length||n<t.length;){let a;if(s<i.length?(a=i[s],s++):(a=t[n],n++),c>0?c--:o++,a===Kn){e.push({index:o,kind:"option-terminator"});const u=[...i.slice(s),...t.slice(n)],r=u.map((l,d)=>({index:o+d+1,kind:"positional",value:l}));e.push(...r),o+=u.length;break}if(ei(a)){const u=a.charAt(1);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(ti(a)&&!a.includes(K)){const u=[];let r="",l=!1;for(let d=1;d<a.length;d++){const h=a.charAt(d);l?r+=h:h.codePointAt(0)===Jn?l=!0:u.push(`${Zn}${h}`)}if(l)if(u.length>0){const d=u.pop();u.push(`${d}=${r}`)}else u.push(r);i=s<i.length?[...u,...i.slice(s)]:u,s=0,c=u.length;continue}if(Yn(a)){const u=a.slice(2);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(Qn(a)){const u=a.indexOf(K),r=a.slice(2,u),l=a.slice(u+1);e.push({index:o,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}if(a.length>2&&a.codePointAt(0)===ee&&a.codePointAt(1)!==ee&&a.includes(K)){const u=a.indexOf(K),r=a.charAt(1),l=a.slice(u+1);e.push({index:o,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}e.push({index:o,kind:"positional",value:a})}return e},ii=/\d/,oi=t=>typeof t=="function",si=(t,e,n)=>{const i=n?.debug??!1;_(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,o=new Set,c=new Set,a=new Set;let u=0;for(const r of t){if(_(i,"Checking definition:","validation",r),!r.name)throw _(i,"Validation failed: name is required","validation"),new P("Invalid option definition: name is required");if(typeof r.name!="string")throw new P("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new P("Invalid option definition: name cannot be empty");const l=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&c.has(l))throw new P(`Invalid option definition: duplicate name '${r.name}'`);if(o.has(r.name)||e&&a.has(l))throw new P(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&c.add(l),r.alias!==void 0){if(typeof r.alias!="string")throw new P("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new P("Invalid option definition: alias must be a single character");if(ii.test(r.alias))throw new P("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new P('Invalid option definition: alias cannot be "-"');const d=e?r.alias.toLowerCase():"";if(o.has(r.alias)||e&&a.has(d))throw new P(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&c.has(d))throw new P(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);o.add(r.alias),e&&a.add(d)}if(r.defaultOption&&(u++,r.type!==void 0&&J(r.type)))throw new P("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&oi(r.type)))throw new P("Invalid option definition: invalid type")}if(u>1)throw _(i,"Validation failed: multiple defaultOptions not allowed","validation"),new P("Invalid option definition: multiple defaultOptions not allowed");_(i,"Validation completed successfully","validation")};function ri(t,e={}){const n=e.debug??!1;_(n,"Starting command-line-args parsing","index"),_(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const s=Array.isArray(t)?t:[t];_(n,"Normalized definitions:","index",s),si(s,i.caseInsensitive,n?i:void 0);let{argv:o}=i;o??=process.argv.slice(2),_(n,"Using argv:","index",o);let c=o;i.caseInsensitive&&(c=o.map(r=>{if(r.startsWith("--")){const l=r.indexOf("="),d=(l===-1?r.slice(2):r.slice(2,l)).toLowerCase();return l===-1?`--${d}`:`--${d}${r.slice(l)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const l=r.indexOf("="),d=l===-1?r.slice(1):r.slice(1,l);if(!d)return r;const h=d.toLowerCase();return l===-1?`-${h}`:`-${h}${r.slice(l)}`}return r}));const a=ni(c.map(String));_(n,"Tokenized arguments:","index",a);const u=Hn(a,s,i,o);return _(n,"Command-line-args parsing completed","index"),u}class ai{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let $e=class extends A{commandName;constructor(e,n,i){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",i!==void 0&&(this.cause=i)}};const li=/^-{1,2}(\w+)(=(.+))?$/,ft=(t,e,n,i)=>{const s=li.exec(t);if(s===null)return{};const o=s[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(a=>a.name===o||a.alias===o);return c!==void 0?{argName:c.name,argValue:s[3],option:c}:{}},Ge=(t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},ci=new Set(["0","1","false","true"]),ui=(t,e,n,i)=>{if(e.length===0||t.length===0)return{};const s=(o,c)=>{const{argName:a,argValue:u,option:r}=ft(c,e,n,i),{lastOption:l}=o;return r&&oe(r)&&u&&a?o.partial[a]=Ge(u,r):o.lastName&&l&&oe(l)&&ci.has(c)&&(o.partial[o.lastName]=Ge(c,l)),{lastName:a,lastOption:r,partial:o.partial}};return t.reduce(s,{partial:{}}).partial},hi=new Set(["0","1","false","true"]),pi=(t,e,n,i)=>{if(e.length===0||t.length===0)return t;const s=(o,c)=>{const{argValue:a,option:u}=ft(c,e,n,i),{lastOption:r}=o;if(r&&oe(r)&&hi.has(c)){const{args:l}=o;return{args:l.slice(0,-1)}}return u&&oe(u)&&a?{args:o.args}:{args:[...o.args,c],lastOption:u}};return t.reduce(s,{args:[]}).args},di=t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},fi=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},mi=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return fi(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},gi=/_./g,wi=/^[A-Z]/,yi=t=>t.toLowerCase().replaceAll(gi,e=>e[1]?.toUpperCase()??e).replace(wi,e=>e.toLowerCase()),vi=(t,e=he())=>{if(!t||t.length===0)return{};const n={};for(const i of t){const s=e[i.name],o=mi(i,s),c=o===void 0?i.defaultValue:o,a=yi(i.name);n[a]=c}return n},$i=t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const s=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of s)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},mt=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new $e(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new $e(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new $e(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},xi=(t,e,n,i,s)=>{const o=new ai(t.name,t),{_all:c,_unknown:a,positionals:u}=e,r=Object.keys(n).length>0?{...c,...n}:c;le in r&&delete r[le],o.argument=u?.[le]??[],o.rawUnknown=[...a??[]];const l=Object.keys(i).length>0;return o.options=l?{...r,...i}:r,o.env=vi(t.env,s),o},bi=(t,e,n)=>{const i=t.options??[],s=i.length>0;let o=di(s?[...i,...n]:n);if(o.length>0){for(const r of o)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:le,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,a;if(s){const{optionMapByAlias:r,optionMapByName:l}=$i(i);c=pi(e,i,l,r),a=ui(e,i,l,r)}else c=e,a={};const u=ri(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:a,parsedArgs:u}},xe=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await mt(t))(e),Ni=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Ai=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),ki=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let s="",o="";for(let c=0;c<n;c++){const a=t[c];if(ce.test(a)){s?(i.push(s+o+a),s="",o=""):(i.length>0&&i.push(e),s=a);continue}s?(o&&(o+=e),o+=a):(i.length>0&&i.push(e),i.push(a))}return i.join("")},Q=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return ki(yn(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(i=>{const s=i,o=s.toLowerCase();return n?(n=!1,Ni(o)):Ai(o)}),"")};let Ci=class extends A{commandName;missingOptions;constructor(t,e){super(`Command "${t}" is missing required options: ${e.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:t,missingOptions:e}),this.name="CommandValidationError",this.commandName=t,this.missingOptions=e,this.hint=`Provide the following required options: ${e.join(", ")}`}},Ei=class extends A{choices;option;value;constructor(t,e,n){super(`Invalid value "${e}" for option "${t}". Allowed values: ${n.join(", ")}`,"INVALID_CHOICE",{choices:n,option:t,value:e}),this.name="InvalidChoiceError",this.option=t,this.value=e,this.choices=n,this.hint=`Use one of: ${n.map(i=>`--${t} ${i}`).join(", ")}`}};const He=(t,e,n=!1)=>{const i=[],s=e._all??e;for(const o of t){if(!n&&!o.required)continue;const c=o.__camelCaseName__??o.name;if(s[c]===void 0){if(o.type?.name==="Boolean"){e[c]=!1;continue}i.push(o)}}return i},_i=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:xn(t,e)<=t.length/3,z=(t,e)=>{const n=t.toLowerCase();return e.filter(i=>_i(i.toLowerCase(),n))},Oi=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const s=i.startsWith("--");let o=`Found unknown ${s?"option":"argument"} "${i}"`;if(s){const c=z(i.replace("--",""),(e.options??[]).map(a=>a.name));if(c.length>0){const[a,...u]=c.map(r=>`--${r}`);o+=u.length>0?`, did you mean ${a??""} or ${u.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
|
|
2
|
-
`))},Ii=(t,e,n)=>{const i=n.__requiredOptions__,s=i?He(i,e,!0):He(t,e,!1);if(s.length>0)throw new Ci(n.name,s.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&Oi(e,n)},Li=(t,e,n)=>{const i=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(i.length>0){const s=i.find(o=>{const c=o.__camelCaseName__??Q(o.name);return Array.isArray(o.conflicts)?o.conflicts.some(a=>e[Q(a)]!==void 0)&&e[c]!==void 0:e[Q(o.conflicts)]!==void 0&&e[c]!==void 0});if(s)throw new at(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},Si=(t,e)=>{const n=e.options;if(n)for(const i of n){if(!i.choices||i.choices.length===0)continue;const s=i.__camelCaseName__??Q(i.name),o=t[s];if(o==null)continue;const c=Array.isArray(o)?o:[o];for(const a of c){const u=String(a);if(!i.choices.includes(u))throw new Ei(i.name,u,i.choices)}}},Pi=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const o=e.get(s.name)??[];o.push(s),e.set(s.name,o)}if(typeof s.alias=="string"&&s.alias.length>0){const o=n.get(s.alias)??[];o.push(s),n.set(s.alias,o)}else if(Array.isArray(s.alias)){for(const o of s.alias)if(o.length>0){const c=n.get(o)??[];c.push(s),n.set(o,c)}}}const i=[];for(const[s,o]of e)o.length>1&&i.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[s,o]of n)o.length>1&&i.push(`Duplicate option alias "-${s}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
3
|
-
`))},Mi=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let s=1;s<=e.length;s+=1){const o=e[s-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:s})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},H=t=>t.join(" "),Je=(t,e)=>e&&e.length>0?[...e,t]:[t],Ui=/^no-/,Vi=t=>{t.options?.forEach(e=>{e.__camelCaseName__=Q(e.name)})},ji=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const s=i.name.replace(Ui,"");if(!e.has(s)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:s};n.push(o),e.add(s)}}n.length>0&&t.options.push(...n)},Di=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const c=Q(o.name);i.set(c,o)}const s=Object.keys(n).filter(o=>i.has(o));if(s.length!==0)for(const o of s){const c=o.charAt(2);if(!c)continue;const a=c.toLowerCase()+o.slice(3),u=i.get(o);u&&(u.__negated__=!0),n[a]=!n[o],Reflect.deleteProperty(n,o)}},Ti=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:i}=t;for(const s of Object.keys(i)){const o=n.get(s);if(o?.implies){const{implies:c}=o;for(const[a,u]of Object.entries(c))i[a]===void 0&&(i[a]=u)}}},Ri=()=>!!process.versions.electron,Bi=()=>Ri()&&!process.defaultApp,zi=()=>Bi()?0:1,Wi=t=>t.slice(zi()+1),Fi=" ",qi=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),Gi=t=>{if(typeof t=="string")return t.split(Fi);const e=Ae();return qi(t,e)?Wi(t):t},Hi=t=>{const e=o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),W(1)},n=(o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let a;if(typeof o=="string")a=o;else try{a=JSON.stringify(o)}catch{a=String(o)}t.error(`Promise rejection: ${a}`)}W(1)},i=Oe("uncaughtException",e),s=Oe("unhandledRejection",n);return()=>{i(),s()}},Ke=100,Ji=/^[a-z][\w-]*$/i,Ce=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new A(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},Ze=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new A(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},be=(t,e)=>{if(typeof t!="object"||t===null)throw new A(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},ae=t=>{const e=Ce(t,"Command name");if(e.length>Ke)throw new A(`Command name is too long (maximum ${String(Ke)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new A(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Ji.test(e))throw new A(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},Ki=new Set([`
|
|
4
|
-
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Zi=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,i=n.maxArgumentLength??1e6;if(Number.isFinite(i)&&i>0&&t.length>i)throw new Error(`Argument is too long (maximum ${String(i)} characters)`);if(n.checkDangerousChars){for(const s of t)if(Ki.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},Xe=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,i=n.maxArguments??1e5;if(Number.isFinite(i)&&i>0&&t.length>i)throw new Error(`Too many arguments (maximum ${String(i)})`);return t.map(s=>Zi(s,n))},Xi=/^-([^\d-])$/,Yi=/^--(\S+)/,Qi=/^-([^\d-]{2,})$/,Ne=t=>Xi.test(t)||Yi.test(t)||Qi.test(t),eo={access:(t,e)=>In(t,e),mkdir:(t,e)=>On(t,e),readdir:t=>_n(t),readFile:(async(t,e)=>e===void 0?De(t):De(t,e)),rm:(t,e)=>En(t,e),stat:t=>Cn(t),writeFile:(t,e,n)=>kn(t,e,n)},to=(t,e,n)=>{const i=e.indexOf("--"),s=i===-1?new Set:new Set(e.slice(i+1)),o=n.filter(u=>u.startsWith("--")&&u!=="--"&&!s.has(u));if(o.length===0)return;const c=(t.options??[]).map(u=>u.name),a=o.flatMap(u=>z(u.slice(2),c).map(r=>`--${r}`));throw new Ln(o,a)};let no=class gt{#t;#e;#u;#p;#d;#f;#A;#k;#C;#$;#E;#x;#_;#b=fe;#h;#n;#i;#o;#s;#r;#O=!1;#I;#L=!1;#m;#g;#w;#l=[];#j(){return this.#m===void 0&&(this.#m=[...this.#i.keys()]),this.#m}#S(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#a(){return this.#w===void 0&&(this.#w=[...this.#j(),...this.#S()]),this.#w}#P(){return this.#l.length===0?re:[...re,...this.#l]}#M(){this.#m=void 0,this.#g=void 0,this.#w=void 0}#N(){if(this.#u===void 0){const e=Gi(this.#e.argv);this.#u=Xe(e,{maxArguments:this.#x}),this.#D()}return this.#u}#y(){return this.#$??he()}#v(e){this.#b=e,this.#y().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){return this.#b}#D(){if(!this.#u)return;let e=!1;for(const n of this.#u){if(n==="--quiet"||n==="-q"){this.#v(Tt),e=!0;break}if(n==="--verbose"||n==="-v"){this.#v(Rt),e=!0;break}if(n==="--debug"){this.#v(T),e=!0;break}}e||this.#v(Object.hasOwn(this.#y(),"DEBUG")?T:fe)}#T(){this.#L||(this.#I=Hi(this.#t),this.#L=!0)}#R(){return{arch:Ut(),argv:this.#N(),cwd:this.#p,env:this.#$??he(),exit:this.#C??(e=>W(e??0)),platform:Mt(),stdin:this.#E}}#U(e,n,i,s){this.#c()===T&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:a}=bi(e,n,this.#P()),u=Object.keys(c).length>0;let r=a;u&&(r={...a,_all:{...a._all,...c}}),Ii(o,r,e);const l=xi(e,a,c,i,this.#y());l.runtime=this,l.argv=this.#N(),l.fs=this.#k??eo,l.process=this.#R(),l.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const h=e.options.filter(f=>f.name.startsWith("no-"));for(const f of h){const p=f.name.slice(3),w=`--${f.name}`,$=`--${p}`,m=n.includes(w),v=n.includes($);if(m&&v)throw new at(p,f.name)}}return d&&(Di(l,e),Ti(l,e)),Li(o,l.options,e),Si(l.options,e),this.#_&&to(e,n,l.rawUnknown),this.#c()===T&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(l.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(l.argument,null,2))),{arguments_:o,booleanValues:c,commandArgs:r,parsedArgs:a,toolbox:l}}async#V(e,n,i){const s=this.getPluginManager();try{!this.#O&&s.hasPlugins()&&(await s.init({cli:this,cwd:this.#p,logger:this.#t}),this.#O=!0),await s.executeLifecycle("execute",n),await s.executeLifecycle("beforeCommand",n);let o;const c=i.global;if(c?.help){const a=this.#n.get("help");if(!a)throw new A("Help command not found","COMMAND_NOT_FOUND");o=await xe(a,n)}else if(c?.version??c?.V){const a=this.#n.get("version");if(!a)throw new A("Version command not found","COMMAND_NOT_FOUND");o=await xe(a,n)}else o=await xe(e,n);return await s.executeLifecycle("afterCommand",n,o),o}catch(o){throw await s.executeErrorHandlers(o,n),o}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new A("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#d=e.trim();const i=n.argv??Ae(),s=n.cwd??Vt();if(this.#e={...n,argv:i,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new A("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new A("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new A("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new A("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const d=["debug","error","info","log","warn"],h=[],f=this.#e.logger;for(const p of d)typeof f[p]!="function"&&h.push(p);if(h.length>0)throw new A(`Logger object is missing required methods: ${h.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:h});this.#t=this.#e.logger}else this.#t={...console,debug:(...d)=>{this.#c()===T&&console.debug(...d)}};this.#f=this.#e.packageVersion,this.#A=this.#e.packageName,this.#p=this.#e.cwd,this.#s="help",this.#r={};const o=n.fs;if(o!==void 0&&(typeof o!="object"||o===null))throw new A("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const c=n.exit;if(c!==void 0&&typeof c!="function")throw new A("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new A("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const u=n.stdin;if(u!==void 0&&typeof u!="string")throw new A("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#k=n.fs,this.#C=n.exit,this.#$=n.env,this.#E=n.stdin??"",this.#x=n.maxArguments,this.#_=n.strictOptions??!1;const r=this.#y().CEREBRO_OUTPUT_LEVEL,l=r===void 0?Number.NaN:Number(r);this.#b=Number.isNaN(l)?fe:l,this.#n=new Map,this.#i=new Map,this.#o=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#d}${this.#f?` v${this.#f}`:""}`),this.#r}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){be(e,"Command"),ae(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new A(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new A(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?ae(e.alias):Ze(e.alias,"Command alias").forEach(r=>ae(r))),e.argument&&be(e.argument,"Command argument"),e.options&&be(e.options,"Command options"),e.commandPath&&(Ze(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{ae(r)}));const s=Je(e.name,e.commandPath),o=H(s);if(this.#i.has(o))throw new A(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),u=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!c&&u)throw new A(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)Te(r);if(Pi(e),ji(e),Vi(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),c&&a!==void 0)this.#n.set(o,e);else{if(!c&&a!==void 0&&!u){const r=Je(a.name,a.commandPath);this.#n.set(H(r),a)}this.#n.set(e.name,e)}if(this.#i.set(o,s),this.#o.set(o,e),this.#M(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const l of r){if(this.#c()===T&&this.#t.debug("adding alias",l),this.#n.has(l))throw new A(`Command alias "${l}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:l,commandName:e.name});this.#n.set(l,e)}}return this}addGlobalOption(e){const n=e,i=new Set(re.map(o=>o.name)),s=new Set(re.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new A(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new A(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new A(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",Te(n),this.#l.push(n),this}getGlobalOptions(){return this.#P()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#h?this.#h:(this.#h=new Pn(this.#t),this.#h.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#h)}getCliName(){return this.#d}getPackageVersion(){return this.#f}getPackageName(){return this.#A}getCommands(){return this.#n}getCwd(){return this.#p}dispose(){this.#I?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...s}=e;if(!this.#n.has("help")){const{default:m}=await import("../packem_chunks/help-command.js");this.addCommand(new m(this.#n))}const o=this.#S(),c=this.#i;this.#T();const a=this.#N();let u,r=[...a];this.#c()===T&&(this.#t.debug(`process.execPath: ${jt()}`),this.#t.debug(`process.execArgv: ${Dt().join(" ")}`),this.#t.debug(`process.argv: ${Ae().join(" ")}`));const l=Mi(c,[...a]);if(l.commandPath)u=l.commandPath,r=l.argv;else{if(a.length>1&&a[0]&&a[1]&&!Ne(a[0])&&!Ne(a[1])){const v=[];let b=0;for(;b<a.length;){const k=a[b];if(!k||Ne(k))break;v.push(k),b+=1}const C=H(v);if(v[0]&&!o.includes(v[0])){const k=this.#a(),V=z(C,k);throw new G(C,V)}}let m;try{m=Tn([null,...o],[...a])}catch(v){if(v instanceof Error&&v.name==="INVALID_COMMAND"&&"command"in v){const b=v.command,C=this.#a(),k=z(b,C);throw new G(b,k)}throw v}m.command&&(u=[m.command],r=m.argv)}if(!u)if(this.#s)u=[this.#s];else{const m=this.#a();throw new G("",m)}const d=H(u),h=this.#i.get(d);let f;if(h){if(f=this.#o.get(d),!f||H(h)!==d){const m=this.#a(),v=z(d,m);throw new G(d,v)}}else{const m=u.at(-1);if(f=m?this.#n.get(m):void 0,!f){const v=this.#a(),b=z(d,v);throw new G(d,b)}}if(typeof f.execute!="function"&&typeof f.loader!="function")return this.#t.error(`Command "${f.name}" has no function to execute.`),i?W(1):void 0;const p=r;let w,$;try{({commandArgs:w,toolbox:$}=this.#U(f,p,s,d))}catch(m){if(this.#t.error(m),i)return W(1);throw m}try{return await this.#V(f,$,w),i?W(0):void 0}catch(m){if(i)return this.#t.error(m),W(1);throw m}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...s}=n;Ce(e,"Command name");const o=e.split(" ").filter(Boolean),c=H(o),a=this.#i.get(c)?this.#o.get(c):this.#n.get(e);if(!a){const d=this.#a(),h=z(c||e,d);throw new G(e,h)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new A(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const u=[...Xe(i,{maxArguments:this.#x})];this.#c()===T&&this.#t.debug(`running command '${e}' programmatically with args: ${u.join(", ")}`);const{commandArgs:r,toolbox:l}=this.#U(a,u,s,c||e);return this.#V(a,l,r)}clone(e){const n={...this.#e,...e},i=new gt(this.#d,n);for(const[s,o]of this.#n)i.#n.set(s,o);for(const[s,o]of this.#i)i.#i.set(s,[...o]);for(const[s,o]of this.#o)i.#o.set(s,o);for(const s of this.#l)i.#l.push(s);return i.#s=this.#s,i.#r={...this.#r},i.#M(),i}async getAction(e){Ce(e,"Command name");const n=e.split(" ").filter(Boolean),i=H(n),s=this.#i.get(i)?this.#o.get(i):this.#n.get(e);if(!s){const o=this.#a(),c=z(i||e,o);throw new G(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return mt(s);throw new A(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}};const is=(t,e)=>new no(t,e),io=globalThis.process??Object.create(null),Ye={versions:{}},se=new Proxy(io,{get(t,e){if(e in t)return t[e];if(e in Ye)return Ye[e]}}),oo=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
5
|
-
`),so=(t,e,n,i)=>{const s={column:0,line:-1,...t.start},o={...s,...t.end},c=s.line,a=s.column,u=o.line,r=o.column;let l=Math.max(c-(n+1),0),d=Math.min(e.length,u+i);c===-1&&(l=0),u===-1&&(d=e.length);const h=u-c,f={};if(h)for(let p=0;p<=h;p++){const w=p+c;if(!a)f[w]=!0;else if(p===0){const $=e[w-1]?.length;f[w]=[a,($??0)-a+1]}else if(p===h)f[w]=[0,r];else{const $=e[w-p]?.length;f[w]=[0,$]}}else a===r?f[c]=a?[a,0]:!0:f[c]=[a,(r??0)-(a??0)];return{end:d,markerLines:f,start:l}},ro=se.platform==="win32"&&!se.env?.WT_SESSION?">":"❯",ao=(t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:p=>p,marker:p=>p,message:p=>p,...n?.color}},s=typeof e.start.column=="number";let o=(t.includes("\r")?oo(t):t).split(`
|
|
6
|
-
`);typeof i.tabWidth=="number"&&t.includes(" ")&&(o=o.map(p=>p.replaceAll(" "," ".repeat(i.tabWidth))));const{end:c,markerLines:a,start:u}=so(e,o,i.linesAbove,i.linesBelow),r=String(c).length,{gutter:l,marker:d,message:h}=i.color;let f=o.slice(u,c).map((p,w)=>{const $=u+1+w,m=a[$],v=String($).padStart(r),b=!a[$+1],C=` ${v}${i.showGutter?" |":""}`;if(m){let k="";if(Array.isArray(m)){const V=p.replaceAll(/[^\t]/g," ").slice(0,Math.max(m[0]-1,0)),O=m[1]||1;k=[`
|
|
7
|
-
`,i.prefix+l(C.replaceAll(/\d/g," "))," ",V,d("^").repeat(O)].join(""),b&&i.message&&(k+=` ${h(i.message)}`)}return[i.prefix+d(ro),l(C),p.length>0?` ${p}`:"",k].join("")}return`${i.prefix} ${l(C)}${p.length>0?` ${p}`:""}`}).join(`
|
|
8
|
-
`);return i.message&&!s&&(f=`${i.prefix+" ".repeat(r+1)+i.message}
|
|
9
|
-
${f}`),f},pe=t=>{let e;return()=>{if(e===void 0){if(typeof se.getBuiltinModule!="function")throw new TypeError(`[@visulima/error] Cannot load ${t}: this runtime implements no process.getBuiltinModule(). Requires Node ^22.14.0 || >=24.10.0, or another runtime providing process.getBuiltinModule().`);e=se.getBuiltinModule(t)}return e}},lo=()=>se.env?.DEBUG==="true",Z=(t,...e)=>{if(lo()){const n=e.map(i=>typeof i=="function"?i():i);console.debug(`error:parse-stacktrace: ${t}`,...n)}},X="<unknown>",co=/^(?:node:internal\/|node:|internal\/)/,uo=t=>t!==void 0&&co.test(t),ho=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,po=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,fo=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,mo=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,go=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,wo=/in\s(.*)\s\(at\s(.+)\)\sat/,yo=/^(?:.*@)?(.*):(\d+):(\d+)$/,vo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$o=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,xo=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Qe=/\(error: ([^)]*)\)/,bo=/at\s/,No=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Ao=/Error: |AggregateError:/,wt=/^Anonymous function$/,ko=/^\s*in\s.*/,Co=/^.*?\s*at\s.*/,Eo=/^.*?\s*@.*|\[native code\]/,yt=(t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:X,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},vt=(t,e)=>{const n=fo.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},_o=t=>{const e=wo.exec(t);if(e){Z(`parse nested node error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]??X,raw:t,type:void 0}}const n=go.exec(t);if(n){Z(`parse node error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const i={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(bo,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??X,raw:t,type:t.startsWith("internal")?"internal":void 0};return vt(i,`${n[2]}:${n[3]}:${n[4]}`),i}},Oo=t=>{const e=ho.exec(t);if(e){Z(`parse chrome error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,o;if(i){const r=po.exec(t);if(r){const l=No.exec(r[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):r[2]&&(e[2]=r[1]),r[2]&&(s={column:r[4]?+r[4]:void 0,file:r[2],line:r[3]?+r[3]:void 0,methodName:"eval",raw:t,type:"eval"})}else{const l=mo.exec(t);l&&(o={column:l[4]?+l[4]:void 0,file:l[2],line:l[3]?+l[3]:void 0},s={column:l[6]?+l[6]:void 0,file:l[1],line:l[5]?+l[5]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[c,a]=yt(e[1]?e[1].replace(wt,"<anonymous>"):X,e[2]),u={column:e[4]?+e[4]:void 0,evalOrigin:s,file:a,line:e[3]?+e[3]:void 0,methodName:c,raw:t,type:i?"eval":n?"native":uo(a)?"internal":void 0};return o?(u.column=o.column,u.file=o.file,u.line=o.line):vt(u,`${a}:${e[3]}:${e[4]}`),u}},Io=(t,e)=>{const n=vo.exec(t);if(n){Z(`parse gecko error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),s=i&&n[3]&&$o.exec(n[3]);let o;i&&s&&(n[3]=s[1],o={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:t,type:"eval"},n[4]=s[2]);const[c,a]=yt(n[1]?n[1].replace(wt,"<anonymous>"):X,n[3]);let u;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?u=e.column:!i&&n[5]&&(u=+n[5]);let r;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?r=e.line:n[4]&&(r=+n[4]),{column:u,evalOrigin:o,file:a,line:r,methodName:c,raw:t,type:i?"eval":a.includes("[native code]")?"native":void 0}}},Lo=(t,e)=>{const n=xo.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return Z(`parse firefox error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||X,raw:t,type:void 0}},So=t=>{const e=yo.exec(t);if(e)return Z(`parse react android native error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:X,raw:t,type:void 0}},$t=(t,{filter:e,frameLimit:n=50}={})=>{const i=t;let s=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
|
|
10
|
-
`).map(o=>(Qe.test(o)?o.replace(Qe,"$1"):o).trim()).filter(o=>!Ao.test(o)&&o!=="eval code");return e&&(s=s.filter(o=>e(o))),s=s.slice(0,n),s.reduce((o,c,a)=>{if(!c||c.length>1024)return o;let u;if(ko.test(c))u=_o(c);else if(Co.test(c))u=Oo(c);else if(Eo.test(c)){let r;if(a===0){const l=t,d=l.columnNumber,h=l.lineNumber,f=l.line,p=l.column;d||h?r={column:d,line:h,type:"firefox"}:(f||p)&&(r={column:p,line:f,type:"safari"})}u=Lo(c,r)??Io(c,r)}else u=So(c);return u?o.push(u):Z(`parse error stack line: "${c}"`,"not parser found"),o},[])},et=pe("node:fs"),ue=pe("node:path"),Po=pe("node:process"),Mo=pe("node:url"),q=(t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),xt=t=>t.replaceAll("\\","/"),Uo=t=>{if(!t.startsWith("file:"))return t;try{return Mo().fileURLToPath(t)}catch{return t}},Vo=(t,e)=>{const n=t.replace("async file:","file:");return xt(ue().relative(e,Uo(n)))},jo=(t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},bt=(t,{color:e,hideErrorTitle:n,indentation:i,prefix:s},o)=>`${q(s,i,o)}${jo(t,n,e)}
|
|
11
|
-
`,Nt=(t,{color:e,indentation:n,prefix:i},s)=>{if(t.hint===void 0)return;const o=q(i,n,s);let c="";if(Array.isArray(t.hint))for(const a of t.hint)c+=`${o+a}
|
|
12
|
-
`;else c+=o+t.hint;return e.hint(c)},Ee=(t,e)=>{if(!e||t.file===void 0||t.line===void 0)return{trace:t};try{const n=e({column:t.column,file:t.file,line:t.line});return n?{source:n.source,trace:{...t,column:n.column??t.column,file:n.file??t.file,line:n.line??t.line}}:{trace:t}}catch{return{trace:t}}},_e=(t,e,n=0)=>{const{color:i,cwd:s,displayShortPath:o,indentation:c,prefix:a}=e,{trace:u}=t;let r;u.file===void 0?r="<unknown>":r=o?Vo(u.file,s):xt(u.file);const{fileLine:l,method:d}=i;return`${q(a,c,n)}at ${u.methodName?`${d(u.methodName)} `:""}${l(r)}:${l(u.line?.toString()??"")}`},Do=(t,e)=>{if(e.allowAllFilePaths)return!0;const n=ue().resolve(e.cwd),i=ue().resolve(n,t);return i===n||i.startsWith(n+ue().sep)},To=t=>{try{return et().existsSync(t)?et().readFileSync(t,"utf8"):void 0}catch{return}},At=(t,e,n)=>{const{color:i,indentation:s,linesAbove:o,linesBelow:c,prefix:a,showGutter:u,showLineNumbers:r,tabWidth:l}=e,{source:d,trace:h}=t;if(h.file===void 0)return;let f;if(d===void 0){const p=h.file.replace("file://","");if(!Do(p,e))return;const w=To(p);if(w===void 0)return;f=w}else f=d;return ao(f,{start:{column:h.column,line:h.line}},{color:i,linesAbove:o,linesBelow:c,prefix:q(a,s,n),showGutter:u,showLineNumbers:r,tabWidth:l})},kt=(t,e,n)=>{if(t.errors.length===0)return;let i=`${q(e.prefix,e.indentation,n)}Errors:
|
|
13
|
-
|
|
14
|
-
`,s=!0;for(const o of t.errors)s?s=!1:i+=`
|
|
15
|
-
|
|
16
|
-
`,i+=Et(o,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
|
|
17
|
-
${i}`},Ro=t=>{if(typeof t=="object"&&t!==null)try{return JSON.stringify(t)}catch{return Object.prototype.toString.call(t)}return String(t)},Ct=(t,e,n,i=new Set)=>{i.add(t);let s=`${q(e.prefix,e.indentation,n)}Caused by:
|
|
18
|
-
|
|
19
|
-
`;const{cause:o}=t;if(!(o instanceof Error)){const u=Ro(o);return s+=`${q(e.prefix,e.indentation,n)}${e.color.title(u)}
|
|
20
|
-
`,`
|
|
21
|
-
${s}`}s+=bt(o,e,n);const c=$t(o).shift(),a=Nt(o,e,n);if(a&&(s+=`${a}
|
|
22
|
-
`),c){const u=Ee(c,e.sourceMap);if(s+=_e(u,e,n),!e.hideErrorCauseCodeView){const r=At(u,e,n);r!==void 0&&(s+=`
|
|
23
|
-
${r}`)}}if(o instanceof AggregateError){const u=kt(o,e,n);u!==void 0&&(s+=`
|
|
24
|
-
${u}`)}return o.cause&&(s+=i.has(o)?`
|
|
25
|
-
${q(e.prefix,e.indentation,n+1)}Caused by: [Circular]`:`
|
|
26
|
-
${Ct(o,e,n+1,i)}`),`
|
|
27
|
-
${s}`},Bo=(t,e)=>(t.length>0?`
|
|
28
|
-
`:"")+t.map(n=>_e(Ee(n,e.sourceMap),e)).join(`
|
|
29
|
-
`),Et=(t,e,n)=>{const i={allowAllFilePaths:!1,cwd:Po().cwd(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:a=>a,gutter:a=>a,hint:a=>a,marker:a=>a,message:a=>a,method:a=>a,title:a=>a,...e.color}},s=$t(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),o=s.shift(),c=o?Ee(o,i.sourceMap):void 0;return[e.hideMessage?void 0:bt(t,i,n),Nt(t,i,n),c?_e(c,i,n):void 0,c&&!i.hideErrorCodeView?At(c,i,n):void 0,t instanceof AggregateError?kt(t,i,n):void 0,t.cause===void 0||t.cause===null?void 0:Ct(t,i,n),s.length>0?Bo(s,i):void 0].filter(Boolean).join(`
|
|
30
|
-
`)},zo=(t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return Et(t,e,0)},os=(t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:i,runtime:s}=n,{concise:o,detailed:c=!1,exitOnError:a=!0,formatter:u,logErrors:r=!0,renderOptions:l={}}=t;if(r)if(u)i.error(u(e));else if(!c&&o?.(e))i.error(e.message);else if(c){const d=s.getCwd(),h=zo(e,{cwd:d,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...l});i.error(h)}else i.error(e);a&&W(1)},version:"1.0.0"}),ss=async t=>{try{await t.run({shouldExitProcess:!1})}catch{process.exitCode=process.exitCode||1}finally{process.exit(process.exitCode??0)}},rs={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"],["vis dlx --info create-vite","Always show the first-run panel (size, score, permissions, changelog)"],["vis dlx --yes create-vite my-app","Skip the first-run panel and confirmation"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler66.js"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean},{alias:"y",defaultValue:!1,description:"Skip the first-run info panel and confirmation prompt (also via VIS_DLX_YES — note this auto-approves every package)",name:"yes",type:Boolean},{defaultValue:!1,description:"Always show the first-run info panel (size, security score, permissions, changelog), even for an approved package",name:"info",type:Boolean},{defaultValue:!1,description:"Disable the first-run info panel entirely (also via VIS_DLX_NO_INFO)",name:"no-info",type:Boolean}]};class Wo extends Error{isVisUserError=!0;constructor(e,n){super(e,n),this.name="VisUserError"}}const as=t=>t instanceof Wo||t instanceof Error&&t.isVisUserError===!0;export{Go as N,Ho as Q,F as U,is as V,Ko as X,Zo as Y,Wo as a,Yo as b,Jo as c,rs as e,as as i,Qo as n,os as p,ss as r,A as s,Xo as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as b}from"node:module";import{P as v,J as j,b as W}from"./index-uBVnF4ji.js";import{p as h}from"../packem_chunks/cli-main.js";let $;const y=o=>($??=b(import.meta.url))(o),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=o=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[c,r]=m.versions.node.split(".").map(Number);if(c>22||c===22&&r>=3||c===20&&r>=16)return m.getBuiltinModule(o)}return y(o)},{watch:T}=p("node:fs"),{execFileSync:S}=p("node:child_process"),{createRequire:k}=p("node:module"),g=k(import.meta.url);let w;const q=()=>{if(w!==void 0)return w;try{g.resolve("fb-watchman")}catch{return w=!1,!1}try{S("watchman",["--version"],{stdio:"ignore",timeout:2e3})}catch{return w=!1,!1}return w=!0,!0},R=(o,c)=>{if(!q())return;let r;try{r=g("fb-watchman")}catch(s){h.warn(`[vis watch] fb-watchman failed to load, using native watcher: ${s.message}`);return}const a=new r.Client;a.on("error",s=>{h.warn(`[vis watch] watchman error: ${s.message}`)}),a.on("subscription",s=>{const t=s;if(!t.is_fresh_instance)for(const e of t.files??[])c(e)});for(const[s,t]of o.entries()){const e=v(t),i=`vis-watch-${s}-${process.pid}`;a.command(["watch-project",e],(l,f)=>{if(l){h.warn(`[vis watch] watchman could not watch ${t}: ${l.message}`);return}const u={expression:["allof",["type","f"]],fields:["name"]};f.relative_path&&(u.relative_root=f.relative_path),a.command(["subscribe",f.watch,i,u],n=>{n&&h.warn(`[vis watch] watchman subscribe failed for ${t}: ${n.message}`)})})}return{close:()=>{try{a.end()}catch{}}}},x=[/node_modules(?:\/|$)/,/\.git(?:\/|$)/,/\.vis(?:\/|$)/],B=(o,c)=>{const r=new Set,a=new Set;for(const[,e]of o){const i=e.task.hashDetails?.nodes;if(i)for(const l of Object.keys(i))r.add(l),a.add(j(v(c,l)))}const s=[...a].sort(),t=[];for(const e of s)t.some(i=>e===i||e.startsWith(`${i}/`))||t.push(e);return{directories:t,files:r}},D=(o,c,r)=>{const a=new Set;for(const s of o){const t=v(c,s);for(const e of r)if(t===e||t.startsWith(`${e}/`)){const i=W(e,t);i.length>0&&a.add(i)}}return s=>{const t=s.replaceAll("\\","/");return a.has(t)}},A=o=>{const c=o.replaceAll("\\","/");return x.some(r=>r.test(c))},J=o=>{const{debounceMs:c=150,filter:r,onChange:a,paths:s}=o;let t=new Set,e;const i=()=>{e=void 0;const n=[...t];t=new Set,n.length!==0&&Promise.resolve(a(n)).catch(d=>{h.error("[vis watch] onChange handler failed:",d)})},l=n=>{A(n)||r&&!r(n)||(t.add(n),e&&clearTimeout(e),e=setTimeout(i,c))},f=R(s,l);if(f)return{close:()=>{e&&clearTimeout(e),f.close()}};const u=[];for(const n of s)try{const d=T(n,{recursive:!0},(C,_)=>{_&&l(_)});u.push(d)}catch(d){h.warn(`[vis watch] unable to watch ${n}: ${d.message}`)}return{close:()=>{e&&clearTimeout(e);for(const n of u)try{n.close()}catch{}}}};export{D as a,B as c,J as s};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{createRequire as K}from"node:module";import{w as g,l as A,z as U,v as S,P as Q,d as X,J as Y}from"./index-uBVnF4ji.js";import{n as w}from"../packem_chunks/catalog.js";import{a as te}from"./readJsonSync-DweZd5ZA-0eZh9sGm.js";import{s as ue}from"./watch-BXOOX7lx.js";let G;const H=e=>(G??=K(import.meta.url))(e),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[t,s]=x.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return x.getBuiltinModule(e)}return H(e)},{createHash:m}=v("node:crypto"),{fileURLToPath:Z,pathToFileURL:ee}=v("node:url"),{spawnSync:se,spawn:ne}=v("node:child_process"),{openSync:re,writeSync:oe,closeSync:ie,statSync:ae,readFileSync:N,mkdirSync:ce,writeFileSync:le}=v("node:fs"),{availableParallelism:b}=v("node:os"),W=(e,t)=>{for(const s of["dependencies","devDependencies","optionalDependencies","peerDependencies"]){const n=e[s];if(n&&typeof n[t]=="string")return n[t]}},k=(e,t)=>{for(const s of t){const n=g(e,s);if(A(n))return n}},de=e=>{const t=g(e,"package.json");if(!A(t))return{};try{return te(t)}catch{return{}}},st=(e,t)=>{const s=de(e),n=new Map;for(const o of t){const r=o.detect(e,s);r&&n.set(o.id,r)}return n},fe={error:"error",info:"info",information:"info",warning:"warning"},nt={argsCheck:(e,t)=>j(e,t,!1),argsFix:(e,t)=>j(e,t,!0),bin:()=>["pnpm","exec","biome"],cacheKey:(e,t)=>{const s=["biome",e.declaredVersion??"unknown",e.configFile??"no-config",t.maxWarnings===void 0?"":`mw=${t.maxWarnings}`,t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(e,t)=>{const s=W(t,w.biome.packageNames[0]),n=k(e,w.biome.configFiles);if(!(!s&&!n))return{adapter:"biome",configFile:n,declared:!!s,declaredVersion:s,root:e}},extensions:["astro","cjs","css","cts","js","json","jsonc","jsx","mjs","mts","svelte","ts","tsx","vue"],id:"biome",kind:"both",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"biome",file:t.root,fixable:!1,message:`biome output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s.diagnostics??[]){const r=o.location?.start,i=o.location?.end,a=pe(t.root,o.location?.path),c=o.category??"",l=c==="format"||c.startsWith("format/");n.push({adapter:"biome",column:r?.column&&r.column>0?r.column:void 0,endColumn:i?.column&&i.column>0?i.column:void 0,endLine:i?.line&&i.line>0?i.line:void 0,file:a,fixable:!0,line:r?.line&&r.line>0?r.line:void 0,message:l?"Code style issues would be auto-fixed":o.message??"",ruleId:c||void 0,severity:fe[o.severity??""]??"warning"})}return n}},j=(e,t,s)=>{const n=["check","--reporter=json"];return s&&n.push("--write"),typeof t.maxWarnings=="number"&&n.push(`--max-diagnostics=${String(t.maxWarnings)}`),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},pe=(e,t)=>{const s=typeof t=="string"?t:t?.file;return s?s.startsWith("/")||/^[a-z]:[\\/]/i.test(s)?s:g(e,s):e},D=e=>t=>{const s=k(t,w.deno.configFiles);if(s)return{adapter:e,configFile:s,declared:!1,root:t}},B=e=>e.startsWith("/")||/^[a-z]:[\\/]/i.test(e),rt={argsCheck:(e,t)=>F(e,t,!1),argsFix:(e,t)=>F(e,t,!0),bin:()=>["deno","lint"],cacheKey:(e,t)=>{const s=["deno-lint",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:D("deno-lint"),extensions:["js","jsx","mjs","mts","ts","tsx"],id:"deno-lint",kind:"lint",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"deno-lint",file:t.root,fixable:!1,message:`deno lint output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s.diagnostics??[]){const r=o.range?.start,i=o.range?.end;n.push({adapter:"deno-lint",column:r?.col===void 0?void 0:r.col+1,endColumn:i?.col===void 0?void 0:i.col+1,endLine:i?.line===void 0?void 0:i.line+1,file:ge(o.filename??t.root,t.root),fixable:!1,line:r?.line===void 0?void 0:r.line+1,message:o.message??"",ruleId:o.code,severity:"warning"})}return n}},ot={argsCheck:(e,t)=>I(e,t,!1),argsFix:(e,t)=>I(e,t,!0),bin:()=>["deno","fmt"],cacheKey:(e,t)=>{const s=["deno-fmt",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:D("deno-fmt"),extensions:["astro","cjs","css","cts","html","ipynb","js","json","jsonc","jsx","less","md","mjs","mts","sass","scss","sql","svelte","ts","tsx","vue","yaml","yml"],id:"deno-fmt",kind:"fmt",parse:(e,t)=>{if(e.exitCode===0)return[];const s=[],n=new Set;for(const o of e.stdout.split(/\r?\n/)){const r=/^from (.+):$/.exec(o);if(!r)continue;const i=r[1];n.has(i)||(n.add(i),s.push({adapter:"deno-fmt",file:B(i)?i:`${t.root}/${i}`,fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return s}},F=(e,t,s)=>{const n=["--json"];return s&&n.push("--fix"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},I=(e,t,s)=>{const n=[];return s||n.push("--check"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},ge=(e,t)=>e.startsWith("file://")?Z(e):B(e)?e:`${t}/${e}`,J="pyproject.toml",he=/^\[tool\.ruff(?:\.[\w-]+)*\]\s*$/m,me=/^Would reformat:?\s+(.+)$/,ye=e=>{const t=g(e,J);if(!A(t))return!1;try{const s=U(t);return he.test(s)}catch{return!1}},P=e=>(t,s)=>{const n=w.ruff.packageNames.map(a=>W(s,a)).find(a=>a!==void 0),o=k(t,w.ruff.configFiles),r=o?void 0:ye(t)?g(t,J):void 0,i=o??r;if(!(!n&&!i))return{adapter:e,configFile:i,declared:!!n,declaredVersion:n,root:t}},xe=e=>e.startsWith("/")||/^[a-z]:[\\/]/i.test(e),z=(e,t)=>e?xe(e)?e:g(t,e):t,$e=e=>me.exec(e)?.[1]?.trim(),it={argsCheck:(e,t)=>R(e,t,!1),argsFix:(e,t)=>R(e,t,!0),bin:()=>["ruff","check"],cacheKey:(e,t)=>{const s=["ruff-check",e.declaredVersion??"unknown",e.configFile??"no-config",t.maxWarnings===void 0?"":`mw=${t.maxWarnings}`,t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:P("ruff-check"),extensions:["py","pyi"],id:"ruff-check",kind:"lint",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"ruff-check",file:t.root,fixable:!1,message:`ruff check output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s){const r=o.location,i=o.end_location;n.push({adapter:"ruff-check",column:r?.column,endColumn:i?.column,endLine:i?.row,file:z(o.filename,t.root),fixable:!!o.fix,line:r?.row,message:o.message??"",ruleId:o.code,severity:"warning"})}return n}},at={argsCheck:(e,t)=>L(e,t,!1),argsFix:(e,t)=>L(e,t,!0),bin:()=>["ruff","format"],cacheKey:(e,t)=>{const s=["ruff-fmt",e.declaredVersion??"unknown",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:P("ruff-fmt"),extensions:["py","pyi"],id:"ruff-fmt",kind:"fmt",parse:(e,t)=>{if(e.exitCode===0)return[];const s=[],n=new Set;for(const o of e.stdout.split(/\r?\n/)){const r=$e(o);!r||n.has(r)||(n.add(r),s.push({adapter:"ruff-fmt",file:z(r,t.root),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return s}},R=(e,t,s)=>{const n=["--output-format=json"];return s&&n.push("--fix"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},L=(e,t,s)=>{const n=[];return s||n.push("--check"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},ct=(e,t)=>{const s=$(e,["diff","--name-only","--diff-filter=ACMR","-z",`${t}...HEAD`]);if(s===void 0)return;const n=$(e,["diff","--name-only","--diff-filter=ACMR","-z"]),o=$(e,["diff","--name-only","--diff-filter=ACMR","--cached","-z"]),r=$(e,["ls-files","--others","--exclude-standard","-z"]),i=new Set;for(const a of[s,n??"",o??"",r??""])for(const c of a.split("\0"))c.length!==0&&i.add(S(c)?c:g(e,c));return[...i].sort()},lt=e=>{const t=$(e,["diff","--name-only","--diff-filter=ACMR","--cached","-z"]);if(t===void 0)return;const s=new Set;for(const n of t.split("\0"))n.length!==0&&s.add(S(n)?n:g(e,n));return[...s].sort()},$=(e,t)=>{const s=se("git",[...t],{cwd:e,encoding:"utf8",timeout:1e4});if(s.status===0)return s.stdout},ut=(e,t)=>{const s=new Set(t.map(r=>r.toLowerCase())),n=[],o=new Set;for(const r of e){const i=r.lastIndexOf(".");if(i===-1||i===r.length-1)continue;const a=r.slice(i+1).toLowerCase();s.has(a)&&(o.has(r)||(o.add(r),n.push(r)))}return n},we=new Set(["-","stdout"]),M=e=>({close:()=>{},write:t=>{e.write(t)}}),ve=e=>{X(Y(e));const t=re(e,"w");let s=[];return{close:()=>{s.length>0&&(oe(t,s.join("")),s=[]),ie(t)},write:n=>{s.push(n)}}},dt=e=>{const{cwd:t,target:s}=e;if(s===void 0||we.has(s))return M(process.stdout);if(s==="stderr")return M(process.stderr);const n=S(s)?s:Q(t,s);return ve(n)},q=["oxlint","oxfmt","biome","eslint","dprint","prettier","stylelint","ruff-check","ruff-fmt","markdownlint","shellcheck","deno-lint","deno-fmt"],ft=(e,t)=>{const s=new Map(e.map(i=>[i.id,i])),n=[],o=new Set,r=t&&t.length>0?t:q;for(const i of r){const a=s.get(i);a&&!o.has(i)&&(n.push(a),o.add(i))}if(t&&t.length>0)for(const i of q){const a=s.get(i);a&&!o.has(i)&&(n.push(a),o.add(i))}for(const i of e)o.has(i.id)||(n.push(i),o.add(i.id));return n},pt=(e,t,s)=>{const n=[];for(const o of t){const r=e.get(o.id);r&&Se(o.kind,s)&&n.push({adapter:o,presence:r})}return n},Se=(e,t)=>e===t||e==="both",gt=(e,t,s={})=>{const n=new Map;for(const o of e){const r=Ce(o),i=Ae(r,t,s);if(!i)continue;const a=n.get(i);a?a.push(o):n.set(i,[o])}return n},Ce=e=>{const t=e.lastIndexOf(".");return t===-1||t===e.length-1?"":e.slice(t+1).toLowerCase()},Ae=(e,t,s)=>{const n=s[e];if(n&&t.some(o=>o.adapter.id===n))return n;for(const{adapter:o}of t)if(o.extensions.includes(e))return o.id},ke=e=>e==="error"?"error":e==="warning"?"warning":"notice",E=e=>e.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
2
|
-
`,"%0A"),_=e=>E(e).replaceAll(",","%2C").replaceAll(":","%3A").replaceAll("=","%3D"),be=(e,t)=>t&&e.startsWith(`${t}/`)?e.slice(t.length+1):e,je=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),Fe=(e,t)=>{const s=ke(e.severity),n=be(e.file,t),o=e.ruleId?`${e.adapter}(${e.ruleId})`:e.adapter,r=[`file=${_(n)}`];return e.line!==void 0&&r.push(`line=${String(e.line)}`),e.endLine!==void 0&&r.push(`endLine=${String(e.endLine)}`),e.column!==void 0&&r.push(`col=${String(e.column)}`),e.endColumn!==void 0&&r.push(`endColumn=${String(e.endColumn)}`),r.push(`title=${_(o)}`),`::${s} ${r.join(",")}::${E(e.message)}
|
|
3
|
-
`},ht=e=>e.runs.flatMap(t=>[...t.findings]).sort(je).map(t=>Fe(t,e.workspaceRoot)).join(""),y=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),Ie=e=>`<![CDATA[${e.replaceAll("]]>","]]]]><![CDATA[>")}]]>`,Re=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),Le=e=>e==="error"?"error":e==="warning"?"warning":"info",Me=(e,t)=>{let{file:s}=e;return t&&e.file.startsWith(`${t}/`)&&(s=e.file.slice(t.length+1)),e.line===void 0?s:e.column===void 0?`${s}:${String(e.line)}`:`${s}:${String(e.line)}:${String(e.column)}`},qe=(e,t,s)=>{const n=Me(e,s),o=Le(e.severity),r=e.ruleId?`[${e.ruleId}] ${e.message}`:e.message;return[` <testcase classname="${y(t)}" name="${y(n)}">`,` <failure type="${y(o)}" message="${y(r)}">${Ie(e.message)}</failure>`," </testcase>",""].join(`
|
|
4
|
-
`)},_e=(e,t,s)=>{const n=[...e.findings].sort(Re),o=n.filter(l=>l.severity==="error").length,r=n.filter(l=>l.severity==="warning").length,i=n.length,a=(e.durationMs/1e3).toFixed(3),c=n.map(l=>qe(l,e.adapter,s)).join("");return` <testsuite ${[`name="${y(e.adapter)}"`,`tests="${String(i)}"`,`failures="${String(o)}"`,'errors="0"',`skipped="${String(r)}"`,`time="${a}"`,`timestamp="${t}"`].join(" ")}>
|
|
5
|
-
${c} </testsuite>
|
|
6
|
-
`},mt=e=>{const t=(e.now??new Date).toISOString(),s=e.suiteName??"vis-lint-fmt",n=e.runs.map(c=>_e(c,t,e.workspaceRoot)).join(""),o=e.runs.reduce((c,l)=>c+l.findings.length,0),r=e.runs.reduce((c,l)=>c+l.findings.filter(p=>p.severity==="error").length,0),i=e.runs.reduce((c,l)=>c+l.findings.filter(p=>p.severity==="warning").length,0),a=(e.runs.reduce((c,l)=>c+l.durationMs,0)/1e3).toFixed(3);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
7
|
-
<testsuites ${[`name="${y(s)}"`,`tests="${String(o)}"`,`failures="${String(r)}"`,'errors="0"',`skipped="${String(i)}"`,`time="${a}"`].join(" ")}>
|
|
8
|
-
${n}</testsuites>
|
|
9
|
-
`},Te="2.1.0",Oe="https://json.schemastore.org/sarif-2.1.0.json",Ne=e=>e==="error"?"error":e==="warning"?"warning":"note",We=(e,t)=>t&&e.startsWith(`${t}/`)?{uri:e.slice(t.length+1),uriBaseId:"SRCROOT"}:{uri:e},De=e=>{const{href:t}=ee(e);return t.endsWith("/")?t:`${t}/`},Be=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),Je=e=>{const t=new Map;for(const s of e)s.ruleId&&(t.has(s.ruleId)||t.set(s.ruleId,{id:s.ruleId,name:s.ruleId}));return[...t.values()]},Pe=(e,t)=>{const{uri:s,uriBaseId:n}=We(e.file,t),o={artifactLocation:n?{uri:s,uriBaseId:n}:{uri:s}};if(e.line!==void 0){const i={startLine:e.line};e.column!==void 0&&(i.startColumn=e.column),e.endLine!==void 0&&(i.endLine=e.endLine),e.endColumn!==void 0&&(i.endColumn=e.endColumn),o.region=i}const r={level:Ne(e.severity),locations:[{physicalLocation:o}],message:{text:e.message}};return e.ruleId&&(r.ruleId=e.ruleId),r},ze=(e,t)=>{const s=[...e.findings].sort(Be),n=Je(s),o={name:e.adapter,rules:n};e.presence?.declaredVersion&&(o.version=e.presence.declaredVersion);const r={results:s.map(i=>Pe(i,t)),tool:{driver:o}};return t&&(r.originalUriBaseIds={SRCROOT:{uri:De(t)}}),r},yt=e=>{const t={$schema:Oe,runs:e.runs.map(s=>ze(s,e.workspaceRoot)),version:Te};return`${JSON.stringify(t,void 0,2)}
|
|
10
|
-
`},T={error:3,info:1,warning:2},xt=e=>{const t=[],s=[];let n,o=!1;for(const r of e){s.push({adapter:r.adapter,durationMs:r.durationMs,exitCode:r.exitCode,findingCount:r.findings.length}),r.exitCode!==0&&r.exitCode!==null&&r.findings.length===0&&(o=!0);for(const i of r.findings)t.push(i),(!n||T[i.severity]>T[n])&&(n=i.severity)}return{findings:t,hadProcessFailure:o,maxSeverity:n,runs:s}},$t=e=>{const t=new Map;for(const s of e){const n=t.get(s.file);n?n.push(s):t.set(s.file,[s])}return t},wt=e=>e.hadProcessFailure||e.maxSeverity==="error"?1:0,Ee=(e,t)=>{if(t==="fix"||process.env.VIS_NO_CACHE==="1"||e.length===0)return!1;for(const s of e)if(s==="."||s==="./"||s==="..")return!1;return!0},Ve=e=>{try{const t=N(e);return m("sha256").update(t).digest("hex")}catch{return}},Ke=(e,t,s,n,o)=>{const r=e.cacheKey(t,n),i=[];for(const c of[...s].sort()){const l=S(c)?c:g(t.root,c);try{ae(l)}catch{return}const p=Ve(l);if(!p)return;i.push({hash:p,path:l})}const a=m("sha256");a.update(e.id),a.update("\0"),a.update(r),a.update("\0"),a.update(o);for(const c of i)a.update("\0"),a.update(c.path),a.update("\0"),a.update(c.hash);return{fileHashes:i,key:a.digest("hex")}},V=(e,t)=>g(e,"lint-fmt",t),Ge=(e,t,s)=>{const n=g(V(e,t.id),`${s}.json`);try{const o=N(n,"utf8"),r=JSON.parse(o);return r.schema!==1?void 0:r}catch{return}},He=(e,t,s,n,o)=>{const r=V(e,t.id),i={fileHashes:o,result:n,savedAt:Date.now(),schema:1};try{ce(r,{recursive:!0}),le(g(r,`${s}.json`),JSON.stringify(i))}catch{}},O=async(e,t,s,n,o)=>{const r=e.bin(t),i=[...r.slice(1),...o==="fix"?e.argsFix(s,n):e.argsCheck(s,n)];return new Promise(a=>{const c=Date.now(),l=ne(r[0],i,{cwd:t.root}),p=[],u=[];let h=!1;const f=setTimeout(()=>{h=!0,l.kill("SIGKILL")},6e4);l.stdout.on("data",d=>p.push(d)),l.stderr.on("data",d=>u.push(d)),l.on("error",d=>{clearTimeout(f),a({durationMs:Date.now()-c,exitCode:null,stderr:d.message,stdout:""})}),l.on("close",d=>{clearTimeout(f),a({durationMs:Date.now()-c,exitCode:h?null:d,stderr:Buffer.concat(u).toString("utf8"),stdout:Buffer.concat(p).toString("utf8")})})})},vt=async(e,t,s,n=b())=>{if(e.length===0)return[];const{cacheRoot:o,concurrency:r}=typeof n=="number"?{concurrency:n}:{cacheRoot:n.cacheRoot,concurrency:n.concurrency??b()},i=async u=>{const h=u.options??t;if(o&&Ee(u.files,s)){const f=Ke(u.adapter,u.presence,u.files,h,s);if(f){const d=Ge(o,u.adapter,f.key);if(d)return d.result;const C=await O(u.adapter,u.presence,u.files,h,s);return C.exitCode!==null&&He(o,u.adapter,f.key,C,f.fileHashes),C}}return O(u.adapter,u.presence,u.files,h,s)};if(process.env.VIS_LINT_FMT_SERIAL==="1"){const u=[];for(const h of e)u.push(await i(h));return u}const a=Math.max(1,Math.min(r,e.length)),c=Array.from({length:e.length});let l=0;const p=async()=>{for(;;){const u=l;if(l+=1,u>=e.length)return;c[u]=await i(e[u])}};return await Promise.all(Array.from({length:a},()=>p())),c},Ue=e=>{const t=new Set;for(const s of e)t.add(s.toLowerCase());return t},Qe=(e,t)=>{const s=e.lastIndexOf(".");return s===-1||s===e.length-1?!1:t.has(e.slice(s+1).toLowerCase())},St=async e=>{const{extensions:t,initialFiles:s,label:n,log:o,runCycle:r,workspaceRoot:i}=e,a=o??(f=>{process.stdout.write(`${f}
|
|
11
|
-
`)}),c=Ue(t);await r(s),a(`▸ ${n}: watching workspace — press Ctrl-C to exit`);let l=new Set,p=!1;const u=async()=>{for(;l.size>0;){const f=[...l];l=new Set;try{await r(f)}catch(d){a(`✗ ${n}: watch cycle failed — ${d.message}`)}}},h=ue({debounceMs:200,filter:f=>Qe(f,c),onChange:async f=>{for(const d of f)l.add(S(d)?d:g(i,d));if(!p){p=!0;try{await u()}finally{p=!1}}},paths:[i]});await new Promise(f=>{const d=()=>{h.close(),process.off("SIGINT",d),process.off("SIGTERM",d),f()};process.once("SIGINT",d),process.once("SIGTERM",d)})};export{st as a,pt as b,ct as c,W as d,St as e,k as f,gt as g,vt as h,xt as i,dt as j,yt as k,mt as l,ht as m,nt as n,at as o,ot as p,$t as q,ft as r,lt as s,wt as t,ut as u,it as v,rt as w};
|