agent-skill-manager 1.19.0 → 1.20.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.md +152 -27
- package/dist/agent-skill-manager.js +419 -304
- package/dist/{chunk-v3wdjh4r.js → chunk-2qybtcgb.js} +1 -1
- package/dist/{chunk-q3gm2x0a.js → chunk-b38qq69j.js} +1 -1
- package/dist/chunk-jexzjtx5.js +15 -0
- package/dist/{chunk-33wmae4f.js → chunk-w4et4kfd.js} +1 -1
- package/package.json +2 -2
- package/dist/chunk-d3ed4n6q.js +0 -14
|
@@ -1,164 +1,164 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as
|
|
3
|
-
`)}}
|
|
4
|
-
`)?
|
|
2
|
+
import{a as h0,b as Sq,c as T8,d as R8}from"./chunk-b38qq69j.js";import{A as M8,B as c,C as P1,D as j8,F as w8,G as D8,H as s5,I as C1,J as N8,e as W0,f as V0,g as g1,i,j as W8,k as w1,l as V8,m as B8,n as D1,o as K8,p as U,q as _8,r as L5,s as O8,t as N1,u as L8,v as F8,w as A8,z as I8}from"./chunk-jexzjtx5.js";import{K as u,L as N,M as h,N as Y8,O as C,P as U8,Q as bq,R as c5,S as xq,T as $8,U as $0,V as v,W as H8}from"./chunk-2qybtcgb.js";var k=N((WZ)=>{var i$=Symbol.for("yaml.alias"),i1=Symbol.for("yaml.document"),pq=Symbol.for("yaml.map"),o1=Symbol.for("yaml.pair"),o$=Symbol.for("yaml.scalar"),dq=Symbol.for("yaml.seq"),B0=Symbol.for("yaml.node.type"),XZ=(q)=>!!q&&typeof q==="object"&&q[B0]===i$,zZ=(q)=>!!q&&typeof q==="object"&&q[B0]===i1,JZ=(q)=>!!q&&typeof q==="object"&&q[B0]===pq,GZ=(q)=>!!q&&typeof q==="object"&&q[B0]===o1,a1=(q)=>!!q&&typeof q==="object"&&q[B0]===o$,YZ=(q)=>!!q&&typeof q==="object"&&q[B0]===dq;function s1(q){if(q&&typeof q==="object")switch(q[B0]){case pq:case dq:return!0}return!1}function UZ(q){if(q&&typeof q==="object")switch(q[B0]){case i$:case pq:case o$:case dq:return!0}return!1}var HZ=(q)=>(a1(q)||s1(q))&&!!q.anchor;WZ.ALIAS=i$;WZ.DOC=i1;WZ.MAP=pq;WZ.NODE_TYPE=B0;WZ.PAIR=o1;WZ.SCALAR=o$;WZ.SEQ=dq;WZ.hasAnchor=HZ;WZ.isAlias=XZ;WZ.isCollection=s1;WZ.isDocument=zZ;WZ.isMap=JZ;WZ.isNode=UZ;WZ.isPair=GZ;WZ.isScalar=a1;WZ.isSeq=YZ});var Jq=N((PZ)=>{var m=k(),n=Symbol("break visit"),r1=Symbol("skip children"),X0=Symbol("remove node");function cq(q,$){let Z=t1($);if(m.isDocument(q)){if(n0(null,q.contents,Z,Object.freeze([q]))===X0)q.contents=null}else n0(null,q,Z,Object.freeze([]))}cq.BREAK=n;cq.SKIP=r1;cq.REMOVE=X0;function n0(q,$,Z,Q){let X=e1(q,$,Z,Q);if(m.isNode(X)||m.isPair(X))return q9(q,Q,X),n0(q,X,Z,Q);if(typeof X!=="symbol"){if(m.isCollection($)){Q=Object.freeze(Q.concat($));for(let z=0;z<$.items.length;++z){let J=n0(z,$.items[z],Z,Q);if(typeof J==="number")z=J-1;else if(J===n)return n;else if(J===X0)$.items.splice(z,1),z-=1}}else if(m.isPair($)){Q=Object.freeze(Q.concat($));let z=n0("key",$.key,Z,Q);if(z===n)return n;else if(z===X0)$.key=null;let J=n0("value",$.value,Z,Q);if(J===n)return n;else if(J===X0)$.value=null}}return X}async function lq(q,$){let Z=t1($);if(m.isDocument(q)){if(await i0(null,q.contents,Z,Object.freeze([q]))===X0)q.contents=null}else await i0(null,q,Z,Object.freeze([]))}lq.BREAK=n;lq.SKIP=r1;lq.REMOVE=X0;async function i0(q,$,Z,Q){let X=await e1(q,$,Z,Q);if(m.isNode(X)||m.isPair(X))return q9(q,Q,X),i0(q,X,Z,Q);if(typeof X!=="symbol"){if(m.isCollection($)){Q=Object.freeze(Q.concat($));for(let z=0;z<$.items.length;++z){let J=await i0(z,$.items[z],Z,Q);if(typeof J==="number")z=J-1;else if(J===n)return n;else if(J===X0)$.items.splice(z,1),z-=1}}else if(m.isPair($)){Q=Object.freeze(Q.concat($));let z=await i0("key",$.key,Z,Q);if(z===n)return n;else if(z===X0)$.key=null;let J=await i0("value",$.value,Z,Q);if(J===n)return n;else if(J===X0)$.value=null}}return X}function t1(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 e1(q,$,Z,Q){if(typeof Z==="function")return Z(q,$,Q);if(m.isMap($))return Z.Map?.(q,$,Q);if(m.isSeq($))return Z.Seq?.(q,$,Q);if(m.isPair($))return Z.Pair?.(q,$,Q);if(m.isScalar($))return Z.Scalar?.(q,$,Q);if(m.isAlias($))return Z.Alias?.(q,$,Q);return}function q9(q,$,Z){let Q=$[$.length-1];if(m.isCollection(Q))Q.items[q]=Z;else if(m.isPair(Q))if(q==="key")Q.key=Z;else Q.value=Z;else if(m.isDocument(Q))Q.contents=Z;else{let X=m.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}PZ.visit=cq;PZ.visitAsync=lq});var a$=N((fZ)=>{var $9=k(),SZ=Jq(),bZ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},xZ=(q)=>q.replace(/[!,[\]{}]/g,($)=>bZ[$]);class s{constructor(q,$){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,q),this.tags=Object.assign({},s.defaultTags,$)}clone(){let q=new s(this.yaml,this.tags);return q.docStart=this.docStart,q}atDocument(){let q=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return q}add(q,$){if(this.atNextDocument)this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1;let Z=q.trim().split(/[ \t]+/),Q=Z.shift();switch(Q){case"%TAG":{if(Z.length!==2){if($(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[X,z]=Z;return this.tags[X]=z,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return $(0,"%YAML directive should contain exactly one part"),!1;let[X]=Z;if(X==="1.1"||X==="1.2")return this.yaml.version=X,!0;else{let z=/^\d+\.\d+$/.test(X);return $(6,`Unsupported YAML version ${X}`,z),!1}}default:return $(0,`Unknown directive ${Q}`,!0),!1}}tagName(q,$){if(q==="!")return"!";if(q[0]!=="!")return $(`Not a valid tag: ${q}`),null;if(q[1]==="<"){let z=q.slice(2,-1);if(z==="!"||z==="!!")return $(`Verbatim tags aren't resolved, so ${q} is invalid.`),null;if(q[q.length-1]!==">")$("Verbatim tags must end with a >");return z}let[,Z,Q]=q.match(/^(.*!)([^!]*)$/s);if(!Q)$(`The ${q} tag has no suffix`);let X=this.tags[Z];if(X)try{return X+decodeURIComponent(Q)}catch(z){return $(String(z)),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 $+xZ(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),Q;if(q&&Z.length>0&&$9.isNode(q.contents)){let X={};SZ.visit(q.contents,(z,J)=>{if($9.isNode(J)&&J.tag)X[J.tag]=!0}),Q=Object.keys(X)}else Q=[];for(let[X,z]of Z){if(X==="!!"&&z==="tag:yaml.org,2002:")continue;if(!q||Q.some((J)=>J.startsWith(z)))$.push(`%TAG ${X} ${z}`)}return $.join(`
|
|
3
|
+
`)}}s.defaultYaml={explicit:!1,version:"1.2"};s.defaultTags={"!!":"tag:yaml.org,2002:"};fZ.Directives=s});var nq=N((gZ)=>{var Z9=k(),kZ=Jq();function vZ(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 Q9(q){let $=new Set;return kZ.visit(q,{Value(Z,Q){if(Q.anchor)$.add(Q.anchor)}}),$}function X9(q,$){for(let Z=1;;++Z){let Q=`${q}${Z}`;if(!$.has(Q))return Q}}function hZ(q,$){let Z=[],Q=new Map,X=null;return{onAnchor:(z)=>{Z.push(z),X??(X=Q9(q));let J=X9($,X);return X.add(J),J},setAnchors:()=>{for(let z of Z){let J=Q.get(z);if(typeof J==="object"&&J.anchor&&(Z9.isScalar(J.node)||Z9.isCollection(J.node)))J.node.anchor=J.anchor;else{let G=Error("Failed to resolve repeated object (this should not happen)");throw G.source=z,G}}},sourceObjects:Q}}gZ.anchorIsValid=vZ;gZ.anchorNames=Q9;gZ.createNodeAnchors=hZ;gZ.findNewAnchor=X9});var s$=N((cZ)=>{function Gq(q,$,Z,Q){if(Q&&typeof Q==="object")if(Array.isArray(Q))for(let X=0,z=Q.length;X<z;++X){let J=Q[X],G=Gq(q,Q,String(X),J);if(G===void 0)delete Q[X];else if(G!==J)Q[X]=G}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let z=Q.get(X),J=Gq(q,Q,X,z);if(J===void 0)Q.delete(X);else if(J!==z)Q.set(X,J)}else if(Q instanceof Set)for(let X of Array.from(Q)){let z=Gq(q,Q,X,X);if(z===void 0)Q.delete(X);else if(z!==X)Q.delete(X),Q.add(z)}else for(let[X,z]of Object.entries(Q)){let J=Gq(q,Q,X,z);if(J===void 0)delete Q[X];else if(J!==z)Q[X]=J}return q.call($,Z,Q)}cZ.applyReviver=Gq});var O0=N((iZ)=>{var nZ=k();function z9(q,$,Z){if(Array.isArray(q))return q.map((Q,X)=>z9(Q,String(X),Z));if(q&&typeof q.toJSON==="function"){if(!Z||!nZ.hasAnchor(q))return q.toJSON($,Z);let Q={aliasCount:0,count:1,res:void 0};Z.anchors.set(q,Q),Z.onCreate=(z)=>{Q.res=z,delete Z.onCreate};let X=q.toJSON($,Z);if(Z.onCreate)Z.onCreate(X);return X}if(typeof q==="bigint"&&!Z?.keep)return Number(q);return q}iZ.toJS=z9});var iq=N((rZ)=>{var aZ=s$(),J9=k(),sZ=O0();class G9{constructor(q){Object.defineProperty(this,J9.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:Q,reviver:X}={}){if(!J9.isDocument(q))throw TypeError("A document argument is required");let z={anchors:new Map,doc:q,keep:!0,mapAsMap:$===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},J=sZ.toJS(this,"",z);if(typeof Q==="function")for(let{count:G,res:Y}of z.anchors.values())Q(Y,G);return typeof X==="function"?aZ.applyReviver(X,{"":J},"",J):J}}rZ.NodeBase=G9});var Yq=N((Q6)=>{var eZ=nq(),q6=Jq(),o0=k(),$6=iq(),Z6=O0();class Y9 extends $6.NodeBase{constructor(q){super(o0.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=[],q6.visit(q,{Node:(X,z)=>{if(o0.isAlias(z)||o0.hasAnchor(z))Z.push(z)}}),$)$.aliasResolveCache=Z;let Q=void 0;for(let X of Z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON(q,$){if(!$)return{source:this.source};let{anchors:Z,doc:Q,maxAliasCount:X}=$,z=this.resolve(Q,$);if(!z){let G=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(G)}let J=Z.get(z);if(!J)Z6.toJS(z,null,$),J=Z.get(z);if(J?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(X>=0){if(J.count+=1,J.aliasCount===0)J.aliasCount=oq(Q,z,Z);if(J.count*J.aliasCount>X)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return J.res}toString(q,$,Z){let Q=`*${this.source}`;if(q){if(eZ.anchorIsValid(this.source),q.options.verifyAliasOrder&&!q.anchors.has(this.source)){let X=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(X)}if(q.implicitKey)return`${Q} `}return Q}}function oq(q,$,Z){if(o0.isAlias($)){let Q=$.resolve(q),X=Z&&Q&&Z.get(Q);return X?X.count*X.aliasCount:0}else if(o0.isCollection($)){let Q=0;for(let X of $.items){let z=oq(q,X,Z);if(z>Q)Q=z}return Q}else if(o0.isPair($)){let Q=oq(q,$.key,Z),X=oq(q,$.value,Z);return Math.max(Q,X)}return 1}Q6.Alias=Y9});var g=N((U6)=>{var z6=k(),J6=iq(),G6=O0(),Y6=(q)=>!q||typeof q!=="function"&&typeof q!=="object";class E0 extends J6.NodeBase{constructor(q){super(z6.SCALAR);this.value=q}toJSON(q,$){return $?.keep?this.value:G6.toJS(this.value,q,$)}toString(){return String(this.value)}}E0.BLOCK_FOLDED="BLOCK_FOLDED";E0.BLOCK_LITERAL="BLOCK_LITERAL";E0.PLAIN="PLAIN";E0.QUOTE_DOUBLE="QUOTE_DOUBLE";E0.QUOTE_SINGLE="QUOTE_SINGLE";U6.Scalar=E0;U6.isScalarValue=Y6});var Uq=N((O6)=>{var V6=Yq(),S0=k(),U9=g(),B6="tag:yaml.org,2002:";function K6(q,$,Z){if($){let Q=Z.filter((z)=>z.tag===$),X=Q.find((z)=>!z.format)??Q[0];if(!X)throw Error(`Tag ${$} not found`);return X}return Z.find((Q)=>Q.identify?.(q)&&!Q.format)}function _6(q,$,Z){if(S0.isDocument(q))q=q.contents;if(S0.isNode(q))return q;if(S0.isPair(q)){let W=Z.schema[S0.MAP].createNode?.(Z.schema,null,Z);return W.items.push(q),W}if(q instanceof String||q instanceof Number||q instanceof Boolean||typeof BigInt<"u"&&q instanceof BigInt)q=q.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:z,schema:J,sourceObjects:G}=Z,Y=void 0;if(Q&&q&&typeof q==="object")if(Y=G.get(q),Y)return Y.anchor??(Y.anchor=X(q)),new V6.Alias(Y.anchor);else Y={anchor:null,node:null},G.set(q,Y);if($?.startsWith("!!"))$=B6+$.slice(2);let H=K6(q,$,J.tags);if(!H){if(q&&typeof q.toJSON==="function")q=q.toJSON();if(!q||typeof q!=="object"){let W=new U9.Scalar(q);if(Y)Y.node=W;return W}H=q instanceof Map?J[S0.MAP]:(Symbol.iterator in Object(q))?J[S0.SEQ]:J[S0.MAP]}if(z)z(H),delete Z.onTagObj;let B=H?.createNode?H.createNode(Z.schema,q,Z):typeof H?.nodeClass?.from==="function"?H.nodeClass.from(Z.schema,q,Z):new U9.Scalar(q);if($)B.tag=$;else if(!H.default)B.tag=H.tag;if(Y)Y.node=B;return B}O6.createNode=_6});var aq=N((I6)=>{var F6=Uq(),z0=k(),A6=iq();function r$(q,$,Z){let Q=Z;for(let X=$.length-1;X>=0;--X){let z=$[X];if(typeof z==="number"&&Number.isInteger(z)&&z>=0){let J=[];J[z]=Q,Q=J}else Q=new Map([[z,Q]])}return F6.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:q,sourceObjects:new Map})}var H9=(q)=>q==null||typeof q==="object"&&!!q[Symbol.iterator]().next().done;class W9 extends A6.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)=>z0.isNode(Z)||z0.isPair(Z)?Z.clone(q):Z),this.range)$.range=this.range.slice();return $}addIn(q,$){if(H9(q))this.add($);else{let[Z,...Q]=q,X=this.get(Z,!0);if(z0.isCollection(X))X.addIn(Q,$);else if(X===void 0&&this.schema)this.set(Z,r$(this.schema,Q,$));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}deleteIn(q){let[$,...Z]=q;if(Z.length===0)return this.delete($);let Q=this.get($,!0);if(z0.isCollection(Q))return Q.deleteIn(Z);else throw Error(`Expected YAML collection at ${$}. Remaining path: ${Z}`)}getIn(q,$){let[Z,...Q]=q,X=this.get(Z,!0);if(Q.length===0)return!$&&z0.isScalar(X)?X.value:X;else return z0.isCollection(X)?X.getIn(Q,$):void 0}hasAllNullValues(q){return this.items.every(($)=>{if(!z0.isPair($))return!1;let Z=$.value;return Z==null||q&&z0.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn(q){let[$,...Z]=q;if(Z.length===0)return this.has($);let Q=this.get($,!0);return z0.isCollection(Q)?Q.hasIn(Z):!1}setIn(q,$){let[Z,...Q]=q;if(Q.length===0)this.set(Z,$);else{let X=this.get(Z,!0);if(z0.isCollection(X))X.setIn(Q,$);else if(X===void 0&&this.schema)this.set(Z,r$(this.schema,Q,$));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}}I6.Collection=W9;I6.collectionFromPath=r$;I6.isEmptyPath=H9});var Hq=N((D6)=>{var j6=(q)=>q.replace(/^(?!$)(?: $)?/gm,"#");function t$(q,$){if(/^\n+$/.test(q))return q.substring(1);return $?q.replace(/^(?! *$)/gm,$):q}var w6=(q,$,Z)=>q.endsWith(`
|
|
4
|
+
`)?t$(Z,$):Z.includes(`
|
|
5
5
|
`)?`
|
|
6
|
-
`+
|
|
7
|
-
`){if(Z==="block")
|
|
8
|
-
`&&
|
|
9
|
-
`&&
|
|
10
|
-
${$}${q.slice(0,
|
|
11
|
-
${$}${q.slice(
|
|
12
|
-
`);X
|
|
13
|
-
`){if(
|
|
14
|
-
|
|
15
|
-
`;while(Z[
|
|
16
|
-
`,
|
|
17
|
-
`)||/[ \t]\n|\n[ \t]/.test(q))return
|
|
18
|
-
${Z}`)+"'";return $.implicitKey?
|
|
6
|
+
`+t$(Z,$):(q.endsWith(" ")?"":" ")+Z;D6.indentComment=t$;D6.lineComment=w6;D6.stringifyComment=j6});var B9=N((S6)=>{function E6(q,$,Z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:z=20,onFold:J,onOverflow:G}={}){if(!X||X<0)return q;if(X<z)z=0;let Y=Math.max(1+z,1+X-$.length);if(q.length<=Y)return q;let H=[],B={},W=X-$.length;if(typeof Q==="number")if(Q>X-Math.max(2,z))H.push(0);else W=X-Q;let V=void 0,K=void 0,L=!1,_=-1,O=-1,F=-1;if(Z==="block"){if(_=V9(q,_,$.length),_!==-1)W=_+Y}for(let R;R=q[_+=1];){if(Z==="quoted"&&R==="\\"){switch(O=_,q[_+1]){case"x":_+=3;break;case"u":_+=5;break;case"U":_+=9;break;default:_+=1}F=_}if(R===`
|
|
7
|
+
`){if(Z==="block")_=V9(q,_,$.length);W=_+$.length+Y,V=void 0}else{if(R===" "&&K&&K!==" "&&K!==`
|
|
8
|
+
`&&K!=="\t"){let j=q[_+1];if(j&&j!==" "&&j!==`
|
|
9
|
+
`&&j!=="\t")V=_}if(_>=W)if(V)H.push(V),W=V+Y,V=void 0;else if(Z==="quoted"){while(K===" "||K==="\t")K=R,R=q[_+=1],L=!0;let j=_>F+1?_-2:O-1;if(B[j])return q;H.push(j),B[j]=!0,W=j+Y,V=void 0}else L=!0}K=R}if(L&&G)G();if(H.length===0)return q;if(J)J();let T=q.slice(0,H[0]);for(let R=0;R<H.length;++R){let j=H[R],I=H[R+1]||q.length;if(j===0)T=`
|
|
10
|
+
${$}${q.slice(0,I)}`;else{if(Z==="quoted"&&B[j])T+=`${q[j]}\\`;T+=`
|
|
11
|
+
${$}${q.slice(j+1,I)}`}}return T}function V9(q,$,Z){let Q=$,X=$+1,z=q[X];while(z===" "||z==="\t")if($<X+Z)z=q[++$];else{do z=q[++$];while(z&&z!==`
|
|
12
|
+
`);Q=$,X=$+1,z=q[X]}return Q}S6.FOLD_BLOCK="block";S6.FOLD_FLOW="flow";S6.FOLD_QUOTED="quoted";S6.foldFlowLines=E6});var Vq=N((g6)=>{var Z0=g(),L0=B9(),rq=(q,$)=>({indentAtStart:$?q.indent.length:q.indentAtStart,lineWidth:q.options.lineWidth,minContentWidth:q.options.minContentWidth}),tq=(q)=>/^(%|---|\.\.\.)/m.test(q);function k6(q,$,Z){if(!$||$<0)return!1;let Q=$-Z,X=q.length;if(X<=Q)return!1;for(let z=0,J=0;z<X;++z)if(q[z]===`
|
|
13
|
+
`){if(z-J>Q)return!0;if(J=z+1,X-J<=Q)return!1}return!0}function Wq(q,$){let Z=JSON.stringify(q);if($.options.doubleQuotedAsJSON)return Z;let{implicitKey:Q}=$,X=$.options.doubleQuotedMinMultiLineLength,z=$.indent||(tq(q)?" ":""),J="",G=0;for(let Y=0,H=Z[Y];H;H=Z[++Y]){if(H===" "&&Z[Y+1]==="\\"&&Z[Y+2]==="n")J+=Z.slice(G,Y)+"\\ ",Y+=1,G=Y,H="\\";if(H==="\\")switch(Z[Y+1]){case"u":{J+=Z.slice(G,Y);let B=Z.substr(Y+2,4);switch(B){case"0000":J+="\\0";break;case"0007":J+="\\a";break;case"000b":J+="\\v";break;case"001b":J+="\\e";break;case"0085":J+="\\N";break;case"00a0":J+="\\_";break;case"2028":J+="\\L";break;case"2029":J+="\\P";break;default:if(B.substr(0,2)==="00")J+="\\x"+B.substr(2);else J+=Z.substr(Y,6)}Y+=5,G=Y+1}break;case"n":if(Q||Z[Y+2]==='"'||Z.length<X)Y+=1;else{J+=Z.slice(G,Y)+`
|
|
14
|
+
|
|
15
|
+
`;while(Z[Y+2]==="\\"&&Z[Y+3]==="n"&&Z[Y+4]!=='"')J+=`
|
|
16
|
+
`,Y+=2;if(J+=z,Z[Y+2]===" ")J+="\\";Y+=1,G=Y+1}break;default:Y+=1}}return J=G?J+Z.slice(G):Z,Q?J:L0.foldFlowLines(J,z,L0.FOLD_QUOTED,rq($,!1))}function e$(q,$){if($.options.singleQuote===!1||$.implicitKey&&q.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(q))return Wq(q,$);let Z=$.indent||(tq(q)?" ":""),Q="'"+q.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${Z}`)+"'";return $.implicitKey?Q:L0.foldFlowLines(Q,Z,L0.FOLD_FLOW,rq($,!1))}function a0(q,$){let{singleQuote:Z}=$.options,Q;if(Z===!1)Q=Wq;else{let X=q.includes('"'),z=q.includes("'");if(X&&!z)Q=e$;else if(z&&!X)Q=Wq;else Q=Z?e$:Wq}return Q(q,$)}var q2;try{q2=new RegExp(`(^|(?<!
|
|
19
19
|
))
|
|
20
20
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{
|
|
21
|
+
|$)`,"g")}catch{q2=/\n+(?!\n|$)/g}function sq({comment:q,type:$,value:Z},Q,X,z){let{blockQuote:J,commentString:G,lineWidth:Y}=Q.options;if(!J||/\n[\t ]+$/.test(Z))return a0(Z,Q);let H=Q.indent||(Q.forceBlockIndent||tq(Z)?" ":""),B=J==="literal"?!0:J==="folded"||$===Z0.Scalar.BLOCK_FOLDED?!1:$===Z0.Scalar.BLOCK_LITERAL?!0:!k6(Z,Y,H.length);if(!Z)return B?`|
|
|
22
22
|
`:`>
|
|
23
|
-
`;let V
|
|
24
|
-
`&&
|
|
25
|
-
`);if(
|
|
26
|
-
`)
|
|
27
|
-
`)
|
|
28
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${H}`),
|
|
29
|
-
${H}${
|
|
30
|
-
${H}${
|
|
31
|
-
`)||
|
|
32
|
-
`)?
|
|
33
|
-
`))return
|
|
34
|
-
${
|
|
35
|
-
${$.indent}${
|
|
36
|
-
${
|
|
37
|
-
`:"",
|
|
38
|
-
${
|
|
39
|
-
`&&
|
|
40
|
-
|
|
41
|
-
`}else
|
|
42
|
-
${Z.indent}`}else if(!
|
|
43
|
-
`),
|
|
44
|
-
${Z.indent}`}}else if(
|
|
45
|
-
`)
|
|
46
|
-
${
|
|
47
|
-
`}}if(q){if(
|
|
48
|
-
`+
|
|
49
|
-
`)))H=!0;
|
|
50
|
-
${
|
|
51
|
-
`;return`${
|
|
52
|
-
${
|
|
53
|
-
`:" ")}return
|
|
54
|
-
${
|
|
55
|
-
${G.comment}`:X.comment}X=Q}q.items[Z]=cq.isPair(X)?X:new p$.Pair(X)}else $("Expected a sequence for this tag");return q}function r1(q,$,Z){let{replacer:X}=Z,Q=new h3.YAMLSeq(q);Q.tag="tag:yaml.org,2002:pairs";let G=0;if($&&Symbol.iterator in Object($))for(let z of $){if(typeof X==="function")z=X.call($,String(G++),z);let J,U;if(Array.isArray(z))if(z.length===2)J=z[0],U=z[1];else throw TypeError(`Expected [key, value] tuple: ${z}`);else if(z&&z instanceof Object){let H=Object.keys(z);if(H.length===1)J=H[0],U=z[J];else throw TypeError(`Expected tuple with one key, not ${H.length} keys`)}else J=z;Q.items.push(p$.createPair(J,U,Z))}return Q}var g3={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:s1,createNode:r1};k3.createPairs=r1;k3.pairs=g3;k3.resolvePairs=s1});var c$=I((c3)=>{var t1=y(),d$=Z0(),Zq=J0(),p3=U0(),e1=lq();class K0 extends p3.YAMLSeq{constructor(){super();this.add=Zq.YAMLMap.prototype.add.bind(this),this.delete=Zq.YAMLMap.prototype.delete.bind(this),this.get=Zq.YAMLMap.prototype.get.bind(this),this.has=Zq.YAMLMap.prototype.has.bind(this),this.set=Zq.YAMLMap.prototype.set.bind(this),this.tag=K0.tag}toJSON(q,$){if(!$)return super.toJSON(q);let Z=new Map;if($?.onCreate)$.onCreate(Z);for(let X of this.items){let Q,G;if(t1.isPair(X))Q=d$.toJS(X.key,"",$),G=d$.toJS(X.value,Q,$);else Q=d$.toJS(X,"",$);if(Z.has(Q))throw Error("Ordered maps must not include duplicate keys");Z.set(Q,G)}return Z}static from(q,$,Z){let X=e1.createPairs(q,$,Z),Q=new this;return Q.items=X.items,Q}}K0.tag="tag:yaml.org,2002:omap";var d3={collection:"seq",identify:(q)=>q instanceof Map,nodeClass:K0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(q,$){let Z=e1.resolvePairs(q,$),X=[];for(let{key:Q}of Z.items)if(t1.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 K0,Z)},createNode:(q,$,Z)=>K0.from(q,$,Z)};c3.YAMLOMap=K0;c3.omap=d3});var Q9=I((a3)=>{var q9=h();function $9({value:q,source:$},Z){if($&&(q?Z9:X9).test.test($))return $;return q?Z.options.trueStr:Z.options.falseStr}var Z9={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 q9.Scalar(!0),stringify:$9},X9={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 q9.Scalar(!1),stringify:$9};a3.falseTag=X9;a3.trueTag=Z9});var G9=I((q7)=>{var s3=h(),l$=y0(),r3={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:l$.stringifyNumber},t3={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():l$.stringifyNumber(q)}},e3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(q){let $=new s3.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:l$.stringifyNumber};q7.float=e3;q7.floatExp=t3;q7.floatNaN=r3});var J9=I((U7)=>{var z9=y0(),Xq=(q)=>typeof q==="bigint"||Number.isInteger(q);function nq(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 G=parseInt(q,Z);return Q==="-"?-1*G:G}function n$(q,$,Z){let{value:X}=q;if(Xq(X)){let Q=X.toString($);return X<0?"-"+Z+Q.substr(1):Z+Q}return z9.stringifyNumber(q)}var Q7={identify:Xq,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(q,$,Z)=>nq(q,2,2,Z),stringify:(q)=>n$(q,2,"0b")},G7={identify:Xq,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(q,$,Z)=>nq(q,1,8,Z),stringify:(q)=>n$(q,8,"0")},z7={identify:Xq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(q,$,Z)=>nq(q,0,10,Z),stringify:z9.stringifyNumber},J7={identify:Xq,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(q,$,Z)=>nq(q,2,16,Z),stringify:(q)=>n$(q,16,"0x")};U7.int=z7;U7.intBin=Q7;U7.intHex=J7;U7.intOct=G7});var a$=I((B7)=>{var oq=y(),aq=G0(),iq=J0();class L0 extends iq.YAMLMap{constructor(q){super(q);this.tag=L0.tag}add(q){let $;if(oq.isPair(q))$=q;else if(q&&typeof q==="object"&&"key"in q&&"value"in q&&q.value===null)$=new aq.Pair(q.key,null);else $=new aq.Pair(q,null);if(!iq.findPair(this.items,$.key))this.items.push($)}get(q,$){let Z=iq.findPair(this.items,q);return!$&&oq.isPair(Z)?oq.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=iq.findPair(this.items,q);if(Z&&!$)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&$)this.items.push(new aq.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 G of $){if(typeof X==="function")G=X.call($,G,G);Q.items.push(aq.createPair(G,null,Z))}return Q}}L0.tag="tag:yaml.org,2002:set";var _7={collection:"map",identify:(q)=>q instanceof Set,nodeClass:L0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(q,$,Z)=>L0.from(q,$,Z),resolve(q,$){if(oq.isMap(q))if(q.hasAllNullValues(!0))return Object.assign(new L0,q);else $("Set items must all have null values");else $("Expected a mapping for this tag");return q}};B7.YAMLSet=L0;B7.set=_7});var o$=I((M7)=>{var T7=y0();function i$(q,$){let Z=q[0],X=Z==="-"||Z==="+"?q.substring(1):q,Q=(z)=>$?BigInt(z):Number(z),G=X.replace(/_/g,"").split(":").reduce((z,J)=>z*Q(60)+Q(J),Q(0));return Z==="-"?Q(-1)*G:G}function U9(q){let{value:$}=q,Z=(z)=>z;if(typeof $==="bigint")Z=(z)=>BigInt(z);else if(isNaN($)||!isFinite($))return T7.stringifyNumber(q);let X="";if($<0)X="-",$*=Z(-1);let Q=Z(60),G=[$%Q];if($<60)G.unshift(0);else if($=($-G[0])/Q,G.unshift($%Q),$>=60)$=($-G[0])/Q,G.unshift($);return X+G.map((z)=>String(z).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var K7={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})=>i$(q,Z),stringify:U9},L7={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)=>i$(q,!1),stringify:U9},Y9={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(Y9.test);if(!$)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,X,Q,G,z,J]=$.map(Number),U=$[7]?Number(($[7]+"00").substr(1,3)):0,H=Date.UTC(Z,X-1,Q,G||0,z||0,J||0,U),_=$[8];if(_&&_!=="Z"){let V=i$(_,!1);if(Math.abs(V)<30)V*=60;H-=60000*V}return new Date(H)},stringify:({value:q})=>q?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};M7.floatTime=L7;M7.intTime=K7;M7.timestamp=Y9});var V9=I((y7)=>{var w7=b0(),D7=mq(),j7=f0(),N7=qq(),P7=m$(),H9=Q9(),s$=G9(),sq=J9(),C7=fq(),E7=c$(),S7=lq(),b7=a$(),r$=o$(),f7=[w7.map,j7.seq,N7.string,D7.nullTag,H9.trueTag,H9.falseTag,sq.intBin,sq.intOct,sq.int,sq.intHex,s$.floatNaN,s$.floatExp,s$.float,P7.binary,C7.merge,E7.omap,S7.pairs,b7.set,r$.intTime,r$.floatTime,r$.timestamp];y7.schema=f7});var R9=I((d7)=>{var O9=b0(),h7=mq(),F9=f0(),g7=qq(),k7=f$(),t$=x$(),e$=g$(),v7=a1(),u7=o1(),T9=m$(),Qq=fq(),K9=c$(),L9=lq(),W9=V9(),M9=a$(),rq=o$(),_9=new Map([["core",v7.schema],["failsafe",[O9.map,F9.seq,g7.string]],["json",u7.schema],["yaml11",W9.schema],["yaml-1.1",W9.schema]]),B9={binary:T9.binary,bool:k7.boolTag,float:t$.float,floatExp:t$.floatExp,floatNaN:t$.floatNaN,floatTime:rq.floatTime,int:e$.int,intHex:e$.intHex,intOct:e$.intOct,intTime:rq.intTime,map:O9.map,merge:Qq.merge,null:h7.nullTag,omap:K9.omap,pairs:L9.pairs,seq:F9.seq,set:M9.set,timestamp:rq.timestamp},m7={"tag:yaml.org,2002:binary":T9.binary,"tag:yaml.org,2002:merge":Qq.merge,"tag:yaml.org,2002:omap":K9.omap,"tag:yaml.org,2002:pairs":L9.pairs,"tag:yaml.org,2002:set":M9.set,"tag:yaml.org,2002:timestamp":rq.timestamp};function p7(q,$,Z){let X=_9.get($);if(X&&!q)return Z&&!X.includes(Qq.merge)?X.concat(Qq.merge):X.slice();let Q=X;if(!Q)if(Array.isArray(q))Q=[];else{let G=Array.from(_9.keys()).filter((z)=>z!=="yaml11").map((z)=>JSON.stringify(z)).join(", ");throw Error(`Unknown schema "${$}"; use one of ${G} or define customTags array`)}if(Array.isArray(q))for(let G of q)Q=Q.concat(G);else if(typeof q==="function")Q=q(Q.slice());if(Z)Q=Q.concat(Qq.merge);return Q.reduce((G,z)=>{let J=typeof z==="string"?B9[z]:z;if(!J){let U=JSON.stringify(z),H=Object.keys(B9).map((_)=>JSON.stringify(_)).join(", ");throw Error(`Unknown custom tag ${U}; use one of ${H}`)}if(!G.includes(J))G.push(J);return G},[])}d7.coreKnownTags=m7;d7.getTags=p7});var Z2=I((s7)=>{var q2=y(),n7=b0(),a7=f0(),i7=qq(),tq=R9(),o7=(q,$)=>q.key<$.key?-1:q.key>$.key?1:0;class $2{constructor({compat:q,customTags:$,merge:Z,resolveKnownTags:X,schema:Q,sortMapEntries:G,toStringDefaults:z}){this.compat=Array.isArray(q)?tq.getTags(q,"compat"):q?tq.getTags(null,q):null,this.name=typeof Q==="string"&&Q||"core",this.knownTags=X?tq.coreKnownTags:{},this.tags=tq.getTags($,this.name,Z),this.toStringOptions=z??null,Object.defineProperty(this,q2.MAP,{value:n7.map}),Object.defineProperty(this,q2.SCALAR,{value:i7.string}),Object.defineProperty(this,q2.SEQ,{value:a7.seq}),this.sortMapEntries=typeof G==="function"?G:G===!0?o7:null}clone(){let q=Object.create($2.prototype,Object.getOwnPropertyDescriptors(this));return q.tags=this.tags.slice(),q}}s7.Schema=$2});var A9=I((qX)=>{var t7=y(),X2=s0(),Gq=a0();function e7(q,$){let Z=[],X=$.directives===!0;if($.directives!==!1&&q.directives){let U=q.directives.toString(q);if(U)Z.push(U),X=!0;else if(q.directives.docStart)X=!0}if(X)Z.push("---");let Q=X2.createStringifyContext(q,$),{commentString:G}=Q.options;if(q.commentBefore){if(Z.length!==1)Z.unshift("");let U=G(q.commentBefore);Z.unshift(Gq.indentComment(U,""))}let z=!1,J=null;if(q.contents){if(t7.isNode(q.contents)){if(q.contents.spaceBefore&&X)Z.push("");if(q.contents.commentBefore){let _=G(q.contents.commentBefore);Z.push(Gq.indentComment(_,""))}Q.forceBlockIndent=!!q.comment,J=q.contents.comment}let U=J?void 0:()=>z=!0,H=X2.stringify(q.contents,Q,()=>J=null,U);if(J)H+=Gq.lineComment(H,"",G(J));if((H[0]==="|"||H[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${H}`;else Z.push(H)}else Z.push(X2.stringify(q.contents,Q));if(q.directives?.docEnd)if(q.comment){let U=G(q.comment);if(U.includes(`
|
|
56
|
-
`))Z.push("..."),Z.push(
|
|
23
|
+
`;let W,V;for(V=Z.length;V>0;--V){let I=Z[V-1];if(I!==`
|
|
24
|
+
`&&I!=="\t"&&I!==" ")break}let K=Z.substring(V),L=K.indexOf(`
|
|
25
|
+
`);if(L===-1)W="-";else if(Z===K||L!==K.length-1){if(W="+",z)z()}else W="";if(K){if(Z=Z.slice(0,-K.length),K[K.length-1]===`
|
|
26
|
+
`)K=K.slice(0,-1);K=K.replace(q2,`$&${H}`)}let _=!1,O,F=-1;for(O=0;O<Z.length;++O){let I=Z[O];if(I===" ")_=!0;else if(I===`
|
|
27
|
+
`)F=O;else break}let T=Z.substring(0,F<O?F+1:O);if(T)Z=Z.substring(T.length),T=T.replace(/\n+/g,`$&${H}`);let j=(_?H?"2":"1":"")+W;if(q){if(j+=" "+G(q.replace(/ ?[\r\n]+/g," ")),X)X()}if(!B){let I=Z.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${H}`),w=!1,x=rq(Q,!0);if(J!=="folded"&&$!==Z0.Scalar.BLOCK_FOLDED)x.onOverflow=()=>{w=!0};let D=L0.foldFlowLines(`${T}${I}${K}`,H,L0.FOLD_BLOCK,x);if(!w)return`>${j}
|
|
29
|
+
${H}${D}`}return Z=Z.replace(/\n+/g,`$&${H}`),`|${j}
|
|
30
|
+
${H}${T}${Z}${K}`}function v6(q,$,Z,Q){let{type:X,value:z}=q,{actualString:J,implicitKey:G,indent:Y,indentStep:H,inFlow:B}=$;if(G&&z.includes(`
|
|
31
|
+
`)||B&&/[[\]{},]/.test(z))return a0(z,$);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(z))return G||B||!z.includes(`
|
|
32
|
+
`)?a0(z,$):sq(q,$,Z,Q);if(!G&&!B&&X!==Z0.Scalar.PLAIN&&z.includes(`
|
|
33
|
+
`))return sq(q,$,Z,Q);if(tq(z)){if(Y==="")return $.forceBlockIndent=!0,sq(q,$,Z,Q);else if(G&&Y===H)return a0(z,$)}let W=z.replace(/\n+/g,`$&
|
|
34
|
+
${Y}`);if(J){let V=(_)=>_.default&&_.tag!=="tag:yaml.org,2002:str"&&_.test?.test(W),{compat:K,tags:L}=$.doc.schema;if(L.some(V)||K?.some(V))return a0(z,$)}return G?W:L0.foldFlowLines(W,Y,L0.FOLD_FLOW,rq($,!1))}function h6(q,$,Z,Q){let{implicitKey:X,inFlow:z}=$,J=typeof q.value==="string"?q:Object.assign({},q,{value:String(q.value)}),{type:G}=q;if(G!==Z0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(J.value))G=Z0.Scalar.QUOTE_DOUBLE}let Y=(B)=>{switch(B){case Z0.Scalar.BLOCK_FOLDED:case Z0.Scalar.BLOCK_LITERAL:return X||z?a0(J.value,$):sq(J,$,Z,Q);case Z0.Scalar.QUOTE_DOUBLE:return Wq(J.value,$);case Z0.Scalar.QUOTE_SINGLE:return e$(J.value,$);case Z0.Scalar.PLAIN:return v6(J,$,Z,Q);default:return null}},H=Y(G);if(H===null){let{defaultKeyType:B,defaultStringType:W}=$.options,V=X&&B||W;if(H=Y(V),H===null)throw Error(`Unsupported default string type ${V}`)}return H}g6.stringifyString=h6});var Bq=N((o6)=>{var m6=nq(),F0=k(),p6=Hq(),d6=Vq();function c6(q,$){let Z=Object.assign({blockQuote:!0,commentString:p6.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,$),Q;switch(Z.collectionStyle){case"block":Q=!1;break;case"flow":Q=!0;break;default:Q=null}return{anchors:new Set,doc:q,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:Q,options:Z}}function l6(q,$){if($.tag){let X=q.filter((z)=>z.tag===$.tag);if(X.length>0)return X.find((z)=>z.format===$.format)??X[0]}let Z=void 0,Q;if(F0.isScalar($)){Q=$.value;let X=q.filter((z)=>z.identify?.(Q));if(X.length>1){let z=X.filter((J)=>J.test);if(z.length>0)X=z}Z=X.find((z)=>z.format===$.format)??X.find((z)=>!z.format)}else Q=$,Z=q.find((X)=>X.nodeClass&&Q instanceof X.nodeClass);if(!Z){let X=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${X} value`)}return Z}function n6(q,$,{anchors:Z,doc:Q}){if(!Q.directives)return"";let X=[],z=(F0.isScalar(q)||F0.isCollection(q))&&q.anchor;if(z&&m6.anchorIsValid(z))Z.add(z),X.push(`&${z}`);let J=q.tag??($.default?null:$.tag);if(J)X.push(Q.directives.tagString(J));return X.join(" ")}function i6(q,$,Z,Q){if(F0.isPair(q))return q.toString($,Z,Q);if(F0.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 X=void 0,z=F0.isNode(q)?q:$.doc.createNode(q,{onTagObj:(Y)=>X=Y});X??(X=l6($.doc.schema.tags,z));let J=n6(z,X,$);if(J.length>0)$.indentAtStart=($.indentAtStart??0)+J.length+1;let G=typeof X.stringify==="function"?X.stringify(z,$,Z,Q):F0.isScalar(z)?d6.stringifyString(z,$,Z,Q):z.toString($,Z,Q);if(!J)return G;return F0.isScalar(z)||G[0]==="{"||G[0]==="["?`${J} ${G}`:`${J}
|
|
35
|
+
${$.indent}${G}`}o6.createStringifyContext=c6;o6.stringify=i6});var O9=N((t6)=>{var K0=k(),K9=g(),_9=Bq(),Kq=Hq();function r6({key:q,value:$},Z,Q,X){let{allNullValues:z,doc:J,indent:G,indentStep:Y,options:{commentString:H,indentSeq:B,simpleKeys:W}}=Z,V=K0.isNode(q)&&q.comment||null;if(W){if(V)throw Error("With simple keys, key nodes cannot have comments");if(K0.isCollection(q)||!K0.isNode(q)&&typeof q==="object")throw Error("With simple keys, collection cannot be used as a key value")}let K=!W&&(!q||V&&$==null&&!Z.inFlow||K0.isCollection(q)||(K0.isScalar(q)?q.type===K9.Scalar.BLOCK_FOLDED||q.type===K9.Scalar.BLOCK_LITERAL:typeof q==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!K&&(W||!z),indent:G+Y});let L=!1,_=!1,O=_9.stringify(q,Z,()=>L=!0,()=>_=!0);if(!K&&!Z.inFlow&&O.length>1024){if(W)throw Error("With simple keys, single line scalar must not span more than 1024 characters");K=!0}if(Z.inFlow){if(z||$==null){if(L&&Q)Q();return O===""?"?":K?`? ${O}`:O}}else if(z&&!W||$==null&&K){if(O=`? ${O}`,V&&!L)O+=Kq.lineComment(O,Z.indent,H(V));else if(_&&X)X();return O}if(L)V=null;if(K){if(V)O+=Kq.lineComment(O,Z.indent,H(V));O=`? ${O}
|
|
36
|
+
${G}:`}else if(O=`${O}:`,V)O+=Kq.lineComment(O,Z.indent,H(V));let F,T,R;if(K0.isNode($))F=!!$.spaceBefore,T=$.commentBefore,R=$.comment;else if(F=!1,T=null,R=null,$&&typeof $==="object")$=J.createNode($);if(Z.implicitKey=!1,!K&&!V&&K0.isScalar($))Z.indentAtStart=O.length+1;if(_=!1,!B&&Y.length>=2&&!Z.inFlow&&!K&&K0.isSeq($)&&!$.flow&&!$.tag&&!$.anchor)Z.indent=Z.indent.substring(2);let j=!1,I=_9.stringify($,Z,()=>j=!0,()=>_=!0),w=" ";if(V||F||T){if(w=F?`
|
|
37
|
+
`:"",T){let x=H(T);w+=`
|
|
38
|
+
${Kq.indentComment(x,Z.indent)}`}if(I===""&&!Z.inFlow){if(w===`
|
|
39
|
+
`&&R)w=`
|
|
40
|
+
|
|
41
|
+
`}else w+=`
|
|
42
|
+
${Z.indent}`}else if(!K&&K0.isCollection($)){let x=I[0],D=I.indexOf(`
|
|
43
|
+
`),y=D!==-1,A=Z.inFlow??$.flow??$.items.length===0;if(y||!A){let M=!1;if(y&&(x==="&"||x==="!")){let P=I.indexOf(" ");if(x==="&"&&P!==-1&&P<D&&I[P+1]==="!")P=I.indexOf(" ",P+1);if(P===-1||D<P)M=!0}if(!M)w=`
|
|
44
|
+
${Z.indent}`}}else if(I===""||I[0]===`
|
|
45
|
+
`)w="";if(O+=w+I,Z.inFlow){if(j&&Q)Q()}else if(R&&!j)O+=Kq.lineComment(O,Z.indent,H(R));else if(_&&X)X();return O}t6.stringifyPair=r6});var $2=N((Z3)=>{var L9=h("process");function q3(q,...$){if(q==="debug")console.log(...$)}function $3(q,$){if(q==="debug"||q==="warn")if(typeof L9.emitWarning==="function")L9.emitWarning($);else console.warn($)}Z3.debug=q3;Z3.warn=$3});var $$=N((J3)=>{var _q=k(),F9=g(),eq="<<",q$={identify:(q)=>q===eq||typeof q==="symbol"&&q.description===eq,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new F9.Scalar(Symbol(eq)),{addToJSMap:A9}),stringify:()=>eq},z3=(q,$)=>(q$.identify($)||_q.isScalar($)&&(!$.type||$.type===F9.Scalar.PLAIN)&&q$.identify($.value))&&q?.doc.schema.tags.some((Z)=>Z.tag===q$.tag&&Z.default);function A9(q,$,Z){if(Z=q&&_q.isAlias(Z)?Z.resolve(q.doc):Z,_q.isSeq(Z))for(let Q of Z.items)Z2(q,$,Q);else if(Array.isArray(Z))for(let Q of Z)Z2(q,$,Q);else Z2(q,$,Z)}function Z2(q,$,Z){let Q=q&&_q.isAlias(Z)?Z.resolve(q.doc):Z;if(!_q.isMap(Q))throw Error("Merge sources must be maps or map aliases");let X=Q.toJSON(null,q,Map);for(let[z,J]of X)if($ instanceof Map){if(!$.has(z))$.set(z,J)}else if($ instanceof Set)$.add(z);else if(!Object.prototype.hasOwnProperty.call($,z))Object.defineProperty($,z,{value:J,writable:!0,enumerable:!0,configurable:!0});return $}J3.addMergeToJSMap=A9;J3.isMergeKey=z3;J3.merge=q$});var X2=N((K3)=>{var H3=$2(),I9=$$(),W3=Bq(),M9=k(),Q2=O0();function V3(q,$,{key:Z,value:Q}){if(M9.isNode(Z)&&Z.addToJSMap)Z.addToJSMap(q,$,Q);else if(I9.isMergeKey(q,Z))I9.addMergeToJSMap(q,$,Q);else{let X=Q2.toJS(Z,"",q);if($ instanceof Map)$.set(X,Q2.toJS(Q,X,q));else if($ instanceof Set)$.add(X);else{let z=B3(Z,X,q),J=Q2.toJS(Q,z,q);if(z in $)Object.defineProperty($,z,{value:J,writable:!0,enumerable:!0,configurable:!0});else $[z]=J}}return $}function B3(q,$,Z){if($===null)return"";if(typeof $!=="object")return String($);if(M9.isNode(q)&&Z?.doc){let Q=W3.createStringifyContext(Z.doc,{});Q.anchors=new Set;for(let z of Z.anchors.keys())Q.anchors.add(z.anchor);Q.inFlow=!0,Q.inStringifyKey=!0;let X=q.toString(Q);if(!Z.mapKeyWarned){let z=JSON.stringify(X);if(z.length>40)z=z.substring(0,36)+'..."';H3.warn(Z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${z}. Set mapAsMap: true to use object keys.`),Z.mapKeyWarned=!0}return X}return JSON.stringify($)}K3.addPairToJSMap=V3});var A0=N((A3)=>{var T9=Uq(),O3=O9(),L3=X2(),Z$=k();function F3(q,$,Z){let Q=T9.createNode(q,void 0,Z),X=T9.createNode($,void 0,Z);return new Q$(Q,X)}class Q${constructor(q,$=null){Object.defineProperty(this,Z$.NODE_TYPE,{value:Z$.PAIR}),this.key=q,this.value=$}clone(q){let{key:$,value:Z}=this;if(Z$.isNode($))$=$.clone(q);if(Z$.isNode(Z))Z=Z.clone(q);return new Q$($,Z)}toJSON(q,$){let Z=$?.mapAsMap?new Map:{};return L3.addPairToJSMap($,Z,this)}toString(q,$,Z){return q?.doc?O3.stringifyPair(this,q,$,Z):JSON.stringify(this)}}A3.Pair=Q$;A3.createPair=F3});var z2=N((w3)=>{var b0=k(),R9=Bq(),X$=Hq();function T3(q,$,Z){return($.inFlow??q.flow?j3:R3)(q,$,Z)}function R3({comment:q,items:$},Z,{blockItemPrefix:Q,flowChars:X,itemIndent:z,onChompKeep:J,onComment:G}){let{indent:Y,options:{commentString:H}}=Z,B=Object.assign({},Z,{indent:z,type:null}),W=!1,V=[];for(let L=0;L<$.length;++L){let _=$[L],O=null;if(b0.isNode(_)){if(!W&&_.spaceBefore)V.push("");if(z$(Z,V,_.commentBefore,W),_.comment)O=_.comment}else if(b0.isPair(_)){let T=b0.isNode(_.key)?_.key:null;if(T){if(!W&&T.spaceBefore)V.push("");z$(Z,V,T.commentBefore,W)}}W=!1;let F=R9.stringify(_,B,()=>O=null,()=>W=!0);if(O)F+=X$.lineComment(F,z,H(O));if(W&&O)W=!1;V.push(Q+F)}let K;if(V.length===0)K=X.start+X.end;else{K=V[0];for(let L=1;L<V.length;++L){let _=V[L];K+=_?`
|
|
46
|
+
${Y}${_}`:`
|
|
47
|
+
`}}if(q){if(K+=`
|
|
48
|
+
`+X$.indentComment(H(q),Y),G)G()}else if(W&&J)J();return K}function j3({items:q},$,{flowChars:Z,itemIndent:Q}){let{indent:X,indentStep:z,flowCollectionPadding:J,options:{commentString:G}}=$;Q+=z;let Y=Object.assign({},$,{indent:Q,inFlow:!0,type:null}),H=!1,B=0,W=[];for(let L=0;L<q.length;++L){let _=q[L],O=null;if(b0.isNode(_)){if(_.spaceBefore)W.push("");if(z$($,W,_.commentBefore,!1),_.comment)O=_.comment}else if(b0.isPair(_)){let T=b0.isNode(_.key)?_.key:null;if(T){if(T.spaceBefore)W.push("");if(z$($,W,T.commentBefore,!1),T.comment)H=!0}let R=b0.isNode(_.value)?_.value:null;if(R){if(R.comment)O=R.comment;if(R.commentBefore)H=!0}else if(_.value==null&&T?.comment)O=T.comment}if(O)H=!0;let F=R9.stringify(_,Y,()=>O=null);if(L<q.length-1)F+=",";if(O)F+=X$.lineComment(F,Q,G(O));if(!H&&(W.length>B||F.includes(`
|
|
49
|
+
`)))H=!0;W.push(F),B=W.length}let{start:V,end:K}=Z;if(W.length===0)return V+K;else{if(!H){let L=W.reduce((_,O)=>_+O.length+2,2);H=$.options.lineWidth>0&&L>$.options.lineWidth}if(H){let L=V;for(let _ of W)L+=_?`
|
|
50
|
+
${z}${X}${_}`:`
|
|
51
|
+
`;return`${L}
|
|
52
|
+
${X}${K}`}else return`${V}${J}${W.join(" ")}${J}${K}`}}function z$({indent:q,options:{commentString:$}},Z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let z=X$.indentComment($(Q),q);Z.push(z.trimStart())}}w3.stringifyCollection=T3});var M0=N((S3)=>{var N3=z2(),P3=X2(),C3=aq(),I0=k(),J$=A0(),E3=g();function Oq(q,$){let Z=I0.isScalar($)?$.value:$;for(let Q of q)if(I0.isPair(Q)){if(Q.key===$||Q.key===Z)return Q;if(I0.isScalar(Q.key)&&Q.key.value===Z)return Q}return}class j9 extends C3.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(q){super(I0.MAP,q);this.items=[]}static from(q,$,Z){let{keepUndefined:Q,replacer:X}=Z,z=new this(q),J=(G,Y)=>{if(typeof X==="function")Y=X.call($,G,Y);else if(Array.isArray(X)&&!X.includes(G))return;if(Y!==void 0||Q)z.items.push(J$.createPair(G,Y,Z))};if($ instanceof Map)for(let[G,Y]of $)J(G,Y);else if($&&typeof $==="object")for(let G of Object.keys($))J(G,$[G]);if(typeof q.sortMapEntries==="function")z.items.sort(q.sortMapEntries);return z}add(q,$){let Z;if(I0.isPair(q))Z=q;else if(!q||typeof q!=="object"||!("key"in q))Z=new J$.Pair(q,q?.value);else Z=new J$.Pair(q.key,q.value);let Q=Oq(this.items,Z.key),X=this.schema?.sortMapEntries;if(Q){if(!$)throw Error(`Key ${Z.key} already set`);if(I0.isScalar(Q.value)&&E3.isScalarValue(Z.value))Q.value.value=Z.value;else Q.value=Z.value}else if(X){let z=this.items.findIndex((J)=>X(Z,J)<0);if(z===-1)this.items.push(Z);else this.items.splice(z,0,Z)}else this.items.push(Z)}delete(q){let $=Oq(this.items,q);if(!$)return!1;return this.items.splice(this.items.indexOf($),1).length>0}get(q,$){let Q=Oq(this.items,q)?.value;return(!$&&I0.isScalar(Q)?Q.value:Q)??void 0}has(q){return!!Oq(this.items,q)}set(q,$){this.add(new J$.Pair(q,$),!0)}toJSON(q,$,Z){let Q=Z?new Z:$?.mapAsMap?new Map:{};if($?.onCreate)$.onCreate(Q);for(let X of this.items)P3.addPairToJSMap($,Q,X);return Q}toString(q,$,Z){if(!q)return JSON.stringify(this);for(let Q of this.items)if(!I0.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!q.allNullValues&&this.hasAllNullValues(!1))q=Object.assign({},q,{allNullValues:!0});return N3.stringifyCollection(this,q,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:q.indent||"",onChompKeep:Z,onComment:$})}}S3.YAMLMap=j9;S3.findPair=Oq});var s0=N((k3)=>{var f3=k(),w9=M0(),y3={collection:"map",default:!0,nodeClass:w9.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(q,$){if(!f3.isMap(q))$("Expected a mapping for this tag");return q},createNode:(q,$,Z)=>w9.YAMLMap.from(q,$,Z)};k3.map=y3});var T0=N((d3)=>{var h3=Uq(),g3=z2(),u3=aq(),Y$=k(),m3=g(),p3=O0();class D9 extends u3.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(q){super(Y$.SEQ,q);this.items=[]}add(q){this.items.push(q)}delete(q){let $=G$(q);if(typeof $!=="number")return!1;return this.items.splice($,1).length>0}get(q,$){let Z=G$(q);if(typeof Z!=="number")return;let Q=this.items[Z];return!$&&Y$.isScalar(Q)?Q.value:Q}has(q){let $=G$(q);return typeof $==="number"&&$<this.items.length}set(q,$){let Z=G$(q);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${q}.`);let Q=this.items[Z];if(Y$.isScalar(Q)&&m3.isScalarValue($))Q.value=$;else this.items[Z]=$}toJSON(q,$){let Z=[];if($?.onCreate)$.onCreate(Z);let Q=0;for(let X of this.items)Z.push(p3.toJS(X,String(Q++),$));return Z}toString(q,$,Z){if(!q)return JSON.stringify(this);return g3.stringifyCollection(this,q,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(q.indent||"")+" ",onChompKeep:Z,onComment:$})}static from(q,$,Z){let{replacer:Q}=Z,X=new this(q);if($&&Symbol.iterator in Object($)){let z=0;for(let J of $){if(typeof Q==="function"){let G=$ instanceof Set?J:String(z++);J=Q.call($,G,J)}X.items.push(h3.createNode(J,void 0,Z))}}return X}}function G$(q){let $=Y$.isScalar(q)?q.value:q;if($&&typeof $==="string")$=Number($);return typeof $==="number"&&Number.isInteger($)&&$>=0?$:null}d3.YAMLSeq=D9});var r0=N((i3)=>{var l3=k(),N9=T0(),n3={collection:"seq",default:!0,nodeClass:N9.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(q,$){if(!l3.isSeq(q))$("Expected a sequence for this tag");return q},createNode:(q,$,Z)=>N9.YAMLSeq.from(q,$,Z)};i3.seq=n3});var Lq=N((r3)=>{var a3=Vq(),s3={identify:(q)=>typeof q==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(q)=>q,stringify(q,$,Z,Q){return $=Object.assign({actualString:!0},$),a3.stringifyString(q,$,Z,Q)}};r3.string=s3});var U$=N((e3)=>{var P9=g(),C9={identify:(q)=>q==null,createNode:()=>new P9.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new P9.Scalar(null),stringify:({source:q},$)=>typeof q==="string"&&C9.test.test(q)?q:$.options.nullStr};e3.nullTag=C9});var J2=N((Z7)=>{var $7=g(),E9={identify:(q)=>typeof q==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(q)=>new $7.Scalar(q[0]==="t"||q[0]==="T"),stringify({source:q,value:$},Z){if(q&&E9.test.test(q)){let Q=q[0]==="t"||q[0]==="T";if($===Q)return q}return $?Z.options.trueStr:Z.options.falseStr}};Z7.boolTag=E9});var t0=N((z7)=>{function X7({format:q,minFractionDigits:$,tag:Z,value:Q}){if(typeof Q==="bigint")return String(Q);let X=typeof Q==="number"?Q:Number(Q);if(!isFinite(X))return isNaN(X)?".nan":X<0?"-.inf":".inf";let z=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!q&&$&&(!Z||Z==="tag:yaml.org,2002:float")&&/^\d/.test(z)){let J=z.indexOf(".");if(J<0)J=z.length,z+=".";let G=$-(z.length-J-1);while(G-- >0)z+="0"}return z}z7.stringifyNumber=X7});var Y2=N((W7)=>{var G7=g(),G2=t0(),Y7={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:G2.stringifyNumber},U7={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():G2.stringifyNumber(q)}},H7={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(q){let $=new G7.Scalar(parseFloat(q)),Z=q.indexOf(".");if(Z!==-1&&q[q.length-1]==="0")$.minFractionDigits=q.length-Z-1;return $},stringify:G2.stringifyNumber};W7.float=H7;W7.floatExp=U7;W7.floatNaN=Y7});var H2=N((F7)=>{var S9=t0(),H$=(q)=>typeof q==="bigint"||Number.isInteger(q),U2=(q,$,Z,{intAsBigInt:Q})=>Q?BigInt(q):parseInt(q.substring($),Z);function b9(q,$,Z){let{value:Q}=q;if(H$(Q)&&Q>=0)return Z+Q.toString($);return S9.stringifyNumber(q)}var _7={identify:(q)=>H$(q)&&q>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(q,$,Z)=>U2(q,2,8,Z),stringify:(q)=>b9(q,8,"0o")},O7={identify:H$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(q,$,Z)=>U2(q,0,10,Z),stringify:S9.stringifyNumber},L7={identify:(q)=>H$(q)&&q>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(q,$,Z)=>U2(q,2,16,Z),stringify:(q)=>b9(q,16,"0x")};F7.int=O7;F7.intHex=L7;F7.intOct=_7});var x9=N((P7)=>{var T7=s0(),R7=U$(),j7=r0(),w7=Lq(),D7=J2(),W2=Y2(),V2=H2(),N7=[T7.map,j7.seq,w7.string,R7.nullTag,D7.boolTag,V2.intOct,V2.int,V2.intHex,W2.floatNaN,W2.floatExp,W2.float];P7.schema=N7});var y9=N((k7)=>{var E7=g(),S7=s0(),b7=r0();function f9(q){return typeof q==="bigint"||Number.isInteger(q)}var W$=({value:q})=>JSON.stringify(q),x7=[{identify:(q)=>typeof q==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(q)=>q,stringify:W$},{identify:(q)=>q==null,createNode:()=>new E7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:W$},{identify:(q)=>typeof q==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(q)=>q==="true",stringify:W$},{identify:f9,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})=>f9(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:W$}],f7={default:!0,tag:"",test:/^/,resolve(q,$){return $(`Unresolved plain scalar ${JSON.stringify(q)}`),q}},y7=[S7.map,b7.seq].concat(x7,f7);k7.schema=y7});var K2=N((u7)=>{var Fq=h("buffer"),B2=g(),h7=Vq(),g7={identify:(q)=>q instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(q,$){if(typeof Fq.Buffer==="function")return Fq.Buffer.from(q,"base64");else if(typeof atob==="function"){let Z=atob(q.replace(/[\n\r]/g,"")),Q=new Uint8Array(Z.length);for(let X=0;X<Z.length;++X)Q[X]=Z.charCodeAt(X);return Q}else return $("This environment does not support reading binary tags; either Buffer or atob is required"),q},stringify({comment:q,type:$,value:Z},Q,X,z){if(!Z)return"";let J=Z,G;if(typeof Fq.Buffer==="function")G=J instanceof Fq.Buffer?J.toString("base64"):Fq.Buffer.from(J.buffer).toString("base64");else if(typeof btoa==="function"){let Y="";for(let H=0;H<J.length;++H)Y+=String.fromCharCode(J[H]);G=btoa(Y)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if($??($=B2.Scalar.BLOCK_LITERAL),$!==B2.Scalar.QUOTE_DOUBLE){let Y=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),H=Math.ceil(G.length/Y),B=Array(H);for(let W=0,V=0;W<H;++W,V+=Y)B[W]=G.substr(V,Y);G=B.join($===B2.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return h7.stringifyString({comment:q,type:$,value:G},Q,X,z)}};u7.binary=g7});var B$=N((l7)=>{var V$=k(),_2=A0(),p7=g(),d7=T0();function k9(q,$){if(V$.isSeq(q))for(let Z=0;Z<q.items.length;++Z){let Q=q.items[Z];if(V$.isPair(Q))continue;else if(V$.isMap(Q)){if(Q.items.length>1)$("Each pair must have its own sequence indicator");let X=Q.items[0]||new _2.Pair(new p7.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
|
|
54
|
+
${X.key.commentBefore}`:Q.commentBefore;if(Q.comment){let z=X.value??X.key;z.comment=z.comment?`${Q.comment}
|
|
55
|
+
${z.comment}`:Q.comment}Q=X}q.items[Z]=V$.isPair(Q)?Q:new _2.Pair(Q)}else $("Expected a sequence for this tag");return q}function v9(q,$,Z){let{replacer:Q}=Z,X=new d7.YAMLSeq(q);X.tag="tag:yaml.org,2002:pairs";let z=0;if($&&Symbol.iterator in Object($))for(let J of $){if(typeof Q==="function")J=Q.call($,String(z++),J);let G,Y;if(Array.isArray(J))if(J.length===2)G=J[0],Y=J[1];else throw TypeError(`Expected [key, value] tuple: ${J}`);else if(J&&J instanceof Object){let H=Object.keys(J);if(H.length===1)G=H[0],Y=J[G];else throw TypeError(`Expected tuple with one key, not ${H.length} keys`)}else G=J;X.items.push(_2.createPair(G,Y,Z))}return X}var c7={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:k9,createNode:v9};l7.createPairs=v9;l7.pairs=c7;l7.resolvePairs=k9});var L2=N((r7)=>{var h9=k(),O2=O0(),Aq=M0(),a7=T0(),g9=B$();class x0 extends a7.YAMLSeq{constructor(){super();this.add=Aq.YAMLMap.prototype.add.bind(this),this.delete=Aq.YAMLMap.prototype.delete.bind(this),this.get=Aq.YAMLMap.prototype.get.bind(this),this.has=Aq.YAMLMap.prototype.has.bind(this),this.set=Aq.YAMLMap.prototype.set.bind(this),this.tag=x0.tag}toJSON(q,$){if(!$)return super.toJSON(q);let Z=new Map;if($?.onCreate)$.onCreate(Z);for(let Q of this.items){let X,z;if(h9.isPair(Q))X=O2.toJS(Q.key,"",$),z=O2.toJS(Q.value,X,$);else X=O2.toJS(Q,"",$);if(Z.has(X))throw Error("Ordered maps must not include duplicate keys");Z.set(X,z)}return Z}static from(q,$,Z){let Q=g9.createPairs(q,$,Z),X=new this;return X.items=Q.items,X}}x0.tag="tag:yaml.org,2002:omap";var s7={collection:"seq",identify:(q)=>q instanceof Map,nodeClass:x0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(q,$){let Z=g9.resolvePairs(q,$),Q=[];for(let{key:X}of Z.items)if(h9.isScalar(X))if(Q.includes(X.value))$(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new x0,Z)},createNode:(q,$,Z)=>x0.from(q,$,Z)};r7.YAMLOMap=x0;r7.omap=s7});var c9=N((qQ)=>{var u9=g();function m9({value:q,source:$},Z){if($&&(q?p9:d9).test.test($))return $;return q?Z.options.trueStr:Z.options.falseStr}var p9={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 u9.Scalar(!0),stringify:m9},d9={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 u9.Scalar(!1),stringify:m9};qQ.falseTag=d9;qQ.trueTag=p9});var l9=N((GQ)=>{var QQ=g(),F2=t0(),XQ={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:F2.stringifyNumber},zQ={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():F2.stringifyNumber(q)}},JQ={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(q){let $=new QQ.Scalar(parseFloat(q.replace(/_/g,""))),Z=q.indexOf(".");if(Z!==-1){let Q=q.substring(Z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")$.minFractionDigits=Q.length}return $},stringify:F2.stringifyNumber};GQ.float=JQ;GQ.floatExp=zQ;GQ.floatNaN=XQ});var i9=N((_Q)=>{var n9=t0(),Iq=(q)=>typeof q==="bigint"||Number.isInteger(q);function K$(q,$,Z,{intAsBigInt:Q}){let X=q[0];if(X==="-"||X==="+")$+=1;if(q=q.substring($).replace(/_/g,""),Q){switch(Z){case 2:q=`0b${q}`;break;case 8:q=`0o${q}`;break;case 16:q=`0x${q}`;break}let J=BigInt(q);return X==="-"?BigInt(-1)*J:J}let z=parseInt(q,Z);return X==="-"?-1*z:z}function A2(q,$,Z){let{value:Q}=q;if(Iq(Q)){let X=Q.toString($);return Q<0?"-"+Z+X.substr(1):Z+X}return n9.stringifyNumber(q)}var WQ={identify:Iq,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(q,$,Z)=>K$(q,2,2,Z),stringify:(q)=>A2(q,2,"0b")},VQ={identify:Iq,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(q,$,Z)=>K$(q,1,8,Z),stringify:(q)=>A2(q,8,"0")},BQ={identify:Iq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(q,$,Z)=>K$(q,0,10,Z),stringify:n9.stringifyNumber},KQ={identify:Iq,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(q,$,Z)=>K$(q,2,16,Z),stringify:(q)=>A2(q,16,"0x")};_Q.int=BQ;_Q.intBin=WQ;_Q.intHex=KQ;_Q.intOct=VQ});var I2=N((MQ)=>{var L$=k(),_$=A0(),O$=M0();class f0 extends O$.YAMLMap{constructor(q){super(q);this.tag=f0.tag}add(q){let $;if(L$.isPair(q))$=q;else if(q&&typeof q==="object"&&"key"in q&&"value"in q&&q.value===null)$=new _$.Pair(q.key,null);else $=new _$.Pair(q,null);if(!O$.findPair(this.items,$.key))this.items.push($)}get(q,$){let Z=O$.findPair(this.items,q);return!$&&L$.isPair(Z)?L$.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=O$.findPair(this.items,q);if(Z&&!$)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&$)this.items.push(new _$.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:Q}=Z,X=new this(q);if($&&Symbol.iterator in Object($))for(let z of $){if(typeof Q==="function")z=Q.call($,z,z);X.items.push(_$.createPair(z,null,Z))}return X}}f0.tag="tag:yaml.org,2002:set";var IQ={collection:"map",identify:(q)=>q instanceof Set,nodeClass:f0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(q,$,Z)=>f0.from(q,$,Z),resolve(q,$){if(L$.isMap(q))if(q.hasAllNullValues(!0))return Object.assign(new f0,q);else $("Set items must all have null values");else $("Expected a mapping for this tag");return q}};MQ.YAMLSet=f0;MQ.set=IQ});var T2=N((NQ)=>{var jQ=t0();function M2(q,$){let Z=q[0],Q=Z==="-"||Z==="+"?q.substring(1):q,X=(J)=>$?BigInt(J):Number(J),z=Q.replace(/_/g,"").split(":").reduce((J,G)=>J*X(60)+X(G),X(0));return Z==="-"?X(-1)*z:z}function o9(q){let{value:$}=q,Z=(J)=>J;if(typeof $==="bigint")Z=(J)=>BigInt(J);else if(isNaN($)||!isFinite($))return jQ.stringifyNumber(q);let Q="";if($<0)Q="-",$*=Z(-1);let X=Z(60),z=[$%X];if($<60)z.unshift(0);else if($=($-z[0])/X,z.unshift($%X),$>=60)$=($-z[0])/X,z.unshift($);return Q+z.map((J)=>String(J).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var wQ={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})=>M2(q,Z),stringify:o9},DQ={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)=>M2(q,!1),stringify:o9},a9={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(a9.test);if(!$)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,Q,X,z,J,G]=$.map(Number),Y=$[7]?Number(($[7]+"00").substr(1,3)):0,H=Date.UTC(Z,Q-1,X,z||0,J||0,G||0,Y),B=$[8];if(B&&B!=="Z"){let W=M2(B,!1);if(Math.abs(W)<30)W*=60;H-=60000*W}return new Date(H)},stringify:({value:q})=>q?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};NQ.floatTime=DQ;NQ.intTime=wQ;NQ.timestamp=a9});var r9=N((mQ)=>{var SQ=s0(),bQ=U$(),xQ=r0(),fQ=Lq(),yQ=K2(),s9=c9(),R2=l9(),F$=i9(),kQ=$$(),vQ=L2(),hQ=B$(),gQ=I2(),j2=T2(),uQ=[SQ.map,xQ.seq,fQ.string,bQ.nullTag,s9.trueTag,s9.falseTag,F$.intBin,F$.intOct,F$.int,F$.intHex,R2.floatNaN,R2.floatExp,R2.float,yQ.binary,kQ.merge,vQ.omap,hQ.pairs,gQ.set,j2.intTime,j2.floatTime,j2.timestamp];mQ.schema=uQ});var G4=N((sQ)=>{var $4=s0(),dQ=U$(),Z4=r0(),cQ=Lq(),lQ=J2(),w2=Y2(),D2=H2(),nQ=x9(),iQ=y9(),Q4=K2(),Mq=$$(),X4=L2(),z4=B$(),t9=r9(),J4=I2(),A$=T2(),e9=new Map([["core",nQ.schema],["failsafe",[$4.map,Z4.seq,cQ.string]],["json",iQ.schema],["yaml11",t9.schema],["yaml-1.1",t9.schema]]),q4={binary:Q4.binary,bool:lQ.boolTag,float:w2.float,floatExp:w2.floatExp,floatNaN:w2.floatNaN,floatTime:A$.floatTime,int:D2.int,intHex:D2.intHex,intOct:D2.intOct,intTime:A$.intTime,map:$4.map,merge:Mq.merge,null:dQ.nullTag,omap:X4.omap,pairs:z4.pairs,seq:Z4.seq,set:J4.set,timestamp:A$.timestamp},oQ={"tag:yaml.org,2002:binary":Q4.binary,"tag:yaml.org,2002:merge":Mq.merge,"tag:yaml.org,2002:omap":X4.omap,"tag:yaml.org,2002:pairs":z4.pairs,"tag:yaml.org,2002:set":J4.set,"tag:yaml.org,2002:timestamp":A$.timestamp};function aQ(q,$,Z){let Q=e9.get($);if(Q&&!q)return Z&&!Q.includes(Mq.merge)?Q.concat(Mq.merge):Q.slice();let X=Q;if(!X)if(Array.isArray(q))X=[];else{let z=Array.from(e9.keys()).filter((J)=>J!=="yaml11").map((J)=>JSON.stringify(J)).join(", ");throw Error(`Unknown schema "${$}"; use one of ${z} or define customTags array`)}if(Array.isArray(q))for(let z of q)X=X.concat(z);else if(typeof q==="function")X=q(X.slice());if(Z)X=X.concat(Mq.merge);return X.reduce((z,J)=>{let G=typeof J==="string"?q4[J]:J;if(!G){let Y=JSON.stringify(J),H=Object.keys(q4).map((B)=>JSON.stringify(B)).join(", ");throw Error(`Unknown custom tag ${Y}; use one of ${H}`)}if(!z.includes(G))z.push(G);return z},[])}sQ.coreKnownTags=oQ;sQ.getTags=aQ});var C2=N((QX)=>{var N2=k(),eQ=s0(),qX=r0(),$X=Lq(),I$=G4(),ZX=(q,$)=>q.key<$.key?-1:q.key>$.key?1:0;class P2{constructor({compat:q,customTags:$,merge:Z,resolveKnownTags:Q,schema:X,sortMapEntries:z,toStringDefaults:J}){this.compat=Array.isArray(q)?I$.getTags(q,"compat"):q?I$.getTags(null,q):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?I$.coreKnownTags:{},this.tags=I$.getTags($,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,N2.MAP,{value:eQ.map}),Object.defineProperty(this,N2.SCALAR,{value:$X.string}),Object.defineProperty(this,N2.SEQ,{value:qX.seq}),this.sortMapEntries=typeof z==="function"?z:z===!0?ZX:null}clone(){let q=Object.create(P2.prototype,Object.getOwnPropertyDescriptors(this));return q.tags=this.tags.slice(),q}}QX.Schema=P2});var Y4=N((GX)=>{var zX=k(),E2=Bq(),Tq=Hq();function JX(q,$){let Z=[],Q=$.directives===!0;if($.directives!==!1&&q.directives){let Y=q.directives.toString(q);if(Y)Z.push(Y),Q=!0;else if(q.directives.docStart)Q=!0}if(Q)Z.push("---");let X=E2.createStringifyContext(q,$),{commentString:z}=X.options;if(q.commentBefore){if(Z.length!==1)Z.unshift("");let Y=z(q.commentBefore);Z.unshift(Tq.indentComment(Y,""))}let J=!1,G=null;if(q.contents){if(zX.isNode(q.contents)){if(q.contents.spaceBefore&&Q)Z.push("");if(q.contents.commentBefore){let B=z(q.contents.commentBefore);Z.push(Tq.indentComment(B,""))}X.forceBlockIndent=!!q.comment,G=q.contents.comment}let Y=G?void 0:()=>J=!0,H=E2.stringify(q.contents,X,()=>G=null,Y);if(G)H+=Tq.lineComment(H,"",z(G));if((H[0]==="|"||H[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${H}`;else Z.push(H)}else Z.push(E2.stringify(q.contents,X));if(q.directives?.docEnd)if(q.comment){let Y=z(q.comment);if(Y.includes(`
|
|
56
|
+
`))Z.push("..."),Z.push(Tq.indentComment(Y,""));else Z.push(`... ${Y}`)}else Z.push("...");else{let Y=q.comment;if(Y&&J)Y=Y.replace(/^\n+/,"");if(Y){if((!J||G)&&Z[Z.length-1]!=="")Z.push("");Z.push(Tq.indentComment(z(Y),""))}}return Z.join(`
|
|
57
57
|
`)+`
|
|
58
|
-
`}
|
|
59
|
-
`;
|
|
58
|
+
`}GX.stringifyDocument=JX});var Rq=N((OX)=>{var UX=Yq(),e0=aq(),r=k(),HX=A0(),WX=O0(),VX=C2(),BX=Y4(),S2=nq(),KX=s$(),_X=Uq(),b2=a$();class x2{constructor(q,$,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let Q=null;if(typeof $==="function"||Array.isArray($))Q=$;else if(Z===void 0&&$)Z=$,$=void 0;let X=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=X;let{version:z}=X;if(Z?._directives){if(this.directives=Z._directives.atDocument(),this.directives.yaml.explicit)z=this.directives.yaml.version}else this.directives=new b2.Directives({version:z});this.setSchema(z,Z),this.contents=q===void 0?null:this.createNode(q,Q,Z)}clone(){let q=Object.create(x2.prototype,{[r.NODE_TYPE]:{value:r.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=r.isNode(this.contents)?this.contents.clone(q.schema):this.contents,this.range)q.range=this.range.slice();return q}add(q){if(qq(this.contents))this.contents.add(q)}addIn(q,$){if(qq(this.contents))this.contents.addIn(q,$)}createAlias(q,$){if(!q.anchor){let Z=S2.anchorNames(this);q.anchor=!$||Z.has($)?S2.findNewAnchor($||"a",Z):$}return new UX.Alias(q.anchor)}createNode(q,$,Z){let Q=void 0;if(typeof $==="function")q=$.call({"":q},"",q),Q=$;else if(Array.isArray($)){let _=(F)=>typeof F==="number"||F instanceof String||F instanceof Number,O=$.filter(_).map(String);if(O.length>0)$=$.concat(O);Q=$}else if(Z===void 0&&$)Z=$,$=void 0;let{aliasDuplicateObjects:X,anchorPrefix:z,flow:J,keepUndefined:G,onTagObj:Y,tag:H}=Z??{},{onAnchor:B,setAnchors:W,sourceObjects:V}=S2.createNodeAnchors(this,z||"a"),K={aliasDuplicateObjects:X??!0,keepUndefined:G??!1,onAnchor:B,onTagObj:Y,replacer:Q,schema:this.schema,sourceObjects:V},L=_X.createNode(q,H,K);if(J&&r.isCollection(L))L.flow=!0;return W(),L}createPair(q,$,Z={}){let Q=this.createNode(q,null,Z),X=this.createNode($,null,Z);return new HX.Pair(Q,X)}delete(q){return qq(this.contents)?this.contents.delete(q):!1}deleteIn(q){if(e0.isEmptyPath(q)){if(this.contents==null)return!1;return this.contents=null,!0}return qq(this.contents)?this.contents.deleteIn(q):!1}get(q,$){return r.isCollection(this.contents)?this.contents.get(q,$):void 0}getIn(q,$){if(e0.isEmptyPath(q))return!$&&r.isScalar(this.contents)?this.contents.value:this.contents;return r.isCollection(this.contents)?this.contents.getIn(q,$):void 0}has(q){return r.isCollection(this.contents)?this.contents.has(q):!1}hasIn(q){if(e0.isEmptyPath(q))return this.contents!==void 0;return r.isCollection(this.contents)?this.contents.hasIn(q):!1}set(q,$){if(this.contents==null)this.contents=e0.collectionFromPath(this.schema,[q],$);else if(qq(this.contents))this.contents.set(q,$)}setIn(q,$){if(e0.isEmptyPath(q))this.contents=$;else if(this.contents==null)this.contents=e0.collectionFromPath(this.schema,Array.from(q),$);else if(qq(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 b2.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 b2.Directives({version:q});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let Q=JSON.stringify(q);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Q}`)}}if($.schema instanceof Object)this.schema=$.schema;else if(Z)this.schema=new VX.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:Q,onAnchor:X,reviver:z}={}){let J={anchors:new Map,doc:this,keep:!q,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},G=WX.toJS(this.contents,$??"",J);if(typeof X==="function")for(let{count:Y,res:H}of J.anchors.values())X(H,Y);return typeof z==="function"?KX.applyReviver(z,{"":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 BX.stringifyDocument(this,q)}}function qq(q){if(r.isCollection(q))return!0;throw Error("Expected a YAML collection as document contents")}OX.Document=x2});var jq=N((AX)=>{class M$ extends Error{constructor(q,$,Z,Q){super();this.name=q,this.code=Z,this.message=Q,this.pos=$}}class U4 extends M${constructor(q,$,Z){super("YAMLParseError",q,$,Z)}}class H4 extends M${constructor(q,$,Z){super("YAMLWarning",q,$,Z)}}var FX=(q,$)=>(Z)=>{if(Z.pos[0]===-1)return;Z.linePos=Z.pos.map((G)=>$.linePos(G));let{line:Q,col:X}=Z.linePos[0];Z.message+=` at line ${Q}, column ${X}`;let z=X-1,J=q.substring($.lineStarts[Q-1],$.lineStarts[Q]).replace(/[\n\r]+$/,"");if(z>=60&&J.length>80){let G=Math.min(z-39,J.length-79);J="…"+J.substring(G),z-=G-1}if(J.length>80)J=J.substring(0,79)+"…";if(Q>1&&/^ *$/.test(J.substring(0,z))){let G=q.substring($.lineStarts[Q-2],$.lineStarts[Q-1]);if(G.length>80)G=G.substring(0,79)+`…
|
|
59
|
+
`;J=G+J}if(/[^ ]/.test(J)){let G=1,Y=Z.linePos[1];if(Y?.line===Q&&Y.col>X)G=Math.max(1,Math.min(Y.col-X,80-z));let H=" ".repeat(z)+"^".repeat(G);Z.message+=`:
|
|
60
60
|
|
|
61
|
-
${
|
|
61
|
+
${J}
|
|
62
62
|
${H}
|
|
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(
|
|
65
|
-
`+
|
|
66
|
-
`+
|
|
67
|
-
`+
|
|
68
|
-
`+
|
|
69
|
-
`+
|
|
70
|
-
`+
|
|
71
|
-
`.repeat(Math.max(1,
|
|
72
|
-
`;for(let B
|
|
73
|
-
`;else if(
|
|
74
|
-
`;else if(!
|
|
75
|
-
`)
|
|
76
|
-
|
|
77
|
-
`;V
|
|
78
|
-
`,
|
|
79
|
-
`)
|
|
80
|
-
`;else
|
|
81
|
-
`;else V
|
|
82
|
-
`+
|
|
83
|
-
`)
|
|
84
|
-
`;break;default:
|
|
85
|
-
`}let
|
|
63
|
+
`}};AX.YAMLError=M$;AX.YAMLParseError=U4;AX.YAMLWarning=H4;AX.prettifyError=FX});var wq=N((wX)=>{function jX(q,{flow:$,indicator:Z,next:Q,offset:X,onError:z,parentIndent:J,startOnNewline:G}){let Y=!1,H=G,B=G,W="",V="",K=!1,L=!1,_=null,O=null,F=null,T=null,R=null,j=null,I=null;for(let D of q){if(L){if(D.type!=="space"&&D.type!=="newline"&&D.type!=="comma")z(D.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(_){if(H&&D.type!=="comment"&&D.type!=="newline")z(_,"TAB_AS_INDENT","Tabs are not allowed as indentation");_=null}switch(D.type){case"space":if(!$&&(Z!=="doc-start"||Q?.type!=="flow-collection")&&D.source.includes("\t"))_=D;B=!0;break;case"comment":{if(!B)z(D,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let y=D.source.substring(1)||" ";if(!W)W=y;else W+=V+y;V="",H=!1;break}case"newline":if(H){if(W)W+=D.source;else if(!j||Z!=="seq-item-ind")Y=!0}else V+=D.source;if(H=!0,K=!0,O||F)T=D;B=!0;break;case"anchor":if(O)z(D,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(D.source.endsWith(":"))z(D.offset+D.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);O=D,I??(I=D.offset),H=!1,B=!1,L=!0;break;case"tag":{if(F)z(D,"MULTIPLE_TAGS","A node can have at most one tag");F=D,I??(I=D.offset),H=!1,B=!1,L=!0;break}case Z:if(O||F)z(D,"BAD_PROP_ORDER",`Anchors and tags must be after the ${D.source} indicator`);if(j)z(D,"UNEXPECTED_TOKEN",`Unexpected ${D.source} in ${$??"collection"}`);j=D,H=Z==="seq-item-ind"||Z==="explicit-key-ind",B=!1;break;case"comma":if($){if(R)z(D,"UNEXPECTED_TOKEN",`Unexpected , in ${$}`);R=D,H=!1,B=!1;break}default:z(D,"UNEXPECTED_TOKEN",`Unexpected ${D.type} token`),H=!1,B=!1}}let w=q[q.length-1],x=w?w.offset+w.source.length:X;if(L&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))z(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(_&&(H&&_.indent<=J||Q?.type==="block-map"||Q?.type==="block-seq"))z(_,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:R,found:j,spaceBefore:Y,comment:W,hasNewline:K,anchor:O,tag:F,newlineAfterProp:T,end:x,start:I??x}}wX.resolveProps=jX});var T$=N((NX)=>{function f2(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(f2($.key)||f2($.value))return!0}return!1;default:return!0}}NX.containsNewline=f2});var y2=N((SX)=>{var CX=T$();function EX(q,$,Z){if($?.type==="flow-collection"){let Q=$.end[0];if(Q.indent===q&&(Q.source==="]"||Q.source==="}")&&CX.containsNewline($))Z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}SX.flowIndentCheck=EX});var k2=N((fX)=>{var W4=k();function xX(q,$,Z){let{uniqueKeys:Q}=q.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(z,J)=>z===J||W4.isScalar(z)&&W4.isScalar(J)&&z.value===J.value;return $.some((z)=>X(z.key,Z))}fX.mapIncludes=xX});var O4=N((uX)=>{var V4=A0(),kX=M0(),B4=wq(),vX=T$(),K4=y2(),hX=k2(),_4="All mapping items must start at the same column";function gX({composeNode:q,composeEmptyNode:$},Z,Q,X,z){let G=new(z?.nodeClass??kX.YAMLMap)(Z.schema);if(Z.atRoot)Z.atRoot=!1;let Y=Q.offset,H=null;for(let B of Q.items){let{start:W,key:V,sep:K,value:L}=B,_=B4.resolveProps(W,{indicator:"explicit-key-ind",next:V??K?.[0],offset:Y,onError:X,parentIndent:Q.indent,startOnNewline:!0}),O=!_.found;if(O){if(V){if(V.type==="block-seq")X(Y,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in V&&V.indent!==Q.indent)X(Y,"BAD_INDENT",_4)}if(!_.anchor&&!_.tag&&!K){if(H=_.end,_.comment)if(G.comment)G.comment+=`
|
|
65
|
+
`+_.comment;else G.comment=_.comment;continue}if(_.newlineAfterProp||vX.containsNewline(V))X(V??W[W.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(_.found?.indent!==Q.indent)X(Y,"BAD_INDENT",_4);Z.atKey=!0;let F=_.end,T=V?q(Z,V,_,X):$(Z,F,W,null,_,X);if(Z.schema.compat)K4.flowIndentCheck(Q.indent,V,X);if(Z.atKey=!1,hX.mapIncludes(Z,G.items,T))X(F,"DUPLICATE_KEY","Map keys must be unique");let R=B4.resolveProps(K??[],{indicator:"map-value-ind",next:L,offset:T.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!V||V.type==="block-scalar"});if(Y=R.end,R.found){if(O){if(L?.type==="block-map"&&!R.hasNewline)X(Y,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(Z.options.strict&&_.start<R.found.offset-1024)X(T.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let j=L?q(Z,L,R,X):$(Z,Y,K,null,R,X);if(Z.schema.compat)K4.flowIndentCheck(Q.indent,L,X);Y=j.range[2];let I=new V4.Pair(T,j);if(Z.options.keepSourceTokens)I.srcToken=B;G.items.push(I)}else{if(O)X(T.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(R.comment)if(T.comment)T.comment+=`
|
|
66
|
+
`+R.comment;else T.comment=R.comment;let j=new V4.Pair(T);if(Z.options.keepSourceTokens)j.srcToken=B;G.items.push(j)}}if(H&&H<Y)X(H,"IMPOSSIBLE","Map comment with trailing content");return G.range=[Q.offset,Y,H??Y],G}uX.resolveBlockMap=gX});var L4=N((nX)=>{var pX=T0(),dX=wq(),cX=y2();function lX({composeNode:q,composeEmptyNode:$},Z,Q,X,z){let G=new(z?.nodeClass??pX.YAMLSeq)(Z.schema);if(Z.atRoot)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let Y=Q.offset,H=null;for(let{start:B,value:W}of Q.items){let V=dX.resolveProps(B,{indicator:"seq-item-ind",next:W,offset:Y,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!V.found)if(V.anchor||V.tag||W)if(W?.type==="block-seq")X(V.end,"BAD_INDENT","All sequence items must start at the same column");else X(Y,"MISSING_CHAR","Sequence item without - indicator");else{if(H=V.end,V.comment)G.comment=V.comment;continue}let K=W?q(Z,W,V,X):$(Z,V.end,B,null,V,X);if(Z.schema.compat)cX.flowIndentCheck(Q.indent,W,X);Y=K.range[2],G.items.push(K)}return G.range=[Q.offset,Y,H??Y],G}nX.resolveBlockSeq=lX});var $q=N((aX)=>{function oX(q,$,Z,Q){let X="";if(q){let z=!1,J="";for(let G of q){let{source:Y,type:H}=G;switch(H){case"space":z=!0;break;case"comment":{if(Z&&!z)Q(G,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let B=Y.substring(1)||" ";if(!X)X=B;else X+=J+B;J="";break}case"newline":if(X)J+=Y;z=!0;break;default:Q(G,"UNEXPECTED_TOKEN",`Unexpected ${H} at node end`)}$+=Y.length}}return{comment:X,offset:$}}aX.resolveEnd=oX});var I4=N((Xz)=>{var rX=k(),tX=A0(),F4=M0(),eX=T0(),qz=$q(),A4=wq(),$z=T$(),Zz=k2(),v2="Block collections are not allowed within flow collections",h2=(q)=>q&&(q.type==="block-map"||q.type==="block-seq");function Qz({composeNode:q,composeEmptyNode:$},Z,Q,X,z){let J=Q.start.source==="{",G=J?"flow map":"flow sequence",H=new(z?.nodeClass??(J?F4.YAMLMap:eX.YAMLSeq))(Z.schema);H.flow=!0;let B=Z.atRoot;if(B)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let W=Q.offset+Q.start.source.length;for(let O=0;O<Q.items.length;++O){let F=Q.items[O],{start:T,key:R,sep:j,value:I}=F,w=A4.resolveProps(T,{flow:G,indicator:"explicit-key-ind",next:R??j?.[0],offset:W,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!w.found){if(!w.anchor&&!w.tag&&!j&&!I){if(O===0&&w.comma)X(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`);else if(O<Q.items.length-1)X(w.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${G}`);if(w.comment)if(H.comment)H.comment+=`
|
|
67
|
+
`+w.comment;else H.comment=w.comment;W=w.end;continue}if(!J&&Z.options.strict&&$z.containsNewline(R))X(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(O===0){if(w.comma)X(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`)}else{if(!w.comma)X(w.start,"MISSING_CHAR",`Missing , between ${G} items`);if(w.comment){let x="";q:for(let D of T)switch(D.type){case"comma":case"space":break;case"comment":x=D.source.substring(1);break q;default:break q}if(x){let D=H.items[H.items.length-1];if(rX.isPair(D))D=D.value??D.key;if(D.comment)D.comment+=`
|
|
68
|
+
`+x;else D.comment=x;w.comment=w.comment.substring(x.length+1)}}}if(!J&&!j&&!w.found){let x=I?q(Z,I,w,X):$(Z,w.end,j,null,w,X);if(H.items.push(x),W=x.range[2],h2(I))X(x.range,"BLOCK_IN_FLOW",v2)}else{Z.atKey=!0;let x=w.end,D=R?q(Z,R,w,X):$(Z,x,T,null,w,X);if(h2(R))X(D.range,"BLOCK_IN_FLOW",v2);Z.atKey=!1;let y=A4.resolveProps(j??[],{flow:G,indicator:"map-value-ind",next:I,offset:D.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(y.found){if(!J&&!w.found&&Z.options.strict){if(j)for(let P of j){if(P===y.found)break;if(P.type==="newline"){X(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(w.start<y.found.offset-1024)X(y.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(I)if("source"in I&&I.source?.[0]===":")X(I,"MISSING_CHAR",`Missing space after : in ${G}`);else X(y.start,"MISSING_CHAR",`Missing , or : between ${G} items`);let A=I?q(Z,I,y,X):y.found?$(Z,y.end,j,null,y,X):null;if(A){if(h2(I))X(A.range,"BLOCK_IN_FLOW",v2)}else if(y.comment)if(D.comment)D.comment+=`
|
|
69
|
+
`+y.comment;else D.comment=y.comment;let M=new tX.Pair(D,A);if(Z.options.keepSourceTokens)M.srcToken=F;if(J){let P=H;if(Zz.mapIncludes(Z,P.items,D))X(x,"DUPLICATE_KEY","Map keys must be unique");P.items.push(M)}else{let P=new F4.YAMLMap(Z.schema);P.flow=!0,P.items.push(M);let S=(A??D).range;P.range=[D.range[0],S[1],S[2]],H.items.push(P)}W=A?A.range[2]:y.end}}let V=J?"}":"]",[K,...L]=Q.end,_=W;if(K?.source===V)_=K.offset+K.source.length;else{let O=G[0].toUpperCase()+G.substring(1),F=B?`${O} must end with a ${V}`:`${O} in block collection must be sufficiently indented and end with a ${V}`;if(X(W,B?"MISSING_CHAR":"BAD_INDENT",F),K&&K.source.length!==1)L.unshift(K)}if(L.length>0){let O=qz.resolveEnd(L,_,Z.options.strict,X);if(O.comment)if(H.comment)H.comment+=`
|
|
70
|
+
`+O.comment;else H.comment=O.comment;H.range=[Q.offset,_,O.offset]}else H.range=[Q.offset,_,_];return H}Xz.resolveFlowCollection=Qz});var M4=N((Kz)=>{var Jz=k(),Gz=g(),Yz=M0(),Uz=T0(),Hz=O4(),Wz=L4(),Vz=I4();function g2(q,$,Z,Q,X,z){let J=Z.type==="block-map"?Hz.resolveBlockMap(q,$,Z,Q,z):Z.type==="block-seq"?Wz.resolveBlockSeq(q,$,Z,Q,z):Vz.resolveFlowCollection(q,$,Z,Q,z),G=J.constructor;if(X==="!"||X===G.tagName)return J.tag=G.tagName,J;if(X)J.tag=X;return J}function Bz(q,$,Z,Q,X){let z=Q.tag,J=!z?null:$.directives.tagName(z.source,(V)=>X(z,"TAG_RESOLVE_FAILED",V));if(Z.type==="block-seq"){let{anchor:V,newlineAfterProp:K}=Q,L=V&&z?V.offset>z.offset?V:z:V??z;if(L&&(!K||K.offset<L.offset))X(L,"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(!z||!J||J==="!"||J===Yz.YAMLMap.tagName&&G==="map"||J===Uz.YAMLSeq.tagName&&G==="seq")return g2(q,$,Z,X,J);let Y=$.schema.tags.find((V)=>V.tag===J&&V.collection===G);if(!Y){let V=$.schema.knownTags[J];if(V?.collection===G)$.schema.tags.push(Object.assign({},V,{default:!1})),Y=V;else{if(V)X(z,"BAD_COLLECTION_TYPE",`${V.tag} used for ${G} collection, but expects ${V.collection??"scalar"}`,!0);else X(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${J}`,!0);return g2(q,$,Z,X,J)}}let H=g2(q,$,Z,X,J,Y),B=Y.resolve?.(H,(V)=>X(z,"TAG_RESOLVE_FAILED",V),$.options)??H,W=Jz.isNode(B)?B:new Gz.Scalar(B);if(W.range=H.range,W.tag=J,Y?.format)W.format=Y.format;return W}Kz.composeCollection=Bz});var m2=N((Az)=>{var u2=g();function Oz(q,$,Z){let Q=$.offset,X=Lz($,q.options.strict,Z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let z=X.mode===">"?u2.Scalar.BLOCK_FOLDED:u2.Scalar.BLOCK_LITERAL,J=$.source?Fz($.source):[],G=J.length;for(let _=J.length-1;_>=0;--_){let O=J[_][1];if(O===""||O==="\r")G=_;else break}if(G===0){let _=X.chomp==="+"&&J.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,J.length-1)):"",O=Q+X.length;if($.source)O+=$.source.length;return{value:_,type:z,comment:X.comment,range:[Q,O,O]}}let Y=$.indent+X.indent,H=$.offset+X.length,B=0;for(let _=0;_<G;++_){let[O,F]=J[_];if(F===""||F==="\r"){if(X.indent===0&&O.length>Y)Y=O.length}else{if(O.length<Y)Z(H+O.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)Y=O.length;if(B=_,Y===0&&!q.atRoot)Z(H,"BAD_INDENT","Block scalar values in collections must be indented");break}H+=O.length+F.length+1}for(let _=J.length-1;_>=G;--_)if(J[_][0].length>Y)G=_+1;let W="",V="",K=!1;for(let _=0;_<B;++_)W+=J[_][0].slice(Y)+`
|
|
72
|
+
`;for(let _=B;_<G;++_){let[O,F]=J[_];H+=O.length+F.length+1;let T=F[F.length-1]==="\r";if(T)F=F.slice(0,-1);if(F&&O.length<Y){let j=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;Z(H-F.length-(T?2:1),"BAD_INDENT",j),O=""}if(z===u2.Scalar.BLOCK_LITERAL)W+=V+O.slice(Y)+F,V=`
|
|
73
|
+
`;else if(O.length>Y||F[0]==="\t"){if(V===" ")V=`
|
|
74
|
+
`;else if(!K&&V===`
|
|
75
|
+
`)V=`
|
|
76
|
+
|
|
77
|
+
`;W+=V+O.slice(Y)+F,V=`
|
|
78
|
+
`,K=!0}else if(F==="")if(V===`
|
|
79
|
+
`)W+=`
|
|
80
|
+
`;else V=`
|
|
81
|
+
`;else W+=V+F,V=" ",K=!1}switch(X.chomp){case"-":break;case"+":for(let _=G;_<J.length;++_)W+=`
|
|
82
|
+
`+J[_][0].slice(Y);if(W[W.length-1]!==`
|
|
83
|
+
`)W+=`
|
|
84
|
+
`;break;default:W+=`
|
|
85
|
+
`}let L=Q+X.length+$.source.length;return{value:W,type:z,comment:X.comment,range:[Q,L,L]}}function Lz({offset:q,props:$},Z,Q){if($[0].type!=="block-scalar-header")return Q($[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=$[0],z=X[0],J=0,G="",Y=-1;for(let V=1;V<X.length;++V){let K=X[V];if(!G&&(K==="-"||K==="+"))G=K;else{let L=Number(K);if(!J&&L)J=L;else if(Y===-1)Y=q+V}}if(Y!==-1)Q(Y,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let H=!1,B="",W=X.length;for(let V=1;V<$.length;++V){let K=$[V];switch(K.type){case"space":H=!0;case"newline":W+=K.source.length;break;case"comment":if(Z&&!H)Q(K,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");W+=K.source.length,B=K.source.substring(1);break;case"error":Q(K,"UNEXPECTED_TOKEN",K.message),W+=K.source.length;break;default:{let L=`Unexpected token in block scalar header: ${K.type}`;Q(K,"UNEXPECTED_TOKEN",L);let _=K.source;if(_&&typeof _==="string")W+=_.length}}}return{mode:z,indent:J,chomp:G,comment:B,length:W}}function Fz(q){let $=q.split(/\n( *)/),Z=$[0],Q=Z.match(/^( *)/),z=[Q?.[1]?[Q[1],Z.slice(Q[1].length)]:["",Z]];for(let J=1;J<$.length;J+=2)z.push([$[J],$[J+1]]);return z}Az.resolveBlockScalar=Oz});var d2=N((Cz)=>{var p2=g(),Mz=$q();function Tz(q,$,Z){let{offset:Q,type:X,source:z,end:J}=q,G,Y,H=(V,K,L)=>Z(Q+V,K,L);switch(X){case"scalar":G=p2.Scalar.PLAIN,Y=Rz(z,H);break;case"single-quoted-scalar":G=p2.Scalar.QUOTE_SINGLE,Y=jz(z,H);break;case"double-quoted-scalar":G=p2.Scalar.QUOTE_DOUBLE,Y=wz(z,H);break;default:return Z(q,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${X}`),{value:"",type:null,comment:"",range:[Q,Q+z.length,Q+z.length]}}let B=Q+z.length,W=Mz.resolveEnd(J,B,$,Z);return{value:Y,type:G,comment:W.comment,range:[Q,B,W.offset]}}function Rz(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 T4(q)}function jz(q,$){if(q[q.length-1]!=="'"||q.length===1)$(q.length,"MISSING_CHAR","Missing closing 'quote");return T4(q.slice(1,-1)).replace(/''/g,"'")}function T4(q){let $,Z;try{$=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
86
|
`,"sy"),Z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
|
-
`,"sy")}catch{$=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let
|
|
88
|
-
`)
|
|
89
|
-
`;else
|
|
90
|
-
`)continue;if(
|
|
91
|
-
`){let{fold:
|
|
92
|
-
`){
|
|
93
|
-
`){
|
|
94
|
-
`&&!(
|
|
95
|
-
`))Z+=
|
|
96
|
-
`||
|
|
97
|
-
`)break;if(
|
|
87
|
+
`,"sy")}catch{$=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Q=$.exec(q);if(!Q)return q;let X=Q[1],z=" ",J=$.lastIndex;Z.lastIndex=J;while(Q=Z.exec(q)){if(Q[1]==="")if(z===`
|
|
88
|
+
`)X+=z;else z=`
|
|
89
|
+
`;else X+=z+Q[1],z=" ";J=Z.lastIndex}let G=/[ \t]*(.*)/sy;return G.lastIndex=J,Q=G.exec(q),X+z+(Q?.[1]??"")}function wz(q,$){let Z="";for(let Q=1;Q<q.length-1;++Q){let X=q[Q];if(X==="\r"&&q[Q+1]===`
|
|
90
|
+
`)continue;if(X===`
|
|
91
|
+
`){let{fold:z,offset:J}=Dz(q,Q);Z+=z,Q=J}else if(X==="\\"){let z=q[++Q],J=Nz[z];if(J)Z+=J;else if(z===`
|
|
92
|
+
`){z=q[Q+1];while(z===" "||z==="\t")z=q[++Q+1]}else if(z==="\r"&&q[Q+1]===`
|
|
93
|
+
`){z=q[++Q+1];while(z===" "||z==="\t")z=q[++Q+1]}else if(z==="x"||z==="u"||z==="U"){let G={x:2,u:4,U:8}[z];Z+=Pz(q,Q+1,G,$),Q+=G}else{let G=q.substr(Q-1,2);$(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),Z+=G}}else if(X===" "||X==="\t"){let z=Q,J=q[Q+1];while(J===" "||J==="\t")J=q[++Q+1];if(J!==`
|
|
94
|
+
`&&!(J==="\r"&&q[Q+2]===`
|
|
95
|
+
`))Z+=Q>z?q.slice(z,Q+1):X}else Z+=X}if(q[q.length-1]!=='"'||q.length===1)$(q.length,"MISSING_CHAR",'Missing closing "quote');return Z}function Dz(q,$){let Z="",Q=q[$+1];while(Q===" "||Q==="\t"||Q===`
|
|
96
|
+
`||Q==="\r"){if(Q==="\r"&&q[$+2]!==`
|
|
97
|
+
`)break;if(Q===`
|
|
98
98
|
`)Z+=`
|
|
99
|
-
`;$+=1,
|
|
100
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
99
|
+
`;$+=1,Q=q[$+1]}if(!Z)Z=" ";return{fold:Z,offset:$}}var Nz={"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 Pz(q,$,Z,Q){let X=q.substr($,Z),J=X.length===Z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;if(isNaN(J)){let G=q.substr($-2,Z+2);return Q($-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),G}return String.fromCodePoint(J)}Cz.resolveFlowScalar=Tz});var j4=N((kz)=>{var y0=k(),R4=g(),Sz=m2(),bz=d2();function xz(q,$,Z,Q){let{value:X,type:z,comment:J,range:G}=$.type==="block-scalar"?Sz.resolveBlockScalar(q,$,Q):bz.resolveFlowScalar($,q.options.strict,Q),Y=Z?q.directives.tagName(Z.source,(W)=>Q(Z,"TAG_RESOLVE_FAILED",W)):null,H;if(q.options.stringKeys&&q.atKey)H=q.schema[y0.SCALAR];else if(Y)H=fz(q.schema,X,Y,Z,Q);else if($.type==="scalar")H=yz(q,X,$,Q);else H=q.schema[y0.SCALAR];let B;try{let W=H.resolve(X,(V)=>Q(Z??$,"TAG_RESOLVE_FAILED",V),q.options);B=y0.isScalar(W)?W:new R4.Scalar(W)}catch(W){let V=W instanceof Error?W.message:String(W);Q(Z??$,"TAG_RESOLVE_FAILED",V),B=new R4.Scalar(X)}if(B.range=G,B.source=X,z)B.type=z;if(Y)B.tag=Y;if(H.format)B.format=H.format;if(J)B.comment=J;return B}function fz(q,$,Z,Q,X){if(Z==="!")return q[y0.SCALAR];let z=[];for(let G of q.tags)if(!G.collection&&G.tag===Z)if(G.default&&G.test)z.push(G);else return G;for(let G of z)if(G.test?.test($))return G;let J=q.knownTags[Z];if(J&&!J.collection)return q.tags.push(Object.assign({},J,{default:!1,test:void 0})),J;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Z}`,Z!=="tag:yaml.org,2002:str"),q[y0.SCALAR]}function yz({atKey:q,directives:$,schema:Z},Q,X,z){let J=Z.tags.find((G)=>(G.default===!0||q&&G.default==="key")&&G.test?.test(Q))||Z[y0.SCALAR];if(Z.compat){let G=Z.compat.find((Y)=>Y.default&&Y.test?.test(Q))??Z[y0.SCALAR];if(J.tag!==G.tag){let Y=$.tagString(J.tag),H=$.tagString(G.tag),B=`Value may be parsed as either ${Y} or ${H}`;z(X,"TAG_RESOLVE_FAILED",B,!0)}}return J}kz.composeScalar=xz});var w4=N((gz)=>{function hz(q,$,Z){if($){Z??(Z=$.length);for(let Q=Z-1;Q>=0;--Q){let X=$[Q];switch(X.type){case"space":case"comment":case"newline":q-=X.source.length;continue}X=$[++Q];while(X?.type==="space")q+=X.source.length,X=$[++Q];break}}return q}gz.emptyScalarPosition=hz});var P4=N((oz)=>{var mz=Yq(),pz=k(),dz=M4(),D4=j4(),cz=$q(),lz=w4(),nz={composeNode:N4,composeEmptyNode:c2};function N4(q,$,Z,Q){let X=q.atKey,{spaceBefore:z,comment:J,anchor:G,tag:Y}=Z,H,B=!0;switch($.type){case"alias":if(H=iz(q,$,Q),G||Y)Q($,"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(H=D4.composeScalar(q,$,Y,Q),G)H.anchor=G.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(H=dz.composeCollection(nz,q,$,Z,Q),G)H.anchor=G.source.substring(1);break;default:{let W=$.type==="error"?$.message:`Unsupported token (type: ${$.type})`;Q($,"UNEXPECTED_TOKEN",W),H=c2(q,$.offset,void 0,null,Z,Q),B=!1}}if(G&&H.anchor==="")Q(G,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&q.options.stringKeys&&(!pz.isScalar(H)||typeof H.value!=="string"||H.tag&&H.tag!=="tag:yaml.org,2002:str"))Q(Y??$,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(z)H.spaceBefore=!0;if(J)if($.type==="scalar"&&$.source==="")H.comment=J;else H.commentBefore=J;if(q.options.keepSourceTokens&&B)H.srcToken=$;return H}function c2(q,$,Z,Q,{spaceBefore:X,comment:z,anchor:J,tag:G,end:Y},H){let B={type:"scalar",offset:lz.emptyScalarPosition($,Z,Q),indent:-1,source:""},W=D4.composeScalar(q,B,G,H);if(J){if(W.anchor=J.source.substring(1),W.anchor==="")H(J,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)W.spaceBefore=!0;if(z)W.comment=z,W.range[2]=Y;return W}function iz({options:q},{offset:$,source:Z,end:Q},X){let z=new mz.Alias(Z.substring(1));if(z.source==="")X($,"BAD_ALIAS","Alias cannot be an empty string");if(z.source.endsWith(":"))X($+Z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let J=$+Z.length,G=cz.resolveEnd(Q,J,q.strict,X);if(z.range=[$,J,G.offset],G.comment)z.comment=G.comment;return z}oz.composeEmptyNode=c2;oz.composeNode=N4});var E4=N(($J)=>{var rz=Rq(),C4=P4(),tz=$q(),ez=wq();function qJ(q,$,{offset:Z,start:Q,value:X,end:z},J){let G=Object.assign({_directives:$},q),Y=new rz.Document(void 0,G),H={atKey:!1,atRoot:!0,directives:Y.directives,options:Y.options,schema:Y.schema},B=ez.resolveProps(Q,{indicator:"doc-start",next:X??z?.[0],offset:Z,onError:J,parentIndent:0,startOnNewline:!0});if(B.found){if(Y.directives.docStart=!0,X&&(X.type==="block-map"||X.type==="block-seq")&&!B.hasNewline)J(B.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}Y.contents=X?C4.composeNode(H,X,B,J):C4.composeEmptyNode(H,B.end,Q,null,B,J);let W=Y.contents.range[2],V=tz.resolveEnd(z,W,!1,J);if(V.comment)Y.comment=V.comment;return Y.range=[Z,W,V.offset],Y}$J.composeDoc=qJ});var l2=N((YJ)=>{var QJ=h("process"),XJ=a$(),zJ=Rq(),Dq=jq(),S4=k(),JJ=E4(),GJ=$q();function Nq(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 b4(q){let $="",Z=!1,Q=!1;for(let X=0;X<q.length;++X){let z=q[X];switch(z[0]){case"#":$+=($===""?"":Q?`
|
|
101
101
|
|
|
102
102
|
`:`
|
|
103
|
-
`)+(
|
|
104
|
-
${Z}`:Z;else if(
|
|
105
|
-
${
|
|
106
|
-
${
|
|
107
|
-
${$.comment}`:$.comment}this.doc.range[2]=$.offset;break}default:this.errors.push(new
|
|
108
|
-
`}];switch(
|
|
109
|
-
`),
|
|
110
|
-
`,
|
|
111
|
-
`});return{type:"block-scalar",offset:
|
|
112
|
-
`),
|
|
113
|
-
`;if(q.type==="block-scalar"){let
|
|
114
|
-
`});for(let
|
|
115
|
-
`};delete q.items,Object.assign(q,{type:Z,source:$,end:[
|
|
103
|
+
`)+(z.substring(1)||" "),Z=!0,Q=!1;break;case"%":if(q[X+1]?.[0]!=="#")X+=1;Z=!1;break;default:if(!Z)Q=!0;Z=!1}}return{comment:$,afterEmptyLine:Q}}class x4{constructor(q={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=($,Z,Q,X)=>{let z=Nq($);if(X)this.warnings.push(new Dq.YAMLWarning(z,Z,Q));else this.errors.push(new Dq.YAMLParseError(z,Z,Q))},this.directives=new XJ.Directives({version:q.version||"1.2"}),this.options=q}decorate(q,$){let{comment:Z,afterEmptyLine:Q}=b4(this.prelude);if(Z){let X=q.contents;if($)q.comment=q.comment?`${q.comment}
|
|
104
|
+
${Z}`:Z;else if(Q||q.directives.docStart||!X)q.commentBefore=Z;else if(S4.isCollection(X)&&!X.flow&&X.items.length>0){let z=X.items[0];if(S4.isPair(z))z=z.key;let J=z.commentBefore;z.commentBefore=J?`${Z}
|
|
105
|
+
${J}`:Z}else{let z=X.commentBefore;X.commentBefore=z?`${Z}
|
|
106
|
+
${z}`: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:b4(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(q,$=!1,Z=-1){for(let Q of q)yield*this.next(Q);yield*this.end($,Z)}*next(q){if(QJ.env.LOG_STREAM)console.dir(q,{depth:null});switch(q.type){case"directive":this.directives.add(q.source,($,Z,Q)=>{let X=Nq(q);X[0]+=$,this.onError(X,"BAD_DIRECTIVE",Z,Q)}),this.prelude.push(q.source),this.atDirectives=!0;break;case"document":{let $=JJ.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 Dq.YAMLParseError(Nq(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 Dq.YAMLParseError(Nq(q),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let $=GJ.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 Dq.YAMLParseError(Nq(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),Q=new zJ.Document(void 0,Z);if(this.atDirectives)this.onError($,"MISSING_CHAR","Missing directives-end indicator line");Q.range=[0,$,$],this.decorate(Q,!1),yield Q}}}YJ.Composer=x4});var k4=N((LJ)=>{var HJ=m2(),WJ=d2(),VJ=jq(),f4=Vq();function BJ(q,$=!0,Z){if(q){let Q=(X,z,J)=>{let G=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(Z)Z(G,z,J);else throw new VJ.YAMLParseError([G,G+1],z,J)};switch(q.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return WJ.resolveFlowScalar(q,$,Q);case"block-scalar":return HJ.resolveBlockScalar({options:{strict:$}},q,Q)}}return null}function KJ(q,$){let{implicitKey:Z=!1,indent:Q,inFlow:X=!1,offset:z=-1,type:J="PLAIN"}=$,G=f4.stringifyString({type:J,value:q},{implicitKey:Z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),Y=$.end??[{type:"newline",offset:-1,indent:Q,source:`
|
|
108
|
+
`}];switch(G[0]){case"|":case">":{let H=G.indexOf(`
|
|
109
|
+
`),B=G.substring(0,H),W=G.substring(H+1)+`
|
|
110
|
+
`,V=[{type:"block-scalar-header",offset:z,indent:Q,source:B}];if(!y4(V,Y))V.push({type:"newline",offset:-1,indent:Q,source:`
|
|
111
|
+
`});return{type:"block-scalar",offset:z,indent:Q,props:V,source:W}}case'"':return{type:"double-quoted-scalar",offset:z,indent:Q,source:G,end:Y};case"'":return{type:"single-quoted-scalar",offset:z,indent:Q,source:G,end:Y};default:return{type:"scalar",offset:z,indent:Q,source:G,end:Y}}}function _J(q,$,Z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:z=!1,type:J}=Z,G="indent"in q?q.indent:null;if(Q&&typeof G==="number")G+=2;if(!J)switch(q.type){case"single-quoted-scalar":J="QUOTE_SINGLE";break;case"double-quoted-scalar":J="QUOTE_DOUBLE";break;case"block-scalar":{let H=q.props[0];if(H.type!=="block-scalar-header")throw Error("Invalid block scalar header");J=H.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:J="PLAIN"}let Y=f4.stringifyString({type:J,value:$},{implicitKey:X||G===null,indent:G!==null&&G>0?" ".repeat(G):"",inFlow:z,options:{blockQuote:!0,lineWidth:-1}});switch(Y[0]){case"|":case">":OJ(q,Y);break;case'"':n2(q,Y,"double-quoted-scalar");break;case"'":n2(q,Y,"single-quoted-scalar");break;default:n2(q,Y,"scalar")}}function OJ(q,$){let Z=$.indexOf(`
|
|
112
|
+
`),Q=$.substring(0,Z),X=$.substring(Z+1)+`
|
|
113
|
+
`;if(q.type==="block-scalar"){let z=q.props[0];if(z.type!=="block-scalar-header")throw Error("Invalid block scalar header");z.source=Q,q.source=X}else{let{offset:z}=q,J="indent"in q?q.indent:-1,G=[{type:"block-scalar-header",offset:z,indent:J,source:Q}];if(!y4(G,"end"in q?q.end:void 0))G.push({type:"newline",offset:-1,indent:J,source:`
|
|
114
|
+
`});for(let Y of Object.keys(q))if(Y!=="type"&&Y!=="offset")delete q[Y];Object.assign(q,{type:"block-scalar",indent:J,props:G,source:X})}}function y4(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 n2(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 Q=q.props.slice(1),X=$.length;if(q.props[0].type==="block-scalar-header")X-=q.props[0].source.length;for(let z of Q)z.offset+=X;delete q.props,Object.assign(q,{type:Z,source:$,end:Q});break}case"block-map":case"block-seq":{let X={type:"newline",offset:q.offset+$.length,indent:q.indent,source:`
|
|
115
|
+
`};delete q.items,Object.assign(q,{type:Z,source:$,end:[X]});break}default:{let Q="indent"in q?q.indent:-1,X="end"in q&&Array.isArray(q.end)?q.end.filter((z)=>z.type==="space"||z.type==="comment"||z.type==="newline"):[];for(let z of Object.keys(q))if(z!=="type"&&z!=="offset")delete q[z];Object.assign(q,{type:Z,indent:Q,source:$,end:X})}}}LJ.createScalarToken=KJ;LJ.resolveAsScalar=BJ;LJ.setScalarValue=_J});var v4=N((TJ)=>{var MJ=(q)=>("type"in q)?j$(q):R$(q);function j$(q){switch(q.type){case"block-scalar":{let $="";for(let Z of q.props)$+=j$(Z);return $+q.source}case"block-map":case"block-seq":{let $="";for(let Z of q.items)$+=R$(Z);return $}case"flow-collection":{let $=q.start.source;for(let Z of q.items)$+=R$(Z);for(let Z of q.end)$+=Z.source;return $}case"document":{let $=R$(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 R$({start:q,key:$,sep:Z,value:Q}){let X="";for(let z of q)X+=z.source;if($)X+=j$($);if(Z)for(let z of Z)X+=z.source;if(Q)X+=j$(Q);return X}TJ.stringify=MJ});var u4=N((wJ)=>{var i2=Symbol("break visit"),jJ=Symbol("skip children"),h4=Symbol("remove item");function k0(q,$){if("type"in q&&q.type==="document")q={start:q.start,value:q.value};g4(Object.freeze([]),q,$)}k0.BREAK=i2;k0.SKIP=jJ;k0.REMOVE=h4;k0.itemAtPath=(q,$)=>{let Z=q;for(let[Q,X]of $){let z=Z?.[Q];if(z&&"items"in z)Z=z.items[X];else return}return Z};k0.parentCollection=(q,$)=>{let Z=k0.itemAtPath(q,$.slice(0,-1)),Q=$[$.length-1][0],X=Z?.[Q];if(X&&"items"in X)return X;throw Error("Parent collection not found")};function g4(q,$,Z){let Q=Z($,q);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let z=$[X];if(z&&"items"in z){for(let J=0;J<z.items.length;++J){let G=g4(Object.freeze(q.concat([[X,J]])),z.items[J],Z);if(typeof G==="number")J=G-1;else if(G===i2)return i2;else if(G===h4)z.items.splice(J,1),J-=1}if(typeof Q==="function"&&X==="key")Q=Q($,q)}}return typeof Q==="function"?Q($,q):Q}wJ.visit=k0});var w$=N((xJ)=>{var o2=k4(),NJ=v4(),PJ=u4(),a2="\uFEFF",s2="\x02",r2="\x18",t2="\x1F",CJ=(q)=>!!q&&("items"in q),EJ=(q)=>!!q&&(q.type==="scalar"||q.type==="single-quoted-scalar"||q.type==="double-quoted-scalar"||q.type==="block-scalar");function SJ(q){switch(q){case a2:return"<BOM>";case s2:return"<DOC>";case r2:return"<FLOW_END>";case t2:return"<SCALAR>";default:return JSON.stringify(q)}}function bJ(q){switch(q){case a2:return"byte-order-mark";case s2:return"doc-mode";case r2:return"flow-error-end";case t2: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 `),
|
|
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}xJ.createScalarToken=o2.createScalarToken;xJ.resolveAsScalar=o2.resolveAsScalar;xJ.setScalarValue=o2.setScalarValue;xJ.stringify=NJ.stringify;xJ.visit=PJ.visit;xJ.BOM=a2;xJ.DOCUMENT=s2;xJ.FLOW_END=r2;xJ.SCALAR=t2;xJ.isCollection=CJ;xJ.isScalar=EJ;xJ.prettyToken=SJ;xJ.tokenType=bJ});var q1=N((aJ)=>{var Pq=w$();function Q0(q){switch(q){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case"\t":return!0;default:return!1}}var m4=new Set("0123456789ABCDEFabcdef"),iJ=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),D$=new Set(",[]{}"),oJ=new Set(` ,[]{}
|
|
119
|
+
\r `),e2=(q)=>!q||oJ.has(q);class p4{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
|
-
`;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
|
|
122
|
-
`||!
|
|
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]===
|
|
125
|
-
`,this.pos);if(
|
|
126
|
-
`,
|
|
127
|
-
`:q=
|
|
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
|
|
129
|
-
`,
|
|
130
|
-
`)Z=this.buffer[++
|
|
131
|
-
`&&
|
|
132
|
-
`)Z+=1,
|
|
133
|
-
`,
|
|
134
|
-
`){let
|
|
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 Q=this.buffer[Z+q+1];if(Q===`
|
|
122
|
+
`||!Q&&!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==="...")&&Q0(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]===Pq.BOM)yield*this.pushCount(1),q=q.substring(1);if(q[0]==="%"){let $=q.length,Z=q.indexOf("#");while(Z!==-1){let X=q[Z-1];if(X===" "||X==="\t"){$=Z-1;break}else Z=q.indexOf("#",Z+1)}while(!0){let X=q[$-1];if(X===" "||X==="\t")$-=1;else break}let Q=(yield*this.pushCount($))+(yield*this.pushSpaces(!0));return yield*this.pushCount(q.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let $=yield*this.pushSpaces(!0);return yield*this.pushCount(q.length-$),yield*this.pushNewline(),"stream"}return yield Pq.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(($==="---"||$==="...")&&Q0(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&&!Q0(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===":")&&Q0($)){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(e2),"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 Q=this.getLine();if(Q===null)return this.setNext("flow");if(Z!==-1&&Z<this.indentNext&&Q[0]!=="#"||Z===0&&(Q.startsWith("---")||Q.startsWith("..."))&&Q0(Q[3])){if(!(Z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield Pq.FLOW_END,yield*this.parseLineStart()}let X=0;while(Q[X]===",")X+=yield*this.pushCount(1),X+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(X+=yield*this.pushIndicators(),Q[X]){case void 0:return"flow";case"#":return yield*this.pushCount(Q.length-X),"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(e2),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let z=this.charAt(1);if(this.flowKey||Q0(z)||z===",")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 X=0;while(this.buffer[$-1-X]==="\\")X+=1;if(X%2===0)break;$=this.buffer.indexOf('"',$+1)}let Z=this.buffer.substring(0,$),Q=Z.indexOf(`
|
|
125
|
+
`,this.pos);if(Q!==-1){while(Q!==-1){let X=this.continueScalar(Q+1);if(X===-1)break;Q=Z.indexOf(`
|
|
126
|
+
`,X)}if(Q!==-1)$=Q-(Z[Q-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(($)=>Q0($)||$==="#")}*parseBlockScalar(){let q=this.pos-1,$=0,Z;q:for(let X=this.pos;Z=this.buffer[X];++X)switch(Z){case" ":$+=1;break;case`
|
|
127
|
+
`:q=X,$=0;break;case"\r":{let z=this.buffer[X+1];if(!z&&!this.atEnd)return this.setNext("block-scalar");if(z===`
|
|
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 X=this.continueScalar(q+1);if(X===-1)break;q=this.buffer.indexOf(`
|
|
129
|
+
`,X)}while(q!==-1);if(q===-1){if(!this.atEnd)return this.setNext("block-scalar");q=this.buffer.length}}let Q=q+1;Z=this.buffer[Q];while(Z===" ")Z=this.buffer[++Q];if(Z==="\t"){while(Z==="\t"||Z===" "||Z==="\r"||Z===`
|
|
130
|
+
`)Z=this.buffer[++Q];q=Q-1}else if(!this.blockScalarKeep)do{let X=q-1,z=this.buffer[X];if(z==="\r")z=this.buffer[--X];let J=X;while(z===" ")z=this.buffer[--X];if(z===`
|
|
131
|
+
`&&X>=this.pos&&X+1+$>J)q=X;else break}while(!0);return yield Pq.SCALAR,yield*this.pushToIndex(q+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let q=this.flowLevel>0,$=this.pos-1,Z=this.pos-1,Q;while(Q=this.buffer[++Z])if(Q===":"){let X=this.buffer[Z+1];if(Q0(X)||q&&D$.has(X))break;$=Z}else if(Q0(Q)){let X=this.buffer[Z+1];if(Q==="\r")if(X===`
|
|
132
|
+
`)Z+=1,Q=`
|
|
133
|
+
`,X=this.buffer[Z+1];else $=Z;if(X==="#"||q&&D$.has(X))break;if(Q===`
|
|
134
|
+
`){let z=this.continueScalar(Z+1);if(z===-1)break;Z=Math.max(Z,z-2)}}else{if(q&&D$.has(Q))break;$=Z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield Pq.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(e2))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let q=this.flowLevel>0,$=this.charAt(1);if(Q0($)||q&&D$.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(!Q0($)&&$!==">")$=this.buffer[++q];return yield*this.pushToIndex($===">"?q+1:q,!1)}else{let q=this.pos+1,$=this.buffer[q];while($)if(iJ.has($))$=this.buffer[++q];else if($==="%"&&m4.has(this.buffer[q+1])&&m4.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
|
|
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 Q=$-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=$;return Q}*pushUntil(q){let $=this.pos,Z=this.buffer[$];while(!q(Z))Z=this.buffer[++$];return yield*this.pushToIndex($,!1)}}aJ.Lexer=p4});var $1=N((rJ)=>{class d4{constructor(){this.lineStarts=[],this.addNewLine=(q)=>this.lineStarts.push(q),this.linePos=(q)=>{let $=0,Z=this.lineStarts.length;while($<Z){let X=$+Z>>1;if(this.lineStarts[X]<q)$=X+1;else Z=X}if(this.lineStarts[$]===q)return{line:$+1,col:1};if($===0)return{line:0,col:q};let Q=this.lineStarts[$-1];return{line:$,col:q-Q+1}}}}rJ.LineCounter=d4});var Z1=N(($G)=>{var eJ=h("process"),c4=w$(),qG=q1();function R0(q,$){for(let Z=0;Z<q.length;++Z)if(q[Z].type===$)return!0;return!1}function l4(q){for(let $=0;$<q.length;++$)switch(q[$].type){case"space":case"comment":case"newline":break;default:return $}return-1}function i4(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 N$(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 Zq(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 n4(q){if(q.start.type==="flow-seq-start"){for(let $ of q.items)if($.sep&&!$.value&&!R0($.start,"explicit-key-ind")&&!R0($.sep,"map-value-ind")){if($.key)$.value=$.key;if(delete $.key,i4($.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 o4{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 qG.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,eJ.env.LOG_TOKENS)console.log("|",c4.prettyToken(q));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=q.length;return}let $=c4.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")n4($);switch(Z.type){case"document":Z.value=$;break;case"block-scalar":Z.props.push($);break;case"block-map":{let Q=Z.items[Z.items.length-1];if(Q.value){Z.items.push({start:[],key:$,sep:[]}),this.onKeyLine=!0;return}else if(Q.sep)Q.value=$;else{Object.assign(Q,{key:$,sep:[]}),this.onKeyLine=!Q.explicitKey;return}break}case"block-seq":{let Q=Z.items[Z.items.length-1];if(Q.value)Z.items.push({start:[],value:$});else Q.value=$;break}case"flow-collection":{let Q=Z.items[Z.items.length-1];if(!Q||Q.value)Z.items.push({start:[],key:$,sep:[]});else if(Q.sep)Q.value=$;else Object.assign(Q,{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 Q=$.items[$.items.length-1];if(Q&&!Q.sep&&!Q.value&&Q.start.length>0&&l4(Q.start)===-1&&($.indent===0||Q.start.every((X)=>X.type!=="comment"||X.indent<$.indent))){if(Z.type==="document")Z.end=Q.start;else Z.items.push({start:Q.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(l4(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 $=N$(this.peek(2)),Z=Zq($),Q;if(q.end)Q=q.end,Q.push(this.sourceToken),delete q.end;else Q=[this.sourceToken];let X={type:"block-map",offset:q.offset,indent:q.indent,items:[{start:Z,key:q,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=X}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
|
|
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 Q=q.items[q.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,$.start),Q.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,Q=Z&&($.sep||$.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&$.sep&&!$.value){let z=[];for(let J=0;J<$.sep.length;++J){let G=$.sep[J];switch(G.type){case"newline":z.push(J);break;case"space":break;case"comment":if(G.indent>q.indent)z.length=0;break;default:z.length=0}}if(z.length>=2)X=$.sep.splice(z[1])}switch(this.type){case"anchor":case"tag":if(Q||$.value)X.push(this.sourceToken),q.items.push({start:X}),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(Q||$.value)X.push(this.sourceToken),q.items.push({start:X,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(R0($.start,"newline"))Object.assign($,{key:null,sep:[this.sourceToken]});else{let z=Zq($.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]})}else if($.value)q.items.push({start:[],key:null,sep:[this.sourceToken]});else if(R0($.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]});else if(i4($.key)&&!R0($.sep,"newline")){let z=Zq($.start),J=$.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:z,key:J,sep:G}]})}else if(X.length>0)$.sep=$.sep.concat(X,this.sourceToken);else $.sep.push(this.sourceToken);else if(!$.sep)Object.assign($,{key:null,sep:[this.sourceToken]});else if($.value||Q)q.items.push({start:X,key:null,sep:[this.sourceToken]});else if(R0($.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 z=this.flowScalar(this.type);if(Q||$.value)q.items.push({start:X,key:z,sep:[]}),this.onKeyLine=!0;else if($.sep)this.stack.push(z);else Object.assign($,{key:z,sep:[]}),this.onKeyLine=!0;return}default:{let z=this.startBlockValue(q);if(z){if(z.type==="block-seq"){if(!$.explicitKey&&$.sep&&!R0($.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:X});this.stack.push(z);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 Q=q.items[q.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,$.start),Q.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||R0($.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 Q=this.flowScalar(this.type);if(!$||$.value)q.items.push({start:[],key:Q,sep:[]});else if($.sep)this.stack.push(Q);else Object.assign($,{key:Q,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 Q=N$(Z),X=Zq(Q);n4(q);let z=q.end.splice(1,q.end.length);z.push(this.sourceToken);let J={type:"block-map",offset:q.offset,indent:q.indent,items:[{start:X,key:q,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}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
|
|
142
|
-
`;
|
|
143
|
-
`){
|
|
144
|
-
`:
|
|
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 $=N$(q),Z=Zq($);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 $=N$(q),Z=Zq($);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()}}}$G.Parser=o4});var e4=N((HG)=>{var a4=l2(),QG=Rq(),Cq=jq(),XG=$2(),zG=k(),JG=$1(),s4=Z1();function r4(q){let $=q.prettyErrors!==!1;return{lineCounter:q.lineCounter||$&&new JG.LineCounter||null,prettyErrors:$}}function GG(q,$={}){let{lineCounter:Z,prettyErrors:Q}=r4($),X=new s4.Parser(Z?.addNewLine),z=new a4.Composer($),J=Array.from(z.compose(X.parse(q)));if(Q&&Z)for(let G of J)G.errors.forEach(Cq.prettifyError(q,Z)),G.warnings.forEach(Cq.prettifyError(q,Z));if(J.length>0)return J;return Object.assign([],{empty:!0},z.streamInfo())}function t4(q,$={}){let{lineCounter:Z,prettyErrors:Q}=r4($),X=new s4.Parser(Z?.addNewLine),z=new a4.Composer($),J=null;for(let G of z.compose(X.parse(q),!0,q.length))if(!J)J=G;else if(J.options.logLevel!=="silent"){J.errors.push(new Cq.YAMLParseError(G.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&Z)J.errors.forEach(Cq.prettifyError(q,Z)),J.warnings.forEach(Cq.prettifyError(q,Z));return J}function YG(q,$,Z){let Q=void 0;if(typeof $==="function")Q=$;else if(Z===void 0&&$&&typeof $==="object")Z=$;let X=t4(q,Z);if(!X)return null;if(X.warnings.forEach((z)=>XG.warn(X.options.logLevel,z)),X.errors.length>0)if(X.options.logLevel!=="silent")throw X.errors[0];else X.errors=[];return X.toJS(Object.assign({reviver:Q},Z))}function UG(q,$,Z){let Q=null;if(typeof $==="function"||Array.isArray($))Q=$;else if(Z===void 0&&$)Z=$;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let X=Math.round(Z);Z=X<1?void 0:X>8?{indent:8}:{indent:X}}if(q===void 0){let{keepUndefined:X}=Z??$??{};if(!X)return}if(zG.isDocument(q)&&!Q)return q.toString(Z);return new QG.Document(q,Q,Z).toString(Z)}HG.parse=YG;HG.parseAllDocuments=GG;HG.parseDocument=t4;HG.stringify=UG});import{execFile as g8}from"child_process";import{promisify as u8}from"util";import{mkdtemp as f1,readdir as m8,readFile as c$,rm as gq,cp as p8,access as d$,stat as d8,lstat as c8,symlink as l8,mkdir as n8}from"fs/promises";import{join as H0,resolve as y1,relative as i8,basename as o8}from"path";import{homedir as k1}from"os";import{tmpdir as v1}from"os";import{readdir as b8,readFile as x8,stat as f8}from"fs/promises";import{join as y8}from"path";var k8=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"]),v8=524288;async function vq(q){let $=[];async function Z(Q,X){let z;try{z=await b8(Q)}catch{return}for(let J of z){if(J===".git"||J==="node_modules")continue;let G=y8(Q,J),Y=X?`${X}/${J}`:J;try{let H=await f8(G);if(H.isDirectory())await Z(G,Y);else if(H.isFile()){let B=J.includes(".")?`.${J.split(".").pop().toLowerCase()}`:"";if(k8.has(B))continue;if(H.size>v8)continue;try{let W=await x8(G,"utf-8");$.push({relPath:Y,content:W,lineCount:W.split(`
|
|
141
|
+
`).length})}catch{}}}catch{continue}}}return await Z(q,""),$}class x1{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,Q)=>Q)}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((Q)=>this.selected[Q]);for(let Q of q)this.selected[Q]=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 h8(q,$,Z){let Q=[];if(q.searchActive||q.filter!==""){let H=U.cyan("/"),B=q.filter,W=q.searchActive?U.cyan("█"):"";if(Q.push(` ${H}${B}${W}`),q.filteredMap.length===0)Q.push(U.dim(" No matches found"));Q.push("")}let{start:X,end:z}=q.getVisibleRange();if(X>0)Q.push(U.dim(` ... ${X} more above`));for(let H=X;H<z;H++){let W=H===q.cursor?U.cyan(">"):" ";if(H===0){let V=q.filteredMap,L=V.length>0&&V.every((O)=>q.selected[O])?U.green("[*]"):"[ ]",_=q.filter!==""?`Select All Matching (${q.filteredMap.length})`:"Select All / Deselect All";Q.push(`${W} ${L} ${U.bold(_)}`)}else{let V=q.filteredMap[H-1],K=$[V],_=q.selected[V]?U.green("[*]"):"[ ]",O=`${W} ${_} `,F=7,T=U.bold(K.label),R=K.label.length;if(K.hint){let j=Z-7-R-2;if(j>10){let I=m$(K.hint,j);Q.push(`${O}${T} ${U.dim(I)}`)}else{let I=m$(K.label,Z-7);Q.push(`${O}${U.bold(I)}`)}}else{let j=m$(K.label,Z-7);Q.push(`${O}${U.bold(j)}`)}}}let J=q.totalRows-z;if(J>0)Q.push(U.dim(` ... ${J} more below`));let G=q.getSelectedIndices().length,Y=q.filter!==""?` matching: ${q.filteredMap.length}/${q.itemCount}`:"";if(Q.push(""),q.searchActive)Q.push(U.dim(` ${G} of ${q.itemCount} selected${Y} | Type to filter Esc Clear Enter Done searching`));else Q.push(U.dim(` ${G} of ${q.itemCount} selected${Y} | `+"↑/↓ Navigate Space Toggle a All / Search Enter Confirm Esc Cancel"));return Q}function m$(q,$){if($<=0)return"";if(q.length<=$)return q;if($<=3)return q.slice(0,$);return q.slice(0,$-3)+"..."}async function m0(q){let{items:$}=q,Z=q.pageSize??Math.min($.length+1,15),Q=new x1($,Z),X=process.stderr,z=process.stdin,J=X.columns||80;if(typeof z.setRawMode==="function")z.setRawMode(!0);z.resume(),z.setEncoding("utf-8"),X.write("\x1B[?25l");let G=0;function Y(){let H=h8(Q,$,J);if(G>0)X.write(`\x1B[${G}F`);let B=Math.max(H.length,G),W="";for(let V=0;V<B;V++)W+=`\x1B[2K${V<H.length?H[V]:""}
|
|
142
|
+
`;X.write(W),G=B}return Y(),new Promise((H)=>{let B="",W=null;function V(){if(z.removeListener("data",_),typeof z.setRawMode==="function")z.setRawMode(!1);if(z.pause(),X.write("\x1B[?25h"),W)clearTimeout(W)}function K(O){V(),H(O)}function L(O){if(Q.searchActive){if(O==="\x1B"){Q.searchActive=!1,Q.filter="",Q.applyFilter($),Y();return}if(O==="\r"||O===`
|
|
143
|
+
`){Q.searchActive=!1,Y();return}if(O===""||O==="\b"){if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter($);else Q.searchActive=!1;Y();return}if(O==="\x03"){V(),process.kill(process.pid,"SIGINT");return}if(O==="\x1B[A"){Q.moveUp(),Y();return}if(O==="\x1B[B"){Q.moveDown(),Y();return}if(O===" "){Q.toggleCurrent(),Y();return}if(O.length===1&&O>=" "&&O<="~"){Q.filter+=O,Q.applyFilter($),Y();return}return}switch(O){case"\x1B[A":case"k":Q.moveUp(),Y();break;case"\x1B[B":case"j":Q.moveDown(),Y();break;case" ":Q.toggleCurrent(),Y();break;case"a":Q.toggleAll(),Y();break;case"/":Q.searchActive=!0,Y();break;case"\r":case`
|
|
144
|
+
`:K(Q.getSelectedIndices());break;case"\x1B":if(Q.filter!=="")Q.filter="",Q.applyFilter($),Y();else K([]);break;case"":case"\b":if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter($),Y();break;case"\x03":V(),process.kill(process.pid,"SIGINT");break}}function _(O){if(B.length>0){if(B+=O,W)clearTimeout(W);if(B.length>=3&&B[1]==="["){let T=B.slice(0,3),R=B.slice(3);if(B="",L(T),R)_(R);return}let F=B;B="",L("\x1B");for(let T=1;T<F.length;T++)L(F[T]);return}for(let F=0;F<O.length;F++){let T=O[F];if(T==="\x1B"){let R=O.slice(F);if(R.length>=3&&R[1]==="[")L(R.slice(0,3)),F+=2;else if(R.length>=2){B=R,W=setTimeout(()=>{let j=B;B="",L("\x1B");for(let I=1;I<j.length;I++)L(j[I])},50);return}else{B="\x1B",W=setTimeout(()=>{B="",L("\x1B")},50);return}}else L(T)}}z.on("data",_)})}var N0=u8(g8),a8=/^[a-zA-Z0-9_-]+$/,s8=/^[a-zA-Z0-9._-]+$/,r8=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,h1=128,t8=/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\/tree\/(.+))?\/?$/;function e8(q){return q.startsWith("/")||q.startsWith("./")||q.startsWith("../")||q.startsWith("~/")||q==="~"||q==="."||q===".."}function qZ(q){let $;if(q==="~")$=k1();else if(q.startsWith("~/"))$=y1(k1(),q.slice(2));else $=y1(q);let Z=o8($);return C(`install: parsed local source -> path=${$}`),{owner:"local",repo:Z,ref:null,subpath:null,cloneUrl:"",sshCloneUrl:"",isLocal:!0,localPath:$}}function p0(q){if(e8(q))return qZ(q);let $=t8.exec(q);if($){let[,W,V,K]=$,L=V.endsWith(".git")?V.slice(0,-4):V;q=`github:${W}/${L}${K?`#${K}`:""}`}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),
|
|
152
|
-
`)){let
|
|
153
|
-
HTTPS: ${
|
|
154
|
-
SSH: ${
|
|
155
|
-
`);for(let
|
|
156
|
-
Use --force to overwrite.`)}catch(Z){if(Z.message?.includes("--force"))throw Z;
|
|
157
|
-
`),Z=!1,
|
|
158
|
-
`),Z=-1;for(let
|
|
159
|
-
`);return null}function
|
|
160
|
-
${
|
|
161
|
-
`)}`);return Z}async function
|
|
151
|
+
./relative/path/to/skill`);let Z=q.slice(7),Q=Z.indexOf("#"),X,z=null,J=null;if(Q!==-1){X=Z.slice(0,Q);let W=Z.slice(Q+1);if(!W)throw Error("Invalid source: ref cannot be empty after #");let V=W.indexOf(":");if(V!==-1){if(z=W.slice(0,V),!z)throw Error("Invalid source: ref cannot be empty before :");J=W.slice(V+1)||null}else z=W}else{let W=Z.indexOf(":");if(W!==-1)X=Z.slice(0,W),J=Z.slice(W+1)||null;else X=Z}let G=X.indexOf("/");if(G===-1)throw Error(`Invalid source: format must be github:owner/repo. Got: "${q}"`);let Y=X.slice(0,G),H=X.slice(G+1);if(!Y)throw Error("Invalid source: owner cannot be empty");if(!H)throw Error("Invalid source: repo cannot be empty");if(!a8.test(Y))throw Error(`Invalid source: owner contains invalid characters: "${Y}". Allowed: [a-zA-Z0-9_-]`);if(!s8.test(H))throw Error(`Invalid source: repo contains invalid characters: "${H}". Allowed: [a-zA-Z0-9._-]`);let B={owner:Y,repo:H,ref:z,subpath:J,cloneUrl:`https://github.com/${Y}/${H}.git`,sshCloneUrl:`git@github.com:${Y}/${H}.git`};return C(`install: parsed source -> owner=${Y} repo=${H} ref=${z} subpath=${J}`),B}async function l$(q){if(q.subpath!==null||!q.ref||!q.ref.includes("/"))return q;try{let{stdout:$}=await N0("git",["ls-remote","--heads","--tags",q.cloneUrl],{timeout:15000}),Z=new Set;for(let X of $.split(`
|
|
152
|
+
`)){let z=X.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(z)Z.add(z[1])}let Q=q.ref.split("/");for(let X=1;X<Q.length;X++){let z=Q.slice(0,X).join("/");if(Z.has(z)){let J=Q.slice(X).join("/");return C(`install: resolved ref="${z}" subpath="${J}"`),{...q,ref:z,subpath:J||null}}}}catch($){C(`install: ls-remote failed, treating entire ref as branch: ${$}`)}return q}function P0(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>h1)throw Error(`Invalid skill name: exceeds maximum length of ${h1} characters`);if(!r8.test(q))throw Error(`Invalid skill name: "${q}" does not match allowed pattern [a-zA-Z0-9][a-zA-Z0-9._-]*`);return q}function $Z(q){let $=q.split(/[/\\]/).filter(Boolean),Z=$.length>0?$[$.length-1]:q;return P0(Z)}function u1(q){let $=new Map;for(let Z of q){let Q=$Z(Z),X=$.get(Q);if(X)X.push(Z);else $.set(Q,[Z])}return[...$.entries()].filter(([,Z])=>Z.length>1).map(([Z,Q])=>({name:Z,paths:Q}))}async function d0(){try{await N0("git",["--version"]),C("install: git available")}catch{throw Error("git is required for installing skills. Install git from https://git-scm.com")}}function ZZ(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 hq(q){return q.killed?"Clone timed out after 60 seconds":`Clone failed: ${q.stderr||q.message}`}async function p$(q,$,Z){if($!==null&&/^[0-9a-f]{40}$/i.test($))return await N0("git",["clone","--no-checkout",q,Z],{timeout:60000}),await N0("git",["checkout",$],{cwd:Z,timeout:30000}),Z;let X=["clone","--depth","1"];if($)X.push("--branch",$);return X.push(q,Z),await N0("git",X,{timeout:60000}),Z}async function c0(q,$="auto"){C(`install: cloning ${q.owner}/${q.repo}${q.ref?` (ref: ${q.ref})`:""} (transport: ${$})`);let Z=await f1(H0(v1(),"asm-install-"));if($==="ssh"||$==="https"){let Q=$==="ssh"?q.sshCloneUrl:q.cloneUrl;try{return await p$(Q,q.ref,Z)}catch(X){throw await q0(Z),Error(hq(X))}}try{return await p$(q.cloneUrl,q.ref,Z)}catch(Q){if(!ZZ(Q))throw await q0(Z),Error(hq(Q));C("install: HTTPS clone failed with auth error, retrying with SSH..."),await q0(Z);let X=await f1(H0(v1(),"asm-install-"));try{return await p$(q.sshCloneUrl,q.ref,X)}catch(z){throw await q0(X),Error(`Clone failed with both transports:
|
|
153
|
+
HTTPS: ${hq(Q)}
|
|
154
|
+
SSH: ${hq(z)}`)}}}async function C0(q){let $=H0(q,"SKILL.md"),Z;try{Z=await c$($,"utf-8")}catch{throw Error("Not a valid skill: SKILL.md not found in repository root")}let Q=W0(Z),X=q.split(/[/\\]/).pop()||"unknown",z=Q.name||X,J=V0(Q);return C(`install: validated skill "${z}" v${J}`),{name:z,version:J,description:(Q.description||"").replace(/\s*\n\s*/g," ").trim(),effort:Q.effort||Q["metadata.effort"]||void 0}}async function uq(q,$=3){let Z=[];async function Q(X,z,J){let G;try{G=await m8(X)}catch{return}for(let Y of G){if(Y===".git"||Y==="node_modules")continue;let H=H0(X,Y);try{if(!(await d8(H)).isDirectory())continue}catch{continue}let B=z?`${z}/${Y}`:Y,W=J+1,V=H0(H,"SKILL.md");try{let K=await c$(V,"utf-8"),L=W0(K);Z.push({relPath:B,name:L.name||Y,version:V0(L),description:(L.description||"").replace(/\s*\n\s*/g," ").trim(),effort:L.effort||L["metadata.effort"]||void 0,license:(L.license||"").trim(),creator:(L["metadata.creator"]||"").trim(),compatibility:(L.compatibility||"").trim(),allowedTools:g1(L)})}catch{if(W<$)await Q(H,B,W)}}}return await Q(q,"",0),Z.sort((X,z)=>X.name.localeCompare(z.name)),Z}var QZ=[{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 m1(q){let $=[],Z=await vq(q);for(let{relPath:Q,content:X}of Z){let z=X.split(`
|
|
155
|
+
`);for(let J=0;J<z.length;J++)for(let{category:G,pattern:Y}of QZ)if(Y.test(z[J])){let H=z[J].trim();$.push({category:G,file:Q,line:J+1,match:H.length>100?H.slice(0,100)+"…":H})}}return $}async function mq(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 d$(q.targetDir),await gq(q.targetDir,{recursive:!0,force:!0})}catch{}let Z=q.sourceDir;try{await p8(Z,q.targetDir,{recursive:!0})}catch(G){throw Error(`Failed to install: ${G.message}`)}let Q=H0(q.targetDir,".git");try{await gq(Q,{recursive:!0,force:!0})}catch{}C(`install: copied files to ${q.targetDir}`);let X=H0(q.targetDir,"SKILL.md");try{await d$(X)}catch{throw Error("Installation verification failed: SKILL.md not found at target")}let z=await c$(X,"utf-8"),J=W0(z);return{success:!0,path:q.targetDir,name:J.name||q.skillName,version:V0(J),provider:q.providerLabel,source:$}}async function p1(q,$){let Z=await mq(q);for(let Q of $){if(Q.name===q.providerName)continue;let X=q.scope==="project"?Q.project:Q.global,z=$0(X),J=H0(z,q.skillName);await n8(z,{recursive:!0});try{if((await c8(J)).isSymbolicLink())await gq(J);else{C(`install: skipping ${J} — existing non-symlink directory`);continue}}catch{}let G=i8(z,q.targetDir);await l8(G,J,"dir"),C(`install: symlinked ${J} -> ${G}`)}return Z.provider=`All (${$.map((Q)=>Q.label).join(", ")})`,Z}async function q0(q){try{await gq(q,{recursive:!0,force:!0})}catch{}}async function d1(){try{await N0("npx",["--version"]),C("install: npx available")}catch{throw Error("npx is required for Vercel method installation. Install Node.js from https://nodejs.org")}}async function c1(q,$){let Z=["--yes","skills","add",q];if($)Z.push("--skill",$);C(`install: running npx ${Z.join(" ")}`);try{let Q=await N0("npx",Z,{timeout:120000});return{stdout:Q.stdout,stderr:Q.stderr}}catch(Q){let X=Q.stderr||Q.message||"";throw Error(`npx skills add failed: ${X}`)}}function l1(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 l0(q,$,Z){let Q=q.providers.filter((K)=>K.enabled);if($==="all"){if(Q.length===0)throw Error("No providers are enabled. Enable a provider in your config.");return{provider:Q.find((L)=>L.name==="agents")||Q[0],allProviders:Q}}if($){let K=q.providers.find((L)=>L.name===$);if(!K){let L=q.providers.map((_)=>_.name).join(", ");throw Error(`Unknown provider: "${$}". Valid providers: ${L}, all`)}if(!K.enabled)throw Error(`Provider "${$}" is disabled. Enable it in your config or choose another provider.`);return{provider:K,allProviders:null}}if(Q.length===1)return{provider:Q[0],allProviders:null};if(!Z){if(Q.length===0)throw Error("No providers are enabled. Enable a provider in your config.");let K=Q.map((L)=>L.name).join(", ");throw Error(`--tool (or --provider) is required in non-interactive mode. Available: ${K}, all`)}let X=q.preferences.selectedTools,J=X&&X.length>0?new Set(X):null,G=q.providers.map((K)=>({label:`${K.label} (${K.name})`,hint:K.global,checked:J?J.has(K.name):K.name==="agents"})),Y=await m0({items:G});if(Y.length===0)throw Error("No tools selected. Aborting.");let H=Y.map((K)=>q.providers[K]),B=H.map((K)=>K.name),{saveSelectedTools:W}=await import("./chunk-2qybtcgb.js");if(await W(B),H.length===1)return{provider:H[0],allProviders:null};return{provider:H.find((K)=>K.name==="agents")||H[0],allProviders:H}}function n$(q,$,Z,Q,X,z,J="global"){let G=J==="project"?X.project:X.global,Y=$0(G),H=H0(Y,Q);return{source:q,tempDir:$,sourceDir:Z,targetDir:H,skillName:Q,force:z,providerName:X.name,providerLabel:X.label,scope:J}}async function n1(q,$){try{if(await d$(q),C(`install: target ${q} — conflict (exists)${$?", force overwrite":""}`),!$)throw Error(`Skill already exists at: ${q}
|
|
156
|
+
Use --force to overwrite.`)}catch(Z){if(Z.message?.includes("--force"))throw Z;C(`install: target ${q} — no conflict`)}}import{readFile as eG}from"fs/promises";import{join as qY}from"path";var _G=l2(),OG=Rq(),LG=C2(),Q1=jq(),FG=Yq(),j0=k(),AG=A0(),IG=g(),MG=M0(),TG=T0(),oV=w$(),RG=q1(),jG=$1(),wG=Z1(),P$=e4(),q5=Jq();var DG=_G.Composer,NG=OG.Document,PG=LG.Schema,CG=Q1.YAMLError,EG=Q1.YAMLParseError,SG=Q1.YAMLWarning,bG=FG.Alias,xG=j0.isAlias,fG=j0.isCollection,yG=j0.isDocument,kG=j0.isMap,vG=j0.isNode,hG=j0.isPair,gG=j0.isScalar,uG=j0.isSeq,mG=AG.Pair,pG=IG.Scalar,dG=MG.YAMLMap,cG=TG.YAMLSeq;var lG=RG.Lexer,nG=jG.LineCounter,iG=wG.Parser,X1=P$.parse,oG=P$.parseAllDocuments,aG=P$.parseDocument,sG=P$.stringify,rG=q5.visit,tG=q5.visitAsync;var $5=500;function $Y(q){let $=q.split(`
|
|
157
|
+
`),Z=!1,Q=!1;for(let X of $){if(X.trim()==="---")if(!Z){Z=!0;continue}else{Q=!0;continue}if(Q&&X.trim().length>0)return!0}return!1}function ZY(q){let $=q.split(`
|
|
158
|
+
`),Z=-1;for(let Q=0;Q<$.length;Q++)if($[Q].trim()==="---")if(Z===-1)Z=Q+1;else return $.slice(Z,Q).join(`
|
|
159
|
+
`);return null}function QY(q){let $=ZY(q);if($===null)return null;try{return X1($),null}catch(Z){return Z.message||"invalid YAML"}}async function Z5(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 Q=qY(q.path,"SKILL.md"),X=await eG(Q,"utf-8");if(!$Y(X))$.push({category:"empty-body",message:"SKILL.md contains only frontmatter with no body content"});let z=QY(X);if(z)$.push({category:"invalid-yaml",message:`SKILL.md has invalid YAML frontmatter: ${z}`})}catch{}let Z=q.fileCount;if(Z!==void 0&&Z>$5)$.push({category:"high-file-count",message:`Skill has ${Z} files (threshold: ${$5})`});return $}import{join as WY}from"path";import{homedir as VY}from"os";import{readFile as XY,writeFile as zY,mkdir as JY}from"fs/promises";import{dirname as GY}from"path";async function YY(q){try{let $=await XY(q,"utf-8"),Z=JSON.parse($);if(!Z.fetched_at||Z.data===void 0||Z.data===null)return null;return Z}catch{return null}}async function UY(q,$,Z){let Q={fetched_at:new Date().toISOString(),ttl_seconds:Z,data:$};try{await JY(GY(q),{recursive:!0}),await zY(q,JSON.stringify(Q,null,2),"utf-8"),C(`http: wrote cache -> ${q}`)}catch(X){C(`http: failed to write cache: ${X}`)}}function HY(q){let $=new Date(q.fetched_at).getTime();return(Date.now()-$)/1000<q.ttl_seconds}async function Q5(q,$,Z={}){let Q=Z.ttl??3600,X=Z.noCache??!1,z=await YY($);if(z&&!X&&HY(z))return C(`http: cache hit (fresh) -> ${$}`),z.data;try{C(`http: fetching -> ${q}`);let J=await fetch(q);if(!J.ok)throw Error(`HTTP ${J.status}: ${J.statusText}`);let G=await J.json();return await UY($,G,Q),G}catch(J){if(C(`http: fetch failed: ${J}`),z)return C(`http: using stale cache as fallback -> ${$}`),z.data;return null}}var BY=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,KY=/^[a-zA-Z0-9_-]+$/,J5=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/,_Y=/^[0-9a-f]{40}$/,OY=/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/,LY=/^[a-z0-9-]+$/,FY=/^sha256:[0-9a-f]{64}$/,X5=["pass","warning","dangerous"];function C$(q){let $=[];if(!q||typeof q!=="object"||Array.isArray(q))return[{field:"(root)",message:"manifest must be a non-null object"}];let Z=q,Q=new Set(["name","author","description","repository","commit","skill_path","version","license","tags","security_verdict","published_at","checksum"]);for(let J of Object.keys(Z))if(!Q.has(J))$.push({field:J,message:`unknown property "${J}" is not allowed`});let X=[{field:"name",pattern:BY,maxLength:128},{field:"author",pattern:KY,maxLength:39},{field:"description",maxLength:256},{field:"repository",pattern:J5},{field:"commit",pattern:_Y},{field:"published_at"}];for(let{field:J,pattern:G,maxLength:Y}of X){let H=Z[J];if(H===void 0||H===null){$.push({field:J,message:`required field "${J}" is missing`});continue}if(typeof H!=="string"){$.push({field:J,message:`"${J}" must be a string`});continue}if(H.length===0){$.push({field:J,message:`"${J}" must not be empty`});continue}if(Y&&H.length>Y)$.push({field:J,message:`"${J}" exceeds maximum length of ${Y}`});if(G&&!G.test(H))$.push({field:J,message:`"${J}" does not match required pattern`})}let z=Z.security_verdict;if(z===void 0||z===null)$.push({field:"security_verdict",message:'required field "security_verdict" is missing'});else if(typeof z!=="string"||!X5.includes(z))$.push({field:"security_verdict",message:`"security_verdict" must be one of: ${X5.join(", ")}`});if(typeof Z.published_at==="string"&&Z.published_at.length>0){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/.test(Z.published_at))$.push({field:"published_at",message:'"published_at" must be a valid ISO 8601 date-time'})}if(Z.version!==void 0){if(typeof Z.version!=="string"||!OY.test(Z.version))$.push({field:"version",message:'"version" must be a valid semver string'})}if(Z.license!==void 0){if(typeof Z.license!=="string")$.push({field:"license",message:'"license" must be a string'});else if(Z.license.length>64)$.push({field:"license",message:'"license" exceeds maximum length of 64'})}if(Z.tags!==void 0)if(!Array.isArray(Z.tags))$.push({field:"tags",message:'"tags" must be an array'});else{if(Z.tags.length>10)$.push({field:"tags",message:'"tags" has more than 10 items'});let J=new Set;for(let G=0;G<Z.tags.length;G++){let Y=Z.tags[G];if(typeof Y!=="string"){$.push({field:`tags[${G}]`,message:"tag must be a string"});continue}if(Y.length>32)$.push({field:`tags[${G}]`,message:`tag "${Y}" exceeds maximum length of 32`});if(!LY.test(Y))$.push({field:`tags[${G}]`,message:`tag "${Y}" does not match pattern (lowercase alphanumeric and hyphens)`});if(J.has(Y))$.push({field:`tags[${G}]`,message:`duplicate tag "${Y}"`});J.add(Y)}}if(Z.checksum!==void 0){if(typeof Z.checksum!=="string"||!FY.test(Z.checksum))$.push({field:"checksum",message:'"checksum" must match pattern sha256:<64-hex-chars>'})}if(Z.skill_path!==void 0){if(typeof Z.skill_path!=="string")$.push({field:"skill_path",message:'"skill_path" must be a string'});else if(Z.skill_path.length===0)$.push({field:"skill_path",message:'"skill_path" must not be empty'});else if(Z.skill_path.length>256)$.push({field:"skill_path",message:'"skill_path" exceeds maximum length of 256'});else if(/\.\.|^\//.test(Z.skill_path))$.push({field:"skill_path",message:'"skill_path" must not contain ".." or start with "/"'})}return $}function AY(q,$){let Z=q.length,Q=$.length;if(Z===0)return Q;if(Q===0)return Z;let X=Array(Q+1),z=Array(Q+1);for(let J=0;J<=Q;J++)X[J]=J;for(let J=1;J<=Z;J++){z[0]=J;for(let G=1;G<=Q;G++){let Y=q[J-1]===$[G-1]?0:1;z[G]=Math.min(X[G]+1,z[G-1]+1,X[G-1]+Y)}[X,z]=[z,X]}return X[Q]}function IY(q,$,Z=2){let Q=[];for(let X of $){if(q===X)continue;let z=AY(q,X);if(z<=Z)Q.push({existingName:X,distance:z})}return Q.sort((X,z)=>X.distance-z.distance)}var z1=process.env.ASM_REGISTRY_URL??"https://raw.githubusercontent.com/luongnv89/asm-registry/main/index.json",MY=process.env.ASM_REGISTRY_CACHE??WY(VY(),".config","agent-skill-manager","registry-cache.json"),TY=3600;function J1(q){if(q.startsWith("github:")||q.startsWith("http://")||q.startsWith("https://")||q.startsWith("/")||q.startsWith("./")||q.startsWith("../")||q.startsWith("~/")||q==="~"||q==="."||q==="..")return!1;let $=(q.match(/\//g)||[]).length;if($>1)return!1;if($===1){let[Z,Q]=q.split("/");return/^[a-zA-Z0-9_-]+$/.test(Z)&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(Q)}return/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(q)}function G1(q){if(!J1(q))return!1;return q.includes("/")}async function Y1(q){let $=await Q5(z1,MY,{ttl:TY,noCache:q?.noCache});if(!$)return null;if(typeof $!=="object"||!Array.isArray($.manifests)||typeof $.generated_at!=="string")return C("registry: fetched index has invalid structure — discarding"),null;let Z=[];for(let Q of $.manifests){let X=C$(Q);if(X.length>0){C(`registry: dropping invalid manifest entry (${Q?.name??"unknown"}): ${X.map((z)=>z.message).join(", ")}`);continue}if(!J5.test(Q.repository)){C(`registry: dropping manifest with unexpected repository URL: ${Q.repository}`);continue}Z.push(Q)}return{generated_at:$.generated_at,manifests:Z}}function RY(q,$){return $.manifests.filter((Z)=>Z.name.toLowerCase()===q.toLowerCase())}function jY(q,$,Z){return Z.manifests.find((Q)=>Q.author.toLowerCase()===q.toLowerCase()&&Q.name.toLowerCase()===$.toLowerCase())??null}function z5(q,$,Z=5){return IY(q,$.manifests.map((X)=>X.name),3).slice(0,Z).map((X)=>X.existingName)}async function G5(q,$){let Z=await Y1($);if(!Z)return C("registry: failed to fetch index — skipping registry resolution"),{resolved:null,multipleMatches:[],suggestions:[]};if(G1(q)){let[z,J]=q.split("/"),G=jY(z,J,Z);if(G)return{resolved:{manifest:G,source:"registry"},multipleMatches:[],suggestions:[]};let Y=z5(J,Z);return{resolved:null,multipleMatches:[],suggestions:Y}}let Q=RY(q,Z);if(Q.length===1)return{resolved:{manifest:Q[0],source:"registry"},multipleMatches:[],suggestions:[]};if(Q.length>1)return{resolved:null,multipleMatches:Q,suggestions:[]};let X=z5(q,Z);return{resolved:null,multipleMatches:[],suggestions:X}}function Y5(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 wY,access as H5,mkdir as DY,cp as U5,rm as NY,symlink as PY}from"fs/promises";import{join as W5,basename as CY}from"path";function EY(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 Q=0;Q<Z.skills.length;Q++){let X=Z.skills[Q];if(typeof X!=="object"||X===null){$.push(`skills[${Q}]: must be an object.`);continue}let z=X;if(typeof z.name!=="string"||!z.name)$.push(`skills[${Q}]: missing or empty 'name'.`);if(typeof z.dirName!=="string"||!z.dirName)$.push(`skills[${Q}]: missing or empty 'dirName'.`);if(typeof z.provider!=="string"||!z.provider)$.push(`skills[${Q}]: missing or empty 'provider'.`);if(z.scope!=="global"&&z.scope!=="project")$.push(`skills[${Q}]: invalid 'scope' "${String(z.scope)}". Must be "global" or "project".`)}return{valid:$.length===0,errors:$}}async function V5(q){let $;try{$=await wY(q,"utf-8")}catch(X){if(X?.code==="ENOENT")throw Error(`Manifest file not found: ${q}`);throw Error(`Failed to read manifest file: ${X.message}`)}let Z;try{Z=JSON.parse($)}catch{throw Error("Manifest file is not valid JSON.")}let Q=EY(Z);if(!Q.valid)throw Error(`Invalid manifest:
|
|
160
|
+
${Q.errors.join(`
|
|
161
|
+
`)}`);return Z}async function SY(q){try{return await H5(q),!0}catch{return!1}}function bY(q,$){return q.providers.find((Z)=>Z.name===$&&Z.enabled)}function xY(q,$,Z,Q){let X=bY(q,$);if(!X)return null;let z=Z==="global"?X.global:X.project,J=$0(z),G=CY(Q);if(!G||G==="."||G==="..")return null;return W5(J,G)}function fY(q,$){let Z=q.find((Q)=>Q.dirName===$.dirName&&Q.provider===$.provider);if(Z)return Z;return q.find((Q)=>Q.dirName===$.dirName)||null}async function B5(q,$,Z){let Q=Z?.config??await v(),X=Z?.installedSkills??await i(Q,"both"),z=[];for(let H of q.skills){if($.scopeFilter!=="both"&&H.scope!==$.scopeFilter){C(`import: skipping "${H.name}" — scope "${H.scope}" filtered out`);continue}let B=xY(Q,H.provider,H.scope,H.dirName);if(!B){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"failed",reason:`Provider "${H.provider}" not found or not enabled.`});continue}let W=await SY(B);if(W&&!$.force){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"skipped",reason:"Already installed.",path:B});continue}if($.dryRun){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"dry-run",reason:W?"Would overwrite (--force).":"Would install.",path:B});continue}let V=fY(X,H);if(!V){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"failed",reason:"No installed source found. Install the skill first with: asm install <source>"});continue}try{if(await DY(W5(B,".."),{recursive:!0}),W)await NY(B,{recursive:!0,force:!0});if(H.isSymlink&&H.symlinkTarget)try{await H5(H.symlinkTarget),await PY(H.symlinkTarget,B),C(`import: symlinked "${H.name}" -> ${H.symlinkTarget} at ${B}`)}catch{await U5(V.realPath,B,{recursive:!0}),C(`import: symlink target unreachable, copied "${H.name}" from ${V.realPath} to ${B}`)}else await U5(V.realPath,B,{recursive:!0}),C(`import: copied "${H.name}" from ${V.realPath} to ${B}`);z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"installed",path:B})}catch(K){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"failed",reason:`Copy failed: ${K.message}`})}}let J=z.filter((H)=>H.status==="installed").length,G=z.filter((H)=>H.status==="skipped").length,Y=z.filter((H)=>H.status==="failed").length;return{total:z.length,installed:J,skipped:G,failed:Y,results:z}}import{mkdir as yY,writeFile as kY,access as vY}from"fs/promises";import{join as hY}from"path";function gY(q){return`---
|
|
162
162
|
name: ${q}
|
|
163
163
|
description: ""
|
|
164
164
|
license: ""
|
|
@@ -179,23 +179,39 @@ as instructions for when and how to use this skill.
|
|
|
179
179
|
## Instructions
|
|
180
180
|
|
|
181
181
|
- Step-by-step instructions for the agent
|
|
182
|
-
`}async function
|
|
183
|
-
`)}import{access as
|
|
184
|
-
`,"utf-8"),
|
|
185
|
-
${
|
|
186
|
-
`)}`);return Z}async function
|
|
187
|
-
`);for(let
|
|
188
|
-
`)}function
|
|
189
|
-
|
|
190
|
-
|
|
182
|
+
`}async function K5(q,$){await yY($,{recursive:!0});let Z=hY($,"SKILL.md"),Q=gY(q);await kY(Z,Q,"utf-8")}async function _5(q){try{return await vY(q),!0}catch{return!1}}import{readdir as uY,stat as mY}from"fs/promises";import{join as pY}from"path";async function dY(q){let $=0;try{let Q=(await uY(q,{recursive:!0})).map(async(z)=>{try{let J=await mY(pY(q,z));if(J.isFile())return J.size}catch{}return 0});$=(await Promise.all(Q)).reduce((z,J)=>z+J,0)}catch{}return $}async function F5(q,$){let Z={},Q={global:0,project:0},X={},z=q.map(async(Y)=>{Z[Y.provider]=(Z[Y.provider]||0)+1,Q[Y.scope]++;let H=await dY(Y.path);return X[Y.path]=H,H}),G=(await Promise.all(z)).reduce((Y,H)=>Y+H,0);return{totalSkills:q.length,byProvider:Z,byScope:Q,totalDiskBytes:G,perSkillDiskBytes:X,duplicateGroups:$.duplicateGroups.length,duplicateInstances:$.totalDuplicateInstances}}function cY(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 U1(q,$,Z=20){let Q=Math.round(q/$*Z),X=Z-Q;return U.green("#".repeat(Q))+U.dim("-".repeat(X))}var O5={claude:"Claude Code",codex:"Codex",openclaw:"OpenClaw",agents:"Agents"};function A5(q){let $=[];$.push(""),$.push(U.blueBold(" Skill Statistics")),$.push(U.dim(" "+"-".repeat(20))),$.push(""),$.push(` ${U.bold("Total:")} ${U.cyan(String(q.totalSkills))} skills`),$.push(` ${U.bold("Disk:")} ${U.cyan(cY(q.totalDiskBytes))}`),$.push(""),$.push(U.bold(" By Tool"));let Z=Object.entries(q.byProvider).sort((Y,H)=>H[1]-Y[1]),Q=Math.max(...Z.map(([,Y])=>Y)),X=Math.max(...Z.map(([Y])=>(O5[Y]||Y).length));for(let[Y,H]of Z){let B=O5[Y]||Y,W=L5(Y,B.padEnd(X)),V=String(H).padStart(4);$.push(` ${W} ${V} ${U1(H,Q)}`)}$.push(""),$.push(U.bold(" By Scope"));let z=Math.max(q.byScope.global,q.byScope.project),J=String(q.byScope.global).padStart(4),G=String(q.byScope.project).padStart(4);if($.push(` ${"global ".padEnd(X)} ${J} ${U1(q.byScope.global,z)}`),$.push(` ${"project".padEnd(X)} ${G} ${U1(q.byScope.project,z)}`),$.push(""),$.push(U.bold(" Duplicates")),q.duplicateGroups>0)$.push(` ${U.yellow(`${q.duplicateGroups} group(s), ${q.duplicateInstances} total instance(s)`)}`),$.push(U.dim(` Run ${U.bold("asm audit")} to review`));else $.push(` ${U.green("None")}`);return $.push(""),$.join(`
|
|
183
|
+
`)}import{access as lY,lstat as H1,mkdir as nY,readdir as iY,readFile as I5,rm as oY,symlink as aY}from"fs/promises";import{join as E$}from"path";async function W1(q){let $;try{$=await H1(q)}catch{throw Error(`Path does not exist: ${q}`)}if(!$.isDirectory())throw Error(`Path is not a directory: ${q}`);let Z=E$(q,"SKILL.md"),Q;try{Q=await I5(Z,"utf-8")}catch{throw Error(`No SKILL.md found in ${q}`)}let X=W0(Q);if(!X.name)throw Error(`Invalid SKILL.md in ${q}: missing "name" in frontmatter`);return{name:X.name,version:V0(X)}}async function M5(q,$,Z,Q){let X=E$($,Z),z=!1;try{await lY(X),z=!0}catch{}if(z){if(!Q)throw Error(`Target already exists: ${X}. Use --force to overwrite.`);await oY(X,{recursive:!0,force:!0})}await nY($,{recursive:!0}),await aY(q,X,"dir")}async function V1(q){let $;try{$=await H1(q)}catch{throw Error(`Path does not exist: ${q}`)}if(!$.isDirectory())throw Error(`Path is not a directory: ${q}`);let Z=await iY(q),Q=[];for(let X of Z){if(X.startsWith(".")||X==="node_modules")continue;let z=E$(q,X);try{if(!(await H1(z)).isDirectory())continue}catch{continue}let J=E$(z,"SKILL.md");try{let G=await I5(J,"utf-8"),Y=W0(G);if(Y.name)Q.push({absPath:z,dirName:X,name:Y.name,version:V0(Y)})}catch{}}return Q.sort((X,z)=>X.name.localeCompare(z.name)),Q}import{readFile as sY,writeFile as rY,readdir as tY,access as eY,mkdir as qU,rm as $U}from"fs/promises";import{join as Eq,resolve as ZU}from"path";import{homedir as QU}from"os";var v0=Eq(QU(),".config","agent-skill-manager","bundles");function XU(q){let $=[];if(typeof q!=="object"||q===null||Array.isArray(q))return{valid:!1,errors:["Bundle must be a JSON object."]};let Z=q;if(Z.version!==1)$.push(`Unsupported bundle version: ${JSON.stringify(Z.version)}. Expected 1.`);if(typeof Z.name!=="string"||!Z.name)$.push("Missing or empty 'name' field.");if(typeof Z.description!=="string"||!Z.description)$.push("Missing or empty 'description' field.");if(typeof Z.author!=="string"||!Z.author)$.push("Missing or empty 'author' field.");if(typeof Z.createdAt!=="string")$.push("Missing or invalid 'createdAt' field.");if(!Array.isArray(Z.skills))return $.push("Missing or invalid 'skills' array."),{valid:!1,errors:$};if(Z.skills.length===0)$.push("Bundle must contain at least one skill.");for(let Q=0;Q<Z.skills.length;Q++){let X=Z.skills[Q];if(typeof X!=="object"||X===null){$.push(`skills[${Q}]: must be an object.`);continue}let z=X;if(typeof z.name!=="string"||!z.name)$.push(`skills[${Q}]: missing or empty 'name'.`);if(typeof z.installUrl!=="string"||!z.installUrl)$.push(`skills[${Q}]: missing or empty 'installUrl'.`)}if(Z.tags!==void 0){if(!Array.isArray(Z.tags))$.push("'tags' must be an array of strings if provided.");else if(Z.tags.some((Q)=>typeof Q!=="string"))$.push("'tags' must contain only strings.")}return{valid:$.length===0,errors:$}}function T5(q,$,Z,Q,X){return{version:1,name:q,description:$,author:Z,createdAt:new Date().toISOString(),skills:Q,tags:X}}async function R5(q,$){let Z=$??await h0(),Q=Z.skills[q.name]||Z.skills[q.dirName],X;if(q.isSymlink&&q.symlinkTarget)X=q.symlinkTarget;else if(Q?.source)X=Q.source;else X=q.path;return{name:q.name,installUrl:X,description:q.description||void 0,version:q.version||void 0}}async function zU(){await qU(v0,{recursive:!0})}function K1(q){let $=q.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if($=$.replace(/^\.+|\.+$/g,""),!$||$==="."||$==="..")throw Error("Invalid bundle name: results in an empty filename after sanitization.");return $}async function j5(q){await zU();let $=`${K1(q.name)}.json`,Z=Eq(v0,$);return await rY(Z,JSON.stringify(q,null,2)+`
|
|
184
|
+
`,"utf-8"),C(`bundle: saved to ${Z}`),Z}async function B1(q){let $;try{$=await sY(q,"utf-8")}catch(X){if(X?.code==="ENOENT")throw Error(`Bundle file not found: ${q}`);throw Error(`Failed to read bundle file: ${X.message}`)}let Z;try{Z=JSON.parse($)}catch{throw Error("Bundle file is not valid JSON.")}let Q=XU(Z);if(!Q.valid)throw Error(`Invalid bundle:
|
|
185
|
+
${Q.errors.join(`
|
|
186
|
+
`)}`);return Z}async function _1(q){if(q.includes("/")||q.includes("\\")||q.endsWith(".json")){let Q=ZU(q);return B1(Q)}let $=`${K1(q)}.json`,Z=Eq(v0,$);return B1(Z)}async function w5(){let q=[];try{await eY(v0)}catch{return q}let $;try{$=await tY(v0)}catch{return q}for(let Z of $){if(!Z.endsWith(".json"))continue;let Q=Eq(v0,Z);try{let X=await B1(Q);q.push(X)}catch{C(`bundle: skipping invalid file ${Q}`)}}return q.sort((Z,Q)=>Z.name.localeCompare(Q.name)),q}async function D5(q){let $=`${K1(q)}.json`,Z=Eq(v0,$);try{return await $U(Z),C(`bundle: removed ${Z}`),!0}catch(Q){if(Q?.code==="ENOENT")return!1;throw Q}}import{readFile as _U}from"fs/promises";import{join as OU,resolve as LU,relative as FU}from"path";var C5=[{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 JU(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 Q=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(!Q.ok)return Z.fetchError=`GitHub API returned ${Q.status}`,Z;let X=await Q.json();if(Z.isOrganization=X.type==="Organization",Z.publicRepos=typeof X.public_repos==="number"?X.public_repos:null,typeof X.created_at==="string"){let z=new Date(X.created_at),J=new Date,G=Math.floor((J.getTime()-z.getTime())/31557600000),Y=Math.floor((J.getTime()-z.getTime())%31557600000/2630016000.0000005);Z.accountAge=G>0?`${G}y ${Y}m`:`${Y}m`}C(`security-audit: source analysis for ${q} -> repos=${Z.publicRepos}, org=${Z.isOrganization}, age=${Z.accountAge}`)}catch(Q){Z.fetchError=Q.message||"Failed to fetch GitHub profile",C(`security-audit: source analysis failed -> ${Z.fetchError}`)}return Z}function GU(q){let $=new Map;for(let{relPath:X,content:z}of q){let J=z.split(`
|
|
187
|
+
`);for(let G=0;G<J.length;G++){let Y=J[G],H=Y.trim();for(let B of C5)if(B.pattern.test(Y)){let W=B.category;if(!$.has(W))$.set(W,{description:B.description,matches:[]});let V=H.length>120?H.slice(0,120)+"...":H;$.get(W).matches.push({file:X,line:G+1,match:V,severity:B.severity})}}}let Z=[];for(let[X,z]of $)Z.push({category:X,description:z.description,matches:z.matches});let Q={critical:0,warning:1,info:2};return Z.sort((X,z)=>{let J=Math.min(...X.matches.map((Y)=>Q[Y.severity])),G=Math.min(...z.matches.map((Y)=>Q[Y.severity]));return J-G}),Z}function YU(q){let $=new Map;for(let z of q)for(let J of z.matches)for(let G of C5)if(G.permissionType&&G.category===z.category&&G.pattern.test(J.match)){let Y=G.permissionType;if(!$.has(Y))$.set(Y,{evidence:[],categories:new Set});let H=$.get(Y);H.evidence.push({file:J.file,line:J.line,match:J.match}),H.categories.add(z.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."},Q=[];for(let[z,J]of $)Q.push({type:z,evidence:J.evidence,reason:Z[z]});let X={shell:0,"code-execution":1,network:2,filesystem:3,environment:4};return Q.sort((z,J)=>(X[z.type]??99)-(X[J.type]??99)),Q}function UU(q,$,Z){let Q=0,X=0;for(let Y of q)for(let H of Y.matches){if(H.severity==="critical")Q++;if(H.severity==="warning")X++}let z=$.some((Y)=>Y.type==="shell"),J=$.some((Y)=>Y.type==="code-execution"),G=$.some((Y)=>Y.type==="network");if(z&&G)return{verdict:"dangerous",reason:"Skill has both shell execution and network access -- potential data exfiltration risk."};if(J&&G)return{verdict:"dangerous",reason:"Skill has dynamic code execution and network access -- potential remote code execution risk."};if(Q>=10)return{verdict:"dangerous",reason:`${Q} critical findings detected. High concentration of risky patterns.`};if(z||J)return{verdict:"warning",reason:z?"Skill executes shell commands. Review commands carefully before installing.":"Skill uses dynamic code execution. Review usage carefully."};if(Q>0)return{verdict:"warning",reason:`${Q} critical finding${Q>1?"s":""} detected. Manual review recommended.`};if(X>0)return{verdict:"caution",reason:`${X} warning${X>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 w0(q,$,Z,Q){C(`security-audit: scanning ${q}`);let X=await vq(q),z=X.reduce((W,V)=>W+V.lineCount,0),J=null;if(Z&&Q)J=await JU(Z,Q);let G=GU(X),Y=YU(G),{verdict:H,reason:B}=UU(G,Y,J);return{scannedAt:new Date().toISOString(),skillName:$,skillPath:q,source:J,codeScans:G,permissions:Y,totalFiles:X.length,totalLines:z,verdict:H,verdictReason:B}}var b=U,g0=56,HU={"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"},N5={critical:0,warning:1,info:2};function WU(q){switch(q){case"safe":return b.bgGreen(" SAFE ");case"caution":return b.bgCyan(" CAUTION ");case"warning":return b.bgYellow(" WARNING ");case"dangerous":return b.bgRed(" DANGEROUS ")}}function VU(q){switch(q){case"safe":return b.green;case"caution":return b.cyan;case"warning":return b.yellow;case"dangerous":return b.red}}function Qq(q){switch(q){case"critical":return b.red("!!");case"warning":return b.yellow(" !");case"info":return b.dim(" i")}}function O1(q,$){return q.length>$?q.slice(0,$-3)+"...":q}function S$(q){return q.toLocaleString("en-US")}function E5(q){return q.replace(/\x1b\[[0-9;]*m/g,"")}function P5(q){return E5(q).length}function BU(q){let $=new Map;for(let Z of q){let Q=`${Z.file}:${Z.line}`,X=$.get(Q);if(!X||N5[Z.severity]<N5[X.severity])$.set(Q,Z)}return Array.from($.values())}function KU(q){let $=new Map;for(let Z of q){let Q=$.get(Z.file);if(!Q)Q={file:Z.file,entries:[]},$.set(Z.file,Q);Q.entries.push({line:Z.line,match:Z.match,severity:Z.severity})}return Array.from($.values())}function b$(q){let $=[],Z=WU(q.verdict),Q=E5(Z),X=` ${b.bold(q.skillName)}`,z=` ${q.skillName}`,J=g0-4,G=Math.max(1,J-z.length-Q.length);if($.push(""),$.push(b.dim(" +-- ")+b.bold("Security Audit")+b.dim(" "+"-".repeat(g0-19)+"+")),$.push(b.dim(" |")+X+" ".repeat(G)+Z+b.dim("|")),$.push(b.dim(" |")+b.dim(` ${S$(q.totalFiles)} files | ${S$(q.totalLines)} lines`)+" ".repeat(Math.max(1,J-` ${S$(q.totalFiles)} files | ${S$(q.totalLines)} lines`.length))+b.dim("|")),$.push(b.dim(" +"+"-".repeat(g0-2)+"+")),q.source){let W=q.source;if(W.fetchError)$.push(` ${b.yellow("!")} Could not fetch profile: ${W.fetchError}`);else{let V=[];if(V.push(`${W.owner} ${W.isOrganization?b.cyan("(org)"):b.dim("(user)")}`),W.publicRepos!==null){let K=W.publicRepos,L=K<3?b.yellow(`${K} repos`):K<10?b.cyan(`${K} repos`):b.green(`${K} repos`);V.push(L)}if(W.accountAge)V.push(W.accountAge);$.push(` ${b.dim("Author:")} ${V.join(b.dim(" | "))}`)}}if($.push(""),q.codeScans.length===0)$.push(` ${b.green("*")} ${b.green("No suspicious patterns detected.")}`);else{let W=VU(q.verdict),V=q.verdict==="dangerous"||q.verdict==="warning"?Qq("critical"):q.verdict==="caution"?Qq("warning"):Qq("info");$.push(` ${V} ${W(q.verdictReason)}`);let K=0,L=0,_=0;for(let R of q.codeScans)for(let j of R.matches)if(j.severity==="critical")K++;else if(j.severity==="warning")L++;else _++;let O=[];if(K>0)O.push(b.red(`${K} critical`));if(L>0)O.push(b.yellow(`${L} warning`));if(_>0)O.push(b.dim(`${_} info`));let F=q.permissions.map((R)=>R.type),T=F.length>0?b.dim(`Perms: ${F.join(", ")}`):"";$.push(` ${O.join(b.dim(" | "))} ${T}`)}if($.push(""),q.codeScans.length>0){$.push(` ${b.bold("Findings")}`),$.push(b.dim(" "+"=".repeat(g0-2)));for(let W of q.codeScans){let V=BU(W.matches),K=V.filter((A)=>A.severity==="critical").length,L=V.filter((A)=>A.severity==="warning").length,_=V.filter((A)=>A.severity==="info").length,O=K>0?Qq("critical"):L>0?Qq("warning"):Qq("info"),F=[];if(K>0)F.push(b.red(`${K} critical`));if(L>0)F.push(b.yellow(`${L} warning`));if(_>0)F.push(b.dim(`${_} info`));let T=HU[W.category],R=T?b.dim(`PERM: ${T}`):"",j=` ${O} ${b.bold(W.category)} (${F.join(", ")})`;if(R){let A=P5(j),M=P5(R),P=Math.max(2,g0-A-M);$.push(j+" ".repeat(P)+R)}else $.push(j);let I=KU(V),w=Math.min(24,Math.max(...I.map((A)=>A.file.length))),x=0,D=3;for(let A of I){if(x>=D)break;let M=O1(A.file,24),P=b.dim(M.padEnd(w));if(A.entries.length===1){let S=A.entries[0],f=O1(S.match,50);$.push(` ${P} :${S.line} ${b.dim("--")} ${S.severity==="critical"?f:b.dim(f)}`),x++}else if(A.entries.length<=3){let S=A.entries.map((d)=>`:${d.line}`).join(", "),f=O1(A.entries[0].match,40);$.push(` ${P} ${S} ${b.dim("--")} ${b.dim(f)}`),x++}else{let f=A.entries.slice(0,3).map((p)=>`:${p.line}`).join(", "),d=A.entries.length-3;$.push(` ${P} ${f} ${b.dim(`(+${d} more)`)}`),x++}}let y=I.length-Math.min(I.length,D);if(y>0){let A=V.length-I.slice(0,D).reduce((M,P)=>M+P.entries.length,0);if(A>0)$.push(` ${b.dim(`... ${A} more in ${y} file${y>1?"s":""}`)}`)}$.push("")}}$.push(b.dim(" "+"=".repeat(g0-2)));let Y=new Date(q.scannedAt),H=`${Y.getFullYear()}-${String(Y.getMonth()+1).padStart(2,"0")}-${String(Y.getDate()).padStart(2,"0")} ${String(Y.getHours()).padStart(2,"0")}:${String(Y.getMinutes()).padStart(2,"0")}`,B=q.source&&!q.source.fetchError?`github.com/${q.source.owner}`:"";if(B){let W=Math.max(2,g0-2-H.length-B.length);$.push(b.dim(` ${H}${" ".repeat(W)}${B}`))}else $.push(b.dim(` ${H}`));return $.push(""),$.join(`
|
|
188
|
+
`)}function L1(q){return JSON.stringify(q,null,2)}function x$(q){return q.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07]*\x07/g,"").replace(/\x1b[^[\]]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}function AU(q){return q.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/</g,"<").replace(/>/g,">").replace(/\|/g,"\\|")}function F1(q){return AU(x$(q))}var u0="luongnv89/asm-registry";async function IU(q){let $=OU(q,"SKILL.md"),Z;try{Z=await _U($,"utf-8")}catch{throw Error(`No SKILL.md found in ${q}. Run "asm init" to create one.`)}let Q=W0(Z);if(!Q.name)throw Error("SKILL.md is missing required field: name");if(!Q.description)throw Error("SKILL.md is missing required field: description");let X=V0(Q),z=Q.tags?Q.tags.split(/[\s,]+/).map((J)=>J.trim().toLowerCase()).filter(Boolean):[];return{name:Q.name,description:Q.description.replace(/\s*\n\s*/g," ").trim(),version:X,license:Q.license||"MIT",creator:Q.creator||"",tags:z}}async function MU(q){if(await Bun.spawn(["git","rev-parse","--git-dir"],{cwd:q,stdout:"pipe",stderr:"pipe"}).exited!==0)throw Error(`${q} is not inside a git repository.`)}async function TU(q){let $=Bun.spawn(["git","rev-parse","HEAD"],{cwd:q,stdout:"pipe",stderr:"pipe"}),Z=await new Response($.stdout).text();if(await $.exited!==0)throw Error("Failed to get HEAD commit. Is this a git repository?");return Z.trim()}async function RU(q){let $=Bun.spawn(["git","rev-parse","--show-toplevel"],{cwd:q,stdout:"pipe",stderr:"pipe"}),Z=await new Response($.stdout).text();if(await $.exited!==0)throw Error("Failed to determine git repository root.");return Z.trim()}async function jU(q){let $=Bun.spawn(["git","remote","get-url","origin"],{cwd:q,stdout:"pipe",stderr:"pipe"}),Z=await new Response($.stdout).text();if(await $.exited!==0)throw Error("No remote origin found. Add one with: git remote add origin <url>");let X=Z.trim(),z=X.match(/^git@github\.com:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+?)(?:\.git)?$/);if(z)return`https://github.com/${z[1]}/${z[2]}`;return X.replace(/\.git$/,"")}async function wU(){if(await Bun.spawn(["gh","--version"],{stdout:"pipe",stderr:"pipe"}).exited!==0)return{available:!1,authenticated:!1,login:null};if(await Bun.spawn(["gh","auth","status"],{stdout:"pipe",stderr:"pipe"}).exited!==0)return{available:!0,authenticated:!1,login:null};let X=Bun.spawn(["gh","api","user","--jq",".login"],{stdout:"pipe",stderr:"pipe"}),z=await new Response(X.stdout).text();return{available:!0,authenticated:!0,login:await X.exited===0?z.trim():null}}function DU(q){switch(q){case"safe":case"caution":return"pass";case"warning":return"warning";case"dangerous":return"dangerous"}}function S5(q){let $={name:q.metadata.name,author:q.author,description:q.metadata.description,repository:q.repository,commit:q.commit,security_verdict:q.securityVerdict,published_at:new Date().toISOString()};if(q.skillPath)$.skill_path=q.skillPath;if(q.metadata.version&&q.metadata.version!=="0.0.0"&&/^\d+\.\d+\.\d+/.test(q.metadata.version))$.version=q.metadata.version;if(q.metadata.license)$.license=q.metadata.license;if(q.metadata.tags&&q.metadata.tags.length>0)$.tags=q.metadata.tags.slice(0,10);return $}function NU(q){let $=S5({metadata:q.metadata,author:q.metadata.creator||"unknown",commit:q.commit,repository:q.repository,securityVerdict:q.registryVerdict}),Z=C$($);if(Z.length>0)return{success:!1,manifest:$,prUrl:null,error:`Manifest validation failed: ${Z.map((Q)=>`${Q.field}: ${Q.message}`).join("; ")}`,securityVerdict:q.registryVerdict,securityReport:q.securityReport};return{success:!0,manifest:$,prUrl:null,error:null,securityVerdict:q.registryVerdict,securityReport:q.securityReport,fallback:!0,fallbackReason:q.fallbackReason}}async function b5(q){let $=LU(q.path);C(`publish: starting for ${$}`),await MU($);let Z=await IU($);C(`publish: parsed metadata for "${Z.name}"`);let X=await(q._auditFn??w0)($,Z.name),z=DU(X.verdict);if(z==="dangerous")return{success:!1,manifest:null,prUrl:null,error:`Security audit verdict: dangerous. ${X.verdictReason}`,securityVerdict:z,securityReport:X};if(z==="warning"&&!q.force)return{success:!1,manifest:null,prUrl:null,error:"Security audit verdict: warning. Use --force to override warnings.",securityVerdict:z,securityReport:X};let J=await TU($),G=await jU($),Y=await RU($),H=FU(Y,$),B=H&&H!=="."?H:void 0,V=await(q._checkGhCliFn??wU)();if(!V.available||!V.authenticated){let l=!V.available?"gh CLI not found":"gh CLI not authenticated";return NU({metadata:Z,commit:J,repository:G,registryVerdict:z,securityReport:X,fallbackReason:l})}if(!V.login)throw Error("Could not determine GitHub username. The gh CLI is authenticated but the API call failed. Check your network connection and try again.");let K=V.login,L=S5({metadata:Z,author:K,commit:J,repository:G,skillPath:B,securityVerdict:z}),_=C$(L);if(_.length>0)return{success:!1,manifest:L,prUrl:null,error:`Manifest validation failed: ${_.map((l)=>`${l.field}: ${l.message}`).join("; ")}`,securityVerdict:z,securityReport:X};if(q.dryRun)return{success:!0,manifest:L,prUrl:null,error:null,securityVerdict:z,securityReport:X};if(!q.yes){if(!process.stdin.isTTY)return{success:!1,manifest:L,prUrl:null,error:"Cannot prompt for confirmation in non-interactive mode. Use --yes to skip.",securityVerdict:z,securityReport:X};let l=x$(Z.name),yq=x$(K);process.stderr.write(`
|
|
189
|
+
About to publish "${l}" by ${yq} to ${u0}.
|
|
190
|
+
Security verdict: ${z}
|
|
191
|
+
|
|
192
|
+
Proceed? [y/N] `);let u$=await new Promise((S1)=>{let kq="",b1=(S8)=>{if(kq+=S8.toString(),kq.includes(`
|
|
193
|
+
`))process.stdin.removeListener("data",b1),process.stdin.pause(),S1(kq.trim())};process.stdin.resume(),process.stdin.on("data",b1)});if(u$.toLowerCase()!=="y"&&u$.toLowerCase()!=="yes")return{success:!1,manifest:L,prUrl:null,error:"Publish aborted by user.",securityVerdict:z,securityReport:X}}C(`publish: forking ${u0}`),await Bun.spawn(["gh","repo","fork",u0,"--clone=false"],{stdout:"pipe",stderr:"pipe"}).exited;let F=`publish/${K}/${Z.name}`,T=`manifests/${K}/${Z.name}.json`,R=JSON.stringify(L,null,2)+`
|
|
194
|
+
`,j=Buffer.from(R,"utf-8").toString("base64"),I=Bun.spawn(["gh","api",`repos/${K}/asm-registry/git/refs/heads/main`,"--jq",".object.sha"],{stdout:"pipe",stderr:"pipe"}),w=await new Response(I.stdout).text();if(await I.exited!==0)return{success:!1,manifest:L,prUrl:null,error:`Failed to read fork's main branch. Ensure the fork exists at ${K}/asm-registry.`,securityVerdict:z,securityReport:X};let D=w.trim();if(await Bun.spawn(["gh","api",`repos/${K}/asm-registry/git/refs`,"-X","POST","-f",`ref=refs/heads/${F}`,"-f",`sha=${D}`],{stdout:"pipe",stderr:"pipe"}).exited!==0)await Bun.spawn(["gh","api",`repos/${K}/asm-registry/git/refs/heads/${F}`,"-X","PATCH","-f",`sha=${D}`,"-f","force=true"],{stdout:"pipe",stderr:"pipe"}).exited;let M=Bun.spawn(["gh","api",`repos/${K}/asm-registry/contents/${T}`,"-X","PUT","-f",`message=Publish ${K}/${Z.name}`,"-f",`content=${j}`,"-f",`branch=${F}`],{stdout:"pipe",stderr:"pipe"}),P=await new Response(M.stderr).text();if(await M.exited!==0){let l=Bun.spawn(["gh","api",`repos/${K}/asm-registry/contents/${T}?ref=${F}`,"-q",".sha"],{stdout:"pipe",stderr:"pipe"}),yq=(await new Response(l.stdout).text()).trim();if(await l.exited===0&&yq){if(await Bun.spawn(["gh","api",`repos/${K}/asm-registry/contents/${T}`,"-X","PUT","-f",`message=Update ${K}/${Z.name}`,"-f",`content=${j}`,"-f",`branch=${F}`,"-f",`sha=${yq}`],{stdout:"pipe",stderr:"pipe"}).exited!==0)return{success:!1,manifest:L,prUrl:null,error:"Failed to write manifest to registry fork.",securityVerdict:z,securityReport:X}}else return{success:!1,manifest:L,prUrl:null,error:`Failed to write manifest to registry fork. ${P}`,securityVerdict:z,securityReport:X}}let f=F1(Z.name),d=F1(Z.description),p=F1(Z.license),a=`Publish ${K}/${x$(Z.name)}`,fq=[`## Skill: ${f}`,"",`**Author:** ${K}`,`**Version:** ${Z.version}`,`**Description:** ${d}`,`**License:** ${p}`,`**Repository:** ${G}`,`**Commit:** \`${J}\``,`**Security verdict:** ${z}`,"","---","","*This PR was generated by `asm publish`.*"].join(`
|
|
195
|
+
`),e=Bun.spawn(["gh","pr","create","--repo",u0,"--head",`${K}:${F}`,"--title",a,"--body",fq],{stdout:"pipe",stderr:"pipe"}),U0=await new Response(e.stdout).text(),D0=await new Response(e.stderr).text(),g$=await e.exited,_0=null;if(g$===0)_0=U0.trim();else{let l=D0.match(/https:\/\/github\.com\/[^\s]+\/pull\/\d+/);if(l)_0=l[0]}if(!_0)return{success:!1,manifest:L,prUrl:null,error:`Failed to create PR against ${u0}. ${D0}`,securityVerdict:z,securityReport:X};return{success:!0,manifest:L,prUrl:_0,error:null,securityVerdict:z,securityReport:X}}function x5(q){let $=q.manifest;if(!$)return"";return["",` gh CLI is unavailable (${q.fallbackReason}).`," To publish manually:","",` 1. Fork ${u0} on GitHub`,` 2. Create branch: publish/${$.author}/${$.name}`,` 3. Add file: manifests/${$.author}/${$.name}.json`," 4. Paste the manifest below into that file",` 5. Open a PR against ${u0}`,"",' Run "asm doctor" to fix your environment.',""," Generated manifest:",JSON.stringify($,null,2).split(`
|
|
196
|
+
`).map((Q)=>` ${Q}`).join(`
|
|
197
|
+
`)].join(`
|
|
198
|
+
`)}import{execFile as PU}from"child_process";import{promisify as CU}from"util";import{rm as f$,rename as f5,cp as y5,access as EU,mkdir as SU}from"fs/promises";import{join as y$}from"path";import{homedir as k5}from"os";var A1=CU(PU);async function bU(q,$,Z){let Q=Array(q.length),X=0;async function z(){while(X<q.length){let G=X++;Q[G]=await Z(q[G])}}let J=[];for(let G=0;G<Math.min($,q.length);G++)J.push(z());return await Promise.all(J),Q}async function xU(q,$){try{let Z=["ls-remote",q];if($)Z.push($);else Z.push("HEAD");let{stdout:Q}=await A1("git",Z,{timeout:1e4}),X=Q.split(`
|
|
199
|
+
`)[0];if(!X)return null;let z=X.split(/\s+/)[0];return z&&/^[0-9a-f]{40}$/.test(z)?z:null}catch(Z){return C(`updater: git ls-remote failed for ${q}: ${Z}`),null}}function I1(q){if(q.sourceType)return q.sourceType;if(q.source.startsWith("local:"))return"local";return"github"}function v5(q){if(q.startsWith("github:")){let $=q.slice(7),Z=$.indexOf("#");if(Z!==-1)$=$.slice(0,Z);return`https://github.com/${$}.git`}if(q.startsWith("file://"))return q;return null}function fU(q){if(!q.startsWith("github:"))return null;let $=q.slice(7),Z=$.indexOf("#");if(Z!==-1)$=$.slice(0,Z);let Q=$.split("/");if(Q.length<2||!Q[0]||!Q[1])return null;return{owner:Q[0],repo:Q[1]}}async function M1(q){let $=q?.readLockFn??h0,Z=q?.fetchRegistryIndexFn??Y1,Q=q?.lock??await $(),X=Object.entries(Q.skills);if(X.length===0)return{entries:[],outdatedCount:0,upToDateCount:0,untrackedCount:0,errorCount:0};let z=null;if(X.some(([,Y])=>I1(Y)==="registry"||Y.registryName))z=await Z();let G=await bU(X,5,async([Y,H])=>{let B=I1(H);if(!H.commitHash||H.commitHash==="unknown")return{name:Y,installedCommit:H.commitHash||"unknown",latestCommit:"unknown",source:H.source,sourceType:B,status:"untracked"};if(B==="local")return{name:Y,installedCommit:H.commitHash,latestCommit:H.commitHash,source:H.source,sourceType:B,status:"up-to-date"};if(B==="registry"&&z){let L=H.registryName||Y,_=z.manifests.find((O)=>O.name.toLowerCase()===L.toLowerCase());if(_){let O=_.commit!==H.commitHash;return{name:Y,installedCommit:J0(H.commitHash),latestCommit:J0(_.commit),source:H.source,sourceType:B,status:O?"outdated":"up-to-date"}}}let W=v5(H.source);if(!W)return{name:Y,installedCommit:J0(H.commitHash),latestCommit:"unknown",source:H.source,sourceType:B,status:"error",error:"Cannot determine remote URL"};let V=await xU(W,H.ref);if(!V)return{name:Y,installedCommit:J0(H.commitHash),latestCommit:"unknown",source:H.source,sourceType:B,status:"error",error:"Failed to fetch remote commit"};let K=V!==H.commitHash;return{name:Y,installedCommit:J0(H.commitHash),latestCommit:J0(V),source:H.source,sourceType:B,status:K?"outdated":"up-to-date"}});return{entries:G,outdatedCount:G.filter((Y)=>Y.status==="outdated").length,upToDateCount:G.filter((Y)=>Y.status==="up-to-date").length,untrackedCount:G.filter((Y)=>Y.status==="untracked").length,errorCount:G.filter((Y)=>Y.status==="error").length}}async function yU(q,$,Z,Q){if(I1($)==="local")return{name:q,status:"skipped",reason:"Local skill (not updatable)"};let z=v5($.source);if(!z)return{name:q,status:"failed",reason:"Cannot determine remote URL"};let J=y$(k5(),".config","agent-skill-manager",".tmp",`${q}-${Date.now()}`);try{let G=y$(k5(),".config","agent-skill-manager",".tmp");await SU(G,{recursive:!0}),C(`updater: cloning latest ${q} to ${J}`);let Y=["clone","--depth","1"];if($.ref&&$.ref!=="HEAD")Y.push("--branch",$.ref);Y.push(z,J);try{await A1("git",Y,{timeout:60000})}catch(I){return{name:q,status:"failed",reason:`Clone failed: ${I.stderr||I.message}`}}let H=null;try{let{stdout:I}=await A1("git",["rev-parse","HEAD"],{cwd:J,timeout:5000});H=I.trim()}catch{return{name:q,status:"failed",reason:"Could not read new commit"}}if(H===$.commitHash)return{name:q,status:"skipped",reason:"Already up to date"};C(`updater: running security audit on ${q}`);let B="safe";try{let I=Q?.auditFn??w0,w=fU($.source);if(B=(await I(J,q,w?.owner,w?.repo)).verdict,B==="dangerous")return{name:q,status:"skipped",reason:"Security audit: dangerous — update blocked",securityVerdict:B};if(B==="warning"||B==="caution"){if(!Z)return{name:q,status:"skipped",reason:`Security audit: ${B} — use --yes to override`,securityVerdict:B};C(`updater: security audit ${B} for ${q} — proceeding (--yes)`)}}catch(I){return C(`updater: security audit failed for ${q}: ${I.message}`),{name:q,status:"failed",reason:`Security audit failed — skipping update: ${I.message}`}}let W=Q?.loadConfigFn??v,V=Q?.resolveProviderPathFn??$0,L=(await W()).providers.find((I)=>I.name===$.provider),_=L?L.global:`~/.${$.provider}/skills`,O=V(_),F=y$(O,q),T=y$(J,".git");try{await f$(T,{recursive:!0,force:!0})}catch{}try{await EU(F)}catch{let I=Q?.writeLockEntryFn??Sq;return await y5(J,F,{recursive:!0}),await I(q,{...$,commitHash:H,installedAt:new Date().toISOString()}),{name:q,status:"updated",oldCommit:J0($.commitHash),newCommit:J0(H),securityVerdict:B}}let R=`${F}.bak-${Date.now()}`;try{await f5(F,R),await y5(J,F,{recursive:!0}),await f$(R,{recursive:!0,force:!0})}catch(I){try{await f$(F,{recursive:!0,force:!0}),await f5(R,F)}catch{}return{name:q,status:"failed",reason:`Atomic swap failed: ${I.message}`}}return await(Q?.writeLockEntryFn??Sq)(q,{...$,commitHash:H,installedAt:new Date().toISOString()}),{name:q,status:"updated",oldCommit:J0($.commitHash),newCommit:J0(H),securityVerdict:B}}finally{try{await f$(J,{recursive:!0,force:!0})}catch{}}}async function h5(q,$,Z){let Q=Z?.readLockFn??h0,X=Z?.checkOutdatedFn??M1,z=Z?.updateSkillFn??yU,J=await Q(),G=await X({lock:J}),Y=G.entries.filter((W)=>W.status==="outdated"),H=[];if(q&&q.length>0){let W=new Set(q.map((V)=>V.toLowerCase()));Y=Y.filter((V)=>W.has(V.name.toLowerCase()));for(let V of q)if(!Y.find((K)=>K.name.toLowerCase()===V.toLowerCase()))if(!G.entries.find((L)=>L.name.toLowerCase()===V.toLowerCase()))C(`updater: skill "${V}" not found in lock file`),H.push(V);else C(`updater: skill "${V}" is already up to date`)}if(Y.length===0)return{results:[],updatedCount:0,skippedCount:0,failedCount:0,...H.length>0?{warnings:H}:{}};let B=[];for(let W of Y){let V=J.skills[W.name];if(!V)continue;let K=await z(W.name,V,$);B.push(K)}return{results:B,updatedCount:B.filter((W)=>W.status==="updated").length,skippedCount:B.filter((W)=>W.status==="skipped").length,failedCount:B.filter((W)=>W.status==="failed").length,...H.length>0?{warnings:H}:{}}}function J0(q){if(!q||q==="unknown")return"unknown";return q.slice(0,7)}function g5(q,$){if(q.entries.length===0)return"No skills installed.";let Z=(W)=>W,Q=$?U.red:Z,X=$?U.green:Z,z=$?U.yellow:Z,J=$?U.dim:Z,G=`${"Skill".padEnd(22)}${"Installed".padEnd(14)}${"Latest".padEnd(14)}Source`,Y="─".repeat(60),H=[G,Y];for(let W of q.entries){let V=W.name.padEnd(22),K=W.installedCommit.padEnd(14),L,_;switch(W.status){case"outdated":L=Q(W.latestCommit.padEnd(14)),_=W.sourceType;break;case"up-to-date":L=X(W.latestCommit.padEnd(14)),_=J("(up to date)");break;case"untracked":L=z("untracked".padEnd(14)),_=z("untracked");break;case"error":L=J("error".padEnd(14)),_=J(W.error||"error");break}H.push(`${V}${K}${L}${_}`)}H.push("");let B=[];if(q.outdatedCount>0)B.push(Q(`${q.outdatedCount} outdated`));if(q.upToDateCount>0)B.push(X(`${q.upToDateCount} up to date`));if(q.untrackedCount>0)B.push(z(`${q.untrackedCount} untracked`));if(q.errorCount>0)B.push(J(`${q.errorCount} error`));return H.push(B.join(", ")),H.join(`
|
|
200
|
+
`)}function u5(q){return JSON.stringify({skills:q.entries.map(($)=>({name:$.name,installed:$.installedCommit,latest:$.latestCommit,source:$.sourceType,status:$.status,...$.error?{error:$.error}:{}})),summary:{outdated:q.outdatedCount,upToDate:q.upToDateCount,untracked:q.untrackedCount,errors:q.errorCount}},null,2)}function m5(q){return JSON.stringify({results:q.results.map(($)=>({name:$.name,status:$.status,...$.reason?{reason:$.reason}:{},...$.oldCommit?{oldCommit:$.oldCommit}:{},...$.newCommit?{newCommit:$.newCommit}:{},...$.securityVerdict?{securityVerdict:$.securityVerdict}:{}})),summary:{updated:q.updatedCount,skipped:q.skippedCount,failed:q.failedCount}},null,2)}import{execFile as kU}from"child_process";import{promisify as vU}from"util";import{access as p5,readFile as l5,readdir as hU,writeFile as gU,rm as uU,stat as n5}from"fs/promises";import{join as T1}from"path";import{homedir as mU}from"os";import{constants as d5}from"fs";var Xq=vU(kU);async function pU(q){let $=q?.execFn??Xq;try{let{stdout:Z}=await $("git",["--version"],{timeout:5000});return{name:"Git available",status:"pass",message:Z.trim().replace("git version ","")}}catch{return{name:"Git available",status:"fail",message:"git not found",fix:"Install git: https://git-scm.com/downloads"}}}async function dU(q){let $=q?.execFn??Xq;try{let{stdout:Z}=await $("git",["--version"],{timeout:5000}),Q=Z.match(/(\d+)\.(\d+)/);if(!Q)return{name:"Git version",status:"warn",message:"Could not parse git version",fix:"Upgrade git: https://git-scm.com/downloads"};let X=parseInt(Q[1],10),z=parseInt(Q[2],10);if(X>2||X===2&&z>=20)return{name:"Git version",status:"pass",message:`${X}.${z} (>= 2.20)`};return{name:"Git version",status:"fail",message:`${X}.${z} (requires >= 2.20)`,fix:"Upgrade git: https://git-scm.com/downloads"}}catch{return{name:"Git version",status:"pass",message:"Skipped — git not available"}}}async function cU(q){let $=q?.execFn??Xq;try{let{stdout:Z}=await $("gh",["--version"],{timeout:5000}),Q=Z.trim().split(`
|
|
201
|
+
`)[0],X=Q.match(/(\d+\.\d+\.\d+)/);return{name:"GitHub CLI available",status:"pass",message:X?X[1]:Q}}catch{return{name:"GitHub CLI available",status:"fail",message:"gh not found",fix:"Install GitHub CLI: https://cli.github.com"}}}async function lU(q){let $=q?.execFn??Xq;try{let{stdout:Z}=await $("gh",["auth","status"],{timeout:1e4}),Q=Z.match(/Logged in to .+ account (\S+)/);return{name:"GitHub CLI authenticated",status:"pass",message:Q?Q[1]:"authenticated"}}catch(Z){let X=(Z?.stderr??"").match(/Logged in to .+ account (\S+)/);if(X)return{name:"GitHub CLI authenticated",status:"pass",message:X[1]};return{name:"GitHub CLI authenticated",status:"fail",message:"Not authenticated",fix:"Run: gh auth login"}}}async function nU(q){let $=q?.execFn??Xq;try{let{stdout:Z}=await $("node",["--version"],{timeout:5000}),Q=Z.trim().replace(/^v/,"");if(parseInt(Q.split(".")[0],10)>=18)return{name:"Node.js version",status:"pass",message:Q};return{name:"Node.js version",status:"fail",message:`${Q} (requires >= 18.0)`,fix:"Upgrade Node.js: https://nodejs.org"}}catch{return{name:"Node.js version",status:"fail",message:"node not found",fix:"Install Node.js >= 18: https://nodejs.org"}}}async function iU(q){try{let $=T1(q,".asm-doctor-write-test");return await gU($,"test","utf-8"),await uU($),{writable:!0,exists:!0}}catch{}try{return await p5(q,d5.W_OK),{writable:!0,exists:!0}}catch{}try{return await p5(q,d5.F_OK),{writable:!1,exists:!0}}catch{return{writable:!0,exists:!1}}}async function oU(q){let $=q.providers.filter((z)=>z.enabled),Z=0,Q=0;for(let z of $){let J=$0(z.global);if(Q++,(await iU(J)).writable)Z++}if(Z===Q)return{name:"Agent directories writable",status:"pass",message:`${Z}/${Q} providers`};let X=Q-Z;return{name:"Agent directories writable",status:"warn",message:`${Z}/${Q} providers (${X} not writable)`,fix:"Fix permissions on agent skill directories"}}async function aU(){let q=bq();try{let $=await l5(q,"utf-8"),Z=JSON.parse($),Q=[];if(Z.version===void 0)Q.push("version");if(!Array.isArray(Z.providers))Q.push("providers");if(Q.length>0)return{name:"Config file valid",status:"fail",message:`Missing required fields: ${Q.join(", ")}`,fix:"Run: asm init"};return{name:"Config file valid",status:"pass",message:"OK"}}catch($){if($?.code==="ENOENT")return{name:"Config file valid",status:"pass",message:"No config file (using defaults)"};return{name:"Config file valid",status:"fail",message:"Corrupted or unreadable config",fix:"Run: asm init, or delete corrupted config"}}}async function sU(){let q=c5();try{let $=await l5(q,"utf-8"),Z=JSON.parse($);if(Z.version!==1||typeof Z.skills!=="object")return{name:"Lock file integrity",status:"fail",message:"Invalid lock file schema",fix:"Run: asm install to regenerate"};let Q=Z.skills,X=Object.entries(Q),z=["source","installedAt","provider"],J=[];for(let[G,Y]of X){if(typeof Y!=="object"||Y===null){J.push(G);continue}let H=Y;for(let B of z)if(!H[B]){J.push(G);break}}if(J.length>0)return{name:"Lock file integrity",status:"warn",message:`${X.length} skills tracked, ${J.length} with missing fields`,fix:"Run: asm install to regenerate"};return{name:"Lock file integrity",status:"pass",message:`${X.length} skills tracked`}}catch($){if($?.code==="ENOENT")return{name:"Lock file integrity",status:"pass",message:"No lock file (first-time user)"};return{name:"Lock file integrity",status:"fail",message:"Corrupted lock file",fix:"Run: asm install to regenerate"}}}async function rU(){try{let q=await fetch(z1,{method:"HEAD",signal:AbortSignal.timeout(5000)});if(q.ok)return{name:"Registry reachable",status:"pass",message:"OK"};return{name:"Registry reachable",status:"fail",message:`HTTP ${q.status}`,fix:"Check network connection or proxy settings"}}catch{return{name:"Registry reachable",status:"fail",message:"Network error",fix:"Check network connection or proxy settings"}}}async function tU(q,$){let Z=Object.entries($.skills);if(Z.length===0)return{name:"Installed skills intact",status:"pass",message:"No skills in lock file"};let Q=[];for(let[J,G]of Z){let Y=q.providers.find((W)=>W.name===G.provider);if(!Y){Q.push(J);continue}let H=$0(Y.global),B=T1(H,J);try{if(!(await n5(B)).isDirectory())Q.push(J)}catch{Q.push(J)}}if(Q.length===0)return{name:"Installed skills intact",status:"pass",message:`${Z.length} skills verified`};let X=Q[0],z=Q.length>1?` (+${Q.length-1} more)`:"";return{name:"Installed skills intact",status:"fail",message:`Missing: ${X}${z}`,fix:`Run: asm update ${X}`}}async function eU(q,$){let Z=new Set(Object.keys($.skills)),Q=[];for(let X of q.providers.filter((z)=>z.enabled)){let z=$0(X.global);try{let J=await hU(z);for(let G of J)try{if((await n5(T1(z,G))).isDirectory()&&!Z.has(G))Q.push(G)}catch{}}catch{}}if(Q.length===0)return{name:"No orphaned skills",status:"pass",message:"OK"};return{name:"No orphaned skills",status:"warn",message:`${Q.length} skill(s) without lock entries`,fix:"Run: asm list to review"}}async function qH(q){let $=q?.execFn??Xq;try{let{stdout:Z}=await $("df",["-Pk",mU()],{timeout:5000}),Q=Z.trim().split(`
|
|
202
|
+
`);if(Q.length<2)return{name:"Disk space",status:"warn",message:"Could not parse df output"};let X=Q[1].split(/\s+/),z=parseInt(X[3],10);if(isNaN(z))return{name:"Disk space",status:"warn",message:"Could not parse available space"};let J=z/1024,G=J/1024;if(J>100)return{name:"Disk space",status:"pass",message:`OK (${G>=1?`${G.toFixed(1)} GB free`:`${Math.round(J)} MB free`})`};return{name:"Disk space",status:"fail",message:`${Math.round(J)} MB free (requires > 100 MB)`,fix:"Free disk space in home directory"}}catch{return{name:"Disk space",status:"warn",message:"Could not check disk space"}}}async function i5(){let q=await v(),$=await h0(),Q=(await Promise.allSettled([pU(),dU(),cU(),lU(),nU(),oU(q),aU(),sU(),rU(),tU(q,$),eU(q,$),qH()])).map((G,Y)=>{if(G.status==="fulfilled")return G.value;return{name:["Git available","Git version","GitHub CLI available","GitHub CLI authenticated","Node.js version","Agent directories writable","Config file valid","Lock file integrity","Registry reachable","Installed skills intact","No orphaned skills","Disk space"][Y],status:"fail",message:`Check threw: ${G.reason}`}}),X=Q.filter((G)=>G.status==="pass").length,z=Q.filter((G)=>G.status==="warn").length,J=Q.filter((G)=>G.status==="fail").length;return{checks:Q,passed:X,warnings:z,failures:J}}var $H={pass:"✅",warn:"⚠️ ",fail:"❌"};function o5(q){let $=["Checking your environment...",""];for(let Z of q.checks){let X=` ${$H[Z.status]} ${Z.name}${Z.message?` (${Z.message})`:""}`;if($.push(X),Z.fix&&Z.status!=="pass"){let z;if(Z.fix.startsWith("Run: "))z=Z.fix;else if(/^[a-z/~]/.test(Z.fix))z=`Run: ${Z.fix}`;else z=`Fix: ${Z.fix}`;$.push(` → ${z}`)}}return $.push(""),$.push(`${q.passed} passed, ${q.warnings} warning${q.warnings!==1?"s":""}, ${q.failures} error${q.failures!==1?"s":""}`),$.join(`
|
|
203
|
+
`)}function a5(q){return JSON.stringify({checks:q.checks.map(($)=>({name:$.name,status:$.status,message:$.message,...$.fix?{fix:$.fix}:{}})),summary:{passed:q.passed,warnings:q.warnings,failures:q.failures}},null,2)}var G0={SKILL_NOT_FOUND:"SKILL_NOT_FOUND",AUDIT_FAILED:"AUDIT_FAILED",INSTALL_FAILED:"INSTALL_FAILED",PUBLISH_FAILED:"PUBLISH_FAILED",NETWORK_ERROR:"NETWORK_ERROR",INVALID_ARGUMENT:"INVALID_ARGUMENT",UNKNOWN_ERROR:"UNKNOWN_ERROR"};function zq(){let{log:q,info:$}=console,Z=(...Q)=>process.stderr.write(Q.map(String).join(" ")+`
|
|
204
|
+
`);return console.log=Z,console.info=Z,()=>{console.log=q,console.info=$}}function r5(q){return{timestamp:new Date().toISOString(),asm_version:s5,duration_ms:Math.round(performance.now()-q)}}function o(q,$,Z){let Q={version:1,command:q,status:"ok",data:$,meta:r5(Z)},X=process.stdout.isTTY?2:0;return JSON.stringify(Q,null,X)}function Y0(q,$,Z,Q,X){let z={version:1,command:q,status:"error",error:{code:$,message:Z,...X!==void 0?{details:X}:{}},meta:r5(Q)},J=process.stdout.isTTY?2:0;return JSON.stringify(z,null,J)}import{writeFile as KH,mkdir as _H,unlink as OH,readFile as LH}from"fs/promises";import{join as j1}from"path";import{readdir as ZH,readFile as QH}from"fs/promises";import{join as XH}from"path";function R1(q){let $=new Set,Z=q.toLowerCase().split(/[\s\-_.,;:()[\]{}"']+/);for(let Q of Z)if(Q.length>=2)$.add(Q);return $}var zH=10,JH=5,GH=3,YH=1;function UH(q,$){let Z=R1(q),Q=R1($.name),X=R1($.description),z=0;for(let J of Z){if(Q.has(J))z+=zH;if(X.has(J))z+=GH;if($.name.toLowerCase().includes(J))z+=JH;if($.description.toLowerCase().includes(J))z+=YH}return z}async function t5(q){let $=new Map,Z;try{Z=await ZH(q)}catch{return $}for(let Q of Z){if(!Q.endsWith(".json"))continue;let X=XH(q,Q);try{let z=await QH(X,"utf-8"),J=JSON.parse(z);for(let G of J.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(`${J.owner}/${J.repo}`,J)}catch{}}return $}async function k$(){let q=await t5($8()),$=await t5(xq()),Z=new Map(q);for(let[Q,X]of $)Z.set(Q,X);return Array.from(Z.values())}var HH=["license","creator","version"];function e5(q){return HH.includes(q)}function q8(q,$){return q[$]||""}function WH(q,$){if($.has)for(let Z of $.has){if(!e5(Z))continue;if(!q8(q,Z))return!1}if($.missing)for(let Z of $.missing){if(!e5(Z))continue;if(q8(q,Z))return!1}return!0}function Z8(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 v$(q,$=20,Z){let Q=await k$(),X=[],z=!q&&Z;for(let J of Q)for(let G of J.skills){if(Z&&!WH(G,Z))continue;let Y=z?1:UH(q,G);if(Y>0)X.push({skill:G,repo:{owner:J.owner,repo:J.repo},score:Y})}return X.sort((J,G)=>G.score-J.score),X.slice(0,$)}async function Q8(){return(await k$()).reduce(($,Z)=>$+Z.skillCount,0)}var VH=[{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 X8(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(BH($).trim().length<20)Z.push("SKILL.md body too short (less than 20 chars of instructions)");for(let{label:X,pattern:z}of VH)if(z.test($))Z.push(`malicious pattern detected: ${X}`);return{verified:Z.length===0,reasons:Z}}function BH(q){let $=q.trimStart();if(!$.startsWith("---"))return $;let Z=$.indexOf(`
|
|
205
|
+
---`,3);if(Z===-1)return"";return $.slice(Z+4)}async function FH(){let q=xq();return await _H(q,{recursive:!0}),q}async function z8(q){await d0();let $;try{$=p0(q)}catch(Q){return{success:!1,repoIndex:null,error:Q.message}}if($.isLocal)return{success:!1,repoIndex:null,error:"Local paths are not supported for indexing. Use a GitHub source instead."};C(`ingester: cloning ${$.owner}/${$.repo}`);let Z=null;try{Z=await c0($),C(`ingester: discovering skills in ${Z}`);let Q=await uq(Z);C(`ingester: found ${Q.length} skills`);let X=[];for(let Y of Q){let H=j1(Z,Y.relPath,"SKILL.md"),B="";try{B=await LH(H,"utf-8")}catch{C(`ingester: could not read SKILL.md at ${H}`)}let W=X8(Y,B);if(!W.verified)C(`ingester: ${Y.name} not verified: ${W.reasons.join(", ")}`);X.push({name:Y.name,description:Y.description,version:Y.version,license:Y.license,creator:Y.creator,compatibility:Y.compatibility,allowedTools:Y.allowedTools,installUrl:`github:${$.owner}/${$.repo}${$.ref?`#${$.ref}`:""}${Y.relPath?`:${Y.relPath}`:""}`,relPath:Y.relPath,verified:W.verified})}let z={repoUrl:$.cloneUrl,owner:$.owner,repo:$.repo,updatedAt:new Date().toISOString(),skillCount:X.length,skills:X},J=await FH(),G=j1(J,`${$.owner}_${$.repo}.json`);return await KH(G,JSON.stringify(z,null,2)+`
|
|
206
|
+
`,"utf-8"),C(`ingester: wrote index to ${G}`),{success:!0,repoIndex:z}}catch(Q){return{success:!1,repoIndex:null,error:Q.message}}finally{if(Z)await q0(Z)}}async function J8(){return(await k$()).map(($)=>({owner:$.owner,repo:$.repo,skillCount:$.skillCount,updatedAt:$.updatedAt})).sort(($,Z)=>Z.skillCount-$.skillCount)}async function G8(q,$){let Z=xq(),Q=j1(Z,`${q}_${$}.json`);try{return await OH(Q),!0}catch{return!1}}import{join as AH}from"path";function IH(q){switch(q){case"dangerous":return 3;case"warning":return 2;case"caution":return 1;default:return 0}}function E1(q){return{verdict:q.every(($)=>$.verdict==="safe")?"safe":q.some(($)=>$.verdict==="dangerous")?"dangerous":"warning",findings:q.map(($)=>({skill:$.skillName,verdict:$.verdict,verdict_reason:$.verdictReason,total_files:$.totalFiles,total_lines:$.totalLines})),risk_score:q.reduce(($,Z)=>$+IH(Z.verdict),0)}}function MH(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:[],dryRun:!1,machine:!1,noCache:!1}},Q=0;while(Q<$.length){let X=$[Q];if(X==="--help"||X==="-h")Z.flags.help=!0;else if(X==="--version"||X==="-v")Z.flags.version=!0;else if(X==="--json")Z.flags.json=!0;else if(X==="--yes"||X==="-y")Z.flags.yes=!0;else if(X==="--no-color")Z.flags.noColor=!0;else if(X==="--scope"||X==="-s"){Q++;let z=$[Q];if(z==="global"||z==="project"||z==="both")Z.flags.scope=z;else E(`Invalid scope: "${z}". Must be global, project, or both.`),process.exit(2)}else if(X==="--sort"){Q++;let z=$[Q];if(z==="name"||z==="version"||z==="location")Z.flags.sort=z;else E(`Invalid sort: "${z}". Must be name, version, or location.`),process.exit(2)}else if(X==="--provider"||X==="-p"||X==="--tool")Q++,Z.flags.provider=$[Q]||null;else if(X==="--name")Q++,Z.flags.name=$[Q]||null;else if(X==="--force"||X==="-f")Z.flags.force=!0;else if(X==="--path")Q++,Z.flags.path=$[Q]||null;else if(X==="--all")Z.flags.all=!0;else if(X==="--verbose"||X==="-V")Z.flags.verbose=!0;else if(X==="--flat")Z.flags.flat=!0;else if(X==="--installed")Z.flags.installed=!0;else if(X==="--available")Z.flags.available=!0;else if(X==="--transport"||X==="-t"){Q++;let z=$[Q];if(z==="https"||z==="ssh"||z==="auto")Z.flags.transport=z;else E(`Invalid transport: "${z}". Must be https, ssh, or auto.`),process.exit(2)}else if(X==="--method"||X==="-m"){Q++;let z=$[Q];if(z==="default"||z==="vercel")Z.flags.method=z;else E(`Invalid method: "${z}". Must be default or vercel.`),process.exit(2)}else if(X==="--skill")Q++,Z.flags.path=$[Q]||null;else if(X==="--dry-run")Z.flags.dryRun=!0;else if(X==="--machine")Z.flags.machine=!0;else if(X==="--no-cache")Z.flags.noCache=!0;else if(X==="--has"){if(Q++,$[Q])Z.flags.has.push($[Q])}else if(X==="--missing"){if(Q++,$[Q])Z.flags.missing.push($[Q])}else if(X.startsWith("-"))E(`Unknown option: ${X}`),console.error('Run "asm --help" for usage.'),process.exit(2);else if(!Z.command)Z.command=X;else if(!Z.subcommand)Z.subcommand=X;else Z.positional.push(X);Q++}return Z}function E(q){console.error(U.red(`Error: ${q}`))}function TH(){console.log(`${U.blueBold("agent-skill-manager")} (${U.bold("asm")}) ${C1}
|
|
191
207
|
|
|
192
208
|
Interactive TUI and CLI for managing installed skills for AI coding agents.
|
|
193
209
|
|
|
194
|
-
${
|
|
210
|
+
${U.bold("Usage:")}
|
|
195
211
|
asm Launch interactive TUI
|
|
196
212
|
asm <command> [options] Run a CLI command
|
|
197
213
|
|
|
198
|
-
${
|
|
214
|
+
${U.bold("Commands:")}
|
|
199
215
|
list List all discovered skills
|
|
200
216
|
search <query> Search skills by name/description/tool
|
|
201
217
|
inspect <skill-name> Show detailed info for a skill
|
|
@@ -208,49 +224,56 @@ ${Y.bold("Commands:")}
|
|
|
208
224
|
init <name> Scaffold a new skill with SKILL.md template
|
|
209
225
|
stats Show aggregate skill metrics dashboard
|
|
210
226
|
link <path> Symlink a local skill directory into an agent
|
|
227
|
+
outdated Show which installed skills have newer versions
|
|
228
|
+
update [name...] Update outdated skills with security re-audit
|
|
229
|
+
publish [path] Validate, audit, and submit a skill to the registry
|
|
211
230
|
bundle Manage skill bundles (create, install, list, show, remove)
|
|
212
231
|
index Manage skill index (ingest, search, list)
|
|
232
|
+
doctor Run environment health checks and diagnostics
|
|
213
233
|
config show Print current config
|
|
214
234
|
config path Print config file path
|
|
215
235
|
config reset Reset config to defaults
|
|
216
236
|
config edit Open config in $EDITOR
|
|
217
237
|
|
|
218
|
-
${
|
|
238
|
+
${U.bold("Global Options:")}
|
|
219
239
|
-h, --help Show help for any command
|
|
220
240
|
-v, --version Print version and exit
|
|
221
241
|
--json Output as JSON (list, search, inspect)
|
|
242
|
+
--machine Stable machine-readable JSON envelope (v1)
|
|
222
243
|
-s, --scope <scope> Filter: global, project, or both (default: both)
|
|
223
244
|
-p, --tool <name> Filter by tool (list, search)
|
|
224
245
|
--no-color Disable ANSI colors
|
|
225
246
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
226
247
|
--flat Show one row per tool instance (list, search)
|
|
227
248
|
-y, --yes Skip confirmation prompts
|
|
228
|
-
-V, --verbose Show debug output`)}function
|
|
249
|
+
-V, --verbose Show debug output`)}function RH(){console.log(`${U.bold("Usage:")} asm list [options]
|
|
229
250
|
|
|
230
251
|
List all discovered skills. By default, skills installed across multiple
|
|
231
252
|
tools are grouped into a single row with tool badges.
|
|
232
253
|
|
|
233
|
-
${
|
|
254
|
+
${U.bold("Options:")}
|
|
234
255
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
235
256
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
236
257
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
237
258
|
--flat Show one row per tool instance (ungrouped)
|
|
238
259
|
--json Output as JSON array
|
|
260
|
+
--machine Output in stable machine-readable v1 envelope format
|
|
239
261
|
--no-color Disable ANSI colors
|
|
240
262
|
-V, --verbose Show debug output
|
|
241
263
|
|
|
242
|
-
${
|
|
243
|
-
asm list ${
|
|
244
|
-
asm list --flat ${
|
|
245
|
-
asm list -p claude ${
|
|
246
|
-
asm list -s project ${
|
|
247
|
-
asm list --sort version ${
|
|
248
|
-
asm list --json ${
|
|
264
|
+
${U.bold("Examples:")}
|
|
265
|
+
asm list ${U.dim("List all skills (grouped)")}
|
|
266
|
+
asm list --flat ${U.dim("One row per tool instance")}
|
|
267
|
+
asm list -p claude ${U.dim("Only Claude Code skills")}
|
|
268
|
+
asm list -s project ${U.dim("Only project-scoped skills")}
|
|
269
|
+
asm list --sort version ${U.dim("Sort by version")}
|
|
270
|
+
asm list --json ${U.dim("Output as JSON")}
|
|
271
|
+
asm list --machine ${U.dim("Machine-readable v1 envelope output")}`)}function jH(){console.log(`${U.bold("Usage:")} asm search <query> [options]
|
|
249
272
|
|
|
250
273
|
Search both installed skills and the skill index. Results show installation
|
|
251
274
|
status and include copy-paste install commands for available skills.
|
|
252
275
|
|
|
253
|
-
${
|
|
276
|
+
${U.bold("Options:")}
|
|
254
277
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
255
278
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
256
279
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
@@ -258,98 +281,158 @@ ${Y.bold("Options:")}
|
|
|
258
281
|
--available Show only available (not installed) skills
|
|
259
282
|
--flat Show one row per tool instance (ungrouped)
|
|
260
283
|
--json Output as JSON array
|
|
284
|
+
--machine Output in stable machine-readable v1 envelope format
|
|
261
285
|
--no-color Disable ANSI colors
|
|
262
286
|
-V, --verbose Show debug output
|
|
263
287
|
|
|
264
|
-
${
|
|
265
|
-
asm search code ${
|
|
266
|
-
asm search review -p claude ${
|
|
267
|
-
asm search "test" --installed ${
|
|
268
|
-
asm search "test" --available ${
|
|
269
|
-
asm search openspec --json ${
|
|
288
|
+
${U.bold("Examples:")}
|
|
289
|
+
asm search code ${U.dim("Search installed and available skills")}
|
|
290
|
+
asm search review -p claude ${U.dim("Search within Claude Code only")}
|
|
291
|
+
asm search "test" --installed ${U.dim("Search installed skills only")}
|
|
292
|
+
asm search "test" --available ${U.dim("Search available skills only")}
|
|
293
|
+
asm search openspec --json ${U.dim("Output matches as JSON")}
|
|
294
|
+
asm search openspec --machine ${U.dim("Machine-readable v1 envelope output")}`)}function wH(){console.log(`${U.bold("Usage:")} asm inspect <skill-name> [options]
|
|
270
295
|
|
|
271
296
|
Show detailed information for a skill. The <skill-name> is the directory name.
|
|
272
297
|
Shows version, description, file count, and all provider installations.
|
|
273
298
|
|
|
274
|
-
${
|
|
299
|
+
${U.bold("Options:")}
|
|
275
300
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
276
301
|
--json Output as JSON object
|
|
277
302
|
--no-color Disable ANSI colors
|
|
278
303
|
-V, --verbose Show debug output
|
|
279
304
|
|
|
280
|
-
${
|
|
281
|
-
asm inspect code-review ${
|
|
282
|
-
asm inspect code-review --json ${
|
|
283
|
-
asm inspect code-review -s global ${
|
|
305
|
+
${U.bold("Examples:")}
|
|
306
|
+
asm inspect code-review ${U.dim("Show details for code-review")}
|
|
307
|
+
asm inspect code-review --json ${U.dim("Output as JSON")}
|
|
308
|
+
asm inspect code-review -s global ${U.dim("Global installations only")}`)}function DH(){console.log(`${U.bold("Usage:")} asm uninstall <skill-name> [options]
|
|
284
309
|
|
|
285
310
|
Remove a skill and its associated rule files. Shows a removal plan
|
|
286
311
|
before proceeding and asks for confirmation.
|
|
287
312
|
|
|
288
|
-
${
|
|
313
|
+
${U.bold("Options:")}
|
|
289
314
|
-y, --yes Skip confirmation prompt
|
|
290
315
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
291
316
|
--no-color Disable ANSI colors
|
|
292
317
|
-V, --verbose Show debug output
|
|
293
318
|
|
|
294
|
-
${
|
|
295
|
-
asm uninstall code-review ${
|
|
296
|
-
asm uninstall code-review -y ${
|
|
297
|
-
asm uninstall code-review -s project ${
|
|
319
|
+
${U.bold("Examples:")}
|
|
320
|
+
asm uninstall code-review ${U.dim("Remove with confirmation")}
|
|
321
|
+
asm uninstall code-review -y ${U.dim("Remove without confirmation")}
|
|
322
|
+
asm uninstall code-review -s project ${U.dim("Remove project copy only")}`)}function NH(){console.log(`${U.bold("Usage:")} asm audit [subcommand] [options]
|
|
298
323
|
|
|
299
324
|
Detect duplicate skills or run security audits on installed/remote skills.
|
|
300
325
|
|
|
301
|
-
${
|
|
326
|
+
${U.bold("Subcommands:")}
|
|
302
327
|
duplicates Find duplicate skills (default)
|
|
303
328
|
security <name|source> Run security audit on an installed skill or GitHub source
|
|
304
329
|
|
|
305
|
-
${
|
|
330
|
+
${U.bold("Options:")}
|
|
306
331
|
--json Output as JSON
|
|
332
|
+
--machine Output in stable machine-readable v1 envelope format
|
|
307
333
|
-y, --yes Auto-remove duplicates, keeping one instance per group
|
|
308
334
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
309
335
|
--no-color Disable ANSI colors
|
|
310
336
|
-V, --verbose Show debug output
|
|
311
337
|
|
|
312
|
-
${
|
|
313
|
-
asm audit ${
|
|
314
|
-
asm audit -y ${
|
|
315
|
-
asm audit --json ${
|
|
316
|
-
asm audit security code-review ${
|
|
317
|
-
asm audit security github:user/repo ${
|
|
318
|
-
asm audit security --all ${
|
|
319
|
-
asm audit security code-review --json ${
|
|
338
|
+
${U.bold("Examples:")}
|
|
339
|
+
asm audit ${U.dim("Find duplicates")}
|
|
340
|
+
asm audit -y ${U.dim("Auto-remove duplicates")}
|
|
341
|
+
asm audit --json ${U.dim("Output as JSON")}
|
|
342
|
+
asm audit security code-review ${U.dim("Audit an installed skill")}
|
|
343
|
+
asm audit security github:user/repo ${U.dim("Audit a remote skill before installing")}
|
|
344
|
+
asm audit security --all ${U.dim("Audit all installed skills")}
|
|
345
|
+
asm audit security code-review --json ${U.dim("Output audit as JSON")}
|
|
346
|
+
asm audit security code-review --machine ${U.dim("Machine-readable v1 envelope output")}
|
|
320
347
|
asm audit security https://github.com/user/skills/tree/main/skills/agent-config
|
|
321
|
-
${
|
|
348
|
+
${U.dim("Audit a skill from a subfolder URL")}`)}function PH(){console.log(`${U.bold("Usage:")} asm publish [path] [options]
|
|
349
|
+
|
|
350
|
+
Validate a skill, run a security audit, generate a registry manifest,
|
|
351
|
+
and open a PR against the asm-registry.
|
|
352
|
+
|
|
353
|
+
${U.bold("Arguments:")}
|
|
354
|
+
path Path to skill directory (default: current directory)
|
|
355
|
+
|
|
356
|
+
${U.bold("Options:")}
|
|
357
|
+
--dry-run Print generated manifest without opening a PR
|
|
358
|
+
--force Override 'warning' security verdict (blocks 'dangerous')
|
|
359
|
+
-y, --yes Skip confirmation prompts
|
|
360
|
+
--json Output result as JSON
|
|
361
|
+
--machine Output in stable machine-readable v1 envelope format
|
|
362
|
+
--no-color Disable ANSI colors
|
|
363
|
+
-V, --verbose Show debug output
|
|
364
|
+
|
|
365
|
+
${U.bold("Examples:")}
|
|
366
|
+
asm publish ${U.dim("Publish skill in current directory")}
|
|
367
|
+
asm publish ./my-skill ${U.dim("Publish skill at the given path")}
|
|
368
|
+
asm publish --dry-run ${U.dim("Preview manifest without side effects")}
|
|
369
|
+
asm publish --force ${U.dim("Override warning-level security findings")}
|
|
370
|
+
asm publish --json ${U.dim("Output as JSON")}
|
|
371
|
+
asm publish --machine ${U.dim("Machine-readable v1 envelope output")}`)}function CH(){console.log(`${U.bold("Usage:")} asm outdated [options]
|
|
372
|
+
|
|
373
|
+
Show which installed skills have newer versions available.
|
|
374
|
+
|
|
375
|
+
${U.bold("Options:")}
|
|
376
|
+
--json Output as JSON
|
|
377
|
+
--machine Output in stable machine-readable format
|
|
378
|
+
--no-color Disable ANSI colors
|
|
379
|
+
-V, --verbose Show debug output
|
|
380
|
+
|
|
381
|
+
${U.bold("Examples:")}
|
|
382
|
+
asm outdated ${U.dim("Show outdated skills")}
|
|
383
|
+
asm outdated --json ${U.dim("Output as JSON")}
|
|
384
|
+
asm outdated --machine ${U.dim("Machine-readable output")}`)}function EH(){console.log(`${U.bold("Usage:")} asm update [name...] [options]
|
|
385
|
+
|
|
386
|
+
Update outdated skills to their latest version with security re-audit.
|
|
387
|
+
|
|
388
|
+
${U.bold("Arguments:")}
|
|
389
|
+
name Specific skill(s) to update (default: all outdated)
|
|
390
|
+
|
|
391
|
+
${U.bold("Options:")}
|
|
392
|
+
-y, --yes Skip confirmation prompts
|
|
393
|
+
--json Output as JSON
|
|
394
|
+
--machine Output in stable machine-readable format
|
|
395
|
+
--no-color Disable ANSI colors
|
|
396
|
+
-V, --verbose Show debug output
|
|
397
|
+
|
|
398
|
+
${U.bold("Examples:")}
|
|
399
|
+
asm update ${U.dim("Update all outdated skills")}
|
|
400
|
+
asm update code-review ${U.dim("Update a specific skill")}
|
|
401
|
+
asm update --yes ${U.dim("Skip confirmation prompts")}
|
|
402
|
+
asm update --json ${U.dim("Output as JSON")}`)}function SH(){console.log(`${U.bold("Usage:")} asm config <subcommand>
|
|
322
403
|
|
|
323
404
|
Manage configuration. Config is stored at ~/.config/agent-skill-manager/.
|
|
324
405
|
|
|
325
|
-
${
|
|
406
|
+
${U.bold("Subcommands:")}
|
|
326
407
|
show Print current config as JSON
|
|
327
408
|
path Print config file path
|
|
328
409
|
reset Reset config to defaults (with confirmation)
|
|
329
410
|
edit Open config in $EDITOR
|
|
330
411
|
|
|
331
|
-
${
|
|
412
|
+
${U.bold("Options:")}
|
|
332
413
|
-V, --verbose Show debug output
|
|
333
414
|
|
|
334
|
-
${
|
|
335
|
-
asm config show ${
|
|
336
|
-
asm config edit ${
|
|
337
|
-
asm config reset -y ${
|
|
338
|
-
${
|
|
339
|
-
`)),q.flags.flat)console.log(
|
|
340
|
-
${
|
|
341
|
-
Done.`))}function
|
|
342
|
-
`))
|
|
343
|
-
Auto-removing duplicates...`));for(let
|
|
344
|
-
Done.`))}}async function
|
|
345
|
-
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2)
|
|
346
|
-
`);let
|
|
347
|
-
Summary:`)),
|
|
348
|
-
`);let
|
|
349
|
-
|
|
350
|
-
Install a skill from a GitHub repository or a local
|
|
351
|
-
|
|
352
|
-
${
|
|
415
|
+
${U.bold("Examples:")}
|
|
416
|
+
asm config show ${U.dim("View current config")}
|
|
417
|
+
asm config edit ${U.dim("Edit in $EDITOR")}
|
|
418
|
+
asm config reset -y ${U.dim("Reset without confirmation")}`)}async function P8(q){for(let $ of q)$.warnings=await Z5($)}async function bH(q){if(q.flags.help){RH();return}let $=performance.now(),Z=await v(),Q=await i(Z,q.flags.scope);if(q.flags.provider&&q.command==="list")Q=Q.filter((z)=>z.provider===q.flags.provider);await P8(Q);let X=w1(Q,q.flags.sort);if(q.flags.machine){let z=X.map((J)=>({name:J.name,version:J.version,description:J.description,scope:J.scope,provider:J.provider,path:J.path}));console.log(o("list",z,$));return}if(q.flags.json)console.log(c(X));else if(q.flags.flat){let z=N1(X),J=X.filter((G)=>G.warnings&&G.warnings.length>0);if(J.length>0)z+=`
|
|
419
|
+
${U.yellow(`${J.length} skill${J.length===1?"":"s"} with warnings -- use --json for details`)}`;console.log(z)}else console.log(L8(X))}async function xH(q){if(q.flags.help){jH();return}let $=q.flags.machine?zq():void 0,Z=performance.now(),Q=q.subcommand;if(!Q){if(q.flags.machine)$?.(),console.log(Y0("search",G0.INVALID_ARGUMENT,"Missing required argument: <query>",Z)),process.exit(2);E("Missing required argument: <query>"),console.error('Run "asm search --help" for usage.'),process.exit(2)}let X=!q.flags.available,z=!q.flags.installed,J=[];if(X){let B=await v(),W=await i(B,q.flags.scope);if(q.flags.provider)W=W.filter((K)=>K.provider===q.flags.provider);let V=W8(W,Q);J=w1(V,q.flags.sort)}let G=[];if(z){if(G=await v$(Q),J.length>0){let B=new Set(J.map((W)=>W.name.toLowerCase()));G=G.filter((W)=>!B.has(W.skill.name.toLowerCase()))}}if(q.flags.machine){$?.();let B=J.map((V)=>({name:V.name,description:V.description,source:"installed",url:null,match_count:1})),W=G.map((V)=>({name:V.skill.name,description:V.skill.description,source:"index",url:V.skill.installUrl,match_count:1}));console.log(o("search",[...B,...W],Z));return}if(q.flags.json){let B=J.map((V)=>({name:V.name,description:V.description,version:V.version,scope:V.scope,provider:V.provider,status:"installed"})),W=G.map((V)=>({name:V.skill.name,description:V.skill.description,version:V.skill.version,repo:`${V.repo.owner}/${V.repo.repo}`,installCommand:`asm install ${V.skill.installUrl}`,status:"available"}));console.log(c([...B,...W]));return}let Y=J.length>0,H=G.length>0;if(!Y&&!H){console.error(`No skills matching "${Q}".`),console.error(U.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(Y)if(console.error(U.bold(`Installed skills matching "${Q}":
|
|
420
|
+
`)),q.flags.flat)console.log(N1(J));else console.log(F8(J,Q));if(H){if(Y)console.error("");let B=A8(G.map((W)=>({name:W.skill.name,version:W.skill.version,description:W.skill.description,verified:W.skill.verified,repoLabel:`${W.repo.owner}/${W.repo.repo}`,installUrl:W.skill.installUrl})),Q);console.error(B)}}async function fH(q){if(q.flags.help){wH();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(),X=(await i(Z,q.flags.scope)).filter((z)=>z.dirName===$);if(X.length===0)E(`Skill "${$}" not found.`),console.error(U.dim(`Try ${U.bold("asm list")} to see all skills or ${U.bold(`asm search "${$}"`)} to search.`)),process.exit(1);if(await P8(X),q.flags.json)console.log(c(X.length===1?X[0]:X));else console.log(await I8(X))}async function yH(q){if(q.flags.help){DH();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(),Q=await i(Z,q.flags.scope),X=B8($,Q,Z),z=await K8(X);if(z.length===0)E(`Skill "${$}" not found or nothing to remove.`),process.exit(1);console.error(U.bold("Removal plan:"));for(let G of z)console.error(` ${U.red("•")} ${O8(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(`
|
|
421
|
+
${U.bold("Proceed with removal?")} [y/N] `);let G=await t();if(G.toLowerCase()!=="y"&&G.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let J=await D1(X);for(let G of J)console.error(G);try{await T8($)}catch{}console.error(U.green(`
|
|
422
|
+
Done.`))}function t(){return new Promise((q)=>{let $="",Z=!1;function Q(){process.stdin.removeListener("data",z),process.stdin.removeListener("end",J),process.stdin.pause(),clearTimeout(G)}function X(Y){if(Z)return;Z=!0,Q(),q(Y)}function z(Y){if($+=Y,$.includes(`
|
|
423
|
+
`))X($.trim())}function J(){X($.trim())}let G=setTimeout(()=>{X($.trim())},30000);process.stdin.setEncoding("utf-8"),process.stdin.on("data",z),process.stdin.on("end",J),process.stdin.resume()})}async function kH(q){if(q.flags.help){NH();return}let $=performance.now(),Z=q.subcommand??"duplicates";if(Z==="security"){await vH(q,$);return}if(Z!=="duplicates")E(`Unknown audit subcommand: "${Z}". Use: duplicates, security`),process.exit(2);let Q=await v(),X=await i(Q,"both"),z=P1(X);if(q.flags.machine){let J={duplicate_groups:z.duplicateGroups.map((G)=>({name:G.key,count:G.instances.length,instances:G.instances.map((Y)=>({path:Y.path,scope:Y.scope,provider:Y.provider}))})),total_duplicates:z.duplicateGroups.length};console.log(o("audit duplicates",J,$));return}if(q.flags.json){console.log(D8(z));return}if(console.log(w8(z)),q.flags.yes&&z.duplicateGroups.length>0){console.error(U.bold(`
|
|
424
|
+
Auto-removing duplicates...`));for(let J of z.duplicateGroups){let G=j8(J.instances),Y=G[0].path;for(let H=1;H<G.length;H++){let B=G[H],W=V8(B,Q),V=await D1(W,Y);for(let K of V)console.error(K)}}console.error(U.green(`
|
|
425
|
+
Done.`))}}async function vH(q,$){let Z=q.positional[0];if(q.flags.all)await hH(q,$);else if(!Z){if(q.flags.machine)console.log(Y0("audit security",G0.INVALID_ARGUMENT,"Missing target. Provide a skill name, GitHub source, or use --all.",$)),process.exit(2);E(`Missing target. Provide a skill name, GitHub source, or use --all.
|
|
426
|
+
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2)}else if(Z.startsWith("github:")||Z.startsWith("https://github.com/"))await gH(q,Z,$);else await uH(q,Z,$)}async function hH(q,$){let Z=await v(),Q=await i(Z,q.flags.scope);if(Q.length===0){if(q.flags.machine)console.log(o("audit security",[],$));else if(q.flags.json)console.log("[]");else console.log("No skills found to audit.");return}let X=new Set,z=Q.filter((G)=>{if(X.has(G.realPath))return!1;return X.add(G.realPath),!0});console.error(`Auditing ${z.length} skill${z.length>1?"s":""}...
|
|
427
|
+
`);let J=[];for(let G of z){console.error(` Scanning ${U.bold(G.name)}...`);let Y=await w0(G.realPath,G.name);J.push(Y)}if(q.flags.machine)console.log(o("audit security",E1(J),$));else if(q.flags.json)console.log(JSON.stringify(J,null,2));else{for(let Y of J)console.log(b$(Y));let G={safe:0,caution:0,warning:0,dangerous:0};for(let Y of J)G[Y.verdict]++;if(console.log(U.bold(`
|
|
428
|
+
Summary:`)),G.dangerous>0)console.log(` ${U.red(`${G.dangerous} dangerous`)}`);if(G.warning>0)console.log(` ${U.yellow(`${G.warning} warning`)}`);if(G.caution>0)console.log(` ${G.caution} caution`);if(G.safe>0)console.log(` ${U.green(`${G.safe} safe`)}`);console.log("")}}async function gH(q,$,Z){let Q=null;try{let X=p0($);if(X.isLocal)throw Error("Local paths are not supported for remote security audits. Use: asm audit security <installed-skill-name>");await d0(),X=await l$(X),console.error(`Cloning ${$} for audit...`),Q=await c0(X,q.flags.transport);let{join:z}=await import("path"),J=X.subpath?z(Q,X.subpath):Q,{name:G}=await C0(J),Y=await w0(J,G,X.owner,X.repo);if(q.flags.machine)console.log(o("audit security",E1([Y]),Z));else if(q.flags.json)console.log(L1(Y));else console.log(b$(Y))}catch(X){if(q.flags.machine)console.log(Y0("audit security",G0.AUDIT_FAILED,X.message,Z)),process.exit(1);E(X.message),process.exit(1)}finally{if(Q)await q0(Q)}}async function uH(q,$,Z){let Q=await v(),z=(await i(Q,q.flags.scope)).filter((Y)=>Y.dirName===$);if(z.length===0){if(q.flags.machine)console.log(Y0("audit security",G0.SKILL_NOT_FOUND,`Skill "${$}" not found.`,Z)),process.exit(1);E(`Skill "${$}" not found. Use "asm list" to see installed skills.`),process.exit(1)}let J=z[0];console.error(`Auditing installed skill: ${U.bold(J.name)}...
|
|
429
|
+
`);let G=await w0(J.realPath,J.name);if(q.flags.machine)console.log(o("audit security",E1([G]),Z));else if(q.flags.json)console.log(L1(G));else console.log(b$(G))}async function mH(q){if(q.flags.help){SH();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(c(Z));break}case"path":{console.log(bq());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(`${U.bold("Reset config to defaults?")} [y/N] `);let Q=await t();if(Q.toLowerCase()!=="y"&&Q.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Z=U8();await H8(Z),console.error(U.green("Config reset to defaults."));break}case"edit":{let Z=process.env.VISUAL||process.env.EDITOR||"vi",[Q,X]=N8(Z),z=bq();await v();let{spawn:J}=await import("child_process");await new Promise((G,Y)=>{let H=J(Q,[...X,z],{stdio:"inherit"});H.on("close",()=>G()),H.on("error",Y)});break}default:E(`Unknown config subcommand: "${$}". Use: show, path, reset, or edit.`),process.exit(2)}}function pH(){console.log(`${U.bold("Usage:")} asm install <source> [options]
|
|
430
|
+
|
|
431
|
+
Install a skill from a GitHub repository, the curated registry, or a local path.
|
|
432
|
+
|
|
433
|
+
${U.bold("Source Format:")}
|
|
434
|
+
code-review Install by name from the curated registry
|
|
435
|
+
author/code-review Install a scoped name (author/name) from registry
|
|
353
436
|
github:owner/repo Install from default branch
|
|
354
437
|
github:owner/repo#ref Install from specific branch or tag
|
|
355
438
|
github:owner/repo#ref:path Install from a subfolder on a specific branch
|
|
@@ -360,7 +443,7 @@ ${Y.bold("Source Format:")}
|
|
|
360
443
|
./relative/path/to/skill Install from a local folder (relative path)
|
|
361
444
|
~/path/to/skill Install from a local folder (home-relative path)
|
|
362
445
|
|
|
363
|
-
${
|
|
446
|
+
${U.bold("Options:")}
|
|
364
447
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents, all)
|
|
365
448
|
Use "all" to install to all tools (shared + symlinks)
|
|
366
449
|
-s, --scope <scope> Installation scope: global or project (default: prompt)
|
|
@@ -374,70 +457,81 @@ ${Y.bold("Options:")}
|
|
|
374
457
|
vercel delegates to npx skills add for tracking
|
|
375
458
|
-t, --transport <mode> Transport: https, ssh, or auto (default: auto)
|
|
376
459
|
auto tries HTTPS first, falls back to SSH on auth error
|
|
460
|
+
--no-cache Force fresh registry fetch (bypass 1-hour TTL cache)
|
|
377
461
|
-f, --force Overwrite if skill already exists
|
|
378
462
|
-y, --yes Skip confirmation prompt
|
|
379
463
|
--json Output result as JSON
|
|
464
|
+
--machine Machine-readable output (includes resolution source)
|
|
380
465
|
--no-color Disable ANSI colors
|
|
381
466
|
-V, --verbose Show debug output
|
|
382
467
|
|
|
383
|
-
${
|
|
384
|
-
asm install
|
|
385
|
-
asm install /
|
|
386
|
-
asm install
|
|
387
|
-
|
|
388
|
-
|
|
468
|
+
${U.bold("Registry (bare name):")}
|
|
469
|
+
asm install code-review ${U.dim("(resolve from registry)")}
|
|
470
|
+
asm install luongnv89/code-review ${U.dim("(scoped name, no ambiguity)")}
|
|
471
|
+
asm install code-review --no-cache ${U.dim("(force fresh registry fetch)")}
|
|
472
|
+
|
|
473
|
+
${U.bold("Local folder:")}
|
|
474
|
+
asm install ./my-skill ${U.dim("(relative path)")}
|
|
475
|
+
asm install /home/user/skills/my-skill ${U.dim("(absolute path)")}
|
|
476
|
+
asm install ~/skills/my-skill ${U.dim("(home-relative path)")}
|
|
477
|
+
asm install ../other-project/skill ${U.dim("(parent-relative path)")}
|
|
478
|
+
asm install ./skills-dir --all ${U.dim("(all skills in directory)")}
|
|
389
479
|
|
|
390
|
-
${
|
|
480
|
+
${U.bold("Single-skill repo:")}
|
|
391
481
|
asm install github:user/my-skill
|
|
392
482
|
asm install github:user/my-skill#v1.0.0 -p claude
|
|
393
483
|
asm install https://github.com/user/my-skill
|
|
394
|
-
asm install github:user/my-skill -p all ${
|
|
395
|
-
asm install github:user/private-skill -t ssh ${
|
|
484
|
+
asm install github:user/my-skill -p all ${U.dim("(install to all tools)")}
|
|
485
|
+
asm install github:user/private-skill -t ssh ${U.dim("(clone via SSH)")}
|
|
396
486
|
|
|
397
|
-
${
|
|
487
|
+
${U.bold("Multi-skill repo:")}
|
|
398
488
|
asm install github:user/skills --path skills/code-review
|
|
399
489
|
asm install github:user/skills --all -p claude -y
|
|
400
|
-
asm install github:user/skills --all -p all -y ${
|
|
490
|
+
asm install github:user/skills --all -p all -y ${U.dim("(all skills, all tools)")}
|
|
401
491
|
asm install https://github.com/user/skills --all
|
|
402
|
-
asm install github:user/skills ${
|
|
492
|
+
asm install github:user/skills ${U.dim("(interactive picker)")}
|
|
403
493
|
|
|
404
|
-
${
|
|
494
|
+
${U.bold("Subfolder URL:")}
|
|
405
495
|
asm install https://github.com/user/skills/tree/main/skills/agent-config
|
|
406
496
|
asm install github:user/skills#main:skills/agent-config
|
|
407
497
|
|
|
408
|
-
${
|
|
498
|
+
${U.bold("Vercel skills CLI:")}
|
|
409
499
|
asm install github:user/skills --method vercel --skill my-skill
|
|
410
500
|
asm install https://github.com/user/skills -m vercel --skill my-skill -y
|
|
411
|
-
${
|
|
412
|
-
${
|
|
413
|
-
${
|
|
414
|
-
${
|
|
415
|
-
${
|
|
416
|
-
|
|
501
|
+
${U.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function dH(q,$,Z,Q,X,z,J,G,Y="global"){let H=await C0(Q),B=await m1(Q),W=Q===Z?null:Q.split(/[/\\]/).pop(),V=X||W||$.repo,K=P0(V),L=G.find((w)=>w.name.toLowerCase()===H.name.toLowerCase()&&w.provider===J.name),_,O=!!L;if(L)if(L.version===H.version)_=q.flags.force?"REINSTALL":`UPDATE: ${L.version} (same version)`;else _=`UPDATE: ${L.version} → ${H.version}`;else _="NEW";let F=n$($,Z,Q,K,J,q.flags.force||O,Y),T=B.some((w)=>["Shell commands","Code execution","Credentials"].includes(w.category)),R=B.some((w)=>["External URLs"].includes(w.category)),j=T?"high":R?"medium":"safe",I=T?U.red("[!] High Risk"):R?U.yellow("[~] Medium Risk"):U.green("[ok] Safe");return{metadata:H,skillName:K,warnings:B,installStatus:_,riskLevel:j,riskLabel:I,plan:F}}function cH(q,$,Z,Q,X,z){let{metadata:J,warnings:G,installStatus:Y,riskLabel:H,plan:B}=q;if(X&&z){let W=U.dim(`[${z.index}/${z.total}]`),V=Y==="NEW"?U.green(`[${Y}]`):U.yellow(`[${Y}]`);console.info(`${W} ${U.bold(J.name)} v${J.version} ${V} ${H}`)}else{let W=Y==="NEW"?U.green(`[${Y}]`):U.yellow(`[${Y}]`);if(console.info(` ${U.bold(J.name)} v${J.version} ${W}`),console.info(`
|
|
502
|
+
${U.bold("Install preview:")}`),console.info(` ${U.bold("Name:")} ${J.name}`),console.info(` ${U.bold("Version:")} ${J.version}`),J.description)console.info(` ${U.bold("Description:")} ${U.dim(J.description)}`);if(J.effort)console.info(` ${U.bold("Effort:")} ${_8(J.effort)}`);if(console.info(` ${U.bold("Source:")} ${$}`),Q)console.info(` ${U.bold("Tool:")} All (${Q.map((V)=>V.label).join(", ")})`),console.info(` ${U.bold("Primary:")} ${Z.label} (${Z.name})`),console.info(` ${U.bold("Symlinks:")} ${Q.filter((V)=>V.name!==Z.name).map((V)=>V.label).join(", ")}`);else console.info(` ${U.bold("Tool:")} ${Z.label} (${Z.name})`);if(console.info(` ${U.bold("Scope:")} ${B.scope==="project"?"Project":"Global"}`),console.info(` ${U.bold("Target:")} ${B.targetDir}`),console.info(` ${U.bold("Status:")} ${W}`),console.info(` ${U.bold("Risk:")} ${H}`),G.length>0){console.info(`
|
|
503
|
+
${U.bold("Security warnings:")}`);let V=new Map;for(let K of G){let L=V.get(K.category)||[];L.push(K),V.set(K.category,L)}for(let[K,L]of V){let O=["Shell commands","Code execution","Credentials"].includes(K)?U.red(`[${K}]`):U.yellow(`[${K}]`);console.info(`
|
|
504
|
+
${O} ${U.dim(`(${L.length} match${L.length>1?"es":""})`)}`);for(let F of L.slice(0,5))console.info(` ${U.dim(`${F.file}:${F.line}`)} -- ${F.match}`);if(L.length>5)console.info(U.dim(` ... and ${L.length-5} more`))}}}}async function lH(q,$){if($)return await p1(q,$);return await mq(q)}async function nH(q){if(q.flags.help){pH();return}let $=q.flags.machine?zq():void 0,Z=performance.now(),Q=q.subcommand;if(!Q)E("Missing required argument: <source>"),console.error('Run "asm install --help" for usage.'),process.exit(2);let X=null,z="github",J=8,G=0,Y=(B)=>{return G++,`
|
|
505
|
+
${U.cyan(`[Step ${G}/${J}]`)} ${U.bold(B)}`},H=()=>{if(X)q0(X).finally(()=>process.exit(1));else process.exit(1)};process.on("SIGINT",H),process.on("SIGTERM",H);try{if(J1(Q)){console.info(`
|
|
506
|
+
${U.cyan("●")} Resolving "${U.bold(Q)}" from registry...`);let{resolved:A,multipleMatches:M,suggestions:P}=await G5(Q,{noCache:q.flags.noCache});if(A){z="registry";let S=A.manifest,f=S.repository.replace("https://github.com/","");Q=S.skill_path?`github:${f}#${S.commit}:${S.skill_path}`:`github:${f}#${S.commit}`,console.info(` ${U.green("✓")} Resolved: ${U.bold(`${S.author}/${S.name}`)} @ ${S.commit.slice(0,7)}`)}else if(M.length>0){console.info(`
|
|
507
|
+
${U.yellow("⚠")} Multiple skills found for "${U.bold(Q)}":`);let S=M.slice(0,5);for(let e=0;e<S.length;e++){let U0=S[e];console.info(` ${U.cyan(`${e+1}.`)} ${U.bold(`${U0.author}/${U0.name}`)} — ${U0.description}`)}if(!process.stdin.isTTY)E(`Ambiguous skill name "${Q}". Use a scoped name: asm install author/name`),process.exit(2);let f=`
|
|
508
|
+
Select a skill [1-${S.length}]: `;process.stderr.write(f);let d=await new Promise((e)=>{let U0="",D0=!1,g$=setTimeout(()=>{if(!D0)D0=!0,process.stdin.removeListener("data",_0),e(U0.trim())},30000);function _0(l){if(U0=l.toString().trim(),!D0)D0=!0,clearTimeout(g$),process.stdin.removeListener("data",_0),e(U0)}process.stdin.setEncoding("utf-8"),process.stdin.on("data",_0)}),p=parseInt(d,10);if(isNaN(p)||p<1||p>S.length)E("Invalid selection. Aborting."),process.exit(2);let a=S[p-1];z="registry";let fq=a.repository.replace("https://github.com/","");Q=a.skill_path?`github:${fq}#${a.commit}:${a.skill_path}`:`github:${fq}#${a.commit}`,console.info(` ${U.green("✓")} Selected: ${U.bold(`${a.author}/${a.name}`)} @ ${a.commit.slice(0,7)}`)}else if(G1(Q)){if(E(`Skill "${Q}" not found in the registry.`),P.length>0)console.error(`
|
|
509
|
+
Did you mean: ${P.map((S)=>U.cyan(S)).join(", ")}?`);process.exit(1)}else console.info(` ${U.dim("Not found in registry — trying existing sources...")}`),z="pre-indexed"}console.info(Y("Parsing source"));let B=p0(Q),W=!!B.isLocal;if(W){let A=B.localPath;console.info(` ${U.dim(`local: ${A}`)}`);let{stat:M}=await import("fs/promises");try{if(!(await M(A)).isDirectory())throw Error(`Path is not a directory: ${A}`)}catch(P){if(P.code==="ENOENT")throw Error(`Path does not exist: ${A}`);throw P}}else await d0(),B=await l$(B),console.info(` ${U.dim(Q)}`);if(q.flags.method==="vercel"){console.info(Y("Installing via Vercel skills CLI")),await d1();let A=l1(B),M=q.flags.path||null;console.info(` ${U.dim(`npx skills add ${A}${M?` --skill ${M}`:""}`)}`);let{stdout:P,stderr:S}=await c1(A,M);if(P.trim())console.info(` ${U.dim(P.trim())}`);if(S.trim())console.error(` ${U.dim(S.trim())}`);console.info(` ${U.green("✓")} Vercel skills CLI install completed`),q.flags.force=!0,console.info(` ${U.dim("Continuing with asm install to register in local inventory...")}`)}console.info(Y("Selecting provider"));let V=await v(),{provider:K,allProviders:L}=await l0(V,q.flags.provider,!!process.stdin.isTTY);console.info(Y("Selecting scope"));let _;if(q.flags.scope==="global"||q.flags.scope==="project")_=q.flags.scope,console.info(` ${U.dim(`scope: ${_}`)}${_==="global"?` (${K.global})`:` (${K.project})`}`);else if(!process.stdin.isTTY||q.flags.yes)_="global",console.info(` ${U.dim("scope: global (default)")} (${K.global})`);else{let A=[{label:`Global (${K.global})`,hint:"Available in all projects",checked:!0},{label:`Project (${K.project})`,hint:"Available only in this project",checked:!1}];console.info("");let M=await m0({items:A});if(M.length===0)throw Error("No scope selected. Aborting.");_=M[0]===0?"global":"project",console.info(` Selected: ${U.bold(_)} ${U.dim(`(${_==="global"?K.global:K.project})`)}`)}if(W)console.info(Y("Reading local source")),console.info(` ${U.dim(B.localPath)}`),X=null;else{console.info(Y("Cloning repository"));let A=q.flags.transport,M=A==="ssh"?B.sshCloneUrl:A==="https"?B.cloneUrl:`${B.cloneUrl} ${U.dim("(auto)")}`;console.info(` ${M}${B.ref?` ${U.dim(`(ref: ${B.ref})`)}`:""}${B.subpath?` ${U.dim(`(path: ${B.subpath})`)}`:""}`),X=await c0(B,A)}let O=W?B.localPath:X;console.info(Y("Scanning for skills"));let{join:F}=await import("path"),T=[],R=q.flags.path||B.subpath,j=[];if(R){let A=F(O,R);try{await C0(A)}catch{throw Error(`No SKILL.md found at path "${R}" in the repository.`)}console.info(` Found skill at ${U.bold(R)}`),j=[{skillDir:A,nameOverride:q.flags.name}]}else{let A=!1;try{await C0(O),A=!0}catch{}if(A){let M=await C0(O);console.info(` Found: ${U.bold(M.name)} v${M.version}`),j=[{skillDir:O,nameOverride:q.flags.name}]}else{console.info(" No SKILL.md at root. Scanning subdirectories...");let M=await uq(O);if(M.length===0)throw Error("No skills found in this repository. Skills must have a SKILL.md file.");console.info(` Found ${U.bold(String(M.length))} skill(s):
|
|
510
|
+
`);for(let f=0;f<M.length;f++){let d=U.cyan(` ${String(f+1).padStart(String(M.length).length)})`);if(console.info(`${d} ${U.bold(M[f].name)} ${U.dim(`v${M[f].version}`)} ${U.dim(`(${M[f].relPath})`)}`),M[f].description)console.info(` ${U.dim(M[f].description)}`)}console.info(Y("Selecting skills")),G--;let P;if(q.flags.all&&(q.flags.yes||!process.stdin.isTTY))P=M.map((f)=>f.relPath),console.info(` Selected all ${U.bold(String(P.length))} skills`);else if(process.stdin.isTTY)if(M.length===1)P=[M[0].relPath],console.info(` Auto-selected: ${U.bold(M[0].name)} ${U.dim(`v${M[0].version}`)}`);else{let f=M.map((p)=>({label:p.name,hint:`v${p.version}${p.description?" "+p.description:""}`,checked:!!q.flags.all}));console.info("");let d=await m0({items:f});if(d.length===0)throw Error("No skills selected. Aborting.");P=d.map((p)=>M[p].relPath),console.info(` Selected ${U.bold(String(P.length))} skill(s)`)}else{E(`Repository contains ${M.length} skills. Use --path <subdir> to pick one or --all to install all.
|
|
417
511
|
Available skills:
|
|
418
|
-
${
|
|
419
|
-
`)}`),process.exit(2);return}let
|
|
420
|
-
`),
|
|
421
|
-
${
|
|
422
|
-
Choose one path per skill name or install with --path.`);throw
|
|
423
|
-
${
|
|
424
|
-
${
|
|
425
|
-
${
|
|
426
|
-
Done! Installed "${
|
|
427
|
-
${
|
|
512
|
+
${M.map((f)=>` --path ${f.relPath}`).join(`
|
|
513
|
+
`)}`),process.exit(2);return}let S=u1(P);if(S.length>0){let f=S.map((p)=>` - ${p.name}: ${p.paths.map((a)=>`"${a}"`).join(", ")}`).join(`
|
|
514
|
+
`),d=Error(`Duplicate skill names detected in selection:
|
|
515
|
+
${f}
|
|
516
|
+
Choose one path per skill name or install with --path.`);throw d.duplicates=S,d}j=P.map((f)=>({skillDir:F(O,f),nameOverride:P.length===1?q.flags.name:null})),G++}}console.info(Y("Inspecting skills"));let I=await i(V,"both"),w=[],x=j.length>1;for(let A=0;A<j.length;A++){let{skillDir:M,nameOverride:P}=j[A],S=await dH(q,B,O,M,P,V,K,I,_);w.push(S),cH(S,Q,K,L,x,x?{index:A+1,total:j.length}:void 0)}if(x){if(console.info(""),console.info(` ${U.bold("Install settings:")}`),console.info(` ${U.bold("Source:")} ${Q}`),L)console.info(` ${U.bold("Tool:")} All (${L.map((f)=>f.label).join(", ")})`);else console.info(` ${U.bold("Tool:")} ${K.label} (${K.name})`);console.info(` ${U.bold("Scope:")} ${_==="project"?"Project":"Global"}`);let A=w.filter((f)=>f.riskLevel==="high").length,M=w.filter((f)=>f.riskLevel==="medium").length,P=w.filter((f)=>f.riskLevel==="safe").length,S=[];if(P>0)S.push(U.green(`${P} Safe`));if(M>0)S.push(U.yellow(`${M} Medium Risk`));if(A>0)S.push(U.red(`${A} High Risk`));console.info(` ${U.bold("Risk:")} ${S.join(", ")}`)}if(console.info(Y("Installing")),!q.flags.yes){let A=w.some((f)=>f.riskLevel==="high");if(!process.stdin.isTTY)E("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);let M=x?`${w.length} skills`:`"${w[0].metadata.name}"`,P=A?`
|
|
517
|
+
${U.red("[!]")} ${U.bold(`Install ${M}? Some have high-risk patterns.`)} [y/N] `:`
|
|
518
|
+
${U.bold(`Install ${M}?`)} [Y/n] `;process.stderr.write(P);let S=await t();if(A){if(S.toLowerCase()!=="y"&&S.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}else if(S.toLowerCase()==="n"||S.toLowerCase()==="no")console.error("Aborted."),process.exit(0)}let D=X?await R8(X):null,y=[];for(let A=0;A<w.length;A++){let M=w[A],P=x?U.dim(`[${A+1}/${w.length}]`)+" ":" ";try{console.info(`${P}Installing ${U.bold(M.metadata.name)}...`);let S=await lH(M.plan,L);T.push(S),console.info(`${P}${U.green("✓")} ${M.metadata.name} installed to ${U.dim(M.plan.targetDir)}`);try{let f=W?`local:${B.localPath}`:`github:${B.owner}/${B.repo}`,d=W?"local":z==="registry"?"registry":"github";await Sq(S.name,{source:f,commitHash:D||"unknown",ref:B.ref||"main",installedAt:new Date().toISOString(),provider:M.plan.providerName,sourceType:d,...z==="registry"?{registryName:S.name}:{}})}catch{}}catch(S){y.push({name:M.metadata.name,error:S.message}),console.error(`${P}${U.red("✗")} ${U.bold(M.metadata.name)} — ${U.red(S.message)}`)}}if(process.removeListener("SIGINT",H),process.removeListener("SIGTERM",H),y.length>0){console.error(`
|
|
519
|
+
${U.yellow(`${y.length} skill(s) failed to install:`)}`);for(let A of y)console.error(` ${U.red("✗")} ${A.name}: ${A.error}`)}if(q.flags.machine){$?.();let A=T.map((M)=>({name:M.name,path:M.path,version:M.version,provider:M.provider,source:M.source,resolution_source:z}));console.log(o("install",A.length===1?A[0]:A,Z))}else if(q.flags.json){let A=T.map((M)=>({...M,resolutionSource:z}));console.log(JSON.stringify(A.length===1?A[0]:A,null,2))}else if(T.length===1)console.error(U.green(`
|
|
520
|
+
Done! Installed "${T[0].name}" to ${T[0].path}`));else if(T.length>0)console.error(`
|
|
521
|
+
${U.green(`Done! Installed ${T.length} skill(s) successfully.`)}`)}catch(B){if(process.removeListener("SIGINT",H),process.removeListener("SIGTERM",H),q.flags.machine)$?.(),console.log(Y0("install",G0.INSTALL_FAILED,B.message,Z,B?.duplicates?{duplicates:B.duplicates}:void 0));else if(q.flags.json){let W={success:!1,error:B.message};if(B?.duplicates)W.duplicates=B.duplicates;console.log(JSON.stringify(W,null,2))}else E(B.message);process.exit(1)}finally{if(X)await q0(X);$?.()}}function iH(){console.log(`${U.bold("Usage:")} asm export [options]
|
|
428
522
|
|
|
429
523
|
Export skill inventory as a portable JSON manifest. Useful for backup,
|
|
430
524
|
sharing, or scripting.
|
|
431
525
|
|
|
432
|
-
${
|
|
526
|
+
${U.bold("Options:")}
|
|
433
527
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
434
528
|
--no-color Disable ANSI colors
|
|
435
529
|
-V, --verbose Show debug output
|
|
436
530
|
|
|
437
|
-
${
|
|
438
|
-
asm export ${
|
|
439
|
-
asm export -s global ${
|
|
440
|
-
asm export > skills.json ${
|
|
531
|
+
${U.bold("Examples:")}
|
|
532
|
+
asm export ${U.dim("Export all skills")}
|
|
533
|
+
asm export -s global ${U.dim("Export global skills only")}
|
|
534
|
+
asm export > skills.json ${U.dim("Save to file")}`)}async function oH(q){if(q.flags.help){iH();return}let $=await v(),Z=await i($,q.flags.scope),Q=Y5(Z);console.log(JSON.stringify(Q,null,2))}function aH(){console.log(`${U.bold("Usage:")} asm import <file> [options]
|
|
441
535
|
|
|
442
536
|
Import skills from a previously exported JSON manifest. Recreates skill
|
|
443
537
|
installations based on the manifest metadata.
|
|
@@ -446,7 +540,7 @@ Skills that already exist at the target location are skipped unless --force
|
|
|
446
540
|
is used. Skills whose source files cannot be found locally are reported as
|
|
447
541
|
failed — install them first with "asm install".
|
|
448
542
|
|
|
449
|
-
${
|
|
543
|
+
${U.bold("Options:")}
|
|
450
544
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
451
545
|
-f, --force Overwrite existing skills
|
|
452
546
|
-y, --yes Skip confirmation prompt
|
|
@@ -454,44 +548,59 @@ ${Y.bold("Options:")}
|
|
|
454
548
|
--no-color Disable ANSI colors
|
|
455
549
|
-V, --verbose Show debug output
|
|
456
550
|
|
|
457
|
-
${
|
|
458
|
-
asm import skills.json ${
|
|
459
|
-
asm import skills.json --force ${
|
|
460
|
-
asm import skills.json -s global ${
|
|
461
|
-
asm export > backup.json ${
|
|
462
|
-
asm import backup.json ${
|
|
463
|
-
${
|
|
464
|
-
Nothing to import after scope filtering (--scope ${q.flags.scope}). All skills in the manifest were excluded.`);return}console.error("");for(let
|
|
551
|
+
${U.bold("Examples:")}
|
|
552
|
+
asm import skills.json ${U.dim("Import from manifest")}
|
|
553
|
+
asm import skills.json --force ${U.dim("Overwrite existing skills")}
|
|
554
|
+
asm import skills.json -s global ${U.dim("Import only global skills")}
|
|
555
|
+
asm export > backup.json ${U.dim("Export first, then import later")}
|
|
556
|
+
asm import backup.json ${U.dim("Restore from backup")}`)}async function sH(q){if(q.flags.help){aH();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"),Q=Z($),X;try{X=await V5(Q)}catch(Y){E(Y.message),process.exit(1)}let z=X.skills.length;if(z===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 J=q.flags.scope==="both"?"all scopes":q.flags.scope;if(console.error(`${U.bold("Importing")} ${z} skill${z>1?"s":""} from ${U.dim(Q)}`),console.error(` Scope filter: ${J}`),q.flags.force)console.error(` ${U.yellow("Force mode: existing skills will be overwritten")}`);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
557
|
+
${U.bold("Proceed?")} [y/N] `);let Y=await t();if(Y.toLowerCase()!=="y"&&Y.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let G=await B5(X,{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(`
|
|
558
|
+
Nothing to import after scope filtering (--scope ${q.flags.scope}). All skills in the manifest were excluded.`);return}console.error("");for(let Y of G.results){let H=Y.status==="installed"?U.green("+++"):Y.status==="skipped"?U.yellow("---"):Y.status==="dry-run"?U.cyan("~~~"):U.red("!!!"),B=Y.reason?` ${U.dim(Y.reason)}`:"",W=Y.path?` ${U.dim(Y.path)}`:"";console.error(` ${H} ${Y.skillName} (${Y.provider}/${Y.scope})${B}${W}`)}if(console.error(""),console.error(`${U.bold("Summary:")} ${G.total} total, ${U.green(String(G.installed))} installed, ${U.yellow(String(G.skipped))} skipped, ${U.red(String(G.failed))} failed`),G.failed>0)process.exitCode=1}function rH(){console.log(`${U.bold("Usage:")} asm init <name> [options]
|
|
465
559
|
|
|
466
560
|
Scaffold a new skill directory with a SKILL.md template. Creates a
|
|
467
561
|
ready-to-edit skill in the target tool's skill folder.
|
|
468
562
|
|
|
469
|
-
${
|
|
563
|
+
${U.bold("Options:")}
|
|
470
564
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
471
565
|
--path <dir> Scaffold in specified directory instead of provider path
|
|
472
566
|
-f, --force Overwrite if skill already exists
|
|
473
567
|
--no-color Disable ANSI colors
|
|
474
568
|
-V, --verbose Show debug output
|
|
475
569
|
|
|
476
|
-
${
|
|
477
|
-
asm init my-skill ${
|
|
478
|
-
asm init my-skill -p claude ${
|
|
479
|
-
asm init my-skill --path ./skills ${
|
|
480
|
-
${
|
|
570
|
+
${U.bold("Examples:")}
|
|
571
|
+
asm init my-skill ${U.dim("Scaffold (interactive tool)")}
|
|
572
|
+
asm init my-skill -p claude ${U.dim("Scaffold in Claude Code")}
|
|
573
|
+
asm init my-skill --path ./skills ${U.dim("Scaffold in custom directory")}`)}async function tH(q){if(q.flags.help){rH();return}let $=q.subcommand;if(!$)E("Missing required argument: <name>"),console.error('Run "asm init --help" for usage.'),process.exit(2);let Z=P0($),Q;if(q.flags.path){let{resolve:X}=await import("path");Q=X(q.flags.path)}else{let X=await v(),{provider:z}=await l0(X,q.flags.provider,!!process.stdin.isTTY),{join:J}=await import("path"),{resolveProviderPath:G}=await import("./chunk-2qybtcgb.js"),Y=G(X.providers.find((H)=>H.name===z.name).global);Q=J(Y,Z)}if(await _5(Q)){if(!q.flags.force){if(!process.stdin.isTTY)E(`Directory already exists: ${Q}. Use --force to overwrite.`),process.exit(2);process.stderr.write(`${U.yellow(`Directory already exists: ${Q}`)}
|
|
574
|
+
${U.bold("Overwrite?")} [y/N] `);let X=await t();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}}await K5(Z,Q),console.error(U.green(`Done! Created skill "${Z}" at ${Q}`))}function eH(){console.log(`${U.bold("Usage:")} asm stats [options]
|
|
481
575
|
|
|
482
576
|
Show aggregate skill metrics with provider distribution charts,
|
|
483
577
|
scope breakdown, disk usage, and duplicate summary.
|
|
484
578
|
|
|
485
|
-
${
|
|
579
|
+
${U.bold("Options:")}
|
|
486
580
|
--json Output as JSON
|
|
487
581
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
488
582
|
--no-color Disable ANSI colors
|
|
489
583
|
-V, --verbose Show debug output
|
|
490
584
|
|
|
491
|
-
${
|
|
492
|
-
asm stats ${
|
|
493
|
-
asm stats -s global ${
|
|
494
|
-
asm stats --json ${
|
|
585
|
+
${U.bold("Examples:")}
|
|
586
|
+
asm stats ${U.dim("Show full dashboard")}
|
|
587
|
+
asm stats -s global ${U.dim("Global skills only")}
|
|
588
|
+
asm stats --json ${U.dim("Output raw data as JSON")}`)}async function qW(q){if(q.flags.help){eH();return}let $=await v(),Z=await i($,q.flags.scope);if(Z.length===0){console.log("No skills found.");return}let Q=P1(Z),X=await F5(Z,Q);if(q.flags.json)if(!q.flags.verbose){let{perSkillDiskBytes:z,...J}=X;console.log(c(J))}else console.log(c(X));else console.log(A5(X))}function $W(){console.log(`${U.bold("Usage:")} asm doctor [options]
|
|
589
|
+
|
|
590
|
+
Run environment health checks and diagnostics. Validates all
|
|
591
|
+
prerequisites for using asm — git, GitHub CLI, Node.js, config,
|
|
592
|
+
lock file, registry, installed skills, and disk space.
|
|
593
|
+
|
|
594
|
+
${U.bold("Options:")}
|
|
595
|
+
--json Output as JSON
|
|
596
|
+
--machine Output in stable machine-readable v1 envelope format
|
|
597
|
+
--no-color Disable ANSI colors
|
|
598
|
+
-V, --verbose Show debug output
|
|
599
|
+
|
|
600
|
+
${U.bold("Examples:")}
|
|
601
|
+
asm doctor ${U.dim("Run all health checks")}
|
|
602
|
+
asm doctor --json ${U.dim("Output as JSON")}
|
|
603
|
+
asm doctor --machine ${U.dim("Machine-readable v1 envelope output")}`)}async function ZW(q){if(q.flags.help){$W();return}let $=performance.now(),Z=await i5();if(q.flags.machine){let Q={checks:Z.checks.map((X)=>({name:X.name,status:X.status,message:X.message,...X.fix?{fix:X.fix}:{}})),passed:Z.passed,warnings:Z.warnings,failures:Z.failures};console.log(o("doctor",Q,$))}else if(q.flags.json)console.log(a5(Z));else console.log(o5(Z));if(Z.failures>0)process.exit(1)}function QW(){console.log(`${U.bold("Usage:")} asm link <path> [<path2> ...] [options]
|
|
495
604
|
|
|
496
605
|
Symlink a local skill directory into an agent's skill folder. Useful
|
|
497
606
|
for local development — changes to the source are reflected immediately.
|
|
@@ -500,33 +609,38 @@ If <path> contains a SKILL.md at its root, it is linked as a single skill.
|
|
|
500
609
|
If <path> has no root SKILL.md but contains subdirectories with SKILL.md
|
|
501
610
|
files, all discovered skills are linked in a single invocation.
|
|
502
611
|
|
|
503
|
-
|
|
612
|
+
Multiple paths can be provided to link several skills at once.
|
|
613
|
+
|
|
614
|
+
${U.bold("Options:")}
|
|
504
615
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
505
|
-
--name <name> Override symlink name (
|
|
616
|
+
--name <name> Override symlink name (single skill only)
|
|
506
617
|
-f, --force Overwrite if target already exists
|
|
507
618
|
--json Output as JSON
|
|
508
619
|
--no-color Disable ANSI colors
|
|
509
620
|
-V, --verbose Show debug output
|
|
510
621
|
|
|
511
|
-
${
|
|
512
|
-
asm link ./my-skill
|
|
513
|
-
asm link ./my-skill -p claude
|
|
514
|
-
asm link ./my-skill --name alias
|
|
515
|
-
asm link ./my-skills-folder
|
|
516
|
-
|
|
517
|
-
${
|
|
518
|
-
${
|
|
519
|
-
Done! Linked ${
|
|
622
|
+
${U.bold("Examples:")}
|
|
623
|
+
asm link ./my-skill ${U.dim("Link (interactive tool)")}
|
|
624
|
+
asm link ./my-skill -p claude ${U.dim("Link to Claude Code")}
|
|
625
|
+
asm link ./my-skill --name alias ${U.dim("Link with custom name")}
|
|
626
|
+
asm link ./my-skills-folder ${U.dim("Link all skills in folder")}
|
|
627
|
+
asm link ./skill1 ./skill2 ./skill3 -p claude ${U.dim("Link multiple skills at once")}`)}async function XW(q,$){if($)return!0;let{access:Z}=await import("fs/promises"),Q=!1;try{await Z(q),Q=!0}catch{}if(!Q)return!1;if(!process.stdin.isTTY)throw Error(`Target already exists: ${q}. Use --force to overwrite.`);process.stderr.write(`${U.yellow(`Target already exists: ${q}`)}
|
|
628
|
+
${U.bold("Overwrite?")} [y/N] `);let X=await t();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0);return!0}async function h$(q,$,Z,Q){let{join:X}=await import("path"),z=X($,Z),J=await XW(z,Q);return await M5(q,$,Z,J),{name:Z,symlinkPath:z,targetPath:q}}async function zW(q){if(q.flags.help){QW();return}let $=[];if(q.subcommand)$.push(q.subcommand);if($.push(...q.positional),$.length===0)E("Missing required argument: <path>"),console.error('Run "asm link --help" for usage.'),process.exit(2);if($.length>1){if(q.flags.name)E("--name cannot be used when linking multiple paths. Link each skill individually to use --name."),process.exit(2);let L=await v(),{provider:_}=await l0(L,q.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:O}=await import("./chunk-2qybtcgb.js"),F=O(L.providers.find((w)=>w.name===_.name).global),{resolve:T,basename:R}=await import("path"),j=[],I=[];for(let w of $){let x=T(w),D=!1;try{await W1(x),D=!0}catch{}if(D){let y=R(x);try{let A=await h$(x,F,y,!!q.flags.force);if(j.push(A),!q.flags.json)console.error(U.green(` Linked "${A.name}" -> ${A.targetPath}`))}catch(A){let M=A instanceof Error?A.message:String(A);if(I.push({name:y,error:M}),!q.flags.json)console.error(U.red(` Failed to link "${y}": ${M}`))}}else{let y=[];try{y=await V1(x)}catch(A){let M=A instanceof Error?A.message:String(A);if(I.push({name:w,error:M}),!q.flags.json)console.error(U.red(` Failed to process "${w}": ${M}`));continue}if(y.length===0){let A=`No SKILL.md found in ${x} or its immediate subdirectories.`;if(I.push({name:w,error:A}),!q.flags.json)console.error(U.red(` ${A}`));continue}for(let A of y)try{let M=await h$(A.absPath,F,A.dirName,!!q.flags.force);if(j.push(M),!q.flags.json)console.error(U.green(` Linked "${M.name}" -> ${M.targetPath}`))}catch(M){let P=M instanceof Error?M.message:String(M);if(I.push({name:A.name,error:P}),!q.flags.json)console.error(U.red(` Failed to link "${A.name}": ${P}`))}}}if(q.flags.json)console.log(c({success:I.length===0,linked:j,failures:I}));else if(I.length>0)console.error(U.yellow(`
|
|
629
|
+
${j.length} linked, ${I.length} failed.`));else console.error(U.green(`
|
|
630
|
+
Done! Linked ${j.length} skill(s) successfully.`));if(I.length>0)process.exit(1);return}let Z=$[0],{resolve:Q,basename:X}=await import("path"),z=Q(Z),J=!1;try{await W1(z),J=!0}catch{}let G=[];if(!J){if(G=await V1(z),G.length===0)E(`No SKILL.md found in ${z} or its immediate subdirectories.`),process.exit(1);if(q.flags.name&&G.length>1)E(`--name cannot be used when linking multiple skills (found ${G.length} skills). Link each skill individually to use --name.`),process.exit(2)}let Y=await v(),{provider:H}=await l0(Y,q.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:B}=await import("./chunk-2qybtcgb.js"),W=B(Y.providers.find((L)=>L.name===H.name).global);if(J){let L=q.flags.name?P0(q.flags.name):X(z),_;try{_=await h$(z,W,L,!!q.flags.force)}catch(O){let F=O instanceof Error?O.message:String(O);if(q.flags.json)console.log(c({success:!1,error:F}));else E(F);process.exit(2)}if(q.flags.json)console.log(c({success:!0,..._}));else console.error(U.green(`Done! Linked "${_.name}" -> ${_.targetPath}`)),console.error(` Symlink: ${_.symlinkPath}`),console.error(U.dim(` If you move or delete the source, run "asm uninstall ${_.name}" to clean up.`));return}console.error(`Found ${U.bold(String(G.length))} skill(s) in ${z}:`);for(let L of G)console.error(` ${U.bold(L.name)} ${U.dim(`v${L.version}`)} ${U.dim(`(${L.dirName}/)`)}`);if(process.stdin.isTTY&&!q.flags.force){process.stderr.write(`
|
|
631
|
+
${U.bold(`Link ${G.length} skill(s)?`)} [Y/n] `);let L=await t();if(L.toLowerCase()==="n"||L.toLowerCase()==="no")console.error("Aborted."),process.exit(0)}let V=[],K=[];for(let L of G){let _=q.flags.name&&G.length===1?P0(q.flags.name):L.dirName;try{let O=await h$(L.absPath,W,_,!!q.flags.force);if(V.push(O),!q.flags.json)console.error(U.green(` Linked "${O.name}" -> ${O.targetPath}`))}catch(O){let F=O instanceof Error?O.message:String(O);if(K.push({name:L.name,error:F}),!q.flags.json)console.error(U.red(` Failed to link "${L.name}": ${F}`))}}if(q.flags.json)console.log(c({success:K.length===0,linked:V,failures:K}));else if(K.length>0)console.error(U.yellow(`
|
|
632
|
+
${V.length} linked, ${K.length} failed.`));else console.error(U.green(`
|
|
633
|
+
Done! Linked ${V.length} skill(s) successfully.`));if(K.length>0)process.exit(1)}function JW(){console.log(`${U.bold("Usage:")} asm index <subcommand> [options]
|
|
520
634
|
|
|
521
635
|
Manage the skill index for searching available skills from indexed repos.
|
|
522
636
|
|
|
523
|
-
${
|
|
637
|
+
${U.bold("Subcommands:")}
|
|
524
638
|
ingest <repo> Ingest a skill repository into the index
|
|
525
639
|
search <query> Search indexed skills by name or description
|
|
526
640
|
list List all indexed repositories
|
|
527
641
|
remove <owner/repo> Remove a repo from the index
|
|
528
642
|
|
|
529
|
-
${
|
|
643
|
+
${U.bold("Options:")}
|
|
530
644
|
--json Output as JSON
|
|
531
645
|
--has <field> Only show skills that have <field> (license, creator, version)
|
|
532
646
|
--missing <field> Only show skills missing <field> (license, creator, version)
|
|
@@ -534,48 +648,49 @@ ${Y.bold("Options:")}
|
|
|
534
648
|
--no-color Disable ANSI colors
|
|
535
649
|
-V, --verbose Show debug output
|
|
536
650
|
|
|
537
|
-
${
|
|
538
|
-
asm index ingest github:obra/superpowers ${
|
|
539
|
-
asm index search code review ${
|
|
540
|
-
asm index search marketing --has license ${
|
|
541
|
-
asm index search "" --missing creator ${
|
|
542
|
-
asm index list ${
|
|
543
|
-
asm index remove obra/superpowers ${
|
|
544
|
-
`));for(let
|
|
545
|
-
`)}}break}case"list":{let Z=await
|
|
546
|
-
`));for(let
|
|
651
|
+
${U.bold("Examples:")}
|
|
652
|
+
asm index ingest github:obra/superpowers ${U.dim("Index superpowers repo")}
|
|
653
|
+
asm index search code review ${U.dim("Search for skills")}
|
|
654
|
+
asm index search marketing --has license ${U.dim("Only with license")}
|
|
655
|
+
asm index search "" --missing creator ${U.dim("Skills missing creator")}
|
|
656
|
+
asm index list ${U.dim("List indexed repos")}
|
|
657
|
+
asm index remove obra/superpowers ${U.dim("Remove from index")}`)}async function GW(q){if(q.flags.help){JW();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(U.blueBold(`Ingesting ${Z}...`));let Q=await z8(Z);if(!Q.success)E(`Failed to ingest: ${Q.error}`),process.exit(1);if(Q.repoIndex)if(q.flags.json)console.log(c({success:!0,owner:Q.repoIndex.owner,repo:Q.repoIndex.repo,skillCount:Q.repoIndex.skillCount,updatedAt:Q.repoIndex.updatedAt}));else console.error(U.green(`Successfully indexed ${Q.repoIndex.owner}/${Q.repoIndex.repo}`)),console.error(` Skills found: ${Q.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 Q={};if(q.flags.has.length>0)Q.has=q.flags.has;if(q.flags.missing.length>0)Q.missing=q.flags.missing;let z=Q.has||Q.missing?await v$(Z||"",20,Q):await v$(Z);if(z.length===0){if(q.flags.json)console.log(c([]));else console.info("No skills found matching your query."),console.error(U.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(q.flags.json)console.log(c(z.map((J)=>({name:J.skill.name,description:J.skill.description,version:J.skill.version,license:J.skill.license||"",creator:J.skill.creator||"",compatibility:J.skill.compatibility||"",allowedTools:J.skill.allowedTools||[],verified:J.skill.verified===!0,installUrl:J.skill.installUrl,installCommand:`asm install ${J.skill.installUrl}`,repo:`${J.repo.owner}/${J.repo.repo}`}))));else{console.error(U.bold(`Found ${z.length} skills:
|
|
658
|
+
`));for(let J of z){let G=J.skill.verified?U.blue(" [verified]"):"";console.error(`${U.cyan(J.skill.name)} ${U.dim(`v${J.skill.version}`)}${G} ${U.dim(`[${J.repo.owner}/${J.repo.repo}]`)}`);for(let H of M8(J.skill.description,80))console.error(` ${H}`);let Y=Z8(J.skill);if(Y.length>0)console.error(` ${U.yellow(`⚠ Missing: ${Y.join(", ")}`)}`);console.error(` ${U.green(`asm install ${J.skill.installUrl}`)}
|
|
659
|
+
`)}}break}case"list":{let Z=await J8();if(Z.length===0){if(q.flags.json)console.log(c([]));else console.info("No repositories indexed."),console.error(U.dim("Add repos with: asm index ingest <repo>"));return}let Q=await Q8();if(q.flags.json)console.log(c(Z));else{console.error(U.bold(`Indexed Repositories (${Q} total skills):
|
|
660
|
+
`));for(let X of Z)console.error(`${U.cyan(`${X.owner}/${X.repo}`)} - ${X.skillCount} skills ${U.dim(`(${new Date(X.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[Q,X]=Z.split("/");if(!Q||!X)E("Invalid format. Use: <owner/repo>"),process.exit(2);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`${U.bold("Remove")} ${U.cyan(`${Q}/${X}`)} ${U.bold("from index?")} [y/N] `);let J=await t();if(J.toLowerCase()!=="y"&&J.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}if(await G8(Q,X))console.error(U.green(`Removed ${Q}/${X} from index`));else E(`Repository not found in index: ${Q}/${X}`),process.exit(1);break}default:E(`Unknown subcommand: "${$}"`),console.error('Run "asm index --help" for usage.'),process.exit(2)}}function YW(){console.log(`${U.bold("Usage:")} asm bundle <subcommand> [options]
|
|
547
661
|
|
|
548
662
|
Create, install, and manage curated skill bundles. A bundle is a reusable
|
|
549
663
|
recipe of skills for a particular workflow, domain, or project setup.
|
|
550
664
|
|
|
551
|
-
${
|
|
665
|
+
${U.bold("Subcommands:")}
|
|
552
666
|
create <name> Create a new bundle from installed skills
|
|
553
667
|
install <name|file> Install all skills from a bundle
|
|
554
668
|
list List all saved bundles
|
|
555
669
|
show <name|file> Show bundle details
|
|
556
670
|
remove <name> Remove a saved bundle
|
|
557
671
|
|
|
558
|
-
${
|
|
672
|
+
${U.bold("Options:")}
|
|
559
673
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
560
674
|
-y, --yes Skip confirmation prompts
|
|
561
675
|
--json Output as JSON
|
|
562
676
|
--no-color Disable ANSI colors
|
|
563
677
|
-V, --verbose Show debug output
|
|
564
678
|
|
|
565
|
-
${
|
|
566
|
-
asm bundle create my-workflow ${
|
|
567
|
-
asm bundle install my-workflow ${
|
|
568
|
-
asm bundle install ./bundle.json ${
|
|
569
|
-
asm bundle list ${
|
|
570
|
-
asm bundle list --json ${
|
|
571
|
-
asm bundle show my-workflow ${
|
|
572
|
-
asm bundle remove my-workflow ${
|
|
573
|
-
`));let
|
|
574
|
-
${
|
|
575
|
-
${
|
|
576
|
-
Installing ${
|
|
577
|
-
`));for(let
|
|
578
|
-
${
|
|
679
|
+
${U.bold("Examples:")}
|
|
680
|
+
asm bundle create my-workflow ${U.dim("Create from installed skills")}
|
|
681
|
+
asm bundle install my-workflow ${U.dim("Install a saved bundle")}
|
|
682
|
+
asm bundle install ./bundle.json ${U.dim("Install from file")}
|
|
683
|
+
asm bundle list ${U.dim("Show all saved bundles")}
|
|
684
|
+
asm bundle list --json ${U.dim("List bundles as JSON")}
|
|
685
|
+
asm bundle show my-workflow ${U.dim("Show bundle details")}
|
|
686
|
+
asm bundle remove my-workflow ${U.dim("Remove a saved bundle")}`)}async function UW(q){if(q.flags.help){YW();return}let $=q.subcommand;if(!$)E("Missing subcommand. Use: create, install, list, show, or remove"),console.error('Run "asm bundle --help" for usage.'),process.exit(2);switch($){case"create":{let Z=q.positional[0];if(!Z)E("Missing required argument: <name>"),console.error("Usage: asm bundle create <name>"),process.exit(2);let Q=await v(),X=await i(Q,q.flags.scope);if(X.length===0)E("No skills found to include in the bundle."),process.exit(1);let z=new Set,J=X.filter((_)=>{let O=_.name.toLowerCase();if(z.has(O))return!1;return z.add(O),!0}),G=J;if(process.stdin.isTTY&&!q.flags.yes){let _=J.map((F)=>({label:`${F.name} v${F.version}`,hint:F.description?F.description.slice(0,60)+(F.description.length>60?"...":""):`(${F.provider}/${F.scope})`,checked:!0}));console.error(U.bold(`Select skills for bundle "${Z}":
|
|
687
|
+
`));let O=await m0({items:_});if(O.length===0)E("No skills selected. Bundle not created."),process.exit(1);G=O.map((F)=>J[F])}let{readLock:Y}=await import("./chunk-b38qq69j.js"),H=await Y(),B=await Promise.all(G.map((_)=>R5(_,H))),W=`Bundle of ${B.length} skills`,V="unknown";try{let{execSync:_}=await import("child_process"),O=_("git config user.name",{encoding:"utf-8"}).trim();if(O)V=O}catch{}if(process.stdin.isTTY&&!q.flags.yes){process.stderr.write(`
|
|
688
|
+
${U.bold("Description")} (optional, press Enter to skip): `);let _=await t();if(_.trim())W=_.trim();process.stderr.write(`${U.bold("Author")} (optional, press Enter to skip): `);let O=await t();if(O.trim())V=O.trim()}let K=T5(Z,W,V,B),L=await j5(K);if(q.flags.json)console.log(JSON.stringify(K,null,2));else console.error(U.green(`Bundle "${Z}" created with ${B.length} skill(s).`)),console.error(` Saved to: ${U.dim(L)}`);break}case"install":{let Z=q.positional[0];if(!Z)E("Missing required argument: <name|file>"),console.error("Usage: asm bundle install <name|file>"),process.exit(2);let Q;try{Q=await _1(Z)}catch(W){E(W.message),process.exit(1)}if(console.error(`${U.bold("Bundle:")} ${Q.name} (${Q.skills.length} skills)`),Q.description)console.error(` ${U.dim(Q.description)}`);console.error("");for(let W of Q.skills){let V=W.version?` v${W.version}`:"";console.error(` ${U.cyan(W.name)}${U.dim(V)} ${U.dim(`-> ${W.installUrl}`)}`)}if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
689
|
+
${U.bold("Install all skills from this bundle?")} [y/N] `);let W=await t();if(W.toLowerCase()!=="y"&&W.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let X=[],z=await v(),{provider:J}=await l0(z,q.flags.provider,!1),G=q.flags.scope==="global"||q.flags.scope==="project"?q.flags.scope:"global";for(let W of Q.skills){console.error(`
|
|
690
|
+
Installing ${U.bold(W.name)}...`);try{if(W.installUrl.startsWith("github:")||W.installUrl.startsWith("https://github.com/"))await d0();let K=p0(W.installUrl),L=!!K.isLocal,_=null;try{let O,F;if(!L)_=await c0(K,q.flags.transport),O=_,F=K.subpath?AH(_,K.subpath):_;else O=K.localPath,F=K.localPath;let T=await C0(F),R=P0(W.name||T.name||K.repo),j=n$(K,O,F,R,J,q.flags.force,G);try{await n1(j.targetDir,j.force)}catch(I){if(I.message?.includes("--force")){X.push({name:W.name,status:"skipped",reason:"Already installed. Use --force to overwrite."}),console.error(` ${U.dim("---")} ${W.name} skipped (already installed)`);continue}throw I}await mq(j),X.push({name:W.name,status:"installed"}),console.error(` ${U.green("+++")} ${W.name} installed`)}finally{if(_)await q0(_)}}catch(V){X.push({name:W.name,status:"failed",reason:V.message}),console.error(` ${U.red("!!!")} ${W.name}: ${V.message}`)}}let Y=X.filter((W)=>W.status==="installed").length,H=X.filter((W)=>W.status==="skipped").length,B=X.filter((W)=>W.status==="failed").length;if(q.flags.json)console.log(JSON.stringify({bundleName:Q.name,total:X.length,installed:Y,skipped:H,failed:B,results:X},null,2));else console.error(""),console.error(`${U.bold("Summary:")} ${X.length} total, ${U.green(String(Y))} installed, `+(H>0?`${U.dim(String(H))} skipped, `:"")+`${U.red(String(B))} failed`);if(B>0)process.exitCode=1;break}case"list":{let Z=await w5();if(Z.length===0){if(q.flags.json)console.log("[]");else console.log("No bundles found."),console.error(U.dim("Create one with: asm bundle create <name>"));return}if(q.flags.json)console.log(JSON.stringify(Z,null,2));else{console.error(U.bold(`Saved Bundles (${Z.length}):
|
|
691
|
+
`));for(let Q of Z){let X=Q.tags&&Q.tags.length>0?` ${U.dim(`[${Q.tags.join(", ")}]`)}`:"";if(console.error(` ${U.cyan(Q.name)} ${U.dim(`(${Q.skills.length} skills)`)}${X}`),Q.description)console.error(` ${U.dim(Q.description)}`);if(Q.author)console.error(` ${U.dim(`by ${Q.author}`)}`)}}break}case"show":{let Z=q.positional[0];if(!Z)E("Missing required argument: <name|file>"),console.error("Usage: asm bundle show <name|file>"),process.exit(2);let Q;try{Q=await _1(Z)}catch(X){E(X.message),process.exit(1)}if(q.flags.json)console.log(JSON.stringify(Q,null,2));else{if(console.error(U.bold(`Bundle: ${Q.name}`)),Q.description)console.error(` ${Q.description}`);if(Q.author)console.error(` ${U.dim(`Author: ${Q.author}`)}`);if(console.error(` ${U.dim(`Created: ${new Date(Q.createdAt).toLocaleString()}`)}`),Q.tags&&Q.tags.length>0)console.error(` ${U.dim(`Tags: ${Q.tags.join(", ")}`)}`);console.error(`
|
|
692
|
+
${U.bold(`Skills (${Q.skills.length})`)}:`);for(let X of Q.skills){let z=X.version?` v${X.version}`:"";if(console.error(` ${U.cyan(X.name)}${U.dim(z)}`),X.description)console.error(` ${U.dim(X.description)}`);console.error(` ${U.dim(`install: ${X.installUrl}`)}`)}}break}case"remove":{let Z=q.positional[0];if(!Z)E("Missing required argument: <name>"),console.error("Usage: asm bundle remove <name>"),process.exit(2);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`${U.bold("Remove bundle")} ${U.cyan(Z)}${U.bold("?")} [y/N] `);let X=await t();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Q;try{Q=await D5(Z)}catch(X){E(X.message),process.exit(1)}if(Q)console.error(U.green(`Bundle "${Z}" removed.`));else E(`Bundle "${Z}" not found.`),process.exit(1);break}default:E(`Unknown subcommand: "${$}". Use: create, install, list, show, or remove`),console.error('Run "asm bundle --help" for usage.'),process.exit(2)}}async function HW(q){if(q.flags.help){PH();return}let $=q.flags.machine?zq():void 0,Z=performance.now(),Q=q.subcommand||".";try{let X=await b5({path:Q,dryRun:q.flags.dryRun,force:q.flags.force,yes:q.flags.yes});if(q.flags.machine){if($?.(),!X.success)console.log(Y0("publish",G0.PUBLISH_FAILED,X.error||"Publish failed",Z,{manifest:X.manifest,security_verdict:X.securityVerdict,fallback:X.fallback??!1})),process.exit(1);console.log(o("publish",{manifest:X.manifest,pr_url:X.prUrl,status:X.securityVerdict},Z));return}if(q.flags.json){if(console.log(JSON.stringify({success:X.success,manifest:X.manifest,pr_url:X.prUrl,error:X.error,security_verdict:X.securityVerdict},null,2)),!X.success)process.exit(1);return}if(!X.success)E(X.error||"Publish failed."),process.exit(1);if(X.fallback){console.log(U.yellow("Manifest generated (gh CLI unavailable):")),console.log(x5(X));return}if(q.flags.dryRun){console.error(U.dim(`Dry run — no PR created.
|
|
693
|
+
`)),console.log(JSON.stringify(X.manifest,null,2));return}if(X.prUrl)console.error(U.green("Published successfully!")),console.error(""),console.error(` PR: ${X.prUrl}`),console.error(` Manifest: manifests/${X.manifest?.author}/${X.manifest?.name}.json`),console.error(` Security: ${X.securityVerdict}`),console.error(""),console.error(U.dim("The registry maintainers will review your submission."))}catch(X){let z={success:!1,manifest:null,prUrl:null,error:X.message,securityVerdict:"pass",securityReport:{scannedAt:new Date().toISOString(),skillName:"",skillPath:"",source:null,codeScans:[],permissions:[],totalFiles:0,totalLines:0,verdict:"safe",verdictReason:""}};if(q.flags.machine)$?.(),console.log(Y0("publish",G0.PUBLISH_FAILED,X.message,Z)),process.exit(1);if(q.flags.json)console.log(JSON.stringify({success:!1,manifest:null,pr_url:null,error:X.message,security_verdict:null},null,2)),process.exit(1);E(X.message),process.exit(1)}}async function WW(q){if(q.flags.help){CH();return}let $=q.flags.machine?zq():void 0,Z=performance.now();try{let Q=await M1();if(q.flags.machine){$?.();let z=Q.entries.map((J)=>({name:J.name,installed_commit:J.installedCommit,latest_commit:J.latestCommit,source:J.sourceType,status:J.status}));console.log(o("outdated",z,Z));return}if(q.flags.json){console.log(u5(Q));return}let X=!q.flags.noColor&&process.stdout.isTTY!==!1;if(console.log(g5(Q,X)),Q.outdatedCount>0)process.exitCode=1}catch(Q){if(q.flags.machine)$?.(),console.log(Y0("outdated",G0.UNKNOWN_ERROR,Q.message,Z)),process.exit(1);E(Q.message),process.exit(1)}}async function VW(q){if(q.flags.help){EH();return}let $=q.flags.machine?zq():void 0,Z=performance.now(),Q=[];if(q.subcommand)Q.push(q.subcommand);Q.push(...q.positional);try{let X=await h5(Q.length>0?Q:null,q.flags.yes);if(q.flags.machine){$?.();let J=X.results.map((G)=>({name:G.name,status:G.status,reason:G.reason||null,old_commit:G.oldCommit||null,new_commit:G.newCommit||null,security_verdict:G.securityVerdict||null}));console.log(o("update",J,Z));return}if(q.flags.json){console.log(m5(X));return}if(X.results.length>0)console.error(U.yellow("Note: project-scoped skill detection is not yet supported. All updates target the global skill path."));if(X.warnings&&X.warnings.length>0)for(let J of X.warnings)console.error(U.yellow(`Warning: skill "${J}" not found in lock file — skipped`));if(X.results.length===0){console.log("All skills are up to date.");return}for(let J of X.results)switch(J.status){case"updated":if(console.log(`${U.green("✓")} ${J.name} ${U.dim(J.oldCommit||"")} → ${J.newCommit||""}`),J.securityVerdict==="warning")console.error(U.yellow(` ⚠ Security audit returned warning for ${J.name} — updated because --yes was supplied`));break;case"skipped":console.log(`${U.yellow("○")} ${J.name} ${U.dim(J.reason||"skipped")}`);break;case"failed":console.log(`${U.red("✗")} ${J.name} ${U.dim(J.reason||"failed")}`);break}console.log("");let z=[];if(X.updatedCount>0)z.push(U.green(`${X.updatedCount} updated`));if(X.skippedCount>0)z.push(U.yellow(`${X.skippedCount} skipped`));if(X.failedCount>0)z.push(U.red(`${X.failedCount} failed`));if(console.log(z.join(", ")),X.failedCount>0)process.exitCode=1}catch(X){if(q.flags.machine)$?.(),console.log(Y0("update",G0.UNKNOWN_ERROR,X.message,Z)),process.exit(1);E(X.message),process.exit(1)}}async function C8(q){let $=MH(q);if($.flags.json&&$.flags.machine)E("--json and --machine are mutually exclusive. Use one or the other."),process.exit(2);if($.flags.machine)$.flags.yes=!0;if($.flags.noColor)globalThis.__CLI_NO_COLOR=!0;if($.flags.verbose)Y8(!0);if($.flags.version){console.log(`asm ${C1}`);return}if(!$.command&&$.flags.help){TH();return}if(!$.command)return;switch($.command){case"list":await bH($);break;case"search":await xH($);break;case"inspect":await fH($);break;case"uninstall":await yH($);break;case"audit":await kH($);break;case"install":await nH($);break;case"config":await mH($);break;case"export":await oH($);break;case"import":await sH($);break;case"init":await tH($);break;case"stats":await qW($);break;case"link":await zW($);break;case"index":await GW($);break;case"bundle":await UW($);break;case"publish":await HW($);break;case"outdated":await WW($);break;case"update":await VW($);break;case"doctor":await ZW($);break;default:E(`Unknown command: "${$.command}"`),console.error('Run "asm --help" for usage.'),process.exit(2)}}function E8(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","bundle","publish","outdated","update"],Q=$[0];if(Z.includes(Q))return!0;if(Q==="--help"||Q==="-h")return!0;if(Q==="--version"||Q==="-v")return!0;if(Q.startsWith("-")||Q.length>0)return!0;return!1}if(E8(process.argv))await C8(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).
|
|
579
694
|
Install it with: curl -fsSL https://bun.sh/install | bash
|
|
580
695
|
|
|
581
|
-
`+"CLI commands (list, search, inspect, etc.) work with Node.js — run: asm --help"),process.exit(1)}),Z.on("exit",(
|
|
696
|
+
`+"CLI commands (list, search, inspect, etc.) work with Node.js — run: asm --help"),process.exit(1)}),Z.on("exit",(Q)=>process.exit(Q??0))}else await import("./chunk-w4et4kfd.js");
|