agent-skill-manager 1.15.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.backup.md +1 -1
- package/README.md +1 -1
- package/dist/agent-skill-manager.js +160 -135
- package/dist/{chunk-zzvkjwrx.js → chunk-6cfm11vm.js} +13 -11
- package/dist/{chunk-6t9cpddh.js → chunk-6n912478.js} +1 -1
- package/dist/{chunk-etgg42ff.js → chunk-t6myftbf.js} +2 -2
- package/package.json +1 -1
|
@@ -1,161 +1,163 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
3
|
-
`)}}
|
|
2
|
+
import{B as z5,C as G5,D as v2,E as J5,a as L0,b as R0,c as n2,e as p,f as i4,g as x2,h as s4,i as o4,j as h2,k as r4,l as H,m as t4,n as R4,o as e4,p as g2,q as q5,r as $5,s as Z5,v as X5,w as Q5,x as d,y as k2,z as U5}from"./chunk-6cfm11vm.js";import{F as m,G as A,H as k,I as l4,J as S,K as a4,L as y2,M as S2,N as Vq,O as k4,P as x0,Q as v,R as n4}from"./chunk-t6myftbf.js";var y=A((a5)=>{var T$=Symbol.for("yaml.alias"),$1=Symbol.for("yaml.document"),Fq=Symbol.for("yaml.map"),Z1=Symbol.for("yaml.pair"),F$=Symbol.for("yaml.scalar"),Kq=Symbol.for("yaml.seq"),t=Symbol.for("yaml.node.type"),v5=(q)=>!!q&&typeof q==="object"&&q[t]===T$,u5=(q)=>!!q&&typeof q==="object"&&q[t]===$1,m5=(q)=>!!q&&typeof q==="object"&&q[t]===Fq,p5=(q)=>!!q&&typeof q==="object"&&q[t]===Z1,X1=(q)=>!!q&&typeof q==="object"&&q[t]===F$,d5=(q)=>!!q&&typeof q==="object"&&q[t]===Kq;function Q1(q){if(q&&typeof q==="object")switch(q[t]){case Fq:case Kq:return!0}return!1}function c5(q){if(q&&typeof q==="object")switch(q[t]){case T$:case Fq:case F$:case Kq:return!0}return!1}var l5=(q)=>(X1(q)||Q1(q))&&!!q.anchor;a5.ALIAS=T$;a5.DOC=$1;a5.MAP=Fq;a5.NODE_TYPE=t;a5.PAIR=Z1;a5.SCALAR=F$;a5.SEQ=Kq;a5.hasAnchor=l5;a5.isAlias=v5;a5.isCollection=Q1;a5.isDocument=u5;a5.isMap=m5;a5.isNode=c5;a5.isPair=p5;a5.isScalar=X1;a5.isSeq=d5});var m0=A((Y8)=>{var g=y(),u=Symbol("break visit"),U1=Symbol("skip children"),s=Symbol("remove node");function Lq(q,$){let Z=z1($);if(g.isDocument(q)){if(A0(null,q.contents,Z,Object.freeze([q]))===s)q.contents=null}else A0(null,q,Z,Object.freeze([]))}Lq.BREAK=u;Lq.SKIP=U1;Lq.REMOVE=s;function A0(q,$,Z,X){let Q=G1(q,$,Z,X);if(g.isNode(Q)||g.isPair(Q))return J1(q,X,Q),A0(q,Q,Z,X);if(typeof Q!=="symbol"){if(g.isCollection($)){X=Object.freeze(X.concat($));for(let U=0;U<$.items.length;++U){let z=A0(U,$.items[U],Z,X);if(typeof z==="number")U=z-1;else if(z===u)return u;else if(z===s)$.items.splice(U,1),U-=1}}else if(g.isPair($)){X=Object.freeze(X.concat($));let U=A0("key",$.key,Z,X);if(U===u)return u;else if(U===s)$.key=null;let z=A0("value",$.value,Z,X);if(z===u)return u;else if(z===s)$.value=null}}return Q}async function Rq(q,$){let Z=z1($);if(g.isDocument(q)){if(await I0(null,q.contents,Z,Object.freeze([q]))===s)q.contents=null}else await I0(null,q,Z,Object.freeze([]))}Rq.BREAK=u;Rq.SKIP=U1;Rq.REMOVE=s;async function I0(q,$,Z,X){let Q=await G1(q,$,Z,X);if(g.isNode(Q)||g.isPair(Q))return J1(q,X,Q),I0(q,Q,Z,X);if(typeof Q!=="symbol"){if(g.isCollection($)){X=Object.freeze(X.concat($));for(let U=0;U<$.items.length;++U){let z=await I0(U,$.items[U],Z,X);if(typeof z==="number")U=z-1;else if(z===u)return u;else if(z===s)$.items.splice(U,1),U-=1}}else if(g.isPair($)){X=Object.freeze(X.concat($));let U=await I0("key",$.key,Z,X);if(U===u)return u;else if(U===s)$.key=null;let z=await I0("value",$.value,Z,X);if(z===u)return u;else if(z===s)$.value=null}}return Q}function z1(q){if(typeof q==="object"&&(q.Collection||q.Node||q.Value))return Object.assign({Alias:q.Node,Map:q.Node,Scalar:q.Node,Seq:q.Node},q.Value&&{Map:q.Value,Scalar:q.Value,Seq:q.Value},q.Collection&&{Map:q.Collection,Seq:q.Collection},q);return q}function G1(q,$,Z,X){if(typeof Z==="function")return Z(q,$,X);if(g.isMap($))return Z.Map?.(q,$,X);if(g.isSeq($))return Z.Seq?.(q,$,X);if(g.isPair($))return Z.Pair?.(q,$,X);if(g.isScalar($))return Z.Scalar?.(q,$,X);if(g.isAlias($))return Z.Alias?.(q,$,X);return}function J1(q,$,Z){let X=$[$.length-1];if(g.isCollection(X))X.items[q]=Z;else if(g.isPair(X))if(q==="key")X.key=Z;else X.value=Z;else if(g.isDocument(X))X.contents=Z;else{let Q=g.isAlias(X)?"alias":"scalar";throw Error(`Cannot replace node with ${Q} parent`)}}Y8.visit=Lq;Y8.visitAsync=Rq});var K$=A((O8)=>{var Y1=y(),W8=m0(),B8={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},_8=(q)=>q.replace(/[!,[\]{}]/g,($)=>B8[$]);class c{constructor(q,$){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},c.defaultYaml,q),this.tags=Object.assign({},c.defaultTags,$)}clone(){let q=new c(this.yaml,this.tags);return q.docStart=this.docStart,q}atDocument(){let q=new c(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:c.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},c.defaultTags);break}return q}add(q,$){if(this.atNextDocument)this.yaml={explicit:c.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},c.defaultTags),this.atNextDocument=!1;let Z=q.trim().split(/[ \t]+/),X=Z.shift();switch(X){case"%TAG":{if(Z.length!==2){if($(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[Q,U]=Z;return this.tags[Q]=U,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return $(0,"%YAML directive should contain exactly one part"),!1;let[Q]=Z;if(Q==="1.1"||Q==="1.2")return this.yaml.version=Q,!0;else{let U=/^\d+\.\d+$/.test(Q);return $(6,`Unsupported YAML version ${Q}`,U),!1}}default:return $(0,`Unknown directive ${X}`,!0),!1}}tagName(q,$){if(q==="!")return"!";if(q[0]!=="!")return $(`Not a valid tag: ${q}`),null;if(q[1]==="<"){let U=q.slice(2,-1);if(U==="!"||U==="!!")return $(`Verbatim tags aren't resolved, so ${q} is invalid.`),null;if(q[q.length-1]!==">")$("Verbatim tags must end with a >");return U}let[,Z,X]=q.match(/^(.*!)([^!]*)$/s);if(!X)$(`The ${q} tag has no suffix`);let Q=this.tags[Z];if(Q)try{return Q+decodeURIComponent(X)}catch(U){return $(String(U)),null}if(Z==="!")return q;return $(`Could not resolve tag: ${q}`),null}tagString(q){for(let[$,Z]of Object.entries(this.tags))if(q.startsWith(Z))return $+_8(q.substring(Z.length));return q[0]==="!"?q:`!<${q}>`}toString(q){let $=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),X;if(q&&Z.length>0&&Y1.isNode(q.contents)){let Q={};W8.visit(q.contents,(U,z)=>{if(Y1.isNode(z)&&z.tag)Q[z.tag]=!0}),X=Object.keys(Q)}else X=[];for(let[Q,U]of Z){if(Q==="!!"&&U==="tag:yaml.org,2002:")continue;if(!q||X.some((z)=>z.startsWith(U)))$.push(`%TAG ${Q} ${U}`)}return $.join(`
|
|
3
|
+
`)}}c.defaultYaml={explicit:!1,version:"1.2"};c.defaultTags={"!!":"tag:yaml.org,2002:"};O8.Directives=c});var Mq=A((R8)=>{var H1=y(),F8=m0();function K8(q){if(/[\x00-\x19\s,[\]{}]/.test(q)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify(q)}`;throw Error(Z)}return!0}function V1(q){let $=new Set;return F8.visit(q,{Value(Z,X){if(X.anchor)$.add(X.anchor)}}),$}function W1(q,$){for(let Z=1;;++Z){let X=`${q}${Z}`;if(!$.has(X))return X}}function L8(q,$){let Z=[],X=new Map,Q=null;return{onAnchor:(U)=>{Z.push(U),Q??(Q=V1(q));let z=W1($,Q);return Q.add(z),z},setAnchors:()=>{for(let U of Z){let z=X.get(U);if(typeof z==="object"&&z.anchor&&(H1.isScalar(z.node)||H1.isCollection(z.node)))z.node.anchor=z.anchor;else{let G=Error("Failed to resolve repeated object (this should not happen)");throw G.source=U,G}}},sourceObjects:X}}R8.anchorIsValid=K8;R8.anchorNames=V1;R8.createNodeAnchors=L8;R8.findNewAnchor=W1});var L$=A((w8)=>{function p0(q,$,Z,X){if(X&&typeof X==="object")if(Array.isArray(X))for(let Q=0,U=X.length;Q<U;++Q){let z=X[Q],G=p0(q,X,String(Q),z);if(G===void 0)delete X[Q];else if(G!==z)X[Q]=G}else if(X instanceof Map)for(let Q of Array.from(X.keys())){let U=X.get(Q),z=p0(q,X,Q,U);if(z===void 0)X.delete(Q);else if(z!==U)X.set(Q,z)}else if(X instanceof Set)for(let Q of Array.from(X)){let U=p0(q,X,Q,Q);if(U===void 0)X.delete(Q);else if(U!==Q)X.delete(Q),X.add(U)}else for(let[Q,U]of Object.entries(X)){let z=p0(q,X,Q,U);if(z===void 0)delete X[Q];else if(z!==U)X[Q]=z}return q.call($,Z,X)}w8.applyReviver=p0});var $0=A((P8)=>{var j8=y();function B1(q,$,Z){if(Array.isArray(q))return q.map((X,Q)=>B1(X,String(Q),Z));if(q&&typeof q.toJSON==="function"){if(!Z||!j8.hasAnchor(q))return q.toJSON($,Z);let X={aliasCount:0,count:1,res:void 0};Z.anchors.set(q,X),Z.onCreate=(U)=>{X.res=U,delete Z.onCreate};let Q=q.toJSON($,Z);if(Z.onCreate)Z.onCreate(Q);return Q}if(typeof q==="bigint"&&!Z?.keep)return Number(q);return q}P8.toJS=B1});var Aq=A((E8)=>{var b8=L$(),_1=y(),S8=$0();class O1{constructor(q){Object.defineProperty(this,_1.NODE_TYPE,{value:q})}clone(){let q=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)q.range=this.range.slice();return q}toJS(q,{mapAsMap:$,maxAliasCount:Z,onAnchor:X,reviver:Q}={}){if(!_1.isDocument(q))throw TypeError("A document argument is required");let U={anchors:new Map,doc:q,keep:!0,mapAsMap:$===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},z=S8.toJS(this,"",U);if(typeof X==="function")for(let{count:G,res:J}of U.anchors.values())X(J,G);return typeof Q==="function"?b8.applyReviver(Q,{"":z},"",z):z}}E8.NodeBase=O1});var d0=A((k8)=>{var y8=Mq(),x8=m0(),D0=y(),h8=Aq(),g8=$0();class T1 extends h8.NodeBase{constructor(q){super(D0.ALIAS);this.source=q,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(q,$){let Z;if($?.aliasResolveCache)Z=$.aliasResolveCache;else if(Z=[],x8.visit(q,{Node:(Q,U)=>{if(D0.isAlias(U)||D0.hasAnchor(U))Z.push(U)}}),$)$.aliasResolveCache=Z;let X=void 0;for(let Q of Z){if(Q===this)break;if(Q.anchor===this.source)X=Q}return X}toJSON(q,$){if(!$)return{source:this.source};let{anchors:Z,doc:X,maxAliasCount:Q}=$,U=this.resolve(X,$);if(!U){let G=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(G)}let z=Z.get(U);if(!z)g8.toJS(U,null,$),z=Z.get(U);if(z?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(Q>=0){if(z.count+=1,z.aliasCount===0)z.aliasCount=Iq(X,U,Z);if(z.count*z.aliasCount>Q)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return z.res}toString(q,$,Z){let X=`*${this.source}`;if(q){if(y8.anchorIsValid(this.source),q.options.verifyAliasOrder&&!q.anchors.has(this.source)){let Q=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(Q)}if(q.implicitKey)return`${X} `}return X}}function Iq(q,$,Z){if(D0.isAlias($)){let X=$.resolve(q),Q=Z&&X&&Z.get(X);return Q?Q.count*Q.aliasCount:0}else if(D0.isCollection($)){let X=0;for(let Q of $.items){let U=Iq(q,Q,Z);if(U>X)X=U}return X}else if(D0.isPair($)){let X=Iq(q,$.key,Z),Q=Iq(q,$.value,Z);return Math.max(X,Q)}return 1}k8.Alias=T1});var x=A((c8)=>{var u8=y(),m8=Aq(),p8=$0(),d8=(q)=>!q||typeof q!=="function"&&typeof q!=="object";class H0 extends m8.NodeBase{constructor(q){super(u8.SCALAR);this.value=q}toJSON(q,$){return $?.keep?this.value:p8.toJS(this.value,q,$)}toString(){return String(this.value)}}H0.BLOCK_FOLDED="BLOCK_FOLDED";H0.BLOCK_LITERAL="BLOCK_LITERAL";H0.PLAIN="PLAIN";H0.QUOTE_DOUBLE="QUOTE_DOUBLE";H0.QUOTE_SINGLE="QUOTE_SINGLE";c8.Scalar=H0;c8.isScalarValue=d8});var c0=A((r8)=>{var n8=d0(),V0=y(),F1=x(),i8="tag:yaml.org,2002:";function s8(q,$,Z){if($){let X=Z.filter((U)=>U.tag===$),Q=X.find((U)=>!U.format)??X[0];if(!Q)throw Error(`Tag ${$} not found`);return Q}return Z.find((X)=>X.identify?.(q)&&!X.format)}function o8(q,$,Z){if(V0.isDocument(q))q=q.contents;if(V0.isNode(q))return q;if(V0.isPair(q)){let V=Z.schema[V0.MAP].createNode?.(Z.schema,null,Z);return V.items.push(q),V}if(q instanceof String||q instanceof Number||q instanceof Boolean||typeof BigInt<"u"&&q instanceof BigInt)q=q.valueOf();let{aliasDuplicateObjects:X,onAnchor:Q,onTagObj:U,schema:z,sourceObjects:G}=Z,J=void 0;if(X&&q&&typeof q==="object")if(J=G.get(q),J)return J.anchor??(J.anchor=Q(q)),new n8.Alias(J.anchor);else J={anchor:null,node:null},G.set(q,J);if($?.startsWith("!!"))$=i8+$.slice(2);let Y=s8(q,$,z.tags);if(!Y){if(q&&typeof q.toJSON==="function")q=q.toJSON();if(!q||typeof q!=="object"){let V=new F1.Scalar(q);if(J)J.node=V;return V}Y=q instanceof Map?z[V0.MAP]:(Symbol.iterator in Object(q))?z[V0.SEQ]:z[V0.MAP]}if(U)U(Y),delete Z.onTagObj;let B=Y?.createNode?Y.createNode(Z.schema,q,Z):typeof Y?.nodeClass?.from==="function"?Y.nodeClass.from(Z.schema,q,Z):new F1.Scalar(q);if($)B.tag=$;else if(!Y.default)B.tag=Y.tag;if(J)J.node=B;return B}r8.createNode=o8});var Dq=A(($Z)=>{var e8=c0(),o=y(),qZ=Aq();function R$(q,$,Z){let X=Z;for(let Q=$.length-1;Q>=0;--Q){let U=$[Q];if(typeof U==="number"&&Number.isInteger(U)&&U>=0){let z=[];z[U]=X,X=z}else X=new Map([[U,X]])}return e8.createNode(X,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:q,sourceObjects:new Map})}var K1=(q)=>q==null||typeof q==="object"&&!!q[Symbol.iterator]().next().done;class L1 extends qZ.NodeBase{constructor(q,$){super(q);Object.defineProperty(this,"schema",{value:$,configurable:!0,enumerable:!1,writable:!0})}clone(q){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(q)$.schema=q;if($.items=$.items.map((Z)=>o.isNode(Z)||o.isPair(Z)?Z.clone(q):Z),this.range)$.range=this.range.slice();return $}addIn(q,$){if(K1(q))this.add($);else{let[Z,...X]=q,Q=this.get(Z,!0);if(o.isCollection(Q))Q.addIn(X,$);else if(Q===void 0&&this.schema)this.set(Z,R$(this.schema,X,$));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}}deleteIn(q){let[$,...Z]=q;if(Z.length===0)return this.delete($);let X=this.get($,!0);if(o.isCollection(X))return X.deleteIn(Z);else throw Error(`Expected YAML collection at ${$}. Remaining path: ${Z}`)}getIn(q,$){let[Z,...X]=q,Q=this.get(Z,!0);if(X.length===0)return!$&&o.isScalar(Q)?Q.value:Q;else return o.isCollection(Q)?Q.getIn(X,$):void 0}hasAllNullValues(q){return this.items.every(($)=>{if(!o.isPair($))return!1;let Z=$.value;return Z==null||q&&o.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn(q){let[$,...Z]=q;if(Z.length===0)return this.has($);let X=this.get($,!0);return o.isCollection(X)?X.hasIn(Z):!1}setIn(q,$){let[Z,...X]=q;if(X.length===0)this.set(Z,$);else{let Q=this.get(Z,!0);if(o.isCollection(Q))Q.setIn(X,$);else if(Q===void 0&&this.schema)this.set(Z,R$(this.schema,X,$));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}}}$Z.Collection=L1;$Z.collectionFromPath=R$;$Z.isEmptyPath=K1});var l0=A((GZ)=>{var UZ=(q)=>q.replace(/^(?!$)(?: $)?/gm,"#");function M$(q,$){if(/^\n+$/.test(q))return q.substring(1);return $?q.replace(/^(?! *$)/gm,$):q}var zZ=(q,$,Z)=>q.endsWith(`
|
|
4
4
|
`)?M$(Z,$):Z.includes(`
|
|
5
5
|
`)?`
|
|
6
|
-
`+M$(Z,$):(q.endsWith(" ")?"":" ")+Z
|
|
7
|
-
`){if(Z==="block")_=
|
|
6
|
+
`+M$(Z,$):(q.endsWith(" ")?"":" ")+Z;GZ.indentComment=M$;GZ.lineComment=zZ;GZ.stringifyComment=UZ});var M1=A((WZ)=>{function VZ(q,$,Z="flow",{indentAtStart:X,lineWidth:Q=80,minContentWidth:U=20,onFold:z,onOverflow:G}={}){if(!Q||Q<0)return q;if(Q<U)U=0;let J=Math.max(1+U,1+Q-$.length);if(q.length<=J)return q;let Y=[],B={},V=Q-$.length;if(typeof X==="number")if(X>Q-Math.max(2,U))Y.push(0);else V=Q-X;let W=void 0,O=void 0,F=!1,_=-1,T=-1,L=-1;if(Z==="block"){if(_=R1(q,_,$.length),_!==-1)V=_+J}for(let R;R=q[_+=1];){if(Z==="quoted"&&R==="\\"){switch(T=_,q[_+1]){case"x":_+=3;break;case"u":_+=5;break;case"U":_+=9;break;default:_+=1}L=_}if(R===`
|
|
7
|
+
`){if(Z==="block")_=R1(q,_,$.length);V=_+$.length+J,W=void 0}else{if(R===" "&&O&&O!==" "&&O!==`
|
|
8
8
|
`&&O!=="\t"){let D=q[_+1];if(D&&D!==" "&&D!==`
|
|
9
|
-
`&&D!=="\t")W=_}if(_>=V)if(W)Y.push(W),V=W+J,W=void 0;else if(Z==="quoted"){while(O===" "||O==="\t")O=R,R=q[_+=1],F=!0;let D=_>
|
|
9
|
+
`&&D!=="\t")W=_}if(_>=V)if(W)Y.push(W),V=W+J,W=void 0;else if(Z==="quoted"){while(O===" "||O==="\t")O=R,R=q[_+=1],F=!0;let D=_>L+1?_-2:T-1;if(B[D])return q;Y.push(D),B[D]=!0,V=D+J,W=void 0}else F=!0}O=R}if(F&&G)G();if(Y.length===0)return q;if(z)z();let M=q.slice(0,Y[0]);for(let R=0;R<Y.length;++R){let D=Y[R],w=Y[R+1]||q.length;if(D===0)M=`
|
|
10
10
|
${$}${q.slice(0,w)}`;else{if(Z==="quoted"&&B[D])M+=`${q[D]}\\`;M+=`
|
|
11
|
-
${$}${q.slice(D+1,w)}`}}return M}function
|
|
12
|
-
`);X=$,Q=$+1,U=q[Q]}return X}
|
|
13
|
-
`){if(U-z>X)return!0;if(z=U+1,Q-z<=X)return!1}return!0}function
|
|
11
|
+
${$}${q.slice(D+1,w)}`}}return M}function R1(q,$,Z){let X=$,Q=$+1,U=q[Q];while(U===" "||U==="\t")if($<Q+Z)U=q[++$];else{do U=q[++$];while(U&&U!==`
|
|
12
|
+
`);X=$,Q=$+1,U=q[Q]}return X}WZ.FOLD_BLOCK="block";WZ.FOLD_FLOW="flow";WZ.FOLD_QUOTED="quoted";WZ.foldFlowLines=VZ});var n0=A((RZ)=>{var a=x(),Z0=M1(),Nq=(q,$)=>({indentAtStart:$?q.indent.length:q.indentAtStart,lineWidth:q.options.lineWidth,minContentWidth:q.options.minContentWidth}),jq=(q)=>/^(%|---|\.\.\.)/m.test(q);function FZ(q,$,Z){if(!$||$<0)return!1;let X=$-Z,Q=q.length;if(Q<=X)return!1;for(let U=0,z=0;U<Q;++U)if(q[U]===`
|
|
13
|
+
`){if(U-z>X)return!0;if(z=U+1,Q-z<=X)return!1}return!0}function a0(q,$){let Z=JSON.stringify(q);if($.options.doubleQuotedAsJSON)return Z;let{implicitKey:X}=$,Q=$.options.doubleQuotedMinMultiLineLength,U=$.indent||(jq(q)?" ":""),z="",G=0;for(let J=0,Y=Z[J];Y;Y=Z[++J]){if(Y===" "&&Z[J+1]==="\\"&&Z[J+2]==="n")z+=Z.slice(G,J)+"\\ ",J+=1,G=J,Y="\\";if(Y==="\\")switch(Z[J+1]){case"u":{z+=Z.slice(G,J);let B=Z.substr(J+2,4);switch(B){case"0000":z+="\\0";break;case"0007":z+="\\a";break;case"000b":z+="\\v";break;case"001b":z+="\\e";break;case"0085":z+="\\N";break;case"00a0":z+="\\_";break;case"2028":z+="\\L";break;case"2029":z+="\\P";break;default:if(B.substr(0,2)==="00")z+="\\x"+B.substr(2);else z+=Z.substr(J,6)}J+=5,G=J+1}break;case"n":if(X||Z[J+2]==='"'||Z.length<Q)J+=1;else{z+=Z.slice(G,J)+`
|
|
14
14
|
|
|
15
15
|
`;while(Z[J+2]==="\\"&&Z[J+3]==="n"&&Z[J+4]!=='"')z+=`
|
|
16
|
-
`,J+=2;if(z+=U,Z[J+2]===" ")z+="\\";J+=1,G=J+1}break;default:J+=1}}return z=G?z+Z.slice(G):Z,X?z:Z0.foldFlowLines(z,U,Z0.FOLD_QUOTED,
|
|
17
|
-
`)||/[ \t]\n|\n[ \t]/.test(q))return
|
|
18
|
-
${Z}`)+"'";return $.implicitKey?X:Z0.foldFlowLines(X,Z,Z0.FOLD_FLOW,
|
|
16
|
+
`,J+=2;if(z+=U,Z[J+2]===" ")z+="\\";J+=1,G=J+1}break;default:J+=1}}return z=G?z+Z.slice(G):Z,X?z:Z0.foldFlowLines(z,U,Z0.FOLD_QUOTED,Nq($,!1))}function A$(q,$){if($.options.singleQuote===!1||$.implicitKey&&q.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(q))return a0(q,$);let Z=$.indent||(jq(q)?" ":""),X="'"+q.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${Z}`)+"'";return $.implicitKey?X:Z0.foldFlowLines(X,Z,Z0.FOLD_FLOW,Nq($,!1))}function w0(q,$){let{singleQuote:Z}=$.options,X;if(Z===!1)X=a0;else{let Q=q.includes('"'),U=q.includes("'");if(Q&&!U)X=A$;else if(U&&!Q)X=a0;else X=Z?A$:a0}return X(q,$)}var I$;try{I$=new RegExp(`(^|(?<!
|
|
19
19
|
))
|
|
20
20
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{I$=/\n+(?!\n|$)/g}function
|
|
21
|
+
|$)`,"g")}catch{I$=/\n+(?!\n|$)/g}function wq({comment:q,type:$,value:Z},X,Q,U){let{blockQuote:z,commentString:G,lineWidth:J}=X.options;if(!z||/\n[\t ]+$/.test(Z))return w0(Z,X);let Y=X.indent||(X.forceBlockIndent||jq(Z)?" ":""),B=z==="literal"?!0:z==="folded"||$===a.Scalar.BLOCK_FOLDED?!1:$===a.Scalar.BLOCK_LITERAL?!0:!FZ(Z,J,Y.length);if(!Z)return B?`|
|
|
22
22
|
`:`>
|
|
23
23
|
`;let V,W;for(W=Z.length;W>0;--W){let w=Z[W-1];if(w!==`
|
|
24
24
|
`&&w!=="\t"&&w!==" ")break}let O=Z.substring(W),F=O.indexOf(`
|
|
25
25
|
`);if(F===-1)V="-";else if(Z===O||F!==O.length-1){if(V="+",U)U()}else V="";if(O){if(Z=Z.slice(0,-O.length),O[O.length-1]===`
|
|
26
|
-
`)O=O.slice(0,-1);O=O.replace(I$,`$&${Y}`)}let _=!1,T,
|
|
27
|
-
`)
|
|
28
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${Y}`),N=!1,I=
|
|
29
|
-
${Y}${
|
|
30
|
-
${Y}${M}${Z}${O}`}function
|
|
31
|
-
`)||B&&/[[\]{},]/.test(U))return
|
|
32
|
-
`)?
|
|
33
|
-
`))return
|
|
34
|
-
${J}`);if(z){let W=(_)=>_.default&&_.tag!=="tag:yaml.org,2002:str"&&_.test?.test(V),{compat:O,tags:F}=$.doc.schema;if(F.some(W)||O?.some(W))return
|
|
35
|
-
${$.indent}${G}`}
|
|
36
|
-
${G}:`}else if(T=`${T}:`,W)T+=
|
|
26
|
+
`)O=O.slice(0,-1);O=O.replace(I$,`$&${Y}`)}let _=!1,T,L=-1;for(T=0;T<Z.length;++T){let w=Z[T];if(w===" ")_=!0;else if(w===`
|
|
27
|
+
`)L=T;else break}let M=Z.substring(0,L<T?L+1:T);if(M)Z=Z.substring(M.length),M=M.replace(/\n+/g,`$&${Y}`);let D=(_?Y?"2":"1":"")+V;if(q){if(D+=" "+G(q.replace(/ ?[\r\n]+/g," ")),Q)Q()}if(!B){let w=Z.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${Y}`),N=!1,I=Nq(X,!0);if(z!=="folded"&&$!==a.Scalar.BLOCK_FOLDED)I.onOverflow=()=>{N=!0};let K=Z0.foldFlowLines(`${M}${w}${O}`,Y,Z0.FOLD_BLOCK,I);if(!N)return`>${D}
|
|
29
|
+
${Y}${K}`}return Z=Z.replace(/\n+/g,`$&${Y}`),`|${D}
|
|
30
|
+
${Y}${M}${Z}${O}`}function KZ(q,$,Z,X){let{type:Q,value:U}=q,{actualString:z,implicitKey:G,indent:J,indentStep:Y,inFlow:B}=$;if(G&&U.includes(`
|
|
31
|
+
`)||B&&/[[\]{},]/.test(U))return w0(U,$);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(U))return G||B||!U.includes(`
|
|
32
|
+
`)?w0(U,$):wq(q,$,Z,X);if(!G&&!B&&Q!==a.Scalar.PLAIN&&U.includes(`
|
|
33
|
+
`))return wq(q,$,Z,X);if(jq(U)){if(J==="")return $.forceBlockIndent=!0,wq(q,$,Z,X);else if(G&&J===Y)return w0(U,$)}let V=U.replace(/\n+/g,`$&
|
|
34
|
+
${J}`);if(z){let W=(_)=>_.default&&_.tag!=="tag:yaml.org,2002:str"&&_.test?.test(V),{compat:O,tags:F}=$.doc.schema;if(F.some(W)||O?.some(W))return w0(U,$)}return G?V:Z0.foldFlowLines(V,J,Z0.FOLD_FLOW,Nq($,!1))}function LZ(q,$,Z,X){let{implicitKey:Q,inFlow:U}=$,z=typeof q.value==="string"?q:Object.assign({},q,{value:String(q.value)}),{type:G}=q;if(G!==a.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(z.value))G=a.Scalar.QUOTE_DOUBLE}let J=(B)=>{switch(B){case a.Scalar.BLOCK_FOLDED:case a.Scalar.BLOCK_LITERAL:return Q||U?w0(z.value,$):wq(z,$,Z,X);case a.Scalar.QUOTE_DOUBLE:return a0(z.value,$);case a.Scalar.QUOTE_SINGLE:return A$(z.value,$);case a.Scalar.PLAIN:return KZ(z,$,Z,X);default:return null}},Y=J(G);if(Y===null){let{defaultKeyType:B,defaultStringType:V}=$.options,W=Q&&B||V;if(Y=J(W),Y===null)throw Error(`Unsupported default string type ${W}`)}return Y}RZ.stringifyString=LZ});var i0=A((CZ)=>{var AZ=Mq(),X0=y(),IZ=l0(),DZ=n0();function wZ(q,$){let Z=Object.assign({blockQuote:!0,commentString:IZ.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},q.schema.toStringOptions,$),X;switch(Z.collectionStyle){case"block":X=!1;break;case"flow":X=!0;break;default:X=null}return{anchors:new Set,doc:q,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:X,options:Z}}function NZ(q,$){if($.tag){let Q=q.filter((U)=>U.tag===$.tag);if(Q.length>0)return Q.find((U)=>U.format===$.format)??Q[0]}let Z=void 0,X;if(X0.isScalar($)){X=$.value;let Q=q.filter((U)=>U.identify?.(X));if(Q.length>1){let U=Q.filter((z)=>z.test);if(U.length>0)Q=U}Z=Q.find((U)=>U.format===$.format)??Q.find((U)=>!U.format)}else X=$,Z=q.find((Q)=>Q.nodeClass&&X instanceof Q.nodeClass);if(!Z){let Q=X?.constructor?.name??(X===null?"null":typeof X);throw Error(`Tag not resolved for ${Q} value`)}return Z}function jZ(q,$,{anchors:Z,doc:X}){if(!X.directives)return"";let Q=[],U=(X0.isScalar(q)||X0.isCollection(q))&&q.anchor;if(U&&AZ.anchorIsValid(U))Z.add(U),Q.push(`&${U}`);let z=q.tag??($.default?null:$.tag);if(z)Q.push(X.directives.tagString(z));return Q.join(" ")}function PZ(q,$,Z,X){if(X0.isPair(q))return q.toString($,Z,X);if(X0.isAlias(q)){if($.doc.directives)return q.toString($);if($.resolvedAliases?.has(q))throw TypeError("Cannot stringify circular structure without alias nodes");else{if($.resolvedAliases)$.resolvedAliases.add(q);else $.resolvedAliases=new Set([q]);q=q.resolve($.doc)}}let Q=void 0,U=X0.isNode(q)?q:$.doc.createNode(q,{onTagObj:(J)=>Q=J});Q??(Q=NZ($.doc.schema.tags,U));let z=jZ(U,Q,$);if(z.length>0)$.indentAtStart=($.indentAtStart??0)+z.length+1;let G=typeof Q.stringify==="function"?Q.stringify(U,$,Z,X):X0.isScalar(U)?DZ.stringifyString(U,$,Z,X):U.toString($,Z,X);if(!z)return G;return X0.isScalar(U)||G[0]==="{"||G[0]==="["?`${z} ${G}`:`${z}
|
|
35
|
+
${$.indent}${G}`}CZ.createStringifyContext=wZ;CZ.stringify=PZ});var D1=A((fZ)=>{var e=y(),A1=x(),I1=i0(),s0=l0();function EZ({key:q,value:$},Z,X,Q){let{allNullValues:U,doc:z,indent:G,indentStep:J,options:{commentString:Y,indentSeq:B,simpleKeys:V}}=Z,W=e.isNode(q)&&q.comment||null;if(V){if(W)throw Error("With simple keys, key nodes cannot have comments");if(e.isCollection(q)||!e.isNode(q)&&typeof q==="object")throw Error("With simple keys, collection cannot be used as a key value")}let O=!V&&(!q||W&&$==null&&!Z.inFlow||e.isCollection(q)||(e.isScalar(q)?q.type===A1.Scalar.BLOCK_FOLDED||q.type===A1.Scalar.BLOCK_LITERAL:typeof q==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!O&&(V||!U),indent:G+J});let F=!1,_=!1,T=I1.stringify(q,Z,()=>F=!0,()=>_=!0);if(!O&&!Z.inFlow&&T.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");O=!0}if(Z.inFlow){if(U||$==null){if(F&&X)X();return T===""?"?":O?`? ${T}`:T}}else if(U&&!V||$==null&&O){if(T=`? ${T}`,W&&!F)T+=s0.lineComment(T,Z.indent,Y(W));else if(_&&Q)Q();return T}if(F)W=null;if(O){if(W)T+=s0.lineComment(T,Z.indent,Y(W));T=`? ${T}
|
|
36
|
+
${G}:`}else if(T=`${T}:`,W)T+=s0.lineComment(T,Z.indent,Y(W));let L,M,R;if(e.isNode($))L=!!$.spaceBefore,M=$.commentBefore,R=$.comment;else if(L=!1,M=null,R=null,$&&typeof $==="object")$=z.createNode($);if(Z.implicitKey=!1,!O&&!W&&e.isScalar($))Z.indentAtStart=T.length+1;if(_=!1,!B&&J.length>=2&&!Z.inFlow&&!O&&e.isSeq($)&&!$.flow&&!$.tag&&!$.anchor)Z.indent=Z.indent.substring(2);let D=!1,w=I1.stringify($,Z,()=>D=!0,()=>_=!0),N=" ";if(W||L||M){if(N=L?`
|
|
37
37
|
`:"",M){let I=Y(M);N+=`
|
|
38
|
-
${
|
|
38
|
+
${s0.indentComment(I,Z.indent)}`}if(w===""&&!Z.inFlow){if(N===`
|
|
39
39
|
`&&R)N=`
|
|
40
40
|
|
|
41
41
|
`}else N+=`
|
|
42
|
-
${Z.indent}`}else if(!O&&e.isCollection($)){let I=w[0],
|
|
43
|
-
`),C=
|
|
42
|
+
${Z.indent}`}else if(!O&&e.isCollection($)){let I=w[0],K=w.indexOf(`
|
|
43
|
+
`),C=K!==-1,j=Z.inFlow??$.flow??$.items.length===0;if(C||!j){let b=!1;if(C&&(I==="&"||I==="!")){let f=w.indexOf(" ");if(I==="&"&&f!==-1&&f<K&&w[f+1]==="!")f=w.indexOf(" ",f+1);if(f===-1||K<f)b=!0}if(!b)N=`
|
|
44
44
|
${Z.indent}`}}else if(w===""||w[0]===`
|
|
45
|
-
`)N="";if(T+=N+w,Z.inFlow){if(D&&X)X()}else if(R&&!D)T+=
|
|
45
|
+
`)N="";if(T+=N+w,Z.inFlow){if(D&&X)X()}else if(R&&!D)T+=s0.lineComment(T,Z.indent,Y(R));else if(_&&Q)Q();return T}fZ.stringifyPair=EZ});var D$=A((gZ)=>{var w1=k("process");function xZ(q,...$){if(q==="debug")console.log(...$)}function hZ(q,$){if(q==="debug"||q==="warn")if(typeof w1.emitWarning==="function")w1.emitWarning($);else console.warn($)}gZ.debug=xZ;gZ.warn=hZ});var bq=A((mZ)=>{var o0=y(),N1=x(),Pq="<<",Cq={identify:(q)=>q===Pq||typeof q==="symbol"&&q.description===Pq,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new N1.Scalar(Symbol(Pq)),{addToJSMap:j1}),stringify:()=>Pq},uZ=(q,$)=>(Cq.identify($)||o0.isScalar($)&&(!$.type||$.type===N1.Scalar.PLAIN)&&Cq.identify($.value))&&q?.doc.schema.tags.some((Z)=>Z.tag===Cq.tag&&Z.default);function j1(q,$,Z){if(Z=q&&o0.isAlias(Z)?Z.resolve(q.doc):Z,o0.isSeq(Z))for(let X of Z.items)w$(q,$,X);else if(Array.isArray(Z))for(let X of Z)w$(q,$,X);else w$(q,$,Z)}function w$(q,$,Z){let X=q&&o0.isAlias(Z)?Z.resolve(q.doc):Z;if(!o0.isMap(X))throw Error("Merge sources must be maps or map aliases");let Q=X.toJSON(null,q,Map);for(let[U,z]of Q)if($ instanceof Map){if(!$.has(U))$.set(U,z)}else if($ instanceof Set)$.add(U);else if(!Object.prototype.hasOwnProperty.call($,U))Object.defineProperty($,U,{value:z,writable:!0,enumerable:!0,configurable:!0});return $}mZ.addMergeToJSMap=j1;mZ.isMergeKey=uZ;mZ.merge=Cq});var j$=A((sZ)=>{var lZ=D$(),P1=bq(),aZ=i0(),C1=y(),N$=$0();function nZ(q,$,{key:Z,value:X}){if(C1.isNode(Z)&&Z.addToJSMap)Z.addToJSMap(q,$,X);else if(P1.isMergeKey(q,Z))P1.addMergeToJSMap(q,$,X);else{let Q=N$.toJS(Z,"",q);if($ instanceof Map)$.set(Q,N$.toJS(X,Q,q));else if($ instanceof Set)$.add(Q);else{let U=iZ(Z,Q,q),z=N$.toJS(X,U,q);if(U in $)Object.defineProperty($,U,{value:z,writable:!0,enumerable:!0,configurable:!0});else $[U]=z}}return $}function iZ(q,$,Z){if($===null)return"";if(typeof $!=="object")return String($);if(C1.isNode(q)&&Z?.doc){let X=aZ.createStringifyContext(Z.doc,{});X.anchors=new Set;for(let U of Z.anchors.keys())X.anchors.add(U.anchor);X.inFlow=!0,X.inStringifyKey=!0;let Q=q.toString(X);if(!Z.mapKeyWarned){let U=JSON.stringify(Q);if(U.length>40)U=U.substring(0,36)+'..."';lZ.warn(Z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${U}. Set mapAsMap: true to use object keys.`),Z.mapKeyWarned=!0}return Q}return JSON.stringify($)}sZ.addPairToJSMap=nZ});var Q0=A((q6)=>{var b1=c0(),rZ=D1(),tZ=j$(),Sq=y();function eZ(q,$,Z){let X=b1.createNode(q,void 0,Z),Q=b1.createNode($,void 0,Z);return new Eq(X,Q)}class Eq{constructor(q,$=null){Object.defineProperty(this,Sq.NODE_TYPE,{value:Sq.PAIR}),this.key=q,this.value=$}clone(q){let{key:$,value:Z}=this;if(Sq.isNode($))$=$.clone(q);if(Sq.isNode(Z))Z=Z.clone(q);return new Eq($,Z)}toJSON(q,$){let Z=$?.mapAsMap?new Map:{};return tZ.addPairToJSMap($,Z,this)}toString(q,$,Z){return q?.doc?rZ.stringifyPair(this,q,$,Z):JSON.stringify(this)}}q6.Pair=Eq;q6.createPair=eZ});var P$=A((z6)=>{var W0=y(),S1=i0(),fq=l0();function X6(q,$,Z){return($.inFlow??q.flow?U6:Q6)(q,$,Z)}function Q6({comment:q,items:$},Z,{blockItemPrefix:X,flowChars:Q,itemIndent:U,onChompKeep:z,onComment:G}){let{indent:J,options:{commentString:Y}}=Z,B=Object.assign({},Z,{indent:U,type:null}),V=!1,W=[];for(let F=0;F<$.length;++F){let _=$[F],T=null;if(W0.isNode(_)){if(!V&&_.spaceBefore)W.push("");if(yq(Z,W,_.commentBefore,V),_.comment)T=_.comment}else if(W0.isPair(_)){let M=W0.isNode(_.key)?_.key:null;if(M){if(!V&&M.spaceBefore)W.push("");yq(Z,W,M.commentBefore,V)}}V=!1;let L=S1.stringify(_,B,()=>T=null,()=>V=!0);if(T)L+=fq.lineComment(L,U,Y(T));if(V&&T)V=!1;W.push(X+L)}let O;if(W.length===0)O=Q.start+Q.end;else{O=W[0];for(let F=1;F<W.length;++F){let _=W[F];O+=_?`
|
|
46
46
|
${J}${_}`:`
|
|
47
47
|
`}}if(q){if(O+=`
|
|
48
|
-
`+
|
|
49
|
-
`)))Y=!0;V.push(
|
|
48
|
+
`+fq.indentComment(Y(q),J),G)G()}else if(V&&z)z();return O}function U6({items:q},$,{flowChars:Z,itemIndent:X}){let{indent:Q,indentStep:U,flowCollectionPadding:z,options:{commentString:G}}=$;X+=U;let J=Object.assign({},$,{indent:X,inFlow:!0,type:null}),Y=!1,B=0,V=[];for(let F=0;F<q.length;++F){let _=q[F],T=null;if(W0.isNode(_)){if(_.spaceBefore)V.push("");if(yq($,V,_.commentBefore,!1),_.comment)T=_.comment}else if(W0.isPair(_)){let M=W0.isNode(_.key)?_.key:null;if(M){if(M.spaceBefore)V.push("");if(yq($,V,M.commentBefore,!1),M.comment)Y=!0}let R=W0.isNode(_.value)?_.value:null;if(R){if(R.comment)T=R.comment;if(R.commentBefore)Y=!0}else if(_.value==null&&M?.comment)T=M.comment}if(T)Y=!0;let L=S1.stringify(_,J,()=>T=null);if(F<q.length-1)L+=",";if(T)L+=fq.lineComment(L,X,G(T));if(!Y&&(V.length>B||L.includes(`
|
|
49
|
+
`)))Y=!0;V.push(L),B=V.length}let{start:W,end:O}=Z;if(V.length===0)return W+O;else{if(!Y){let F=V.reduce((_,T)=>_+T.length+2,2);Y=$.options.lineWidth>0&&F>$.options.lineWidth}if(Y){let F=W;for(let _ of V)F+=_?`
|
|
50
50
|
${U}${Q}${_}`:`
|
|
51
51
|
`;return`${F}
|
|
52
|
-
${Q}${O}`}else return`${W}${z}${V.join(" ")}${z}${O}`}}function
|
|
53
|
-
`:" ")}return
|
|
52
|
+
${Q}${O}`}else return`${W}${z}${V.join(" ")}${z}${O}`}}function yq({indent:q,options:{commentString:$}},Z,X,Q){if(X&&Q)X=X.replace(/^\n+/,"");if(X){let U=fq.indentComment($(X),q);Z.push(U.trimStart())}}z6.stringifyCollection=X6});var z0=A((W6)=>{var J6=P$(),Y6=j$(),H6=Dq(),U0=y(),xq=Q0(),V6=x();function r0(q,$){let Z=U0.isScalar($)?$.value:$;for(let X of q)if(U0.isPair(X)){if(X.key===$||X.key===Z)return X;if(U0.isScalar(X.key)&&X.key.value===Z)return X}return}class E1 extends H6.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(q){super(U0.MAP,q);this.items=[]}static from(q,$,Z){let{keepUndefined:X,replacer:Q}=Z,U=new this(q),z=(G,J)=>{if(typeof Q==="function")J=Q.call($,G,J);else if(Array.isArray(Q)&&!Q.includes(G))return;if(J!==void 0||X)U.items.push(xq.createPair(G,J,Z))};if($ instanceof Map)for(let[G,J]of $)z(G,J);else if($&&typeof $==="object")for(let G of Object.keys($))z(G,$[G]);if(typeof q.sortMapEntries==="function")U.items.sort(q.sortMapEntries);return U}add(q,$){let Z;if(U0.isPair(q))Z=q;else if(!q||typeof q!=="object"||!("key"in q))Z=new xq.Pair(q,q?.value);else Z=new xq.Pair(q.key,q.value);let X=r0(this.items,Z.key),Q=this.schema?.sortMapEntries;if(X){if(!$)throw Error(`Key ${Z.key} already set`);if(U0.isScalar(X.value)&&V6.isScalarValue(Z.value))X.value.value=Z.value;else X.value=Z.value}else if(Q){let U=this.items.findIndex((z)=>Q(Z,z)<0);if(U===-1)this.items.push(Z);else this.items.splice(U,0,Z)}else this.items.push(Z)}delete(q){let $=r0(this.items,q);if(!$)return!1;return this.items.splice(this.items.indexOf($),1).length>0}get(q,$){let X=r0(this.items,q)?.value;return(!$&&U0.isScalar(X)?X.value:X)??void 0}has(q){return!!r0(this.items,q)}set(q,$){this.add(new xq.Pair(q,$),!0)}toJSON(q,$,Z){let X=Z?new Z:$?.mapAsMap?new Map:{};if($?.onCreate)$.onCreate(X);for(let Q of this.items)Y6.addPairToJSMap($,X,Q);return X}toString(q,$,Z){if(!q)return JSON.stringify(this);for(let X of this.items)if(!U0.isPair(X))throw Error(`Map items must all be pairs; found ${JSON.stringify(X)} instead`);if(!q.allNullValues&&this.hasAllNullValues(!1))q=Object.assign({},q,{allNullValues:!0});return J6.stringifyCollection(this,q,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:q.indent||"",onChompKeep:Z,onComment:$})}}W6.YAMLMap=E1;W6.findPair=r0});var N0=A((F6)=>{var O6=y(),f1=z0(),T6={collection:"map",default:!0,nodeClass:f1.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(q,$){if(!O6.isMap(q))$("Expected a mapping for this tag");return q},createNode:(q,$,Z)=>f1.YAMLMap.from(q,$,Z)};F6.map=T6});var G0=A((D6)=>{var L6=c0(),R6=P$(),M6=Dq(),gq=y(),A6=x(),I6=$0();class y1 extends M6.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(q){super(gq.SEQ,q);this.items=[]}add(q){this.items.push(q)}delete(q){let $=hq(q);if(typeof $!=="number")return!1;return this.items.splice($,1).length>0}get(q,$){let Z=hq(q);if(typeof Z!=="number")return;let X=this.items[Z];return!$&&gq.isScalar(X)?X.value:X}has(q){let $=hq(q);return typeof $==="number"&&$<this.items.length}set(q,$){let Z=hq(q);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${q}.`);let X=this.items[Z];if(gq.isScalar(X)&&A6.isScalarValue($))X.value=$;else this.items[Z]=$}toJSON(q,$){let Z=[];if($?.onCreate)$.onCreate(Z);let X=0;for(let Q of this.items)Z.push(I6.toJS(Q,String(X++),$));return Z}toString(q,$,Z){if(!q)return JSON.stringify(this);return R6.stringifyCollection(this,q,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(q.indent||"")+" ",onChompKeep:Z,onComment:$})}static from(q,$,Z){let{replacer:X}=Z,Q=new this(q);if($&&Symbol.iterator in Object($)){let U=0;for(let z of $){if(typeof X==="function"){let G=$ instanceof Set?z:String(U++);z=X.call($,G,z)}Q.items.push(L6.createNode(z,void 0,Z))}}return Q}}function hq(q){let $=gq.isScalar(q)?q.value:q;if($&&typeof $==="string")$=Number($);return typeof $==="number"&&Number.isInteger($)&&$>=0?$:null}D6.YAMLSeq=y1});var j0=A((P6)=>{var N6=y(),x1=G0(),j6={collection:"seq",default:!0,nodeClass:x1.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(q,$){if(!N6.isSeq(q))$("Expected a sequence for this tag");return q},createNode:(q,$,Z)=>x1.YAMLSeq.from(q,$,Z)};P6.seq=j6});var t0=A((E6)=>{var b6=n0(),S6={identify:(q)=>typeof q==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(q)=>q,stringify(q,$,Z,X){return $=Object.assign({actualString:!0},$),b6.stringifyString(q,$,Z,X)}};E6.string=S6});var kq=A((y6)=>{var h1=x(),g1={identify:(q)=>q==null,createNode:()=>new h1.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new h1.Scalar(null),stringify:({source:q},$)=>typeof q==="string"&&g1.test.test(q)?q:$.options.nullStr};y6.nullTag=g1});var C$=A((g6)=>{var h6=x(),k1={identify:(q)=>typeof q==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(q)=>new h6.Scalar(q[0]==="t"||q[0]==="T"),stringify({source:q,value:$},Z){if(q&&k1.test.test(q)){let X=q[0]==="t"||q[0]==="T";if($===X)return q}return $?Z.options.trueStr:Z.options.falseStr}};g6.boolTag=k1});var P0=A((u6)=>{function v6({format:q,minFractionDigits:$,tag:Z,value:X}){if(typeof X==="bigint")return String(X);let Q=typeof X==="number"?X:Number(X);if(!isFinite(Q))return isNaN(Q)?".nan":Q<0?"-.inf":".inf";let U=Object.is(X,-0)?"-0":JSON.stringify(X);if(!q&&$&&(!Z||Z==="tag:yaml.org,2002:float")&&/^\d/.test(U)){let z=U.indexOf(".");if(z<0)z=U.length,U+=".";let G=$-(U.length-z-1);while(G-- >0)U+="0"}return U}u6.stringifyNumber=v6});var S$=A((a6)=>{var p6=x(),b$=P0(),d6={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(q)=>q.slice(-3).toLowerCase()==="nan"?NaN:q[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:b$.stringifyNumber},c6={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(q)=>parseFloat(q),stringify(q){let $=Number(q.value);return isFinite($)?$.toExponential():b$.stringifyNumber(q)}},l6={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(q){let $=new p6.Scalar(parseFloat(q)),Z=q.indexOf(".");if(Z!==-1&&q[q.length-1]==="0")$.minFractionDigits=q.length-Z-1;return $},stringify:b$.stringifyNumber};a6.float=l6;a6.floatExp=c6;a6.floatNaN=d6});var f$=A((e6)=>{var v1=P0(),vq=(q)=>typeof q==="bigint"||Number.isInteger(q),E$=(q,$,Z,{intAsBigInt:X})=>X?BigInt(q):parseInt(q.substring($),Z);function u1(q,$,Z){let{value:X}=q;if(vq(X)&&X>=0)return Z+X.toString($);return v1.stringifyNumber(q)}var o6={identify:(q)=>vq(q)&&q>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(q,$,Z)=>E$(q,2,8,Z),stringify:(q)=>u1(q,8,"0o")},r6={identify:vq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(q,$,Z)=>E$(q,0,10,Z),stringify:v1.stringifyNumber},t6={identify:(q)=>vq(q)&&q>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(q,$,Z)=>E$(q,2,16,Z),stringify:(q)=>u1(q,16,"0x")};e6.int=r6;e6.intHex=t6;e6.intOct=o6});var m1=A((Y3)=>{var X3=N0(),Q3=kq(),U3=j0(),z3=t0(),G3=C$(),y$=S$(),x$=f$(),J3=[X3.map,U3.seq,z3.string,Q3.nullTag,G3.boolTag,x$.intOct,x$.int,x$.intHex,y$.floatNaN,y$.floatExp,y$.float];Y3.schema=J3});var d1=A((F3)=>{var V3=x(),W3=N0(),B3=j0();function p1(q){return typeof q==="bigint"||Number.isInteger(q)}var uq=({value:q})=>JSON.stringify(q),_3=[{identify:(q)=>typeof q==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(q)=>q,stringify:uq},{identify:(q)=>q==null,createNode:()=>new V3.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:uq},{identify:(q)=>typeof q==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(q)=>q==="true",stringify:uq},{identify:p1,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(q,$,{intAsBigInt:Z})=>Z?BigInt(q):parseInt(q,10),stringify:({value:q})=>p1(q)?q.toString():JSON.stringify(q)},{identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(q)=>parseFloat(q),stringify:uq}],O3={default:!0,tag:"",test:/^/,resolve(q,$){return $(`Unresolved plain scalar ${JSON.stringify(q)}`),q}},T3=[W3.map,B3.seq].concat(_3,O3);F3.schema=T3});var g$=A((M3)=>{var e0=k("buffer"),h$=x(),L3=n0(),R3={identify:(q)=>q instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(q,$){if(typeof e0.Buffer==="function")return e0.Buffer.from(q,"base64");else if(typeof atob==="function"){let Z=atob(q.replace(/[\n\r]/g,"")),X=new Uint8Array(Z.length);for(let Q=0;Q<Z.length;++Q)X[Q]=Z.charCodeAt(Q);return X}else return $("This environment does not support reading binary tags; either Buffer or atob is required"),q},stringify({comment:q,type:$,value:Z},X,Q,U){if(!Z)return"";let z=Z,G;if(typeof e0.Buffer==="function")G=z instanceof e0.Buffer?z.toString("base64"):e0.Buffer.from(z.buffer).toString("base64");else if(typeof btoa==="function"){let J="";for(let Y=0;Y<z.length;++Y)J+=String.fromCharCode(z[Y]);G=btoa(J)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if($??($=h$.Scalar.BLOCK_LITERAL),$!==h$.Scalar.QUOTE_DOUBLE){let J=Math.max(X.options.lineWidth-X.indent.length,X.options.minContentWidth),Y=Math.ceil(G.length/J),B=Array(Y);for(let V=0,W=0;V<Y;++V,W+=J)B[V]=G.substr(W,J);G=B.join($===h$.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return L3.stringifyString({comment:q,type:$,value:G},X,Q,U)}};M3.binary=R3});var pq=A((N3)=>{var mq=y(),k$=Q0(),I3=x(),D3=G0();function c1(q,$){if(mq.isSeq(q))for(let Z=0;Z<q.items.length;++Z){let X=q.items[Z];if(mq.isPair(X))continue;else if(mq.isMap(X)){if(X.items.length>1)$("Each pair must have its own sequence indicator");let Q=X.items[0]||new k$.Pair(new I3.Scalar(null));if(X.commentBefore)Q.key.commentBefore=Q.key.commentBefore?`${X.commentBefore}
|
|
54
54
|
${Q.key.commentBefore}`:X.commentBefore;if(X.comment){let U=Q.value??Q.key;U.comment=U.comment?`${X.comment}
|
|
55
|
-
${U.comment}`:X.comment}X=Q}q.items[Z]=uq.isPair(X)?X:new k$.Pair(X)}else $("Expected a sequence for this tag");return q}function a1(q,$,Z){let{replacer:X}=Z,Q=new L3.YAMLSeq(q);Q.tag="tag:yaml.org,2002:pairs";let U=0;if($&&Symbol.iterator in Object($))for(let z of $){if(typeof X==="function")z=X.call($,String(U++),z);let G,J;if(Array.isArray(z))if(z.length===2)G=z[0],J=z[1];else throw TypeError(`Expected [key, value] tuple: ${z}`);else if(z&&z instanceof Object){let Y=Object.keys(z);if(Y.length===1)G=Y[0],J=z[G];else throw TypeError(`Expected tuple with one key, not ${Y.length} keys`)}else G=z;Q.items.push(k$.createPair(G,J,Z))}return Q}var K3={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:l1,createNode:a1};R3.createPairs=a1;R3.pairs=K3;R3.resolvePairs=l1});var u$=A((N3)=>{var i1=f(),v$=$0(),e0=z0(),D3=G0(),n1=mq();class B0 extends D3.YAMLSeq{constructor(){super();this.add=e0.YAMLMap.prototype.add.bind(this),this.delete=e0.YAMLMap.prototype.delete.bind(this),this.get=e0.YAMLMap.prototype.get.bind(this),this.has=e0.YAMLMap.prototype.has.bind(this),this.set=e0.YAMLMap.prototype.set.bind(this),this.tag=B0.tag}toJSON(q,$){if(!$)return super.toJSON(q);let Z=new Map;if($?.onCreate)$.onCreate(Z);for(let X of this.items){let Q,U;if(i1.isPair(X))Q=v$.toJS(X.key,"",$),U=v$.toJS(X.value,Q,$);else Q=v$.toJS(X,"",$);if(Z.has(Q))throw Error("Ordered maps must not include duplicate keys");Z.set(Q,U)}return Z}static from(q,$,Z){let X=n1.createPairs(q,$,Z),Q=new this;return Q.items=X.items,Q}}B0.tag="tag:yaml.org,2002:omap";var w3={collection:"seq",identify:(q)=>q instanceof Map,nodeClass:B0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(q,$){let Z=n1.resolvePairs(q,$),X=[];for(let{key:Q}of Z.items)if(i1.isScalar(Q))if(X.includes(Q.value))$(`Ordered maps must not include duplicate keys: ${Q.value}`);else X.push(Q.value);return Object.assign(new B0,Z)},createNode:(q,$,Z)=>B0.from(q,$,Z)};N3.YAMLOMap=B0;N3.omap=w3});var e1=A((C3)=>{var s1=x();function o1({value:q,source:$},Z){if($&&(q?r1:t1).test.test($))return $;return q?Z.options.trueStr:Z.options.falseStr}var r1={identify:(q)=>q===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new s1.Scalar(!0),stringify:o1},t1={identify:(q)=>q===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new s1.Scalar(!1),stringify:o1};C3.falseTag=t1;C3.trueTag=r1});var q9=A((g3)=>{var E3=x(),m$=j0(),f3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(q)=>q.slice(-3).toLowerCase()==="nan"?NaN:q[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:m$.stringifyNumber},y3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(q)=>parseFloat(q.replace(/_/g,"")),stringify(q){let $=Number(q.value);return isFinite($)?$.toExponential():m$.stringifyNumber(q)}},x3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(q){let $=new E3.Scalar(parseFloat(q.replace(/_/g,""))),Z=q.indexOf(".");if(Z!==-1){let X=q.substring(Z+1).replace(/_/g,"");if(X[X.length-1]==="0")$.minFractionDigits=X.length}return $},stringify:m$.stringifyNumber};g3.float=x3;g3.floatExp=y3;g3.floatNaN=f3});var Z9=A((c3)=>{var $9=j0(),qq=(q)=>typeof q==="bigint"||Number.isInteger(q);function pq(q,$,Z,{intAsBigInt:X}){let Q=q[0];if(Q==="-"||Q==="+")$+=1;if(q=q.substring($).replace(/_/g,""),X){switch(Z){case 2:q=`0b${q}`;break;case 8:q=`0o${q}`;break;case 16:q=`0x${q}`;break}let z=BigInt(q);return Q==="-"?BigInt(-1)*z:z}let U=parseInt(q,Z);return Q==="-"?-1*U:U}function p$(q,$,Z){let{value:X}=q;if(qq(X)){let Q=X.toString($);return X<0?"-"+Z+Q.substr(1):Z+Q}return $9.stringifyNumber(q)}var u3={identify:qq,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(q,$,Z)=>pq(q,2,2,Z),stringify:(q)=>p$(q,2,"0b")},m3={identify:qq,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(q,$,Z)=>pq(q,1,8,Z),stringify:(q)=>p$(q,8,"0")},p3={identify:qq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(q,$,Z)=>pq(q,0,10,Z),stringify:$9.stringifyNumber},d3={identify:qq,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(q,$,Z)=>pq(q,2,16,Z),stringify:(q)=>p$(q,16,"0x")};c3.int=p3;c3.intBin=u3;c3.intHex=d3;c3.intOct=m3});var d$=A((o3)=>{var lq=f(),dq=Q0(),cq=z0();class _0 extends cq.YAMLMap{constructor(q){super(q);this.tag=_0.tag}add(q){let $;if(lq.isPair(q))$=q;else if(q&&typeof q==="object"&&"key"in q&&"value"in q&&q.value===null)$=new dq.Pair(q.key,null);else $=new dq.Pair(q,null);if(!cq.findPair(this.items,$.key))this.items.push($)}get(q,$){let Z=cq.findPair(this.items,q);return!$&&lq.isPair(Z)?lq.isScalar(Z.key)?Z.key.value:Z.key:Z}set(q,$){if(typeof $!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof $}`);let Z=cq.findPair(this.items,q);if(Z&&!$)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&$)this.items.push(new dq.Pair(q))}toJSON(q,$){return super.toJSON(q,$,Set)}toString(q,$,Z){if(!q)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},q,{allNullValues:!0}),$,Z);else throw Error("Set items must all have null values")}static from(q,$,Z){let{replacer:X}=Z,Q=new this(q);if($&&Symbol.iterator in Object($))for(let U of $){if(typeof X==="function")U=X.call($,U,U);Q.items.push(dq.createPair(U,null,Z))}return Q}}_0.tag="tag:yaml.org,2002:set";var s3={collection:"map",identify:(q)=>q instanceof Set,nodeClass:_0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(q,$,Z)=>_0.from(q,$,Z),resolve(q,$){if(lq.isMap(q))if(q.hasAllNullValues(!0))return Object.assign(new _0,q);else $("Set items must all have null values");else $("Expected a mapping for this tag");return q}};o3.YAMLSet=_0;o3.set=s3});var l$=A((Z7)=>{var e3=j0();function c$(q,$){let Z=q[0],X=Z==="-"||Z==="+"?q.substring(1):q,Q=(z)=>$?BigInt(z):Number(z),U=X.replace(/_/g,"").split(":").reduce((z,G)=>z*Q(60)+Q(G),Q(0));return Z==="-"?Q(-1)*U:U}function X9(q){let{value:$}=q,Z=(z)=>z;if(typeof $==="bigint")Z=(z)=>BigInt(z);else if(isNaN($)||!isFinite($))return e3.stringifyNumber(q);let X="";if($<0)X="-",$*=Z(-1);let Q=Z(60),U=[$%Q];if($<60)U.unshift(0);else if($=($-U[0])/Q,U.unshift($%Q),$>=60)$=($-U[0])/Q,U.unshift($);return X+U.map((z)=>String(z).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var q7={identify:(q)=>typeof q==="bigint"||Number.isInteger(q),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(q,$,{intAsBigInt:Z})=>c$(q,Z),stringify:X9},$7={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(q)=>c$(q,!1),stringify:X9},Q9={identify:(q)=>q instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(q){let $=q.match(Q9.test);if(!$)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,X,Q,U,z,G]=$.map(Number),J=$[7]?Number(($[7]+"00").substr(1,3)):0,Y=Date.UTC(Z,X-1,Q,U||0,z||0,G||0,J),B=$[8];if(B&&B!=="Z"){let V=c$(B,!1);if(Math.abs(V)<30)V*=60;Y-=60000*V}return new Date(Y)},stringify:({value:q})=>q?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Z7.floatTime=$7;Z7.intTime=q7;Z7.timestamp=Q9});var z9=A((T7)=>{var z7=w0(),G7=hq(),J7=N0(),Y7=r0(),H7=h$(),U9=e1(),a$=q9(),aq=Z9(),V7=Cq(),W7=u$(),B7=mq(),_7=d$(),i$=l$(),O7=[z7.map,J7.seq,Y7.string,G7.nullTag,U9.trueTag,U9.falseTag,aq.intBin,aq.intOct,aq.int,aq.intHex,a$.floatNaN,a$.floatExp,a$.float,H7.binary,V7.merge,W7.omap,B7.pairs,_7.set,i$.intTime,i$.floatTime,i$.timestamp];T7.schema=O7});var T9=A((w7)=>{var H9=w0(),L7=hq(),V9=N0(),K7=r0(),R7=C$(),n$=S$(),s$=f$(),M7=p1(),A7=c1(),W9=h$(),$q=Cq(),B9=u$(),_9=mq(),G9=z9(),O9=d$(),iq=l$(),J9=new Map([["core",M7.schema],["failsafe",[H9.map,V9.seq,K7.string]],["json",A7.schema],["yaml11",G9.schema],["yaml-1.1",G9.schema]]),Y9={binary:W9.binary,bool:R7.boolTag,float:n$.float,floatExp:n$.floatExp,floatNaN:n$.floatNaN,floatTime:iq.floatTime,int:s$.int,intHex:s$.intHex,intOct:s$.intOct,intTime:iq.intTime,map:H9.map,merge:$q.merge,null:L7.nullTag,omap:B9.omap,pairs:_9.pairs,seq:V9.seq,set:O9.set,timestamp:iq.timestamp},I7={"tag:yaml.org,2002:binary":W9.binary,"tag:yaml.org,2002:merge":$q.merge,"tag:yaml.org,2002:omap":B9.omap,"tag:yaml.org,2002:pairs":_9.pairs,"tag:yaml.org,2002:set":O9.set,"tag:yaml.org,2002:timestamp":iq.timestamp};function D7(q,$,Z){let X=J9.get($);if(X&&!q)return Z&&!X.includes($q.merge)?X.concat($q.merge):X.slice();let Q=X;if(!Q)if(Array.isArray(q))Q=[];else{let U=Array.from(J9.keys()).filter((z)=>z!=="yaml11").map((z)=>JSON.stringify(z)).join(", ");throw Error(`Unknown schema "${$}"; use one of ${U} or define customTags array`)}if(Array.isArray(q))for(let U of q)Q=Q.concat(U);else if(typeof q==="function")Q=q(Q.slice());if(Z)Q=Q.concat($q.merge);return Q.reduce((U,z)=>{let G=typeof z==="string"?Y9[z]:z;if(!G){let J=JSON.stringify(z),Y=Object.keys(Y9).map((B)=>JSON.stringify(B)).join(", ");throw Error(`Unknown custom tag ${J}; use one of ${Y}`)}if(!U.includes(G))U.push(G);return U},[])}w7.coreKnownTags=I7;w7.getTags=D7});var t$=A((E7)=>{var o$=f(),P7=w0(),C7=N0(),b7=r0(),nq=T9(),S7=(q,$)=>q.key<$.key?-1:q.key>$.key?1:0;class r${constructor({compat:q,customTags:$,merge:Z,resolveKnownTags:X,schema:Q,sortMapEntries:U,toStringDefaults:z}){this.compat=Array.isArray(q)?nq.getTags(q,"compat"):q?nq.getTags(null,q):null,this.name=typeof Q==="string"&&Q||"core",this.knownTags=X?nq.coreKnownTags:{},this.tags=nq.getTags($,this.name,Z),this.toStringOptions=z??null,Object.defineProperty(this,o$.MAP,{value:P7.map}),Object.defineProperty(this,o$.SCALAR,{value:b7.string}),Object.defineProperty(this,o$.SEQ,{value:C7.seq}),this.sortMapEntries=typeof U==="function"?U:U===!0?S7:null}clone(){let q=Object.create(r$.prototype,Object.getOwnPropertyDescriptors(this));return q.tags=this.tags.slice(),q}}E7.Schema=r$});var F9=A((g7)=>{var y7=f(),e$=i0(),Zq=c0();function x7(q,$){let Z=[],X=$.directives===!0;if($.directives!==!1&&q.directives){let J=q.directives.toString(q);if(J)Z.push(J),X=!0;else if(q.directives.docStart)X=!0}if(X)Z.push("---");let Q=e$.createStringifyContext(q,$),{commentString:U}=Q.options;if(q.commentBefore){if(Z.length!==1)Z.unshift("");let J=U(q.commentBefore);Z.unshift(Zq.indentComment(J,""))}let z=!1,G=null;if(q.contents){if(y7.isNode(q.contents)){if(q.contents.spaceBefore&&X)Z.push("");if(q.contents.commentBefore){let B=U(q.contents.commentBefore);Z.push(Zq.indentComment(B,""))}Q.forceBlockIndent=!!q.comment,G=q.contents.comment}let J=G?void 0:()=>z=!0,Y=e$.stringify(q.contents,Q,()=>G=null,J);if(G)Y+=Zq.lineComment(Y,"",U(G));if((Y[0]==="|"||Y[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${Y}`;else Z.push(Y)}else Z.push(e$.stringify(q.contents,Q));if(q.directives?.docEnd)if(q.comment){let J=U(q.comment);if(J.includes(`
|
|
56
|
-
`))Z.push("..."),Z.push(
|
|
55
|
+
${U.comment}`:X.comment}X=Q}q.items[Z]=mq.isPair(X)?X:new k$.Pair(X)}else $("Expected a sequence for this tag");return q}function l1(q,$,Z){let{replacer:X}=Z,Q=new D3.YAMLSeq(q);Q.tag="tag:yaml.org,2002:pairs";let U=0;if($&&Symbol.iterator in Object($))for(let z of $){if(typeof X==="function")z=X.call($,String(U++),z);let G,J;if(Array.isArray(z))if(z.length===2)G=z[0],J=z[1];else throw TypeError(`Expected [key, value] tuple: ${z}`);else if(z&&z instanceof Object){let Y=Object.keys(z);if(Y.length===1)G=Y[0],J=z[G];else throw TypeError(`Expected tuple with one key, not ${Y.length} keys`)}else G=z;Q.items.push(k$.createPair(G,J,Z))}return Q}var w3={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:c1,createNode:l1};N3.createPairs=l1;N3.pairs=w3;N3.resolvePairs=c1});var u$=A((E3)=>{var a1=y(),v$=$0(),qq=z0(),b3=G0(),n1=pq();class B0 extends b3.YAMLSeq{constructor(){super();this.add=qq.YAMLMap.prototype.add.bind(this),this.delete=qq.YAMLMap.prototype.delete.bind(this),this.get=qq.YAMLMap.prototype.get.bind(this),this.has=qq.YAMLMap.prototype.has.bind(this),this.set=qq.YAMLMap.prototype.set.bind(this),this.tag=B0.tag}toJSON(q,$){if(!$)return super.toJSON(q);let Z=new Map;if($?.onCreate)$.onCreate(Z);for(let X of this.items){let Q,U;if(a1.isPair(X))Q=v$.toJS(X.key,"",$),U=v$.toJS(X.value,Q,$);else Q=v$.toJS(X,"",$);if(Z.has(Q))throw Error("Ordered maps must not include duplicate keys");Z.set(Q,U)}return Z}static from(q,$,Z){let X=n1.createPairs(q,$,Z),Q=new this;return Q.items=X.items,Q}}B0.tag="tag:yaml.org,2002:omap";var S3={collection:"seq",identify:(q)=>q instanceof Map,nodeClass:B0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(q,$){let Z=n1.resolvePairs(q,$),X=[];for(let{key:Q}of Z.items)if(a1.isScalar(Q))if(X.includes(Q.value))$(`Ordered maps must not include duplicate keys: ${Q.value}`);else X.push(Q.value);return Object.assign(new B0,Z)},createNode:(q,$,Z)=>B0.from(q,$,Z)};E3.YAMLOMap=B0;E3.omap=S3});var t1=A((x3)=>{var i1=x();function s1({value:q,source:$},Z){if($&&(q?o1:r1).test.test($))return $;return q?Z.options.trueStr:Z.options.falseStr}var o1={identify:(q)=>q===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new i1.Scalar(!0),stringify:s1},r1={identify:(q)=>q===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new i1.Scalar(!1),stringify:s1};x3.falseTag=r1;x3.trueTag=o1});var e1=A((p3)=>{var k3=x(),m$=P0(),v3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(q)=>q.slice(-3).toLowerCase()==="nan"?NaN:q[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:m$.stringifyNumber},u3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(q)=>parseFloat(q.replace(/_/g,"")),stringify(q){let $=Number(q.value);return isFinite($)?$.toExponential():m$.stringifyNumber(q)}},m3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(q){let $=new k3.Scalar(parseFloat(q.replace(/_/g,""))),Z=q.indexOf(".");if(Z!==-1){let X=q.substring(Z+1).replace(/_/g,"");if(X[X.length-1]==="0")$.minFractionDigits=X.length}return $},stringify:m$.stringifyNumber};p3.float=m3;p3.floatExp=u3;p3.floatNaN=v3});var $9=A((o3)=>{var q9=P0(),$q=(q)=>typeof q==="bigint"||Number.isInteger(q);function dq(q,$,Z,{intAsBigInt:X}){let Q=q[0];if(Q==="-"||Q==="+")$+=1;if(q=q.substring($).replace(/_/g,""),X){switch(Z){case 2:q=`0b${q}`;break;case 8:q=`0o${q}`;break;case 16:q=`0x${q}`;break}let z=BigInt(q);return Q==="-"?BigInt(-1)*z:z}let U=parseInt(q,Z);return Q==="-"?-1*U:U}function p$(q,$,Z){let{value:X}=q;if($q(X)){let Q=X.toString($);return X<0?"-"+Z+Q.substr(1):Z+Q}return q9.stringifyNumber(q)}var a3={identify:$q,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(q,$,Z)=>dq(q,2,2,Z),stringify:(q)=>p$(q,2,"0b")},n3={identify:$q,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(q,$,Z)=>dq(q,1,8,Z),stringify:(q)=>p$(q,8,"0")},i3={identify:$q,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(q,$,Z)=>dq(q,0,10,Z),stringify:q9.stringifyNumber},s3={identify:$q,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(q,$,Z)=>dq(q,2,16,Z),stringify:(q)=>p$(q,16,"0x")};o3.int=i3;o3.intBin=a3;o3.intHex=s3;o3.intOct=n3});var d$=A((Z7)=>{var aq=y(),cq=Q0(),lq=z0();class _0 extends lq.YAMLMap{constructor(q){super(q);this.tag=_0.tag}add(q){let $;if(aq.isPair(q))$=q;else if(q&&typeof q==="object"&&"key"in q&&"value"in q&&q.value===null)$=new cq.Pair(q.key,null);else $=new cq.Pair(q,null);if(!lq.findPair(this.items,$.key))this.items.push($)}get(q,$){let Z=lq.findPair(this.items,q);return!$&&aq.isPair(Z)?aq.isScalar(Z.key)?Z.key.value:Z.key:Z}set(q,$){if(typeof $!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof $}`);let Z=lq.findPair(this.items,q);if(Z&&!$)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&$)this.items.push(new cq.Pair(q))}toJSON(q,$){return super.toJSON(q,$,Set)}toString(q,$,Z){if(!q)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},q,{allNullValues:!0}),$,Z);else throw Error("Set items must all have null values")}static from(q,$,Z){let{replacer:X}=Z,Q=new this(q);if($&&Symbol.iterator in Object($))for(let U of $){if(typeof X==="function")U=X.call($,U,U);Q.items.push(cq.createPair(U,null,Z))}return Q}}_0.tag="tag:yaml.org,2002:set";var $7={collection:"map",identify:(q)=>q instanceof Set,nodeClass:_0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(q,$,Z)=>_0.from(q,$,Z),resolve(q,$){if(aq.isMap(q))if(q.hasAllNullValues(!0))return Object.assign(new _0,q);else $("Set items must all have null values");else $("Expected a mapping for this tag");return q}};Z7.YAMLSet=_0;Z7.set=$7});var l$=A((J7)=>{var U7=P0();function c$(q,$){let Z=q[0],X=Z==="-"||Z==="+"?q.substring(1):q,Q=(z)=>$?BigInt(z):Number(z),U=X.replace(/_/g,"").split(":").reduce((z,G)=>z*Q(60)+Q(G),Q(0));return Z==="-"?Q(-1)*U:U}function Z9(q){let{value:$}=q,Z=(z)=>z;if(typeof $==="bigint")Z=(z)=>BigInt(z);else if(isNaN($)||!isFinite($))return U7.stringifyNumber(q);let X="";if($<0)X="-",$*=Z(-1);let Q=Z(60),U=[$%Q];if($<60)U.unshift(0);else if($=($-U[0])/Q,U.unshift($%Q),$>=60)$=($-U[0])/Q,U.unshift($);return X+U.map((z)=>String(z).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var z7={identify:(q)=>typeof q==="bigint"||Number.isInteger(q),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(q,$,{intAsBigInt:Z})=>c$(q,Z),stringify:Z9},G7={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(q)=>c$(q,!1),stringify:Z9},X9={identify:(q)=>q instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(q){let $=q.match(X9.test);if(!$)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,X,Q,U,z,G]=$.map(Number),J=$[7]?Number(($[7]+"00").substr(1,3)):0,Y=Date.UTC(Z,X-1,Q,U||0,z||0,G||0,J),B=$[8];if(B&&B!=="Z"){let V=c$(B,!1);if(Math.abs(V)<30)V*=60;Y-=60000*V}return new Date(Y)},stringify:({value:q})=>q?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};J7.floatTime=G7;J7.intTime=z7;J7.timestamp=X9});var U9=A((A7)=>{var W7=N0(),B7=kq(),_7=j0(),O7=t0(),T7=g$(),Q9=t1(),a$=e1(),nq=$9(),F7=bq(),K7=u$(),L7=pq(),R7=d$(),n$=l$(),M7=[W7.map,_7.seq,O7.string,B7.nullTag,Q9.trueTag,Q9.falseTag,nq.intBin,nq.intOct,nq.int,nq.intHex,a$.floatNaN,a$.floatExp,a$.float,T7.binary,F7.merge,K7.omap,L7.pairs,R7.set,n$.intTime,n$.floatTime,n$.timestamp];A7.schema=M7});var O9=A((S7)=>{var Y9=N0(),D7=kq(),H9=j0(),w7=t0(),N7=C$(),i$=S$(),s$=f$(),j7=m1(),P7=d1(),V9=g$(),Zq=bq(),W9=u$(),B9=pq(),z9=U9(),_9=d$(),iq=l$(),G9=new Map([["core",j7.schema],["failsafe",[Y9.map,H9.seq,w7.string]],["json",P7.schema],["yaml11",z9.schema],["yaml-1.1",z9.schema]]),J9={binary:V9.binary,bool:N7.boolTag,float:i$.float,floatExp:i$.floatExp,floatNaN:i$.floatNaN,floatTime:iq.floatTime,int:s$.int,intHex:s$.intHex,intOct:s$.intOct,intTime:iq.intTime,map:Y9.map,merge:Zq.merge,null:D7.nullTag,omap:W9.omap,pairs:B9.pairs,seq:H9.seq,set:_9.set,timestamp:iq.timestamp},C7={"tag:yaml.org,2002:binary":V9.binary,"tag:yaml.org,2002:merge":Zq.merge,"tag:yaml.org,2002:omap":W9.omap,"tag:yaml.org,2002:pairs":B9.pairs,"tag:yaml.org,2002:set":_9.set,"tag:yaml.org,2002:timestamp":iq.timestamp};function b7(q,$,Z){let X=G9.get($);if(X&&!q)return Z&&!X.includes(Zq.merge)?X.concat(Zq.merge):X.slice();let Q=X;if(!Q)if(Array.isArray(q))Q=[];else{let U=Array.from(G9.keys()).filter((z)=>z!=="yaml11").map((z)=>JSON.stringify(z)).join(", ");throw Error(`Unknown schema "${$}"; use one of ${U} or define customTags array`)}if(Array.isArray(q))for(let U of q)Q=Q.concat(U);else if(typeof q==="function")Q=q(Q.slice());if(Z)Q=Q.concat(Zq.merge);return Q.reduce((U,z)=>{let G=typeof z==="string"?J9[z]:z;if(!G){let J=JSON.stringify(z),Y=Object.keys(J9).map((B)=>JSON.stringify(B)).join(", ");throw Error(`Unknown custom tag ${J}; use one of ${Y}`)}if(!U.includes(G))U.push(G);return U},[])}S7.coreKnownTags=C7;S7.getTags=b7});var t$=A((k7)=>{var o$=y(),y7=N0(),x7=j0(),h7=t0(),sq=O9(),g7=(q,$)=>q.key<$.key?-1:q.key>$.key?1:0;class r${constructor({compat:q,customTags:$,merge:Z,resolveKnownTags:X,schema:Q,sortMapEntries:U,toStringDefaults:z}){this.compat=Array.isArray(q)?sq.getTags(q,"compat"):q?sq.getTags(null,q):null,this.name=typeof Q==="string"&&Q||"core",this.knownTags=X?sq.coreKnownTags:{},this.tags=sq.getTags($,this.name,Z),this.toStringOptions=z??null,Object.defineProperty(this,o$.MAP,{value:y7.map}),Object.defineProperty(this,o$.SCALAR,{value:h7.string}),Object.defineProperty(this,o$.SEQ,{value:x7.seq}),this.sortMapEntries=typeof U==="function"?U:U===!0?g7:null}clone(){let q=Object.create(r$.prototype,Object.getOwnPropertyDescriptors(this));return q.tags=this.tags.slice(),q}}k7.Schema=r$});var T9=A((p7)=>{var u7=y(),e$=i0(),Xq=l0();function m7(q,$){let Z=[],X=$.directives===!0;if($.directives!==!1&&q.directives){let J=q.directives.toString(q);if(J)Z.push(J),X=!0;else if(q.directives.docStart)X=!0}if(X)Z.push("---");let Q=e$.createStringifyContext(q,$),{commentString:U}=Q.options;if(q.commentBefore){if(Z.length!==1)Z.unshift("");let J=U(q.commentBefore);Z.unshift(Xq.indentComment(J,""))}let z=!1,G=null;if(q.contents){if(u7.isNode(q.contents)){if(q.contents.spaceBefore&&X)Z.push("");if(q.contents.commentBefore){let B=U(q.contents.commentBefore);Z.push(Xq.indentComment(B,""))}Q.forceBlockIndent=!!q.comment,G=q.contents.comment}let J=G?void 0:()=>z=!0,Y=e$.stringify(q.contents,Q,()=>G=null,J);if(G)Y+=Xq.lineComment(Y,"",U(G));if((Y[0]==="|"||Y[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${Y}`;else Z.push(Y)}else Z.push(e$.stringify(q.contents,Q));if(q.directives?.docEnd)if(q.comment){let J=U(q.comment);if(J.includes(`
|
|
56
|
+
`))Z.push("..."),Z.push(Xq.indentComment(J,""));else Z.push(`... ${J}`)}else Z.push("...");else{let J=q.comment;if(J&&z)J=J.replace(/^\n+/,"");if(J){if((!z||G)&&Z[Z.length-1]!=="")Z.push("");Z.push(Xq.indentComment(U(J),""))}}return Z.join(`
|
|
57
57
|
`)+`
|
|
58
|
-
`}
|
|
58
|
+
`}p7.stringifyDocument=m7});var Qq=A((r7)=>{var c7=d0(),C0=Dq(),l=y(),l7=Q0(),a7=$0(),n7=t$(),i7=T9(),q2=Mq(),s7=L$(),o7=c0(),$2=K$();class Z2{constructor(q,$,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,l.NODE_TYPE,{value:l.DOC});let X=null;if(typeof $==="function"||Array.isArray($))X=$;else if(Z===void 0&&$)Z=$,$=void 0;let Q=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=Q;let{version:U}=Q;if(Z?._directives){if(this.directives=Z._directives.atDocument(),this.directives.yaml.explicit)U=this.directives.yaml.version}else this.directives=new $2.Directives({version:U});this.setSchema(U,Z),this.contents=q===void 0?null:this.createNode(q,X,Z)}clone(){let q=Object.create(Z2.prototype,{[l.NODE_TYPE]:{value:l.DOC}});if(q.commentBefore=this.commentBefore,q.comment=this.comment,q.errors=this.errors.slice(),q.warnings=this.warnings.slice(),q.options=Object.assign({},this.options),this.directives)q.directives=this.directives.clone();if(q.schema=this.schema.clone(),q.contents=l.isNode(this.contents)?this.contents.clone(q.schema):this.contents,this.range)q.range=this.range.slice();return q}add(q){if(b0(this.contents))this.contents.add(q)}addIn(q,$){if(b0(this.contents))this.contents.addIn(q,$)}createAlias(q,$){if(!q.anchor){let Z=q2.anchorNames(this);q.anchor=!$||Z.has($)?q2.findNewAnchor($||"a",Z):$}return new c7.Alias(q.anchor)}createNode(q,$,Z){let X=void 0;if(typeof $==="function")q=$.call({"":q},"",q),X=$;else if(Array.isArray($)){let _=(L)=>typeof L==="number"||L instanceof String||L instanceof Number,T=$.filter(_).map(String);if(T.length>0)$=$.concat(T);X=$}else if(Z===void 0&&$)Z=$,$=void 0;let{aliasDuplicateObjects:Q,anchorPrefix:U,flow:z,keepUndefined:G,onTagObj:J,tag:Y}=Z??{},{onAnchor:B,setAnchors:V,sourceObjects:W}=q2.createNodeAnchors(this,U||"a"),O={aliasDuplicateObjects:Q??!0,keepUndefined:G??!1,onAnchor:B,onTagObj:J,replacer:X,schema:this.schema,sourceObjects:W},F=o7.createNode(q,Y,O);if(z&&l.isCollection(F))F.flow=!0;return V(),F}createPair(q,$,Z={}){let X=this.createNode(q,null,Z),Q=this.createNode($,null,Z);return new l7.Pair(X,Q)}delete(q){return b0(this.contents)?this.contents.delete(q):!1}deleteIn(q){if(C0.isEmptyPath(q)){if(this.contents==null)return!1;return this.contents=null,!0}return b0(this.contents)?this.contents.deleteIn(q):!1}get(q,$){return l.isCollection(this.contents)?this.contents.get(q,$):void 0}getIn(q,$){if(C0.isEmptyPath(q))return!$&&l.isScalar(this.contents)?this.contents.value:this.contents;return l.isCollection(this.contents)?this.contents.getIn(q,$):void 0}has(q){return l.isCollection(this.contents)?this.contents.has(q):!1}hasIn(q){if(C0.isEmptyPath(q))return this.contents!==void 0;return l.isCollection(this.contents)?this.contents.hasIn(q):!1}set(q,$){if(this.contents==null)this.contents=C0.collectionFromPath(this.schema,[q],$);else if(b0(this.contents))this.contents.set(q,$)}setIn(q,$){if(C0.isEmptyPath(q))this.contents=$;else if(this.contents==null)this.contents=C0.collectionFromPath(this.schema,Array.from(q),$);else if(b0(this.contents))this.contents.setIn(q,$)}setSchema(q,$={}){if(typeof q==="number")q=String(q);let Z;switch(q){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new $2.Directives({version:"1.1"});Z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=q;else this.directives=new $2.Directives({version:q});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let X=JSON.stringify(q);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${X}`)}}if($.schema instanceof Object)this.schema=$.schema;else if(Z)this.schema=new n7.Schema(Object.assign(Z,$));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:q,jsonArg:$,mapAsMap:Z,maxAliasCount:X,onAnchor:Q,reviver:U}={}){let z={anchors:new Map,doc:this,keep:!q,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},G=a7.toJS(this.contents,$??"",z);if(typeof Q==="function")for(let{count:J,res:Y}of z.anchors.values())Q(Y,J);return typeof U==="function"?s7.applyReviver(U,{"":G},"",G):G}toJSON(q,$){return this.toJS({json:!0,jsonArg:q,mapAsMap:!1,onAnchor:$})}toString(q={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in q&&(!Number.isInteger(q.indent)||Number(q.indent)<=0)){let $=JSON.stringify(q.indent);throw Error(`"indent" option must be a positive integer, not ${$}`)}return i7.stringifyDocument(this,q)}}function b0(q){if(l.isCollection(q))return!0;throw Error("Expected a YAML collection as document contents")}r7.Document=Z2});var Uq=A((qX)=>{class oq extends Error{constructor(q,$,Z,X){super();this.name=q,this.code=Z,this.message=X,this.pos=$}}class F9 extends oq{constructor(q,$,Z){super("YAMLParseError",q,$,Z)}}class K9 extends oq{constructor(q,$,Z){super("YAMLWarning",q,$,Z)}}var e7=(q,$)=>(Z)=>{if(Z.pos[0]===-1)return;Z.linePos=Z.pos.map((G)=>$.linePos(G));let{line:X,col:Q}=Z.linePos[0];Z.message+=` at line ${X}, column ${Q}`;let U=Q-1,z=q.substring($.lineStarts[X-1],$.lineStarts[X]).replace(/[\n\r]+$/,"");if(U>=60&&z.length>80){let G=Math.min(U-39,z.length-79);z="…"+z.substring(G),U-=G-1}if(z.length>80)z=z.substring(0,79)+"…";if(X>1&&/^ *$/.test(z.substring(0,U))){let G=q.substring($.lineStarts[X-2],$.lineStarts[X-1]);if(G.length>80)G=G.substring(0,79)+`…
|
|
59
59
|
`;z=G+z}if(/[^ ]/.test(z)){let G=1,J=Z.linePos[1];if(J?.line===X&&J.col>Q)G=Math.max(1,Math.min(J.col-Q,80-U));let Y=" ".repeat(U)+"^".repeat(G);Z.message+=`:
|
|
60
60
|
|
|
61
61
|
${z}
|
|
62
62
|
${Y}
|
|
63
|
-
`}};
|
|
64
|
-
`))return!0;if(q.end){for(let $ of q.end)if($.type==="newline")return!0}return!1;case"flow-collection":for(let $ of q.items){for(let Z of $.start)if(Z.type==="newline")return!0;if($.sep){for(let Z of $.sep)if(Z.type==="newline")return!0}if(X2($.key)||X2($.value))return!0}return!1;default:return!0}}
|
|
65
|
-
`+_.comment;else G.comment=_.comment;continue}if(_.newlineAfterProp||
|
|
66
|
-
`+R.comment;else M.comment=R.comment;let D=new
|
|
67
|
-
`+N.comment;else Y.comment=N.comment;V=N.end;continue}if(!z&&Z.options.strict&&
|
|
68
|
-
`+I;else
|
|
69
|
-
`+C.comment;else
|
|
70
|
-
`+T.comment;else Y.comment=T.comment;Y.range=[X.offset,_,T.offset]}else Y.range=[X.offset,_,_];return Y}
|
|
71
|
-
`.repeat(Math.max(1,z.length-1)):"",T=X+Q.length;if($.source)T+=$.source.length;return{value:_,type:U,comment:Q.comment,range:[X,T,T]}}let J=$.indent+Q.indent,Y=$.offset+Q.length,B=0;for(let _=0;_<G;++_){let[T,
|
|
72
|
-
`;for(let _=B;_<G;++_){let[T,
|
|
73
|
-
`;else if(T.length>J||
|
|
63
|
+
`}};qX.YAMLError=oq;qX.YAMLParseError=F9;qX.YAMLWarning=K9;qX.prettifyError=e7});var zq=A((zX)=>{function UX(q,{flow:$,indicator:Z,next:X,offset:Q,onError:U,parentIndent:z,startOnNewline:G}){let J=!1,Y=G,B=G,V="",W="",O=!1,F=!1,_=null,T=null,L=null,M=null,R=null,D=null,w=null;for(let K of q){if(F){if(K.type!=="space"&&K.type!=="newline"&&K.type!=="comma")U(K.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");F=!1}if(_){if(Y&&K.type!=="comment"&&K.type!=="newline")U(_,"TAB_AS_INDENT","Tabs are not allowed as indentation");_=null}switch(K.type){case"space":if(!$&&(Z!=="doc-start"||X?.type!=="flow-collection")&&K.source.includes("\t"))_=K;B=!0;break;case"comment":{if(!B)U(K,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=K.source.substring(1)||" ";if(!V)V=C;else V+=W+C;W="",Y=!1;break}case"newline":if(Y){if(V)V+=K.source;else if(!D||Z!=="seq-item-ind")J=!0}else W+=K.source;if(Y=!0,O=!0,T||L)M=K;B=!0;break;case"anchor":if(T)U(K,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(K.source.endsWith(":"))U(K.offset+K.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);T=K,w??(w=K.offset),Y=!1,B=!1,F=!0;break;case"tag":{if(L)U(K,"MULTIPLE_TAGS","A node can have at most one tag");L=K,w??(w=K.offset),Y=!1,B=!1,F=!0;break}case Z:if(T||L)U(K,"BAD_PROP_ORDER",`Anchors and tags must be after the ${K.source} indicator`);if(D)U(K,"UNEXPECTED_TOKEN",`Unexpected ${K.source} in ${$??"collection"}`);D=K,Y=Z==="seq-item-ind"||Z==="explicit-key-ind",B=!1;break;case"comma":if($){if(R)U(K,"UNEXPECTED_TOKEN",`Unexpected , in ${$}`);R=K,Y=!1,B=!1;break}default:U(K,"UNEXPECTED_TOKEN",`Unexpected ${K.type} token`),Y=!1,B=!1}}let N=q[q.length-1],I=N?N.offset+N.source.length:Q;if(F&&X&&X.type!=="space"&&X.type!=="newline"&&X.type!=="comma"&&(X.type!=="scalar"||X.source!==""))U(X.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(_&&(Y&&_.indent<=z||X?.type==="block-map"||X?.type==="block-seq"))U(_,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:R,found:D,spaceBefore:J,comment:V,hasNewline:O,anchor:T,tag:L,newlineAfterProp:M,end:I,start:w??I}}zX.resolveProps=UX});var rq=A((JX)=>{function X2(q){if(!q)return null;switch(q.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(q.source.includes(`
|
|
64
|
+
`))return!0;if(q.end){for(let $ of q.end)if($.type==="newline")return!0}return!1;case"flow-collection":for(let $ of q.items){for(let Z of $.start)if(Z.type==="newline")return!0;if($.sep){for(let Z of $.sep)if(Z.type==="newline")return!0}if(X2($.key)||X2($.value))return!0}return!1;default:return!0}}JX.containsNewline=X2});var Q2=A((WX)=>{var HX=rq();function VX(q,$,Z){if($?.type==="flow-collection"){let X=$.end[0];if(X.indent===q&&(X.source==="]"||X.source==="}")&&HX.containsNewline($))Z(X,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}WX.flowIndentCheck=VX});var U2=A((OX)=>{var L9=y();function _X(q,$,Z){let{uniqueKeys:X}=q.options;if(X===!1)return!1;let Q=typeof X==="function"?X:(U,z)=>U===z||L9.isScalar(U)&&L9.isScalar(z)&&U.value===z.value;return $.some((U)=>Q(U.key,Z))}OX.mapIncludes=_X});var D9=A((MX)=>{var R9=Q0(),FX=z0(),M9=zq(),KX=rq(),A9=Q2(),LX=U2(),I9="All mapping items must start at the same column";function RX({composeNode:q,composeEmptyNode:$},Z,X,Q,U){let G=new(U?.nodeClass??FX.YAMLMap)(Z.schema);if(Z.atRoot)Z.atRoot=!1;let J=X.offset,Y=null;for(let B of X.items){let{start:V,key:W,sep:O,value:F}=B,_=M9.resolveProps(V,{indicator:"explicit-key-ind",next:W??O?.[0],offset:J,onError:Q,parentIndent:X.indent,startOnNewline:!0}),T=!_.found;if(T){if(W){if(W.type==="block-seq")Q(J,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in W&&W.indent!==X.indent)Q(J,"BAD_INDENT",I9)}if(!_.anchor&&!_.tag&&!O){if(Y=_.end,_.comment)if(G.comment)G.comment+=`
|
|
65
|
+
`+_.comment;else G.comment=_.comment;continue}if(_.newlineAfterProp||KX.containsNewline(W))Q(W??V[V.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(_.found?.indent!==X.indent)Q(J,"BAD_INDENT",I9);Z.atKey=!0;let L=_.end,M=W?q(Z,W,_,Q):$(Z,L,V,null,_,Q);if(Z.schema.compat)A9.flowIndentCheck(X.indent,W,Q);if(Z.atKey=!1,LX.mapIncludes(Z,G.items,M))Q(L,"DUPLICATE_KEY","Map keys must be unique");let R=M9.resolveProps(O??[],{indicator:"map-value-ind",next:F,offset:M.range[2],onError:Q,parentIndent:X.indent,startOnNewline:!W||W.type==="block-scalar"});if(J=R.end,R.found){if(T){if(F?.type==="block-map"&&!R.hasNewline)Q(J,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(Z.options.strict&&_.start<R.found.offset-1024)Q(M.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let D=F?q(Z,F,R,Q):$(Z,J,O,null,R,Q);if(Z.schema.compat)A9.flowIndentCheck(X.indent,F,Q);J=D.range[2];let w=new R9.Pair(M,D);if(Z.options.keepSourceTokens)w.srcToken=B;G.items.push(w)}else{if(T)Q(M.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(R.comment)if(M.comment)M.comment+=`
|
|
66
|
+
`+R.comment;else M.comment=R.comment;let D=new R9.Pair(M);if(Z.options.keepSourceTokens)D.srcToken=B;G.items.push(D)}}if(Y&&Y<J)Q(Y,"IMPOSSIBLE","Map comment with trailing content");return G.range=[X.offset,J,Y??J],G}MX.resolveBlockMap=RX});var w9=A((jX)=>{var IX=G0(),DX=zq(),wX=Q2();function NX({composeNode:q,composeEmptyNode:$},Z,X,Q,U){let G=new(U?.nodeClass??IX.YAMLSeq)(Z.schema);if(Z.atRoot)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let J=X.offset,Y=null;for(let{start:B,value:V}of X.items){let W=DX.resolveProps(B,{indicator:"seq-item-ind",next:V,offset:J,onError:Q,parentIndent:X.indent,startOnNewline:!0});if(!W.found)if(W.anchor||W.tag||V)if(V?.type==="block-seq")Q(W.end,"BAD_INDENT","All sequence items must start at the same column");else Q(J,"MISSING_CHAR","Sequence item without - indicator");else{if(Y=W.end,W.comment)G.comment=W.comment;continue}let O=V?q(Z,V,W,Q):$(Z,W.end,B,null,W,Q);if(Z.schema.compat)wX.flowIndentCheck(X.indent,V,Q);J=O.range[2],G.items.push(O)}return G.range=[X.offset,J,Y??J],G}jX.resolveBlockSeq=NX});var S0=A((bX)=>{function CX(q,$,Z,X){let Q="";if(q){let U=!1,z="";for(let G of q){let{source:J,type:Y}=G;switch(Y){case"space":U=!0;break;case"comment":{if(Z&&!U)X(G,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let B=J.substring(1)||" ";if(!Q)Q=B;else Q+=z+B;z="";break}case"newline":if(Q)z+=J;U=!0;break;default:X(G,"UNEXPECTED_TOKEN",`Unexpected ${Y} at node end`)}$+=J.length}}return{comment:Q,offset:$}}bX.resolveEnd=CX});var P9=A((vX)=>{var EX=y(),fX=Q0(),N9=z0(),yX=G0(),xX=S0(),j9=zq(),hX=rq(),gX=U2(),z2="Block collections are not allowed within flow collections",G2=(q)=>q&&(q.type==="block-map"||q.type==="block-seq");function kX({composeNode:q,composeEmptyNode:$},Z,X,Q,U){let z=X.start.source==="{",G=z?"flow map":"flow sequence",Y=new(U?.nodeClass??(z?N9.YAMLMap:yX.YAMLSeq))(Z.schema);Y.flow=!0;let B=Z.atRoot;if(B)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let V=X.offset+X.start.source.length;for(let T=0;T<X.items.length;++T){let L=X.items[T],{start:M,key:R,sep:D,value:w}=L,N=j9.resolveProps(M,{flow:G,indicator:"explicit-key-ind",next:R??D?.[0],offset:V,onError:Q,parentIndent:X.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!D&&!w){if(T===0&&N.comma)Q(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`);else if(T<X.items.length-1)Q(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${G}`);if(N.comment)if(Y.comment)Y.comment+=`
|
|
67
|
+
`+N.comment;else Y.comment=N.comment;V=N.end;continue}if(!z&&Z.options.strict&&hX.containsNewline(R))Q(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(T===0){if(N.comma)Q(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`)}else{if(!N.comma)Q(N.start,"MISSING_CHAR",`Missing , between ${G} items`);if(N.comment){let I="";q:for(let K of M)switch(K.type){case"comma":case"space":break;case"comment":I=K.source.substring(1);break q;default:break q}if(I){let K=Y.items[Y.items.length-1];if(EX.isPair(K))K=K.value??K.key;if(K.comment)K.comment+=`
|
|
68
|
+
`+I;else K.comment=I;N.comment=N.comment.substring(I.length+1)}}}if(!z&&!D&&!N.found){let I=w?q(Z,w,N,Q):$(Z,N.end,D,null,N,Q);if(Y.items.push(I),V=I.range[2],G2(w))Q(I.range,"BLOCK_IN_FLOW",z2)}else{Z.atKey=!0;let I=N.end,K=R?q(Z,R,N,Q):$(Z,I,M,null,N,Q);if(G2(R))Q(K.range,"BLOCK_IN_FLOW",z2);Z.atKey=!1;let C=j9.resolveProps(D??[],{flow:G,indicator:"map-value-ind",next:w,offset:K.range[2],onError:Q,parentIndent:X.indent,startOnNewline:!1});if(C.found){if(!z&&!N.found&&Z.options.strict){if(D)for(let f of D){if(f===C.found)break;if(f.type==="newline"){Q(f,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(N.start<C.found.offset-1024)Q(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(w)if("source"in w&&w.source?.[0]===":")Q(w,"MISSING_CHAR",`Missing space after : in ${G}`);else Q(C.start,"MISSING_CHAR",`Missing , or : between ${G} items`);let j=w?q(Z,w,C,Q):C.found?$(Z,C.end,D,null,C,Q):null;if(j){if(G2(w))Q(j.range,"BLOCK_IN_FLOW",z2)}else if(C.comment)if(K.comment)K.comment+=`
|
|
69
|
+
`+C.comment;else K.comment=C.comment;let b=new fX.Pair(K,j);if(Z.options.keepSourceTokens)b.srcToken=L;if(z){let f=Y;if(gX.mapIncludes(Z,f.items,K))Q(I,"DUPLICATE_KEY","Map keys must be unique");f.items.push(b)}else{let f=new N9.YAMLMap(Z.schema);f.flow=!0,f.items.push(b);let h=(j??K).range;f.range=[K.range[0],h[1],h[2]],Y.items.push(f)}V=j?j.range[2]:C.end}}let W=z?"}":"]",[O,...F]=X.end,_=V;if(O?.source===W)_=O.offset+O.source.length;else{let T=G[0].toUpperCase()+G.substring(1),L=B?`${T} must end with a ${W}`:`${T} in block collection must be sufficiently indented and end with a ${W}`;if(Q(V,B?"MISSING_CHAR":"BAD_INDENT",L),O&&O.source.length!==1)F.unshift(O)}if(F.length>0){let T=xX.resolveEnd(F,_,Z.options.strict,Q);if(T.comment)if(Y.comment)Y.comment+=`
|
|
70
|
+
`+T.comment;else Y.comment=T.comment;Y.range=[X.offset,_,T.offset]}else Y.range=[X.offset,_,_];return Y}vX.resolveFlowCollection=kX});var C9=A((sX)=>{var mX=y(),pX=x(),dX=z0(),cX=G0(),lX=D9(),aX=w9(),nX=P9();function J2(q,$,Z,X,Q,U){let z=Z.type==="block-map"?lX.resolveBlockMap(q,$,Z,X,U):Z.type==="block-seq"?aX.resolveBlockSeq(q,$,Z,X,U):nX.resolveFlowCollection(q,$,Z,X,U),G=z.constructor;if(Q==="!"||Q===G.tagName)return z.tag=G.tagName,z;if(Q)z.tag=Q;return z}function iX(q,$,Z,X,Q){let U=X.tag,z=!U?null:$.directives.tagName(U.source,(W)=>Q(U,"TAG_RESOLVE_FAILED",W));if(Z.type==="block-seq"){let{anchor:W,newlineAfterProp:O}=X,F=W&&U?W.offset>U.offset?W:U:W??U;if(F&&(!O||O.offset<F.offset))Q(F,"MISSING_CHAR","Missing newline after block sequence props")}let G=Z.type==="block-map"?"map":Z.type==="block-seq"?"seq":Z.start.source==="{"?"map":"seq";if(!U||!z||z==="!"||z===dX.YAMLMap.tagName&&G==="map"||z===cX.YAMLSeq.tagName&&G==="seq")return J2(q,$,Z,Q,z);let J=$.schema.tags.find((W)=>W.tag===z&&W.collection===G);if(!J){let W=$.schema.knownTags[z];if(W?.collection===G)$.schema.tags.push(Object.assign({},W,{default:!1})),J=W;else{if(W)Q(U,"BAD_COLLECTION_TYPE",`${W.tag} used for ${G} collection, but expects ${W.collection??"scalar"}`,!0);else Q(U,"TAG_RESOLVE_FAILED",`Unresolved tag: ${z}`,!0);return J2(q,$,Z,Q,z)}}let Y=J2(q,$,Z,Q,z,J),B=J.resolve?.(Y,(W)=>Q(U,"TAG_RESOLVE_FAILED",W),$.options)??Y,V=mX.isNode(B)?B:new pX.Scalar(B);if(V.range=Y.range,V.tag=z,J?.format)V.format=J.format;return V}sX.composeCollection=iX});var H2=A((qQ)=>{var Y2=x();function rX(q,$,Z){let X=$.offset,Q=tX($,q.options.strict,Z);if(!Q)return{value:"",type:null,comment:"",range:[X,X,X]};let U=Q.mode===">"?Y2.Scalar.BLOCK_FOLDED:Y2.Scalar.BLOCK_LITERAL,z=$.source?eX($.source):[],G=z.length;for(let _=z.length-1;_>=0;--_){let T=z[_][1];if(T===""||T==="\r")G=_;else break}if(G===0){let _=Q.chomp==="+"&&z.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,z.length-1)):"",T=X+Q.length;if($.source)T+=$.source.length;return{value:_,type:U,comment:Q.comment,range:[X,T,T]}}let J=$.indent+Q.indent,Y=$.offset+Q.length,B=0;for(let _=0;_<G;++_){let[T,L]=z[_];if(L===""||L==="\r"){if(Q.indent===0&&T.length>J)J=T.length}else{if(T.length<J)Z(Y+T.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(Q.indent===0)J=T.length;if(B=_,J===0&&!q.atRoot)Z(Y,"BAD_INDENT","Block scalar values in collections must be indented");break}Y+=T.length+L.length+1}for(let _=z.length-1;_>=G;--_)if(z[_][0].length>J)G=_+1;let V="",W="",O=!1;for(let _=0;_<B;++_)V+=z[_][0].slice(J)+`
|
|
72
|
+
`;for(let _=B;_<G;++_){let[T,L]=z[_];Y+=T.length+L.length+1;let M=L[L.length-1]==="\r";if(M)L=L.slice(0,-1);if(L&&T.length<J){let D=`Block scalar lines must not be less indented than their ${Q.indent?"explicit indentation indicator":"first line"}`;Z(Y-L.length-(M?2:1),"BAD_INDENT",D),T=""}if(U===Y2.Scalar.BLOCK_LITERAL)V+=W+T.slice(J)+L,W=`
|
|
73
|
+
`;else if(T.length>J||L[0]==="\t"){if(W===" ")W=`
|
|
74
74
|
`;else if(!O&&W===`
|
|
75
75
|
`)W=`
|
|
76
76
|
|
|
77
|
-
`;V+=W+T.slice(J)+
|
|
78
|
-
`,O=!0}else if(
|
|
77
|
+
`;V+=W+T.slice(J)+L,W=`
|
|
78
|
+
`,O=!0}else if(L==="")if(W===`
|
|
79
79
|
`)V+=`
|
|
80
80
|
`;else W=`
|
|
81
|
-
`;else V+=W+
|
|
81
|
+
`;else V+=W+L,W=" ",O=!1}switch(Q.chomp){case"-":break;case"+":for(let _=G;_<z.length;++_)V+=`
|
|
82
82
|
`+z[_][0].slice(J);if(V[V.length-1]!==`
|
|
83
83
|
`)V+=`
|
|
84
84
|
`;break;default:V+=`
|
|
85
|
-
`}let F=X+Q.length+$.source.length;return{value:V,type:U,comment:Q.comment,range:[X,F,F]}}function
|
|
85
|
+
`}let F=X+Q.length+$.source.length;return{value:V,type:U,comment:Q.comment,range:[X,F,F]}}function tX({offset:q,props:$},Z,X){if($[0].type!=="block-scalar-header")return X($[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:Q}=$[0],U=Q[0],z=0,G="",J=-1;for(let W=1;W<Q.length;++W){let O=Q[W];if(!G&&(O==="-"||O==="+"))G=O;else{let F=Number(O);if(!z&&F)z=F;else if(J===-1)J=q+W}}if(J!==-1)X(J,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${Q}`);let Y=!1,B="",V=Q.length;for(let W=1;W<$.length;++W){let O=$[W];switch(O.type){case"space":Y=!0;case"newline":V+=O.source.length;break;case"comment":if(Z&&!Y)X(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=O.source.length,B=O.source.substring(1);break;case"error":X(O,"UNEXPECTED_TOKEN",O.message),V+=O.source.length;break;default:{let F=`Unexpected token in block scalar header: ${O.type}`;X(O,"UNEXPECTED_TOKEN",F);let _=O.source;if(_&&typeof _==="string")V+=_.length}}}return{mode:U,indent:z,chomp:G,comment:B,length:V}}function eX(q){let $=q.split(/\n( *)/),Z=$[0],X=Z.match(/^( *)/),U=[X?.[1]?[X[1],Z.slice(X[1].length)]:["",Z]];for(let z=1;z<$.length;z+=2)U.push([$[z],$[z+1]]);return U}qQ.resolveBlockScalar=rX});var W2=A((HQ)=>{var V2=x(),ZQ=S0();function XQ(q,$,Z){let{offset:X,type:Q,source:U,end:z}=q,G,J,Y=(W,O,F)=>Z(X+W,O,F);switch(Q){case"scalar":G=V2.Scalar.PLAIN,J=QQ(U,Y);break;case"single-quoted-scalar":G=V2.Scalar.QUOTE_SINGLE,J=UQ(U,Y);break;case"double-quoted-scalar":G=V2.Scalar.QUOTE_DOUBLE,J=zQ(U,Y);break;default:return Z(q,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${Q}`),{value:"",type:null,comment:"",range:[X,X+U.length,X+U.length]}}let B=X+U.length,V=ZQ.resolveEnd(z,B,$,Z);return{value:J,type:G,comment:V.comment,range:[X,B,V.offset]}}function QQ(q,$){let Z="";switch(q[0]){case"\t":Z="a tab character";break;case",":Z="flow indicator character ,";break;case"%":Z="directive indicator character %";break;case"|":case">":{Z=`block scalar indicator ${q[0]}`;break}case"@":case"`":{Z=`reserved character ${q[0]}`;break}}if(Z)$(0,"BAD_SCALAR_START",`Plain value cannot start with ${Z}`);return b9(q)}function UQ(q,$){if(q[q.length-1]!=="'"||q.length===1)$(q.length,"MISSING_CHAR","Missing closing 'quote");return b9(q.slice(1,-1)).replace(/''/g,"'")}function b9(q){let $,Z;try{$=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
86
|
`,"sy"),Z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
87
|
`,"sy")}catch{$=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let X=$.exec(q);if(!X)return q;let Q=X[1],U=" ",z=$.lastIndex;Z.lastIndex=z;while(X=Z.exec(q)){if(X[1]==="")if(U===`
|
|
88
88
|
`)Q+=U;else U=`
|
|
89
|
-
`;else Q+=U+X[1],U=" ";z=Z.lastIndex}let G=/[ \t]*(.*)/sy;return G.lastIndex=z,X=G.exec(q),Q+U+(X?.[1]??"")}function
|
|
89
|
+
`;else Q+=U+X[1],U=" ";z=Z.lastIndex}let G=/[ \t]*(.*)/sy;return G.lastIndex=z,X=G.exec(q),Q+U+(X?.[1]??"")}function zQ(q,$){let Z="";for(let X=1;X<q.length-1;++X){let Q=q[X];if(Q==="\r"&&q[X+1]===`
|
|
90
90
|
`)continue;if(Q===`
|
|
91
|
-
`){let{fold:U,offset:z}
|
|
91
|
+
`){let{fold:U,offset:z}=GQ(q,X);Z+=U,X=z}else if(Q==="\\"){let U=q[++X],z=JQ[U];if(z)Z+=z;else if(U===`
|
|
92
92
|
`){U=q[X+1];while(U===" "||U==="\t")U=q[++X+1]}else if(U==="\r"&&q[X+1]===`
|
|
93
|
-
`){U=q[++X+1];while(U===" "||U==="\t")U=q[++X+1]}else if(U==="x"||U==="u"||U==="U"){let G={x:2,u:4,U:8}[U];Z+=
|
|
93
|
+
`){U=q[++X+1];while(U===" "||U==="\t")U=q[++X+1]}else if(U==="x"||U==="u"||U==="U"){let G={x:2,u:4,U:8}[U];Z+=YQ(q,X+1,G,$),X+=G}else{let G=q.substr(X-1,2);$(X-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),Z+=G}}else if(Q===" "||Q==="\t"){let U=X,z=q[X+1];while(z===" "||z==="\t")z=q[++X+1];if(z!==`
|
|
94
94
|
`&&!(z==="\r"&&q[X+2]===`
|
|
95
|
-
`))Z+=X>U?q.slice(U,X+1):Q}else Z+=Q}if(q[q.length-1]!=='"'||q.length===1)$(q.length,"MISSING_CHAR",'Missing closing "quote');return Z}function
|
|
95
|
+
`))Z+=X>U?q.slice(U,X+1):Q}else Z+=Q}if(q[q.length-1]!=='"'||q.length===1)$(q.length,"MISSING_CHAR",'Missing closing "quote');return Z}function GQ(q,$){let Z="",X=q[$+1];while(X===" "||X==="\t"||X===`
|
|
96
96
|
`||X==="\r"){if(X==="\r"&&q[$+2]!==`
|
|
97
97
|
`)break;if(X===`
|
|
98
98
|
`)Z+=`
|
|
99
|
-
`;$+=1,X=q[$+1]}if(!Z)Z=" ";return{fold:Z,offset:$}}var
|
|
100
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
99
|
+
`;$+=1,X=q[$+1]}if(!Z)Z=" ";return{fold:Z,offset:$}}var JQ={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
100
|
+
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function YQ(q,$,Z,X){let Q=q.substr($,Z),z=Q.length===Z&&/^[0-9a-fA-F]+$/.test(Q)?parseInt(Q,16):NaN;if(isNaN(z)){let G=q.substr($-2,Z+2);return X($-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),G}return String.fromCodePoint(z)}HQ.resolveFlowScalar=XQ});var E9=A((FQ)=>{var O0=y(),S9=x(),WQ=H2(),BQ=W2();function _Q(q,$,Z,X){let{value:Q,type:U,comment:z,range:G}=$.type==="block-scalar"?WQ.resolveBlockScalar(q,$,X):BQ.resolveFlowScalar($,q.options.strict,X),J=Z?q.directives.tagName(Z.source,(V)=>X(Z,"TAG_RESOLVE_FAILED",V)):null,Y;if(q.options.stringKeys&&q.atKey)Y=q.schema[O0.SCALAR];else if(J)Y=OQ(q.schema,Q,J,Z,X);else if($.type==="scalar")Y=TQ(q,Q,$,X);else Y=q.schema[O0.SCALAR];let B;try{let V=Y.resolve(Q,(W)=>X(Z??$,"TAG_RESOLVE_FAILED",W),q.options);B=O0.isScalar(V)?V:new S9.Scalar(V)}catch(V){let W=V instanceof Error?V.message:String(V);X(Z??$,"TAG_RESOLVE_FAILED",W),B=new S9.Scalar(Q)}if(B.range=G,B.source=Q,U)B.type=U;if(J)B.tag=J;if(Y.format)B.format=Y.format;if(z)B.comment=z;return B}function OQ(q,$,Z,X,Q){if(Z==="!")return q[O0.SCALAR];let U=[];for(let G of q.tags)if(!G.collection&&G.tag===Z)if(G.default&&G.test)U.push(G);else return G;for(let G of U)if(G.test?.test($))return G;let z=q.knownTags[Z];if(z&&!z.collection)return q.tags.push(Object.assign({},z,{default:!1,test:void 0})),z;return Q(X,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Z}`,Z!=="tag:yaml.org,2002:str"),q[O0.SCALAR]}function TQ({atKey:q,directives:$,schema:Z},X,Q,U){let z=Z.tags.find((G)=>(G.default===!0||q&&G.default==="key")&&G.test?.test(X))||Z[O0.SCALAR];if(Z.compat){let G=Z.compat.find((J)=>J.default&&J.test?.test(X))??Z[O0.SCALAR];if(z.tag!==G.tag){let J=$.tagString(z.tag),Y=$.tagString(G.tag),B=`Value may be parsed as either ${J} or ${Y}`;U(Q,"TAG_RESOLVE_FAILED",B,!0)}}return z}FQ.composeScalar=_Q});var f9=A((RQ)=>{function LQ(q,$,Z){if($){Z??(Z=$.length);for(let X=Z-1;X>=0;--X){let Q=$[X];switch(Q.type){case"space":case"comment":case"newline":q-=Q.source.length;continue}Q=$[++X];while(Q?.type==="space")q+=Q.source.length,Q=$[++X];break}}return q}RQ.emptyScalarPosition=LQ});var h9=A((CQ)=>{var AQ=d0(),IQ=y(),DQ=C9(),y9=E9(),wQ=S0(),NQ=f9(),jQ={composeNode:x9,composeEmptyNode:B2};function x9(q,$,Z,X){let Q=q.atKey,{spaceBefore:U,comment:z,anchor:G,tag:J}=Z,Y,B=!0;switch($.type){case"alias":if(Y=PQ(q,$,X),G||J)X($,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(Y=y9.composeScalar(q,$,J,X),G)Y.anchor=G.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(Y=DQ.composeCollection(jQ,q,$,Z,X),G)Y.anchor=G.source.substring(1);break;default:{let V=$.type==="error"?$.message:`Unsupported token (type: ${$.type})`;X($,"UNEXPECTED_TOKEN",V),Y=B2(q,$.offset,void 0,null,Z,X),B=!1}}if(G&&Y.anchor==="")X(G,"BAD_ALIAS","Anchor cannot be an empty string");if(Q&&q.options.stringKeys&&(!IQ.isScalar(Y)||typeof Y.value!=="string"||Y.tag&&Y.tag!=="tag:yaml.org,2002:str"))X(J??$,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(U)Y.spaceBefore=!0;if(z)if($.type==="scalar"&&$.source==="")Y.comment=z;else Y.commentBefore=z;if(q.options.keepSourceTokens&&B)Y.srcToken=$;return Y}function B2(q,$,Z,X,{spaceBefore:Q,comment:U,anchor:z,tag:G,end:J},Y){let B={type:"scalar",offset:NQ.emptyScalarPosition($,Z,X),indent:-1,source:""},V=y9.composeScalar(q,B,G,Y);if(z){if(V.anchor=z.source.substring(1),V.anchor==="")Y(z,"BAD_ALIAS","Anchor cannot be an empty string")}if(Q)V.spaceBefore=!0;if(U)V.comment=U,V.range[2]=J;return V}function PQ({options:q},{offset:$,source:Z,end:X},Q){let U=new AQ.Alias(Z.substring(1));if(U.source==="")Q($,"BAD_ALIAS","Alias cannot be an empty string");if(U.source.endsWith(":"))Q($+Z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let z=$+Z.length,G=wQ.resolveEnd(X,z,q.strict,Q);if(U.range=[$,z,G.offset],G.comment)U.comment=G.comment;return U}CQ.composeEmptyNode=B2;CQ.composeNode=x9});var k9=A((hQ)=>{var EQ=Qq(),g9=h9(),fQ=S0(),yQ=zq();function xQ(q,$,{offset:Z,start:X,value:Q,end:U},z){let G=Object.assign({_directives:$},q),J=new EQ.Document(void 0,G),Y={atKey:!1,atRoot:!0,directives:J.directives,options:J.options,schema:J.schema},B=yQ.resolveProps(X,{indicator:"doc-start",next:Q??U?.[0],offset:Z,onError:z,parentIndent:0,startOnNewline:!0});if(B.found){if(J.directives.docStart=!0,Q&&(Q.type==="block-map"||Q.type==="block-seq")&&!B.hasNewline)z(B.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}J.contents=Q?g9.composeNode(Y,Q,B,z):g9.composeEmptyNode(Y,B.end,X,null,B,z);let V=J.contents.range[2],W=fQ.resolveEnd(U,V,!1,z);if(W.comment)J.comment=W.comment;return J.range=[Z,V,W.offset],J}hQ.composeDoc=xQ});var _2=A((dQ)=>{var kQ=k("process"),vQ=K$(),uQ=Qq(),Gq=Uq(),v9=y(),mQ=k9(),pQ=S0();function Jq(q){if(typeof q==="number")return[q,q+1];if(Array.isArray(q))return q.length===2?q:[q[0],q[1]];let{offset:$,source:Z}=q;return[$,$+(typeof Z==="string"?Z.length:1)]}function u9(q){let $="",Z=!1,X=!1;for(let Q=0;Q<q.length;++Q){let U=q[Q];switch(U[0]){case"#":$+=($===""?"":X?`
|
|
101
101
|
|
|
102
102
|
`:`
|
|
103
|
-
`)+(U.substring(1)||" "),Z=!0,X=!1;break;case"%":if(q[Q+1]?.[0]!=="#")Q+=1;Z=!1;break;default:if(!Z)X=!0;Z=!1}}return{comment:$,afterEmptyLine:X}}class
|
|
104
|
-
${Z}`:Z;else if(X||q.directives.docStart||!Q)q.commentBefore=Z;else if(
|
|
103
|
+
`)+(U.substring(1)||" "),Z=!0,X=!1;break;case"%":if(q[Q+1]?.[0]!=="#")Q+=1;Z=!1;break;default:if(!Z)X=!0;Z=!1}}return{comment:$,afterEmptyLine:X}}class m9{constructor(q={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=($,Z,X,Q)=>{let U=Jq($);if(Q)this.warnings.push(new Gq.YAMLWarning(U,Z,X));else this.errors.push(new Gq.YAMLParseError(U,Z,X))},this.directives=new vQ.Directives({version:q.version||"1.2"}),this.options=q}decorate(q,$){let{comment:Z,afterEmptyLine:X}=u9(this.prelude);if(Z){let Q=q.contents;if($)q.comment=q.comment?`${q.comment}
|
|
104
|
+
${Z}`:Z;else if(X||q.directives.docStart||!Q)q.commentBefore=Z;else if(v9.isCollection(Q)&&!Q.flow&&Q.items.length>0){let U=Q.items[0];if(v9.isPair(U))U=U.key;let z=U.commentBefore;U.commentBefore=z?`${Z}
|
|
105
105
|
${z}`:Z}else{let U=Q.commentBefore;Q.commentBefore=U?`${Z}
|
|
106
|
-
${U}`:Z}}if($)Array.prototype.push.apply(q.errors,this.errors),Array.prototype.push.apply(q.warnings,this.warnings);else q.errors=this.errors,q.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
107
|
-
${$.comment}`:$.comment}this.doc.range[2]=$.offset;break}default:this.errors.push(new
|
|
106
|
+
${U}`:Z}}if($)Array.prototype.push.apply(q.errors,this.errors),Array.prototype.push.apply(q.warnings,this.warnings);else q.errors=this.errors,q.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:u9(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(q,$=!1,Z=-1){for(let X of q)yield*this.next(X);yield*this.end($,Z)}*next(q){if(kQ.env.LOG_STREAM)console.dir(q,{depth:null});switch(q.type){case"directive":this.directives.add(q.source,($,Z,X)=>{let Q=Jq(q);Q[0]+=$,this.onError(Q,"BAD_DIRECTIVE",Z,X)}),this.prelude.push(q.source),this.atDirectives=!0;break;case"document":{let $=mQ.composeDoc(this.options,this.directives,q,this.onError);if(this.atDirectives&&!$.directives.docStart)this.onError(q,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate($,!1),this.doc)yield this.doc;this.doc=$,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(q.source);break;case"error":{let $=q.source?`${q.message}: ${JSON.stringify(q.source)}`:q.message,Z=new Gq.YAMLParseError(Jq(q),"UNEXPECTED_TOKEN",$);if(this.atDirectives||!this.doc)this.errors.push(Z);else this.doc.errors.push(Z);break}case"doc-end":{if(!this.doc){this.errors.push(new Gq.YAMLParseError(Jq(q),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let $=pQ.resolveEnd(q.end,q.offset+q.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),$.comment){let Z=this.doc.comment;this.doc.comment=Z?`${Z}
|
|
107
|
+
${$.comment}`:$.comment}this.doc.range[2]=$.offset;break}default:this.errors.push(new Gq.YAMLParseError(Jq(q),"UNEXPECTED_TOKEN",`Unsupported token ${q.type}`))}}*end(q=!1,$=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(q){let Z=Object.assign({_directives:this.directives},this.options),X=new uQ.Document(void 0,Z);if(this.atDirectives)this.onError($,"MISSING_CHAR","Missing directives-end indicator line");X.range=[0,$,$],this.decorate(X,!1),yield X}}}dQ.Composer=m9});var c9=A((tQ)=>{var lQ=H2(),aQ=W2(),nQ=Uq(),p9=n0();function iQ(q,$=!0,Z){if(q){let X=(Q,U,z)=>{let G=typeof Q==="number"?Q:Array.isArray(Q)?Q[0]:Q.offset;if(Z)Z(G,U,z);else throw new nQ.YAMLParseError([G,G+1],U,z)};switch(q.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return aQ.resolveFlowScalar(q,$,X);case"block-scalar":return lQ.resolveBlockScalar({options:{strict:$}},q,X)}}return null}function sQ(q,$){let{implicitKey:Z=!1,indent:X,inFlow:Q=!1,offset:U=-1,type:z="PLAIN"}=$,G=p9.stringifyString({type:z,value:q},{implicitKey:Z,indent:X>0?" ".repeat(X):"",inFlow:Q,options:{blockQuote:!0,lineWidth:-1}}),J=$.end??[{type:"newline",offset:-1,indent:X,source:`
|
|
108
108
|
`}];switch(G[0]){case"|":case">":{let Y=G.indexOf(`
|
|
109
109
|
`),B=G.substring(0,Y),V=G.substring(Y+1)+`
|
|
110
|
-
`,W=[{type:"block-scalar-header",offset:U,indent:X,source:B}];if(!
|
|
111
|
-
`});return{type:"block-scalar",offset:U,indent:X,props:W,source:V}}case'"':return{type:"double-quoted-scalar",offset:U,indent:X,source:G,end:J};case"'":return{type:"single-quoted-scalar",offset:U,indent:X,source:G,end:J};default:return{type:"scalar",offset:U,indent:X,source:G,end:J}}}function
|
|
110
|
+
`,W=[{type:"block-scalar-header",offset:U,indent:X,source:B}];if(!d9(W,J))W.push({type:"newline",offset:-1,indent:X,source:`
|
|
111
|
+
`});return{type:"block-scalar",offset:U,indent:X,props:W,source:V}}case'"':return{type:"double-quoted-scalar",offset:U,indent:X,source:G,end:J};case"'":return{type:"single-quoted-scalar",offset:U,indent:X,source:G,end:J};default:return{type:"scalar",offset:U,indent:X,source:G,end:J}}}function oQ(q,$,Z={}){let{afterKey:X=!1,implicitKey:Q=!1,inFlow:U=!1,type:z}=Z,G="indent"in q?q.indent:null;if(X&&typeof G==="number")G+=2;if(!z)switch(q.type){case"single-quoted-scalar":z="QUOTE_SINGLE";break;case"double-quoted-scalar":z="QUOTE_DOUBLE";break;case"block-scalar":{let Y=q.props[0];if(Y.type!=="block-scalar-header")throw Error("Invalid block scalar header");z=Y.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:z="PLAIN"}let J=p9.stringifyString({type:z,value:$},{implicitKey:Q||G===null,indent:G!==null&&G>0?" ".repeat(G):"",inFlow:U,options:{blockQuote:!0,lineWidth:-1}});switch(J[0]){case"|":case">":rQ(q,J);break;case'"':O2(q,J,"double-quoted-scalar");break;case"'":O2(q,J,"single-quoted-scalar");break;default:O2(q,J,"scalar")}}function rQ(q,$){let Z=$.indexOf(`
|
|
112
112
|
`),X=$.substring(0,Z),Q=$.substring(Z+1)+`
|
|
113
|
-
`;if(q.type==="block-scalar"){let U=q.props[0];if(U.type!=="block-scalar-header")throw Error("Invalid block scalar header");U.source=X,q.source=Q}else{let{offset:U}=q,z="indent"in q?q.indent:-1,G=[{type:"block-scalar-header",offset:U,indent:z,source:X}];if(!
|
|
114
|
-
`});for(let J of Object.keys(q))if(J!=="type"&&J!=="offset")delete q[J];Object.assign(q,{type:"block-scalar",indent:z,props:G,source:Q})}}function
|
|
115
|
-
`};delete q.items,Object.assign(q,{type:Z,source:$,end:[Q]});break}default:{let X="indent"in q?q.indent:-1,Q="end"in q&&Array.isArray(q.end)?q.end.filter((U)=>U.type==="space"||U.type==="comment"||U.type==="newline"):[];for(let U of Object.keys(q))if(U!=="type"&&U!=="offset")delete q[U];Object.assign(q,{type:Z,indent:X,source:$,end:Q})}}}
|
|
113
|
+
`;if(q.type==="block-scalar"){let U=q.props[0];if(U.type!=="block-scalar-header")throw Error("Invalid block scalar header");U.source=X,q.source=Q}else{let{offset:U}=q,z="indent"in q?q.indent:-1,G=[{type:"block-scalar-header",offset:U,indent:z,source:X}];if(!d9(G,"end"in q?q.end:void 0))G.push({type:"newline",offset:-1,indent:z,source:`
|
|
114
|
+
`});for(let J of Object.keys(q))if(J!=="type"&&J!=="offset")delete q[J];Object.assign(q,{type:"block-scalar",indent:z,props:G,source:Q})}}function d9(q,$){if($)for(let Z of $)switch(Z.type){case"space":case"comment":q.push(Z);break;case"newline":return q.push(Z),!0}return!1}function O2(q,$,Z){switch(q.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":q.type=Z,q.source=$;break;case"block-scalar":{let X=q.props.slice(1),Q=$.length;if(q.props[0].type==="block-scalar-header")Q-=q.props[0].source.length;for(let U of X)U.offset+=Q;delete q.props,Object.assign(q,{type:Z,source:$,end:X});break}case"block-map":case"block-seq":{let Q={type:"newline",offset:q.offset+$.length,indent:q.indent,source:`
|
|
115
|
+
`};delete q.items,Object.assign(q,{type:Z,source:$,end:[Q]});break}default:{let X="indent"in q?q.indent:-1,Q="end"in q&&Array.isArray(q.end)?q.end.filter((U)=>U.type==="space"||U.type==="comment"||U.type==="newline"):[];for(let U of Object.keys(q))if(U!=="type"&&U!=="offset")delete q[U];Object.assign(q,{type:Z,indent:X,source:$,end:Q})}}}tQ.createScalarToken=sQ;tQ.resolveAsScalar=iQ;tQ.setScalarValue=oQ});var l9=A((XU)=>{var ZU=(q)=>("type"in q)?eq(q):tq(q);function eq(q){switch(q.type){case"block-scalar":{let $="";for(let Z of q.props)$+=eq(Z);return $+q.source}case"block-map":case"block-seq":{let $="";for(let Z of q.items)$+=tq(Z);return $}case"flow-collection":{let $=q.start.source;for(let Z of q.items)$+=tq(Z);for(let Z of q.end)$+=Z.source;return $}case"document":{let $=tq(q);if(q.end)for(let Z of q.end)$+=Z.source;return $}default:{let $=q.source;if("end"in q&&q.end)for(let Z of q.end)$+=Z.source;return $}}}function tq({start:q,key:$,sep:Z,value:X}){let Q="";for(let U of q)Q+=U.source;if($)Q+=eq($);if(Z)for(let U of Z)Q+=U.source;if(X)Q+=eq(X);return Q}XU.stringify=ZU});var i9=A((zU)=>{var T2=Symbol("break visit"),UU=Symbol("skip children"),a9=Symbol("remove item");function T0(q,$){if("type"in q&&q.type==="document")q={start:q.start,value:q.value};n9(Object.freeze([]),q,$)}T0.BREAK=T2;T0.SKIP=UU;T0.REMOVE=a9;T0.itemAtPath=(q,$)=>{let Z=q;for(let[X,Q]of $){let U=Z?.[X];if(U&&"items"in U)Z=U.items[Q];else return}return Z};T0.parentCollection=(q,$)=>{let Z=T0.itemAtPath(q,$.slice(0,-1)),X=$[$.length-1][0],Q=Z?.[X];if(Q&&"items"in Q)return Q;throw Error("Parent collection not found")};function n9(q,$,Z){let X=Z($,q);if(typeof X==="symbol")return X;for(let Q of["key","value"]){let U=$[Q];if(U&&"items"in U){for(let z=0;z<U.items.length;++z){let G=n9(Object.freeze(q.concat([[Q,z]])),U.items[z],Z);if(typeof G==="number")z=G-1;else if(G===T2)return T2;else if(G===a9)U.items.splice(z,1),z-=1}if(typeof X==="function"&&Q==="key")X=X($,q)}}return typeof X==="function"?X($,q):X}zU.visit=T0});var q$=A((_U)=>{var F2=c9(),JU=l9(),YU=i9(),K2="\uFEFF",L2="\x02",R2="\x18",M2="\x1F",HU=(q)=>!!q&&("items"in q),VU=(q)=>!!q&&(q.type==="scalar"||q.type==="single-quoted-scalar"||q.type==="double-quoted-scalar"||q.type==="block-scalar");function WU(q){switch(q){case K2:return"<BOM>";case L2:return"<DOC>";case R2:return"<FLOW_END>";case M2:return"<SCALAR>";default:return JSON.stringify(q)}}function BU(q){switch(q){case K2:return"byte-order-mark";case L2:return"doc-mode";case R2:return"flow-error-end";case M2:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
116
116
|
`:case`\r
|
|
117
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(q[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
118
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
119
|
-
\r `),A2=(q)=>!q||
|
|
117
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(q[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}_U.createScalarToken=F2.createScalarToken;_U.resolveAsScalar=F2.resolveAsScalar;_U.setScalarValue=F2.setScalarValue;_U.stringify=JU.stringify;_U.visit=YU.visit;_U.BOM=K2;_U.DOCUMENT=L2;_U.FLOW_END=R2;_U.SCALAR=M2;_U.isCollection=HU;_U.isScalar=VU;_U.prettyToken=WU;_U.tokenType=BU});var I2=A((bU)=>{var Yq=q$();function n(q){switch(q){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case"\t":return!0;default:return!1}}var s9=new Set("0123456789ABCDEFabcdef"),PU=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),$$=new Set(",[]{}"),CU=new Set(` ,[]{}
|
|
119
|
+
\r `),A2=(q)=>!q||CU.has(q);class o9{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(q,$=!1){if(q){if(typeof q!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+q:q,this.lineEndPos=null}this.atEnd=!$;let Z=this.next??"stream";while(Z&&($||this.hasChars(1)))Z=yield*this.parseNext(Z)}atLineEnd(){let q=this.pos,$=this.buffer[q];while($===" "||$==="\t")$=this.buffer[++q];if(!$||$==="#"||$===`
|
|
120
120
|
`)return!0;if($==="\r")return this.buffer[q+1]===`
|
|
121
121
|
`;return!1}charAt(q){return this.buffer[this.pos+q]}continueScalar(q){let $=this.buffer[q];if(this.indentNext>0){let Z=0;while($===" ")$=this.buffer[++Z+q];if($==="\r"){let X=this.buffer[Z+q+1];if(X===`
|
|
122
122
|
`||!X&&!this.atEnd)return q+Z+1}return $===`
|
|
123
|
-
`||Z>=this.indentNext||!$&&!this.atEnd?q+Z:-1}if($==="-"||$==="."){let Z=this.buffer.substr(q,3);if((Z==="---"||Z==="...")&&
|
|
124
|
-
`,this.pos),this.lineEndPos=q;if(q===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[q-1]==="\r")q-=1;return this.buffer.substring(this.pos,q)}hasChars(q){return this.pos+q<=this.buffer.length}setNext(q){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=q,null}peek(q){return this.buffer.substr(this.pos,q)}*parseNext(q){switch(q){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let q=this.getLine();if(q===null)return this.setNext("stream");if(q[0]===
|
|
123
|
+
`||Z>=this.indentNext||!$&&!this.atEnd?q+Z:-1}if($==="-"||$==="."){let Z=this.buffer.substr(q,3);if((Z==="---"||Z==="...")&&n(this.buffer[q+3]))return-1}return q}getLine(){let q=this.lineEndPos;if(typeof q!=="number"||q!==-1&&q<this.pos)q=this.buffer.indexOf(`
|
|
124
|
+
`,this.pos),this.lineEndPos=q;if(q===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[q-1]==="\r")q-=1;return this.buffer.substring(this.pos,q)}hasChars(q){return this.pos+q<=this.buffer.length}setNext(q){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=q,null}peek(q){return this.buffer.substr(this.pos,q)}*parseNext(q){switch(q){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let q=this.getLine();if(q===null)return this.setNext("stream");if(q[0]===Yq.BOM)yield*this.pushCount(1),q=q.substring(1);if(q[0]==="%"){let $=q.length,Z=q.indexOf("#");while(Z!==-1){let Q=q[Z-1];if(Q===" "||Q==="\t"){$=Z-1;break}else Z=q.indexOf("#",Z+1)}while(!0){let Q=q[$-1];if(Q===" "||Q==="\t")$-=1;else break}let X=(yield*this.pushCount($))+(yield*this.pushSpaces(!0));return yield*this.pushCount(q.length-X),this.pushNewline(),"stream"}if(this.atLineEnd()){let $=yield*this.pushSpaces(!0);return yield*this.pushCount(q.length-$),yield*this.pushNewline(),"stream"}return yield Yq.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let q=this.charAt(0);if(!q&&!this.atEnd)return this.setNext("line-start");if(q==="-"||q==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let $=this.peek(3);if(($==="---"||$==="...")&&n(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,$==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!n(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[q,$]=this.peek(2);if(!$&&!this.atEnd)return this.setNext("block-start");if((q==="-"||q==="?"||q===":")&&n($)){let Z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=Z,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let q=this.getLine();if(q===null)return this.setNext("doc");let $=yield*this.pushIndicators();switch(q[$]){case"#":yield*this.pushCount(q.length-$);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(A2),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return $+=yield*this.parseBlockScalarHeader(),$+=yield*this.pushSpaces(!0),yield*this.pushCount(q.length-$),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let q,$,Z=-1;do{if(q=yield*this.pushNewline(),q>0)$=yield*this.pushSpaces(!1),this.indentValue=Z=$;else $=0;$+=yield*this.pushSpaces(!0)}while(q+$>0);let X=this.getLine();if(X===null)return this.setNext("flow");if(Z!==-1&&Z<this.indentNext&&X[0]!=="#"||Z===0&&(X.startsWith("---")||X.startsWith("..."))&&n(X[3])){if(!(Z===this.indentNext-1&&this.flowLevel===1&&(X[0]==="]"||X[0]==="}")))return this.flowLevel=0,yield Yq.FLOW_END,yield*this.parseLineStart()}let Q=0;while(X[Q]===",")Q+=yield*this.pushCount(1),Q+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(Q+=yield*this.pushIndicators(),X[Q]){case void 0:return"flow";case"#":return yield*this.pushCount(X.length-Q),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(A2),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let U=this.charAt(1);if(this.flowKey||n(U)||U===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let q=this.charAt(0),$=this.buffer.indexOf(q,this.pos+1);if(q==="'")while($!==-1&&this.buffer[$+1]==="'")$=this.buffer.indexOf("'",$+2);else while($!==-1){let Q=0;while(this.buffer[$-1-Q]==="\\")Q+=1;if(Q%2===0)break;$=this.buffer.indexOf('"',$+1)}let Z=this.buffer.substring(0,$),X=Z.indexOf(`
|
|
125
125
|
`,this.pos);if(X!==-1){while(X!==-1){let Q=this.continueScalar(X+1);if(Q===-1)break;X=Z.indexOf(`
|
|
126
|
-
`,Q)}if(X!==-1)$=X-(Z[X-1]==="\r"?2:1)}if($===-1){if(!this.atEnd)return this.setNext("quoted-scalar");$=this.buffer.length}return yield*this.pushToIndex($+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let q=this.pos;while(!0){let $=this.buffer[++q];if($==="+")this.blockScalarKeep=!0;else if($>"0"&&$<="9")this.blockScalarIndent=Number($)-1;else if($!=="-")break}return yield*this.pushUntil(($)=>
|
|
126
|
+
`,Q)}if(X!==-1)$=X-(Z[X-1]==="\r"?2:1)}if($===-1){if(!this.atEnd)return this.setNext("quoted-scalar");$=this.buffer.length}return yield*this.pushToIndex($+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let q=this.pos;while(!0){let $=this.buffer[++q];if($==="+")this.blockScalarKeep=!0;else if($>"0"&&$<="9")this.blockScalarIndent=Number($)-1;else if($!=="-")break}return yield*this.pushUntil(($)=>n($)||$==="#")}*parseBlockScalar(){let q=this.pos-1,$=0,Z;q:for(let Q=this.pos;Z=this.buffer[Q];++Q)switch(Z){case" ":$+=1;break;case`
|
|
127
127
|
`:q=Q,$=0;break;case"\r":{let U=this.buffer[Q+1];if(!U&&!this.atEnd)return this.setNext("block-scalar");if(U===`
|
|
128
128
|
`)break}default:break q}if(!Z&&!this.atEnd)return this.setNext("block-scalar");if($>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=$;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let Q=this.continueScalar(q+1);if(Q===-1)break;q=this.buffer.indexOf(`
|
|
129
129
|
`,Q)}while(q!==-1);if(q===-1){if(!this.atEnd)return this.setNext("block-scalar");q=this.buffer.length}}let X=q+1;Z=this.buffer[X];while(Z===" ")Z=this.buffer[++X];if(Z==="\t"){while(Z==="\t"||Z===" "||Z==="\r"||Z===`
|
|
130
130
|
`)Z=this.buffer[++X];q=X-1}else if(!this.blockScalarKeep)do{let Q=q-1,U=this.buffer[Q];if(U==="\r")U=this.buffer[--Q];let z=Q;while(U===" ")U=this.buffer[--Q];if(U===`
|
|
131
|
-
`&&Q>=this.pos&&Q+1+$>z)q=Q;else break}while(!0);return yield
|
|
131
|
+
`&&Q>=this.pos&&Q+1+$>z)q=Q;else break}while(!0);return yield Yq.SCALAR,yield*this.pushToIndex(q+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let q=this.flowLevel>0,$=this.pos-1,Z=this.pos-1,X;while(X=this.buffer[++Z])if(X===":"){let Q=this.buffer[Z+1];if(n(Q)||q&&$$.has(Q))break;$=Z}else if(n(X)){let Q=this.buffer[Z+1];if(X==="\r")if(Q===`
|
|
132
132
|
`)Z+=1,X=`
|
|
133
|
-
`,Q=this.buffer[Z+1];else $=Z;if(Q==="#"||q
|
|
134
|
-
`){let U=this.continueScalar(Z+1);if(U===-1)break;Z=Math.max(Z,U-2)}}else{if(q
|
|
133
|
+
`,Q=this.buffer[Z+1];else $=Z;if(Q==="#"||q&&$$.has(Q))break;if(X===`
|
|
134
|
+
`){let U=this.continueScalar(Z+1);if(U===-1)break;Z=Math.max(Z,U-2)}}else{if(q&&$$.has(X))break;$=Z}if(!X&&!this.atEnd)return this.setNext("plain-scalar");return yield Yq.SCALAR,yield*this.pushToIndex($+1,!0),q?"flow":"doc"}*pushCount(q){if(q>0)return yield this.buffer.substr(this.pos,q),this.pos+=q,q;return 0}*pushToIndex(q,$){let Z=this.buffer.slice(this.pos,q);if(Z)return yield Z,this.pos+=Z.length,Z.length;else if($)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(A2))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let q=this.flowLevel>0,$=this.charAt(1);if(n($)||q&&$$.has($)){if(!q)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let q=this.pos+2,$=this.buffer[q];while(!n($)&&$!==">")$=this.buffer[++q];return yield*this.pushToIndex($===">"?q+1:q,!1)}else{let q=this.pos+1,$=this.buffer[q];while($)if(PU.has($))$=this.buffer[++q];else if($==="%"&&s9.has(this.buffer[q+1])&&s9.has(this.buffer[q+2]))$=this.buffer[q+=3];else break;return yield*this.pushToIndex(q,!1)}}*pushNewline(){let q=this.buffer[this.pos];if(q===`
|
|
135
135
|
`)return yield*this.pushCount(1);else if(q==="\r"&&this.charAt(1)===`
|
|
136
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces(q){let $=this.pos-1,Z;do Z=this.buffer[++$];while(Z===" "||q&&Z==="\t");let X=$-this.pos;if(X>0)yield this.buffer.substr(this.pos,X),this.pos=$;return X}*pushUntil(q){let $=this.pos,Z=this.buffer[$];while(!q(Z))Z=this.buffer[++$];return yield*this.pushToIndex($,!1)}}
|
|
136
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces(q){let $=this.pos-1,Z;do Z=this.buffer[++$];while(Z===" "||q&&Z==="\t");let X=$-this.pos;if(X>0)yield this.buffer.substr(this.pos,X),this.pos=$;return X}*pushUntil(q){let $=this.pos,Z=this.buffer[$];while(!q(Z))Z=this.buffer[++$];return yield*this.pushToIndex($,!1)}}bU.Lexer=o9});var D2=A((EU)=>{class r9{constructor(){this.lineStarts=[],this.addNewLine=(q)=>this.lineStarts.push(q),this.linePos=(q)=>{let $=0,Z=this.lineStarts.length;while($<Z){let Q=$+Z>>1;if(this.lineStarts[Q]<q)$=Q+1;else Z=Q}if(this.lineStarts[$]===q)return{line:$+1,col:1};if($===0)return{line:0,col:q};let X=this.lineStarts[$-1];return{line:$,col:q-X+1}}}}EU.LineCounter=r9});var w2=A((hU)=>{var yU=k("process"),t9=q$(),xU=I2();function J0(q,$){for(let Z=0;Z<q.length;++Z)if(q[Z].type===$)return!0;return!1}function e9(q){for(let $=0;$<q.length;++$)switch(q[$].type){case"space":case"comment":case"newline":break;default:return $}return-1}function $4(q){switch(q?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Z$(q){switch(q.type){case"document":return q.start;case"block-map":{let $=q.items[q.items.length-1];return $.sep??$.start}case"block-seq":return q.items[q.items.length-1].start;default:return[]}}function E0(q){if(q.length===0)return[];let $=q.length;q:while(--$>=0)switch(q[$].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break q}while(q[++$]?.type==="space");return q.splice($,q.length)}function q4(q){if(q.start.type==="flow-seq-start"){for(let $ of q.items)if($.sep&&!$.value&&!J0($.start,"explicit-key-ind")&&!J0($.sep,"map-value-ind")){if($.key)$.value=$.key;if(delete $.key,$4($.value))if($.value.end)Array.prototype.push.apply($.value.end,$.sep);else $.value.end=$.sep;else Array.prototype.push.apply($.start,$.sep);delete $.sep}}}class Z4{constructor(q){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new xU.Lexer,this.onNewLine=q}*parse(q,$=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let Z of this.lexer.lex(q,$))yield*this.next(Z);if(!$)yield*this.end()}*next(q){if(this.source=q,yU.env.LOG_TOKENS)console.log("|",t9.prettyToken(q));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=q.length;return}let $=t9.tokenType(q);if(!$){let Z=`Not a YAML token: ${q}`;yield*this.pop({type:"error",offset:this.offset,message:Z,source:q}),this.offset+=q.length}else if($==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=$,yield*this.step(),$){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+q.length);break;case"space":if(this.atNewLine&&q[0]===" ")this.indent+=q.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=q.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=q.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let q=this.peek(1);if(this.type==="doc-end"&&q?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!q)return yield*this.stream();switch(q.type){case"document":return yield*this.document(q);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(q);case"block-scalar":return yield*this.blockScalar(q);case"block-map":return yield*this.blockMap(q);case"block-seq":return yield*this.blockSequence(q);case"flow-collection":return yield*this.flowCollection(q);case"doc-end":return yield*this.documentEnd(q)}yield*this.pop()}peek(q){return this.stack[this.stack.length-q]}*pop(q){let $=q??this.stack.pop();if(!$)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield $;else{let Z=this.peek(1);if($.type==="block-scalar")$.indent="indent"in Z?Z.indent:0;else if($.type==="flow-collection"&&Z.type==="document")$.indent=0;if($.type==="flow-collection")q4($);switch(Z.type){case"document":Z.value=$;break;case"block-scalar":Z.props.push($);break;case"block-map":{let X=Z.items[Z.items.length-1];if(X.value){Z.items.push({start:[],key:$,sep:[]}),this.onKeyLine=!0;return}else if(X.sep)X.value=$;else{Object.assign(X,{key:$,sep:[]}),this.onKeyLine=!X.explicitKey;return}break}case"block-seq":{let X=Z.items[Z.items.length-1];if(X.value)Z.items.push({start:[],value:$});else X.value=$;break}case"flow-collection":{let X=Z.items[Z.items.length-1];if(!X||X.value)Z.items.push({start:[],key:$,sep:[]});else if(X.sep)X.value=$;else Object.assign(X,{key:$,sep:[]});return}default:yield*this.pop(),yield*this.pop($)}if((Z.type==="document"||Z.type==="block-map"||Z.type==="block-seq")&&($.type==="block-map"||$.type==="block-seq")){let X=$.items[$.items.length-1];if(X&&!X.sep&&!X.value&&X.start.length>0&&e9(X.start)===-1&&($.indent===0||X.start.every((Q)=>Q.type!=="comment"||Q.indent<$.indent))){if(Z.type==="document")Z.end=X.start;else Z.items.push({start:X.start});$.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let q={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")q.start.push(this.sourceToken);this.stack.push(q);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(q){if(q.value)return yield*this.lineEnd(q);switch(this.type){case"doc-start":{if(e9(q.start)!==-1)yield*this.pop(),yield*this.step();else q.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":q.start.push(this.sourceToken);return}let $=this.startBlockValue(q);if($)this.stack.push($);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(q){if(this.type==="map-value-ind"){let $=Z$(this.peek(2)),Z=E0($),X;if(q.end)X=q.end,X.push(this.sourceToken),delete q.end;else X=[this.sourceToken];let Q={type:"block-map",offset:q.offset,indent:q.indent,items:[{start:Z,key:q,sep:X}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Q}else yield*this.lineEnd(q)}*blockScalar(q){switch(this.type){case"space":case"comment":case"newline":q.props.push(this.sourceToken);return;case"scalar":if(q.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let $=this.source.indexOf(`
|
|
137
137
|
`)+1;while($!==0)this.onNewLine(this.offset+$),$=this.source.indexOf(`
|
|
138
|
-
`,$)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(q){let $=q.items[q.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,$.value){let Z="end"in $.value?$.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else q.items.push({start:[this.sourceToken]})}else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"space":case"comment":if($.value)q.items.push({start:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else{if(this.atIndentedComment($.start,q.indent)){let X=q.items[q.items.length-2]?.value?.end;if(Array.isArray(X)){Array.prototype.push.apply(X,$.start),X.push(this.sourceToken),q.items.pop();return}}$.start.push(this.sourceToken)}return}if(this.indent>=q.indent){let Z=!this.onKeyLine&&this.indent===q.indent,X=Z&&($.sep||$.explicitKey)&&this.type!=="seq-item-ind",Q=[];if(X&&$.sep&&!$.value){let U=[];for(let z=0;z<$.sep.length;++z){let G=$.sep[z];switch(G.type){case"newline":U.push(z);break;case"space":break;case"comment":if(G.indent>q.indent)U.length=0;break;default:U.length=0}}if(U.length>=2)Q=$.sep.splice(U[1])}switch(this.type){case"anchor":case"tag":if(X||$.value)Q.push(this.sourceToken),q.items.push({start:Q}),this.onKeyLine=!0;else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"explicit-key-ind":if(!$.sep&&!$.explicitKey)$.start.push(this.sourceToken),$.explicitKey=!0;else if(X||$.value)Q.push(this.sourceToken),q.items.push({start:Q,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if($.explicitKey)if(!$.sep)if(J0($.start,"newline"))Object.assign($,{key:null,sep:[this.sourceToken]});else{let U=
|
|
138
|
+
`,$)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(q){let $=q.items[q.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,$.value){let Z="end"in $.value?$.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else q.items.push({start:[this.sourceToken]})}else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"space":case"comment":if($.value)q.items.push({start:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else{if(this.atIndentedComment($.start,q.indent)){let X=q.items[q.items.length-2]?.value?.end;if(Array.isArray(X)){Array.prototype.push.apply(X,$.start),X.push(this.sourceToken),q.items.pop();return}}$.start.push(this.sourceToken)}return}if(this.indent>=q.indent){let Z=!this.onKeyLine&&this.indent===q.indent,X=Z&&($.sep||$.explicitKey)&&this.type!=="seq-item-ind",Q=[];if(X&&$.sep&&!$.value){let U=[];for(let z=0;z<$.sep.length;++z){let G=$.sep[z];switch(G.type){case"newline":U.push(z);break;case"space":break;case"comment":if(G.indent>q.indent)U.length=0;break;default:U.length=0}}if(U.length>=2)Q=$.sep.splice(U[1])}switch(this.type){case"anchor":case"tag":if(X||$.value)Q.push(this.sourceToken),q.items.push({start:Q}),this.onKeyLine=!0;else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"explicit-key-ind":if(!$.sep&&!$.explicitKey)$.start.push(this.sourceToken),$.explicitKey=!0;else if(X||$.value)Q.push(this.sourceToken),q.items.push({start:Q,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if($.explicitKey)if(!$.sep)if(J0($.start,"newline"))Object.assign($,{key:null,sep:[this.sourceToken]});else{let U=E0($.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:U,key:null,sep:[this.sourceToken]}]})}else if($.value)q.items.push({start:[],key:null,sep:[this.sourceToken]});else if(J0($.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]});else if($4($.key)&&!J0($.sep,"newline")){let U=E0($.start),z=$.key,G=$.sep;G.push(this.sourceToken),delete $.key,delete $.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:U,key:z,sep:G}]})}else if(Q.length>0)$.sep=$.sep.concat(Q,this.sourceToken);else $.sep.push(this.sourceToken);else if(!$.sep)Object.assign($,{key:null,sep:[this.sourceToken]});else if($.value||X)q.items.push({start:Q,key:null,sep:[this.sourceToken]});else if(J0($.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else $.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let U=this.flowScalar(this.type);if(X||$.value)q.items.push({start:Q,key:U,sep:[]}),this.onKeyLine=!0;else if($.sep)this.stack.push(U);else Object.assign($,{key:U,sep:[]}),this.onKeyLine=!0;return}default:{let U=this.startBlockValue(q);if(U){if(U.type==="block-seq"){if(!$.explicitKey&&$.sep&&!J0($.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(Z)q.items.push({start:Q});this.stack.push(U);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(q){let $=q.items[q.items.length-1];switch(this.type){case"newline":if($.value){let Z="end"in $.value?$.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else q.items.push({start:[this.sourceToken]})}else $.start.push(this.sourceToken);return;case"space":case"comment":if($.value)q.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment($.start,q.indent)){let X=q.items[q.items.length-2]?.value?.end;if(Array.isArray(X)){Array.prototype.push.apply(X,$.start),X.push(this.sourceToken),q.items.pop();return}}$.start.push(this.sourceToken)}return;case"anchor":case"tag":if($.value||this.indent<=q.indent)break;$.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==q.indent)break;if($.value||J0($.start,"seq-item-ind"))q.items.push({start:[this.sourceToken]});else $.start.push(this.sourceToken);return}if(this.indent>q.indent){let Z=this.startBlockValue(q);if(Z){this.stack.push(Z);return}}yield*this.pop(),yield*this.step()}*flowCollection(q){let $=q.items[q.items.length-1];if(this.type==="flow-error-end"){let Z;do yield*this.pop(),Z=this.peek(1);while(Z?.type==="flow-collection")}else if(q.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!$||$.sep)q.items.push({start:[this.sourceToken]});else $.start.push(this.sourceToken);return;case"map-value-ind":if(!$||$.value)q.items.push({start:[],key:null,sep:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else Object.assign($,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!$||$.value)q.items.push({start:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let X=this.flowScalar(this.type);if(!$||$.value)q.items.push({start:[],key:X,sep:[]});else if($.sep)this.stack.push(X);else Object.assign($,{key:X,sep:[]});return}case"flow-map-end":case"flow-seq-end":q.end.push(this.sourceToken);return}let Z=this.startBlockValue(q);if(Z)this.stack.push(Z);else yield*this.pop(),yield*this.step()}else{let Z=this.peek(2);if(Z.type==="block-map"&&(this.type==="map-value-ind"&&Z.indent===q.indent||this.type==="newline"&&!Z.items[Z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&Z.type!=="flow-collection"){let X=Z$(Z),Q=E0(X);q4(q);let U=q.end.splice(1,q.end.length);U.push(this.sourceToken);let z={type:"block-map",offset:q.offset,indent:q.indent,items:[{start:Q,key:q,sep:U}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=z}else yield*this.lineEnd(q)}}flowScalar(q){if(this.onNewLine){let $=this.source.indexOf(`
|
|
139
139
|
`)+1;while($!==0)this.onNewLine(this.offset+$),$=this.source.indexOf(`
|
|
140
|
-
`,$)+1}return{type:q,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(q){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let
|
|
141
|
-
`).length})}catch{}}}catch{continue}}}return await Z(q,""),$}class
|
|
140
|
+
`,$)+1}return{type:q,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(q){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let $=Z$(q),Z=E0($);return Z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let $=Z$(q),Z=E0($);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(q,$){if(this.type!=="comment")return!1;if(this.indent<=$)return!1;return q.every((Z)=>Z.type==="newline"||Z.type==="space")}*documentEnd(q){if(this.type!=="doc-mode"){if(q.end)q.end.push(this.sourceToken);else q.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(q){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(q.end)q.end.push(this.sourceToken);else q.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}hU.Parser=Z4});var G4=A((lU)=>{var X4=_2(),kU=Qq(),Hq=Uq(),vU=D$(),uU=y(),mU=D2(),Q4=w2();function U4(q){let $=q.prettyErrors!==!1;return{lineCounter:q.lineCounter||$&&new mU.LineCounter||null,prettyErrors:$}}function pU(q,$={}){let{lineCounter:Z,prettyErrors:X}=U4($),Q=new Q4.Parser(Z?.addNewLine),U=new X4.Composer($),z=Array.from(U.compose(Q.parse(q)));if(X&&Z)for(let G of z)G.errors.forEach(Hq.prettifyError(q,Z)),G.warnings.forEach(Hq.prettifyError(q,Z));if(z.length>0)return z;return Object.assign([],{empty:!0},U.streamInfo())}function z4(q,$={}){let{lineCounter:Z,prettyErrors:X}=U4($),Q=new Q4.Parser(Z?.addNewLine),U=new X4.Composer($),z=null;for(let G of U.compose(Q.parse(q),!0,q.length))if(!z)z=G;else if(z.options.logLevel!=="silent"){z.errors.push(new Hq.YAMLParseError(G.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(X&&Z)z.errors.forEach(Hq.prettifyError(q,Z)),z.warnings.forEach(Hq.prettifyError(q,Z));return z}function dU(q,$,Z){let X=void 0;if(typeof $==="function")X=$;else if(Z===void 0&&$&&typeof $==="object")Z=$;let Q=z4(q,Z);if(!Q)return null;if(Q.warnings.forEach((U)=>vU.warn(Q.options.logLevel,U)),Q.errors.length>0)if(Q.options.logLevel!=="silent")throw Q.errors[0];else Q.errors=[];return Q.toJS(Object.assign({reviver:X},Z))}function cU(q,$,Z){let X=null;if(typeof $==="function"||Array.isArray($))X=$;else if(Z===void 0&&$)Z=$;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let Q=Math.round(Z);Z=Q<1?void 0:Q>8?{indent:8}:{indent:Q}}if(q===void 0){let{keepUndefined:Q}=Z??$??{};if(!Q)return}if(uU.isDocument(q)&&!X)return q.toString(Z);return new kU.Document(q,X,Z).toString(Z)}lU.parse=dU;lU.parseAllDocuments=pU;lU.parseDocument=z4;lU.stringify=cU});import{execFile as R5}from"child_process";import{promisify as M5}from"util";import{mkdtemp as m2,readdir as A5,readFile as B$,rm as _q,cp as I5,access as p2,stat as D5,lstat as w5,symlink as N5,mkdir as j5}from"fs/promises";import{join as r,resolve as d2,relative as P5,basename as C5}from"path";import{homedir as c2}from"os";import{tmpdir as l2}from"os";import{readdir as B5,readFile as _5,stat as O5}from"fs/promises";import{join as T5}from"path";var F5=new Set([".png",".jpg",".jpeg",".gif",".ico",".bmp",".webp",".mp3",".mp4",".wav",".avi",".mov",".zip",".tar",".gz",".bz2",".7z",".exe",".dll",".so",".dylib",".woff",".woff2",".ttf",".eot",".pdf",".doc",".docx"]),K5=524288;async function Wq(q){let $=[];async function Z(X,Q){let U;try{U=await B5(X)}catch{return}for(let z of U){if(z===".git"||z==="node_modules")continue;let G=T5(X,z),J=Q?`${Q}/${z}`:z;try{let Y=await O5(G);if(Y.isDirectory())await Z(G,J);else if(Y.isFile()){let B=z.includes(".")?`.${z.split(".").pop().toLowerCase()}`:"";if(F5.has(B))continue;if(Y.size>K5)continue;try{let V=await _5(G,"utf-8");$.push({relPath:J,content:V,lineCount:V.split(`
|
|
141
|
+
`).length})}catch{}}}catch{continue}}}return await Z(q,""),$}class u2{selected;cursor;scrollOffset;pageSize;itemCount;filter;searchActive;filteredMap;constructor(q,$){this.selected=q.map((Z)=>Z.checked),this.cursor=1,this.scrollOffset=0,this.pageSize=$,this.itemCount=q.length,this.filter="",this.searchActive=!1,this.filteredMap=q.map((Z,X)=>X)}get totalRows(){return this.filteredMap.length+1}applyFilter(q){if(this.filter==="")this.filteredMap=q.map(($,Z)=>Z);else{let $=this.filter.toLowerCase();this.filteredMap=[];for(let Z=0;Z<q.length;Z++)if((q[Z].label.toLowerCase()+" "+(q[Z].hint?.toLowerCase()??"")).includes($))this.filteredMap.push(Z)}if(this.cursor>=this.totalRows)this.cursor=Math.max(0,this.totalRows-1);if(this.scrollOffset>0&&this.scrollOffset>=this.totalRows)this.scrollOffset=Math.max(0,this.totalRows-this.pageSize)}cursorToOriginalIndex(){if(this.cursor===0)return-1;return this.filteredMap[this.cursor-1]??-1}toggleCurrent(){if(this.cursor===0)this.toggleAll();else{let q=this.cursorToOriginalIndex();if(q>=0)this.selected[q]=!this.selected[q]}}toggleAll(){let q=this.filteredMap,Z=!q.every((X)=>this.selected[X]);for(let X of q)this.selected[X]=Z}moveUp(){if(this.cursor>0)this.cursor--;else this.cursor=this.totalRows-1;this.adjustScroll()}moveDown(){if(this.cursor<this.totalRows-1)this.cursor++;else this.cursor=0;this.adjustScroll()}getSelectedIndices(){let q=[];for(let $=0;$<this.selected.length;$++)if(this.selected[$])q.push($);return q}getVisibleRange(){let q=this.scrollOffset,$=Math.min(this.scrollOffset+this.pageSize,this.totalRows);return{start:q,end:$}}adjustScroll(){if(this.cursor<this.scrollOffset)this.scrollOffset=this.cursor;else if(this.cursor>=this.scrollOffset+this.pageSize)this.scrollOffset=this.cursor-this.pageSize+1}}function L5(q,$,Z){let X=[];if(q.searchActive||q.filter!==""){let Y=H.cyan("/"),B=q.filter,V=q.searchActive?H.cyan("█"):"";if(X.push(` ${Y}${B}${V}`),q.filteredMap.length===0)X.push(H.dim(" No matches found"));X.push("")}let{start:Q,end:U}=q.getVisibleRange();if(Q>0)X.push(H.dim(` ... ${Q} more above`));for(let Y=Q;Y<U;Y++){let V=Y===q.cursor?H.cyan(">"):" ";if(Y===0){let W=q.filteredMap,F=W.length>0&&W.every((T)=>q.selected[T])?H.green("[*]"):"[ ]",_=q.filter!==""?`Select All Matching (${q.filteredMap.length})`:"Select All / Deselect All";X.push(`${V} ${F} ${H.bold(_)}`)}else{let W=q.filteredMap[Y-1],O=$[W],_=q.selected[W]?H.green("[*]"):"[ ]",T=`${V} ${_} `,L=7,M=H.bold(O.label),R=O.label.length;if(O.hint){let D=Z-7-R-2;if(D>10){let w=V$(O.hint,D);X.push(`${T}${M} ${H.dim(w)}`)}else{let w=V$(O.label,Z-7);X.push(`${T}${H.bold(w)}`)}}else{let D=V$(O.label,Z-7);X.push(`${T}${H.bold(D)}`)}}}let z=q.totalRows-U;if(z>0)X.push(H.dim(` ... ${z} more below`));let G=q.getSelectedIndices().length,J=q.filter!==""?` matching: ${q.filteredMap.length}/${q.itemCount}`:"";if(X.push(""),q.searchActive)X.push(H.dim(` ${G} of ${q.itemCount} selected${J} | Type to filter Esc Clear Enter Done searching`));else X.push(H.dim(` ${G} of ${q.itemCount} selected${J} | `+"↑/↓ Navigate Space Toggle a All / Search Enter Confirm Esc Cancel"));return X}function V$(q,$){if($<=0)return"";if(q.length<=$)return q;if($<=3)return q.slice(0,$);return q.slice(0,$-3)+"..."}async function y0(q){let{items:$}=q,Z=q.pageSize??Math.min($.length+1,15),X=new u2($,Z),Q=process.stderr,U=process.stdin,z=Q.columns||80;if(typeof U.setRawMode==="function")U.setRawMode(!0);U.resume(),U.setEncoding("utf-8"),Q.write("\x1B[?25l");let G=0;function J(){let Y=L5(X,$,z);if(G>0)Q.write(`\x1B[${G}F`);let B=Math.max(Y.length,G),V="";for(let W=0;W<B;W++)V+=`\x1B[2K${W<Y.length?Y[W]:""}
|
|
142
142
|
`;Q.write(V),G=B}return J(),new Promise((Y)=>{let B="",V=null;function W(){if(U.removeListener("data",_),typeof U.setRawMode==="function")U.setRawMode(!1);if(U.pause(),Q.write("\x1B[?25h"),V)clearTimeout(V)}function O(T){W(),Y(T)}function F(T){if(X.searchActive){if(T==="\x1B"){X.searchActive=!1,X.filter="",X.applyFilter($),J();return}if(T==="\r"||T===`
|
|
143
143
|
`){X.searchActive=!1,J();return}if(T===""||T==="\b"){if(X.filter.length>0)X.filter=X.filter.slice(0,-1),X.applyFilter($);else X.searchActive=!1;J();return}if(T==="\x03"){W(),process.kill(process.pid,"SIGINT");return}if(T==="\x1B[A"){X.moveUp(),J();return}if(T==="\x1B[B"){X.moveDown(),J();return}if(T===" "){X.toggleCurrent(),J();return}if(T.length===1&&T>=" "&&T<="~"){X.filter+=T,X.applyFilter($),J();return}return}switch(T){case"\x1B[A":case"k":X.moveUp(),J();break;case"\x1B[B":case"j":X.moveDown(),J();break;case" ":X.toggleCurrent(),J();break;case"a":X.toggleAll(),J();break;case"/":X.searchActive=!0,J();break;case"\r":case`
|
|
144
|
-
`:O(X.getSelectedIndices());break;case"\x1B":if(X.filter!=="")X.filter="",X.applyFilter($),J();else O([]);break;case"":case"\b":if(X.filter.length>0)X.filter=X.filter.slice(0,-1),X.applyFilter($),J();break;case"\x03":W(),process.kill(process.pid,"SIGINT");break}}function _(T){if(B.length>0){if(B+=T,V)clearTimeout(V);if(B.length>=3&&B[1]==="["){let M=B.slice(0,3),R=B.slice(3);if(B="",F(M),R)_(R);return}let
|
|
144
|
+
`:O(X.getSelectedIndices());break;case"\x1B":if(X.filter!=="")X.filter="",X.applyFilter($),J();else O([]);break;case"":case"\b":if(X.filter.length>0)X.filter=X.filter.slice(0,-1),X.applyFilter($),J();break;case"\x03":W(),process.kill(process.pid,"SIGINT");break}}function _(T){if(B.length>0){if(B+=T,V)clearTimeout(V);if(B.length>=3&&B[1]==="["){let M=B.slice(0,3),R=B.slice(3);if(B="",F(M),R)_(R);return}let L=B;B="",F("\x1B");for(let M=1;M<L.length;M++)F(L[M]);return}for(let L=0;L<T.length;L++){let M=T[L];if(M==="\x1B"){let R=T.slice(L);if(R.length>=3&&R[1]==="[")F(R.slice(0,3)),L+=2;else if(R.length>=2){B=R,V=setTimeout(()=>{let D=B;B="",F("\x1B");for(let w=1;w<D.length;w++)F(D[w])},50);return}else{B="\x1B",V=setTimeout(()=>{B="",F("\x1B")},50);return}}else F(M)}}U.on("data",_)})}var h0=M5(R5),b5=/^[a-zA-Z0-9_-]+$/,S5=/^[a-zA-Z0-9._-]+$/,E5=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,a2=128,f5=/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\/tree\/(.+))?\/?$/;function y5(q){return q.startsWith("/")||q.startsWith("./")||q.startsWith("../")||q.startsWith("~/")||q==="~"||q==="."||q===".."}function x5(q){let $;if(q==="~")$=c2();else if(q.startsWith("~/"))$=d2(c2(),q.slice(2));else $=d2(q);let Z=C5($);return S(`install: parsed local source -> path=${$}`),{owner:"local",repo:Z,ref:null,subpath:null,cloneUrl:"",sshCloneUrl:"",isLocal:!0,localPath:$}}function g0(q){if(y5(q))return x5(q);let $=f5.exec(q);if($){let[,V,W,O]=$,F=W.endsWith(".git")?W.slice(0,-4):W;q=`github:${V}/${F}${O?`#${O}`:""}`}if(!q.startsWith("github:"))throw Error(`Invalid source format. Got: "${q}"
|
|
145
145
|
Supported formats:
|
|
146
146
|
github:owner/repo[#ref]
|
|
147
147
|
github:owner/repo#ref:path
|
|
148
148
|
https://github.com/owner/repo
|
|
149
149
|
https://github.com/owner/repo/tree/branch/path/to/skill
|
|
150
150
|
/path/to/local/skill
|
|
151
|
-
./relative/path/to/skill`);let Z=q.slice(7),X=Z.indexOf("#"),Q,U=null,z=null;if(X!==-1){Q=Z.slice(0,X);let V=Z.slice(X+1);if(!V)throw Error("Invalid source: ref cannot be empty after #");let W=V.indexOf(":");if(W!==-1){if(U=V.slice(0,W),!U)throw Error("Invalid source: ref cannot be empty before :");z=V.slice(W+1)||null}else U=V}else{let V=Z.indexOf(":");if(V!==-1)Q=Z.slice(0,V),z=Z.slice(V+1)||null;else Q=Z}let G=Q.indexOf("/");if(G===-1)throw Error(`Invalid source: format must be github:owner/repo. Got: "${q}"`);let J=Q.slice(0,G),Y=Q.slice(G+1);if(!J)throw Error("Invalid source: owner cannot be empty");if(!Y)throw Error("Invalid source: repo cannot be empty");if(!
|
|
152
|
-
`)){let U=Q.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(U)Z.add(U[1])}let X=q.ref.split("/");for(let Q=1;Q<X.length;Q++){let U=X.slice(0,Q).join("/");if(Z.has(U)){let z=X.slice(Q).join("/");return
|
|
153
|
-
HTTPS: ${
|
|
154
|
-
SSH: ${
|
|
155
|
-
`);for(let z=0;z<U.length;z++)for(let{category:G,pattern:J}of
|
|
156
|
-
`),Z=!1,X=!1;for(let Q of $){if(Q.trim()==="---")if(!Z){Z=!0;continue}else{X=!0;continue}if(X&&Q.trim().length>0)return!0}return!1}function
|
|
151
|
+
./relative/path/to/skill`);let Z=q.slice(7),X=Z.indexOf("#"),Q,U=null,z=null;if(X!==-1){Q=Z.slice(0,X);let V=Z.slice(X+1);if(!V)throw Error("Invalid source: ref cannot be empty after #");let W=V.indexOf(":");if(W!==-1){if(U=V.slice(0,W),!U)throw Error("Invalid source: ref cannot be empty before :");z=V.slice(W+1)||null}else U=V}else{let V=Z.indexOf(":");if(V!==-1)Q=Z.slice(0,V),z=Z.slice(V+1)||null;else Q=Z}let G=Q.indexOf("/");if(G===-1)throw Error(`Invalid source: format must be github:owner/repo. Got: "${q}"`);let J=Q.slice(0,G),Y=Q.slice(G+1);if(!J)throw Error("Invalid source: owner cannot be empty");if(!Y)throw Error("Invalid source: repo cannot be empty");if(!b5.test(J))throw Error(`Invalid source: owner contains invalid characters: "${J}". Allowed: [a-zA-Z0-9_-]`);if(!S5.test(Y))throw Error(`Invalid source: repo contains invalid characters: "${Y}". Allowed: [a-zA-Z0-9._-]`);let B={owner:J,repo:Y,ref:U,subpath:z,cloneUrl:`https://github.com/${J}/${Y}.git`,sshCloneUrl:`git@github.com:${J}/${Y}.git`};return S(`install: parsed source -> owner=${J} repo=${Y} ref=${U} subpath=${z}`),B}async function _$(q){if(q.subpath!==null||!q.ref||!q.ref.includes("/"))return q;try{let{stdout:$}=await h0("git",["ls-remote","--heads","--tags",q.cloneUrl],{timeout:15000}),Z=new Set;for(let Q of $.split(`
|
|
152
|
+
`)){let U=Q.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(U)Z.add(U[1])}let X=q.ref.split("/");for(let Q=1;Q<X.length;Q++){let U=X.slice(0,Q).join("/");if(Z.has(U)){let z=X.slice(Q).join("/");return S(`install: resolved ref="${U}" subpath="${z}"`),{...q,ref:U,subpath:z||null}}}}catch($){S(`install: ls-remote failed, treating entire ref as branch: ${$}`)}return q}function k0(q){if(!q)throw Error("Invalid skill name: name cannot be empty");if(q.includes("\x00"))throw Error("Invalid skill name: contains unsafe characters (null byte)");if(q.includes(".."))throw Error("Invalid skill name: contains unsafe characters (..)");if(q.includes("/")||q.includes("\\"))throw Error("Invalid skill name: contains unsafe characters (path separator)");if(q.startsWith("."))throw Error("Invalid skill name: must not start with a dot");if(q.length>a2)throw Error(`Invalid skill name: exceeds maximum length of ${a2} characters`);if(!E5.test(q))throw Error(`Invalid skill name: "${q}" does not match allowed pattern [a-zA-Z0-9][a-zA-Z0-9._-]*`);return q}function h5(q){let $=q.split("/").filter(Boolean),Z=$.length>0?$[$.length-1]:q;return k0(Z)}function i2(q){let $=new Map;for(let Z of q){let X=h5(Z),Q=$.get(X);if(Q)Q.push(Z);else $.set(X,[Z])}return[...$.entries()].filter(([,Z])=>Z.length>1).map(([Z,X])=>({name:Z,paths:X}))}async function v0(){try{await h0("git",["--version"]),S("install: git available")}catch{throw Error("git is required for installing skills. Install git from https://git-scm.com")}}function g5(q){if(q.killed)return!1;let $=(q.stderr||q.message||"").toLowerCase();return $.includes("authentication failed")||$.includes("could not read username")||$.includes("repository not found")||$.includes("returned error: 403")||$.includes("returned error: 401")||$.includes("terminal prompts disabled")||$.includes("permission denied")}function Bq(q){return q.killed?"Clone timed out after 60 seconds":`Clone failed: ${q.stderr||q.message}`}async function W$(q,$,Z){let X=["clone","--depth","1"];if($)X.push("--branch",$);return X.push(q,Z),await h0("git",X,{timeout:60000}),Z}async function u0(q,$="auto"){S(`install: cloning ${q.owner}/${q.repo}${q.ref?` (ref: ${q.ref})`:""} (transport: ${$})`);let Z=await m2(r(l2(),"asm-install-"));if($==="ssh"||$==="https"){let X=$==="ssh"?q.sshCloneUrl:q.cloneUrl;try{return await W$(X,q.ref,Z)}catch(Q){throw await i(Z),Error(Bq(Q))}}try{return await W$(q.cloneUrl,q.ref,Z)}catch(X){if(!g5(X))throw await i(Z),Error(Bq(X));S("install: HTTPS clone failed with auth error, retrying with SSH..."),await i(Z);let Q=await m2(r(l2(),"asm-install-"));try{return await W$(q.sshCloneUrl,q.ref,Q)}catch(U){throw await i(Q),Error(`Clone failed with both transports:
|
|
153
|
+
HTTPS: ${Bq(X)}
|
|
154
|
+
SSH: ${Bq(U)}`)}}}async function M0(q){let $=r(q,"SKILL.md"),Z;try{Z=await B$($,"utf-8")}catch{throw Error("Not a valid skill: SKILL.md not found in repository root")}let X=L0(Z),Q=q.split("/").pop()||"unknown",U=X.name||Q,z=R0(X);return S(`install: validated skill "${U}" v${z}`),{name:U,version:z,description:(X.description||"").replace(/\s*\n\s*/g," ").trim(),effort:X.effort||X["metadata.effort"]||void 0}}async function Oq(q,$=3){let Z=[];async function X(Q,U,z){let G;try{G=await A5(Q)}catch{return}for(let J of G){if(J===".git"||J==="node_modules")continue;let Y=r(Q,J);try{if(!(await D5(Y)).isDirectory())continue}catch{continue}let B=U?`${U}/${J}`:J,V=z+1,W=r(Y,"SKILL.md");try{let O=await B$(W,"utf-8"),F=L0(O);Z.push({relPath:B,name:F.name||J,version:R0(F),description:(F.description||"").replace(/\s*\n\s*/g," ").trim(),effort:F.effort||F["metadata.effort"]||void 0,license:(F.license||"").trim(),creator:(F["metadata.creator"]||"").trim(),compatibility:(F.compatibility||"").trim(),allowedTools:n2(F)})}catch{if(V<$)await X(Y,B,V)}}}return await X(q,"",0),Z.sort((Q,U)=>Q.name.localeCompare(U.name)),Z}var k5=[{category:"Shell commands",pattern:/\b(bash|sh\s+-c)\b/},{category:"Shell commands",pattern:/\bexec\(/},{category:"Shell commands",pattern:/\bchild_process\b/},{category:"Shell commands",pattern:/\bBun\.spawn\b/},{category:"Code execution",pattern:/\beval\(/},{category:"Code execution",pattern:/\bFunction\(/},{category:"Code execution",pattern:/\bnew\s+Function\b/},{category:"Credentials",pattern:/\b(API_KEY|SECRET|TOKEN|PASSWORD)\s*[=:]/},{category:"External URLs",pattern:/https?:\/\//}];async function s2(q){let $=[],Z=await Wq(q);for(let{relPath:X,content:Q}of Z){let U=Q.split(`
|
|
155
|
+
`);for(let z=0;z<U.length;z++)for(let{category:G,pattern:J}of k5)if(J.test(U[z])){let Y=U[z].trim();$.push({category:G,file:X,line:z+1,match:Y.length>100?Y.slice(0,100)+"…":Y})}}return $}async function O$(q){let $=q.source.isLocal?`local:${q.source.localPath}`:`github:${q.source.owner}/${q.source.repo}${q.source.ref?`#${q.source.ref}`:""}${q.source.subpath?`:${q.source.subpath}`:""}`;if(q.force)try{await p2(q.targetDir),await _q(q.targetDir,{recursive:!0,force:!0})}catch{}let Z=q.sourceDir;try{await I5(Z,q.targetDir,{recursive:!0})}catch(G){throw Error(`Failed to install: ${G.message}`)}let X=r(q.targetDir,".git");try{await _q(X,{recursive:!0,force:!0})}catch{}S(`install: copied files to ${q.targetDir}`);let Q=r(q.targetDir,"SKILL.md");try{await p2(Q)}catch{throw Error("Installation verification failed: SKILL.md not found at target")}let U=await B$(Q,"utf-8"),z=L0(U);return{success:!0,path:q.targetDir,name:z.name||q.skillName,version:R0(z),provider:q.providerLabel,source:$}}async function o2(q,$){let Z=await O$(q);for(let X of $){if(X.name===q.providerName)continue;let Q=q.scope==="project"?X.project:X.global,U=x0(Q),z=r(U,q.skillName);await j5(U,{recursive:!0});try{if((await w5(z)).isSymbolicLink())await _q(z);else{S(`install: skipping ${z} — existing non-symlink directory`);continue}}catch{}let G=P5(U,q.targetDir);await N5(G,z,"dir"),S(`install: symlinked ${z} -> ${G}`)}return Z.provider=`All (${$.map((X)=>X.label).join(", ")})`,Z}async function i(q){try{await _q(q,{recursive:!0,force:!0})}catch{}}async function r2(){try{await h0("npx",["--version"]),S("install: npx available")}catch{throw Error("npx is required for Vercel method installation. Install Node.js from https://nodejs.org")}}async function t2(q,$){let Z=["--yes","skills","add",q];if($)Z.push("--skill",$);S(`install: running npx ${Z.join(" ")}`);try{let X=await h0("npx",Z,{timeout:120000});return{stdout:X.stdout,stderr:X.stderr}}catch(X){let Q=X.stderr||X.message||"";throw Error(`npx skills add failed: ${Q}`)}}function e2(q){if(q.isLocal)return q.localPath;let $=`https://github.com/${q.owner}/${q.repo}`;if(q.ref)return`${$}/tree/${q.ref}${q.subpath?`/${q.subpath}`:""}`;return $}async function Tq(q,$,Z){let X=q.providers.filter((J)=>J.enabled);if($==="all"){if(X.length===0)throw Error("No providers are enabled. Enable a provider in your config.");return{provider:X.find((Y)=>Y.name==="agents")||X[0],allProviders:X}}if($){let J=q.providers.find((Y)=>Y.name===$);if(!J){let Y=q.providers.map((B)=>B.name).join(", ");throw Error(`Unknown provider: "${$}". Valid providers: ${Y}, all`)}if(!J.enabled)throw Error(`Provider "${$}" is disabled. Enable it in your config or choose another provider.`);return{provider:J,allProviders:null}}if(X.length===1)return{provider:X[0],allProviders:null};if(!Z){if(X.length===0)throw Error("No providers are enabled. Enable a provider in your config.");let J=X.map((Y)=>Y.name).join(", ");throw Error(`--tool (or --provider) is required in non-interactive mode. Available: ${J}, all`)}let Q=q.providers.map((J)=>({label:`${J.label} (${J.name})`,hint:J.global,checked:J.name==="agents"})),U=await y0({items:Q});if(U.length===0)throw Error("No tools selected. Aborting.");let z=U.map((J)=>q.providers[J]);if(z.length===1)return{provider:z[0],allProviders:null};return{provider:z.find((J)=>J.name==="agents")||z[0],allProviders:z}}function q1(q,$,Z,X,Q,U,z="global"){let G=z==="project"?Q.project:Q.global,J=x0(G),Y=r(J,X);return{source:q,tempDir:$,sourceDir:Z,targetDir:Y,skillName:X,force:U,providerName:Q.name,providerLabel:Q.label,scope:z}}import{readFile as yz}from"fs/promises";import{join as xz}from"path";var oU=_2(),rU=Qq(),tU=t$(),N2=Uq(),eU=d0(),Y0=y(),qz=Q0(),$z=x(),Zz=z0(),Xz=G0(),zH=q$(),Qz=I2(),Uz=D2(),zz=w2(),X$=G4(),J4=m0();var Gz=oU.Composer,Jz=rU.Document,Yz=tU.Schema,Hz=N2.YAMLError,Vz=N2.YAMLParseError,Wz=N2.YAMLWarning,Bz=eU.Alias,_z=Y0.isAlias,Oz=Y0.isCollection,Tz=Y0.isDocument,Fz=Y0.isMap,Kz=Y0.isNode,Lz=Y0.isPair,Rz=Y0.isScalar,Mz=Y0.isSeq,Az=qz.Pair,Iz=$z.Scalar,Dz=Zz.YAMLMap,wz=Xz.YAMLSeq;var Nz=Qz.Lexer,jz=Uz.LineCounter,Pz=zz.Parser,j2=X$.parse,Cz=X$.parseAllDocuments,bz=X$.parseDocument,Sz=X$.stringify,Ez=J4.visit,fz=J4.visitAsync;var Y4=500;function hz(q){let $=q.split(`
|
|
156
|
+
`),Z=!1,X=!1;for(let Q of $){if(Q.trim()==="---")if(!Z){Z=!0;continue}else{X=!0;continue}if(X&&Q.trim().length>0)return!0}return!1}function gz(q){let $=q.split(`
|
|
157
157
|
`),Z=-1;for(let X=0;X<$.length;X++)if($[X].trim()==="---")if(Z===-1)Z=X+1;else return $.slice(Z,X).join(`
|
|
158
|
-
`);return null}function
|
|
158
|
+
`);return null}function kz(q){let $=gz(q);if($===null)return null;try{return j2($),null}catch(Z){return Z.message||"invalid YAML"}}async function H4(q){let $=[];if(!q.description||q.description.trim()==="")$.push({category:"missing-description",message:"Skill has no description in SKILL.md frontmatter"});if(!q.version||q.version==="0.0.0")$.push({category:"missing-version",message:"Skill has no version (or default 0.0.0) in SKILL.md frontmatter"});try{let X=xz(q.path,"SKILL.md"),Q=await yz(X,"utf-8");if(!hz(Q))$.push({category:"empty-body",message:"SKILL.md contains only frontmatter with no body content"});let U=kz(Q);if(U)$.push({category:"invalid-yaml",message:`SKILL.md has invalid YAML frontmatter: ${U}`})}catch{}let Z=q.fileCount;if(Z!==void 0&&Z>Y4)$.push({category:"high-file-count",message:`Skill has ${Z} files (threshold: ${Y4})`});return $}function V4(q){let $=q.map((Z)=>({name:Z.name,version:Z.version,dirName:Z.dirName,provider:Z.provider,scope:Z.scope,path:Z.path,isSymlink:Z.isSymlink,symlinkTarget:Z.symlinkTarget,effort:Z.effort}));return{version:1,exportedAt:new Date().toISOString(),skills:$}}import{readFile as vz,access as B4,mkdir as uz,cp as W4,rm as mz,symlink as pz}from"fs/promises";import{join as _4,basename as dz}from"path";function cz(q){let $=[];if(typeof q!=="object"||q===null||Array.isArray(q))return{valid:!1,errors:["Manifest must be a JSON object."]};let Z=q;if(Z.version!==1)$.push(`Unsupported manifest version: ${JSON.stringify(Z.version)}. Expected 1.`);if(typeof Z.exportedAt!=="string")$.push("Missing or invalid 'exportedAt' field.");if(!Array.isArray(Z.skills))return $.push("Missing or invalid 'skills' array."),{valid:!1,errors:$};for(let X=0;X<Z.skills.length;X++){let Q=Z.skills[X];if(typeof Q!=="object"||Q===null){$.push(`skills[${X}]: must be an object.`);continue}let U=Q;if(typeof U.name!=="string"||!U.name)$.push(`skills[${X}]: missing or empty 'name'.`);if(typeof U.dirName!=="string"||!U.dirName)$.push(`skills[${X}]: missing or empty 'dirName'.`);if(typeof U.provider!=="string"||!U.provider)$.push(`skills[${X}]: missing or empty 'provider'.`);if(U.scope!=="global"&&U.scope!=="project")$.push(`skills[${X}]: invalid 'scope' "${String(U.scope)}". Must be "global" or "project".`)}return{valid:$.length===0,errors:$}}async function O4(q){let $;try{$=await vz(q,"utf-8")}catch(Q){if(Q?.code==="ENOENT")throw Error(`Manifest file not found: ${q}`);throw Error(`Failed to read manifest file: ${Q.message}`)}let Z;try{Z=JSON.parse($)}catch{throw Error("Manifest file is not valid JSON.")}let X=cz(Z);if(!X.valid)throw Error(`Invalid manifest:
|
|
159
|
+
${X.errors.join(`
|
|
160
|
+
`)}`);return Z}async function lz(q){try{return await B4(q),!0}catch{return!1}}function az(q,$){return q.providers.find((Z)=>Z.name===$&&Z.enabled)}function nz(q,$,Z,X){let Q=az(q,$);if(!Q)return null;let U=Z==="global"?Q.global:Q.project,z=x0(U),G=dz(X);if(!G||G==="."||G==="..")return null;return _4(z,G)}function iz(q,$){let Z=q.find((X)=>X.dirName===$.dirName&&X.provider===$.provider);if(Z)return Z;return q.find((X)=>X.dirName===$.dirName)||null}async function T4(q,$,Z){let X=Z?.config??await v(),Q=Z?.installedSkills??await p(X,"both"),U=[];for(let Y of q.skills){if($.scopeFilter!=="both"&&Y.scope!==$.scopeFilter){S(`import: skipping "${Y.name}" — scope "${Y.scope}" filtered out`);continue}let B=nz(X,Y.provider,Y.scope,Y.dirName);if(!B){U.push({skillName:Y.name,provider:Y.provider,scope:Y.scope,status:"failed",reason:`Provider "${Y.provider}" not found or not enabled.`});continue}let V=await lz(B);if(V&&!$.force){U.push({skillName:Y.name,provider:Y.provider,scope:Y.scope,status:"skipped",reason:"Already installed.",path:B});continue}if($.dryRun){U.push({skillName:Y.name,provider:Y.provider,scope:Y.scope,status:"dry-run",reason:V?"Would overwrite (--force).":"Would install.",path:B});continue}let W=iz(Q,Y);if(!W){U.push({skillName:Y.name,provider:Y.provider,scope:Y.scope,status:"failed",reason:"No installed source found. Install the skill first with: asm install <source>"});continue}try{if(await uz(_4(B,".."),{recursive:!0}),V)await mz(B,{recursive:!0,force:!0});if(Y.isSymlink&&Y.symlinkTarget)try{await B4(Y.symlinkTarget),await pz(Y.symlinkTarget,B),S(`import: symlinked "${Y.name}" -> ${Y.symlinkTarget} at ${B}`)}catch{await W4(W.realPath,B,{recursive:!0}),S(`import: symlink target unreachable, copied "${Y.name}" from ${W.realPath} to ${B}`)}else await W4(W.realPath,B,{recursive:!0}),S(`import: copied "${Y.name}" from ${W.realPath} to ${B}`);U.push({skillName:Y.name,provider:Y.provider,scope:Y.scope,status:"installed",path:B})}catch(O){U.push({skillName:Y.name,provider:Y.provider,scope:Y.scope,status:"failed",reason:`Copy failed: ${O.message}`})}}let z=U.filter((Y)=>Y.status==="installed").length,G=U.filter((Y)=>Y.status==="skipped").length,J=U.filter((Y)=>Y.status==="failed").length;return{total:U.length,installed:z,skipped:G,failed:J,results:U}}import{mkdir as sz,writeFile as oz,access as rz}from"fs/promises";import{join as tz}from"path";function ez(q){return`---
|
|
159
161
|
name: ${q}
|
|
160
162
|
description: ""
|
|
161
163
|
license: ""
|
|
@@ -176,13 +178,13 @@ as instructions for when and how to use this skill.
|
|
|
176
178
|
## Instructions
|
|
177
179
|
|
|
178
180
|
- Step-by-step instructions for the agent
|
|
179
|
-
`}async function
|
|
180
|
-
`)}import{access as
|
|
181
|
-
`);for(let G=0;G<z.length;G++){let J=z[G],Y=J.trim();for(let B of
|
|
182
|
-
`)}function b2(q){return JSON.stringify(q,null,2)}import{readFile as
|
|
183
|
-
`,"utf-8")}async function
|
|
184
|
-
---`,3);if(Z===-1)return"";return $.slice(Z+4)}async function
|
|
185
|
-
`,"utf-8"),
|
|
181
|
+
`}async function F4(q,$){await sz($,{recursive:!0});let Z=tz($,"SKILL.md"),X=ez(q);await oz(Z,X,"utf-8")}async function K4(q){try{return await rz(q),!0}catch{return!1}}import{readdir as qG,stat as $G}from"fs/promises";import{join as ZG}from"path";async function XG(q){let $=0;try{let X=(await qG(q,{recursive:!0})).map(async(U)=>{try{let z=await $G(ZG(q,U));if(z.isFile())return z.size}catch{}return 0});$=(await Promise.all(X)).reduce((U,z)=>U+z,0)}catch{}return $}async function M4(q,$){let Z={},X={global:0,project:0},Q={},U=q.map(async(J)=>{Z[J.provider]=(Z[J.provider]||0)+1,X[J.scope]++;let Y=await XG(J.path);return Q[J.path]=Y,Y}),G=(await Promise.all(U)).reduce((J,Y)=>J+Y,0);return{totalSkills:q.length,byProvider:Z,byScope:X,totalDiskBytes:G,perSkillDiskBytes:Q,duplicateGroups:$.duplicateGroups.length,duplicateInstances:$.totalDuplicateInstances}}function QG(q){if(q<1024)return`${q} B`;if(q<1048576)return`${(q/1024).toFixed(1)} KB`;if(q<1073741824)return`${(q/1048576).toFixed(1)} MB`;return`${(q/1073741824).toFixed(1)} GB`}function P2(q,$,Z=20){let X=Math.round(q/$*Z),Q=Z-X;return H.green("#".repeat(X))+H.dim("-".repeat(Q))}var L4={claude:"Claude Code",codex:"Codex",openclaw:"OpenClaw",agents:"Agents"};function A4(q){let $=[];$.push(""),$.push(H.blueBold(" Skill Statistics")),$.push(H.dim(" "+"-".repeat(20))),$.push(""),$.push(` ${H.bold("Total:")} ${H.cyan(String(q.totalSkills))} skills`),$.push(` ${H.bold("Disk:")} ${H.cyan(QG(q.totalDiskBytes))}`),$.push(""),$.push(H.bold(" By Tool"));let Z=Object.entries(q.byProvider).sort((J,Y)=>Y[1]-J[1]),X=Math.max(...Z.map(([,J])=>J)),Q=Math.max(...Z.map(([J])=>(L4[J]||J).length));for(let[J,Y]of Z){let B=L4[J]||J,V=R4(J,B.padEnd(Q)),W=String(Y).padStart(4);$.push(` ${V} ${W} ${P2(Y,X)}`)}$.push(""),$.push(H.bold(" By Scope"));let U=Math.max(q.byScope.global,q.byScope.project),z=String(q.byScope.global).padStart(4),G=String(q.byScope.project).padStart(4);if($.push(` ${"global ".padEnd(Q)} ${z} ${P2(q.byScope.global,U)}`),$.push(` ${"project".padEnd(Q)} ${G} ${P2(q.byScope.project,U)}`),$.push(""),$.push(H.bold(" Duplicates")),q.duplicateGroups>0)$.push(` ${H.yellow(`${q.duplicateGroups} group(s), ${q.duplicateInstances} total instance(s)`)}`),$.push(H.dim(` Run ${H.bold("asm audit")} to review`));else $.push(` ${H.green("None")}`);return $.push(""),$.join(`
|
|
182
|
+
`)}import{access as UG,lstat as zG,readFile as GG,rm as JG,symlink as YG}from"fs/promises";import{join as I4}from"path";async function D4(q){let $;try{$=await zG(q)}catch{throw Error(`Path does not exist: ${q}`)}if(!$.isDirectory())throw Error(`Path is not a directory: ${q}`);let Z=I4(q,"SKILL.md"),X;try{X=await GG(Z,"utf-8")}catch{throw Error(`No SKILL.md found in ${q}`)}let Q=L0(X);if(!Q.name)throw Error(`Invalid SKILL.md in ${q}: missing "name" in frontmatter`);return{name:Q.name,version:R0(Q)}}async function Q$(q,$,Z,X){let Q=I4($,Z),U=!1;try{await UG(Q),U=!0}catch{}if(U){if(!X)throw Error(`Target already exists: ${Q}. Use --force to overwrite.`);await JG(Q,{recursive:!0,force:!0})}await YG(q,Q,"dir")}var j4=[{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bcurl\b/,severity:"critical",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bwget\b/,severity:"critical",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bfetch\s*\(/,severity:"warning",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\baxios\b/,severity:"warning",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bhttp\.request\b/,severity:"warning",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bXMLHttpRequest\b/,severity:"warning",permissionType:"network"},{category:"External URLs",description:"Hardcoded URLs that may indicate data exfiltration or remote payload loading",pattern:/https?:\/\/(?!github\.com|localhost|127\.0\.0\.1|example\.com)/,severity:"warning",permissionType:"network"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bexec\s*\(/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bexecSync\b/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bchild_process\b/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bspawn\s*\(/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bBun\.spawn\b/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bshelljs\b/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\b(?:bash|sh|zsh)\s+-c\b/,severity:"critical",permissionType:"shell"},{category:"Dynamic code execution",description:"Patterns that execute dynamically constructed code at runtime",pattern:/\beval\s*\(/,severity:"critical",permissionType:"code-execution"},{category:"Dynamic code execution",description:"Patterns that execute dynamically constructed code at runtime",pattern:/\bnew\s+Function\b/,severity:"critical",permissionType:"code-execution"},{category:"Dynamic code execution",description:"Patterns that execute dynamically constructed code at runtime",pattern:/\bFunction\s*\(/,severity:"critical",permissionType:"code-execution"},{category:"Dynamic code execution",description:"Patterns that execute dynamically constructed code at runtime",pattern:/\bimport\s*\(\s*[^'"]/,severity:"warning",permissionType:"code-execution"},{category:"File system access",description:"Operations that read, write, or modify files on disk",pattern:/\bfs\.(?:write|append|unlink|rm|mkdir|rename)\b/,severity:"warning",permissionType:"filesystem"},{category:"File system access",description:"Operations that read, write, or modify files on disk",pattern:/\bwriteFile(?:Sync)?\b/,severity:"warning",permissionType:"filesystem"},{category:"File system access",description:"Operations that read, write, or modify files on disk",pattern:/\brm\s+-rf?\b/,severity:"critical",permissionType:"filesystem"},{category:"File system access",description:"Operations that read, write, or modify files on disk",pattern:/\bchmod\b/,severity:"warning",permissionType:"filesystem"},{category:"Embedded credentials",description:"Hardcoded secrets, API keys, tokens, or passwords",pattern:/\b(?:API_KEY|SECRET_KEY|ACCESS_TOKEN|PRIVATE_KEY)\s*[=:]/,severity:"critical"},{category:"Embedded credentials",description:"Hardcoded secrets, API keys, tokens, or passwords",pattern:/\bPASSWORD\s*[=:]/,severity:"critical"},{category:"Embedded credentials",description:"Hardcoded secrets, API keys, tokens, or passwords",pattern:/(?:sk|pk)[-_](?:live|test)[-_][a-zA-Z0-9]{20,}/,severity:"critical"},{category:"Environment variable access",description:"Reading environment variables which may contain secrets or configuration",pattern:/\bprocess\.env\b/,severity:"info",permissionType:"environment"},{category:"Environment variable access",description:"Reading environment variables which may contain secrets or configuration",pattern:/\bBun\.env\b/,severity:"info",permissionType:"environment"},{category:"Obfuscation patterns",description:"Base64 encoding, hex strings, or other obfuscation techniques",pattern:/\batob\s*\(/,severity:"warning"},{category:"Obfuscation patterns",description:"Base64 encoding, hex strings, or other obfuscation techniques",pattern:/\bBuffer\.from\s*\([^,]+,\s*['"]base64['"]\)/,severity:"warning"},{category:"Obfuscation patterns",description:"Base64 encoding, hex strings, or other obfuscation techniques",pattern:/\\x[0-9a-fA-F]{2}(?:\\x[0-9a-fA-F]{2}){5,}/,severity:"warning"}];async function HG(q,$){let Z={owner:q,repo:$,profileUrl:`https://github.com/${q}`,reposUrl:`https://github.com/${q}?tab=repositories`,isOrganization:null,publicRepos:null,accountAge:null,fetchError:null};try{let X=await fetch(`https://api.github.com/users/${q}`,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"agent-skill-manager"},signal:AbortSignal.timeout(1e4)});if(!X.ok)return Z.fetchError=`GitHub API returned ${X.status}`,Z;let Q=await X.json();if(Z.isOrganization=Q.type==="Organization",Z.publicRepos=typeof Q.public_repos==="number"?Q.public_repos:null,typeof Q.created_at==="string"){let U=new Date(Q.created_at),z=new Date,G=Math.floor((z.getTime()-U.getTime())/31557600000),J=Math.floor((z.getTime()-U.getTime())%31557600000/2630016000.0000005);Z.accountAge=G>0?`${G}y ${J}m`:`${J}m`}S(`security-audit: source analysis for ${q} -> repos=${Z.publicRepos}, org=${Z.isOrganization}, age=${Z.accountAge}`)}catch(X){Z.fetchError=X.message||"Failed to fetch GitHub profile",S(`security-audit: source analysis failed -> ${Z.fetchError}`)}return Z}function VG(q){let $=new Map;for(let{relPath:Q,content:U}of q){let z=U.split(`
|
|
183
|
+
`);for(let G=0;G<z.length;G++){let J=z[G],Y=J.trim();for(let B of j4)if(B.pattern.test(J)){let V=B.category;if(!$.has(V))$.set(V,{description:B.description,matches:[]});let W=Y.length>120?Y.slice(0,120)+"...":Y;$.get(V).matches.push({file:Q,line:G+1,match:W,severity:B.severity})}}}let Z=[];for(let[Q,U]of $)Z.push({category:Q,description:U.description,matches:U.matches});let X={critical:0,warning:1,info:2};return Z.sort((Q,U)=>{let z=Math.min(...Q.matches.map((J)=>X[J.severity])),G=Math.min(...U.matches.map((J)=>X[J.severity]));return z-G}),Z}function WG(q){let $=new Map;for(let U of q)for(let z of U.matches)for(let G of j4)if(G.permissionType&&G.category===U.category&&G.pattern.test(z.match)){let J=G.permissionType;if(!$.has(J))$.set(J,{evidence:[],categories:new Set});let Y=$.get(J);Y.evidence.push({file:z.file,line:z.line,match:z.match}),Y.categories.add(U.category);break}let Z={filesystem:"Skill reads, writes, or modifies files on disk. Verify it only accesses intended paths.",shell:"Skill executes shell commands or spawns processes. This allows arbitrary system access.",network:"Skill makes network requests or downloads external content. Data may be sent to remote servers.","code-execution":"Skill dynamically constructs and executes code. This can bypass static analysis.",environment:"Skill reads environment variables, which may contain secrets or API keys."},X=[];for(let[U,z]of $)X.push({type:U,evidence:z.evidence,reason:Z[U]});let Q={shell:0,"code-execution":1,network:2,filesystem:3,environment:4};return X.sort((U,z)=>(Q[U.type]??99)-(Q[z.type]??99)),X}function BG(q,$,Z){let X=0,Q=0;for(let J of q)for(let Y of J.matches){if(Y.severity==="critical")X++;if(Y.severity==="warning")Q++}let U=$.some((J)=>J.type==="shell"),z=$.some((J)=>J.type==="code-execution"),G=$.some((J)=>J.type==="network");if(U&&G)return{verdict:"dangerous",reason:"Skill has both shell execution and network access -- potential data exfiltration risk."};if(z&&G)return{verdict:"dangerous",reason:"Skill has dynamic code execution and network access -- potential remote code execution risk."};if(X>=10)return{verdict:"dangerous",reason:`${X} critical findings detected. High concentration of risky patterns.`};if(U||z)return{verdict:"warning",reason:U?"Skill executes shell commands. Review commands carefully before installing.":"Skill uses dynamic code execution. Review usage carefully."};if(X>0)return{verdict:"warning",reason:`${X} critical finding${X>1?"s":""} detected. Manual review recommended.`};if(Q>0)return{verdict:"caution",reason:`${Q} warning${Q>1?"s":""} found. Generally acceptable but worth reviewing.`};if(Z&&Z.publicRepos!==null&&Z.publicRepos<3)return{verdict:"caution",reason:"No code issues found, but the author has very few public repositories."};return{verdict:"safe",reason:"No suspicious patterns detected."}}async function z$(q,$,Z,X){S(`security-audit: scanning ${q}`);let Q=await Wq(q),U=Q.reduce((V,W)=>V+W.lineCount,0),z=null;if(Z&&X)z=await HG(Z,X);let G=VG(Q),J=WG(G),{verdict:Y,reason:B}=BG(G,J,z);return{scannedAt:new Date().toISOString(),skillName:$,skillPath:q,source:z,codeScans:G,permissions:J,totalFiles:Q.length,totalLines:U,verdict:Y,verdictReason:B}}var P=H,F0=56,_G={"Shell execution":"shell","Dynamic code execution":"code-execution","Network requests":"network","External URLs":"network","File system access":"filesystem","Environment variable access":"environment","Embedded credentials":"credentials","Obfuscation patterns":"obfuscation"},w4={critical:0,warning:1,info:2};function OG(q){switch(q){case"safe":return P.bgGreen(" SAFE ");case"caution":return P.bgCyan(" CAUTION ");case"warning":return P.bgYellow(" WARNING ");case"dangerous":return P.bgRed(" DANGEROUS ")}}function TG(q){switch(q){case"safe":return P.green;case"caution":return P.cyan;case"warning":return P.yellow;case"dangerous":return P.red}}function f0(q){switch(q){case"critical":return P.red("!!");case"warning":return P.yellow(" !");case"info":return P.dim(" i")}}function C2(q,$){return q.length>$?q.slice(0,$-3)+"...":q}function U$(q){return q.toLocaleString("en-US")}function P4(q){return q.replace(/\x1b\[[0-9;]*m/g,"")}function N4(q){return P4(q).length}function FG(q){let $=new Map;for(let Z of q){let X=`${Z.file}:${Z.line}`,Q=$.get(X);if(!Q||w4[Z.severity]<w4[Q.severity])$.set(X,Z)}return Array.from($.values())}function KG(q){let $=new Map;for(let Z of q){let X=$.get(Z.file);if(!X)X={file:Z.file,entries:[]},$.set(Z.file,X);X.entries.push({line:Z.line,match:Z.match,severity:Z.severity})}return Array.from($.values())}function G$(q){let $=[],Z=OG(q.verdict),X=P4(Z),Q=` ${P.bold(q.skillName)}`,U=` ${q.skillName}`,z=F0-4,G=Math.max(1,z-U.length-X.length);if($.push(""),$.push(P.dim(" +-- ")+P.bold("Security Audit")+P.dim(" "+"-".repeat(F0-19)+"+")),$.push(P.dim(" |")+Q+" ".repeat(G)+Z+P.dim("|")),$.push(P.dim(" |")+P.dim(` ${U$(q.totalFiles)} files | ${U$(q.totalLines)} lines`)+" ".repeat(Math.max(1,z-` ${U$(q.totalFiles)} files | ${U$(q.totalLines)} lines`.length))+P.dim("|")),$.push(P.dim(" +"+"-".repeat(F0-2)+"+")),q.source){let V=q.source;if(V.fetchError)$.push(` ${P.yellow("!")} Could not fetch profile: ${V.fetchError}`);else{let W=[];if(W.push(`${V.owner} ${V.isOrganization?P.cyan("(org)"):P.dim("(user)")}`),V.publicRepos!==null){let O=V.publicRepos,F=O<3?P.yellow(`${O} repos`):O<10?P.cyan(`${O} repos`):P.green(`${O} repos`);W.push(F)}if(V.accountAge)W.push(V.accountAge);$.push(` ${P.dim("Author:")} ${W.join(P.dim(" | "))}`)}}if($.push(""),q.codeScans.length===0)$.push(` ${P.green("*")} ${P.green("No suspicious patterns detected.")}`);else{let V=TG(q.verdict),W=q.verdict==="dangerous"||q.verdict==="warning"?f0("critical"):q.verdict==="caution"?f0("warning"):f0("info");$.push(` ${W} ${V(q.verdictReason)}`);let O=0,F=0,_=0;for(let R of q.codeScans)for(let D of R.matches)if(D.severity==="critical")O++;else if(D.severity==="warning")F++;else _++;let T=[];if(O>0)T.push(P.red(`${O} critical`));if(F>0)T.push(P.yellow(`${F} warning`));if(_>0)T.push(P.dim(`${_} info`));let L=q.permissions.map((R)=>R.type),M=L.length>0?P.dim(`Perms: ${L.join(", ")}`):"";$.push(` ${T.join(P.dim(" | "))} ${M}`)}if($.push(""),q.codeScans.length>0){$.push(` ${P.bold("Findings")}`),$.push(P.dim(" "+"=".repeat(F0-2)));for(let V of q.codeScans){let W=FG(V.matches),O=W.filter((j)=>j.severity==="critical").length,F=W.filter((j)=>j.severity==="warning").length,_=W.filter((j)=>j.severity==="info").length,T=O>0?f0("critical"):F>0?f0("warning"):f0("info"),L=[];if(O>0)L.push(P.red(`${O} critical`));if(F>0)L.push(P.yellow(`${F} warning`));if(_>0)L.push(P.dim(`${_} info`));let M=_G[V.category],R=M?P.dim(`PERM: ${M}`):"",D=` ${T} ${P.bold(V.category)} (${L.join(", ")})`;if(R){let j=N4(D),b=N4(R),f=Math.max(2,F0-j-b);$.push(D+" ".repeat(f)+R)}else $.push(D);let w=KG(W),N=Math.min(24,Math.max(...w.map((j)=>j.file.length))),I=0,K=3;for(let j of w){if(I>=K)break;let b=C2(j.file,24),f=P.dim(b.padEnd(N));if(j.entries.length===1){let h=j.entries[0],q0=C2(h.match,50);$.push(` ${f} :${h.line} ${P.dim("--")} ${h.severity==="critical"?q0:P.dim(q0)}`),I++}else if(j.entries.length<=3){let h=j.entries.map((H$)=>`:${H$.line}`).join(", "),q0=C2(j.entries[0].match,40);$.push(` ${f} ${h} ${P.dim("--")} ${P.dim(q0)}`),I++}else{let q0=j.entries.slice(0,3).map((W5)=>`:${W5.line}`).join(", "),H$=j.entries.length-3;$.push(` ${f} ${q0} ${P.dim(`(+${H$} more)`)}`),I++}}let C=w.length-Math.min(w.length,K);if(C>0){let j=W.length-w.slice(0,K).reduce((b,f)=>b+f.entries.length,0);if(j>0)$.push(` ${P.dim(`... ${j} more in ${C} file${C>1?"s":""}`)}`)}$.push("")}}$.push(P.dim(" "+"=".repeat(F0-2)));let J=new Date(q.scannedAt),Y=`${J.getFullYear()}-${String(J.getMonth()+1).padStart(2,"0")}-${String(J.getDate()).padStart(2,"0")} ${String(J.getHours()).padStart(2,"0")}:${String(J.getMinutes()).padStart(2,"0")}`,B=q.source&&!q.source.fetchError?`github.com/${q.source.owner}`:"";if(B){let V=Math.max(2,F0-2-Y.length-B.length);$.push(P.dim(` ${Y}${" ".repeat(V)}${B}`))}else $.push(P.dim(` ${Y}`));return $.push(""),$.join(`
|
|
184
|
+
`)}function b2(q){return JSON.stringify(q,null,2)}import{readFile as LG,writeFile as RG,mkdir as MG,copyFile as AG}from"fs/promises";import{execFile as IG}from"child_process";import{promisify as DG}from"util";import{dirname as wG}from"path";var NG=DG(IG);function C4(){return{version:1,skills:{}}}async function b4(){let q=S2(),$;try{$=await LG(q,"utf-8")}catch(Z){if(Z?.code==="ENOENT")return S("lock: file not found, returning empty lock"),C4();throw Z}try{let Z=JSON.parse($);if(Z.version!==1||typeof Z.skills!=="object"||Z.skills===null)throw Error("invalid schema");return S(`lock: loaded ${Object.keys(Z.skills).length} entries`),Z}catch{let Z=q+".bak";S(`lock: parse error, backing up to ${Z}`);try{await AG(q,Z)}catch{}return console.error(`Warning: .skill-lock.json was corrupted. Backup saved to ${Z}. Starting fresh.`),C4()}}async function S4(q,$){let Z=await b4();Z.skills[q]=$,await f4(Z),S(`lock: wrote entry for "${q}"`)}async function E4(q){let $=await b4();if(!(q in $.skills)){S(`lock: no entry for "${q}", nothing to remove`);return}delete $.skills[q],await f4($),S(`lock: removed entry for "${q}"`)}async function f4(q){let $=S2();await MG(wG($),{recursive:!0}),await RG($,JSON.stringify(q,null,2)+`
|
|
185
|
+
`,"utf-8")}async function y4(q){try{let{stdout:$}=await NG("git",["rev-parse","HEAD"],{cwd:q,timeout:5000});return $.trim()||null}catch{return S("lock: could not read commit hash from cloned repo"),null}}import{writeFile as vG,mkdir as uG,unlink as mG,readFile as pG}from"fs/promises";import{join as f2}from"path";import{readdir as jG,readFile as PG}from"fs/promises";import{join as CG}from"path";function E2(q){let $=new Set,Z=q.toLowerCase().split(/[\s\-_.,;:()[\]{}"']+/);for(let X of Z)if(X.length>=2)$.add(X);return $}var bG=10,SG=5,EG=3,fG=1;function yG(q,$){let Z=E2(q),X=E2($.name),Q=E2($.description),U=0;for(let z of Z){if(X.has(z))U+=bG;if(Q.has(z))U+=EG;if($.name.toLowerCase().includes(z))U+=SG;if($.description.toLowerCase().includes(z))U+=fG}return U}async function x4(q){let $=new Map,Z;try{Z=await jG(q)}catch{return $}for(let X of Z){if(!X.endsWith(".json"))continue;let Q=CG(q,X);try{let U=await PG(Q,"utf-8"),z=JSON.parse(U);for(let G of z.skills){if(!("license"in G))G.license="";if(!("creator"in G))G.creator="";if(!("compatibility"in G))G.compatibility="";if(!("allowedTools"in G))G.allowedTools=[];if(!("verified"in G))G.verified=!1}$.set(`${z.owner}/${z.repo}`,z)}catch{}}return $}async function J$(){let q=await x4(k4()),$=await x4(Vq()),Z=new Map(q);for(let[X,Q]of $)Z.set(X,Q);return Array.from(Z.values())}var xG=["license","creator","version"];function h4(q){return xG.includes(q)}function g4(q,$){return q[$]||""}function hG(q,$){if($.has)for(let Z of $.has){if(!h4(Z))continue;if(!g4(q,Z))return!1}if($.missing)for(let Z of $.missing){if(!h4(Z))continue;if(g4(q,Z))return!1}return!0}function v4(q){let $=[];if(!q.license)$.push("license");if(!q.creator)$.push("creator");if(!q.version||q.version==="0.0.0")$.push("version");return $}async function Y$(q,$=20,Z){let X=await J$(),Q=[],U=!q&&Z;for(let z of X)for(let G of z.skills){if(Z&&!hG(G,Z))continue;let J=U?1:yG(q,G);if(J>0)Q.push({skill:G,repo:{owner:z.owner,repo:z.repo},score:J})}return Q.sort((z,G)=>G.score-z.score),Q.slice(0,$)}async function u4(){return(await J$()).reduce(($,Z)=>$+Z.skillCount,0)}var gG=[{label:"obfuscation:atob",pattern:/\batob\s*\(/},{label:"obfuscation:base64",pattern:/(?:^|[=:\s])[A-Za-z0-9+/]{40,}={1,2}(?:\s|$)/m},{label:"obfuscation:hex-escape",pattern:/\\x[0-9a-fA-F]{2}(?:\\x[0-9a-fA-F]{2}){3,}/},{label:"credential-leak:api-key",pattern:/\bAPI_KEY\s*=\s*['"][^'"]+['"]/},{label:"credential-leak:secret",pattern:/\bSECRET_KEY\s*=\s*['"][^'"]+['"]/},{label:"credential-leak:password",pattern:/\bPASSWORD\s*=\s*['"][^'"]+['"]/}];function m4(q,$){let Z=[];if(!q.name||!q.name.trim())Z.push("missing frontmatter field: name");if(!q.description||!q.description.trim())Z.push("missing frontmatter field: description");if(kG($).trim().length<20)Z.push("SKILL.md body too short (less than 20 chars of instructions)");for(let{label:Q,pattern:U}of gG)if(U.test($))Z.push(`malicious pattern detected: ${Q}`);return{verified:Z.length===0,reasons:Z}}function kG(q){let $=q.trimStart();if(!$.startsWith("---"))return $;let Z=$.indexOf(`
|
|
186
|
+
---`,3);if(Z===-1)return"";return $.slice(Z+4)}async function dG(){let q=Vq();return await uG(q,{recursive:!0}),q}async function p4(q){await v0();let $;try{$=g0(q)}catch(X){return{success:!1,repoIndex:null,error:X.message}}if($.isLocal)return{success:!1,repoIndex:null,error:"Local paths are not supported for indexing. Use a GitHub source instead."};S(`ingester: cloning ${$.owner}/${$.repo}`);let Z=null;try{Z=await u0($),S(`ingester: discovering skills in ${Z}`);let X=await Oq(Z);S(`ingester: found ${X.length} skills`);let Q=[];for(let J of X){let Y=f2(Z,J.relPath,"SKILL.md"),B="";try{B=await pG(Y,"utf-8")}catch{S(`ingester: could not read SKILL.md at ${Y}`)}let V=m4(J,B);if(!V.verified)S(`ingester: ${J.name} not verified: ${V.reasons.join(", ")}`);Q.push({name:J.name,description:J.description,version:J.version,license:J.license,creator:J.creator,compatibility:J.compatibility,allowedTools:J.allowedTools,installUrl:`github:${$.owner}/${$.repo}${$.ref?`#${$.ref}`:""}${J.relPath?`:${J.relPath}`:""}`,relPath:J.relPath,verified:V.verified})}let U={repoUrl:$.cloneUrl,owner:$.owner,repo:$.repo,updatedAt:new Date().toISOString(),skillCount:Q.length,skills:Q},z=await dG(),G=f2(z,`${$.owner}_${$.repo}.json`);return await vG(G,JSON.stringify(U,null,2)+`
|
|
187
|
+
`,"utf-8"),S(`ingester: wrote index to ${G}`),{success:!0,repoIndex:U}}catch(X){return{success:!1,repoIndex:null,error:X.message}}finally{if(Z)await i(Z)}}async function d4(){return(await J$()).map(($)=>({owner:$.owner,repo:$.repo,skillCount:$.skillCount,updatedAt:$.updatedAt})).sort(($,Z)=>Z.skillCount-$.skillCount)}async function c4(q,$){let Z=Vq(),X=f2(Z,`${q}_${$}.json`);try{return await mG(X),!0}catch{return!1}}function cG(q){let $=q.slice(2),Z={command:null,subcommand:null,positional:[],flags:{help:!1,version:!1,json:!1,yes:!1,noColor:!1,scope:"both",sort:"name",provider:null,name:null,force:!1,path:null,all:!1,verbose:!1,flat:!1,transport:"auto",method:"default",installed:!1,available:!1,has:[],missing:[]}},X=0;while(X<$.length){let Q=$[X];if(Q==="--help"||Q==="-h")Z.flags.help=!0;else if(Q==="--version"||Q==="-v")Z.flags.version=!0;else if(Q==="--json")Z.flags.json=!0;else if(Q==="--yes"||Q==="-y")Z.flags.yes=!0;else if(Q==="--no-color")Z.flags.noColor=!0;else if(Q==="--scope"||Q==="-s"){X++;let U=$[X];if(U==="global"||U==="project"||U==="both")Z.flags.scope=U;else E(`Invalid scope: "${U}". Must be global, project, or both.`),process.exit(2)}else if(Q==="--sort"){X++;let U=$[X];if(U==="name"||U==="version"||U==="location")Z.flags.sort=U;else E(`Invalid sort: "${U}". Must be name, version, or location.`),process.exit(2)}else if(Q==="--provider"||Q==="-p"||Q==="--tool")X++,Z.flags.provider=$[X]||null;else if(Q==="--name")X++,Z.flags.name=$[X]||null;else if(Q==="--force"||Q==="-f")Z.flags.force=!0;else if(Q==="--path")X++,Z.flags.path=$[X]||null;else if(Q==="--all")Z.flags.all=!0;else if(Q==="--verbose"||Q==="-V")Z.flags.verbose=!0;else if(Q==="--flat")Z.flags.flat=!0;else if(Q==="--installed")Z.flags.installed=!0;else if(Q==="--available")Z.flags.available=!0;else if(Q==="--transport"||Q==="-t"){X++;let U=$[X];if(U==="https"||U==="ssh"||U==="auto")Z.flags.transport=U;else E(`Invalid transport: "${U}". Must be https, ssh, or auto.`),process.exit(2)}else if(Q==="--method"||Q==="-m"){X++;let U=$[X];if(U==="default"||U==="vercel")Z.flags.method=U;else E(`Invalid method: "${U}". Must be default or vercel.`),process.exit(2)}else if(Q==="--skill")X++,Z.flags.path=$[X]||null;else if(Q==="--has"){if(X++,$[X])Z.flags.has.push($[X])}else if(Q==="--missing"){if(X++,$[X])Z.flags.missing.push($[X])}else if(Q.startsWith("-"))E(`Unknown option: ${Q}`),console.error('Run "asm --help" for usage.'),process.exit(2);else if(!Z.command)Z.command=Q;else if(!Z.subcommand)Z.subcommand=Q;else Z.positional.push(Q);X++}return Z}function E(q){console.error(H.red(`Error: ${q}`))}function lG(){console.log(`${H.blueBold("agent-skill-manager")} (${H.bold("asm")}) ${v2}
|
|
186
188
|
|
|
187
189
|
Interactive TUI and CLI for managing installed skills for AI coding agents.
|
|
188
190
|
|
|
@@ -199,6 +201,7 @@ ${H.bold("Commands:")}
|
|
|
199
201
|
audit Detect duplicate skills across tools
|
|
200
202
|
audit security <name> Run security audit on a skill (or GitHub source)
|
|
201
203
|
export Export skill inventory as JSON manifest
|
|
204
|
+
import <file> Import skills from a previously exported manifest
|
|
202
205
|
init <name> Scaffold a new skill with SKILL.md template
|
|
203
206
|
stats Show aggregate skill metrics dashboard
|
|
204
207
|
link <path> Symlink a local skill directory into an agent
|
|
@@ -218,7 +221,7 @@ ${H.bold("Global Options:")}
|
|
|
218
221
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
219
222
|
--flat Show one row per tool instance (list, search)
|
|
220
223
|
-y, --yes Skip confirmation prompts
|
|
221
|
-
-V, --verbose Show debug output`)}function
|
|
224
|
+
-V, --verbose Show debug output`)}function aG(){console.log(`${H.bold("Usage:")} asm list [options]
|
|
222
225
|
|
|
223
226
|
List all discovered skills. By default, skills installed across multiple
|
|
224
227
|
tools are grouped into a single row with tool badges.
|
|
@@ -238,7 +241,7 @@ ${H.bold("Examples:")}
|
|
|
238
241
|
asm list -p claude ${H.dim("Only Claude Code skills")}
|
|
239
242
|
asm list -s project ${H.dim("Only project-scoped skills")}
|
|
240
243
|
asm list --sort version ${H.dim("Sort by version")}
|
|
241
|
-
asm list --json ${H.dim("Output as JSON")}`)}function
|
|
244
|
+
asm list --json ${H.dim("Output as JSON")}`)}function nG(){console.log(`${H.bold("Usage:")} asm search <query> [options]
|
|
242
245
|
|
|
243
246
|
Search both installed skills and the skill index. Results show installation
|
|
244
247
|
status and include copy-paste install commands for available skills.
|
|
@@ -259,7 +262,7 @@ ${H.bold("Examples:")}
|
|
|
259
262
|
asm search review -p claude ${H.dim("Search within Claude Code only")}
|
|
260
263
|
asm search "test" --installed ${H.dim("Search installed skills only")}
|
|
261
264
|
asm search "test" --available ${H.dim("Search available skills only")}
|
|
262
|
-
asm search openspec --json ${H.dim("Output matches as JSON")}`)}function
|
|
265
|
+
asm search openspec --json ${H.dim("Output matches as JSON")}`)}function iG(){console.log(`${H.bold("Usage:")} asm inspect <skill-name> [options]
|
|
263
266
|
|
|
264
267
|
Show detailed information for a skill. The <skill-name> is the directory name.
|
|
265
268
|
Shows version, description, file count, and all provider installations.
|
|
@@ -273,7 +276,7 @@ ${H.bold("Options:")}
|
|
|
273
276
|
${H.bold("Examples:")}
|
|
274
277
|
asm inspect code-review ${H.dim("Show details for code-review")}
|
|
275
278
|
asm inspect code-review --json ${H.dim("Output as JSON")}
|
|
276
|
-
asm inspect code-review -s global ${H.dim("Global installations only")}`)}function
|
|
279
|
+
asm inspect code-review -s global ${H.dim("Global installations only")}`)}function sG(){console.log(`${H.bold("Usage:")} asm uninstall <skill-name> [options]
|
|
277
280
|
|
|
278
281
|
Remove a skill and its associated rule files. Shows a removal plan
|
|
279
282
|
before proceeding and asks for confirmation.
|
|
@@ -287,7 +290,7 @@ ${H.bold("Options:")}
|
|
|
287
290
|
${H.bold("Examples:")}
|
|
288
291
|
asm uninstall code-review ${H.dim("Remove with confirmation")}
|
|
289
292
|
asm uninstall code-review -y ${H.dim("Remove without confirmation")}
|
|
290
|
-
asm uninstall code-review -s project ${H.dim("Remove project copy only")}`)}function
|
|
293
|
+
asm uninstall code-review -s project ${H.dim("Remove project copy only")}`)}function oG(){console.log(`${H.bold("Usage:")} asm audit [subcommand] [options]
|
|
291
294
|
|
|
292
295
|
Detect duplicate skills or run security audits on installed/remote skills.
|
|
293
296
|
|
|
@@ -311,7 +314,7 @@ ${H.bold("Examples:")}
|
|
|
311
314
|
asm audit security --all ${H.dim("Audit all installed skills")}
|
|
312
315
|
asm audit security code-review --json ${H.dim("Output audit as JSON")}
|
|
313
316
|
asm audit security https://github.com/user/skills/tree/main/skills/agent-config
|
|
314
|
-
${H.dim("Audit a skill from a subfolder URL")}`)}function
|
|
317
|
+
${H.dim("Audit a skill from a subfolder URL")}`)}function rG(){console.log(`${H.bold("Usage:")} asm config <subcommand>
|
|
315
318
|
|
|
316
319
|
Manage configuration. Config is stored at ~/.config/agent-skill-manager/.
|
|
317
320
|
|
|
@@ -327,20 +330,18 @@ ${H.bold("Options:")}
|
|
|
327
330
|
${H.bold("Examples:")}
|
|
328
331
|
asm config show ${H.dim("View current config")}
|
|
329
332
|
asm config edit ${H.dim("Edit in $EDITOR")}
|
|
330
|
-
asm config reset -y ${H.dim("Reset without confirmation")}`)}async function
|
|
331
|
-
${H.yellow(`${U.length} skill${U.length===1?"":"s"} with warnings -- use --json for details`)}`;console.log(Q)}else console.log(
|
|
332
|
-
`)),q.flags.flat)console.log(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
`);let U
|
|
342
|
-
Summary:`)),z.dangerous>0)console.log(` ${H.red(`${z.dangerous} dangerous`)}`);if(z.warning>0)console.log(` ${H.yellow(`${z.warning} warning`)}`);if(z.caution>0)console.log(` ${z.caution} caution`);if(z.safe>0)console.log(` ${H.green(`${z.safe} safe`)}`);console.log("")}}async function dG(q,$){let Z=null;try{let X=g0($);if(X.isLocal)throw Error("Local paths are not supported for remote security audits. Use: asm audit security <installed-skill-name>");await k0(),X=await _$(X),console.error(`Cloning ${$} for audit...`),Z=await v0(X,q.flags.transport);let{join:Q}=await import("path"),U=X.subpath?Q(Z,X.subpath):Z,{name:z}=await R0(U),G=await U$(U,z,X.owner,X.repo);if(q.flags.json)console.log(b2(G));else console.log(z$(G))}catch(X){E(X.message),process.exit(1)}finally{if(Z)await n(Z)}}async function cG(q,$){let Z=await v(),Q=(await i(Z,q.flags.scope)).filter((G)=>G.dirName===$);if(Q.length===0)E(`Skill "${$}" not found. Use "asm list" to see installed skills.`),process.exit(1);let U=Q[0];console.error(`Auditing installed skill: ${H.bold(U.name)}...
|
|
343
|
-
`);let z=await U$(U.realPath,U.name);if(q.flags.json)console.log(b2(z));else console.log(z$(z))}async function lG(q){if(q.flags.help){xG();return}let $=q.subcommand;if(!$)E("Missing subcommand. Use: show, path, reset, or edit."),console.error('Run "asm config --help" for usage.'),process.exit(2);switch($){case"show":{let Z=await v();console.log(m(Z));break}case"path":{console.log(y2());break}case"reset":{if(!q.flags.yes){if(!process.stdin.isTTY)E("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`${H.bold("Reset config to defaults?")} [y/N] `);let X=await f0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Z=p4();await d4(Z),console.error(H.green("Config reset to defaults."));break}case"edit":{let Z=process.env.VISUAL||process.env.EDITOR||"vi",[X,Q]=Z5(Z),U=y2();await v();let{spawn:z}=await import("child_process");await new Promise((G,J)=>{let Y=z(X,[...Q,U],{stdio:"inherit"});Y.on("close",()=>G()),Y.on("error",J)});break}default:E(`Unknown config subcommand: "${$}". Use: show, path, reset, or edit.`),process.exit(2)}}function aG(){console.log(`${H.bold("Usage:")} asm install <source> [options]
|
|
333
|
+
asm config reset -y ${H.dim("Reset without confirmation")}`)}async function Y5(q){for(let $ of q)$.warnings=await H4($)}async function tG(q){if(q.flags.help){aG();return}let $=await v(),Z=await p($,q.flags.scope);if(q.flags.provider&&q.command==="list")Z=Z.filter((Q)=>Q.provider===q.flags.provider);await Y5(Z);let X=x2(Z,q.flags.sort);if(q.flags.json)console.log(d(X));else if(q.flags.flat){let Q=g2(X),U=X.filter((z)=>z.warnings&&z.warnings.length>0);if(U.length>0)Q+=`
|
|
334
|
+
${H.yellow(`${U.length} skill${U.length===1?"":"s"} with warnings -- use --json for details`)}`;console.log(Q)}else console.log(q5(X))}async function eG(q){if(q.flags.help){nG();return}let $=q.subcommand;if(!$)E("Missing required argument: <query>"),console.error('Run "asm search --help" for usage.'),process.exit(2);let Z=!q.flags.available,X=!q.flags.installed,Q=[];if(Z){let J=await v(),Y=await p(J,q.flags.scope);if(q.flags.provider)Y=Y.filter((V)=>V.provider===q.flags.provider);let B=i4(Y,$);Q=x2(B,q.flags.sort)}let U=[];if(X){if(U=await Y$($),Q.length>0){let J=new Set(Q.map((Y)=>Y.name.toLowerCase()));U=U.filter((Y)=>!J.has(Y.skill.name.toLowerCase()))}}if(q.flags.json){let J=Q.map((B)=>({name:B.name,description:B.description,version:B.version,scope:B.scope,provider:B.provider,status:"installed"})),Y=U.map((B)=>({name:B.skill.name,description:B.skill.description,version:B.skill.version,repo:`${B.repo.owner}/${B.repo.repo}`,installCommand:`asm install ${B.skill.installUrl}`,status:"available"}));console.log(d([...J,...Y]));return}let z=Q.length>0,G=U.length>0;if(!z&&!G){console.error(`No skills matching "${$}".`),console.error(H.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(z)if(console.error(H.bold(`Installed skills matching "${$}":
|
|
335
|
+
`)),q.flags.flat)console.log(g2(Q));else console.log($5(Q,$));if(G){if(z)console.error("");let J=Z5(U.map((Y)=>({name:Y.skill.name,version:Y.skill.version,description:Y.skill.description,verified:Y.skill.verified,repoLabel:`${Y.repo.owner}/${Y.repo.repo}`,installUrl:Y.skill.installUrl})),$);console.error(J)}}async function qJ(q){if(q.flags.help){iG();return}let $=q.subcommand;if(!$)E("Missing required argument: <skill-name>"),console.error('Run "asm inspect --help" for usage.'),process.exit(2);let Z=await v(),Q=(await p(Z,q.flags.scope)).filter((U)=>U.dirName===$);if(Q.length===0)E(`Skill "${$}" not found.`),console.error(H.dim(`Try ${H.bold("asm list")} to see all skills or ${H.bold(`asm search "${$}"`)} to search.`)),process.exit(1);if(await Y5(Q),q.flags.json)console.log(d(Q.length===1?Q[0]:Q));else console.log(await X5(Q))}async function $J(q){if(q.flags.help){sG();return}let $=q.subcommand;if(!$)E("Missing required argument: <skill-name>"),console.error('Run "asm uninstall --help" for usage.'),process.exit(2);let Z=await v(),X=await p(Z,q.flags.scope),Q=o4($,X,Z),U=await r4(Q);if(U.length===0)E(`Skill "${$}" not found or nothing to remove.`),process.exit(1);console.error(H.bold("Removal plan:"));for(let G of U)console.error(` ${H.red("•")} ${e4(G)}`);if(!q.flags.yes){if(!process.stdin.isTTY)E("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`
|
|
336
|
+
${H.bold("Proceed with removal?")} [y/N] `);let G=await K0();if(G.toLowerCase()!=="y"&&G.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let z=await h2(Q);for(let G of z)console.error(G);try{await E4($)}catch{}console.error(H.green(`
|
|
337
|
+
Done.`))}function K0(){return new Promise((q)=>{let $="",Z=!1;function X(){process.stdin.removeListener("data",U),process.stdin.removeListener("end",z),process.stdin.pause(),clearTimeout(G)}function Q(J){if(Z)return;Z=!0,X(),q(J)}function U(J){if($+=J,$.includes(`
|
|
338
|
+
`))Q($.trim())}function z(){Q($.trim())}let G=setTimeout(()=>{Q($.trim())},30000);process.stdin.setEncoding("utf-8"),process.stdin.on("data",U),process.stdin.on("end",z),process.stdin.resume()})}async function ZJ(q){if(q.flags.help){oG();return}let $=q.subcommand??"duplicates";if($==="security"){await XJ(q);return}if($!=="duplicates")E(`Unknown audit subcommand: "${$}". Use: duplicates, security`),process.exit(2);let Z=await v(),X=await p(Z,"both"),Q=k2(X);if(q.flags.json){console.log(G5(Q));return}if(console.log(z5(Q)),q.flags.yes&&Q.duplicateGroups.length>0){console.error(H.bold(`
|
|
339
|
+
Auto-removing duplicates...`));for(let U of Q.duplicateGroups){let z=U5(U.instances),G=z[0].path;for(let J=1;J<z.length;J++){let Y=z[J],B=s4(Y,Z),V=await h2(B,G);for(let W of V)console.error(W)}}console.error(H.green(`
|
|
340
|
+
Done.`))}}async function XJ(q){let $=q.positional[0];if(q.flags.all)await QJ(q);else if(!$)E(`Missing target. Provide a skill name, GitHub source, or use --all.
|
|
341
|
+
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2);else if($.startsWith("github:")||$.startsWith("https://github.com/"))await UJ(q,$);else await zJ(q,$)}async function QJ(q){let $=await v(),Z=await p($,q.flags.scope);if(Z.length===0){if(q.flags.json)console.log("[]");else console.log("No skills found to audit.");return}let X=new Set,Q=Z.filter((z)=>{if(X.has(z.realPath))return!1;return X.add(z.realPath),!0});console.error(`Auditing ${Q.length} skill${Q.length>1?"s":""}...
|
|
342
|
+
`);let U=[];for(let z of Q){console.error(` Scanning ${H.bold(z.name)}...`);let G=await z$(z.realPath,z.name);U.push(G)}if(q.flags.json)console.log(JSON.stringify(U,null,2));else{for(let G of U)console.log(G$(G));let z={safe:0,caution:0,warning:0,dangerous:0};for(let G of U)z[G.verdict]++;if(console.log(H.bold(`
|
|
343
|
+
Summary:`)),z.dangerous>0)console.log(` ${H.red(`${z.dangerous} dangerous`)}`);if(z.warning>0)console.log(` ${H.yellow(`${z.warning} warning`)}`);if(z.caution>0)console.log(` ${z.caution} caution`);if(z.safe>0)console.log(` ${H.green(`${z.safe} safe`)}`);console.log("")}}async function UJ(q,$){let Z=null;try{let X=g0($);if(X.isLocal)throw Error("Local paths are not supported for remote security audits. Use: asm audit security <installed-skill-name>");await v0(),X=await _$(X),console.error(`Cloning ${$} for audit...`),Z=await u0(X,q.flags.transport);let{join:Q}=await import("path"),U=X.subpath?Q(Z,X.subpath):Z,{name:z}=await M0(U),G=await z$(U,z,X.owner,X.repo);if(q.flags.json)console.log(b2(G));else console.log(G$(G))}catch(X){E(X.message),process.exit(1)}finally{if(Z)await i(Z)}}async function zJ(q,$){let Z=await v(),Q=(await p(Z,q.flags.scope)).filter((G)=>G.dirName===$);if(Q.length===0)E(`Skill "${$}" not found. Use "asm list" to see installed skills.`),process.exit(1);let U=Q[0];console.error(`Auditing installed skill: ${H.bold(U.name)}...
|
|
344
|
+
`);let z=await z$(U.realPath,U.name);if(q.flags.json)console.log(b2(z));else console.log(G$(z))}async function GJ(q){if(q.flags.help){rG();return}let $=q.subcommand;if(!$)E("Missing subcommand. Use: show, path, reset, or edit."),console.error('Run "asm config --help" for usage.'),process.exit(2);switch($){case"show":{let Z=await v();console.log(d(Z));break}case"path":{console.log(y2());break}case"reset":{if(!q.flags.yes){if(!process.stdin.isTTY)E("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`${H.bold("Reset config to defaults?")} [y/N] `);let X=await K0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Z=a4();await n4(Z),console.error(H.green("Config reset to defaults."));break}case"edit":{let Z=process.env.VISUAL||process.env.EDITOR||"vi",[X,Q]=J5(Z),U=y2();await v();let{spawn:z}=await import("child_process");await new Promise((G,J)=>{let Y=z(X,[...Q,U],{stdio:"inherit"});Y.on("close",()=>G()),Y.on("error",J)});break}default:E(`Unknown config subcommand: "${$}". Use: show, path, reset, or edit.`),process.exit(2)}}function JJ(){console.log(`${H.bold("Usage:")} asm install <source> [options]
|
|
344
345
|
|
|
345
346
|
Install a skill from a GitHub repository or a local folder path.
|
|
346
347
|
|
|
@@ -403,23 +404,23 @@ ${H.bold("Subfolder URL:")}
|
|
|
403
404
|
${H.bold("Vercel skills CLI:")}
|
|
404
405
|
asm install github:user/skills --method vercel --skill my-skill
|
|
405
406
|
asm install https://github.com/user/skills -m vercel --skill my-skill -y
|
|
406
|
-
${H.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function
|
|
407
|
-
${H.bold("Install preview:")}`),console.info(` ${H.bold("Name:")} ${z.name}`),console.info(` ${H.bold("Version:")} ${z.version}`),z.description)console.info(` ${H.bold("Description:")} ${H.dim(z.description)}`);if(z.effort)console.info(` ${H.bold("Effort:")} ${
|
|
407
|
+
${H.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function YJ(q,$,Z,X,Q,U,z,G,J="global"){let Y=await M0(X),B=await s2(X),V=X===Z?null:X.split("/").pop(),W=Q||V||$.repo,O=k0(W),F=G.find((N)=>N.name.toLowerCase()===Y.name.toLowerCase()&&N.provider===z.name),_,T=!!F;if(F)if(F.version===Y.version)_=q.flags.force?"REINSTALL":`UPDATE: ${F.version} (same version)`;else _=`UPDATE: ${F.version} → ${Y.version}`;else _="NEW";let L=q1($,Z,X,O,z,q.flags.force||T,J),M=B.some((N)=>["Shell commands","Code execution","Credentials"].includes(N.category)),R=B.some((N)=>["External URLs"].includes(N.category)),D=M?"high":R?"medium":"safe",w=M?H.red("[!] High Risk"):R?H.yellow("[~] Medium Risk"):H.green("[ok] Safe");return{metadata:Y,skillName:O,warnings:B,installStatus:_,riskLevel:D,riskLabel:w,plan:L}}function HJ(q,$,Z,X,Q,U){let{metadata:z,warnings:G,installStatus:J,riskLabel:Y,plan:B}=q;if(Q&&U){let V=H.dim(`[${U.index}/${U.total}]`),W=J==="NEW"?H.green(`[${J}]`):H.yellow(`[${J}]`);console.info(`${V} ${H.bold(z.name)} v${z.version} ${W} ${Y}`)}else{let V=J==="NEW"?H.green(`[${J}]`):H.yellow(`[${J}]`);if(console.info(` ${H.bold(z.name)} v${z.version} ${V}`),console.info(`
|
|
408
|
+
${H.bold("Install preview:")}`),console.info(` ${H.bold("Name:")} ${z.name}`),console.info(` ${H.bold("Version:")} ${z.version}`),z.description)console.info(` ${H.bold("Description:")} ${H.dim(z.description)}`);if(z.effort)console.info(` ${H.bold("Effort:")} ${t4(z.effort)}`);if(console.info(` ${H.bold("Source:")} ${$}`),X)console.info(` ${H.bold("Tool:")} All (${X.map((W)=>W.label).join(", ")})`),console.info(` ${H.bold("Primary:")} ${Z.label} (${Z.name})`),console.info(` ${H.bold("Symlinks:")} ${X.filter((W)=>W.name!==Z.name).map((W)=>W.label).join(", ")}`);else console.info(` ${H.bold("Tool:")} ${Z.label} (${Z.name})`);if(console.info(` ${H.bold("Scope:")} ${B.scope==="project"?"Project":"Global"}`),console.info(` ${H.bold("Target:")} ${B.targetDir}`),console.info(` ${H.bold("Status:")} ${V}`),console.info(` ${H.bold("Risk:")} ${Y}`),G.length>0){console.info(`
|
|
408
409
|
${H.bold("Security warnings:")}`);let W=new Map;for(let O of G){let F=W.get(O.category)||[];F.push(O),W.set(O.category,F)}for(let[O,F]of W){let T=["Shell commands","Code execution","Credentials"].includes(O)?H.red(`[${O}]`):H.yellow(`[${O}]`);console.info(`
|
|
409
|
-
${T} ${H.dim(`(${F.length} match${F.length>1?"es":""})`)}`);for(let
|
|
410
|
-
${H.cyan(`[Step ${Q}/${X}]`)} ${H.bold(G)}`},z=()=>{if(Z)
|
|
411
|
-
`);for(let b=0;b<
|
|
410
|
+
${T} ${H.dim(`(${F.length} match${F.length>1?"es":""})`)}`);for(let L of F.slice(0,5))console.info(` ${H.dim(`${L.file}:${L.line}`)} -- ${L.match}`);if(F.length>5)console.info(H.dim(` ... and ${F.length-5} more`))}}}}async function VJ(q,$){if($)return await o2(q,$);return await O$(q)}async function WJ(q){if(q.flags.help){JJ();return}let $=q.subcommand;if(!$)E("Missing required argument: <source>"),console.error('Run "asm install --help" for usage.'),process.exit(2);let Z=null,X=8,Q=0,U=(G)=>{return Q++,`
|
|
411
|
+
${H.cyan(`[Step ${Q}/${X}]`)} ${H.bold(G)}`},z=()=>{if(Z)i(Z).finally(()=>process.exit(1));else process.exit(1)};process.on("SIGINT",z),process.on("SIGTERM",z);try{console.info(U("Parsing source"));let G=g0($),J=!!G.isLocal;if(J){let I=G.localPath;console.info(` ${H.dim(`local: ${I}`)}`);let{stat:K}=await import("fs/promises");try{if(!(await K(I)).isDirectory())throw Error(`Path is not a directory: ${I}`)}catch(C){if(C.code==="ENOENT")throw Error(`Path does not exist: ${I}`);throw C}}else await v0(),G=await _$(G),console.info(` ${H.dim($)}`);if(q.flags.method==="vercel"){console.info(U("Installing via Vercel skills CLI")),await r2();let I=e2(G),K=q.flags.path||null;console.info(` ${H.dim(`npx skills add ${I}${K?` --skill ${K}`:""}`)}`);let{stdout:C,stderr:j}=await t2(I,K);if(C.trim())console.info(` ${H.dim(C.trim())}`);if(j.trim())console.error(` ${H.dim(j.trim())}`);console.info(` ${H.green("✓")} Vercel skills CLI install completed`),q.flags.force=!0,console.info(` ${H.dim("Continuing with asm install to register in local inventory...")}`)}console.info(U("Selecting provider"));let Y=await v(),{provider:B,allProviders:V}=await Tq(Y,q.flags.provider,!!process.stdin.isTTY);console.info(U("Selecting scope"));let W;if(q.flags.scope==="global"||q.flags.scope==="project")W=q.flags.scope,console.info(` ${H.dim(`scope: ${W}`)}${W==="global"?` (${B.global})`:` (${B.project})`}`);else if(!process.stdin.isTTY||q.flags.yes)W="global",console.info(` ${H.dim("scope: global (default)")} (${B.global})`);else{let I=[{label:`Global (${B.global})`,hint:"Available in all projects",checked:!0},{label:`Project (${B.project})`,hint:"Available only in this project",checked:!1}];console.info("");let K=await y0({items:I});if(K.length===0)throw Error("No scope selected. Aborting.");W=K[0]===0?"global":"project",console.info(` Selected: ${H.bold(W)} ${H.dim(`(${W==="global"?B.global:B.project})`)}`)}if(J)console.info(U("Reading local source")),console.info(` ${H.dim(G.localPath)}`),Z=null;else{console.info(U("Cloning repository"));let I=q.flags.transport,K=I==="ssh"?G.sshCloneUrl:I==="https"?G.cloneUrl:`${G.cloneUrl} ${H.dim("(auto)")}`;console.info(` ${K}${G.ref?` ${H.dim(`(ref: ${G.ref})`)}`:""}${G.subpath?` ${H.dim(`(path: ${G.subpath})`)}`:""}`),Z=await u0(G,I)}let O=J?G.localPath:Z;console.info(U("Scanning for skills"));let{join:F}=await import("path"),_=[],T=q.flags.path||G.subpath,L=[];if(T){let I=F(O,T);try{await M0(I)}catch{throw Error(`No SKILL.md found at path "${T}" in the repository.`)}console.info(` Found skill at ${H.bold(T)}`),L=[{skillDir:I,nameOverride:q.flags.name}]}else{let I=!1;try{await M0(O),I=!0}catch{}if(I){let K=await M0(O);console.info(` Found: ${H.bold(K.name)} v${K.version}`),L=[{skillDir:O,nameOverride:q.flags.name}]}else{console.info(" No SKILL.md at root. Scanning subdirectories...");let K=await Oq(O);if(K.length===0)throw Error("No skills found in this repository. Skills must have a SKILL.md file.");console.info(` Found ${H.bold(String(K.length))} skill(s):
|
|
412
|
+
`);for(let b=0;b<K.length;b++){let f=H.cyan(` ${String(b+1).padStart(String(K.length).length)})`);if(console.info(`${f} ${H.bold(K[b].name)} ${H.dim(`v${K[b].version}`)} ${H.dim(`(${K[b].relPath})`)}`),K[b].description)console.info(` ${H.dim(K[b].description)}`)}console.info(U("Selecting skills")),Q--;let C;if(q.flags.all&&(q.flags.yes||!process.stdin.isTTY))C=K.map((b)=>b.relPath),console.info(` Selected all ${H.bold(String(C.length))} skills`);else if(process.stdin.isTTY)if(K.length===1)C=[K[0].relPath],console.info(` Auto-selected: ${H.bold(K[0].name)} ${H.dim(`v${K[0].version}`)}`);else{let b=K.map((h)=>({label:h.name,hint:`v${h.version}${h.description?" "+h.description:""}`,checked:!!q.flags.all}));console.info("");let f=await y0({items:b});if(f.length===0)throw Error("No skills selected. Aborting.");C=f.map((h)=>K[h].relPath),console.info(` Selected ${H.bold(String(C.length))} skill(s)`)}else{E(`Repository contains ${K.length} skills. Use --path <subdir> to pick one or --all to install all.
|
|
412
413
|
Available skills:
|
|
413
|
-
${
|
|
414
|
-
`)}`),process.exit(2);return}let j=
|
|
415
|
-
`),
|
|
414
|
+
${K.map((b)=>` --path ${b.relPath}`).join(`
|
|
415
|
+
`)}`),process.exit(2);return}let j=i2(C);if(j.length>0){let b=j.map((h)=>` - ${h.name}: ${h.paths.map((q0)=>`"${q0}"`).join(", ")}`).join(`
|
|
416
|
+
`),f=Error(`Duplicate skill names detected in selection:
|
|
416
417
|
${b}
|
|
417
|
-
Choose one path per skill name or install with --path.`);throw
|
|
418
|
-
${H.red("[!]")} ${H.bold(`Install ${
|
|
419
|
-
${H.bold(`Install ${
|
|
418
|
+
Choose one path per skill name or install with --path.`);throw f.duplicates=j,f}L=C.map((b)=>({skillDir:F(O,b),nameOverride:C.length===1?q.flags.name:null})),Q++}}console.info(U("Inspecting skills"));let M=await p(Y,"both"),R=[],D=L.length>1;for(let I=0;I<L.length;I++){let{skillDir:K,nameOverride:C}=L[I],j=await YJ(q,G,O,K,C,Y,B,M,W);R.push(j),HJ(j,$,B,V,D,D?{index:I+1,total:L.length}:void 0)}if(D){if(console.info(""),console.info(` ${H.bold("Install settings:")}`),console.info(` ${H.bold("Source:")} ${$}`),V)console.info(` ${H.bold("Tool:")} All (${V.map((b)=>b.label).join(", ")})`);else console.info(` ${H.bold("Tool:")} ${B.label} (${B.name})`);console.info(` ${H.bold("Scope:")} ${W==="project"?"Project":"Global"}`);let I=R.filter((b)=>b.riskLevel==="high").length,K=R.filter((b)=>b.riskLevel==="medium").length,C=R.filter((b)=>b.riskLevel==="safe").length,j=[];if(C>0)j.push(H.green(`${C} Safe`));if(K>0)j.push(H.yellow(`${K} Medium Risk`));if(I>0)j.push(H.red(`${I} High Risk`));console.info(` ${H.bold("Risk:")} ${j.join(", ")}`)}if(console.info(U("Installing")),!q.flags.yes){let I=R.some((b)=>b.riskLevel==="high");if(!process.stdin.isTTY)E("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);let K=D?`${R.length} skills`:`"${R[0].metadata.name}"`,C=I?`
|
|
419
|
+
${H.red("[!]")} ${H.bold(`Install ${K}? Some have high-risk patterns.`)} [y/N] `:`
|
|
420
|
+
${H.bold(`Install ${K}?`)} [Y/n] `;process.stderr.write(C);let j=await K0();if(I){if(j.toLowerCase()!=="y"&&j.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}else if(j.toLowerCase()==="n"||j.toLowerCase()==="no")console.error("Aborted."),process.exit(0)}let w=Z?await y4(Z):null,N=[];for(let I=0;I<R.length;I++){let K=R[I],C=D?H.dim(`[${I+1}/${R.length}]`)+" ":" ";try{console.info(`${C}Installing ${H.bold(K.metadata.name)}...`);let j=await VJ(K.plan,V);_.push(j),console.info(`${C}${H.green("✓")} ${K.metadata.name} installed to ${H.dim(K.plan.targetDir)}`);try{let b=J?`local:${G.localPath}`:`github:${G.owner}/${G.repo}`;await S4(j.name,{source:b,commitHash:w||"unknown",ref:G.ref||"main",installedAt:new Date().toISOString(),provider:K.plan.providerName})}catch{}}catch(j){N.push({name:K.metadata.name,error:j.message}),console.error(`${C}${H.red("✗")} ${H.bold(K.metadata.name)} — ${H.red(j.message)}`)}}if(process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),N.length>0){console.error(`
|
|
420
421
|
${H.yellow(`${N.length} skill(s) failed to install:`)}`);for(let I of N)console.error(` ${H.red("✗")} ${I.name}: ${I.error}`)}if(q.flags.json)console.log(JSON.stringify(_.length===1?_[0]:_,null,2));else if(_.length===1)console.error(H.green(`
|
|
421
422
|
Done! Installed "${_[0].name}" to ${_[0].path}`));else if(_.length>0)console.error(`
|
|
422
|
-
${H.green(`Done! Installed ${_.length} skill(s) successfully.`)}`)}catch(G){if(process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),q.flags.json){let J={success:!1,error:G.message};if(G?.duplicates)J.duplicates=G.duplicates;console.log(JSON.stringify(J,null,2))}else E(G.message);process.exit(1)}finally{if(Z)await
|
|
423
|
+
${H.green(`Done! Installed ${_.length} skill(s) successfully.`)}`)}catch(G){if(process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),q.flags.json){let J={success:!1,error:G.message};if(G?.duplicates)J.duplicates=G.duplicates;console.log(JSON.stringify(J,null,2))}else E(G.message);process.exit(1)}finally{if(Z)await i(Z)}}function BJ(){console.log(`${H.bold("Usage:")} asm export [options]
|
|
423
424
|
|
|
424
425
|
Export skill inventory as a portable JSON manifest. Useful for backup,
|
|
425
426
|
sharing, or scripting.
|
|
@@ -432,7 +433,31 @@ ${H.bold("Options:")}
|
|
|
432
433
|
${H.bold("Examples:")}
|
|
433
434
|
asm export ${H.dim("Export all skills")}
|
|
434
435
|
asm export -s global ${H.dim("Export global skills only")}
|
|
435
|
-
asm export > skills.json ${H.dim("Save to file")}`)}async function
|
|
436
|
+
asm export > skills.json ${H.dim("Save to file")}`)}async function _J(q){if(q.flags.help){BJ();return}let $=await v(),Z=await p($,q.flags.scope),X=V4(Z);console.log(JSON.stringify(X,null,2))}function OJ(){console.log(`${H.bold("Usage:")} asm import <file> [options]
|
|
437
|
+
|
|
438
|
+
Import skills from a previously exported JSON manifest. Recreates skill
|
|
439
|
+
installations based on the manifest metadata.
|
|
440
|
+
|
|
441
|
+
Skills that already exist at the target location are skipped unless --force
|
|
442
|
+
is used. Skills whose source files cannot be found locally are reported as
|
|
443
|
+
failed — install them first with "asm install".
|
|
444
|
+
|
|
445
|
+
${H.bold("Options:")}
|
|
446
|
+
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
447
|
+
-f, --force Overwrite existing skills
|
|
448
|
+
-y, --yes Skip confirmation prompt
|
|
449
|
+
--json Output results as JSON
|
|
450
|
+
--no-color Disable ANSI colors
|
|
451
|
+
-V, --verbose Show debug output
|
|
452
|
+
|
|
453
|
+
${H.bold("Examples:")}
|
|
454
|
+
asm import skills.json ${H.dim("Import from manifest")}
|
|
455
|
+
asm import skills.json --force ${H.dim("Overwrite existing skills")}
|
|
456
|
+
asm import skills.json -s global ${H.dim("Import only global skills")}
|
|
457
|
+
asm export > backup.json ${H.dim("Export first, then import later")}
|
|
458
|
+
asm import backup.json ${H.dim("Restore from backup")}`)}async function TJ(q){if(q.flags.help){OJ();return}let $=q.subcommand;if(!$)E("Missing required argument: <file>"),console.error('Run "asm import --help" for usage.'),process.exit(2);let{resolve:Z}=await import("path"),X=Z($),Q;try{Q=await O4(X)}catch(J){E(J.message),process.exit(1)}let U=Q.skills.length;if(U===0){if(q.flags.json)console.log(JSON.stringify({total:0,installed:0,skipped:0,failed:0,results:[]},null,2));else console.log("Manifest contains no skills. Nothing to import.");return}let z=q.flags.scope==="both"?"all scopes":q.flags.scope;if(console.error(`${H.bold("Importing")} ${U} skill${U>1?"s":""} from ${H.dim(X)}`),console.error(` Scope filter: ${z}`),q.flags.force)console.error(` ${H.yellow("Force mode: existing skills will be overwritten")}`);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
459
|
+
${H.bold("Proceed?")} [y/N] `);let J=await K0();if(J.toLowerCase()!=="y"&&J.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let G=await T4(Q,{force:q.flags.force,dryRun:!1,scopeFilter:q.flags.scope});if(q.flags.json){console.log(JSON.stringify(G,null,2));return}if(G.total===0){console.error(`
|
|
460
|
+
Nothing to import after scope filtering (--scope ${q.flags.scope}). All skills in the manifest were excluded.`);return}console.error("");for(let J of G.results){let Y=J.status==="installed"?H.green("+++"):J.status==="skipped"?H.yellow("---"):J.status==="dry-run"?H.cyan("~~~"):H.red("!!!"),B=J.reason?` ${H.dim(J.reason)}`:"",V=J.path?` ${H.dim(J.path)}`:"";console.error(` ${Y} ${J.skillName} (${J.provider}/${J.scope})${B}${V}`)}if(console.error(""),console.error(`${H.bold("Summary:")} ${G.total} total, ${H.green(String(G.installed))} installed, ${H.yellow(String(G.skipped))} skipped, ${H.red(String(G.failed))} failed`),G.failed>0)process.exitCode=1}function FJ(){console.log(`${H.bold("Usage:")} asm init <name> [options]
|
|
436
461
|
|
|
437
462
|
Scaffold a new skill directory with a SKILL.md template. Creates a
|
|
438
463
|
ready-to-edit skill in the target tool's skill folder.
|
|
@@ -447,8 +472,8 @@ ${H.bold("Options:")}
|
|
|
447
472
|
${H.bold("Examples:")}
|
|
448
473
|
asm init my-skill ${H.dim("Scaffold (interactive tool)")}
|
|
449
474
|
asm init my-skill -p claude ${H.dim("Scaffold in Claude Code")}
|
|
450
|
-
asm init my-skill --path ./skills ${H.dim("Scaffold in custom directory")}`)}async function
|
|
451
|
-
${H.bold("Overwrite?")} [y/N] `);let Q=await
|
|
475
|
+
asm init my-skill --path ./skills ${H.dim("Scaffold in custom directory")}`)}async function KJ(q){if(q.flags.help){FJ();return}let $=q.subcommand;if(!$)E("Missing required argument: <name>"),console.error('Run "asm init --help" for usage.'),process.exit(2);let Z=k0($),X;if(q.flags.path){let{resolve:Q}=await import("path");X=Q(q.flags.path)}else{let Q=await v(),{provider:U}=await Tq(Q,q.flags.provider,!!process.stdin.isTTY),{join:z}=await import("path"),{resolveProviderPath:G}=await import("./chunk-t6myftbf.js"),J=G(Q.providers.find((Y)=>Y.name===U.name).global);X=z(J,Z)}if(await K4(X)){if(!q.flags.force){if(!process.stdin.isTTY)E(`Directory already exists: ${X}. Use --force to overwrite.`),process.exit(2);process.stderr.write(`${H.yellow(`Directory already exists: ${X}`)}
|
|
476
|
+
${H.bold("Overwrite?")} [y/N] `);let Q=await K0();if(Q.toLowerCase()!=="y"&&Q.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}}await F4(Z,X),console.error(H.green(`Done! Created skill "${Z}" at ${X}`))}function LJ(){console.log(`${H.bold("Usage:")} asm stats [options]
|
|
452
477
|
|
|
453
478
|
Show aggregate skill metrics with provider distribution charts,
|
|
454
479
|
scope breakdown, disk usage, and duplicate summary.
|
|
@@ -462,7 +487,7 @@ ${H.bold("Options:")}
|
|
|
462
487
|
${H.bold("Examples:")}
|
|
463
488
|
asm stats ${H.dim("Show full dashboard")}
|
|
464
489
|
asm stats -s global ${H.dim("Global skills only")}
|
|
465
|
-
asm stats --json ${H.dim("Output raw data as JSON")}`)}async function
|
|
490
|
+
asm stats --json ${H.dim("Output raw data as JSON")}`)}async function RJ(q){if(q.flags.help){LJ();return}let $=await v(),Z=await p($,q.flags.scope);if(Z.length===0){console.log("No skills found.");return}let X=k2(Z),Q=await M4(Z,X);if(q.flags.json)if(!q.flags.verbose){let{perSkillDiskBytes:U,...z}=Q;console.log(d(z))}else console.log(d(Q));else console.log(A4(Q))}function MJ(){console.log(`${H.bold("Usage:")} asm link <path> [options]
|
|
466
491
|
|
|
467
492
|
Symlink a local skill directory into an agent's skill folder. Useful
|
|
468
493
|
for local development — changes to the source are reflected immediately.
|
|
@@ -478,8 +503,8 @@ ${H.bold("Options:")}
|
|
|
478
503
|
${H.bold("Examples:")}
|
|
479
504
|
asm link ./my-skill ${H.dim("Link (interactive tool)")}
|
|
480
505
|
asm link ./my-skill -p claude ${H.dim("Link to Claude Code")}
|
|
481
|
-
asm link ./my-skill --name alias ${H.dim("Link with custom name")}`)}async function
|
|
482
|
-
${H.bold("Overwrite?")} [y/N] `);let F=await
|
|
506
|
+
asm link ./my-skill --name alias ${H.dim("Link with custom name")}`)}async function AJ(q){if(q.flags.help){MJ();return}let $=q.subcommand;if(!$)E("Missing required argument: <path>"),console.error('Run "asm link --help" for usage.'),process.exit(2);let{resolve:Z,basename:X}=await import("path"),Q=Z($),U=await D4(Q),z=q.flags.name?k0(q.flags.name):X(Q),G=await v(),{provider:J}=await Tq(G,q.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:Y}=await import("./chunk-t6myftbf.js"),B=Y(G.providers.find((O)=>O.name===J.name).global),{join:V}=await import("path"),W=V(B,z);if(!q.flags.force){let O=!1;try{let{access:F}=await import("fs/promises");await F(W),O=!0}catch{}if(O){if(!process.stdin.isTTY)E(`Target already exists: ${W}. Use --force to overwrite.`),process.exit(2);process.stderr.write(`${H.yellow(`Target already exists: ${W}`)}
|
|
507
|
+
${H.bold("Overwrite?")} [y/N] `);let F=await K0();if(F.toLowerCase()!=="y"&&F.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0);await Q$(Q,B,z,!0)}else await Q$(Q,B,z,!1)}else await Q$(Q,B,z,!0);if(q.flags.json)console.log(d({success:!0,name:z,symlinkPath:W,targetPath:Q}));else console.error(H.green(`Done! Linked "${z}" -> ${Q}`)),console.error(` Symlink: ${W}`),console.error(H.dim(` If you move or delete the source, run "asm uninstall ${z}" to clean up.`))}function IJ(){console.log(`${H.bold("Usage:")} asm index <subcommand> [options]
|
|
483
508
|
|
|
484
509
|
Manage the skill index for searching available skills from indexed repos.
|
|
485
510
|
|
|
@@ -503,10 +528,10 @@ ${H.bold("Examples:")}
|
|
|
503
528
|
asm index search marketing --has license ${H.dim("Only with license")}
|
|
504
529
|
asm index search "" --missing creator ${H.dim("Skills missing creator")}
|
|
505
530
|
asm index list ${H.dim("List indexed repos")}
|
|
506
|
-
asm index remove obra/superpowers ${H.dim("Remove from index")}`)}async function
|
|
507
|
-
`));for(let z of U){let G=z.skill.verified?H.blue(" [verified]"):"";console.error(`${H.cyan(z.skill.name)} ${H.dim(`v${z.skill.version}`)}${G} ${H.dim(`[${z.repo.owner}/${z.repo.repo}]`)}`);for(let Y of
|
|
508
|
-
`)}}break}case"list":{let Z=await
|
|
509
|
-
`));for(let Q of Z)console.error(`${H.cyan(`${Q.owner}/${Q.repo}`)} - ${Q.skillCount} skills ${H.dim(`(${new Date(Q.updatedAt).toLocaleDateString()})`)}`)}break}case"remove":{let Z=q.positional[0];if(!Z)E("Missing required argument: <owner/repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let[X,Q]=Z.split("/");if(!X||!Q)E("Invalid format. Use: <owner/repo>"),process.exit(2);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`${H.bold("Remove")} ${H.cyan(`${X}/${Q}`)} ${H.bold("from index?")} [y/N] `);let z=await
|
|
531
|
+
asm index remove obra/superpowers ${H.dim("Remove from index")}`)}async function DJ(q){if(q.flags.help){IJ();return}let $=q.subcommand;if(!$)E("Missing subcommand. Use: ingest, search, list, or remove"),console.error('Run "asm index --help" for usage.'),process.exit(2);switch($){case"ingest":{let Z=q.positional[0];if(!Z)E("Missing required argument: <repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);console.error(H.blueBold(`Ingesting ${Z}...`));let X=await p4(Z);if(!X.success)E(`Failed to ingest: ${X.error}`),process.exit(1);if(X.repoIndex)if(q.flags.json)console.log(d({success:!0,owner:X.repoIndex.owner,repo:X.repoIndex.repo,skillCount:X.repoIndex.skillCount,updatedAt:X.repoIndex.updatedAt}));else console.error(H.green(`Successfully indexed ${X.repoIndex.owner}/${X.repoIndex.repo}`)),console.error(` Skills found: ${X.repoIndex.skillCount}`);break}case"search":{let Z=q.positional.join(" ");if(!Z&&q.flags.has.length===0&&q.flags.missing.length===0)E("Missing required argument: <query>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let X={};if(q.flags.has.length>0)X.has=q.flags.has;if(q.flags.missing.length>0)X.missing=q.flags.missing;let U=X.has||X.missing?await Y$(Z||"",20,X):await Y$(Z);if(U.length===0){if(q.flags.json)console.log(d([]));else console.info("No skills found matching your query."),console.error(H.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(q.flags.json)console.log(d(U.map((z)=>({name:z.skill.name,description:z.skill.description,version:z.skill.version,license:z.skill.license||"",creator:z.skill.creator||"",compatibility:z.skill.compatibility||"",allowedTools:z.skill.allowedTools||[],verified:z.skill.verified===!0,installUrl:z.skill.installUrl,installCommand:`asm install ${z.skill.installUrl}`,repo:`${z.repo.owner}/${z.repo.repo}`}))));else{console.error(H.bold(`Found ${U.length} skills:
|
|
532
|
+
`));for(let z of U){let G=z.skill.verified?H.blue(" [verified]"):"";console.error(`${H.cyan(z.skill.name)} ${H.dim(`v${z.skill.version}`)}${G} ${H.dim(`[${z.repo.owner}/${z.repo.repo}]`)}`);for(let Y of Q5(z.skill.description,80))console.error(` ${Y}`);let J=v4(z.skill);if(J.length>0)console.error(` ${H.yellow(`⚠ Missing: ${J.join(", ")}`)}`);console.error(` ${H.green(`asm install ${z.skill.installUrl}`)}
|
|
533
|
+
`)}}break}case"list":{let Z=await d4();if(Z.length===0){if(q.flags.json)console.log(d([]));else console.info("No repositories indexed."),console.error(H.dim("Add repos with: asm index ingest <repo>"));return}let X=await u4();if(q.flags.json)console.log(d(Z));else{console.error(H.bold(`Indexed Repositories (${X} total skills):
|
|
534
|
+
`));for(let Q of Z)console.error(`${H.cyan(`${Q.owner}/${Q.repo}`)} - ${Q.skillCount} skills ${H.dim(`(${new Date(Q.updatedAt).toLocaleDateString()})`)}`)}break}case"remove":{let Z=q.positional[0];if(!Z)E("Missing required argument: <owner/repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let[X,Q]=Z.split("/");if(!X||!Q)E("Invalid format. Use: <owner/repo>"),process.exit(2);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`${H.bold("Remove")} ${H.cyan(`${X}/${Q}`)} ${H.bold("from index?")} [y/N] `);let z=await K0();if(z.toLowerCase()!=="y"&&z.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}if(await c4(X,Q))console.error(H.green(`Removed ${X}/${Q} from index`));else E(`Repository not found in index: ${X}/${Q}`),process.exit(1);break}default:E(`Unknown subcommand: "${$}"`),console.error('Run "asm index --help" for usage.'),process.exit(2)}}async function H5(q){let $=cG(q);if($.flags.noColor)globalThis.__CLI_NO_COLOR=!0;if($.flags.verbose)l4(!0);if($.flags.version){console.log(`asm ${v2}`);return}if(!$.command&&$.flags.help){lG();return}if(!$.command)return;switch($.command){case"list":await tG($);break;case"search":await eG($);break;case"inspect":await qJ($);break;case"uninstall":await $J($);break;case"audit":await ZJ($);break;case"install":await WJ($);break;case"config":await GJ($);break;case"export":await _J($);break;case"import":await TJ($);break;case"init":await KJ($);break;case"stats":await RJ($);break;case"link":await AJ($);break;case"index":await DJ($);break;default:E(`Unknown command: "${$.command}"`),console.error('Run "asm --help" for usage.'),process.exit(2)}}function V5(q){let $=q.slice(2);if($.length===0)return!1;let Z=["list","search","inspect","uninstall","audit","config","install","export","import","init","stats","link","index"],X=$[0];if(Z.includes(X))return!0;if(X==="--help"||X==="-h")return!0;if(X==="--version"||X==="-v")return!0;if(X.startsWith("-")||X.length>0)return!0;return!1}if(V5(process.argv))await H5(process.argv);else if(!(typeof globalThis.Bun<"u")){let{spawn:$}=await import("child_process"),Z=$("bun",[process.argv[1],...process.argv.slice(2)],{stdio:"inherit"});Z.on("error",()=>{console.error(`The interactive TUI requires Bun (https://bun.sh).
|
|
510
535
|
Install it with: curl -fsSL https://bun.sh/install | bash
|
|
511
536
|
|
|
512
|
-
`+"CLI commands (list, search, inspect, etc.) work with Node.js — run: asm --help"),process.exit(1)}),Z.on("exit",(X)=>process.exit(X??0))}else await import("./chunk-
|
|
537
|
+
`+"CLI commands (list, search, inspect, etc.) work with Node.js — run: asm --help"),process.exit(1)}),Z.on("exit",(X)=>process.exit(X??0))}else await import("./chunk-6n912478.js");
|