agent-skill-manager 1.20.0 → 1.21.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 +74 -18
- package/dist/agent-skill-manager.js +434 -347
- package/dist/{chunk-b38qq69j.js → chunk-1becp2v6.js} +1 -1
- package/dist/{chunk-w4et4kfd.js → chunk-4qbqrrmk.js} +1 -1
- package/dist/{chunk-2qybtcgb.js → chunk-a26gjzjk.js} +1 -1
- package/dist/{chunk-jexzjtx5.js → chunk-cshq625q.js} +2 -2
- package/package.json +2 -1
|
@@ -1,165 +1,165 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as h0,b as
|
|
3
|
-
`)}}
|
|
4
|
-
`)?
|
|
2
|
+
import{a as h0,b as k$,c as CZ,d as EZ}from"./chunk-1becp2v6.js";import{A as PZ,B as l,C as q2,D as SZ,F as bZ,G as xZ,H as ZZ,I as Z2,J as yZ,e as r,f as z0,g as V2,i,j as OZ,k as r4,l as AZ,m as IZ,n as e4,o as TZ,p as W,q as MZ,r as c5,s as jZ,t as $2,u as NZ,v as DZ,w as RZ,z as wZ}from"./chunk-cshq625q.js";import{K as g,L as R,M as h,N as _Z,O as E,P as LZ,Q as f$,R as F8,S as u$,T as GZ,U as X0,V as v,W as FZ}from"./chunk-a26gjzjk.js";var f=R((O6)=>{var J9=Symbol.for("yaml.alias"),I2=Symbol.for("yaml.document"),s$=Symbol.for("yaml.map"),T2=Symbol.for("yaml.pair"),G9=Symbol.for("yaml.scalar"),t$=Symbol.for("yaml.seq"),B0=Symbol.for("yaml.node.type"),H6=($)=>!!$&&typeof $==="object"&&$[B0]===J9,V6=($)=>!!$&&typeof $==="object"&&$[B0]===I2,B6=($)=>!!$&&typeof $==="object"&&$[B0]===s$,K6=($)=>!!$&&typeof $==="object"&&$[B0]===T2,M2=($)=>!!$&&typeof $==="object"&&$[B0]===G9,_6=($)=>!!$&&typeof $==="object"&&$[B0]===t$;function j2($){if($&&typeof $==="object")switch($[B0]){case s$:case t$:return!0}return!1}function L6($){if($&&typeof $==="object")switch($[B0]){case J9:case s$:case G9:case t$:return!0}return!1}var F6=($)=>(M2($)||j2($))&&!!$.anchor;O6.ALIAS=J9;O6.DOC=I2;O6.MAP=s$;O6.NODE_TYPE=B0;O6.PAIR=T2;O6.SCALAR=G9;O6.SEQ=t$;O6.hasAnchor=F6;O6.isAlias=H6;O6.isCollection=j2;O6.isDocument=V6;O6.isMap=B6;O6.isNode=L6;O6.isPair=K6;O6.isScalar=M2;O6.isSeq=_6});var U$=R((k6)=>{var m=f(),n=Symbol("break visit"),N2=Symbol("skip children"),Y0=Symbol("remove node");function r$($,q){let Z=D2(q);if(m.isDocument($)){if(o0(null,$.contents,Z,Object.freeze([$]))===Y0)$.contents=null}else o0(null,$,Z,Object.freeze([]))}r$.BREAK=n;r$.SKIP=N2;r$.REMOVE=Y0;function o0($,q,Z,Q){let X=R2($,q,Z,Q);if(m.isNode(X)||m.isPair(X))return w2($,Q,X),o0($,X,Z,Q);if(typeof X!=="symbol"){if(m.isCollection(q)){Q=Object.freeze(Q.concat(q));for(let z=0;z<q.items.length;++z){let J=o0(z,q.items[z],Z,Q);if(typeof J==="number")z=J-1;else if(J===n)return n;else if(J===Y0)q.items.splice(z,1),z-=1}}else if(m.isPair(q)){Q=Object.freeze(Q.concat(q));let z=o0("key",q.key,Z,Q);if(z===n)return n;else if(z===Y0)q.key=null;let J=o0("value",q.value,Z,Q);if(J===n)return n;else if(J===Y0)q.value=null}}return X}async function e$($,q){let Z=D2(q);if(m.isDocument($)){if(await a0(null,$.contents,Z,Object.freeze([$]))===Y0)$.contents=null}else await a0(null,$,Z,Object.freeze([]))}e$.BREAK=n;e$.SKIP=N2;e$.REMOVE=Y0;async function a0($,q,Z,Q){let X=await R2($,q,Z,Q);if(m.isNode(X)||m.isPair(X))return w2($,Q,X),a0($,X,Z,Q);if(typeof X!=="symbol"){if(m.isCollection(q)){Q=Object.freeze(Q.concat(q));for(let z=0;z<q.items.length;++z){let J=await a0(z,q.items[z],Z,Q);if(typeof J==="number")z=J-1;else if(J===n)return n;else if(J===Y0)q.items.splice(z,1),z-=1}}else if(m.isPair(q)){Q=Object.freeze(Q.concat(q));let z=await a0("key",q.key,Z,Q);if(z===n)return n;else if(z===Y0)q.key=null;let J=await a0("value",q.value,Z,Q);if(J===n)return n;else if(J===Y0)q.value=null}}return X}function D2($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function R2($,q,Z,Q){if(typeof Z==="function")return Z($,q,Q);if(m.isMap(q))return Z.Map?.($,q,Q);if(m.isSeq(q))return Z.Seq?.($,q,Q);if(m.isPair(q))return Z.Pair?.($,q,Q);if(m.isScalar(q))return Z.Scalar?.($,q,Q);if(m.isAlias(q))return Z.Alias?.($,q,Q);return}function w2($,q,Z){let Q=q[q.length-1];if(m.isCollection(Q))Q.items[$]=Z;else if(m.isPair(Q))if($==="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`)}}k6.visit=r$;k6.visitAsync=e$});var Y9=R((m6)=>{var P2=f(),v6=U$(),g6={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},u6=($)=>$.replace(/[!,[\]{}]/g,(q)=>g6[q]);class e{constructor($,q){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,$),this.tags=Object.assign({},e.defaultTags,q)}clone(){let $=new e(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return $}add($,q){if(this.atNextDocument)this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1;let Z=$.trim().split(/[ \t]+/),Q=Z.shift();switch(Q){case"%TAG":{if(Z.length!==2){if(q(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 q(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 q(6,`Unsupported YAML version ${X}`,z),!1}}default:return q(0,`Unknown directive ${Q}`,!0),!1}}tagName($,q){if($==="!")return"!";if($[0]!=="!")return q(`Not a valid tag: ${$}`),null;if($[1]==="<"){let z=$.slice(2,-1);if(z==="!"||z==="!!")return q(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")q("Verbatim tags must end with a >");return z}let[,Z,Q]=$.match(/^(.*!)([^!]*)$/s);if(!Q)q(`The ${$} tag has no suffix`);let X=this.tags[Z];if(X)try{return X+decodeURIComponent(Q)}catch(z){return q(String(z)),null}if(Z==="!")return $;return q(`Could not resolve tag: ${$}`),null}tagString($){for(let[q,Z]of Object.entries(this.tags))if($.startsWith(Z))return q+u6($.substring(Z.length));return $[0]==="!"?$:`!<${$}>`}toString($){let q=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),Q;if($&&Z.length>0&&P2.isNode($.contents)){let X={};v6.visit($.contents,(z,J)=>{if(P2.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.some((J)=>J.startsWith(z)))q.push(`%TAG ${X} ${z}`)}return q.join(`
|
|
3
|
+
`)}}e.defaultYaml={explicit:!1,version:"1.2"};e.defaultTags={"!!":"tag:yaml.org,2002:"};m6.Directives=e});var $q=R((n6)=>{var C2=f(),d6=U$();function c6($){if(/[\x00-\x19\s,[\]{}]/.test($)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(Z)}return!0}function E2($){let q=new Set;return d6.visit($,{Value(Z,Q){if(Q.anchor)q.add(Q.anchor)}}),q}function S2($,q){for(let Z=1;;++Z){let Q=`${$}${Z}`;if(!q.has(Q))return Q}}function l6($,q){let Z=[],Q=new Map,X=null;return{onAnchor:(z)=>{Z.push(z),X??(X=E2($));let J=S2(q,X);return X.add(J),J},setAnchors:()=>{for(let z of Z){let J=Q.get(z);if(typeof J==="object"&&J.anchor&&(C2.isScalar(J.node)||C2.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}}n6.anchorIsValid=c6;n6.anchorNames=E2;n6.createNodeAnchors=l6;n6.findNewAnchor=S2});var U9=R((t6)=>{function W$($,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=W$($,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=W$($,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=W$($,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=W$($,Q,X,z);if(J===void 0)delete Q[X];else if(J!==z)Q[X]=J}return $.call(q,Z,Q)}t6.applyReviver=W$});var _0=R(($7)=>{var e6=f();function b2($,q,Z){if(Array.isArray($))return $.map((Q,X)=>b2(Q,String(X),Z));if($&&typeof $.toJSON==="function"){if(!Z||!e6.hasAnchor($))return $.toJSON(q,Z);let Q={aliasCount:0,count:1,res:void 0};Z.anchors.set($,Q),Z.onCreate=(z)=>{Q.res=z,delete Z.onCreate};let X=$.toJSON(q,Z);if(Z.onCreate)Z.onCreate(X);return X}if(typeof $==="bigint"&&!Z?.keep)return Number($);return $}$7.toJS=b2});var qq=R((X7)=>{var Z7=U9(),x2=f(),Q7=_0();class y2{constructor($){Object.defineProperty(this,x2.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:q,maxAliasCount:Z,onAnchor:Q,reviver:X}={}){if(!x2.isDocument($))throw TypeError("A document argument is required");let z={anchors:new Map,doc:$,keep:!0,mapAsMap:q===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},J=Q7.toJS(this,"",z);if(typeof Q==="function")for(let{count:G,res:Y}of z.anchors.values())Q(Y,G);return typeof X==="function"?Z7.applyReviver(X,{"":J},"",J):J}}X7.NodeBase=y2});var H$=R((W7)=>{var J7=$q(),G7=U$(),s0=f(),Y7=qq(),U7=_0();class k2 extends Y7.NodeBase{constructor($){super(s0.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,q){let Z;if(q?.aliasResolveCache)Z=q.aliasResolveCache;else if(Z=[],G7.visit($,{Node:(X,z)=>{if(s0.isAlias(z)||s0.hasAnchor(z))Z.push(z)}}),q)q.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(!q)return{source:this.source};let{anchors:Z,doc:Q,maxAliasCount:X}=q,z=this.resolve(Q,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)U7.toJS(z,null,q),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=Zq(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($){if(J7.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let X=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(X)}if($.implicitKey)return`${Q} `}return Q}}function Zq($,q,Z){if(s0.isAlias(q)){let Q=q.resolve($),X=Z&&Q&&Z.get(Q);return X?X.count*X.aliasCount:0}else if(s0.isCollection(q)){let Q=0;for(let X of q.items){let z=Zq($,X,Z);if(z>Q)Q=z}return Q}else if(s0.isPair(q)){let Q=Zq($,q.key,Z),X=Zq($,q.value,Z);return Math.max(Q,X)}return 1}W7.Alias=k2});var u=R((L7)=>{var V7=f(),B7=qq(),K7=_0(),_7=($)=>!$||typeof $!=="function"&&typeof $!=="object";class C0 extends B7.NodeBase{constructor($){super(V7.SCALAR);this.value=$}toJSON($,q){return q?.keep?this.value:K7.toJS(this.value,$,q)}toString(){return String(this.value)}}C0.BLOCK_FOLDED="BLOCK_FOLDED";C0.BLOCK_LITERAL="BLOCK_LITERAL";C0.PLAIN="PLAIN";C0.QUOTE_DOUBLE="QUOTE_DOUBLE";C0.QUOTE_SINGLE="QUOTE_SINGLE";L7.Scalar=C0;L7.isScalarValue=_7});var V$=R((j7)=>{var A7=H$(),E0=f(),f2=u(),I7="tag:yaml.org,2002:";function T7($,q,Z){if(q){let Q=Z.filter((z)=>z.tag===q),X=Q.find((z)=>!z.format)??Q[0];if(!X)throw Error(`Tag ${q} not found`);return X}return Z.find((Q)=>Q.identify?.($)&&!Q.format)}function M7($,q,Z){if(E0.isDocument($))$=$.contents;if(E0.isNode($))return $;if(E0.isPair($)){let H=Z.schema[E0.MAP].createNode?.(Z.schema,null,Z);return H.items.push($),H}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:z,schema:J,sourceObjects:G}=Z,Y=void 0;if(Q&&$&&typeof $==="object")if(Y=G.get($),Y)return Y.anchor??(Y.anchor=X($)),new A7.Alias(Y.anchor);else Y={anchor:null,node:null},G.set($,Y);if(q?.startsWith("!!"))q=I7+q.slice(2);let U=T7($,q,J.tags);if(!U){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new f2.Scalar($);if(Y)Y.node=H;return H}U=$ instanceof Map?J[E0.MAP]:(Symbol.iterator in Object($))?J[E0.SEQ]:J[E0.MAP]}if(z)z(U),delete Z.onTagObj;let V=U?.createNode?U.createNode(Z.schema,$,Z):typeof U?.nodeClass?.from==="function"?U.nodeClass.from(Z.schema,$,Z):new f2.Scalar($);if(q)V.tag=q;else if(!U.default)V.tag=U.tag;if(Y)Y.node=V;return V}j7.createNode=M7});var Qq=R((w7)=>{var D7=V$(),U0=f(),R7=qq();function W9($,q,Z){let Q=Z;for(let X=q.length-1;X>=0;--X){let z=q[X];if(typeof z==="number"&&Number.isInteger(z)&&z>=0){let J=[];J[z]=Q,Q=J}else Q=new Map([[z,Q]])}return D7.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var h2=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class v2 extends R7.NodeBase{constructor($,q){super($);Object.defineProperty(this,"schema",{value:q,configurable:!0,enumerable:!1,writable:!0})}clone($){let q=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)q.schema=$;if(q.items=q.items.map((Z)=>U0.isNode(Z)||U0.isPair(Z)?Z.clone($):Z),this.range)q.range=this.range.slice();return q}addIn($,q){if(h2($))this.add(q);else{let[Z,...Q]=$,X=this.get(Z,!0);if(U0.isCollection(X))X.addIn(Q,q);else if(X===void 0&&this.schema)this.set(Z,W9(this.schema,Q,q));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}deleteIn($){let[q,...Z]=$;if(Z.length===0)return this.delete(q);let Q=this.get(q,!0);if(U0.isCollection(Q))return Q.deleteIn(Z);else throw Error(`Expected YAML collection at ${q}. Remaining path: ${Z}`)}getIn($,q){let[Z,...Q]=$,X=this.get(Z,!0);if(Q.length===0)return!q&&U0.isScalar(X)?X.value:X;else return U0.isCollection(X)?X.getIn(Q,q):void 0}hasAllNullValues($){return this.items.every((q)=>{if(!U0.isPair(q))return!1;let Z=q.value;return Z==null||$&&U0.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn($){let[q,...Z]=$;if(Z.length===0)return this.has(q);let Q=this.get(q,!0);return U0.isCollection(Q)?Q.hasIn(Z):!1}setIn($,q){let[Z,...Q]=$;if(Q.length===0)this.set(Z,q);else{let X=this.get(Z,!0);if(U0.isCollection(X))X.setIn(Q,q);else if(X===void 0&&this.schema)this.set(Z,W9(this.schema,Q,q));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}}w7.Collection=v2;w7.collectionFromPath=W9;w7.isEmptyPath=h2});var B$=R((x7)=>{var S7=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function H9($,q){if(/^\n+$/.test($))return $.substring(1);return q?$.replace(/^(?! *$)/gm,q):$}var b7=($,q,Z)=>$.endsWith(`
|
|
4
|
+
`)?H9(Z,q):Z.includes(`
|
|
5
5
|
`)?`
|
|
6
|
-
`+
|
|
7
|
-
`){if(Z==="block")
|
|
8
|
-
`&&
|
|
9
|
-
`&&
|
|
10
|
-
${
|
|
11
|
-
${
|
|
12
|
-
`);Q
|
|
13
|
-
`){if(z-J>Q)return!0;if(J=z+1,X-J<=Q)return!1}return!0}function
|
|
6
|
+
`+H9(Z,q):($.endsWith(" ")?"":" ")+Z;x7.indentComment=H9;x7.lineComment=b7;x7.stringifyComment=S7});var u2=R((v7)=>{function h7($,q,Z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:z=20,onFold:J,onOverflow:G}={}){if(!X||X<0)return $;if(X<z)z=0;let Y=Math.max(1+z,1+X-q.length);if($.length<=Y)return $;let U=[],V={},H=X-q.length;if(typeof Q==="number")if(Q>X-Math.max(2,z))U.push(0);else H=X-Q;let B=void 0,_=void 0,L=!1,K=-1,F=-1,O=-1;if(Z==="block"){if(K=g2($,K,q.length),K!==-1)H=K+Y}for(let M;M=$[K+=1];){if(Z==="quoted"&&M==="\\"){switch(F=K,$[K+1]){case"x":K+=3;break;case"u":K+=5;break;case"U":K+=9;break;default:K+=1}O=K}if(M===`
|
|
7
|
+
`){if(Z==="block")K=g2($,K,q.length);H=K+q.length+Y,B=void 0}else{if(M===" "&&_&&_!==" "&&_!==`
|
|
8
|
+
`&&_!=="\t"){let N=$[K+1];if(N&&N!==" "&&N!==`
|
|
9
|
+
`&&N!=="\t")B=K}if(K>=H)if(B)U.push(B),H=B+Y,B=void 0;else if(Z==="quoted"){while(_===" "||_==="\t")_=M,M=$[K+=1],L=!0;let N=K>O+1?K-2:F-1;if(V[N])return $;U.push(N),V[N]=!0,H=N+Y,B=void 0}else L=!0}_=M}if(L&&G)G();if(U.length===0)return $;if(J)J();let A=$.slice(0,U[0]);for(let M=0;M<U.length;++M){let N=U[M],T=U[M+1]||$.length;if(N===0)A=`
|
|
10
|
+
${q}${$.slice(0,T)}`;else{if(Z==="quoted"&&V[N])A+=`${$[N]}\\`;A+=`
|
|
11
|
+
${q}${$.slice(N+1,T)}`}}return A}function g2($,q,Z){let Q=q,X=q+1,z=$[X];while(z===" "||z==="\t")if(q<X+Z)z=$[++q];else{do z=$[++q];while(z&&z!==`
|
|
12
|
+
`);Q=q,X=q+1,z=$[X]}return Q}v7.FOLD_BLOCK="block";v7.FOLD_FLOW="flow";v7.FOLD_QUOTED="quoted";v7.foldFlowLines=h7});var _$=R((n7)=>{var J0=u(),L0=u2(),zq=($,q)=>({indentAtStart:q?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),Jq=($)=>/^(%|---|\.\.\.)/m.test($);function d7($,q,Z){if(!q||q<0)return!1;let Q=q-Z,X=$.length;if(X<=Q)return!1;for(let z=0,J=0;z<X;++z)if($[z]===`
|
|
13
|
+
`){if(z-J>Q)return!0;if(J=z+1,X-J<=Q)return!1}return!0}function K$($,q){let Z=JSON.stringify($);if(q.options.doubleQuotedAsJSON)return Z;let{implicitKey:Q}=q,X=q.options.doubleQuotedMinMultiLineLength,z=q.indent||(Jq($)?" ":""),J="",G=0;for(let Y=0,U=Z[Y];U;U=Z[++Y]){if(U===" "&&Z[Y+1]==="\\"&&Z[Y+2]==="n")J+=Z.slice(G,Y)+"\\ ",Y+=1,G=Y,U="\\";if(U==="\\")switch(Z[Y+1]){case"u":{J+=Z.slice(G,Y);let V=Z.substr(Y+2,4);switch(V){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(V.substr(0,2)==="00")J+="\\x"+V.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
14
|
|
|
15
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,
|
|
17
|
-
`)||/[ \t]\n|\n[ \t]/.test(
|
|
18
|
-
${Z}`)+"'";return
|
|
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,zq(q,!1))}function V9($,q){if(q.options.singleQuote===!1||q.implicitKey&&$.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return K$($,q);let Z=q.indent||(Jq($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${Z}`)+"'";return q.implicitKey?Q:L0.foldFlowLines(Q,Z,L0.FOLD_FLOW,zq(q,!1))}function t0($,q){let{singleQuote:Z}=q.options,Q;if(Z===!1)Q=K$;else{let X=$.includes('"'),z=$.includes("'");if(X&&!z)Q=V9;else if(z&&!X)Q=K$;else Q=Z?V9:K$}return Q($,q)}var B9;try{B9=new RegExp(`(^|(?<!
|
|
19
19
|
))
|
|
20
20
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{
|
|
21
|
+
|$)`,"g")}catch{B9=/\n+(?!\n|$)/g}function Xq({comment:$,type:q,value:Z},Q,X,z){let{blockQuote:J,commentString:G,lineWidth:Y}=Q.options;if(!J||/\n[\t ]+$/.test(Z))return t0(Z,Q);let U=Q.indent||(Q.forceBlockIndent||Jq(Z)?" ":""),V=J==="literal"?!0:J==="folded"||q===J0.Scalar.BLOCK_FOLDED?!1:q===J0.Scalar.BLOCK_LITERAL?!0:!d7(Z,Y,U.length);if(!Z)return V?`|
|
|
22
22
|
`:`>
|
|
23
|
-
`;let
|
|
24
|
-
`&&
|
|
25
|
-
`);if(L===-1)
|
|
26
|
-
`)
|
|
27
|
-
`)F
|
|
28
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${
|
|
29
|
-
${
|
|
30
|
-
${
|
|
31
|
-
`)||
|
|
32
|
-
`)?
|
|
33
|
-
`))return
|
|
34
|
-
${Y}`);if(J){let
|
|
35
|
-
${
|
|
36
|
-
${G}:`}else if(
|
|
37
|
-
`:"",
|
|
38
|
-
${
|
|
39
|
-
`&&
|
|
40
|
-
|
|
41
|
-
`}else
|
|
42
|
-
${Z.indent}`}else if(!
|
|
43
|
-
`),
|
|
44
|
-
${Z.indent}`}}else if(
|
|
45
|
-
`)
|
|
46
|
-
${Y}${
|
|
47
|
-
`}}if(
|
|
48
|
-
`+
|
|
49
|
-
`)))H
|
|
50
|
-
${z}${X}${
|
|
23
|
+
`;let H,B;for(B=Z.length;B>0;--B){let T=Z[B-1];if(T!==`
|
|
24
|
+
`&&T!=="\t"&&T!==" ")break}let _=Z.substring(B),L=_.indexOf(`
|
|
25
|
+
`);if(L===-1)H="-";else if(Z===_||L!==_.length-1){if(H="+",z)z()}else H="";if(_){if(Z=Z.slice(0,-_.length),_[_.length-1]===`
|
|
26
|
+
`)_=_.slice(0,-1);_=_.replace(B9,`$&${U}`)}let K=!1,F,O=-1;for(F=0;F<Z.length;++F){let T=Z[F];if(T===" ")K=!0;else if(T===`
|
|
27
|
+
`)O=F;else break}let A=Z.substring(0,O<F?O+1:F);if(A)Z=Z.substring(A.length),A=A.replace(/\n+/g,`$&${U}`);let N=(K?U?"2":"1":"")+H;if($){if(N+=" "+G($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!V){let T=Z.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${U}`),D=!1,x=zq(Q,!0);if(J!=="folded"&&q!==J0.Scalar.BLOCK_FOLDED)x.onOverflow=()=>{D=!0};let P=L0.foldFlowLines(`${A}${T}${_}`,U,L0.FOLD_BLOCK,x);if(!D)return`>${N}
|
|
29
|
+
${U}${P}`}return Z=Z.replace(/\n+/g,`$&${U}`),`|${N}
|
|
30
|
+
${U}${A}${Z}${_}`}function c7($,q,Z,Q){let{type:X,value:z}=$,{actualString:J,implicitKey:G,indent:Y,indentStep:U,inFlow:V}=q;if(G&&z.includes(`
|
|
31
|
+
`)||V&&/[[\]{},]/.test(z))return t0(z,q);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(z))return G||V||!z.includes(`
|
|
32
|
+
`)?t0(z,q):Xq($,q,Z,Q);if(!G&&!V&&X!==J0.Scalar.PLAIN&&z.includes(`
|
|
33
|
+
`))return Xq($,q,Z,Q);if(Jq(z)){if(Y==="")return q.forceBlockIndent=!0,Xq($,q,Z,Q);else if(G&&Y===U)return t0(z,q)}let H=z.replace(/\n+/g,`$&
|
|
34
|
+
${Y}`);if(J){let B=(K)=>K.default&&K.tag!=="tag:yaml.org,2002:str"&&K.test?.test(H),{compat:_,tags:L}=q.doc.schema;if(L.some(B)||_?.some(B))return t0(z,q)}return G?H:L0.foldFlowLines(H,Y,L0.FOLD_FLOW,zq(q,!1))}function l7($,q,Z,Q){let{implicitKey:X,inFlow:z}=q,J=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:G}=$;if(G!==J0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(J.value))G=J0.Scalar.QUOTE_DOUBLE}let Y=(V)=>{switch(V){case J0.Scalar.BLOCK_FOLDED:case J0.Scalar.BLOCK_LITERAL:return X||z?t0(J.value,q):Xq(J,q,Z,Q);case J0.Scalar.QUOTE_DOUBLE:return K$(J.value,q);case J0.Scalar.QUOTE_SINGLE:return V9(J.value,q);case J0.Scalar.PLAIN:return c7(J,q,Z,Q);default:return null}},U=Y(G);if(U===null){let{defaultKeyType:V,defaultStringType:H}=q.options,B=X&&V||H;if(U=Y(B),U===null)throw Error(`Unsupported default string type ${B}`)}return U}n7.stringifyString=l7});var L$=R((q3)=>{var o7=$q(),F0=f(),a7=B$(),s7=_$();function t7($,q){let Z=Object.assign({blockQuote:!0,commentString:a7.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,q),Q;switch(Z.collectionStyle){case"block":Q=!1;break;case"flow":Q=!0;break;default:Q=null}return{anchors:new Set,doc:$,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:Q,options:Z}}function r7($,q){if(q.tag){let X=$.filter((z)=>z.tag===q.tag);if(X.length>0)return X.find((z)=>z.format===q.format)??X[0]}let Z=void 0,Q;if(F0.isScalar(q)){Q=q.value;let X=$.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===q.format)??X.find((z)=>!z.format)}else Q=q,Z=$.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 e7($,q,{anchors:Z,doc:Q}){if(!Q.directives)return"";let X=[],z=(F0.isScalar($)||F0.isCollection($))&&$.anchor;if(z&&o7.anchorIsValid(z))Z.add(z),X.push(`&${z}`);let J=$.tag??(q.default?null:q.tag);if(J)X.push(Q.directives.tagString(J));return X.join(" ")}function $3($,q,Z,Q){if(F0.isPair($))return $.toString(q,Z,Q);if(F0.isAlias($)){if(q.doc.directives)return $.toString(q);if(q.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(q.resolvedAliases)q.resolvedAliases.add($);else q.resolvedAliases=new Set([$]);$=$.resolve(q.doc)}}let X=void 0,z=F0.isNode($)?$:q.doc.createNode($,{onTagObj:(Y)=>X=Y});X??(X=r7(q.doc.schema.tags,z));let J=e7(z,X,q);if(J.length>0)q.indentAtStart=(q.indentAtStart??0)+J.length+1;let G=typeof X.stringify==="function"?X.stringify(z,q,Z,Q):F0.isScalar(z)?s7.stringifyString(z,q,Z,Q):z.toString(q,Z,Q);if(!J)return G;return F0.isScalar(z)||G[0]==="{"||G[0]==="["?`${J} ${G}`:`${J}
|
|
35
|
+
${q.indent}${G}`}q3.createStringifyContext=t7;q3.stringify=$3});var d2=R((z3)=>{var K0=f(),m2=u(),p2=L$(),F$=B$();function X3({key:$,value:q},Z,Q,X){let{allNullValues:z,doc:J,indent:G,indentStep:Y,options:{commentString:U,indentSeq:V,simpleKeys:H}}=Z,B=K0.isNode($)&&$.comment||null;if(H){if(B)throw Error("With simple keys, key nodes cannot have comments");if(K0.isCollection($)||!K0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let _=!H&&(!$||B&&q==null&&!Z.inFlow||K0.isCollection($)||(K0.isScalar($)?$.type===m2.Scalar.BLOCK_FOLDED||$.type===m2.Scalar.BLOCK_LITERAL:typeof $==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!_&&(H||!z),indent:G+Y});let L=!1,K=!1,F=p2.stringify($,Z,()=>L=!0,()=>K=!0);if(!_&&!Z.inFlow&&F.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");_=!0}if(Z.inFlow){if(z||q==null){if(L&&Q)Q();return F===""?"?":_?`? ${F}`:F}}else if(z&&!H||q==null&&_){if(F=`? ${F}`,B&&!L)F+=F$.lineComment(F,Z.indent,U(B));else if(K&&X)X();return F}if(L)B=null;if(_){if(B)F+=F$.lineComment(F,Z.indent,U(B));F=`? ${F}
|
|
36
|
+
${G}:`}else if(F=`${F}:`,B)F+=F$.lineComment(F,Z.indent,U(B));let O,A,M;if(K0.isNode(q))O=!!q.spaceBefore,A=q.commentBefore,M=q.comment;else if(O=!1,A=null,M=null,q&&typeof q==="object")q=J.createNode(q);if(Z.implicitKey=!1,!_&&!B&&K0.isScalar(q))Z.indentAtStart=F.length+1;if(K=!1,!V&&Y.length>=2&&!Z.inFlow&&!_&&K0.isSeq(q)&&!q.flow&&!q.tag&&!q.anchor)Z.indent=Z.indent.substring(2);let N=!1,T=p2.stringify(q,Z,()=>N=!0,()=>K=!0),D=" ";if(B||O||A){if(D=O?`
|
|
37
|
+
`:"",A){let x=U(A);D+=`
|
|
38
|
+
${F$.indentComment(x,Z.indent)}`}if(T===""&&!Z.inFlow){if(D===`
|
|
39
|
+
`&&M)D=`
|
|
40
|
+
|
|
41
|
+
`}else D+=`
|
|
42
|
+
${Z.indent}`}else if(!_&&K0.isCollection(q)){let x=T[0],P=T.indexOf(`
|
|
43
|
+
`),k=P!==-1,I=Z.inFlow??q.flow??q.items.length===0;if(k||!I){let j=!1;if(k&&(x==="&"||x==="!")){let C=T.indexOf(" ");if(x==="&"&&C!==-1&&C<P&&T[C+1]==="!")C=T.indexOf(" ",C+1);if(C===-1||P<C)j=!0}if(!j)D=`
|
|
44
|
+
${Z.indent}`}}else if(T===""||T[0]===`
|
|
45
|
+
`)D="";if(F+=D+T,Z.inFlow){if(N&&Q)Q()}else if(M&&!N)F+=F$.lineComment(F,Z.indent,U(M));else if(K&&X)X();return F}z3.stringifyPair=X3});var K9=R((U3)=>{var c2=h("process");function G3($,...q){if($==="debug")console.log(...q)}function Y3($,q){if($==="debug"||$==="warn")if(typeof c2.emitWarning==="function")c2.emitWarning(q);else console.warn(q)}U3.debug=G3;U3.warn=Y3});var Uq=R((B3)=>{var O$=f(),l2=u(),Gq="<<",Yq={identify:($)=>$===Gq||typeof $==="symbol"&&$.description===Gq,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new l2.Scalar(Symbol(Gq)),{addToJSMap:n2}),stringify:()=>Gq},V3=($,q)=>(Yq.identify(q)||O$.isScalar(q)&&(!q.type||q.type===l2.Scalar.PLAIN)&&Yq.identify(q.value))&&$?.doc.schema.tags.some((Z)=>Z.tag===Yq.tag&&Z.default);function n2($,q,Z){if(Z=$&&O$.isAlias(Z)?Z.resolve($.doc):Z,O$.isSeq(Z))for(let Q of Z.items)_9($,q,Q);else if(Array.isArray(Z))for(let Q of Z)_9($,q,Q);else _9($,q,Z)}function _9($,q,Z){let Q=$&&O$.isAlias(Z)?Z.resolve($.doc):Z;if(!O$.isMap(Q))throw Error("Merge sources must be maps or map aliases");let X=Q.toJSON(null,$,Map);for(let[z,J]of X)if(q instanceof Map){if(!q.has(z))q.set(z,J)}else if(q instanceof Set)q.add(z);else if(!Object.prototype.hasOwnProperty.call(q,z))Object.defineProperty(q,z,{value:J,writable:!0,enumerable:!0,configurable:!0});return q}B3.addMergeToJSMap=n2;B3.isMergeKey=V3;B3.merge=Yq});var F9=R((T3)=>{var F3=K9(),i2=Uq(),O3=L$(),o2=f(),L9=_0();function A3($,q,{key:Z,value:Q}){if(o2.isNode(Z)&&Z.addToJSMap)Z.addToJSMap($,q,Q);else if(i2.isMergeKey($,Z))i2.addMergeToJSMap($,q,Q);else{let X=L9.toJS(Z,"",$);if(q instanceof Map)q.set(X,L9.toJS(Q,X,$));else if(q instanceof Set)q.add(X);else{let z=I3(Z,X,$),J=L9.toJS(Q,z,$);if(z in q)Object.defineProperty(q,z,{value:J,writable:!0,enumerable:!0,configurable:!0});else q[z]=J}}return q}function I3($,q,Z){if(q===null)return"";if(typeof q!=="object")return String(q);if(o2.isNode($)&&Z?.doc){let Q=O3.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=$.toString(Q);if(!Z.mapKeyWarned){let z=JSON.stringify(X);if(z.length>40)z=z.substring(0,36)+'..."';F3.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(q)}T3.addPairToJSMap=A3});var O0=R((R3)=>{var a2=V$(),j3=d2(),N3=F9(),Wq=f();function D3($,q,Z){let Q=a2.createNode($,void 0,Z),X=a2.createNode(q,void 0,Z);return new Hq(Q,X)}class Hq{constructor($,q=null){Object.defineProperty(this,Wq.NODE_TYPE,{value:Wq.PAIR}),this.key=$,this.value=q}clone($){let{key:q,value:Z}=this;if(Wq.isNode(q))q=q.clone($);if(Wq.isNode(Z))Z=Z.clone($);return new Hq(q,Z)}toJSON($,q){let Z=q?.mapAsMap?new Map:{};return N3.addPairToJSMap(q,Z,this)}toString($,q,Z){return $?.doc?j3.stringifyPair(this,$,q,Z):JSON.stringify(this)}}R3.Pair=Hq;R3.createPair=D3});var O9=R((b3)=>{var S0=f(),s2=L$(),Vq=B$();function C3($,q,Z){return(q.inFlow??$.flow?S3:E3)($,q,Z)}function E3({comment:$,items:q},Z,{blockItemPrefix:Q,flowChars:X,itemIndent:z,onChompKeep:J,onComment:G}){let{indent:Y,options:{commentString:U}}=Z,V=Object.assign({},Z,{indent:z,type:null}),H=!1,B=[];for(let L=0;L<q.length;++L){let K=q[L],F=null;if(S0.isNode(K)){if(!H&&K.spaceBefore)B.push("");if(Bq(Z,B,K.commentBefore,H),K.comment)F=K.comment}else if(S0.isPair(K)){let A=S0.isNode(K.key)?K.key:null;if(A){if(!H&&A.spaceBefore)B.push("");Bq(Z,B,A.commentBefore,H)}}H=!1;let O=s2.stringify(K,V,()=>F=null,()=>H=!0);if(F)O+=Vq.lineComment(O,z,U(F));if(H&&F)H=!1;B.push(Q+O)}let _;if(B.length===0)_=X.start+X.end;else{_=B[0];for(let L=1;L<B.length;++L){let K=B[L];_+=K?`
|
|
46
|
+
${Y}${K}`:`
|
|
47
|
+
`}}if($){if(_+=`
|
|
48
|
+
`+Vq.indentComment(U($),Y),G)G()}else if(H&&J)J();return _}function S3({items:$},q,{flowChars:Z,itemIndent:Q}){let{indent:X,indentStep:z,flowCollectionPadding:J,options:{commentString:G}}=q;Q+=z;let Y=Object.assign({},q,{indent:Q,inFlow:!0,type:null}),U=!1,V=0,H=[];for(let L=0;L<$.length;++L){let K=$[L],F=null;if(S0.isNode(K)){if(K.spaceBefore)H.push("");if(Bq(q,H,K.commentBefore,!1),K.comment)F=K.comment}else if(S0.isPair(K)){let A=S0.isNode(K.key)?K.key:null;if(A){if(A.spaceBefore)H.push("");if(Bq(q,H,A.commentBefore,!1),A.comment)U=!0}let M=S0.isNode(K.value)?K.value:null;if(M){if(M.comment)F=M.comment;if(M.commentBefore)U=!0}else if(K.value==null&&A?.comment)F=A.comment}if(F)U=!0;let O=s2.stringify(K,Y,()=>F=null);if(U||(U=H.length>V||O.includes(`
|
|
49
|
+
`)),L<$.length-1)O+=",";else if(q.options.trailingComma){if(q.options.lineWidth>0)U||(U=H.reduce((A,M)=>A+M.length+2,2)+(O.length+2)>q.options.lineWidth);if(U)O+=","}if(F)O+=Vq.lineComment(O,Q,G(F));H.push(O),V=H.length}let{start:B,end:_}=Z;if(H.length===0)return B+_;else{if(!U){let L=H.reduce((K,F)=>K+F.length+2,2);U=q.options.lineWidth>0&&L>q.options.lineWidth}if(U){let L=B;for(let K of H)L+=K?`
|
|
50
|
+
${z}${X}${K}`:`
|
|
51
51
|
`;return`${L}
|
|
52
|
-
${X}${
|
|
53
|
-
`:" ")}return
|
|
52
|
+
${X}${_}`}else return`${B}${J}${H.join(" ")}${J}${_}`}}function Bq({indent:$,options:{commentString:q}},Z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let z=Vq.indentComment(q(Q),$);Z.push(z.trimStart())}}b3.stringifyCollection=C3});var I0=R((v3)=>{var y3=O9(),k3=F9(),f3=Qq(),A0=f(),Kq=O0(),h3=u();function A$($,q){let Z=A0.isScalar(q)?q.value:q;for(let Q of $)if(A0.isPair(Q)){if(Q.key===q||Q.key===Z)return Q;if(A0.isScalar(Q.key)&&Q.key.value===Z)return Q}return}class t2 extends f3.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(A0.MAP,$);this.items=[]}static from($,q,Z){let{keepUndefined:Q,replacer:X}=Z,z=new this($),J=(G,Y)=>{if(typeof X==="function")Y=X.call(q,G,Y);else if(Array.isArray(X)&&!X.includes(G))return;if(Y!==void 0||Q)z.items.push(Kq.createPair(G,Y,Z))};if(q instanceof Map)for(let[G,Y]of q)J(G,Y);else if(q&&typeof q==="object")for(let G of Object.keys(q))J(G,q[G]);if(typeof $.sortMapEntries==="function")z.items.sort($.sortMapEntries);return z}add($,q){let Z;if(A0.isPair($))Z=$;else if(!$||typeof $!=="object"||!("key"in $))Z=new Kq.Pair($,$?.value);else Z=new Kq.Pair($.key,$.value);let Q=A$(this.items,Z.key),X=this.schema?.sortMapEntries;if(Q){if(!q)throw Error(`Key ${Z.key} already set`);if(A0.isScalar(Q.value)&&h3.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($){let q=A$(this.items,$);if(!q)return!1;return this.items.splice(this.items.indexOf(q),1).length>0}get($,q){let Q=A$(this.items,$)?.value;return(!q&&A0.isScalar(Q)?Q.value:Q)??void 0}has($){return!!A$(this.items,$)}set($,q){this.add(new Kq.Pair($,q),!0)}toJSON($,q,Z){let Q=Z?new Z:q?.mapAsMap?new Map:{};if(q?.onCreate)q.onCreate(Q);for(let X of this.items)k3.addPairToJSMap(q,Q,X);return Q}toString($,q,Z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!A0.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return y3.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:Z,onComment:q})}}v3.YAMLMap=t2;v3.findPair=A$});var r0=R((d3)=>{var m3=f(),r2=I0(),p3={collection:"map",default:!0,nodeClass:r2.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,q){if(!m3.isMap($))q("Expected a mapping for this tag");return $},createNode:($,q,Z)=>r2.YAMLMap.from($,q,Z)};d3.map=p3});var T0=R((s3)=>{var l3=V$(),n3=O9(),i3=Qq(),Lq=f(),o3=u(),a3=_0();class e2 extends i3.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(Lq.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let q=_q($);if(typeof q!=="number")return!1;return this.items.splice(q,1).length>0}get($,q){let Z=_q($);if(typeof Z!=="number")return;let Q=this.items[Z];return!q&&Lq.isScalar(Q)?Q.value:Q}has($){let q=_q($);return typeof q==="number"&&q<this.items.length}set($,q){let Z=_q($);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[Z];if(Lq.isScalar(Q)&&o3.isScalarValue(q))Q.value=q;else this.items[Z]=q}toJSON($,q){let Z=[];if(q?.onCreate)q.onCreate(Z);let Q=0;for(let X of this.items)Z.push(a3.toJS(X,String(Q++),q));return Z}toString($,q,Z){if(!$)return JSON.stringify(this);return n3.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:Z,onComment:q})}static from($,q,Z){let{replacer:Q}=Z,X=new this($);if(q&&Symbol.iterator in Object(q)){let z=0;for(let J of q){if(typeof Q==="function"){let G=q instanceof Set?J:String(z++);J=Q.call(q,G,J)}X.items.push(l3.createNode(J,void 0,Z))}}return X}}function _q($){let q=Lq.isScalar($)?$.value:$;if(q&&typeof q==="string")q=Number(q);return typeof q==="number"&&Number.isInteger(q)&&q>=0?q:null}s3.YAMLSeq=e2});var e0=R(($Q)=>{var r3=f(),$1=T0(),e3={collection:"seq",default:!0,nodeClass:$1.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,q){if(!r3.isSeq($))q("Expected a sequence for this tag");return $},createNode:($,q,Z)=>$1.YAMLSeq.from($,q,Z)};$Q.seq=e3});var I$=R((XQ)=>{var ZQ=_$(),QQ={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,q,Z,Q){return q=Object.assign({actualString:!0},q),ZQ.stringifyString($,q,Z,Q)}};XQ.string=QQ});var Fq=R((JQ)=>{var q1=u(),Z1={identify:($)=>$==null,createNode:()=>new q1.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new q1.Scalar(null),stringify:({source:$},q)=>typeof $==="string"&&Z1.test.test($)?$:q.options.nullStr};JQ.nullTag=Z1});var A9=R((UQ)=>{var YQ=u(),Q1={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new YQ.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:q},Z){if($&&Q1.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(q===Q)return $}return q?Z.options.trueStr:Z.options.falseStr}};UQ.boolTag=Q1});var $$=R((VQ)=>{function HQ({format:$,minFractionDigits:q,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=q-(z.length-J-1);while(G-- >0)z+="0"}return z}VQ.stringifyNumber=HQ});var T9=R((OQ)=>{var KQ=u(),I9=$$(),_Q={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:I9.stringifyNumber},LQ={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let q=Number($.value);return isFinite(q)?q.toExponential():I9.stringifyNumber($)}},FQ={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let q=new KQ.Scalar(parseFloat($)),Z=$.indexOf(".");if(Z!==-1&&$[$.length-1]==="0")q.minFractionDigits=$.length-Z-1;return q},stringify:I9.stringifyNumber};OQ.float=FQ;OQ.floatExp=LQ;OQ.floatNaN=_Q});var j9=R((DQ)=>{var X1=$$(),Oq=($)=>typeof $==="bigint"||Number.isInteger($),M9=($,q,Z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(q),Z);function z1($,q,Z){let{value:Q}=$;if(Oq(Q)&&Q>=0)return Z+Q.toString(q);return X1.stringifyNumber($)}var MQ={identify:($)=>Oq($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,q,Z)=>M9($,2,8,Z),stringify:($)=>z1($,8,"0o")},jQ={identify:Oq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,q,Z)=>M9($,0,10,Z),stringify:X1.stringifyNumber},NQ={identify:($)=>Oq($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,q,Z)=>M9($,2,16,Z),stringify:($)=>z1($,16,"0x")};DQ.int=jQ;DQ.intHex=NQ;DQ.intOct=MQ});var J1=R((kQ)=>{var CQ=r0(),EQ=Fq(),SQ=e0(),bQ=I$(),xQ=A9(),N9=T9(),D9=j9(),yQ=[CQ.map,SQ.seq,bQ.string,EQ.nullTag,xQ.boolTag,D9.intOct,D9.int,D9.intHex,N9.floatNaN,N9.floatExp,N9.float];kQ.schema=yQ});var Y1=R((dQ)=>{var hQ=u(),vQ=r0(),gQ=e0();function G1($){return typeof $==="bigint"||Number.isInteger($)}var Aq=({value:$})=>JSON.stringify($),uQ=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:Aq},{identify:($)=>$==null,createNode:()=>new hQ.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Aq},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:Aq},{identify:G1,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,q,{intAsBigInt:Z})=>Z?BigInt($):parseInt($,10),stringify:({value:$})=>G1($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:Aq}],mQ={default:!0,tag:"",test:/^/,resolve($,q){return q(`Unresolved plain scalar ${JSON.stringify($)}`),$}},pQ=[vQ.map,gQ.seq].concat(uQ,mQ);dQ.schema=pQ});var w9=R((iQ)=>{var T$=h("buffer"),R9=u(),lQ=_$(),nQ={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,q){if(typeof T$.Buffer==="function")return T$.Buffer.from($,"base64");else if(typeof atob==="function"){let Z=atob($.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 q("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:q,value:Z},Q,X,z){if(!Z)return"";let J=Z,G;if(typeof T$.Buffer==="function")G=J instanceof T$.Buffer?J.toString("base64"):T$.Buffer.from(J.buffer).toString("base64");else if(typeof btoa==="function"){let Y="";for(let U=0;U<J.length;++U)Y+=String.fromCharCode(J[U]);G=btoa(Y)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(q??(q=R9.Scalar.BLOCK_LITERAL),q!==R9.Scalar.QUOTE_DOUBLE){let Y=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),U=Math.ceil(G.length/Y),V=Array(U);for(let H=0,B=0;H<U;++H,B+=Y)V[H]=G.substr(B,Y);G=V.join(q===R9.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return lQ.stringifyString({comment:$,type:q,value:G},Q,X,z)}};iQ.binary=nQ});var Tq=R((rQ)=>{var Iq=f(),P9=O0(),aQ=u(),sQ=T0();function U1($,q){if(Iq.isSeq($))for(let Z=0;Z<$.items.length;++Z){let Q=$.items[Z];if(Iq.isPair(Q))continue;else if(Iq.isMap(Q)){if(Q.items.length>1)q("Each pair must have its own sequence indicator");let X=Q.items[0]||new P9.Pair(new aQ.Scalar(null));if(Q.commentBefore)X.key.commentBefore=X.key.commentBefore?`${Q.commentBefore}
|
|
54
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(
|
|
55
|
+
${z.comment}`:Q.comment}Q=X}$.items[Z]=Iq.isPair(Q)?Q:new P9.Pair(Q)}else q("Expected a sequence for this tag");return $}function W1($,q,Z){let{replacer:Q}=Z,X=new sQ.YAMLSeq($);X.tag="tag:yaml.org,2002:pairs";let z=0;if(q&&Symbol.iterator in Object(q))for(let J of q){if(typeof Q==="function")J=Q.call(q,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 U=Object.keys(J);if(U.length===1)G=U[0],Y=J[G];else throw TypeError(`Expected tuple with one key, not ${U.length} keys`)}else G=J;X.items.push(P9.createPair(G,Y,Z))}return X}var tQ={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:U1,createNode:W1};rQ.createPairs=W1;rQ.pairs=tQ;rQ.resolvePairs=U1});var E9=R((XX)=>{var H1=f(),C9=_0(),M$=I0(),ZX=T0(),V1=Tq();class b0 extends ZX.YAMLSeq{constructor(){super();this.add=M$.YAMLMap.prototype.add.bind(this),this.delete=M$.YAMLMap.prototype.delete.bind(this),this.get=M$.YAMLMap.prototype.get.bind(this),this.has=M$.YAMLMap.prototype.has.bind(this),this.set=M$.YAMLMap.prototype.set.bind(this),this.tag=b0.tag}toJSON($,q){if(!q)return super.toJSON($);let Z=new Map;if(q?.onCreate)q.onCreate(Z);for(let Q of this.items){let X,z;if(H1.isPair(Q))X=C9.toJS(Q.key,"",q),z=C9.toJS(Q.value,X,q);else X=C9.toJS(Q,"",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=V1.createPairs($,q,Z),X=new this;return X.items=Q.items,X}}b0.tag="tag:yaml.org,2002:omap";var QX={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:b0,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,q){let Z=V1.resolvePairs($,q),Q=[];for(let{key:X}of Z.items)if(H1.isScalar(X))if(Q.includes(X.value))q(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new b0,Z)},createNode:($,q,Z)=>b0.from($,q,Z)};XX.YAMLOMap=b0;XX.omap=QX});var F1=R((GX)=>{var B1=u();function K1({value:$,source:q},Z){if(q&&($?_1:L1).test.test(q))return q;return $?Z.options.trueStr:Z.options.falseStr}var _1={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new B1.Scalar(!0),stringify:K1},L1={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new B1.Scalar(!1),stringify:K1};GX.falseTag=L1;GX.trueTag=_1});var O1=R((KX)=>{var WX=u(),S9=$$(),HX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:S9.stringifyNumber},VX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let q=Number($.value);return isFinite(q)?q.toExponential():S9.stringifyNumber($)}},BX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let q=new WX.Scalar(parseFloat($.replace(/_/g,""))),Z=$.indexOf(".");if(Z!==-1){let Q=$.substring(Z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")q.minFractionDigits=Q.length}return q},stringify:S9.stringifyNumber};KX.float=BX;KX.floatExp=VX;KX.floatNaN=HX});var I1=R((MX)=>{var A1=$$(),j$=($)=>typeof $==="bigint"||Number.isInteger($);function Mq($,q,Z,{intAsBigInt:Q}){let X=$[0];if(X==="-"||X==="+")q+=1;if($=$.substring(q).replace(/_/g,""),Q){switch(Z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let J=BigInt($);return X==="-"?BigInt(-1)*J:J}let z=parseInt($,Z);return X==="-"?-1*z:z}function b9($,q,Z){let{value:Q}=$;if(j$(Q)){let X=Q.toString(q);return Q<0?"-"+Z+X.substr(1):Z+X}return A1.stringifyNumber($)}var OX={identify:j$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,q,Z)=>Mq($,2,2,Z),stringify:($)=>b9($,2,"0b")},AX={identify:j$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,q,Z)=>Mq($,1,8,Z),stringify:($)=>b9($,8,"0")},IX={identify:j$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,q,Z)=>Mq($,0,10,Z),stringify:A1.stringifyNumber},TX={identify:j$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,q,Z)=>Mq($,2,16,Z),stringify:($)=>b9($,16,"0x")};MX.int=IX;MX.intBin=OX;MX.intHex=TX;MX.intOct=AX});var x9=R((PX)=>{var Dq=f(),jq=O0(),Nq=I0();class x0 extends Nq.YAMLMap{constructor($){super($);this.tag=x0.tag}add($){let q;if(Dq.isPair($))q=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)q=new jq.Pair($.key,null);else q=new jq.Pair($,null);if(!Nq.findPair(this.items,q.key))this.items.push(q)}get($,q){let Z=Nq.findPair(this.items,$);return!q&&Dq.isPair(Z)?Dq.isScalar(Z.key)?Z.key.value:Z.key:Z}set($,q){if(typeof q!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof q}`);let Z=Nq.findPair(this.items,$);if(Z&&!q)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&q)this.items.push(new jq.Pair($))}toJSON($,q){return super.toJSON($,q,Set)}toString($,q,Z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),q,Z);else throw Error("Set items must all have null values")}static from($,q,Z){let{replacer:Q}=Z,X=new this($);if(q&&Symbol.iterator in Object(q))for(let z of q){if(typeof Q==="function")z=Q.call(q,z,z);X.items.push(jq.createPair(z,null,Z))}return X}}x0.tag="tag:yaml.org,2002:set";var wX={collection:"map",identify:($)=>$ instanceof Set,nodeClass:x0,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,q,Z)=>x0.from($,q,Z),resolve($,q){if(Dq.isMap($))if($.hasAllNullValues(!0))return Object.assign(new x0,$);else q("Set items must all have null values");else q("Expected a mapping for this tag");return $}};PX.YAMLSet=x0;PX.set=wX});var k9=R((yX)=>{var SX=$$();function y9($,q){let Z=$[0],Q=Z==="-"||Z==="+"?$.substring(1):$,X=(J)=>q?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 T1($){let{value:q}=$,Z=(J)=>J;if(typeof q==="bigint")Z=(J)=>BigInt(J);else if(isNaN(q)||!isFinite(q))return SX.stringifyNumber($);let Q="";if(q<0)Q="-",q*=Z(-1);let X=Z(60),z=[q%X];if(q<60)z.unshift(0);else if(q=(q-z[0])/X,z.unshift(q%X),q>=60)q=(q-z[0])/X,z.unshift(q);return Q+z.map((J)=>String(J).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var bX={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,q,{intAsBigInt:Z})=>y9($,Z),stringify:T1},xX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>y9($,!1),stringify:T1},M1={identify:($)=>$ 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($){let q=$.match(M1.test);if(!q)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,Q,X,z,J,G]=q.map(Number),Y=q[7]?Number((q[7]+"00").substr(1,3)):0,U=Date.UTC(Z,Q-1,X,z||0,J||0,G||0,Y),V=q[8];if(V&&V!=="Z"){let H=y9(V,!1);if(Math.abs(H)<30)H*=60;U-=60000*H}return new Date(U)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};yX.floatTime=xX;yX.intTime=bX;yX.timestamp=M1});var N1=R((oX)=>{var vX=r0(),gX=Fq(),uX=e0(),mX=I$(),pX=w9(),j1=F1(),f9=O1(),Rq=I1(),dX=Uq(),cX=E9(),lX=Tq(),nX=x9(),h9=k9(),iX=[vX.map,uX.seq,mX.string,gX.nullTag,j1.trueTag,j1.falseTag,Rq.intBin,Rq.intOct,Rq.int,Rq.intHex,f9.floatNaN,f9.floatExp,f9.float,pX.binary,dX.merge,cX.omap,lX.pairs,nX.set,h9.intTime,h9.floatTime,h9.timestamp];oX.schema=iX});var y1=R((Qz)=>{var P1=r0(),sX=Fq(),C1=e0(),tX=I$(),rX=A9(),v9=T9(),g9=j9(),eX=J1(),$z=Y1(),E1=w9(),N$=Uq(),S1=E9(),b1=Tq(),D1=N1(),x1=x9(),wq=k9(),R1=new Map([["core",eX.schema],["failsafe",[P1.map,C1.seq,tX.string]],["json",$z.schema],["yaml11",D1.schema],["yaml-1.1",D1.schema]]),w1={binary:E1.binary,bool:rX.boolTag,float:v9.float,floatExp:v9.floatExp,floatNaN:v9.floatNaN,floatTime:wq.floatTime,int:g9.int,intHex:g9.intHex,intOct:g9.intOct,intTime:wq.intTime,map:P1.map,merge:N$.merge,null:sX.nullTag,omap:S1.omap,pairs:b1.pairs,seq:C1.seq,set:x1.set,timestamp:wq.timestamp},qz={"tag:yaml.org,2002:binary":E1.binary,"tag:yaml.org,2002:merge":N$.merge,"tag:yaml.org,2002:omap":S1.omap,"tag:yaml.org,2002:pairs":b1.pairs,"tag:yaml.org,2002:set":x1.set,"tag:yaml.org,2002:timestamp":wq.timestamp};function Zz($,q,Z){let Q=R1.get(q);if(Q&&!$)return Z&&!Q.includes(N$.merge)?Q.concat(N$.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let z=Array.from(R1.keys()).filter((J)=>J!=="yaml11").map((J)=>JSON.stringify(J)).join(", ");throw Error(`Unknown schema "${q}"; use one of ${z} or define customTags array`)}if(Array.isArray($))for(let z of $)X=X.concat(z);else if(typeof $==="function")X=$(X.slice());if(Z)X=X.concat(N$.merge);return X.reduce((z,J)=>{let G=typeof J==="string"?w1[J]:J;if(!G){let Y=JSON.stringify(J),U=Object.keys(w1).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${Y}; use one of ${U}`)}if(!z.includes(G))z.push(G);return z},[])}Qz.coreKnownTags=qz;Qz.getTags=Zz});var p9=R((Wz)=>{var u9=f(),Jz=r0(),Gz=e0(),Yz=I$(),Pq=y1(),Uz=($,q)=>$.key<q.key?-1:$.key>q.key?1:0;class m9{constructor({compat:$,customTags:q,merge:Z,resolveKnownTags:Q,schema:X,sortMapEntries:z,toStringDefaults:J}){this.compat=Array.isArray($)?Pq.getTags($,"compat"):$?Pq.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?Pq.coreKnownTags:{},this.tags=Pq.getTags(q,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,u9.MAP,{value:Jz.map}),Object.defineProperty(this,u9.SCALAR,{value:Yz.string}),Object.defineProperty(this,u9.SEQ,{value:Gz.seq}),this.sortMapEntries=typeof z==="function"?z:z===!0?Uz:null}clone(){let $=Object.create(m9.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}Wz.Schema=m9});var k1=R((Kz)=>{var Vz=f(),d9=L$(),D$=B$();function Bz($,q){let Z=[],Q=q.directives===!0;if(q.directives!==!1&&$.directives){let Y=$.directives.toString($);if(Y)Z.push(Y),Q=!0;else if($.directives.docStart)Q=!0}if(Q)Z.push("---");let X=d9.createStringifyContext($,q),{commentString:z}=X.options;if($.commentBefore){if(Z.length!==1)Z.unshift("");let Y=z($.commentBefore);Z.unshift(D$.indentComment(Y,""))}let J=!1,G=null;if($.contents){if(Vz.isNode($.contents)){if($.contents.spaceBefore&&Q)Z.push("");if($.contents.commentBefore){let V=z($.contents.commentBefore);Z.push(D$.indentComment(V,""))}X.forceBlockIndent=!!$.comment,G=$.contents.comment}let Y=G?void 0:()=>J=!0,U=d9.stringify($.contents,X,()=>G=null,Y);if(G)U+=D$.lineComment(U,"",z(G));if((U[0]==="|"||U[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${U}`;else Z.push(U)}else Z.push(d9.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let Y=z($.comment);if(Y.includes(`
|
|
56
|
+
`))Z.push("..."),Z.push(D$.indentComment(Y,""));else Z.push(`... ${Y}`)}else Z.push("...");else{let Y=$.comment;if(Y&&J)Y=Y.replace(/^\n+/,"");if(Y){if((!J||G)&&Z[Z.length-1]!=="")Z.push("");Z.push(D$.indentComment(z(Y),""))}}return Z.join(`
|
|
57
57
|
`)+`
|
|
58
|
-
`}
|
|
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
|
|
58
|
+
`}Kz.stringifyDocument=Bz});var R$=R((jz)=>{var Lz=H$(),q$=Qq(),$0=f(),Fz=O0(),Oz=_0(),Az=p9(),Iz=k1(),c9=$q(),Tz=U9(),Mz=V$(),l9=Y9();class n9{constructor($,q,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,$0.NODE_TYPE,{value:$0.DOC});let Q=null;if(typeof q==="function"||Array.isArray(q))Q=q;else if(Z===void 0&&q)Z=q,q=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 l9.Directives({version:z});this.setSchema(z,Z),this.contents=$===void 0?null:this.createNode($,Q,Z)}clone(){let $=Object.create(n9.prototype,{[$0.NODE_TYPE]:{value:$0.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=$0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(Z$(this.contents))this.contents.add($)}addIn($,q){if(Z$(this.contents))this.contents.addIn($,q)}createAlias($,q){if(!$.anchor){let Z=c9.anchorNames(this);$.anchor=!q||Z.has(q)?c9.findNewAnchor(q||"a",Z):q}return new Lz.Alias($.anchor)}createNode($,q,Z){let Q=void 0;if(typeof q==="function")$=q.call({"":$},"",$),Q=q;else if(Array.isArray(q)){let K=(O)=>typeof O==="number"||O instanceof String||O instanceof Number,F=q.filter(K).map(String);if(F.length>0)q=q.concat(F);Q=q}else if(Z===void 0&&q)Z=q,q=void 0;let{aliasDuplicateObjects:X,anchorPrefix:z,flow:J,keepUndefined:G,onTagObj:Y,tag:U}=Z??{},{onAnchor:V,setAnchors:H,sourceObjects:B}=c9.createNodeAnchors(this,z||"a"),_={aliasDuplicateObjects:X??!0,keepUndefined:G??!1,onAnchor:V,onTagObj:Y,replacer:Q,schema:this.schema,sourceObjects:B},L=Mz.createNode($,U,_);if(J&&$0.isCollection(L))L.flow=!0;return H(),L}createPair($,q,Z={}){let Q=this.createNode($,null,Z),X=this.createNode(q,null,Z);return new Fz.Pair(Q,X)}delete($){return Z$(this.contents)?this.contents.delete($):!1}deleteIn($){if(q$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return Z$(this.contents)?this.contents.deleteIn($):!1}get($,q){return $0.isCollection(this.contents)?this.contents.get($,q):void 0}getIn($,q){if(q$.isEmptyPath($))return!q&&$0.isScalar(this.contents)?this.contents.value:this.contents;return $0.isCollection(this.contents)?this.contents.getIn($,q):void 0}has($){return $0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(q$.isEmptyPath($))return this.contents!==void 0;return $0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,q){if(this.contents==null)this.contents=q$.collectionFromPath(this.schema,[$],q);else if(Z$(this.contents))this.contents.set($,q)}setIn($,q){if(q$.isEmptyPath($))this.contents=q;else if(this.contents==null)this.contents=q$.collectionFromPath(this.schema,Array.from($),q);else if(Z$(this.contents))this.contents.setIn($,q)}setSchema($,q={}){if(typeof $==="number")$=String($);let Z;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new l9.Directives({version:"1.1"});Z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new l9.Directives({version:$});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let Q=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Q}`)}}if(q.schema instanceof Object)this.schema=q.schema;else if(Z)this.schema=new Az.Schema(Object.assign(Z,q));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:q,mapAsMap:Z,maxAliasCount:Q,onAnchor:X,reviver:z}={}){let J={anchors:new Map,doc:this,keep:!$,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},G=Oz.toJS(this.contents,q??"",J);if(typeof X==="function")for(let{count:Y,res:U}of J.anchors.values())X(U,Y);return typeof z==="function"?Tz.applyReviver(z,{"":G},"",G):G}toJSON($,q){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:q})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let q=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${q}`)}return Iz.stringifyDocument(this,$)}}function Z$($){if($0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}jz.Document=n9});var w$=R((Rz)=>{class Cq extends Error{constructor($,q,Z,Q){super();this.name=$,this.code=Z,this.message=Q,this.pos=q}}class f1 extends Cq{constructor($,q,Z){super("YAMLParseError",$,q,Z)}}class h1 extends Cq{constructor($,q,Z){super("YAMLWarning",$,q,Z)}}var Dz=($,q)=>(Z)=>{if(Z.pos[0]===-1)return;Z.linePos=Z.pos.map((G)=>q.linePos(G));let{line:Q,col:X}=Z.linePos[0];Z.message+=` at line ${Q}, column ${X}`;let z=X-1,J=$.substring(q.lineStarts[Q-1],q.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=$.substring(q.lineStarts[Q-2],q.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 U=" ".repeat(z)+"^".repeat(G);Z.message+=`:
|
|
60
60
|
|
|
61
61
|
${J}
|
|
62
|
-
${
|
|
63
|
-
`}};
|
|
64
|
-
`))return!0;if(
|
|
65
|
-
`+
|
|
66
|
-
`+
|
|
67
|
-
`+
|
|
68
|
-
`+x;else
|
|
69
|
-
`+
|
|
70
|
-
`+
|
|
71
|
-
`.repeat(Math.max(1,J.length-1)):"",
|
|
72
|
-
`;for(let
|
|
73
|
-
`;else if(
|
|
74
|
-
`;else if(!
|
|
75
|
-
`)
|
|
76
|
-
|
|
77
|
-
`;
|
|
78
|
-
`,
|
|
79
|
-
`)
|
|
80
|
-
`;else
|
|
81
|
-
`;else
|
|
82
|
-
`+J[
|
|
83
|
-
`)
|
|
84
|
-
`;break;default:
|
|
85
|
-
`}let L=Q+X.length
|
|
62
|
+
${U}
|
|
63
|
+
`}};Rz.YAMLError=Cq;Rz.YAMLParseError=f1;Rz.YAMLWarning=h1;Rz.prettifyError=Dz});var P$=R((bz)=>{function Sz($,{flow:q,indicator:Z,next:Q,offset:X,onError:z,parentIndent:J,startOnNewline:G}){let Y=!1,U=G,V=G,H="",B="",_=!1,L=!1,K=null,F=null,O=null,A=null,M=null,N=null,T=null;for(let P of $){if(L){if(P.type!=="space"&&P.type!=="newline"&&P.type!=="comma")z(P.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(K){if(U&&P.type!=="comment"&&P.type!=="newline")z(K,"TAB_AS_INDENT","Tabs are not allowed as indentation");K=null}switch(P.type){case"space":if(!q&&(Z!=="doc-start"||Q?.type!=="flow-collection")&&P.source.includes("\t"))K=P;V=!0;break;case"comment":{if(!V)z(P,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let k=P.source.substring(1)||" ";if(!H)H=k;else H+=B+k;B="",U=!1;break}case"newline":if(U){if(H)H+=P.source;else if(!N||Z!=="seq-item-ind")Y=!0}else B+=P.source;if(U=!0,_=!0,F||O)A=P;V=!0;break;case"anchor":if(F)z(P,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(P.source.endsWith(":"))z(P.offset+P.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);F=P,T??(T=P.offset),U=!1,V=!1,L=!0;break;case"tag":{if(O)z(P,"MULTIPLE_TAGS","A node can have at most one tag");O=P,T??(T=P.offset),U=!1,V=!1,L=!0;break}case Z:if(F||O)z(P,"BAD_PROP_ORDER",`Anchors and tags must be after the ${P.source} indicator`);if(N)z(P,"UNEXPECTED_TOKEN",`Unexpected ${P.source} in ${q??"collection"}`);N=P,U=Z==="seq-item-ind"||Z==="explicit-key-ind",V=!1;break;case"comma":if(q){if(M)z(P,"UNEXPECTED_TOKEN",`Unexpected , in ${q}`);M=P,U=!1,V=!1;break}default:z(P,"UNEXPECTED_TOKEN",`Unexpected ${P.type} token`),U=!1,V=!1}}let D=$[$.length-1],x=D?D.offset+D.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(K&&(U&&K.indent<=J||Q?.type==="block-map"||Q?.type==="block-seq"))z(K,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:M,found:N,spaceBefore:Y,comment:H,hasNewline:_,anchor:F,tag:O,newlineAfterProp:A,end:x,start:T??x}}bz.resolveProps=Sz});var Eq=R((yz)=>{function i9($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
|
|
64
|
+
`))return!0;if($.end){for(let q of $.end)if(q.type==="newline")return!0}return!1;case"flow-collection":for(let q of $.items){for(let Z of q.start)if(Z.type==="newline")return!0;if(q.sep){for(let Z of q.sep)if(Z.type==="newline")return!0}if(i9(q.key)||i9(q.value))return!0}return!1;default:return!0}}yz.containsNewline=i9});var o9=R((vz)=>{var fz=Eq();function hz($,q,Z){if(q?.type==="flow-collection"){let Q=q.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&fz.containsNewline(q))Z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}vz.flowIndentCheck=hz});var a9=R((mz)=>{var v1=f();function uz($,q,Z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(z,J)=>z===J||v1.isScalar(z)&&v1.isScalar(J)&&z.value===J.value;return q.some((z)=>X(z.key,Z))}mz.mapIncludes=uz});var d1=R((iz)=>{var g1=O0(),dz=I0(),u1=P$(),cz=Eq(),m1=o9(),lz=a9(),p1="All mapping items must start at the same column";function nz({composeNode:$,composeEmptyNode:q},Z,Q,X,z){let G=new(z?.nodeClass??dz.YAMLMap)(Z.schema);if(Z.atRoot)Z.atRoot=!1;let Y=Q.offset,U=null;for(let V of Q.items){let{start:H,key:B,sep:_,value:L}=V,K=u1.resolveProps(H,{indicator:"explicit-key-ind",next:B??_?.[0],offset:Y,onError:X,parentIndent:Q.indent,startOnNewline:!0}),F=!K.found;if(F){if(B){if(B.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 B&&B.indent!==Q.indent)X(Y,"BAD_INDENT",p1)}if(!K.anchor&&!K.tag&&!_){if(U=K.end,K.comment)if(G.comment)G.comment+=`
|
|
65
|
+
`+K.comment;else G.comment=K.comment;continue}if(K.newlineAfterProp||cz.containsNewline(B))X(B??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(K.found?.indent!==Q.indent)X(Y,"BAD_INDENT",p1);Z.atKey=!0;let O=K.end,A=B?$(Z,B,K,X):q(Z,O,H,null,K,X);if(Z.schema.compat)m1.flowIndentCheck(Q.indent,B,X);if(Z.atKey=!1,lz.mapIncludes(Z,G.items,A))X(O,"DUPLICATE_KEY","Map keys must be unique");let M=u1.resolveProps(_??[],{indicator:"map-value-ind",next:L,offset:A.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!B||B.type==="block-scalar"});if(Y=M.end,M.found){if(F){if(L?.type==="block-map"&&!M.hasNewline)X(Y,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(Z.options.strict&&K.start<M.found.offset-1024)X(A.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let N=L?$(Z,L,M,X):q(Z,Y,_,null,M,X);if(Z.schema.compat)m1.flowIndentCheck(Q.indent,L,X);Y=N.range[2];let T=new g1.Pair(A,N);if(Z.options.keepSourceTokens)T.srcToken=V;G.items.push(T)}else{if(F)X(A.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(M.comment)if(A.comment)A.comment+=`
|
|
66
|
+
`+M.comment;else A.comment=M.comment;let N=new g1.Pair(A);if(Z.options.keepSourceTokens)N.srcToken=V;G.items.push(N)}}if(U&&U<Y)X(U,"IMPOSSIBLE","Map comment with trailing content");return G.range=[Q.offset,Y,U??Y],G}iz.resolveBlockMap=nz});var c1=R((ez)=>{var az=T0(),sz=P$(),tz=o9();function rz({composeNode:$,composeEmptyNode:q},Z,Q,X,z){let G=new(z?.nodeClass??az.YAMLSeq)(Z.schema);if(Z.atRoot)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let Y=Q.offset,U=null;for(let{start:V,value:H}of Q.items){let B=sz.resolveProps(V,{indicator:"seq-item-ind",next:H,offset:Y,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!B.found)if(B.anchor||B.tag||H)if(H?.type==="block-seq")X(B.end,"BAD_INDENT","All sequence items must start at the same column");else X(Y,"MISSING_CHAR","Sequence item without - indicator");else{if(U=B.end,B.comment)G.comment=B.comment;continue}let _=H?$(Z,H,B,X):q(Z,B.end,V,null,B,X);if(Z.schema.compat)tz.flowIndentCheck(Q.indent,H,X);Y=_.range[2],G.items.push(_)}return G.range=[Q.offset,Y,U??Y],G}ez.resolveBlockSeq=rz});var Q$=R((ZJ)=>{function qJ($,q,Z,Q){let X="";if($){let z=!1,J="";for(let G of $){let{source:Y,type:U}=G;switch(U){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 V=Y.substring(1)||" ";if(!X)X=V;else X+=J+V;J="";break}case"newline":if(X)J+=Y;z=!0;break;default:Q(G,"UNEXPECTED_TOKEN",`Unexpected ${U} at node end`)}q+=Y.length}}return{comment:X,offset:q}}ZJ.resolveEnd=qJ});var i1=R((HJ)=>{var XJ=f(),zJ=O0(),l1=I0(),JJ=T0(),GJ=Q$(),n1=P$(),YJ=Eq(),UJ=a9(),s9="Block collections are not allowed within flow collections",t9=($)=>$&&($.type==="block-map"||$.type==="block-seq");function WJ({composeNode:$,composeEmptyNode:q},Z,Q,X,z){let J=Q.start.source==="{",G=J?"flow map":"flow sequence",U=new(z?.nodeClass??(J?l1.YAMLMap:JJ.YAMLSeq))(Z.schema);U.flow=!0;let V=Z.atRoot;if(V)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let H=Q.offset+Q.start.source.length;for(let F=0;F<Q.items.length;++F){let O=Q.items[F],{start:A,key:M,sep:N,value:T}=O,D=n1.resolveProps(A,{flow:G,indicator:"explicit-key-ind",next:M??N?.[0],offset:H,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!D.found){if(!D.anchor&&!D.tag&&!N&&!T){if(F===0&&D.comma)X(D.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`);else if(F<Q.items.length-1)X(D.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${G}`);if(D.comment)if(U.comment)U.comment+=`
|
|
67
|
+
`+D.comment;else U.comment=D.comment;H=D.end;continue}if(!J&&Z.options.strict&&YJ.containsNewline(M))X(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(F===0){if(D.comma)X(D.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`)}else{if(!D.comma)X(D.start,"MISSING_CHAR",`Missing , between ${G} items`);if(D.comment){let x="";$:for(let P of A)switch(P.type){case"comma":case"space":break;case"comment":x=P.source.substring(1);break $;default:break $}if(x){let P=U.items[U.items.length-1];if(XJ.isPair(P))P=P.value??P.key;if(P.comment)P.comment+=`
|
|
68
|
+
`+x;else P.comment=x;D.comment=D.comment.substring(x.length+1)}}}if(!J&&!N&&!D.found){let x=T?$(Z,T,D,X):q(Z,D.end,N,null,D,X);if(U.items.push(x),H=x.range[2],t9(T))X(x.range,"BLOCK_IN_FLOW",s9)}else{Z.atKey=!0;let x=D.end,P=M?$(Z,M,D,X):q(Z,x,A,null,D,X);if(t9(M))X(P.range,"BLOCK_IN_FLOW",s9);Z.atKey=!1;let k=n1.resolveProps(N??[],{flow:G,indicator:"map-value-ind",next:T,offset:P.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(k.found){if(!J&&!D.found&&Z.options.strict){if(N)for(let C of N){if(C===k.found)break;if(C.type==="newline"){X(C,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(D.start<k.found.offset-1024)X(k.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(T)if("source"in T&&T.source?.[0]===":")X(T,"MISSING_CHAR",`Missing space after : in ${G}`);else X(k.start,"MISSING_CHAR",`Missing , or : between ${G} items`);let I=T?$(Z,T,k,X):k.found?q(Z,k.end,N,null,k,X):null;if(I){if(t9(T))X(I.range,"BLOCK_IN_FLOW",s9)}else if(k.comment)if(P.comment)P.comment+=`
|
|
69
|
+
`+k.comment;else P.comment=k.comment;let j=new zJ.Pair(P,I);if(Z.options.keepSourceTokens)j.srcToken=O;if(J){let C=U;if(UJ.mapIncludes(Z,C.items,P))X(x,"DUPLICATE_KEY","Map keys must be unique");C.items.push(j)}else{let C=new l1.YAMLMap(Z.schema);C.flow=!0,C.items.push(j);let S=(I??P).range;C.range=[P.range[0],S[1],S[2]],U.items.push(C)}H=I?I.range[2]:k.end}}let B=J?"}":"]",[_,...L]=Q.end,K=H;if(_?.source===B)K=_.offset+_.source.length;else{let F=G[0].toUpperCase()+G.substring(1),O=V?`${F} must end with a ${B}`:`${F} in block collection must be sufficiently indented and end with a ${B}`;if(X(H,V?"MISSING_CHAR":"BAD_INDENT",O),_&&_.source.length!==1)L.unshift(_)}if(L.length>0){let F=GJ.resolveEnd(L,K,Z.options.strict,X);if(F.comment)if(U.comment)U.comment+=`
|
|
70
|
+
`+F.comment;else U.comment=F.comment;U.range=[Q.offset,K,F.offset]}else U.range=[Q.offset,K,K];return U}HJ.resolveFlowCollection=WJ});var o1=R((TJ)=>{var BJ=f(),KJ=u(),_J=I0(),LJ=T0(),FJ=d1(),OJ=c1(),AJ=i1();function r9($,q,Z,Q,X,z){let J=Z.type==="block-map"?FJ.resolveBlockMap($,q,Z,Q,z):Z.type==="block-seq"?OJ.resolveBlockSeq($,q,Z,Q,z):AJ.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 IJ($,q,Z,Q,X){let z=Q.tag,J=!z?null:q.directives.tagName(z.source,(B)=>X(z,"TAG_RESOLVE_FAILED",B));if(Z.type==="block-seq"){let{anchor:B,newlineAfterProp:_}=Q,L=B&&z?B.offset>z.offset?B:z:B??z;if(L&&(!_||_.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===_J.YAMLMap.tagName&&G==="map"||J===LJ.YAMLSeq.tagName&&G==="seq")return r9($,q,Z,X,J);let Y=q.schema.tags.find((B)=>B.tag===J&&B.collection===G);if(!Y){let B=q.schema.knownTags[J];if(B?.collection===G)q.schema.tags.push(Object.assign({},B,{default:!1})),Y=B;else{if(B)X(z,"BAD_COLLECTION_TYPE",`${B.tag} used for ${G} collection, but expects ${B.collection??"scalar"}`,!0);else X(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${J}`,!0);return r9($,q,Z,X,J)}}let U=r9($,q,Z,X,J,Y),V=Y.resolve?.(U,(B)=>X(z,"TAG_RESOLVE_FAILED",B),q.options)??U,H=BJ.isNode(V)?V:new KJ.Scalar(V);if(H.range=U.range,H.tag=J,Y?.format)H.format=Y.format;return H}TJ.composeCollection=IJ});var $4=R((RJ)=>{var e9=u();function jJ($,q,Z){let Q=q.offset,X=NJ(q,$.options.strict,Z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let z=X.mode===">"?e9.Scalar.BLOCK_FOLDED:e9.Scalar.BLOCK_LITERAL,J=q.source?DJ(q.source):[],G=J.length;for(let K=J.length-1;K>=0;--K){let F=J[K][1];if(F===""||F==="\r")G=K;else break}if(G===0){let K=X.chomp==="+"&&J.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,J.length-1)):"",F=Q+X.length;if(q.source)F+=q.source.length;return{value:K,type:z,comment:X.comment,range:[Q,F,F]}}let Y=q.indent+X.indent,U=q.offset+X.length,V=0;for(let K=0;K<G;++K){let[F,O]=J[K];if(O===""||O==="\r"){if(X.indent===0&&F.length>Y)Y=F.length}else{if(F.length<Y)Z(U+F.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)Y=F.length;if(V=K,Y===0&&!$.atRoot)Z(U,"BAD_INDENT","Block scalar values in collections must be indented");break}U+=F.length+O.length+1}for(let K=J.length-1;K>=G;--K)if(J[K][0].length>Y)G=K+1;let H="",B="",_=!1;for(let K=0;K<V;++K)H+=J[K][0].slice(Y)+`
|
|
72
|
+
`;for(let K=V;K<G;++K){let[F,O]=J[K];U+=F.length+O.length+1;let A=O[O.length-1]==="\r";if(A)O=O.slice(0,-1);if(O&&F.length<Y){let N=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;Z(U-O.length-(A?2:1),"BAD_INDENT",N),F=""}if(z===e9.Scalar.BLOCK_LITERAL)H+=B+F.slice(Y)+O,B=`
|
|
73
|
+
`;else if(F.length>Y||O[0]==="\t"){if(B===" ")B=`
|
|
74
|
+
`;else if(!_&&B===`
|
|
75
|
+
`)B=`
|
|
76
|
+
|
|
77
|
+
`;H+=B+F.slice(Y)+O,B=`
|
|
78
|
+
`,_=!0}else if(O==="")if(B===`
|
|
79
|
+
`)H+=`
|
|
80
|
+
`;else B=`
|
|
81
|
+
`;else H+=B+O,B=" ",_=!1}switch(X.chomp){case"-":break;case"+":for(let K=G;K<J.length;++K)H+=`
|
|
82
|
+
`+J[K][0].slice(Y);if(H[H.length-1]!==`
|
|
83
|
+
`)H+=`
|
|
84
|
+
`;break;default:H+=`
|
|
85
|
+
`}let L=Q+X.length+q.source.length;return{value:H,type:z,comment:X.comment,range:[Q,L,L]}}function NJ({offset:$,props:q},Z,Q){if(q[0].type!=="block-scalar-header")return Q(q[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=q[0],z=X[0],J=0,G="",Y=-1;for(let B=1;B<X.length;++B){let _=X[B];if(!G&&(_==="-"||_==="+"))G=_;else{let L=Number(_);if(!J&&L)J=L;else if(Y===-1)Y=$+B}}if(Y!==-1)Q(Y,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let U=!1,V="",H=X.length;for(let B=1;B<q.length;++B){let _=q[B];switch(_.type){case"space":U=!0;case"newline":H+=_.source.length;break;case"comment":if(Z&&!U)Q(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=_.source.length,V=_.source.substring(1);break;case"error":Q(_,"UNEXPECTED_TOKEN",_.message),H+=_.source.length;break;default:{let L=`Unexpected token in block scalar header: ${_.type}`;Q(_,"UNEXPECTED_TOKEN",L);let K=_.source;if(K&&typeof K==="string")H+=K.length}}}return{mode:z,indent:J,chomp:G,comment:V,length:H}}function DJ($){let q=$.split(/\n( *)/),Z=q[0],Q=Z.match(/^( *)/),z=[Q?.[1]?[Q[1],Z.slice(Q[1].length)]:["",Z]];for(let J=1;J<q.length;J+=2)z.push([q[J],q[J+1]]);return z}RJ.resolveBlockScalar=jJ});var Z4=R((fJ)=>{var q4=u(),PJ=Q$();function CJ($,q,Z){let{offset:Q,type:X,source:z,end:J}=$,G,Y,U=(B,_,L)=>Z(Q+B,_,L);switch(X){case"scalar":G=q4.Scalar.PLAIN,Y=EJ(z,U);break;case"single-quoted-scalar":G=q4.Scalar.QUOTE_SINGLE,Y=SJ(z,U);break;case"double-quoted-scalar":G=q4.Scalar.QUOTE_DOUBLE,Y=bJ(z,U);break;default:return Z($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${X}`),{value:"",type:null,comment:"",range:[Q,Q+z.length,Q+z.length]}}let V=Q+z.length,H=PJ.resolveEnd(J,V,q,Z);return{value:Y,type:G,comment:H.comment,range:[Q,V,H.offset]}}function EJ($,q){let Z="";switch($[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 ${$[0]}`;break}case"@":case"`":{Z=`reserved character ${$[0]}`;break}}if(Z)q(0,"BAD_SCALAR_START",`Plain value cannot start with ${Z}`);return a1($)}function SJ($,q){if($[$.length-1]!=="'"||$.length===1)q($.length,"MISSING_CHAR","Missing closing 'quote");return a1($.slice(1,-1)).replace(/''/g,"'")}function a1($){let q,Z;try{q=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
86
|
`,"sy"),Z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
|
-
`,"sy")}catch{
|
|
87
|
+
`,"sy")}catch{q=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Q=q.exec($);if(!Q)return $;let X=Q[1],z=" ",J=q.lastIndex;Z.lastIndex=J;while(Q=Z.exec($)){if(Q[1]==="")if(z===`
|
|
88
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(
|
|
89
|
+
`;else X+=z+Q[1],z=" ";J=Z.lastIndex}let G=/[ \t]*(.*)/sy;return G.lastIndex=J,Q=G.exec($),X+z+(Q?.[1]??"")}function bJ($,q){let Z="";for(let Q=1;Q<$.length-1;++Q){let X=$[Q];if(X==="\r"&&$[Q+1]===`
|
|
90
90
|
`)continue;if(X===`
|
|
91
|
-
`){let{fold:z,offset:J}=
|
|
92
|
-
`){z
|
|
93
|
-
`){z
|
|
94
|
-
`&&!(J==="\r"
|
|
95
|
-
`))Z+=Q>z
|
|
96
|
-
`||Q==="\r"){if(Q==="\r"
|
|
91
|
+
`){let{fold:z,offset:J}=xJ($,Q);Z+=z,Q=J}else if(X==="\\"){let z=$[++Q],J=yJ[z];if(J)Z+=J;else if(z===`
|
|
92
|
+
`){z=$[Q+1];while(z===" "||z==="\t")z=$[++Q+1]}else if(z==="\r"&&$[Q+1]===`
|
|
93
|
+
`){z=$[++Q+1];while(z===" "||z==="\t")z=$[++Q+1]}else if(z==="x"||z==="u"||z==="U"){let G={x:2,u:4,U:8}[z];Z+=kJ($,Q+1,G,q),Q+=G}else{let G=$.substr(Q-1,2);q(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),Z+=G}}else if(X===" "||X==="\t"){let z=Q,J=$[Q+1];while(J===" "||J==="\t")J=$[++Q+1];if(J!==`
|
|
94
|
+
`&&!(J==="\r"&&$[Q+2]===`
|
|
95
|
+
`))Z+=Q>z?$.slice(z,Q+1):X}else Z+=X}if($[$.length-1]!=='"'||$.length===1)q($.length,"MISSING_CHAR",'Missing closing "quote');return Z}function xJ($,q){let Z="",Q=$[q+1];while(Q===" "||Q==="\t"||Q===`
|
|
96
|
+
`||Q==="\r"){if(Q==="\r"&&$[q+2]!==`
|
|
97
97
|
`)break;if(Q===`
|
|
98
98
|
`)Z+=`
|
|
99
|
-
|
|
100
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
99
|
+
`;q+=1,Q=$[q+1]}if(!Z)Z=" ";return{fold:Z,offset:q}}var yJ={"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 kJ($,q,Z,Q){let X=$.substr(q,Z),J=X.length===Z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;if(isNaN(J)){let G=$.substr(q-2,Z+2);return Q(q-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),G}return String.fromCodePoint(J)}fJ.resolveFlowScalar=CJ});var t1=R((dJ)=>{var y0=f(),s1=u(),vJ=$4(),gJ=Z4();function uJ($,q,Z,Q){let{value:X,type:z,comment:J,range:G}=q.type==="block-scalar"?vJ.resolveBlockScalar($,q,Q):gJ.resolveFlowScalar(q,$.options.strict,Q),Y=Z?$.directives.tagName(Z.source,(H)=>Q(Z,"TAG_RESOLVE_FAILED",H)):null,U;if($.options.stringKeys&&$.atKey)U=$.schema[y0.SCALAR];else if(Y)U=mJ($.schema,X,Y,Z,Q);else if(q.type==="scalar")U=pJ($,X,q,Q);else U=$.schema[y0.SCALAR];let V;try{let H=U.resolve(X,(B)=>Q(Z??q,"TAG_RESOLVE_FAILED",B),$.options);V=y0.isScalar(H)?H:new s1.Scalar(H)}catch(H){let B=H instanceof Error?H.message:String(H);Q(Z??q,"TAG_RESOLVE_FAILED",B),V=new s1.Scalar(X)}if(V.range=G,V.source=X,z)V.type=z;if(Y)V.tag=Y;if(U.format)V.format=U.format;if(J)V.comment=J;return V}function mJ($,q,Z,Q,X){if(Z==="!")return $[y0.SCALAR];let z=[];for(let G of $.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(q))return G;let J=$.knownTags[Z];if(J&&!J.collection)return $.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"),$[y0.SCALAR]}function pJ({atKey:$,directives:q,schema:Z},Q,X,z){let J=Z.tags.find((G)=>(G.default===!0||$&&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=q.tagString(J.tag),U=q.tagString(G.tag),V=`Value may be parsed as either ${Y} or ${U}`;z(X,"TAG_RESOLVE_FAILED",V,!0)}}return J}dJ.composeScalar=uJ});var r1=R((nJ)=>{function lJ($,q,Z){if(q){Z??(Z=q.length);for(let Q=Z-1;Q>=0;--Q){let X=q[Q];switch(X.type){case"space":case"comment":case"newline":$-=X.source.length;continue}X=q[++Q];while(X?.type==="space")$+=X.source.length,X=q[++Q];break}}return $}nJ.emptyScalarPosition=lJ});var q5=R((qG)=>{var oJ=H$(),aJ=f(),sJ=o1(),e1=t1(),tJ=Q$(),rJ=r1(),eJ={composeNode:$5,composeEmptyNode:Q4};function $5($,q,Z,Q){let X=$.atKey,{spaceBefore:z,comment:J,anchor:G,tag:Y}=Z,U,V=!0;switch(q.type){case"alias":if(U=$G($,q,Q),G||Y)Q(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(U=e1.composeScalar($,q,Y,Q),G)U.anchor=G.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(U=sJ.composeCollection(eJ,$,q,Z,Q),G)U.anchor=G.source.substring(1)}catch(H){let B=H instanceof Error?H.message:String(H);Q(q,"RESOURCE_EXHAUSTION",B)}break;default:{let H=q.type==="error"?q.message:`Unsupported token (type: ${q.type})`;Q(q,"UNEXPECTED_TOKEN",H),V=!1}}if(U??(U=Q4($,q.offset,void 0,null,Z,Q)),G&&U.anchor==="")Q(G,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!aJ.isScalar(U)||typeof U.value!=="string"||U.tag&&U.tag!=="tag:yaml.org,2002:str"))Q(Y??q,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(z)U.spaceBefore=!0;if(J)if(q.type==="scalar"&&q.source==="")U.comment=J;else U.commentBefore=J;if($.options.keepSourceTokens&&V)U.srcToken=q;return U}function Q4($,q,Z,Q,{spaceBefore:X,comment:z,anchor:J,tag:G,end:Y},U){let V={type:"scalar",offset:rJ.emptyScalarPosition(q,Z,Q),indent:-1,source:""},H=e1.composeScalar($,V,G,U);if(J){if(H.anchor=J.source.substring(1),H.anchor==="")U(J,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)H.spaceBefore=!0;if(z)H.comment=z,H.range[2]=Y;return H}function $G({options:$},{offset:q,source:Z,end:Q},X){let z=new oJ.Alias(Z.substring(1));if(z.source==="")X(q,"BAD_ALIAS","Alias cannot be an empty string");if(z.source.endsWith(":"))X(q+Z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let J=q+Z.length,G=tJ.resolveEnd(Q,J,$.strict,X);if(z.range=[q,J,G.offset],G.comment)z.comment=G.comment;return z}qG.composeEmptyNode=Q4;qG.composeNode=$5});var Q5=R((YG)=>{var XG=R$(),Z5=q5(),zG=Q$(),JG=P$();function GG($,q,{offset:Z,start:Q,value:X,end:z},J){let G=Object.assign({_directives:q},$),Y=new XG.Document(void 0,G),U={atKey:!1,atRoot:!0,directives:Y.directives,options:Y.options,schema:Y.schema},V=JG.resolveProps(Q,{indicator:"doc-start",next:X??z?.[0],offset:Z,onError:J,parentIndent:0,startOnNewline:!0});if(V.found){if(Y.directives.docStart=!0,X&&(X.type==="block-map"||X.type==="block-seq")&&!V.hasNewline)J(V.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}Y.contents=X?Z5.composeNode(U,X,V,J):Z5.composeEmptyNode(U,V.end,Q,null,V,J);let H=Y.contents.range[2],B=zG.resolveEnd(z,H,!1,J);if(B.comment)Y.comment=B.comment;return Y.range=[Z,H,B.offset],Y}YG.composeDoc=GG});var X4=R((_G)=>{var WG=h("process"),HG=Y9(),VG=R$(),C$=w$(),X5=f(),BG=Q5(),KG=Q$();function E$($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:q,source:Z}=$;return[q,q+(typeof Z==="string"?Z.length:1)]}function z5($){let q="",Z=!1,Q=!1;for(let X=0;X<$.length;++X){let z=$[X];switch(z[0]){case"#":q+=(q===""?"":Q?`
|
|
101
101
|
|
|
102
102
|
`:`
|
|
103
|
-
`)+(z.substring(1)||" "),Z=!0,Q=!1;break;case"%":if(
|
|
104
|
-
${Z}`:Z;else if(Q
|
|
103
|
+
`)+(z.substring(1)||" "),Z=!0,Q=!1;break;case"%":if($[X+1]?.[0]!=="#")X+=1;Z=!1;break;default:if(!Z)Q=!0;Z=!1}}return{comment:q,afterEmptyLine:Q}}class J5{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(q,Z,Q,X)=>{let z=E$(q);if(X)this.warnings.push(new C$.YAMLWarning(z,Z,Q));else this.errors.push(new C$.YAMLParseError(z,Z,Q))},this.directives=new HG.Directives({version:$.version||"1.2"}),this.options=$}decorate($,q){let{comment:Z,afterEmptyLine:Q}=z5(this.prelude);if(Z){let X=$.contents;if(q)$.comment=$.comment?`${$.comment}
|
|
104
|
+
${Z}`:Z;else if(Q||$.directives.docStart||!X)$.commentBefore=Z;else if(X5.isCollection(X)&&!X.flow&&X.items.length>0){let z=X.items[0];if(X5.isPair(z))z=z.key;let J=z.commentBefore;z.commentBefore=J?`${Z}
|
|
105
105
|
${J}`:Z}else{let z=X.commentBefore;X.commentBefore=z?`${Z}
|
|
106
|
-
${z}`:Z}}if(
|
|
107
|
-
${
|
|
108
|
-
`}];switch(G[0]){case"|":case">":{let
|
|
109
|
-
`),
|
|
110
|
-
`,
|
|
111
|
-
`});return{type:"block-scalar",offset:z,indent:Q,props:
|
|
112
|
-
`),Q
|
|
113
|
-
`;if(
|
|
114
|
-
`});for(let Y of Object.keys(
|
|
115
|
-
`};delete
|
|
106
|
+
${z}`:Z}}if(q)Array.prototype.push.apply($.errors,this.errors),Array.prototype.push.apply($.warnings,this.warnings);else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:z5(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,q=!1,Z=-1){for(let Q of $)yield*this.next(Q);yield*this.end(q,Z)}*next($){if(WG.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(q,Z,Q)=>{let X=E$($);X[0]+=q,this.onError(X,"BAD_DIRECTIVE",Z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let q=BG.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!q.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(q,!1),this.doc)yield this.doc;this.doc=q,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let q=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,Z=new C$.YAMLParseError(E$($),"UNEXPECTED_TOKEN",q);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 C$.YAMLParseError(E$($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let q=KG.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),q.comment){let Z=this.doc.comment;this.doc.comment=Z?`${Z}
|
|
107
|
+
${q.comment}`:q.comment}this.doc.range[2]=q.offset;break}default:this.errors.push(new C$.YAMLParseError(E$($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,q=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let Z=Object.assign({_directives:this.directives},this.options),Q=new VG.Document(void 0,Z);if(this.atDirectives)this.onError(q,"MISSING_CHAR","Missing directives-end indicator line");Q.range=[0,q,q],this.decorate(Q,!1),yield Q}}}_G.Composer=J5});var U5=R((NG)=>{var FG=$4(),OG=Z4(),AG=w$(),G5=_$();function IG($,q=!0,Z){if($){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 AG.YAMLParseError([G,G+1],z,J)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return OG.resolveFlowScalar($,q,Q);case"block-scalar":return FG.resolveBlockScalar({options:{strict:q}},$,Q)}}return null}function TG($,q){let{implicitKey:Z=!1,indent:Q,inFlow:X=!1,offset:z=-1,type:J="PLAIN"}=q,G=G5.stringifyString({type:J,value:$},{implicitKey:Z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),Y=q.end??[{type:"newline",offset:-1,indent:Q,source:`
|
|
108
|
+
`}];switch(G[0]){case"|":case">":{let U=G.indexOf(`
|
|
109
|
+
`),V=G.substring(0,U),H=G.substring(U+1)+`
|
|
110
|
+
`,B=[{type:"block-scalar-header",offset:z,indent:Q,source:V}];if(!Y5(B,Y))B.push({type:"newline",offset:-1,indent:Q,source:`
|
|
111
|
+
`});return{type:"block-scalar",offset:z,indent:Q,props:B,source:H}}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 MG($,q,Z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:z=!1,type:J}=Z,G="indent"in $?$.indent:null;if(Q&&typeof G==="number")G+=2;if(!J)switch($.type){case"single-quoted-scalar":J="QUOTE_SINGLE";break;case"double-quoted-scalar":J="QUOTE_DOUBLE";break;case"block-scalar":{let U=$.props[0];if(U.type!=="block-scalar-header")throw Error("Invalid block scalar header");J=U.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:J="PLAIN"}let Y=G5.stringifyString({type:J,value:q},{implicitKey:X||G===null,indent:G!==null&&G>0?" ".repeat(G):"",inFlow:z,options:{blockQuote:!0,lineWidth:-1}});switch(Y[0]){case"|":case">":jG($,Y);break;case'"':z4($,Y,"double-quoted-scalar");break;case"'":z4($,Y,"single-quoted-scalar");break;default:z4($,Y,"scalar")}}function jG($,q){let Z=q.indexOf(`
|
|
112
|
+
`),Q=q.substring(0,Z),X=q.substring(Z+1)+`
|
|
113
|
+
`;if($.type==="block-scalar"){let z=$.props[0];if(z.type!=="block-scalar-header")throw Error("Invalid block scalar header");z.source=Q,$.source=X}else{let{offset:z}=$,J="indent"in $?$.indent:-1,G=[{type:"block-scalar-header",offset:z,indent:J,source:Q}];if(!Y5(G,"end"in $?$.end:void 0))G.push({type:"newline",offset:-1,indent:J,source:`
|
|
114
|
+
`});for(let Y of Object.keys($))if(Y!=="type"&&Y!=="offset")delete $[Y];Object.assign($,{type:"block-scalar",indent:J,props:G,source:X})}}function Y5($,q){if(q)for(let Z of q)switch(Z.type){case"space":case"comment":$.push(Z);break;case"newline":return $.push(Z),!0}return!1}function z4($,q,Z){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=Z,$.source=q;break;case"block-scalar":{let Q=$.props.slice(1),X=q.length;if($.props[0].type==="block-scalar-header")X-=$.props[0].source.length;for(let z of Q)z.offset+=X;delete $.props,Object.assign($,{type:Z,source:q,end:Q});break}case"block-map":case"block-seq":{let X={type:"newline",offset:$.offset+q.length,indent:$.indent,source:`
|
|
115
|
+
`};delete $.items,Object.assign($,{type:Z,source:q,end:[X]});break}default:{let Q="indent"in $?$.indent:-1,X="end"in $&&Array.isArray($.end)?$.end.filter((z)=>z.type==="space"||z.type==="comment"||z.type==="newline"):[];for(let z of Object.keys($))if(z!=="type"&&z!=="offset")delete $[z];Object.assign($,{type:Z,indent:Q,source:q,end:X})}}}NG.createScalarToken=TG;NG.resolveAsScalar=IG;NG.setScalarValue=MG});var W5=R((CG)=>{var PG=($)=>("type"in $)?bq($):Sq($);function bq($){switch($.type){case"block-scalar":{let q="";for(let Z of $.props)q+=bq(Z);return q+$.source}case"block-map":case"block-seq":{let q="";for(let Z of $.items)q+=Sq(Z);return q}case"flow-collection":{let q=$.start.source;for(let Z of $.items)q+=Sq(Z);for(let Z of $.end)q+=Z.source;return q}case"document":{let q=Sq($);if($.end)for(let Z of $.end)q+=Z.source;return q}default:{let q=$.source;if("end"in $&&$.end)for(let Z of $.end)q+=Z.source;return q}}}function Sq({start:$,key:q,sep:Z,value:Q}){let X="";for(let z of $)X+=z.source;if(q)X+=bq(q);if(Z)for(let z of Z)X+=z.source;if(Q)X+=bq(Q);return X}CG.stringify=PG});var B5=R((bG)=>{var J4=Symbol("break visit"),SG=Symbol("skip children"),H5=Symbol("remove item");function k0($,q){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};V5(Object.freeze([]),$,q)}k0.BREAK=J4;k0.SKIP=SG;k0.REMOVE=H5;k0.itemAtPath=($,q)=>{let Z=$;for(let[Q,X]of q){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=q[q.length-1][0],X=Z?.[Q];if(X&&"items"in X)return X;throw Error("Parent collection not found")};function V5($,q,Z){let Q=Z(q,$);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let z=q[X];if(z&&"items"in z){for(let J=0;J<z.items.length;++J){let G=V5(Object.freeze($.concat([[X,J]])),z.items[J],Z);if(typeof G==="number")J=G-1;else if(G===J4)return J4;else if(G===H5)z.items.splice(J,1),J-=1}if(typeof Q==="function"&&X==="key")Q=Q(q,$)}}return typeof Q==="function"?Q(q,$):Q}bG.visit=k0});var xq=R((uG)=>{var G4=U5(),yG=W5(),kG=B5(),Y4="\uFEFF",U4="\x02",W4="\x18",H4="\x1F",fG=($)=>!!$&&("items"in $),hG=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function vG($){switch($){case Y4:return"<BOM>";case U4:return"<DOC>";case W4:return"<FLOW_END>";case H4:return"<SCALAR>";default:return JSON.stringify($)}}function gG($){switch($){case Y4:return"byte-order-mark";case U4:return"doc-mode";case W4:return"flow-error-end";case H4: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(
|
|
118
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
119
|
-
\r `),
|
|
120
|
-
`)return!0;if(
|
|
121
|
-
`;return!1}charAt(
|
|
122
|
-
`||!Q&&!this.atEnd)return
|
|
123
|
-
`||Z>=this.indentNext
|
|
124
|
-
`,this.pos),this.lineEndPos
|
|
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($[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}uG.createScalarToken=G4.createScalarToken;uG.resolveAsScalar=G4.resolveAsScalar;uG.setScalarValue=G4.setScalarValue;uG.stringify=yG.stringify;uG.visit=kG.visit;uG.BOM=Y4;uG.DOCUMENT=U4;uG.FLOW_END=W4;uG.SCALAR=H4;uG.isCollection=fG;uG.isScalar=hG;uG.prettyToken=vG;uG.tokenType=gG});var B4=R((ZY)=>{var S$=xq();function G0($){switch($){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case"\t":return!0;default:return!1}}var K5=new Set("0123456789ABCDEFabcdef"),$Y=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),yq=new Set(",[]{}"),qY=new Set(` ,[]{}
|
|
119
|
+
\r `),V4=($)=>!$||qY.has($);class _5{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($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!q;let Z=this.next??"stream";while(Z&&(q||this.hasChars(1)))Z=yield*this.parseNext(Z)}atLineEnd(){let $=this.pos,q=this.buffer[$];while(q===" "||q==="\t")q=this.buffer[++$];if(!q||q==="#"||q===`
|
|
120
|
+
`)return!0;if(q==="\r")return this.buffer[$+1]===`
|
|
121
|
+
`;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let q=this.buffer[$];if(this.indentNext>0){let Z=0;while(q===" ")q=this.buffer[++Z+$];if(q==="\r"){let Q=this.buffer[Z+$+1];if(Q===`
|
|
122
|
+
`||!Q&&!this.atEnd)return $+Z+1}return q===`
|
|
123
|
+
`||Z>=this.indentNext||!q&&!this.atEnd?$+Z:-1}if(q==="-"||q==="."){let Z=this.buffer.substr($,3);if((Z==="---"||Z==="...")&&G0(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
|
|
124
|
+
`,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){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 $=this.getLine();if($===null)return this.setNext("stream");if($[0]===S$.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let q=$.length,Z=$.indexOf("#");while(Z!==-1){let X=$[Z-1];if(X===" "||X==="\t"){q=Z-1;break}else Z=$.indexOf("#",Z+1)}while(!0){let X=$[q-1];if(X===" "||X==="\t")q-=1;else break}let Q=(yield*this.pushCount(q))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let q=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-q),yield*this.pushNewline(),"stream"}return yield S$.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let q=this.peek(3);if((q==="---"||q==="...")&&G0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,q==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,q]=this.peek(2);if(!q&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&G0(q)){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 $=this.getLine();if($===null)return this.setNext("doc");let q=yield*this.pushIndicators();switch($[q]){case"#":yield*this.pushCount($.length-q);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(V4),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return q+=yield*this.parseBlockScalarHeader(),q+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-q),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,q,Z=-1;do{if($=yield*this.pushNewline(),$>0)q=yield*this.pushSpaces(!1),this.indentValue=Z=q;else q=0;q+=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("..."))&&G0(Q[3])){if(!(Z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield S$.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(V4),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let z=this.charAt(1);if(this.flowKey||G0(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 $=this.charAt(0),q=this.buffer.indexOf($,this.pos+1);if($==="'")while(q!==-1&&this.buffer[q+1]==="'")q=this.buffer.indexOf("'",q+2);else while(q!==-1){let X=0;while(this.buffer[q-1-X]==="\\")X+=1;if(X%2===0)break;q=this.buffer.indexOf('"',q+1)}let Z=this.buffer.substring(0,q),Q=Z.indexOf(`
|
|
125
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)
|
|
127
|
-
|
|
128
|
-
`)break}default:break
|
|
129
|
-
`,X)}while(
|
|
130
|
-
`)Z=this.buffer[++Q]
|
|
131
|
-
`&&X>=this.pos&&X+1
|
|
126
|
+
`,X)}if(Q!==-1)q=Q-(Z[Q-1]==="\r"?2:1)}if(q===-1){if(!this.atEnd)return this.setNext("quoted-scalar");q=this.buffer.length}return yield*this.pushToIndex(q+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let q=this.buffer[++$];if(q==="+")this.blockScalarKeep=!0;else if(q>"0"&&q<="9")this.blockScalarIndent=Number(q)-1;else if(q!=="-")break}return yield*this.pushUntil((q)=>G0(q)||q==="#")}*parseBlockScalar(){let $=this.pos-1,q=0,Z;$:for(let X=this.pos;Z=this.buffer[X];++X)switch(Z){case" ":q+=1;break;case`
|
|
127
|
+
`:$=X,q=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 $}if(!Z&&!this.atEnd)return this.setNext("block-scalar");if(q>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=q;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let X=this.continueScalar($+1);if(X===-1)break;$=this.buffer.indexOf(`
|
|
129
|
+
`,X)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let 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-1}else if(!this.blockScalarKeep)do{let X=$-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+q>J)$=X;else break}while(!0);return yield S$.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,q=this.pos-1,Z=this.pos-1,Q;while(Q=this.buffer[++Z])if(Q===":"){let X=this.buffer[Z+1];if(G0(X)||$&&yq.has(X))break;q=Z}else if(G0(Q)){let X=this.buffer[Z+1];if(Q==="\r")if(X===`
|
|
132
132
|
`)Z+=1,Q=`
|
|
133
|
-
`,X=this.buffer[Z+1];else
|
|
134
|
-
`){let z=this.continueScalar(Z+1);if(z===-1)break;Z=Math.max(Z,z-2)}}else{if(
|
|
135
|
-
`)return yield*this.pushCount(1);else if(
|
|
136
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces(
|
|
137
|
-
`)+1;while(
|
|
138
|
-
|
|
139
|
-
`)+1;while(
|
|
140
|
-
|
|
141
|
-
`).length})}catch{}}}catch{continue}}}return await Z(
|
|
142
|
-
`;X.write(
|
|
143
|
-
`){Q.searchActive=!1,Y();return}if(
|
|
144
|
-
`:
|
|
133
|
+
`,X=this.buffer[Z+1];else q=Z;if(X==="#"||$&&yq.has(X))break;if(Q===`
|
|
134
|
+
`){let z=this.continueScalar(Z+1);if(z===-1)break;Z=Math.max(Z,z-2)}}else{if($&&yq.has(Q))break;q=Z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield S$.SCALAR,yield*this.pushToIndex(q+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,q){let Z=this.buffer.slice(this.pos,$);if(Z)return yield Z,this.pos+=Z.length,Z.length;else if(q)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(V4))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,q=this.charAt(1);if(G0(q)||$&&yq.has(q)){if(!$)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 $=this.pos+2,q=this.buffer[$];while(!G0(q)&&q!==">")q=this.buffer[++$];return yield*this.pushToIndex(q===">"?$+1:$,!1)}else{let $=this.pos+1,q=this.buffer[$];while(q)if($Y.has(q))q=this.buffer[++$];else if(q==="%"&&K5.has(this.buffer[$+1])&&K5.has(this.buffer[$+2]))q=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
|
|
135
|
+
`)return yield*this.pushCount(1);else if($==="\r"&&this.charAt(1)===`
|
|
136
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces($){let q=this.pos-1,Z;do Z=this.buffer[++q];while(Z===" "||$&&Z==="\t");let Q=q-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=q;return Q}*pushUntil($){let q=this.pos,Z=this.buffer[q];while(!$(Z))Z=this.buffer[++q];return yield*this.pushToIndex(q,!1)}}ZY.Lexer=_5});var K4=R((XY)=>{class L5{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let q=0,Z=this.lineStarts.length;while(q<Z){let X=q+Z>>1;if(this.lineStarts[X]<$)q=X+1;else Z=X}if(this.lineStarts[q]===$)return{line:q+1,col:1};if(q===0)return{line:0,col:$};let Q=this.lineStarts[q-1];return{line:q,col:$-Q+1}}}}XY.LineCounter=L5});var _4=R((YY)=>{var JY=h("process"),F5=xq(),GY=B4();function M0($,q){for(let Z=0;Z<$.length;++Z)if($[Z].type===q)return!0;return!1}function O5($){for(let q=0;q<$.length;++q)switch($[q].type){case"space":case"comment":case"newline":break;default:return q}return-1}function I5($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function kq($){switch($.type){case"document":return $.start;case"block-map":{let q=$.items[$.items.length-1];return q.sep??q.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function X$($){if($.length===0)return[];let q=$.length;$:while(--q>=0)switch($[q].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++q]?.type==="space");return $.splice(q,$.length)}function A5($){if($.start.type==="flow-seq-start"){for(let q of $.items)if(q.sep&&!q.value&&!M0(q.start,"explicit-key-ind")&&!M0(q.sep,"map-value-ind")){if(q.key)q.value=q.key;if(delete q.key,I5(q.value))if(q.value.end)Array.prototype.push.apply(q.value.end,q.sep);else q.value.end=q.sep;else Array.prototype.push.apply(q.start,q.sep);delete q.sep}}}class T5{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new GY.Lexer,this.onNewLine=$}*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(!q)yield*this.end()}*next($){if(this.source=$,JY.env.LOG_TOKENS)console.log("|",F5.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let q=F5.tokenType($);if(!q){let Z=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:Z,source:$}),this.offset+=$.length}else if(q==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=q,yield*this.step(),q){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.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 $=this.peek(1);if(this.type==="doc-end"&&$?.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(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let q=$??this.stack.pop();if(!q)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield q;else{let Z=this.peek(1);if(q.type==="block-scalar")q.indent="indent"in Z?Z.indent:0;else if(q.type==="flow-collection"&&Z.type==="document")q.indent=0;if(q.type==="flow-collection")A5(q);switch(Z.type){case"document":Z.value=q;break;case"block-scalar":Z.props.push(q);break;case"block-map":{let Q=Z.items[Z.items.length-1];if(Q.value){Z.items.push({start:[],key:q,sep:[]}),this.onKeyLine=!0;return}else if(Q.sep)Q.value=q;else{Object.assign(Q,{key:q,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:q});else Q.value=q;break}case"flow-collection":{let Q=Z.items[Z.items.length-1];if(!Q||Q.value)Z.items.push({start:[],key:q,sep:[]});else if(Q.sep)Q.value=q;else Object.assign(Q,{key:q,sep:[]});return}default:yield*this.pop(),yield*this.pop(q)}if((Z.type==="document"||Z.type==="block-map"||Z.type==="block-seq")&&(q.type==="block-map"||q.type==="block-seq")){let Q=q.items[q.items.length-1];if(Q&&!Q.sep&&!Q.value&&Q.start.length>0&&O5(Q.start)===-1&&(q.indent===0||Q.start.every((X)=>X.type!=="comment"||X.indent<q.indent))){if(Z.type==="document")Z.end=Q.start;else Z.items.push({start:Q.start});q.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 $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(O5($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let q=this.startBlockValue($);if(q)this.stack.push(q);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let q=kq(this.peek(2)),Z=X$(q),Q;if($.end)Q=$.end,Q.push(this.sourceToken),delete $.end;else Q=[this.sourceToken];let X={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:Z,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=X}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let q=this.source.indexOf(`
|
|
137
|
+
`)+1;while(q!==0)this.onNewLine(this.offset+q),q=this.source.indexOf(`
|
|
138
|
+
`,q)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let q=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,q.value){let Z="end"in q.value?q.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(q.sep)q.sep.push(this.sourceToken);else q.start.push(this.sourceToken);return;case"space":case"comment":if(q.value)$.items.push({start:[this.sourceToken]});else if(q.sep)q.sep.push(this.sourceToken);else{if(this.atIndentedComment(q.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,q.start),Q.push(this.sourceToken),$.items.pop();return}}q.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let Z=!this.onKeyLine&&this.indent===$.indent,Q=Z&&(q.sep||q.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&q.sep&&!q.value){let z=[];for(let J=0;J<q.sep.length;++J){let G=q.sep[J];switch(G.type){case"newline":z.push(J);break;case"space":break;case"comment":if(G.indent>$.indent)z.length=0;break;default:z.length=0}}if(z.length>=2)X=q.sep.splice(z[1])}switch(this.type){case"anchor":case"tag":if(Q||q.value)X.push(this.sourceToken),$.items.push({start:X}),this.onKeyLine=!0;else if(q.sep)q.sep.push(this.sourceToken);else q.start.push(this.sourceToken);return;case"explicit-key-ind":if(!q.sep&&!q.explicitKey)q.start.push(this.sourceToken),q.explicitKey=!0;else if(Q||q.value)X.push(this.sourceToken),$.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(q.explicitKey)if(!q.sep)if(M0(q.start,"newline"))Object.assign(q,{key:null,sep:[this.sourceToken]});else{let z=X$(q.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]})}else if(q.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(M0(q.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(I5(q.key)&&!M0(q.sep,"newline")){let z=X$(q.start),J=q.key,G=q.sep;G.push(this.sourceToken),delete q.key,delete q.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)q.sep=q.sep.concat(X,this.sourceToken);else q.sep.push(this.sourceToken);else if(!q.sep)Object.assign(q,{key:null,sep:[this.sourceToken]});else if(q.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(M0(q.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else q.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||q.value)$.items.push({start:X,key:z,sep:[]}),this.onKeyLine=!0;else if(q.sep)this.stack.push(z);else Object.assign(q,{key:z,sep:[]}),this.onKeyLine=!0;return}default:{let z=this.startBlockValue($);if(z){if(z.type==="block-seq"){if(!q.explicitKey&&q.sep&&!M0(q.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)$.items.push({start:X});this.stack.push(z);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let q=$.items[$.items.length-1];switch(this.type){case"newline":if(q.value){let Z="end"in q.value?q.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else q.start.push(this.sourceToken);return;case"space":case"comment":if(q.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(q.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,q.start),Q.push(this.sourceToken),$.items.pop();return}}q.start.push(this.sourceToken)}return;case"anchor":case"tag":if(q.value||this.indent<=$.indent)break;q.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(q.value||M0(q.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else q.start.push(this.sourceToken);return}if(this.indent>$.indent){let Z=this.startBlockValue($);if(Z){this.stack.push(Z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let q=$.items[$.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($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!q||q.sep)$.items.push({start:[this.sourceToken]});else q.start.push(this.sourceToken);return;case"map-value-ind":if(!q||q.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(q.sep)q.sep.push(this.sourceToken);else Object.assign(q,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!q||q.value)$.items.push({start:[this.sourceToken]});else if(q.sep)q.sep.push(this.sourceToken);else q.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(!q||q.value)$.items.push({start:[],key:Q,sep:[]});else if(q.sep)this.stack.push(Q);else Object.assign(q,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let Z=this.startBlockValue($);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===$.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=kq(Z),X=X$(Q);A5($);let z=$.end.splice(1,$.end.length);z.push(this.sourceToken);let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let q=this.source.indexOf(`
|
|
139
|
+
`)+1;while(q!==0)this.onNewLine(this.offset+q),q=this.source.indexOf(`
|
|
140
|
+
`,q)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){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 q=kq($),Z=X$(q);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 q=kq($),Z=X$(q);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<=q)return!1;return $.every((Z)=>Z.type==="newline"||Z.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){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($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}YY.Parser=T5});var R5=R((FY)=>{var M5=X4(),WY=R$(),b$=w$(),HY=K9(),VY=f(),BY=K4(),j5=_4();function N5($){let q=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||q&&new BY.LineCounter||null,prettyErrors:q}}function KY($,q={}){let{lineCounter:Z,prettyErrors:Q}=N5(q),X=new j5.Parser(Z?.addNewLine),z=new M5.Composer(q),J=Array.from(z.compose(X.parse($)));if(Q&&Z)for(let G of J)G.errors.forEach(b$.prettifyError($,Z)),G.warnings.forEach(b$.prettifyError($,Z));if(J.length>0)return J;return Object.assign([],{empty:!0},z.streamInfo())}function D5($,q={}){let{lineCounter:Z,prettyErrors:Q}=N5(q),X=new j5.Parser(Z?.addNewLine),z=new M5.Composer(q),J=null;for(let G of z.compose(X.parse($),!0,$.length))if(!J)J=G;else if(J.options.logLevel!=="silent"){J.errors.push(new b$.YAMLParseError(G.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&Z)J.errors.forEach(b$.prettifyError($,Z)),J.warnings.forEach(b$.prettifyError($,Z));return J}function _Y($,q,Z){let Q=void 0;if(typeof q==="function")Q=q;else if(Z===void 0&&q&&typeof q==="object")Z=q;let X=D5($,Z);if(!X)return null;if(X.warnings.forEach((z)=>HY.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 LY($,q,Z){let Q=null;if(typeof q==="function"||Array.isArray(q))Q=q;else if(Z===void 0&&q)Z=q;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($===void 0){let{keepUndefined:X}=Z??q??{};if(!X)return}if(VY.isDocument($)&&!Q)return $.toString(Z);return new WY.Document($,Q,Z).toString(Z)}FY.parse=_Y;FY.parseAllDocuments=KY;FY.parseDocument=D5;FY.stringify=LY});import{execFile as nZ}from"child_process";import{promisify as iZ}from"util";import{mkdtemp as G2,readdir as oZ,readFile as Q9,rm as i$,cp as aZ,access as Z9,stat as sZ,lstat as tZ,symlink as rZ,mkdir as eZ}from"fs/promises";import{join as V0,resolve as Y2,relative as $6,basename as q6}from"path";import{homedir as U2}from"os";import{tmpdir as W2}from"os";import{readdir as gZ,readFile as uZ,stat as mZ}from"fs/promises";import{join as pZ}from"path";var dZ=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"]),cZ=524288;async function l$($){let q=[];async function Z(Q,X){let z;try{z=await gZ(Q)}catch{return}for(let J of z){if(J===".git"||J==="node_modules")continue;let G=pZ(Q,J),Y=X?`${X}/${J}`:J;try{let U=await mZ(G);if(U.isDirectory())await Z(G,Y);else if(U.isFile()){let V=J.includes(".")?`.${J.split(".").pop().toLowerCase()}`:"";if(dZ.has(V))continue;if(U.size>cZ)continue;try{let H=await uZ(G,"utf-8");q.push({relPath:Y,content:H,lineCount:H.split(`
|
|
141
|
+
`).length})}catch{}}}catch{continue}}}return await Z($,""),q}class J2{selected;cursor;scrollOffset;pageSize;itemCount;filter;searchActive;filteredMap;constructor($,q){this.selected=$.map((Z)=>Z.checked),this.cursor=1,this.scrollOffset=0,this.pageSize=q,this.itemCount=$.length,this.filter="",this.searchActive=!1,this.filteredMap=$.map((Z,Q)=>Q)}get totalRows(){return this.filteredMap.length+1}applyFilter($){if(this.filter==="")this.filteredMap=$.map((q,Z)=>Z);else{let q=this.filter.toLowerCase();this.filteredMap=[];for(let Z=0;Z<$.length;Z++)if(($[Z].label.toLowerCase()+" "+($[Z].hint?.toLowerCase()??"")).includes(q))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 $=this.cursorToOriginalIndex();if($>=0)this.selected[$]=!this.selected[$]}}toggleAll(){let $=this.filteredMap,Z=!$.every((Q)=>this.selected[Q]);for(let Q of $)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 $=[];for(let q=0;q<this.selected.length;q++)if(this.selected[q])$.push(q);return $}getVisibleRange(){let $=this.scrollOffset,q=Math.min(this.scrollOffset+this.pageSize,this.totalRows);return{start:$,end:q}}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 lZ($,q,Z){let Q=[];if($.searchActive||$.filter!==""){let U=W.cyan("/"),V=$.filter,H=$.searchActive?W.cyan("█"):"";if(Q.push(` ${U}${V}${H}`),$.filteredMap.length===0)Q.push(W.dim(" No matches found"));Q.push("")}let{start:X,end:z}=$.getVisibleRange();if(X>0)Q.push(W.dim(` ... ${X} more above`));for(let U=X;U<z;U++){let H=U===$.cursor?W.cyan(">"):" ";if(U===0){let B=$.filteredMap,L=B.length>0&&B.every((F)=>$.selected[F])?W.green("[*]"):"[ ]",K=$.filter!==""?`Select All Matching (${$.filteredMap.length})`:"Select All / Deselect All";Q.push(`${H} ${L} ${W.bold(K)}`)}else{let B=$.filteredMap[U-1],_=q[B],K=$.selected[B]?W.green("[*]"):"[ ]",F=`${H} ${K} `,O=7,A=W.bold(_.label),M=_.label.length;if(_.hint){let N=Z-7-M-2;if(N>10){let T=$9(_.hint,N);Q.push(`${F}${A} ${W.dim(T)}`)}else{let T=$9(_.label,Z-7);Q.push(`${F}${W.bold(T)}`)}}else{let N=$9(_.label,Z-7);Q.push(`${F}${W.bold(N)}`)}}}let J=$.totalRows-z;if(J>0)Q.push(W.dim(` ... ${J} more below`));let G=$.getSelectedIndices().length,Y=$.filter!==""?` matching: ${$.filteredMap.length}/${$.itemCount}`:"";if(Q.push(""),$.searchActive)Q.push(W.dim(` ${G} of ${$.itemCount} selected${Y} | Type to filter Esc Clear Enter Done searching`));else Q.push(W.dim(` ${G} of ${$.itemCount} selected${Y} | `+"↑/↓ Navigate Space Toggle a All / Search Enter Confirm Esc Cancel"));return Q}function $9($,q){if(q<=0)return"";if($.length<=q)return $;if(q<=3)return $.slice(0,q);return $.slice(0,q-3)+"..."}async function d0($){let{items:q}=$,Z=$.pageSize??Math.min(q.length+1,15),Q=new J2(q,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 U=lZ(Q,q,J);if(G>0)X.write(`\x1B[${G}F`);let V=Math.max(U.length,G),H="";for(let B=0;B<V;B++)H+=`\x1B[2K${B<U.length?U[B]:""}
|
|
142
|
+
`;X.write(H),G=V}return Y(),new Promise((U)=>{let V="",H=null;function B(){if(z.removeListener("data",K),typeof z.setRawMode==="function")z.setRawMode(!1);if(z.pause(),X.write("\x1B[?25h"),H)clearTimeout(H)}function _(F){B(),U(F)}function L(F){if(Q.searchActive){if(F==="\x1B"){Q.searchActive=!1,Q.filter="",Q.applyFilter(q),Y();return}if(F==="\r"||F===`
|
|
143
|
+
`){Q.searchActive=!1,Y();return}if(F===""||F==="\b"){if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter(q);else Q.searchActive=!1;Y();return}if(F==="\x03"){B(),process.kill(process.pid,"SIGINT");return}if(F==="\x1B[A"){Q.moveUp(),Y();return}if(F==="\x1B[B"){Q.moveDown(),Y();return}if(F===" "){Q.toggleCurrent(),Y();return}if(F.length===1&&F>=" "&&F<="~"){Q.filter+=F,Q.applyFilter(q),Y();return}return}switch(F){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
|
+
`:_(Q.getSelectedIndices());break;case"\x1B":if(Q.filter!=="")Q.filter="",Q.applyFilter(q),Y();else _([]);break;case"":case"\b":if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter(q),Y();break;case"\x03":B(),process.kill(process.pid,"SIGINT");break}}function K(F){if(V.length>0){if(V+=F,H)clearTimeout(H);if(V.length>=3&&V[1]==="["){let A=V.slice(0,3),M=V.slice(3);if(V="",L(A),M)K(M);return}let O=V;V="",L("\x1B");for(let A=1;A<O.length;A++)L(O[A]);return}for(let O=0;O<F.length;O++){let A=F[O];if(A==="\x1B"){let M=F.slice(O);if(M.length>=3&&M[1]==="[")L(M.slice(0,3)),O+=2;else if(M.length>=2){V=M,H=setTimeout(()=>{let N=V;V="",L("\x1B");for(let T=1;T<N.length;T++)L(N[T])},50);return}else{V="\x1B",H=setTimeout(()=>{V="",L("\x1B")},50);return}}else L(A)}}z.on("data",K)})}var R0=iZ(nZ),Z6=/^[a-zA-Z0-9_-]+$/,Q6=/^[a-zA-Z0-9._-]+$/,X6=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,H2=128,z6=/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\/tree\/(.+))?\/?$/;function J6($){return $.startsWith("/")||$.startsWith("./")||$.startsWith(".\\")||$.startsWith("../")||$.startsWith("..\\")||$.startsWith("~/")||$.startsWith("~\\")||$==="~"||$==="."||$===".."||/^[a-zA-Z]:[/\\]/.test($)}function G6($){let q;if($==="~")q=U2();else if($.startsWith("~/")||$.startsWith("~\\"))q=Y2(U2(),$.slice(2));else q=Y2($);let Z=q6(q);return E(`install: parsed local source -> path=${q}`),{owner:"local",repo:Z,ref:null,subpath:null,cloneUrl:"",sshCloneUrl:"",isLocal:!0,localPath:q}}function c0($){if(J6($))return G6($);let q=z6.exec($);if(q){let[,H,B,_]=q,L=B.endsWith(".git")?B.slice(0,-4):B;$=`github:${H}/${L}${_?`#${_}`:""}`}if(!$.startsWith("github:"))throw Error(`Invalid source format. Got: "${$}"
|
|
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
|
|
152
|
-
`)){let z=X.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(z)Z.add(z[1])}let Q
|
|
153
|
-
HTTPS: ${
|
|
154
|
-
SSH: ${
|
|
155
|
-
`);for(let J=0;J<z.length;J++)for(let{category:G,pattern:Y}of
|
|
156
|
-
Use --force to overwrite.`)}catch(Z){if(Z.message?.includes("--force"))throw Z;
|
|
157
|
-
`),Z=!1,Q=!1;for(let X of
|
|
158
|
-
`),Z=-1;for(let Q=0;Q
|
|
159
|
-
`);return null}function
|
|
151
|
+
./relative/path/to/skill`);let Z=$.slice(7),Q=Z.indexOf("#"),X,z=null,J=null;if(Q!==-1){X=Z.slice(0,Q);let H=Z.slice(Q+1);if(!H)throw Error("Invalid source: ref cannot be empty after #");let B=H.indexOf(":");if(B!==-1){if(z=H.slice(0,B),!z)throw Error("Invalid source: ref cannot be empty before :");J=H.slice(B+1)||null}else z=H}else{let H=Z.indexOf(":");if(H!==-1)X=Z.slice(0,H),J=Z.slice(H+1)||null;else X=Z}let G=X.indexOf("/");if(G===-1)throw Error(`Invalid source: format must be github:owner/repo. Got: "${$}"`);let Y=X.slice(0,G),U=X.slice(G+1);if(!Y)throw Error("Invalid source: owner cannot be empty");if(!U)throw Error("Invalid source: repo cannot be empty");if(!Z6.test(Y))throw Error(`Invalid source: owner contains invalid characters: "${Y}". Allowed: [a-zA-Z0-9_-]`);if(!Q6.test(U))throw Error(`Invalid source: repo contains invalid characters: "${U}". Allowed: [a-zA-Z0-9._-]`);let V={owner:Y,repo:U,ref:z,subpath:J,cloneUrl:`https://github.com/${Y}/${U}.git`,sshCloneUrl:`git@github.com:${Y}/${U}.git`};return E(`install: parsed source -> owner=${Y} repo=${U} ref=${z} subpath=${J}`),V}async function X9($){if($.subpath!==null||!$.ref||!$.ref.includes("/"))return $;try{let{stdout:q}=await R0("git",["ls-remote","--heads","--tags",$.cloneUrl],{timeout:15000}),Z=new Set;for(let X of q.split(`
|
|
152
|
+
`)){let z=X.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(z)Z.add(z[1])}let 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 E(`install: resolved ref="${z}" subpath="${J}"`),{...$,ref:z,subpath:J||null}}}}catch(q){E(`install: ls-remote failed, treating entire ref as branch: ${q}`)}return $}function w0($){if(!$)throw Error("Invalid skill name: name cannot be empty");if($.includes("\x00"))throw Error("Invalid skill name: contains unsafe characters (null byte)");if($.includes(".."))throw Error("Invalid skill name: contains unsafe characters (..)");if($.includes("/")||$.includes("\\"))throw Error("Invalid skill name: contains unsafe characters (path separator)");if($.startsWith("."))throw Error("Invalid skill name: must not start with a dot");if($.length>H2)throw Error(`Invalid skill name: exceeds maximum length of ${H2} characters`);if(!X6.test($))throw Error(`Invalid skill name: "${$}" does not match allowed pattern [a-zA-Z0-9][a-zA-Z0-9._-]*`);return $}function Y6($){let q=$.split(/[/\\]/).filter(Boolean),Z=q.length>0?q[q.length-1]:$;return w0(Z)}function B2($){let q=new Map;for(let Z of $){let Q=Y6(Z),X=q.get(Q);if(X)X.push(Z);else q.set(Q,[Z])}return[...q.entries()].filter(([,Z])=>Z.length>1).map(([Z,Q])=>({name:Z,paths:Q}))}async function l0(){try{await R0("git",["--version"]),E("install: git available")}catch{throw Error("git is required for installing skills. Install git from https://git-scm.com")}}function U6($){if($.killed)return!1;let q=($.stderr||$.message||"").toLowerCase();return q.includes("authentication failed")||q.includes("could not read username")||q.includes("repository not found")||q.includes("returned error: 403")||q.includes("returned error: 401")||q.includes("terminal prompts disabled")||q.includes("permission denied")}function n$($){return $.killed?"Clone timed out after 60 seconds":`Clone failed: ${$.stderr||$.message}`}async function q9($,q,Z){if(q!==null&&/^[0-9a-f]{40}$/i.test(q))return await R0("git",["clone","--no-checkout",$,Z],{timeout:60000}),await R0("git",["checkout",q],{cwd:Z,timeout:30000}),Z;let X=["clone","--depth","1"];if(q)X.push("--branch",q);return X.push($,Z),await R0("git",X,{timeout:60000}),Z}async function n0($,q="auto"){E(`install: cloning ${$.owner}/${$.repo}${$.ref?` (ref: ${$.ref})`:""} (transport: ${q})`);let Z=await G2(V0(W2(),"asm-install-"));if(q==="ssh"||q==="https"){let Q=q==="ssh"?$.sshCloneUrl:$.cloneUrl;try{return await q9(Q,$.ref,Z)}catch(X){throw await Q0(Z),Error(n$(X))}}try{return await q9($.cloneUrl,$.ref,Z)}catch(Q){if(!U6(Q))throw await Q0(Z),Error(n$(Q));E("install: HTTPS clone failed with auth error, retrying with SSH..."),await Q0(Z);let X=await G2(V0(W2(),"asm-install-"));try{return await q9($.sshCloneUrl,$.ref,X)}catch(z){throw await Q0(X),Error(`Clone failed with both transports:
|
|
153
|
+
HTTPS: ${n$(Q)}
|
|
154
|
+
SSH: ${n$(z)}`)}}}async function P0($){let q=V0($,"SKILL.md"),Z;try{Z=await Q9(q,"utf-8")}catch{throw Error("Not a valid skill: SKILL.md not found in repository root")}let Q=r(Z),X=$.split(/[/\\]/).pop()||"unknown",z=Q.name||X,J=z0(Q);return E(`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 o$($,q=3){let Z=[];async function Q(X,z,J){let G;try{G=await oZ(X)}catch{return}for(let Y of G){if(Y===".git"||Y==="node_modules")continue;let U=V0(X,Y);try{if(!(await sZ(U)).isDirectory())continue}catch{continue}let V=z?`${z}/${Y}`:Y,H=J+1,B=V0(U,"SKILL.md");try{let _=await Q9(B,"utf-8"),L=r(_);Z.push({relPath:V,name:L.name||Y,version:z0(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:V2(L)})}catch{if(H<q)await Q(U,V,H)}}}return await Q($,"",0),Z.sort((X,z)=>X.name.localeCompare(z.name)),Z}var W6=[{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 K2($){let q=[],Z=await l$($);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 W6)if(Y.test(z[J])){let U=z[J].trim();q.push({category:G,file:Q,line:J+1,match:U.length>100?U.slice(0,100)+"…":U})}}return q}async function a$($){let q=$.source.isLocal?`local:${$.source.localPath}`:`github:${$.source.owner}/${$.source.repo}${$.source.ref?`#${$.source.ref}`:""}${$.source.subpath?`:${$.source.subpath}`:""}`;if($.force)try{await Z9($.targetDir),await i$($.targetDir,{recursive:!0,force:!0})}catch{}let Z=$.sourceDir;try{await aZ(Z,$.targetDir,{recursive:!0})}catch(G){throw Error(`Failed to install: ${G.message}`)}let Q=V0($.targetDir,".git");try{await i$(Q,{recursive:!0,force:!0})}catch{}E(`install: copied files to ${$.targetDir}`);let X=V0($.targetDir,"SKILL.md");try{await Z9(X)}catch{throw Error("Installation verification failed: SKILL.md not found at target")}let z=await Q9(X,"utf-8"),J=r(z);return{success:!0,path:$.targetDir,name:J.name||$.skillName,version:z0(J),provider:$.providerLabel,source:q}}async function _2($,q){let Z=await a$($);for(let Q of q){if(Q.name===$.providerName)continue;let X=$.scope==="project"?Q.project:Q.global,z=X0(X),J=V0(z,$.skillName);await eZ(z,{recursive:!0});try{if((await tZ(J)).isSymbolicLink())await i$(J);else{E(`install: skipping ${J} — existing non-symlink directory`);continue}}catch{}let G=$6(z,$.targetDir);await rZ(G,J,"dir"),E(`install: symlinked ${J} -> ${G}`)}return Z.provider=`All (${q.map((Q)=>Q.label).join(", ")})`,Z}async function Q0($){try{await i$($,{recursive:!0,force:!0})}catch{}}async function L2(){try{await R0("npx",["--version"]),E("install: npx available")}catch{throw Error("npx is required for Vercel method installation. Install Node.js from https://nodejs.org")}}async function F2($,q){let Z=["--yes","skills","add",$];if(q)Z.push("--skill",q);E(`install: running npx ${Z.join(" ")}`);try{let Q=await R0("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 O2($){if($.isLocal)return $.localPath;let q=`https://github.com/${$.owner}/${$.repo}`;if($.ref)return`${q}/tree/${$.ref}${$.subpath?`/${$.subpath}`:""}`;return q}async function i0($,q,Z){let Q=$.providers.filter((_)=>_.enabled);if(q==="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(q){let _=$.providers.find((L)=>L.name===q);if(!_){let L=$.providers.map((K)=>K.name).join(", ");throw Error(`Unknown provider: "${q}". Valid providers: ${L}, all`)}if(!_.enabled)throw Error(`Provider "${q}" is disabled. Enable it in your config or choose another provider.`);return{provider:_,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 _=Q.map((L)=>L.name).join(", ");throw Error(`--tool (or --provider) is required in non-interactive mode. Available: ${_}, all`)}let X=$.preferences.selectedTools,J=X&&X.length>0?new Set(X):null,G=$.providers.map((_)=>({label:`${_.label} (${_.name})`,hint:_.global,checked:J?J.has(_.name):_.name==="agents"})),Y=await d0({items:G});if(Y.length===0)throw Error("No tools selected. Aborting.");let U=Y.map((_)=>$.providers[_]),V=U.map((_)=>_.name),{saveSelectedTools:H}=await import("./chunk-a26gjzjk.js");if(await H(V),U.length===1)return{provider:U[0],allProviders:null};return{provider:U.find((_)=>_.name==="agents")||U[0],allProviders:U}}function z9($,q,Z,Q,X,z,J="global"){let G=J==="project"?X.project:X.global,Y=X0(G),U=V0(Y,Q);return{source:$,tempDir:q,sourceDir:Z,targetDir:U,skillName:Q,force:z,providerName:X.name,providerLabel:X.label,scope:J}}async function A2($,q){try{if(await Z9($),E(`install: target ${$} — conflict (exists)${q?", force overwrite":""}`),!q)throw Error(`Skill already exists at: ${$}
|
|
156
|
+
Use --force to overwrite.`)}catch(Z){if(Z.message?.includes("--force"))throw Z;E(`install: target ${$} — no conflict`)}}import{readFile as JU}from"fs/promises";import{join as GU}from"path";var MY=X4(),jY=R$(),NY=p9(),L4=w$(),DY=H$(),j0=f(),RY=O0(),wY=u(),PY=I0(),CY=T0(),B_=xq(),EY=B4(),SY=K4(),bY=_4(),fq=R5(),w5=U$();var xY=MY.Composer,yY=jY.Document,kY=NY.Schema,fY=L4.YAMLError,hY=L4.YAMLParseError,vY=L4.YAMLWarning,gY=DY.Alias,uY=j0.isAlias,mY=j0.isCollection,pY=j0.isDocument,dY=j0.isMap,cY=j0.isNode,lY=j0.isPair,nY=j0.isScalar,iY=j0.isSeq,oY=RY.Pair,aY=wY.Scalar,sY=PY.YAMLMap,tY=CY.YAMLSeq;var rY=EY.Lexer,eY=SY.LineCounter,$U=bY.Parser,x$=fq.parse,qU=fq.parseAllDocuments,ZU=fq.parseDocument,QU=fq.stringify,XU=w5.visit,zU=w5.visitAsync;var P5=500;function YU($){let q=$.split(`
|
|
157
|
+
`),Z=!1,Q=!1;for(let X of q){if(X.trim()==="---")if(!Z){Z=!0;continue}else{Q=!0;continue}if(Q&&X.trim().length>0)return!0}return!1}function UU($){let q=$.split(`
|
|
158
|
+
`),Z=-1;for(let Q=0;Q<q.length;Q++)if(q[Q].trim()==="---")if(Z===-1)Z=Q+1;else return q.slice(Z,Q).join(`
|
|
159
|
+
`);return null}function WU($){let q=UU($);if(q===null)return null;try{return x$(q),null}catch(Z){return Z.message||"invalid YAML"}}async function C5($){let q=[];if(!$.description||$.description.trim()==="")q.push({category:"missing-description",message:"Skill has no description in SKILL.md frontmatter"});if(!$.version||$.version==="0.0.0")q.push({category:"missing-version",message:"Skill has no version (or default 0.0.0) in SKILL.md frontmatter"});try{let Q=GU($.path,"SKILL.md"),X=await JU(Q,"utf-8");if(!YU(X))q.push({category:"empty-body",message:"SKILL.md contains only frontmatter with no body content"});let z=WU(X);if(z)q.push({category:"invalid-yaml",message:`SKILL.md has invalid YAML frontmatter: ${z}`})}catch{}let Z=$.fileCount;if(Z!==void 0&&Z>P5)q.push({category:"high-file-count",message:`Skill has ${Z} files (threshold: ${P5})`});return q}import{join as OU}from"path";import{homedir as AU}from"os";import{readFile as HU,writeFile as VU,mkdir as BU}from"fs/promises";import{dirname as KU}from"path";async function _U($){try{let q=await HU($,"utf-8"),Z=JSON.parse(q);if(!Z.fetched_at||Z.data===void 0||Z.data===null)return null;return Z}catch{return null}}async function LU($,q,Z){let Q={fetched_at:new Date().toISOString(),ttl_seconds:Z,data:q};try{await BU(KU($),{recursive:!0}),await VU($,JSON.stringify(Q,null,2),"utf-8"),E(`http: wrote cache -> ${$}`)}catch(X){E(`http: failed to write cache: ${X}`)}}function FU($){let q=new Date($.fetched_at).getTime();return(Date.now()-q)/1000<$.ttl_seconds}async function E5($,q,Z={}){let Q=Z.ttl??3600,X=Z.noCache??!1,z=await _U(q);if(z&&!X&&FU(z))return E(`http: cache hit (fresh) -> ${q}`),z.data;try{E(`http: fetching -> ${$}`);let J=await fetch($);if(!J.ok)throw Error(`HTTP ${J.status}: ${J.statusText}`);let G=await J.json();return await LU(q,G,Q),G}catch(J){if(E(`http: fetch failed: ${J}`),z)return E(`http: using stale cache as fallback -> ${q}`),z.data;return null}}var IU=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,TU=/^[a-zA-Z0-9_-]+$/,x5=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/,MU=/^[0-9a-f]{40}$/,jU=/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/,NU=/^[a-z0-9-]+$/,DU=/^sha256:[0-9a-f]{64}$/,S5=["pass","warning","dangerous"];function hq($){let q=[];if(!$||typeof $!=="object"||Array.isArray($))return[{field:"(root)",message:"manifest must be a non-null object"}];let Z=$,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))q.push({field:J,message:`unknown property "${J}" is not allowed`});let X=[{field:"name",pattern:IU,maxLength:128},{field:"author",pattern:TU,maxLength:39},{field:"description",maxLength:256},{field:"repository",pattern:x5},{field:"commit",pattern:MU},{field:"published_at"}];for(let{field:J,pattern:G,maxLength:Y}of X){let U=Z[J];if(U===void 0||U===null){q.push({field:J,message:`required field "${J}" is missing`});continue}if(typeof U!=="string"){q.push({field:J,message:`"${J}" must be a string`});continue}if(U.length===0){q.push({field:J,message:`"${J}" must not be empty`});continue}if(Y&&U.length>Y)q.push({field:J,message:`"${J}" exceeds maximum length of ${Y}`});if(G&&!G.test(U))q.push({field:J,message:`"${J}" does not match required pattern`})}let z=Z.security_verdict;if(z===void 0||z===null)q.push({field:"security_verdict",message:'required field "security_verdict" is missing'});else if(typeof z!=="string"||!S5.includes(z))q.push({field:"security_verdict",message:`"security_verdict" must be one of: ${S5.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))q.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"||!jU.test(Z.version))q.push({field:"version",message:'"version" must be a valid semver string'})}if(Z.license!==void 0){if(typeof Z.license!=="string")q.push({field:"license",message:'"license" must be a string'});else if(Z.license.length>64)q.push({field:"license",message:'"license" exceeds maximum length of 64'})}if(Z.tags!==void 0)if(!Array.isArray(Z.tags))q.push({field:"tags",message:'"tags" must be an array'});else{if(Z.tags.length>10)q.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"){q.push({field:`tags[${G}]`,message:"tag must be a string"});continue}if(Y.length>32)q.push({field:`tags[${G}]`,message:`tag "${Y}" exceeds maximum length of 32`});if(!NU.test(Y))q.push({field:`tags[${G}]`,message:`tag "${Y}" does not match pattern (lowercase alphanumeric and hyphens)`});if(J.has(Y))q.push({field:`tags[${G}]`,message:`duplicate tag "${Y}"`});J.add(Y)}}if(Z.checksum!==void 0){if(typeof Z.checksum!=="string"||!DU.test(Z.checksum))q.push({field:"checksum",message:'"checksum" must match pattern sha256:<64-hex-chars>'})}if(Z.skill_path!==void 0){if(typeof Z.skill_path!=="string")q.push({field:"skill_path",message:'"skill_path" must be a string'});else if(Z.skill_path.length===0)q.push({field:"skill_path",message:'"skill_path" must not be empty'});else if(Z.skill_path.length>256)q.push({field:"skill_path",message:'"skill_path" exceeds maximum length of 256'});else if(/\.\.|^\//.test(Z.skill_path))q.push({field:"skill_path",message:'"skill_path" must not contain ".." or start with "/"'})}return q}function RU($,q){let Z=$.length,Q=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=$[J-1]===q[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 wU($,q,Z=2){let Q=[];for(let X of q){if($===X)continue;let z=RU($,X);if(z<=Z)Q.push({existingName:X,distance:z})}return Q.sort((X,z)=>X.distance-z.distance)}var F4=process.env.ASM_REGISTRY_URL??"https://raw.githubusercontent.com/luongnv89/asm-registry/main/index.json",PU=process.env.ASM_REGISTRY_CACHE??OU(AU(),".config","agent-skill-manager","registry-cache.json"),CU=3600;function O4($){if($.startsWith("github:")||$.startsWith("http://")||$.startsWith("https://")||$.startsWith("/")||$.startsWith("./")||$.startsWith("../")||$.startsWith("~/")||$==="~"||$==="."||$==="..")return!1;let q=($.match(/\//g)||[]).length;if(q>1)return!1;if(q===1){let[Z,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($)}function A4($){if(!O4($))return!1;return $.includes("/")}async function I4($){let q=await E5(F4,PU,{ttl:CU,noCache:$?.noCache});if(!q)return null;if(typeof q!=="object"||!Array.isArray(q.manifests)||typeof q.generated_at!=="string")return E("registry: fetched index has invalid structure — discarding"),null;let Z=[];for(let Q of q.manifests){let X=hq(Q);if(X.length>0){E(`registry: dropping invalid manifest entry (${Q?.name??"unknown"}): ${X.map((z)=>z.message).join(", ")}`);continue}if(!x5.test(Q.repository)){E(`registry: dropping manifest with unexpected repository URL: ${Q.repository}`);continue}Z.push(Q)}return{generated_at:q.generated_at,manifests:Z}}function EU($,q){return q.manifests.filter((Z)=>Z.name.toLowerCase()===$.toLowerCase())}function SU($,q,Z){return Z.manifests.find((Q)=>Q.author.toLowerCase()===$.toLowerCase()&&Q.name.toLowerCase()===q.toLowerCase())??null}function b5($,q,Z=5){return wU($,q.manifests.map((X)=>X.name),3).slice(0,Z).map((X)=>X.existingName)}async function y5($,q){let Z=await I4(q);if(!Z)return E("registry: failed to fetch index — skipping registry resolution"),{resolved:null,multipleMatches:[],suggestions:[]};if(A4($)){let[z,J]=$.split("/"),G=SU(z,J,Z);if(G)return{resolved:{manifest:G,source:"registry"},multipleMatches:[],suggestions:[]};let Y=b5(J,Z);return{resolved:null,multipleMatches:[],suggestions:Y}}let Q=EU($,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=b5($,Z);return{resolved:null,multipleMatches:[],suggestions:X}}function k5($){let q=$.filter((Z)=>Z.provider!=="plugin").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:q}}import{readFile as bU,access as h5,mkdir as xU,cp as f5,rm as yU,symlink as kU}from"fs/promises";import{join as v5,basename as fU}from"path";function hU($){let q=[];if(typeof $!=="object"||$===null||Array.isArray($))return{valid:!1,errors:["Manifest must be a JSON object."]};let Z=$;if(Z.version!==1)q.push(`Unsupported manifest version: ${JSON.stringify(Z.version)}. Expected 1.`);if(typeof Z.exportedAt!=="string")q.push("Missing or invalid 'exportedAt' field.");if(!Array.isArray(Z.skills))return q.push("Missing or invalid 'skills' array."),{valid:!1,errors:q};for(let Q=0;Q<Z.skills.length;Q++){let X=Z.skills[Q];if(typeof X!=="object"||X===null){q.push(`skills[${Q}]: must be an object.`);continue}let z=X;if(typeof z.name!=="string"||!z.name)q.push(`skills[${Q}]: missing or empty 'name'.`);if(typeof z.dirName!=="string"||!z.dirName)q.push(`skills[${Q}]: missing or empty 'dirName'.`);if(typeof z.provider!=="string"||!z.provider)q.push(`skills[${Q}]: missing or empty 'provider'.`);if(z.scope!=="global"&&z.scope!=="project")q.push(`skills[${Q}]: invalid 'scope' "${String(z.scope)}". Must be "global" or "project".`)}return{valid:q.length===0,errors:q}}async function g5($){let q;try{q=await bU($,"utf-8")}catch(X){if(X?.code==="ENOENT")throw Error(`Manifest file not found: ${$}`);throw Error(`Failed to read manifest file: ${X.message}`)}let Z;try{Z=JSON.parse(q)}catch{throw Error("Manifest file is not valid JSON.")}let Q=hU(Z);if(!Q.valid)throw Error(`Invalid manifest:
|
|
160
160
|
${Q.errors.join(`
|
|
161
|
-
`)}`);return Z}async function
|
|
162
|
-
name: ${
|
|
161
|
+
`)}`);return Z}async function vU($){try{return await h5($),!0}catch{return!1}}function gU($,q){return $.providers.find((Z)=>Z.name===q&&Z.enabled)}function uU($,q,Z,Q){let X=gU($,q);if(!X)return null;let z=Z==="global"?X.global:X.project,J=X0(z),G=fU(Q);if(!G||G==="."||G==="..")return null;return v5(J,G)}function mU($,q){let Z=$.find((Q)=>Q.dirName===q.dirName&&Q.provider===q.provider);if(Z)return Z;return $.find((Q)=>Q.dirName===q.dirName)||null}async function u5($,q,Z){let Q=Z?.config??await v(),X=Z?.installedSkills??await i(Q,"both"),z=[];for(let U of $.skills){if(q.scopeFilter!=="both"&&U.scope!==q.scopeFilter){E(`import: skipping "${U.name}" — scope "${U.scope}" filtered out`);continue}let V=uU(Q,U.provider,U.scope,U.dirName);if(!V){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"failed",reason:`Provider "${U.provider}" not found or not enabled.`});continue}let H=await vU(V);if(H&&!q.force){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"skipped",reason:"Already installed.",path:V});continue}if(q.dryRun){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"dry-run",reason:H?"Would overwrite (--force).":"Would install.",path:V});continue}let B=mU(X,U);if(!B){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"failed",reason:"No installed source found. Install the skill first with: asm install <source>"});continue}try{if(await xU(v5(V,".."),{recursive:!0}),H)await yU(V,{recursive:!0,force:!0});if(U.isSymlink&&U.symlinkTarget)try{await h5(U.symlinkTarget),await kU(U.symlinkTarget,V),E(`import: symlinked "${U.name}" -> ${U.symlinkTarget} at ${V}`)}catch{await f5(B.realPath,V,{recursive:!0}),E(`import: symlink target unreachable, copied "${U.name}" from ${B.realPath} to ${V}`)}else await f5(B.realPath,V,{recursive:!0}),E(`import: copied "${U.name}" from ${B.realPath} to ${V}`);z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"installed",path:V})}catch(_){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"failed",reason:`Copy failed: ${_.message}`})}}let J=z.filter((U)=>U.status==="installed").length,G=z.filter((U)=>U.status==="skipped").length,Y=z.filter((U)=>U.status==="failed").length;return{total:z.length,installed:J,skipped:G,failed:Y,results:z}}import{mkdir as pU,writeFile as dU,access as cU}from"fs/promises";import{join as lU}from"path";function nU($){return`---
|
|
162
|
+
name: ${$}
|
|
163
163
|
description: ""
|
|
164
164
|
license: ""
|
|
165
165
|
metadata:
|
|
@@ -167,7 +167,7 @@ metadata:
|
|
|
167
167
|
creator: ""
|
|
168
168
|
---
|
|
169
169
|
|
|
170
|
-
# ${
|
|
170
|
+
# ${$}
|
|
171
171
|
|
|
172
172
|
Describe what this skill does here. This content will be loaded by the AI agent
|
|
173
173
|
as instructions for when and how to use this skill.
|
|
@@ -179,39 +179,69 @@ 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"),
|
|
182
|
+
`}async function m5($,q){await pU(q,{recursive:!0});let Z=lU(q,"SKILL.md"),Q=nU($);await dU(Z,Q,"utf-8")}async function p5($){try{return await cU($),!0}catch{return!1}}import{readdir as iU,stat as oU}from"fs/promises";import{join as aU}from"path";async function sU($){let q=0;try{let Q=(await iU($,{recursive:!0})).map(async(z)=>{try{let J=await oU(aU($,z));if(J.isFile())return J.size}catch{}return 0});q=(await Promise.all(Q)).reduce((z,J)=>z+J,0)}catch{}return q}async function l5($,q){let Z={},Q={global:0,project:0},X={},z=$.map(async(Y)=>{Z[Y.provider]=(Z[Y.provider]||0)+1,Q[Y.scope]++;let U=await sU(Y.path);return X[Y.path]=U,U}),G=(await Promise.all(z)).reduce((Y,U)=>Y+U,0);return{totalSkills:$.length,byProvider:Z,byScope:Q,totalDiskBytes:G,perSkillDiskBytes:X,duplicateGroups:q.duplicateGroups.length,duplicateInstances:q.totalDuplicateInstances}}function tU($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;if($<1073741824)return`${($/1048576).toFixed(1)} MB`;return`${($/1073741824).toFixed(1)} GB`}function T4($,q,Z=20){let Q=Math.round($/q*Z),X=Z-Q;return W.green("#".repeat(Q))+W.dim("-".repeat(X))}var d5={claude:"Claude Code",codex:"Codex",openclaw:"OpenClaw",agents:"Agents"};function n5($){let q=[];q.push(""),q.push(W.blueBold(" Skill Statistics")),q.push(W.dim(" "+"-".repeat(20))),q.push(""),q.push(` ${W.bold("Total:")} ${W.cyan(String($.totalSkills))} skills`),q.push(` ${W.bold("Disk:")} ${W.cyan(tU($.totalDiskBytes))}`),q.push(""),q.push(W.bold(" By Tool"));let Z=Object.entries($.byProvider).sort((Y,U)=>U[1]-Y[1]),Q=Math.max(...Z.map(([,Y])=>Y)),X=Math.max(...Z.map(([Y])=>(d5[Y]||Y).length));for(let[Y,U]of Z){let V=d5[Y]||Y,H=c5(Y,V.padEnd(X)),B=String(U).padStart(4);q.push(` ${H} ${B} ${T4(U,Q)}`)}q.push(""),q.push(W.bold(" By Scope"));let z=Math.max($.byScope.global,$.byScope.project),J=String($.byScope.global).padStart(4),G=String($.byScope.project).padStart(4);if(q.push(` ${"global ".padEnd(X)} ${J} ${T4($.byScope.global,z)}`),q.push(` ${"project".padEnd(X)} ${G} ${T4($.byScope.project,z)}`),q.push(""),q.push(W.bold(" Duplicates")),$.duplicateGroups>0)q.push(` ${W.yellow(`${$.duplicateGroups} group(s), ${$.duplicateInstances} total instance(s)`)}`),q.push(W.dim(` Run ${W.bold("asm audit")} to review`));else q.push(` ${W.green("None")}`);return q.push(""),q.join(`
|
|
183
|
+
`)}import{access as rU,lstat as M4,mkdir as eU,readdir as $W,readFile as i5,rm as qW,symlink as ZW}from"fs/promises";import{join as vq}from"path";async function j4($){let q;try{q=await M4($)}catch{throw Error(`Path does not exist: ${$}`)}if(!q.isDirectory())throw Error(`Path is not a directory: ${$}`);let Z=vq($,"SKILL.md"),Q;try{Q=await i5(Z,"utf-8")}catch{throw Error(`No SKILL.md found in ${$}`)}let X=r(Q);if(!X.name)throw Error(`Invalid SKILL.md in ${$}: missing "name" in frontmatter`);return{name:X.name,version:z0(X)}}async function o5($,q,Z,Q){let X=vq(q,Z),z=!1;try{await rU(X),z=!0}catch{}if(z){if(!Q)throw Error(`Target already exists: ${X}. Use --force to overwrite.`);await qW(X,{recursive:!0,force:!0})}await eU(q,{recursive:!0}),await ZW($,X,"dir")}async function N4($){let q;try{q=await M4($)}catch{throw Error(`Path does not exist: ${$}`)}if(!q.isDirectory())throw Error(`Path is not a directory: ${$}`);let Z=await $W($),Q=[];for(let X of Z){if(X.startsWith(".")||X==="node_modules")continue;let z=vq($,X);try{if(!(await M4(z)).isDirectory())continue}catch{continue}let J=vq(z,"SKILL.md");try{let G=await i5(J,"utf-8"),Y=r(G);if(Y.name)Q.push({absPath:z,dirName:X,name:Y.name,version:z0(Y)})}catch{}}return Q.sort((X,z)=>X.name.localeCompare(z.name)),Q}import{readFile as QW,writeFile as XW,readdir as zW,access as JW,mkdir as GW,rm as YW}from"fs/promises";import{join as y$,resolve as UW}from"path";import{homedir as WW}from"os";var f0=y$(WW(),".config","agent-skill-manager","bundles");function HW($){let q=[];if(typeof $!=="object"||$===null||Array.isArray($))return{valid:!1,errors:["Bundle must be a JSON object."]};let Z=$;if(Z.version!==1)q.push(`Unsupported bundle version: ${JSON.stringify(Z.version)}. Expected 1.`);if(typeof Z.name!=="string"||!Z.name)q.push("Missing or empty 'name' field.");if(typeof Z.description!=="string"||!Z.description)q.push("Missing or empty 'description' field.");if(typeof Z.author!=="string"||!Z.author)q.push("Missing or empty 'author' field.");if(typeof Z.createdAt!=="string")q.push("Missing or invalid 'createdAt' field.");if(!Array.isArray(Z.skills))return q.push("Missing or invalid 'skills' array."),{valid:!1,errors:q};if(Z.skills.length===0)q.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){q.push(`skills[${Q}]: must be an object.`);continue}let z=X;if(typeof z.name!=="string"||!z.name)q.push(`skills[${Q}]: missing or empty 'name'.`);if(typeof z.installUrl!=="string"||!z.installUrl)q.push(`skills[${Q}]: missing or empty 'installUrl'.`)}if(Z.tags!==void 0){if(!Array.isArray(Z.tags))q.push("'tags' must be an array of strings if provided.");else if(Z.tags.some((Q)=>typeof Q!=="string"))q.push("'tags' must contain only strings.")}return{valid:q.length===0,errors:q}}function a5($,q,Z,Q,X){return{version:1,name:$,description:q,author:Z,createdAt:new Date().toISOString(),skills:Q,tags:X}}async function s5($,q){let Z=q??await h0(),Q=Z.skills[$.name]||Z.skills[$.dirName],X;if($.isSymlink&&$.symlinkTarget)X=$.symlinkTarget;else if(Q?.source)X=Q.source;else X=$.path;return{name:$.name,installUrl:X,description:$.description||void 0,version:$.version||void 0}}async function VW(){await GW(f0,{recursive:!0})}function R4($){let q=$.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(q=q.replace(/^\.+|\.+$/g,""),!q||q==="."||q==="..")throw Error("Invalid bundle name: results in an empty filename after sanitization.");return q}async function t5($){await VW();let q=`${R4($.name)}.json`,Z=y$(f0,q);return await XW(Z,JSON.stringify($,null,2)+`
|
|
184
|
+
`,"utf-8"),E(`bundle: saved to ${Z}`),Z}async function D4($){let q;try{q=await QW($,"utf-8")}catch(X){if(X?.code==="ENOENT")throw Error(`Bundle file not found: ${$}`);throw Error(`Failed to read bundle file: ${X.message}`)}let Z;try{Z=JSON.parse(q)}catch{throw Error("Bundle file is not valid JSON.")}let Q=HW(Z);if(!Q.valid)throw Error(`Invalid bundle:
|
|
185
185
|
${Q.errors.join(`
|
|
186
|
-
`)}`);return Z}async function
|
|
187
|
-
`);for(let G=0;G<J.length;G++){let Y=J[G],
|
|
188
|
-
`)}function
|
|
189
|
-
About to publish "${
|
|
186
|
+
`)}`);return Z}async function w4($){if($.includes("/")||$.includes("\\")||$.endsWith(".json")){let Q=UW($);return D4(Q)}let q=`${R4($)}.json`,Z=y$(f0,q);return D4(Z)}async function r5(){let $=[];try{await JW(f0)}catch{return $}let q;try{q=await zW(f0)}catch{return $}for(let Z of q){if(!Z.endsWith(".json"))continue;let Q=y$(f0,Z);try{let X=await D4(Q);$.push(X)}catch{E(`bundle: skipping invalid file ${Q}`)}}return $.sort((Z,Q)=>Z.name.localeCompare(Q.name)),$}async function e5($){let q=`${R4($)}.json`,Z=y$(f0,q);try{return await YW(Z),E(`bundle: removed ${Z}`),!0}catch(Q){if(Q?.code==="ENOENT")return!1;throw Q}}import{readFile as MW,realpath as jW}from"fs/promises";import{join as NW,resolve as DW,relative as RW}from"path";var Z8=[{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 BW($,q){let Z={owner:$,repo:q,profileUrl:`https://github.com/${$}`,reposUrl:`https://github.com/${$}?tab=repositories`,isOrganization:null,publicRepos:null,accountAge:null,fetchError:null};try{let Q=await fetch(`https://api.github.com/users/${$}`,{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`}E(`security-audit: source analysis for ${$} -> repos=${Z.publicRepos}, org=${Z.isOrganization}, age=${Z.accountAge}`)}catch(Q){Z.fetchError=Q.message||"Failed to fetch GitHub profile",E(`security-audit: source analysis failed -> ${Z.fetchError}`)}return Z}function KW($){let q=new Map;for(let{relPath:X,content:z}of $){let J=z.split(`
|
|
187
|
+
`);for(let G=0;G<J.length;G++){let Y=J[G],U=Y.trim();for(let V of Z8)if(V.pattern.test(Y)){let H=V.category;if(!q.has(H))q.set(H,{description:V.description,matches:[]});let B=U.length>120?U.slice(0,120)+"...":U;q.get(H).matches.push({file:X,line:G+1,match:B,severity:V.severity})}}}let Z=[];for(let[X,z]of q)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 _W($){let q=new Map;for(let z of $)for(let J of z.matches)for(let G of Z8)if(G.permissionType&&G.category===z.category&&G.pattern.test(J.match)){let Y=G.permissionType;if(!q.has(Y))q.set(Y,{evidence:[],categories:new Set});let U=q.get(Y);U.evidence.push({file:J.file,line:J.line,match:J.match}),U.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)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 LW($,q,Z){let Q=0,X=0;for(let Y of $)for(let U of Y.matches){if(U.severity==="critical")Q++;if(U.severity==="warning")X++}let z=q.some((Y)=>Y.type==="shell"),J=q.some((Y)=>Y.type==="code-execution"),G=q.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 N0($,q,Z,Q){E(`security-audit: scanning ${$}`);let X=await l$($),z=X.reduce((H,B)=>H+B.lineCount,0),J=null;if(Z&&Q)J=await BW(Z,Q);let G=KW(X),Y=_W(G),{verdict:U,reason:V}=LW(G,Y,J);return{scannedAt:new Date().toISOString(),skillName:q,skillPath:$,source:J,codeScans:G,permissions:Y,totalFiles:X.length,totalLines:z,verdict:U,verdictReason:V}}var b=W,v0=56,FW={"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"},$8={critical:0,warning:1,info:2};function OW($){switch($){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 AW($){switch($){case"safe":return b.green;case"caution":return b.cyan;case"warning":return b.yellow;case"dangerous":return b.red}}function z$($){switch($){case"critical":return b.red("!!");case"warning":return b.yellow(" !");case"info":return b.dim(" i")}}function P4($,q){return $.length>q?$.slice(0,q-3)+"...":$}function gq($){return $.toLocaleString("en-US")}function Q8($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function q8($){return Q8($).length}function IW($){let q=new Map;for(let Z of $){let Q=`${Z.file}:${Z.line}`,X=q.get(Q);if(!X||$8[Z.severity]<$8[X.severity])q.set(Q,Z)}return Array.from(q.values())}function TW($){let q=new Map;for(let Z of $){let Q=q.get(Z.file);if(!Q)Q={file:Z.file,entries:[]},q.set(Z.file,Q);Q.entries.push({line:Z.line,match:Z.match,severity:Z.severity})}return Array.from(q.values())}function uq($){let q=[],Z=OW($.verdict),Q=Q8(Z),X=` ${b.bold($.skillName)}`,z=` ${$.skillName}`,J=v0-4,G=Math.max(1,J-z.length-Q.length);if(q.push(""),q.push(b.dim(" +-- ")+b.bold("Security Audit")+b.dim(" "+"-".repeat(v0-19)+"+")),q.push(b.dim(" |")+X+" ".repeat(G)+Z+b.dim("|")),q.push(b.dim(" |")+b.dim(` ${gq($.totalFiles)} files | ${gq($.totalLines)} lines`)+" ".repeat(Math.max(1,J-` ${gq($.totalFiles)} files | ${gq($.totalLines)} lines`.length))+b.dim("|")),q.push(b.dim(" +"+"-".repeat(v0-2)+"+")),$.source){let H=$.source;if(H.fetchError)q.push(` ${b.yellow("!")} Could not fetch profile: ${H.fetchError}`);else{let B=[];if(B.push(`${H.owner} ${H.isOrganization?b.cyan("(org)"):b.dim("(user)")}`),H.publicRepos!==null){let _=H.publicRepos,L=_<3?b.yellow(`${_} repos`):_<10?b.cyan(`${_} repos`):b.green(`${_} repos`);B.push(L)}if(H.accountAge)B.push(H.accountAge);q.push(` ${b.dim("Author:")} ${B.join(b.dim(" | "))}`)}}if(q.push(""),$.codeScans.length===0)q.push(` ${b.green("*")} ${b.green("No suspicious patterns detected.")}`);else{let H=AW($.verdict),B=$.verdict==="dangerous"||$.verdict==="warning"?z$("critical"):$.verdict==="caution"?z$("warning"):z$("info");q.push(` ${B} ${H($.verdictReason)}`);let _=0,L=0,K=0;for(let M of $.codeScans)for(let N of M.matches)if(N.severity==="critical")_++;else if(N.severity==="warning")L++;else K++;let F=[];if(_>0)F.push(b.red(`${_} critical`));if(L>0)F.push(b.yellow(`${L} warning`));if(K>0)F.push(b.dim(`${K} info`));let O=$.permissions.map((M)=>M.type),A=O.length>0?b.dim(`Perms: ${O.join(", ")}`):"";q.push(` ${F.join(b.dim(" | "))} ${A}`)}if(q.push(""),$.codeScans.length>0){q.push(` ${b.bold("Findings")}`),q.push(b.dim(" "+"=".repeat(v0-2)));for(let H of $.codeScans){let B=IW(H.matches),_=B.filter((I)=>I.severity==="critical").length,L=B.filter((I)=>I.severity==="warning").length,K=B.filter((I)=>I.severity==="info").length,F=_>0?z$("critical"):L>0?z$("warning"):z$("info"),O=[];if(_>0)O.push(b.red(`${_} critical`));if(L>0)O.push(b.yellow(`${L} warning`));if(K>0)O.push(b.dim(`${K} info`));let A=FW[H.category],M=A?b.dim(`PERM: ${A}`):"",N=` ${F} ${b.bold(H.category)} (${O.join(", ")})`;if(M){let I=q8(N),j=q8(M),C=Math.max(2,v0-I-j);q.push(N+" ".repeat(C)+M)}else q.push(N);let T=TW(B),D=Math.min(24,Math.max(...T.map((I)=>I.file.length))),x=0,P=3;for(let I of T){if(x>=P)break;let j=P4(I.file,24),C=b.dim(j.padEnd(D));if(I.entries.length===1){let S=I.entries[0],y=P4(S.match,50);q.push(` ${C} :${S.line} ${b.dim("--")} ${S.severity==="critical"?y:b.dim(y)}`),x++}else if(I.entries.length<=3){let S=I.entries.map((c)=>`:${c.line}`).join(", "),y=P4(I.entries[0].match,40);q.push(` ${C} ${S} ${b.dim("--")} ${b.dim(y)}`),x++}else{let y=I.entries.slice(0,3).map((p)=>`:${p.line}`).join(", "),c=I.entries.length-3;q.push(` ${C} ${y} ${b.dim(`(+${c} more)`)}`),x++}}let k=T.length-Math.min(T.length,P);if(k>0){let I=B.length-T.slice(0,P).reduce((j,C)=>j+C.entries.length,0);if(I>0)q.push(` ${b.dim(`... ${I} more in ${k} file${k>1?"s":""}`)}`)}q.push("")}}q.push(b.dim(" "+"=".repeat(v0-2)));let Y=new Date($.scannedAt),U=`${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")}`,V=$.source&&!$.source.fetchError?`github.com/${$.source.owner}`:"";if(V){let H=Math.max(2,v0-2-U.length-V.length);q.push(b.dim(` ${U}${" ".repeat(H)}${V}`))}else q.push(b.dim(` ${U}`));return q.push(""),q.join(`
|
|
188
|
+
`)}function C4($){return JSON.stringify($,null,2)}function mq($){return $.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 wW($){return $.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/</g,"<").replace(/>/g,">").replace(/\|/g,"\\|")}function E4($){return wW(mq($))}var g0="luongnv89/asm-registry";async function PW($){let q=NW($,"SKILL.md"),Z;try{Z=await MW(q,"utf-8")}catch{throw Error(`No SKILL.md found in ${$}. Run "asm init" to create one.`)}let Q=r(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=z0(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 CW($){if(await Bun.spawn(["git","rev-parse","--git-dir"],{cwd:$,stdout:"pipe",stderr:"pipe"}).exited!==0)throw Error(`${$} is not inside a git repository.`)}async function EW($){let q=Bun.spawn(["git","rev-parse","HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"}),Z=await new Response(q.stdout).text();if(await q.exited!==0)throw Error("Failed to get HEAD commit. Is this a git repository?");return Z.trim()}async function SW($){let q=Bun.spawn(["git","rev-parse","--show-toplevel"],{cwd:$,stdout:"pipe",stderr:"pipe"}),Z=await new Response(q.stdout).text();if(await q.exited!==0)throw Error("Failed to determine git repository root.");return Z.trim()}async function bW($){let q=Bun.spawn(["git","remote","get-url","origin"],{cwd:$,stdout:"pipe",stderr:"pipe"}),Z=await new Response(q.stdout).text();if(await q.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 xW(){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 yW($){switch($){case"safe":case"caution":return"pass";case"warning":return"warning";case"dangerous":return"dangerous"}}function X8($){let q={name:$.metadata.name,author:$.author,description:$.metadata.description,repository:$.repository,commit:$.commit,security_verdict:$.securityVerdict,published_at:new Date().toISOString()};if($.skillPath)q.skill_path=$.skillPath;if($.metadata.version&&$.metadata.version!=="0.0.0"&&/^\d+\.\d+\.\d+/.test($.metadata.version))q.version=$.metadata.version;if($.metadata.license)q.license=$.metadata.license;if($.metadata.tags&&$.metadata.tags.length>0)q.tags=$.metadata.tags.slice(0,10);return q}function kW($){let q=X8({metadata:$.metadata,author:$.metadata.creator||"unknown",commit:$.commit,repository:$.repository,securityVerdict:$.registryVerdict}),Z=hq(q);if(Z.length>0)return{success:!1,manifest:q,prUrl:null,error:`Manifest validation failed: ${Z.map((Q)=>`${Q.field}: ${Q.message}`).join("; ")}`,securityVerdict:$.registryVerdict,securityReport:$.securityReport};return{success:!0,manifest:q,prUrl:null,error:null,securityVerdict:$.registryVerdict,securityReport:$.securityReport,fallback:!0,fallbackReason:$.fallbackReason}}async function z8($){let q=DW($.path);E(`publish: starting for ${q}`),await CW(q);let Z=await PW(q);E(`publish: parsed metadata for "${Z.name}"`);let X=await($._auditFn??N0)(q,Z.name),z=yW(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"&&!$.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 EW(q),G=await bW(q),Y=await SW(q),U=await jW(q),V=RW(Y,U),H=V&&V!=="."?V:void 0,_=await($._checkGhCliFn??xW)();if(!_.available||!_.authenticated){let o=!_.available?"gh CLI not found":"gh CLI not authenticated";return kW({metadata:Z,commit:J,repository:G,registryVerdict:z,securityReport:X,fallbackReason:o})}if(!_.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 L=_.login,K=X8({metadata:Z,author:L,commit:J,repository:G,skillPath:H,securityVerdict:z}),F=hq(K);if(F.length>0)return{success:!1,manifest:K,prUrl:null,error:`Manifest validation failed: ${F.map((o)=>`${o.field}: ${o.message}`).join("; ")}`,securityVerdict:z,securityReport:X};if($.dryRun)return{success:!0,manifest:K,prUrl:null,error:null,securityVerdict:z,securityReport:X};if(!$.yes){if(!process.stdin.isTTY)return{success:!1,manifest:K,prUrl:null,error:"Cannot prompt for confirmation in non-interactive mode. Use --yes to skip.",securityVerdict:z,securityReport:X};let o=mq(Z.name),d$=mq(L);process.stderr.write(`
|
|
189
|
+
About to publish "${o}" by ${d$} to ${g0}.
|
|
190
190
|
Security verdict: ${z}
|
|
191
191
|
|
|
192
|
-
Proceed? [y/N] `);let
|
|
193
|
-
`))process.stdin.removeListener("data",
|
|
194
|
-
`,
|
|
195
|
-
`),
|
|
192
|
+
Proceed? [y/N] `);let eq=await new Promise((X2)=>{let c$="",z2=(vZ)=>{if(c$+=vZ.toString(),c$.includes(`
|
|
193
|
+
`))process.stdin.removeListener("data",z2),process.stdin.pause(),X2(c$.trim())};process.stdin.resume(),process.stdin.on("data",z2)});if(eq.toLowerCase()!=="y"&&eq.toLowerCase()!=="yes")return{success:!1,manifest:K,prUrl:null,error:"Publish aborted by user.",securityVerdict:z,securityReport:X}}E(`publish: forking ${g0}`),await Bun.spawn(["gh","repo","fork",g0,"--clone=false"],{stdout:"pipe",stderr:"pipe"}).exited;let A=`publish/${L}/${Z.name}`,M=`manifests/${L}/${Z.name}.json`,N=JSON.stringify(K,null,2)+`
|
|
194
|
+
`,T=Buffer.from(N,"utf-8").toString("base64"),D=Bun.spawn(["gh","api",`repos/${L}/asm-registry/git/refs/heads/main`,"--jq",".object.sha"],{stdout:"pipe",stderr:"pipe"}),x=await new Response(D.stdout).text();if(await D.exited!==0)return{success:!1,manifest:K,prUrl:null,error:`Failed to read fork's main branch. Ensure the fork exists at ${L}/asm-registry.`,securityVerdict:z,securityReport:X};let k=x.trim();if(await Bun.spawn(["gh","api",`repos/${L}/asm-registry/git/refs`,"-X","POST","-f",`ref=refs/heads/${A}`,"-f",`sha=${k}`],{stdout:"pipe",stderr:"pipe"}).exited!==0)await Bun.spawn(["gh","api",`repos/${L}/asm-registry/git/refs/heads/${A}`,"-X","PATCH","-f",`sha=${k}`,"-f","force=true"],{stdout:"pipe",stderr:"pipe"}).exited;let C=Bun.spawn(["gh","api",`repos/${L}/asm-registry/contents/${M}`,"-X","PUT","-f",`message=Publish ${L}/${Z.name}`,"-f",`content=${T}`,"-f",`branch=${A}`],{stdout:"pipe",stderr:"pipe"}),S=await new Response(C.stderr).text();if(await C.exited!==0){let o=Bun.spawn(["gh","api",`repos/${L}/asm-registry/contents/${M}?ref=${A}`,"-q",".sha"],{stdout:"pipe",stderr:"pipe"}),d$=(await new Response(o.stdout).text()).trim();if(await o.exited===0&&d$){if(await Bun.spawn(["gh","api",`repos/${L}/asm-registry/contents/${M}`,"-X","PUT","-f",`message=Update ${L}/${Z.name}`,"-f",`content=${T}`,"-f",`branch=${A}`,"-f",`sha=${d$}`],{stdout:"pipe",stderr:"pipe"}).exited!==0)return{success:!1,manifest:K,prUrl:null,error:"Failed to write manifest to registry fork.",securityVerdict:z,securityReport:X}}else return{success:!1,manifest:K,prUrl:null,error:`Failed to write manifest to registry fork. ${S}`,securityVerdict:z,securityReport:X}}let c=E4(Z.name),p=E4(Z.description),t=E4(Z.license),m$=`Publish ${L}/${mq(Z.name)}`,H0=[`## Skill: ${c}`,"",`**Author:** ${L}`,`**Version:** ${Z.version}`,`**Description:** ${p}`,`**License:** ${t}`,`**Repository:** ${G}`,`**Commit:** \`${J}\``,`**Security verdict:** ${z}`,"","---","","*This PR was generated by `asm publish`.*"].join(`
|
|
195
|
+
`),Z0=Bun.spawn(["gh","pr","create","--repo",g0,"--head",`${L}:${A}`,"--title",m$,"--body",H0],{stdout:"pipe",stderr:"pipe"}),m0=await new Response(Z0.stdout).text(),p$=await new Response(Z0.stderr).text(),Y$=await Z0.exited,p0=null;if(Y$===0)p0=m0.trim();else{let o=p$.match(/https:\/\/github\.com\/[^\s]+\/pull\/\d+/);if(o)p0=o[0]}if(!p0)return{success:!1,manifest:K,prUrl:null,error:`Failed to create PR against ${g0}. ${p$}`,securityVerdict:z,securityReport:X};return{success:!0,manifest:K,prUrl:p0,error:null,securityVerdict:z,securityReport:X}}function J8($){let q=$.manifest;if(!q)return"";return["",` gh CLI is unavailable (${$.fallbackReason}).`," To publish manually:","",` 1. Fork ${g0} on GitHub`,` 2. Create branch: publish/${q.author}/${q.name}`,` 3. Add file: manifests/${q.author}/${q.name}.json`," 4. Paste the manifest below into that file",` 5. Open a PR against ${g0}`,"",' Run "asm doctor" to fix your environment.',""," Generated manifest:",JSON.stringify(q,null,2).split(`
|
|
196
196
|
`).map((Q)=>` ${Q}`).join(`
|
|
197
197
|
`)].join(`
|
|
198
|
-
`)}import{execFile as
|
|
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
|
|
200
|
-
`)}function
|
|
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
|
|
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
|
|
203
|
-
`)}function
|
|
204
|
-
`);
|
|
205
|
-
|
|
206
|
-
|
|
198
|
+
`)}import{execFile as fW}from"child_process";import{promisify as hW}from"util";import{rm as pq,rename as G8,cp as Y8,access as vW,mkdir as gW}from"fs/promises";import{join as dq}from"path";import{homedir as U8}from"os";var S4=hW(fW);async function uW($,q,Z){let Q=Array($.length),X=0;async function z(){while(X<$.length){let G=X++;Q[G]=await Z($[G])}}let J=[];for(let G=0;G<Math.min(q,$.length);G++)J.push(z());return await Promise.all(J),Q}async function mW($,q){try{let Z=["ls-remote",$];if(q)Z.push(q);else Z.push("HEAD");let{stdout:Q}=await S4("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 E(`updater: git ls-remote failed for ${$}: ${Z}`),null}}function b4($){if($.sourceType)return $.sourceType;if($.source.startsWith("local:"))return"local";return"github"}function W8($){if($.startsWith("github:")){let q=$.slice(7),Z=q.indexOf("#");if(Z!==-1)q=q.slice(0,Z);return`https://github.com/${q}.git`}if($.startsWith("file://"))return $;return null}function pW($){if(!$.startsWith("github:"))return null;let q=$.slice(7),Z=q.indexOf("#");if(Z!==-1)q=q.slice(0,Z);let Q=q.split("/");if(Q.length<2||!Q[0]||!Q[1])return null;return{owner:Q[0],repo:Q[1]}}async function x4($){let q=$?.readLockFn??h0,Z=$?.fetchRegistryIndexFn??I4,Q=$?.lock??await q(),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])=>b4(Y)==="registry"||Y.registryName))z=await Z();let G=await uW(X,5,async([Y,U])=>{let V=b4(U);if(!U.commitHash||U.commitHash==="unknown")return{name:Y,installedCommit:U.commitHash||"unknown",latestCommit:"unknown",source:U.source,sourceType:V,status:"untracked"};if(V==="local")return{name:Y,installedCommit:U.commitHash,latestCommit:U.commitHash,source:U.source,sourceType:V,status:"up-to-date"};if(V==="registry"&&z){let L=U.registryName||Y,K=z.manifests.find((F)=>F.name.toLowerCase()===L.toLowerCase());if(K){let F=K.commit!==U.commitHash;return{name:Y,installedCommit:W0(U.commitHash),latestCommit:W0(K.commit),source:U.source,sourceType:V,status:F?"outdated":"up-to-date"}}}let H=W8(U.source);if(!H)return{name:Y,installedCommit:W0(U.commitHash),latestCommit:"unknown",source:U.source,sourceType:V,status:"error",error:"Cannot determine remote URL"};let B=await mW(H,U.ref);if(!B)return{name:Y,installedCommit:W0(U.commitHash),latestCommit:"unknown",source:U.source,sourceType:V,status:"error",error:"Failed to fetch remote commit"};let _=B!==U.commitHash;return{name:Y,installedCommit:W0(U.commitHash),latestCommit:W0(B),source:U.source,sourceType:V,status:_?"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 dW($,q,Z,Q){if(b4(q)==="local")return{name:$,status:"skipped",reason:"Local skill (not updatable)"};let z=W8(q.source);if(!z)return{name:$,status:"failed",reason:"Cannot determine remote URL"};let J=dq(U8(),".config","agent-skill-manager",".tmp",`${$}-${Date.now()}`);try{let G=dq(U8(),".config","agent-skill-manager",".tmp");await gW(G,{recursive:!0}),E(`updater: cloning latest ${$} to ${J}`);let Y=["clone","--depth","1"];if(q.ref&&q.ref!=="HEAD")Y.push("--branch",q.ref);Y.push(z,J);try{await S4("git",Y,{timeout:60000})}catch(T){return{name:$,status:"failed",reason:`Clone failed: ${T.stderr||T.message}`}}let U=null;try{let{stdout:T}=await S4("git",["rev-parse","HEAD"],{cwd:J,timeout:5000});U=T.trim()}catch{return{name:$,status:"failed",reason:"Could not read new commit"}}if(U===q.commitHash)return{name:$,status:"skipped",reason:"Already up to date"};E(`updater: running security audit on ${$}`);let V="safe";try{let T=Q?.auditFn??N0,D=pW(q.source);if(V=(await T(J,$,D?.owner,D?.repo)).verdict,V==="dangerous")return{name:$,status:"skipped",reason:"Security audit: dangerous — update blocked",securityVerdict:V};if(V==="warning"||V==="caution"){if(!Z)return{name:$,status:"skipped",reason:`Security audit: ${V} — use --yes to override`,securityVerdict:V};E(`updater: security audit ${V} for ${$} — proceeding (--yes)`)}}catch(T){return E(`updater: security audit failed for ${$}: ${T.message}`),{name:$,status:"failed",reason:`Security audit failed — skipping update: ${T.message}`}}let H=Q?.loadConfigFn??v,B=Q?.resolveProviderPathFn??X0,L=(await H()).providers.find((T)=>T.name===q.provider),K=L?L.global:`~/.${q.provider}/skills`,F=B(K),O=dq(F,$),A=dq(J,".git");try{await pq(A,{recursive:!0,force:!0})}catch{}try{await vW(O)}catch{let T=Q?.writeLockEntryFn??k$;return await Y8(J,O,{recursive:!0}),await T($,{...q,commitHash:U,installedAt:new Date().toISOString()}),{name:$,status:"updated",oldCommit:W0(q.commitHash),newCommit:W0(U),securityVerdict:V}}let M=`${O}.bak-${Date.now()}`;try{await G8(O,M),await Y8(J,O,{recursive:!0}),await pq(M,{recursive:!0,force:!0})}catch(T){try{await pq(O,{recursive:!0,force:!0}),await G8(M,O)}catch{}return{name:$,status:"failed",reason:`Atomic swap failed: ${T.message}`}}return await(Q?.writeLockEntryFn??k$)($,{...q,commitHash:U,installedAt:new Date().toISOString()}),{name:$,status:"updated",oldCommit:W0(q.commitHash),newCommit:W0(U),securityVerdict:V}}finally{try{await pq(J,{recursive:!0,force:!0})}catch{}}}async function H8($,q,Z){let Q=Z?.readLockFn??h0,X=Z?.checkOutdatedFn??x4,z=Z?.updateSkillFn??dW,J=await Q(),G=await X({lock:J}),Y=G.entries.filter((H)=>H.status==="outdated"),U=[];if($&&$.length>0){let H=new Set($.map((B)=>B.toLowerCase()));Y=Y.filter((B)=>H.has(B.name.toLowerCase()));for(let B of $)if(!Y.find((_)=>_.name.toLowerCase()===B.toLowerCase()))if(!G.entries.find((L)=>L.name.toLowerCase()===B.toLowerCase()))E(`updater: skill "${B}" not found in lock file`),U.push(B);else E(`updater: skill "${B}" is already up to date`)}if(Y.length===0)return{results:[],updatedCount:0,skippedCount:0,failedCount:0,...U.length>0?{warnings:U}:{}};let V=[];for(let H of Y){let B=J.skills[H.name];if(!B)continue;let _=await z(H.name,B,q);V.push(_)}return{results:V,updatedCount:V.filter((H)=>H.status==="updated").length,skippedCount:V.filter((H)=>H.status==="skipped").length,failedCount:V.filter((H)=>H.status==="failed").length,...U.length>0?{warnings:U}:{}}}function W0($){if(!$||$==="unknown")return"unknown";return $.slice(0,7)}function V8($,q){if($.entries.length===0)return"No skills installed.";let Z=(H)=>H,Q=q?W.red:Z,X=q?W.green:Z,z=q?W.yellow:Z,J=q?W.dim:Z,G=`${"Skill".padEnd(22)}${"Installed".padEnd(14)}${"Latest".padEnd(14)}Source`,Y="─".repeat(60),U=[G,Y];for(let H of $.entries){let B=H.name.padEnd(22),_=H.installedCommit.padEnd(14),L,K;switch(H.status){case"outdated":L=Q(H.latestCommit.padEnd(14)),K=H.sourceType;break;case"up-to-date":L=X(H.latestCommit.padEnd(14)),K=J("(up to date)");break;case"untracked":L=z("untracked".padEnd(14)),K=z("untracked");break;case"error":L=J("error".padEnd(14)),K=J(H.error||"error");break}U.push(`${B}${_}${L}${K}`)}U.push("");let V=[];if($.outdatedCount>0)V.push(Q(`${$.outdatedCount} outdated`));if($.upToDateCount>0)V.push(X(`${$.upToDateCount} up to date`));if($.untrackedCount>0)V.push(z(`${$.untrackedCount} untracked`));if($.errorCount>0)V.push(J(`${$.errorCount} error`));return U.push(V.join(", ")),U.join(`
|
|
200
|
+
`)}function B8($){return JSON.stringify({skills:$.entries.map((q)=>({name:q.name,installed:q.installedCommit,latest:q.latestCommit,source:q.sourceType,status:q.status,...q.error?{error:q.error}:{}})),summary:{outdated:$.outdatedCount,upToDate:$.upToDateCount,untracked:$.untrackedCount,errors:$.errorCount}},null,2)}function K8($){return JSON.stringify({results:$.results.map((q)=>({name:q.name,status:q.status,...q.reason?{reason:q.reason}:{},...q.oldCommit?{oldCommit:q.oldCommit}:{},...q.newCommit?{newCommit:q.newCommit}:{},...q.securityVerdict?{securityVerdict:q.securityVerdict}:{}})),summary:{updated:$.updatedCount,skipped:$.skippedCount,failed:$.failedCount}},null,2)}import{execFile as cW}from"child_process";import{promisify as lW}from"util";import{access as _8,readFile as O8,readdir as nW,writeFile as iW,rm as oW,stat as A8}from"fs/promises";import{join as y4}from"path";import{homedir as aW}from"os";import{constants as L8}from"fs";var J$=lW(cW);async function sW($){let q=$?.execFn??J$;try{let{stdout:Z}=await q("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 tW($){let q=$?.execFn??J$;try{let{stdout:Z}=await q("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 rW($){let q=$?.execFn??J$;try{let{stdout:Z}=await q("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 eW($){let q=$?.execFn??J$;try{let{stdout:Z}=await q("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 $H($){let q=$?.execFn??J$;try{let{stdout:Z}=await q("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 qH($){try{let q=y4($,".asm-doctor-write-test");return await iW(q,"test","utf-8"),await oW(q),{writable:!0,exists:!0}}catch{}try{return await _8($,L8.W_OK),{writable:!0,exists:!0}}catch{}try{return await _8($,L8.F_OK),{writable:!1,exists:!0}}catch{return{writable:!0,exists:!1}}}async function ZH($){let q=$.providers.filter((z)=>z.enabled),Z=0,Q=0;for(let z of q){let J=X0(z.global);if(Q++,(await qH(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 QH(){let $=f$();try{let q=await O8($,"utf-8"),Z=JSON.parse(q),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(q){if(q?.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 XH(){let $=F8();try{let q=await O8($,"utf-8"),Z=JSON.parse(q);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 U=Y;for(let V of z)if(!U[V]){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(q){if(q?.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 zH(){try{let $=await fetch(F4,{method:"HEAD",signal:AbortSignal.timeout(5000)});if($.ok)return{name:"Registry reachable",status:"pass",message:"OK"};return{name:"Registry reachable",status:"fail",message:`HTTP ${$.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 JH($,q){let Z=Object.entries(q.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=$.providers.find((H)=>H.name===G.provider);if(!Y){Q.push(J);continue}let U=X0(Y.global),V=y4(U,J);try{if(!(await A8(V)).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 GH($,q){let Z=new Set(Object.keys(q.skills)),Q=[];for(let X of $.providers.filter((z)=>z.enabled)){let z=X0(X.global);try{let J=await nW(z);for(let G of J)try{if((await A8(y4(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 YH($){let q=$?.execFn??J$;try{let{stdout:Z}=await q("df",["-Pk",aW()],{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 I8(){let $=await v(),q=await h0(),Q=(await Promise.allSettled([sW(),tW(),rW(),eW(),$H(),ZH($),QH(),XH(),zH(),JH($,q),GH($,q),YH()])).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 UH={pass:"✅",warn:"⚠️ ",fail:"❌"};function T8($){let q=["Checking your environment...",""];for(let Z of $.checks){let X=` ${UH[Z.status]} ${Z.name}${Z.message?` (${Z.message})`:""}`;if(q.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}`;q.push(` → ${z}`)}}return q.push(""),q.push(`${$.passed} passed, ${$.warnings} warning${$.warnings!==1?"s":""}, ${$.failures} error${$.failures!==1?"s":""}`),q.join(`
|
|
203
|
+
`)}function M8($){return JSON.stringify({checks:$.checks.map((q)=>({name:q.name,status:q.status,message:q.message,...q.fix?{fix:q.fix}:{}})),summary:{passed:$.passed,warnings:$.warnings,failures:$.failures}},null,2)}import{readFile as f4,writeFile as WH,stat as D8,copyFile as HH}from"fs/promises";import{join as R8,resolve as w8,basename as h4,isAbsolute as P8}from"path";var j8=["name","description","version","license","creator","compatibility","allowed-tools","effort","tags","metadata"],N8=["add","analyze","audit","build","check","configure","convert","create","debug","deploy","detect","edit","evaluate","explain","export","extract","fetch","find","fix","format","generate","identify","improve","index","inspect","install","list","manage","migrate","optimize","parse","plan","prepare","publish","refactor","remove","rename","report","research","review","run","scaffold","scan","score","search","set","setup","show","summarize","sync","test","transform","translate","update","validate","verify","write"],VH=["confirm","confirmation","error","errors","fail","failure","caution","warning","prerequisite","prerequisites","requires","requirements","rollback","dry-run","dry run","safety","validate","validation","check","backup"],BH=["acceptance criteria","expected output","expected result","edge case","edge cases","test","tests","testing","verify","verification","assert","example input","example output","given","then"],KH=["reference","references","see","template","templates","script","scripts","helper","helpers","link"],_H=["when to use","quick start","overview","instructions","steps","workflow","phases","progressive"];function C8($){let q=$.split(`
|
|
204
|
+
`);if(q.length===0||q[0].trim()!=="---")return{rawFrontmatter:null,body:$};for(let Z=1;Z<q.length;Z++)if(q[Z].trim()==="---"){let Q=q.slice(1,Z).join(`
|
|
205
|
+
`),X=q.slice(Z+1).join(`
|
|
206
|
+
`);return{rawFrontmatter:Q,body:X}}return{rawFrontmatter:q.slice(1).join(`
|
|
207
|
+
`),body:""}}function E8($){if(!$)return 0;return $.split(`
|
|
208
|
+
`).length}function g4($){if(!$)return 0;return $.split(/\s+/).map((q)=>q.trim()).filter(Boolean).length}function LH($,q=1){return($.match(/^#{1,6}\s+\S/gm)||[]).length>=q}function cq($,q){let Z=$.toLowerCase();return q.filter((Q)=>Z.includes(Q))}function FH($){return/```[\s\S]+?```/m.test($)}function OH($){return/^\s*[-*]\s+\S/m.test($)||/^\s*\d+\.\s+\S/m.test($)}function AH($,q,Z){let Q=[],X=[],z=0;if(Z!==null)z+=2,Q.push("Has YAML frontmatter block.");else Q.push("SKILL.md has no YAML frontmatter."),X.push("Add a YAML frontmatter block delimited by `---` with at least `name` and `description` fields.");let J=Boolean($.name&&$.name.trim()),G=Boolean($.description&&$.description.trim());if(J)z+=1.5;else Q.push("Missing required field: name."),X.push("Add `name:` to frontmatter (use the skill directory name).");if(G)z+=1.5;else Q.push("Missing required field: description."),X.push("Add a one-line `description:` to frontmatter.");let Y=z0($);if(Y&&Y!=="0.0.0")z+=1;else Q.push("Missing or default version."),X.push("Set `metadata.version` (or top-level `version`) using semver (e.g. 0.1.0).");if(Boolean($.creator||$["metadata.creator"]))z+=1;else Q.push("Missing `creator`."),X.push("Add a `creator` field so users know who authored and maintains the skill.");if(Boolean($.license))z+=1;else Q.push("Missing `license`."),X.push("Add a `license` field (e.g. `license: MIT`).");let B=q.trim().length>=20,_=LH(q,1);if(B)z+=1,Q.push("Body has meaningful content.");else Q.push("Body content is too short (<20 chars of instructions)."),X.push("Flesh out the markdown body with at least one paragraph of instructions for the agent.");if(_)z+=1,Q.push("Body uses markdown headings.");else Q.push("Body has no markdown headings."),X.push("Add section headings (e.g. `## When to Use`, `## Instructions`) so the agent can navigate the skill quickly.");return{id:"structure",name:"Structure & completeness",score:Math.round(z),max:10,findings:Q,suggestions:X}}function IH($,q){let Z=[],Q=[],X=0,z=($.description||"").trim();if(!z)return Z.push("No description."),Q.push("Write a one-sentence description that says specifically what the skill does and when to use it."),{id:"description",name:"Description quality",score:0,max:10,findings:Z,suggestions:Q};let J=g4(z);if(Z.push(`Description is ${J} words.`),J>=8&&J<=40)X+=4;else if(J>=5&&J<8)X+=2,Q.push("Lengthen the description slightly so it names both the action and the trigger (aim for 8–20 words).");else if(J>=41&&J<=60)X+=2,Q.push("Trim the description — aim for under 40 words. Move the long version to the markdown body.");else if(J>60)X+=0,Q.push("Description is too long. Keep it under 40 words; put detail in the body.");else X+=0,Q.push("Description is too short. Aim for 8–20 words.");let G=z.split(/\s+/)[0]?.toLowerCase().replace(/[^\w-]/g,"");if(Boolean(G&&(N8.includes(G)||N8.includes(G.replace(/s$/,"")))))X+=3,Z.push("Starts with an action verb.");else Z.push(`Does not start with a recognized action verb (got "${G??""}").`),Q.push('Start the description with an imperative action verb (e.g. "Generate...", "Analyze...", "Review...").');if(/\buse when\b|\btrigger\b|\bwhen\b|\bfor\b/i.test(z)||/\b(before|after|during)\b/i.test(z))X+=3,Z.push("Mentions a trigger or use-case signal.");else Z.push("No explicit trigger / use-case phrase."),Q.push('Name the trigger in the description — e.g. "Use when...", "for reviewing...", "before publishing...".');return{id:"description",name:"Description quality",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function TH($,q){let Z=[],Q=[],X=0,z=cq(q,_H);if(z.length>=2)X+=3,Z.push(`Progressive disclosure cues present: ${z.slice(0,3).join(", ")}.`);else if(z.length===1)X+=1,Q.push('Add clearer section labels — e.g. "## When to Use" and "## Instructions" — to support progressive disclosure.');else Q.push('Structure the body with "## When to Use" and "## Instructions" sections so the agent reads only what it needs.');if(OH(q))X+=2,Z.push("Uses lists or numbered steps.");else Z.push("No lists or steps detected."),Q.push("Use bulleted or numbered steps to narrow the agent's degrees of freedom.");let J=FH(q),G=/\bexample\b/i.test(q);if(J&&G)X+=2,Z.push("Includes example code block.");else if(J||G)X+=1,Q.push('Back up examples with fenced code blocks labelled under "## Example" so the agent sees concrete input/output.');else Q.push('Add an "## Example" section with a fenced code block showing the desired output.');let Y=(q.match(/^\s*[-*0-9.]*\s*(Do|Use|Run|Call|Check|Validate|Return|Emit|Write|Read|Ask|Confirm|Avoid|Never|Always)\b/gim)||[]).length;if(Y>=3)X+=2,Z.push(`Uses imperative voice (${Y} cues).`);else if(Y>=1)X+=1,Q.push("Favor imperative voice (Do / Use / Avoid / Never) to narrow the agent's choices.");else Q.push('Rewrite instructions in the imperative mood — e.g. "Run `git status` first" instead of "you might want to run".');let U=g4(q);if(U>=80&&U<=3000)X+=1,Z.push(`Body length within healthy range (${U} words).`);else if(U<80)Z.push(`Body is very short (${U} words).`),Q.push("Expand the instructions; an underspecified skill gives the agent too much freedom.");else Z.push(`Body is very long (${U} words).`),Q.push("Split large content into referenced files; keep SKILL.md focused under ~3000 words.");return{id:"prompt-engineering",name:"Prompt engineering",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function MH($,q){let Z=[],Q=[],X=0,z=g4(q);if(Z.push(`Body is ${z} words.`),z>=120&&z<=1500)X+=4;else if(z>=60&&z<120)X+=2,Q.push("Expand instructions slightly — too little context can push the agent to improvise.");else if(z>1500&&z<=3000)X+=2,Q.push("Consider moving large sections into referenced files (e.g. `references/*.md`) and linking them instead of inlining.");else if(z>3000)X+=0,Q.push("Body is over 3000 words — split long content into referenced files or templates.");let J=cq(q,KH);if(J.length>=2)X+=3,Z.push(`References external files or links (${J.slice(0,3).join(", ")}).`);else if(J.length===1)X+=1,Q.push('Link out to supporting files (e.g. "see `references/examples.md`") instead of inlining them.');else Q.push('Offload verbose content to referenced files and link to them ("see `./templates/x.md`").');let Y=(q.match(/```[\s\S]+?```/g)||[]).filter((U)=>E8(U)>60);if(Y.length===0)X+=2,Z.push("No oversized code blocks.");else Z.push(`${Y.length} code block(s) longer than 60 lines.`),Q.push("Move large code blocks into referenced template files; link to them from SKILL.md.");if(/\btoken\b|\bbudget\b|\bcontext window\b/i.test(q))X+=1,Z.push("Mentions tokens/budget/context window.");return{id:"context-efficiency",name:"Context efficiency",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function jH($,q){let Z=[],Q=[],X=0,z=cq(q,VH);if(z.length>=4)X+=4,Z.push(`Covers multiple safety cues (${z.slice(0,4).join(", ")}).`);else if(z.length>=2)X+=2,Z.push(`Mentions a few safety cues: ${z.join(", ")}.`),Q.push("Add explicit error-handling and confirmation steps so the agent knows how to recover from failures.");else if(z.length===1)X+=1,Q.push('Expand the safety section — include prerequisites, validation steps, and what to do "on error".');else Q.push("Describe prerequisites, confirmation prompts, and error-handling steps to reduce blast radius.");let J=/\b(rm\s|delete|remove|drop|force|overwrite|destructive)\b/i.test(q),G=/\bconfirm\b|\bdry-?run\b|\bare you sure\b|\bbackup\b/i.test(q);if(J&&G)X+=3,Z.push("Destructive actions paired with confirmation/dry-run.");else if(J)Z.push("References destructive actions without explicit confirmation/dry-run."),Q.push("Pair any destructive command with an explicit confirmation prompt, dry-run flag, or backup step.");else X+=1.5;if(/\bprerequisit/i.test(q)||/\brequire/i.test(q)||/\bdepend/i.test(q))X+=3,Z.push("Declares prerequisites or requirements.");else Z.push("No prerequisites / requirements section."),Q.push('Add a "## Prerequisites" block listing required tools, credentials, and environment state.');return{id:"safety",name:"Safety & guardrails",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function NH($,q){let Z=[],Q=[],X=0,z=cq(q,BH);if(z.length>=4)X+=5,Z.push(`Many testability cues present (${z.slice(0,4).join(", ")}).`);else if(z.length>=2)X+=3,Z.push(`Some testability cues: ${z.join(", ")}.`),Q.push('Add an "## Acceptance Criteria" block listing verifiable outputs or checklist items.');else if(z.length===1)X+=1,Q.push('Add concrete "expected output" examples so the agent can self-check.');else Q.push('Add a "## Acceptance Criteria" section with testable statements (e.g. "produces a JSON report with overall_score").');if(/expected\s+(output|result|response)/i.test(q))X+=3,Z.push("Describes expected output/result.");else Q.push('Include an "Expected output" example so reviewers and the agent can verify correctness.');if(/\bedge case|gotcha|pitfall|limitation/i.test(q))X+=2,Z.push("Mentions edge cases or limitations.");else Q.push('Add a short "Edge cases" list to describe inputs the skill should reject or handle carefully.');return{id:"testability",name:"Testability",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function DH($,q){let Z=[],Q=[],X=0,z=($.name||"").trim();if(z){let Y=/^[a-z][a-z0-9-]*$/.test(z),U=z.length<=40;if(Y&&U)X+=4,Z.push(`name "${z}" follows kebab-case convention.`);else{if(!Y)Z.push(`name "${z}" is not lowercase kebab-case.`),Q.push(`Rename to lowercase kebab-case (e.g. "${z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}").`);if(!U)Z.push(`name is ${z.length} chars; keep it <= 40.`)}}else Q.push("Add a kebab-case `name` (e.g. `my-skill`).");let J=q.match(/^#{1,6}\s+(.+)$/gm)||[];if(J.length>0)if(J.filter((V)=>/^#{1,6}\s+([A-Z][a-z]+|Use|How|When|Workflow|Instructions|Examples|Steps|Acceptance)/.test(V)).length/J.length>=0.5)X+=3,Z.push("Most headings use action/imperative labels.");else X+=1,Q.push("Rename body headings to action-oriented labels (e.g. `## Instructions`, `## When to Use`).");if(!/(?:\s\s|\bTODO\b|\bFIXME\b|\?{2,})/.test($.description||""))X+=2,Z.push("Description looks clean (no TODO/FIXME/stray noise).");else Q.push("Clean up description — remove TODOs, FIXMEs, double spaces, or trailing punctuation.");return{id:"naming",name:"Naming & conventions",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function v4($){let{content:q,skillPath:Z,skillMdPath:Q}=$,X=r(q),{rawFrontmatter:z,body:J}=C8(q),G=[AH(X,J,z),IH(X,J),TH(X,J),MH(X,J),jH(X,J),NH(X,J),DH(X,J)];if(X.name&&h4(Z)===X.name){let L=G.find((K)=>K.id==="naming");if(L.score<L.max)L.score=Math.min(L.max,L.score+1),L.findings.push("Directory name matches frontmatter `name`.")}let Y=G.reduce((L,K)=>L+K.score,0),U=G.reduce((L,K)=>L+K.max,0),V=Math.round(Y/U*100),H="F";if(V>=90)H="A";else if(V>=80)H="B";else if(V>=65)H="C";else if(V>=50)H="D";let B=[],_=[...G].sort((L,K)=>L.score/L.max-K.score/K.max);for(let L of _){for(let K of L.suggestions){if(B.length>=3)break;if(!B.includes(K))B.push(K)}if(B.length>=3)break}return{skillPath:Z,skillMdPath:Q,evaluatedAt:new Date().toISOString(),categories:G,overallScore:V,grade:H,topSuggestions:B,frontmatter:X}}async function S8($){let q=P8($)?$:w8($),Z;try{Z=await D8(q)}catch{throw Error(`Skill path does not exist: ${q}`)}let Q,X;if(Z.isFile())return Q=q,X=await f4(Q,"utf-8"),v4({content:X,skillPath:h4(q)==="SKILL.md"?h4(q):q,skillMdPath:Q});if(!Z.isDirectory())throw Error(`Skill path is not a directory or file: ${q}`);Q=R8(q,"SKILL.md");try{X=await f4(Q,"utf-8")}catch{throw Error(`SKILL.md not found in ${q}. Run "asm init" to create one.`)}return v4({content:X,skillPath:q,skillMdPath:Q})}function RH($){if($<=20)return"low";if($<=80)return"medium";if($<=250)return"high";return"max"}function wH($){let q=$.split(`
|
|
209
|
+
`),Z=[],Q=[],X=0;while(X<q.length){let U=q[X];if(!U.trim()){X++;continue}let H=U.match(/^([A-Za-z_][\w-]*):\s*(.*)$/);if(!H)return{newFrontmatter:$,changed:!1};let B=H[1],_=H[2];if(_===""||_===">"||_==="|"){let L=[U];X++;while(X<q.length){let K=q[X];if(K.trim()===""){L.push(K),X++;continue}if(/^\s+/.test(K))L.push(K),X++;else break}Q.push({key:B,text:L.join(`
|
|
210
|
+
`)})}else Z.push({key:B,text:U}),X++}let z=(U)=>{let V=j8.indexOf(U);return V===-1?j8.length+1:V},J=[...Z].sort((U,V)=>{let H=z(U.key),B=z(V.key);if(H!==B)return H-B;return Z.indexOf(U)-Z.indexOf(V)}),G=J.some((U,V)=>U!==Z[V]);return{newFrontmatter:[...J.map((U)=>U.text),...Q.map((U)=>U.text)].join(`
|
|
211
|
+
`),changed:G}}function PH($,q={}){let Z=[],Q=[],X=$.replace(/\r\n/g,`
|
|
212
|
+
`);if(X!==$)Z.push({id:"normalise-line-endings",description:"Convert CRLF line endings to LF."});let z=X.split(`
|
|
213
|
+
`),J=z.map((F)=>F.replace(/[ \t]+$/g,""));if(J.some((F,O)=>F!==z[O]))Z.push({id:"strip-trailing-whitespace",description:"Strip trailing whitespace from lines."});X=J.join(`
|
|
214
|
+
`);let{rawFrontmatter:G,body:Y}=C8(X),U=r(X);if(G===null)return Q.push({id:"missing-frontmatter",description:"SKILL.md has no frontmatter — not auto-fixable (requires author decisions)."}),{newContent:X,applied:Z,skipped:Q};let V=G;if(!Boolean(U.version||U["metadata.version"]))V=k4(V,"version","0.1.0"),Z.push({id:"add-missing-version",description:"Add `version: 0.1.0`."});if(!Boolean(U.creator||U["metadata.creator"])){let F=q.gitAuthor?.trim();if(F)V=k4(V,"creator",F),Z.push({id:"add-missing-creator",description:`Add \`creator: ${F}\` from git config.`});else Q.push({id:"add-missing-creator",description:"Missing `creator` — no git user.name found to fill in safely."})}if(!U.effort){let F=RH(E8(Y));V=k4(V,"effort",F),Z.push({id:"infer-missing-effort",description:`Infer \`effort: ${F}\` from body size.`})}if(!U.description)Q.push({id:"missing-description",description:"Missing `description` — content-level fix, left to the author."});let _=wH(V);if(_.changed)Z.push({id:"reorder-frontmatter",description:"Reorder frontmatter fields to canonical order."}),V=_.newFrontmatter;let L=Y.replace(/^\n+/,""),K=`---
|
|
215
|
+
${V.replace(/^\n+|\n+$/g,"")}
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
${L}`;if(!K.endsWith(`
|
|
219
|
+
`))K+=`
|
|
220
|
+
`;if(K===$.replace(/\r\n/g,`
|
|
221
|
+
`));return{newContent:K,applied:Z,skipped:Q}}function k4($,q,Z){if(new RegExp(`^${q}:\\s*`,"m").test($))return $;let X=/[:#{}\[\],&*?|<>=!%@`"']/.test(Z)?JSON.stringify(Z):Z,z=$.length===0||$.endsWith(`
|
|
222
|
+
`)?"":`
|
|
223
|
+
`;return`${$}${z}${q}: ${X}
|
|
224
|
+
`}function CH($,q,Z="SKILL.md"){if($===q)return"";let Q=$.split(`
|
|
225
|
+
`),X=q.split(`
|
|
226
|
+
`),z=[`--- a/${Z}`,`+++ b/${Z}`],J=0;while(J<Q.length&&J<X.length&&Q[J]===X[J])J++;let G=0;while(G<Q.length-J&&G<X.length-J&&Q[Q.length-1-G]===X[X.length-1-G])G++;let Y=Q.slice(J,Q.length-G),U=X.slice(J,X.length-G),V=J+1,H=J+1;z.push(`@@ -${V},${Y.length} +${H},${U.length} @@`);let B=Q.slice(Math.max(0,J-3),J).map((L)=>` ${L}`),_=Q.slice(Q.length-G,Math.min(Q.length,Q.length-G+3)).map((L)=>` ${L}`);z.push(...B);for(let L of Y)z.push(`-${L}`);for(let L of U)z.push(`+${L}`);return z.push(..._),z.join(`
|
|
227
|
+
`)}async function b8($,q){let Z=P8($)?$:w8($),Q,X=await D8(Z).catch(()=>null);if(!X)throw Error(`Skill path does not exist: ${Z}`);if(X.isFile())Q=Z;else if(X.isDirectory())Q=R8(Z,"SKILL.md");else throw Error(`Skill path is not a directory or file: ${Z}`);let z;try{z=await f4(Q,"utf-8")}catch{throw Error(`SKILL.md not found at ${Q}.`)}let J=PH(z,{gitAuthor:q.gitAuthor}),G=CH(z,J.newContent),Y=null;if(!q.dryRun&&J.newContent!==z)Y=`${Q}.bak`,await HH(Q,Y),await WH(Q,J.newContent,"utf-8");return{report:v4({content:q.dryRun?z:J.newContent,skillPath:Z,skillMdPath:Q}),applied:J.applied,skipped:J.skipped,diff:G,dryRun:q.dryRun,backupPath:Y,skillMdPath:Q}}async function x8(){try{let $=Bun.spawn(["git","config","--global","--get","user.name"],{stdout:"pipe",stderr:"pipe"}),q=await new Response($.stdout).text();if(await $.exited!==0)return null;let Q=q.trim();return Q?Q:null}catch{return null}}function EH($,q,Z=20){let Q=Math.round($/q*Z);return"█".repeat(Q)+"░".repeat(Math.max(0,Z-Q))}function u4($){let q=[];q.push(`Skill evaluation: ${$.skillPath}`),q.push(`SKILL.md: ${$.skillMdPath}`),q.push(""),q.push(`Overall score: ${$.overallScore}/100 (${$.grade})`),q.push(""),q.push("Categories:");for(let Z of $.categories)q.push(` ${Z.name.padEnd(28)} ${String(Z.score).padStart(2)}/${Z.max} ${EH(Z.score,Z.max)}`);if(q.push(""),$.topSuggestions.length>0){q.push("Top suggestions:");for(let Z of $.topSuggestions)q.push(` • ${Z}`)}else q.push("No suggestions — skill looks great.");return q.join(`
|
|
228
|
+
`)}function y8($){return JSON.stringify($,null,2)}function k8($){let q=[];if($.applied.length===0&&$.skipped.length===0)return q.push("No fixes needed — SKILL.md is already clean."),q.join(`
|
|
229
|
+
`);if($.applied.length>0){q.push(`${$.dryRun?"Would apply":"Applied"} ${$.applied.length} fix(es):`);for(let Z of $.applied)q.push(` • ${Z.description}`)}if($.skipped.length>0){q.push(""),q.push(`Skipped ${$.skipped.length} issue(s) (not auto-fixable):`);for(let Z of $.skipped)q.push(` • ${Z.description}`)}if($.diff)q.push(""),q.push("Diff:"),q.push($.diff);if(!$.dryRun&&$.backupPath)q.push(""),q.push(`Backup: ${$.backupPath}`);return q.join(`
|
|
230
|
+
`)}function m4($,q=null){return{skill_path:$.skillPath,skill_md_path:$.skillMdPath,overall_score:$.overallScore,grade:$.grade,categories:$.categories.map((Z)=>({id:Z.id,name:Z.name,score:Z.score,max:Z.max,findings:Z.findings,suggestions:Z.suggestions})),top_suggestions:$.topSuggestions,fix:q?{dry_run:q.dryRun,applied:q.applied,skipped:q.skipped,backup_path:q.backupPath,diff:q.diff}:null}}function f8($){if($ instanceof Error)return $.message;if(typeof $==="string")return $;try{return JSON.stringify($)}catch{return String($)}}function h8($,q,Z,Q,X){let z={severity:"error",message:Q,code:X};return{providerId:$.id,providerVersion:$.version,schemaVersion:$.schemaVersion,score:0,passed:!1,categories:[],findings:[z],raw:void 0,startedAt:q,durationMs:Z}}async function h$($,q,Z={}){let Q=new Date().toISOString(),X=performance.now(),z={id:$.id,version:$.version,schemaVersion:$.schemaVersion},J=new AbortController;if(Z.signal)if(Z.signal.aborted)J.abort(Z.signal.reason);else Z.signal.addEventListener("abort",()=>J.abort(Z.signal?.reason));let G=null;if(typeof Z.timeoutMs==="number"&&Z.timeoutMs>0)G=setTimeout(()=>J.abort(Error("timeout")),Z.timeoutMs);let Y={...Z,signal:J.signal};try{let U=await Promise.race([$.run(q,Y).then((B)=>({kind:"ok",value:B})),new Promise((B)=>{if(J.signal.aborted){B({kind:"timeout"});return}J.signal.addEventListener("abort",()=>B({kind:"timeout"}))})]),V=Math.max(0,Math.round(performance.now()-X));if(U.kind==="timeout"){let B=J.signal.reason,_=B instanceof Error&&B.message==="timeout"?`provider timed out after ${Z.timeoutMs}ms`:`provider aborted: ${f8(B)}`;return h8(z,Q,V,_,B instanceof Error&&B.message==="timeout"?"timeout":"aborted")}let H=U.value;return{...H,providerId:z.id,providerVersion:z.version,schemaVersion:H.schemaVersion??z.schemaVersion,startedAt:Q,durationMs:V}}catch(U){let V=Math.max(0,Math.round(performance.now()-X));return h8(z,Q,V,f8(U),"provider-threw")}finally{if(G)clearTimeout(G)}}var SH=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function D0($){if(typeof $!=="string")return null;let q=SH.exec($.trim());if(!q)return null;let[,Z,Q,X,z]=q;return{major:Number(Z),minor:Number(Q),patch:Number(X),prerelease:z?z.split("."):[]}}function G$($,q){if($.major!==q.major)return $.major-q.major;if($.minor!==q.minor)return $.minor-q.minor;if($.patch!==q.patch)return $.patch-q.patch;if($.prerelease.length===0&&q.prerelease.length>0)return 1;if($.prerelease.length>0&&q.prerelease.length===0)return-1;let Z=Math.max($.prerelease.length,q.prerelease.length);for(let Q=0;Q<Z;Q++){let X=$.prerelease[Q],z=q.prerelease[Q];if(X===void 0)return-1;if(z===void 0)return 1;let J=/^\d+$/.test(X),G=/^\d+$/.test(z);if(J&&G){let Y=Number(X)-Number(z);if(Y!==0)return Y}else if(J&&!G)return-1;else if(!J&&G)return 1;else if(X<z)return-1;else if(X>z)return 1}return 0}function p4($,q){let Z=D0($);if(!Z)throw Error(`invalid semver: ${q} "${$}"`);return Z}function d4($,q){if(typeof q!=="string"||q.trim().length===0)throw Error(`invalid semver range: ${JSON.stringify(q)}`);let Z=D0($);if(!Z)return!1;let Q=q.trim();if(Q==="*"||Q==="x"||Q==="X")return!0;if(Q.startsWith("^")){let J=p4(Q.slice(1),"range base");if(G$(Z,J)<0)return!1;if(J.major>0)return Z.major===J.major;if(J.minor>0)return Z.major===0&&Z.minor===J.minor;return Z.major===0&&Z.minor===0&&Z.patch===J.patch}if(Q.startsWith("~")){let J=p4(Q.slice(1),"range base");if(G$(Z,J)<0)return!1;return Z.major===J.major&&Z.minor===J.minor}let X=Q.startsWith("=")?Q.slice(1).trim():Q,z=D0(X);if(!z)throw Error(`invalid semver range: ${JSON.stringify(q)}`);return G$(Z,z)===0}var lq=new Map;function c4($){if(!$||typeof $.id!=="string"||$.id.length===0)throw Error("register: provider.id is required");if(p4($.version,`provider ${$.id} version`),typeof $.schemaVersion!=="number"||!Number.isInteger($.schemaVersion))throw Error(`register: provider ${$.id} schemaVersion must be an integer`);let q=lq.get($.id)??[];if(q.some((Z)=>Z.version===$.version))throw Error(`register: provider ${$.id}@${$.version} already registered`);q.push($),lq.set($.id,q)}function v$($,q){if(typeof $!=="string"||$.length===0)throw Error("resolve: id is required");let Z=lq.get($);if(!Z||Z.length===0)throw Error(`resolve: provider "${$}" is not registered`);let Q=Z.filter((X)=>d4(X.version,q));if(Q.length===0){let X=Z.map((z)=>z.version).join(", ");throw Error(`resolve: no version of "${$}" satisfies "${q}" (have: ${X})`)}return Q.sort((X,z)=>G$(D0(z.version),D0(X.version))),Q[0]}function v8(){let $=[];for(let q of lq.values())for(let Z of q)$.push(Z);return $}import{stat as bH}from"fs/promises";var g8="quality",u8="1.0.0",m8=1;function xH($){return $.topSuggestions.map((q)=>({severity:"info",message:q}))}function yH($){return $.categories.map((q)=>({id:q.id,name:q.name,score:q.score,max:q.max}))}var p8={id:g8,version:u8,schemaVersion:m8,description:"Static linter for SKILL.md structure, description, and safety.",async applicable($){try{if(!(await bH($.skillMdPath)).isFile())return{ok:!1,reason:`${$.skillMdPath} is not a file`};return{ok:!0}}catch{return{ok:!1,reason:`SKILL.md not found at ${$.skillMdPath}`}}},async run($,q){let Z=await S8($.skillPath);return{providerId:g8,providerVersion:u8,schemaVersion:m8,score:Z.overallScore,passed:Z.grade!=="F",categories:yH(Z),findings:xH(Z),raw:Z,startedAt:"",durationMs:0}}};import{stat as lH}from"fs/promises";import{join as nH}from"path";async function d8($){if(!$)return"";let q=$.getReader(),Z=[];while(!0){let{value:J,done:G}=await q.read();if(G)break;if(J)Z.push(J)}let Q=Z.reduce((J,G)=>J+G.byteLength,0),X=new Uint8Array(Q),z=0;for(let J of Z)X.set(J,z),z+=J.byteLength;return new TextDecoder("utf-8").decode(X)}var nq=async($,q={})=>{let Z={...process.env,...q.env??{}};return typeof globalThis.Bun<"u"?kH($,q,Z):fH($,q,Z)};async function kH($,q,Z){let Q=Bun.spawn($,{cwd:q.cwd,env:Z,stdout:"pipe",stderr:"pipe"}),X=!1,z=!1,J=null;if(typeof q.timeoutMs==="number"&&q.timeoutMs>0)J=setTimeout(()=>{X=!0;try{Q.kill("SIGTERM")}catch{}},q.timeoutMs);let G=()=>{z=!0;try{Q.kill("SIGTERM")}catch{}};if(q.signal)if(q.signal.aborted)G();else q.signal.addEventListener("abort",G,{once:!0});try{let[Y,U,V]=await Promise.all([d8(Q.stdout),d8(Q.stderr),Q.exited]);return{exitCode:typeof V==="number"?V:null,stdout:Y,stderr:U,timedOut:X,aborted:z}}finally{if(J)clearTimeout(J);if(q.signal)q.signal.removeEventListener("abort",G)}}async function fH($,q,Z){let{spawn:Q}=await import("child_process"),[X,...z]=$;if(!X)return{exitCode:null,stdout:"",stderr:"empty argv",timedOut:!1,aborted:!1};let J=Q(X,z,{cwd:q.cwd,env:Z,stdio:["ignore","pipe","pipe"]}),G=!1,Y=!1,U=null;if(typeof q.timeoutMs==="number"&&q.timeoutMs>0)U=setTimeout(()=>{G=!0;try{J.kill("SIGTERM")}catch{}},q.timeoutMs);let V=()=>{Y=!0;try{J.kill("SIGTERM")}catch{}};if(q.signal)if(q.signal.aborted)V();else q.signal.addEventListener("abort",V,{once:!0});let H=new TextDecoder("utf-8"),B=new TextDecoder("utf-8"),_="",L="";J.stdout?.on("data",(K)=>{_+=typeof K==="string"?K:H.decode(K,{stream:!0})}),J.stderr?.on("data",(K)=>{L+=typeof K==="string"?K:B.decode(K,{stream:!0})});try{return await new Promise((F,O)=>{J.on("error",(A)=>{J.stdout?.removeAllListeners("data"),J.stderr?.removeAllListeners("data"),O(A)}),J.on("close",(A)=>{_+=H.decode(),L+=B.decode(),F({exitCode:A,stdout:_,stderr:L,timedOut:G,aborted:Y})})})}finally{if(U)clearTimeout(U);if(q.signal)q.signal.removeEventListener("abort",V)}}function hH($){if(typeof $!=="number"||!Number.isFinite($))return 0;let q=Math.round($*100);if(q<0)return 0;if(q>100)return 100;return q}function vH($){return $.split(/[-_]+/).map((q)=>q.length>0?q[0].toUpperCase()+q.slice(1):"").join(" ")}function gH($,q){let Z=typeof $.id==="string"&&$.id.length>0?$.id:`task-${q+1}`,Q=vH(Z);if(typeof $.passing==="number"&&typeof $.trials==="number"&&$.trials>0)return{id:Z,name:Q,score:Math.max(0,Math.min($.passing,$.trials)),max:$.trials};let X=typeof $.passRate==="number"?$.passRate:0;return{id:Z,name:Q,score:Math.max(0,Math.min(10,Math.round(X*10))),max:10}}function uH($){let q=[];for(let Z of $){let Q=typeof Z.id==="string"?Z.id:void 0,X=Array.isArray(Z.graders)?Z.graders:[];if(X.length===0){q.push({severity:Z.passed===!1?"warning":"info",message:`task ${Q??"(unnamed)"} ${Z.passed===!1?"failed":"passed"}`,categoryId:Q});continue}for(let z of X){let J=typeof z.message==="string"&&z.message.length>0?z.message:`grader ${z.id??"(unnamed)"} ${z.passed?"passed":"failed"}`;q.push({severity:z.passed===!1?"warning":"info",message:J,categoryId:Q,code:typeof z.id==="string"?`grader:${z.id}`:void 0})}}return q}function c8($,q){let Z=$&&typeof $==="object"?$:{},Q=Array.isArray(Z.tasks)?Z.tasks:[],X=Q.map(gH),z=uH(Q),J=hH(Z.passRate),G;if(typeof Z.passed==="boolean")G=Z.passed;else if(typeof Z.passRate==="number")G=Z.passRate>=q.thresholdFraction;else G=!1;return{providerId:q.providerId,providerVersion:q.providerVersion,schemaVersion:q.schemaVersion,score:J,passed:G,categories:X,findings:z,raw:Z,startedAt:"",durationMs:0}}var mH=/^(>=|<=|>|<|=)(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)$/;function pH($){let q=mH.exec($);if(!q)return null;let[,Z,Q]=q,X=D0(Q);if(!X)return null;return{op:Z,major:X.major,minor:X.minor,patch:X.patch,prerelease:X.prerelease}}function dH($,q){if(!$)return!1;let Z=G$($,{major:q.major,minor:q.minor,patch:q.patch,prerelease:q.prerelease});switch(q.op){case">=":return Z>=0;case">":return Z>0;case"<=":return Z<=0;case"<":return Z<0;case"=":return Z===0}}function l8($,q){if(!q||q.trim().length===0)return!0;let Z=q.trim();if(Z==="*"||Z==="x"||Z==="X")return!0;let Q=D0($);if(!Q)return!1;let X=Z.split(/\s+/);for(let z of X){if(z.length===0)continue;let J=pH(z);if(J){if(!dH(Q,J))return!1;continue}try{if(!d4($,z))return!1;continue}catch{throw Error(`invalid externalRequires range clause: ${JSON.stringify(z)} in ${JSON.stringify(q)}`)}}return!0}import{createRequire as cH}from"module";function n8($=import.meta.url){try{return cH($).resolve("skillgrade/bin/skillgrade.js")}catch{return null}}var l4="skillgrade",n4="1.0.0",i4=1,iH=">=0.1.3 <0.3.0",oH=0.8,aH="smoke",sH="docker",tH=async($)=>{try{return(await lH($)).isFile()}catch{return!1}};function g$($,q){return{providerId:l4,providerVersion:n4,schemaVersion:i4,score:0,passed:!1,categories:[],findings:[$],raw:q,startedAt:"",durationMs:0}}function rH($){let q=$.toLowerCase();if(q.includes("api key")||q.includes("anthropic_api_key")||q.includes("openai_api_key")||q.includes("unauthorized")||q.includes("401"))return{code:"missing-api-key",hint:"set ANTHROPIC_API_KEY or OPENAI_API_KEY in your environment"};if(q.includes("docker")&&(q.includes("not found")||q.includes("cannot connect")||q.includes("unavailable")||q.includes("is not running")))return{code:"docker-unavailable",hint:"start Docker or pass --provider local"};return{code:"skillgrade-nonzero-exit",hint:"check skillgrade logs above for details"}}async function eH($,q,Z){let Q;try{Q=await $([q,"--version"],{timeoutMs:5000,signal:Z})}catch{return null}if(Q.exitCode!==0)return null;let X=`${Q.stdout}
|
|
231
|
+
${Q.stderr}`,z=/(?:^|[^\w.-])v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?=$|[^\w.-])/m.exec(X);return z?z[1]:null}function $V($){return nH($.skillPath,"eval.yaml")}function qV($,q){return[$,"run","--ci","--threshold",String(q.thresholdFraction),"--preset",q.preset,"--provider",q.provider,"--json"]}function ZV($){let q=typeof $.threshold==="number"&&Number.isFinite($.threshold)?$.threshold>1?$.threshold/100:$.threshold:oH,Z=$.preset==="smoke"||$.preset==="reliable"||$.preset==="regression"?$.preset:aH,Q=$.provider==="docker"||$.provider==="local"?$.provider:sH;return{thresholdFraction:q,preset:Z,provider:Q}}function QV($={}){let q=$.spawn??nq,Z=$.fileExists??tH,Q=$.binary??"skillgrade",X=$.externalRequires??iH;return{id:l4,version:n4,schemaVersion:i4,description:"Runtime eval via skillgrade: runs task prompts through LLM judges and computes a pass rate.",externalRequires:{binary:Q,semverRange:X,installHint:"skillgrade ships with agent-skill-manager — try reinstalling: npm install -g agent-skill-manager"},async applicable(z,J){let G=await eH(q,Q,J.signal);if(G===null)return{ok:!1,reason:`${Q} not installed or unreachable — reinstall agent-skill-manager to restore the bundled skillgrade: npm install -g agent-skill-manager`};try{if(!l8(G,X))return{ok:!1,reason:`${Q} ${G} is outside required range "${X}" — upgrade or downgrade the binary`}}catch(U){return{ok:!1,reason:`invalid externalRequires "${X}": ${U?.message??String(U)}`}}let Y=$V(z);if(!await Z(Y))return{ok:!1,reason:`no eval.yaml at ${Y} — run: asm eval --runtime init`};return{ok:!0}},async run(z,J){let G=ZV(J),Y=qV(Q,G),U={cwd:z.skillPath,signal:J.signal};if(typeof J.timeoutMs==="number"&&J.timeoutMs>0)U.timeoutMs=J.timeoutMs;let V;try{V=await q(Y,U)}catch(B){return g$({severity:"error",message:`failed to spawn ${Q}: ${B?.message??String(B)}`,code:B?.code==="ENOENT"?"binary-missing":"spawn-failed"})}if(V.timedOut)return g$({severity:"error",message:"skillgrade run timed out",code:"timeout"});if(V.aborted)return g$({severity:"error",message:"skillgrade run aborted",code:"aborted"});if(V.exitCode!==0){let{code:B,hint:_}=rH(V.stderr),L=V.stderr.trim().slice(0,2000);return g$({severity:"error",message:`skillgrade exited ${V.exitCode}: ${_}${L.length>0?`
|
|
232
|
+
${L}`:""}`,code:B},{exitCode:V.exitCode,stderr:V.stderr})}let H;try{H=JSON.parse(V.stdout)}catch(B){return g$({severity:"error",message:`skillgrade stdout was not valid JSON: ${B?.message??String(B)}`,code:"skillgrade-bad-json"},{stdout:V.stdout,stderr:V.stderr})}return c8(H,{providerId:l4,providerVersion:n4,schemaVersion:i4,thresholdFraction:G.thresholdFraction})}}}function XV(){let $=process.env.ASM_SKILLGRADE_BIN?.trim();if($)return $;let q=n8();if(q!==null)return q;return}var i8=XV(),o8=QV(i8!==void 0?{binary:i8}:{});function a8(){c4(p8),c4(o8)}import{readFile as zV}from"fs/promises";import{join as JV}from"path";import{homedir as GV}from"os";function o4(){return{defaults:{threshold:70,timeoutMs:60000},providers:{}}}function YV(){return JV(GV(),".asm","config.yml")}async function a4($=YV()){let q;try{q=await zV($,"utf-8")}catch(Q){if(Q?.code==="ENOENT")return o4();throw Q}if(q.trim().length===0)return o4();let Z=x$(q);return UV(Z)}function UV($){let q=o4();if(!$||typeof $!=="object")return q;let Q=$.eval;if(!Q||typeof Q!=="object")return q;let X=Q,z={defaults:{threshold:q.defaults.threshold,timeoutMs:q.defaults.timeoutMs},providers:{}},J=X.defaults;if(J&&typeof J==="object"){let Y=J;if(typeof Y.threshold==="number"&&Number.isFinite(Y.threshold))z.defaults.threshold=Y.threshold;if(typeof Y.timeoutMs==="number"&&Number.isFinite(Y.timeoutMs))z.defaults.timeoutMs=Y.timeoutMs}let G=X.providers;if(G&&typeof G==="object"&&!Array.isArray(G)){for(let[Y,U]of Object.entries(G))if(U&&typeof U==="object"&&!Array.isArray(U))z.providers[Y]={...U}}return z}var WV="skillgrade",HV=30000;async function s8($){let q=$.spawn??nq,Z=$.binary??WV,Q=$.timeoutMs??HV,X;try{X=await q([Z,"init"],{cwd:$.skillPath,timeoutMs:Q,signal:$.signal})}catch(z){return{ok:!1,message:z?.code==="ENOENT"?`${Z} not installed — reinstall agent-skill-manager to restore the bundled skillgrade: npm install -g agent-skill-manager`:`failed to spawn ${Z}: ${z?.message??String(z)}`,exitCode:null,stdout:"",stderr:z?.message??String(z)}}if(X.timedOut)return{ok:!1,message:`${Z} init timed out after ${Q}ms`,exitCode:X.exitCode,stdout:X.stdout,stderr:X.stderr};if(X.aborted)return{ok:!1,message:`${Z} init aborted`,exitCode:X.exitCode,stdout:X.stdout,stderr:X.stderr};if(X.exitCode!==0){let z=X.stderr.trim().length>0?X.stderr.trim():X.stdout.trim().length>0?X.stdout.trim():"no stderr output";return{ok:!1,message:`${Z} init failed (exit ${X.exitCode}): ${z}`,exitCode:X.exitCode,stdout:X.stdout,stderr:X.stderr}}return{ok:!0,message:`eval.yaml scaffolded in ${$.skillPath}`,exitCode:0,stdout:X.stdout,stderr:X.stderr}}var VV={bold:($)=>$,dim:($)=>$,red:($)=>$,green:($)=>$,yellow:($)=>$,cyan:($)=>$},BV={bold:($)=>`\x1B[1m${$}\x1B[0m`,dim:($)=>`\x1B[2m${$}\x1B[0m`,red:($)=>`\x1B[31m${$}\x1B[0m`,green:($)=>`\x1B[32m${$}\x1B[0m`,yellow:($)=>`\x1B[33m${$}\x1B[0m`,cyan:($)=>`\x1B[36m${$}\x1B[0m`};function iq($){if($>0)return`+${$}`;if($<0)return`${$}`;return"±0"}function oq($){return $.code?`code:${$.code}`:`msg:${$.message}`}function KV($,q){let Z=new Set($.map(oq)),Q=new Set(q.map(oq)),X=$.filter((J)=>!Q.has(oq(J)));return{added:q.filter((J)=>!Z.has(oq(J))),removed:X}}function _V($,q){let Z=new Map($.map((G)=>[G.id,G])),Q=new Map(q.map((G)=>[G.id,G])),X=[];for(let[G,Y]of Z){let U=Q.get(G);if(!U)continue;if(Y.score!==U.score||Y.max!==U.max)X.push({id:G,name:U.name,beforeScore:Y.score,afterScore:U.score,beforeMax:Y.max,afterMax:U.max})}let z=q.filter((G)=>!Z.has(G.id)),J=$.filter((G)=>!Q.has(G.id));return{changed:X,added:z,removed:J}}function t8($){return`${$.providerId}@${$.providerVersion}`}function r8($,q,Z){let Q=$.severity==="error"?Z.red("error"):$.severity==="warning"?Z.yellow("warn"):Z.dim("info"),X=$.code?` (${Z.dim($.code)})`:"";return` ${q} [${Q}]${X} ${$.message}`}function $Z($,q,Z={}){let Q=Z.useColor===!1?VV:BV,X=Z.beforeLabel??t8($),z=Z.afterLabel??t8(q),J=[];if(J.push(Q.bold("Compare: ")+`${X} → ${z}`),$.schemaVersion!==q.schemaVersion)J.push(Q.yellow(` ! schema version mismatch: ${$.schemaVersion} → ${q.schemaVersion}`));J.push("");let G=q.score-$.score,Y=iq(G),U=G>0?Q.green(Y):G<0?Q.red(Y):Q.dim(Y);if(J.push(`${Q.bold("Score:")} ${$.score}/100 → ${q.score}/100 (${U})`),$.passed!==q.passed){let _=$.passed?Q.green("PASS"):Q.red("FAIL"),L=q.passed?Q.green("PASS"):Q.red("FAIL"),K=q.passed?Q.green("(regression fixed)"):Q.red("(regression introduced)");J.push(`${Q.bold("Verdict:")} ${_} → ${L} ${K}`)}else{let _=q.passed?Q.green("PASS"):Q.red("FAIL");J.push(`${Q.bold("Verdict:")} ${_} (unchanged)`)}if($.durationMs>0||q.durationMs>0)J.push(Q.dim(` duration: ${$.durationMs}ms → ${q.durationMs}ms`));let V=_V($.categories,q.categories);if(V.changed.length>0||V.added.length>0||V.removed.length>0){J.push(""),J.push(Q.bold("Categories:"));for(let _ of V.changed){let L=_.afterScore-_.beforeScore,K=L>0?Q.green(iq(L)):L<0?Q.red(iq(L)):Q.dim(iq(L));J.push(` ${_.name} (${Q.dim(_.id)}): ${_.beforeScore}/${_.beforeMax} → ${_.afterScore}/${_.afterMax} (${K})`)}for(let _ of V.added)J.push(` ${Q.green("+")} ${_.name} (${Q.dim(_.id)}): ${_.score}/${_.max} ${Q.green("(new)")}`);for(let _ of V.removed)J.push(` ${Q.red("-")} ${_.name} (${Q.dim(_.id)}): ${_.score}/${_.max} ${Q.red("(removed)")}`)}let H=KV($.findings,q.findings);if(H.added.length>0||H.removed.length>0){J.push(""),J.push(Q.bold("Findings:"));for(let _ of H.removed)J.push(r8(_,Q.red("-"),Q));for(let _ of H.added)J.push(r8(_,Q.green("+"),Q))}if(G===0&&$.passed===q.passed&&$.schemaVersion===q.schemaVersion&&V.changed.length===0&&V.added.length===0&&V.removed.length===0&&H.added.length===0&&H.removed.length===0)J.push(""),J.push(Q.dim("No differences between versions."));return J.join(`
|
|
233
|
+
`)}function qZ($){if(typeof $!=="string"||$.trim().length===0)throw Error('--compare requires two provider specs (e.g. "quality@1.0.0,quality@1.0.0")');let q=$.split(",").map((X)=>X.trim()).filter((X)=>X.length>0);if(q.length!==2)throw Error(`--compare requires exactly two specs separated by a comma (got ${q.length})`);let Z=e8(q[0],!0),Q=e8(q[1],!1,Z.id);return[Z,Q]}function e8($,q,Z){let Q=$.indexOf("@");if(Q<0){if(q||!Z)throw Error(`--compare spec "${$}" must be of the form id@version`);return{id:Z,version:$}}let X=$.slice(0,Q).trim(),z=$.slice(Q+1).trim();if(X.length===0||z.length===0)throw Error(`--compare spec "${$}" must be of the form id@version with both id and version`);return{id:X,version:z}}var a={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 u0(){let{log:$,info:q}=console,Z=(...Q)=>process.stderr.write(Q.map(String).join(" ")+`
|
|
234
|
+
`);return console.log=Z,console.info=Z,()=>{console.log=$,console.info=q}}function QZ($){return{timestamp:new Date().toISOString(),asm_version:ZZ,duration_ms:Math.round(performance.now()-$)}}function d($,q,Z){let Q={version:1,command:$,status:"ok",data:q,meta:QZ(Z)},X=process.stdout.isTTY?2:0;return JSON.stringify(Q,null,X)}function s($,q,Z,Q,X){let z={version:1,command:$,status:"error",error:{code:q,message:Z,...X!==void 0?{details:X}:{}},meta:QZ(Q)},J=process.stdout.isTTY?2:0;return JSON.stringify(z,null,J)}import{writeFile as PV,mkdir as CV,unlink as EV,readFile as SV}from"fs/promises";import{join as t4}from"path";import{readdir as LV,readFile as FV}from"fs/promises";import{join as OV}from"path";function s4($){let q=new Set,Z=$.toLowerCase().split(/[\s\-_.,;:()[\]{}"']+/);for(let Q of Z)if(Q.length>=2)q.add(Q);return q}var AV=10,IV=5,TV=3,MV=1;function jV($,q){let Z=s4($),Q=s4(q.name),X=s4(q.description),z=0;for(let J of Z){if(Q.has(J))z+=AV;if(X.has(J))z+=TV;if(q.name.toLowerCase().includes(J))z+=IV;if(q.description.toLowerCase().includes(J))z+=MV}return z}async function XZ($){let q=new Map,Z;try{Z=await LV($)}catch{return q}for(let Q of Z){if(!Q.endsWith(".json"))continue;let X=OV($,Q);try{let z=await FV(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}q.set(`${J.owner}/${J.repo}`,J)}catch{}}return q}async function aq(){let $=await XZ(GZ()),q=await XZ(u$()),Z=new Map($);for(let[Q,X]of q)Z.set(Q,X);return Array.from(Z.values())}var NV=["license","creator","version"];function zZ($){return NV.includes($)}function JZ($,q){return $[q]||""}function DV($,q){if(q.has)for(let Z of q.has){if(!zZ(Z))continue;if(!JZ($,Z))return!1}if(q.missing)for(let Z of q.missing){if(!zZ(Z))continue;if(JZ($,Z))return!1}return!0}function YZ($){let q=[];if(!$.license)q.push("license");if(!$.creator)q.push("creator");if(!$.version||$.version==="0.0.0")q.push("version");return q}async function sq($,q=20,Z){let Q=await aq(),X=[],z=!$&&Z;for(let J of Q)for(let G of J.skills){if(Z&&!DV(G,Z))continue;let Y=z?1:jV($,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,q)}async function UZ(){return(await aq()).reduce((q,Z)=>q+Z.skillCount,0)}var RV=[{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 WZ($,q){let Z=[];if(!$.name||!$.name.trim())Z.push("missing frontmatter field: name");if(!$.description||!$.description.trim())Z.push("missing frontmatter field: description");if(wV(q).trim().length<20)Z.push("SKILL.md body too short (less than 20 chars of instructions)");for(let{label:X,pattern:z}of RV)if(z.test(q))Z.push(`malicious pattern detected: ${X}`);return{verified:Z.length===0,reasons:Z}}function wV($){let q=$.trimStart();if(!q.startsWith("---"))return q;let Z=q.indexOf(`
|
|
235
|
+
---`,3);if(Z===-1)return"";return q.slice(Z+4)}async function bV(){let $=u$();return await CV($,{recursive:!0}),$}async function HZ($){await l0();let q;try{q=c0($)}catch(Q){return{success:!1,repoIndex:null,error:Q.message}}if(q.isLocal)return{success:!1,repoIndex:null,error:"Local paths are not supported for indexing. Use a GitHub source instead."};E(`ingester: cloning ${q.owner}/${q.repo}`);let Z=null;try{Z=await n0(q),E(`ingester: discovering skills in ${Z}`);let Q=await o$(Z);E(`ingester: found ${Q.length} skills`);let X=[];for(let Y of Q){let U=t4(Z,Y.relPath,"SKILL.md"),V="";try{V=await SV(U,"utf-8")}catch{E(`ingester: could not read SKILL.md at ${U}`)}let H=WZ(Y,V);if(!H.verified)E(`ingester: ${Y.name} not verified: ${H.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:${q.owner}/${q.repo}${q.ref?`#${q.ref}`:""}${Y.relPath?`:${Y.relPath}`:""}`,relPath:Y.relPath,verified:H.verified})}let z={repoUrl:q.cloneUrl,owner:q.owner,repo:q.repo,updatedAt:new Date().toISOString(),skillCount:X.length,skills:X},J=await bV(),G=t4(J,`${q.owner}_${q.repo}.json`);return await PV(G,JSON.stringify(z,null,2)+`
|
|
236
|
+
`,"utf-8"),E(`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 VZ(){return(await aq()).map((q)=>({owner:q.owner,repo:q.repo,skillCount:q.skillCount,updatedAt:q.updatedAt})).sort((q,Z)=>Z.skillCount-q.skillCount)}async function BZ($,q){let Z=u$(),Q=t4(Z,`${$}_${q}.json`);try{return await EV(Q),!0}catch{return!1}}import{join as xV}from"path";function yV($){switch($){case"dangerous":return 3;case"warning":return 2;case"caution":return 1;default:return 0}}function Q2($){return{verdict:$.every((q)=>q.verdict==="safe")?"safe":$.some((q)=>q.verdict==="dangerous")?"dangerous":"warning",findings:$.map((q)=>({skill:q.skillName,verdict:q.verdict,verdict_reason:q.verdictReason,total_files:q.totalFiles,total_lines:q.totalLines})),risk_score:$.reduce((q,Z)=>q+yV(Z.verdict),0)}}function kV($){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,fix:!1,runtime:!1,preset:null,threshold:null,compare:null}},Q=0;while(Q<q.length){let X=q[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[Q];if(z==="global"||z==="project"||z==="both")Z.flags.scope=z;else w(`Invalid scope: "${z}". Must be global, project, or both.`),process.exit(2)}else if(X==="--sort"){Q++;let z=q[Q];if(z==="name"||z==="version"||z==="location")Z.flags.sort=z;else w(`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[Q]||null;else if(X==="--name")Q++,Z.flags.name=q[Q]||null;else if(X==="--force"||X==="-f")Z.flags.force=!0;else if(X==="--path")Q++,Z.flags.path=q[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[Q];if(z==="https"||z==="ssh"||z==="auto")Z.flags.transport=z;else w(`Invalid transport: "${z}". Must be https, ssh, or auto.`),process.exit(2)}else if(X==="--method"||X==="-m"){Q++;let z=q[Q];if(z==="default"||z==="vercel")Z.flags.method=z;else w(`Invalid method: "${z}". Must be default or vercel.`),process.exit(2)}else if(X==="--skill")Q++,Z.flags.path=q[Q]||null;else if(X==="--dry-run")Z.flags.dryRun=!0;else if(X==="--fix")Z.flags.fix=!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[Q])Z.flags.has.push(q[Q])}else if(X==="--missing"){if(Q++,q[Q])Z.flags.missing.push(q[Q])}else if(X==="--runtime")Z.flags.runtime=!0;else if(X==="--preset")Q++,Z.flags.preset=q[Q]||null;else if(X==="--threshold"){Q++;let z=q[Q];if(z===void 0)w("--threshold requires a numeric value"),process.exit(2);let J=Number(z);if(!Number.isFinite(J))w(`Invalid --threshold: "${z}". Must be a number (e.g. 0.8 or 80).`),process.exit(2);Z.flags.threshold=J}else if(X==="--compare")Q++,Z.flags.compare=q[Q]||null;else if(X.startsWith("-"))w(`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 w($){console.error(W.red(`Error: ${$}`))}function fV(){console.log(`${W.blueBold("agent-skill-manager")} (${W.bold("asm")}) ${Z2}
|
|
207
237
|
|
|
208
238
|
Interactive TUI and CLI for managing installed skills for AI coding agents.
|
|
209
239
|
|
|
210
|
-
${
|
|
240
|
+
${W.bold("Usage:")}
|
|
211
241
|
asm Launch interactive TUI
|
|
212
242
|
asm <command> [options] Run a CLI command
|
|
213
243
|
|
|
214
|
-
${
|
|
244
|
+
${W.bold("Commands:")}
|
|
215
245
|
list List all discovered skills
|
|
216
246
|
search <query> Search skills by name/description/tool
|
|
217
247
|
inspect <skill-name> Show detailed info for a skill
|
|
@@ -227,6 +257,8 @@ ${U.bold("Commands:")}
|
|
|
227
257
|
outdated Show which installed skills have newer versions
|
|
228
258
|
update [name...] Update outdated skills with security re-audit
|
|
229
259
|
publish [path] Validate, audit, and submit a skill to the registry
|
|
260
|
+
eval <skill-path> Evaluate a skill against best practices and score it
|
|
261
|
+
eval-providers list List registered eval providers (id, version, schema, …)
|
|
230
262
|
bundle Manage skill bundles (create, install, list, show, remove)
|
|
231
263
|
index Manage skill index (ingest, search, list)
|
|
232
264
|
doctor Run environment health checks and diagnostics
|
|
@@ -235,7 +267,7 @@ ${U.bold("Commands:")}
|
|
|
235
267
|
config reset Reset config to defaults
|
|
236
268
|
config edit Open config in $EDITOR
|
|
237
269
|
|
|
238
|
-
${
|
|
270
|
+
${W.bold("Global Options:")}
|
|
239
271
|
-h, --help Show help for any command
|
|
240
272
|
-v, --version Print version and exit
|
|
241
273
|
--json Output as JSON (list, search, inspect)
|
|
@@ -246,12 +278,12 @@ ${U.bold("Global Options:")}
|
|
|
246
278
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
247
279
|
--flat Show one row per tool instance (list, search)
|
|
248
280
|
-y, --yes Skip confirmation prompts
|
|
249
|
-
-V, --verbose Show debug output`)}function
|
|
281
|
+
-V, --verbose Show debug output`)}function hV(){console.log(`${W.bold("Usage:")} asm list [options]
|
|
250
282
|
|
|
251
283
|
List all discovered skills. By default, skills installed across multiple
|
|
252
284
|
tools are grouped into a single row with tool badges.
|
|
253
285
|
|
|
254
|
-
${
|
|
286
|
+
${W.bold("Options:")}
|
|
255
287
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
256
288
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
257
289
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
@@ -261,19 +293,19 @@ ${U.bold("Options:")}
|
|
|
261
293
|
--no-color Disable ANSI colors
|
|
262
294
|
-V, --verbose Show debug output
|
|
263
295
|
|
|
264
|
-
${
|
|
265
|
-
asm list ${
|
|
266
|
-
asm list --flat ${
|
|
267
|
-
asm list -p claude ${
|
|
268
|
-
asm list -s project ${
|
|
269
|
-
asm list --sort version ${
|
|
270
|
-
asm list --json ${
|
|
271
|
-
asm list --machine ${
|
|
296
|
+
${W.bold("Examples:")}
|
|
297
|
+
asm list ${W.dim("List all skills (grouped)")}
|
|
298
|
+
asm list --flat ${W.dim("One row per tool instance")}
|
|
299
|
+
asm list -p claude ${W.dim("Only Claude Code skills")}
|
|
300
|
+
asm list -s project ${W.dim("Only project-scoped skills")}
|
|
301
|
+
asm list --sort version ${W.dim("Sort by version")}
|
|
302
|
+
asm list --json ${W.dim("Output as JSON")}
|
|
303
|
+
asm list --machine ${W.dim("Machine-readable v1 envelope output")}`)}function vV(){console.log(`${W.bold("Usage:")} asm search <query> [options]
|
|
272
304
|
|
|
273
305
|
Search both installed skills and the skill index. Results show installation
|
|
274
306
|
status and include copy-paste install commands for available skills.
|
|
275
307
|
|
|
276
|
-
${
|
|
308
|
+
${W.bold("Options:")}
|
|
277
309
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
278
310
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
279
311
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
@@ -285,49 +317,49 @@ ${U.bold("Options:")}
|
|
|
285
317
|
--no-color Disable ANSI colors
|
|
286
318
|
-V, --verbose Show debug output
|
|
287
319
|
|
|
288
|
-
${
|
|
289
|
-
asm search code ${
|
|
290
|
-
asm search review -p claude ${
|
|
291
|
-
asm search "test" --installed ${
|
|
292
|
-
asm search "test" --available ${
|
|
293
|
-
asm search openspec --json ${
|
|
294
|
-
asm search openspec --machine ${
|
|
320
|
+
${W.bold("Examples:")}
|
|
321
|
+
asm search code ${W.dim("Search installed and available skills")}
|
|
322
|
+
asm search review -p claude ${W.dim("Search within Claude Code only")}
|
|
323
|
+
asm search "test" --installed ${W.dim("Search installed skills only")}
|
|
324
|
+
asm search "test" --available ${W.dim("Search available skills only")}
|
|
325
|
+
asm search openspec --json ${W.dim("Output matches as JSON")}
|
|
326
|
+
asm search openspec --machine ${W.dim("Machine-readable v1 envelope output")}`)}function gV(){console.log(`${W.bold("Usage:")} asm inspect <skill-name> [options]
|
|
295
327
|
|
|
296
328
|
Show detailed information for a skill. The <skill-name> is the directory name.
|
|
297
329
|
Shows version, description, file count, and all provider installations.
|
|
298
330
|
|
|
299
|
-
${
|
|
331
|
+
${W.bold("Options:")}
|
|
300
332
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
301
333
|
--json Output as JSON object
|
|
302
334
|
--no-color Disable ANSI colors
|
|
303
335
|
-V, --verbose Show debug output
|
|
304
336
|
|
|
305
|
-
${
|
|
306
|
-
asm inspect code-review ${
|
|
307
|
-
asm inspect code-review --json ${
|
|
308
|
-
asm inspect code-review -s global ${
|
|
337
|
+
${W.bold("Examples:")}
|
|
338
|
+
asm inspect code-review ${W.dim("Show details for code-review")}
|
|
339
|
+
asm inspect code-review --json ${W.dim("Output as JSON")}
|
|
340
|
+
asm inspect code-review -s global ${W.dim("Global installations only")}`)}function uV(){console.log(`${W.bold("Usage:")} asm uninstall <skill-name> [options]
|
|
309
341
|
|
|
310
342
|
Remove a skill and its associated rule files. Shows a removal plan
|
|
311
343
|
before proceeding and asks for confirmation.
|
|
312
344
|
|
|
313
|
-
${
|
|
345
|
+
${W.bold("Options:")}
|
|
314
346
|
-y, --yes Skip confirmation prompt
|
|
315
347
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
316
348
|
--no-color Disable ANSI colors
|
|
317
349
|
-V, --verbose Show debug output
|
|
318
350
|
|
|
319
|
-
${
|
|
320
|
-
asm uninstall code-review ${
|
|
321
|
-
asm uninstall code-review -y ${
|
|
322
|
-
asm uninstall code-review -s project ${
|
|
351
|
+
${W.bold("Examples:")}
|
|
352
|
+
asm uninstall code-review ${W.dim("Remove with confirmation")}
|
|
353
|
+
asm uninstall code-review -y ${W.dim("Remove without confirmation")}
|
|
354
|
+
asm uninstall code-review -s project ${W.dim("Remove project copy only")}`)}function mV(){console.log(`${W.bold("Usage:")} asm audit [subcommand] [options]
|
|
323
355
|
|
|
324
356
|
Detect duplicate skills or run security audits on installed/remote skills.
|
|
325
357
|
|
|
326
|
-
${
|
|
358
|
+
${W.bold("Subcommands:")}
|
|
327
359
|
duplicates Find duplicate skills (default)
|
|
328
360
|
security <name|source> Run security audit on an installed skill or GitHub source
|
|
329
361
|
|
|
330
|
-
${
|
|
362
|
+
${W.bold("Options:")}
|
|
331
363
|
--json Output as JSON
|
|
332
364
|
--machine Output in stable machine-readable v1 envelope format
|
|
333
365
|
-y, --yes Auto-remove duplicates, keeping one instance per group
|
|
@@ -335,25 +367,25 @@ ${U.bold("Options:")}
|
|
|
335
367
|
--no-color Disable ANSI colors
|
|
336
368
|
-V, --verbose Show debug output
|
|
337
369
|
|
|
338
|
-
${
|
|
339
|
-
asm audit ${
|
|
340
|
-
asm audit -y ${
|
|
341
|
-
asm audit --json ${
|
|
342
|
-
asm audit security code-review ${
|
|
343
|
-
asm audit security github:user/repo ${
|
|
344
|
-
asm audit security --all ${
|
|
345
|
-
asm audit security code-review --json ${
|
|
346
|
-
asm audit security code-review --machine ${
|
|
370
|
+
${W.bold("Examples:")}
|
|
371
|
+
asm audit ${W.dim("Find duplicates")}
|
|
372
|
+
asm audit -y ${W.dim("Auto-remove duplicates")}
|
|
373
|
+
asm audit --json ${W.dim("Output as JSON")}
|
|
374
|
+
asm audit security code-review ${W.dim("Audit an installed skill")}
|
|
375
|
+
asm audit security github:user/repo ${W.dim("Audit a remote skill before installing")}
|
|
376
|
+
asm audit security --all ${W.dim("Audit all installed skills")}
|
|
377
|
+
asm audit security code-review --json ${W.dim("Output audit as JSON")}
|
|
378
|
+
asm audit security code-review --machine ${W.dim("Machine-readable v1 envelope output")}
|
|
347
379
|
asm audit security https://github.com/user/skills/tree/main/skills/agent-config
|
|
348
|
-
${
|
|
380
|
+
${W.dim("Audit a skill from a subfolder URL")}`)}function pV(){console.log(`${W.bold("Usage:")} asm publish [path] [options]
|
|
349
381
|
|
|
350
382
|
Validate a skill, run a security audit, generate a registry manifest,
|
|
351
383
|
and open a PR against the asm-registry.
|
|
352
384
|
|
|
353
|
-
${
|
|
385
|
+
${W.bold("Arguments:")}
|
|
354
386
|
path Path to skill directory (default: current directory)
|
|
355
387
|
|
|
356
|
-
${
|
|
388
|
+
${W.bold("Options:")}
|
|
357
389
|
--dry-run Print generated manifest without opening a PR
|
|
358
390
|
--force Override 'warning' security verdict (blocks 'dangerous')
|
|
359
391
|
-y, --yes Skip confirmation prompts
|
|
@@ -362,75 +394,75 @@ ${U.bold("Options:")}
|
|
|
362
394
|
--no-color Disable ANSI colors
|
|
363
395
|
-V, --verbose Show debug output
|
|
364
396
|
|
|
365
|
-
${
|
|
366
|
-
asm publish ${
|
|
367
|
-
asm publish ./my-skill ${
|
|
368
|
-
asm publish --dry-run ${
|
|
369
|
-
asm publish --force ${
|
|
370
|
-
asm publish --json ${
|
|
371
|
-
asm publish --machine ${
|
|
397
|
+
${W.bold("Examples:")}
|
|
398
|
+
asm publish ${W.dim("Publish skill in current directory")}
|
|
399
|
+
asm publish ./my-skill ${W.dim("Publish skill at the given path")}
|
|
400
|
+
asm publish --dry-run ${W.dim("Preview manifest without side effects")}
|
|
401
|
+
asm publish --force ${W.dim("Override warning-level security findings")}
|
|
402
|
+
asm publish --json ${W.dim("Output as JSON")}
|
|
403
|
+
asm publish --machine ${W.dim("Machine-readable v1 envelope output")}`)}function dV(){console.log(`${W.bold("Usage:")} asm outdated [options]
|
|
372
404
|
|
|
373
405
|
Show which installed skills have newer versions available.
|
|
374
406
|
|
|
375
|
-
${
|
|
407
|
+
${W.bold("Options:")}
|
|
376
408
|
--json Output as JSON
|
|
377
409
|
--machine Output in stable machine-readable format
|
|
378
410
|
--no-color Disable ANSI colors
|
|
379
411
|
-V, --verbose Show debug output
|
|
380
412
|
|
|
381
|
-
${
|
|
382
|
-
asm outdated ${
|
|
383
|
-
asm outdated --json ${
|
|
384
|
-
asm outdated --machine ${
|
|
413
|
+
${W.bold("Examples:")}
|
|
414
|
+
asm outdated ${W.dim("Show outdated skills")}
|
|
415
|
+
asm outdated --json ${W.dim("Output as JSON")}
|
|
416
|
+
asm outdated --machine ${W.dim("Machine-readable output")}`)}function cV(){console.log(`${W.bold("Usage:")} asm update [name...] [options]
|
|
385
417
|
|
|
386
418
|
Update outdated skills to their latest version with security re-audit.
|
|
387
419
|
|
|
388
|
-
${
|
|
420
|
+
${W.bold("Arguments:")}
|
|
389
421
|
name Specific skill(s) to update (default: all outdated)
|
|
390
422
|
|
|
391
|
-
${
|
|
423
|
+
${W.bold("Options:")}
|
|
392
424
|
-y, --yes Skip confirmation prompts
|
|
393
425
|
--json Output as JSON
|
|
394
426
|
--machine Output in stable machine-readable format
|
|
395
427
|
--no-color Disable ANSI colors
|
|
396
428
|
-V, --verbose Show debug output
|
|
397
429
|
|
|
398
|
-
${
|
|
399
|
-
asm update ${
|
|
400
|
-
asm update code-review ${
|
|
401
|
-
asm update --yes ${
|
|
402
|
-
asm update --json ${
|
|
430
|
+
${W.bold("Examples:")}
|
|
431
|
+
asm update ${W.dim("Update all outdated skills")}
|
|
432
|
+
asm update code-review ${W.dim("Update a specific skill")}
|
|
433
|
+
asm update --yes ${W.dim("Skip confirmation prompts")}
|
|
434
|
+
asm update --json ${W.dim("Output as JSON")}`)}function lV(){console.log(`${W.bold("Usage:")} asm config <subcommand>
|
|
403
435
|
|
|
404
436
|
Manage configuration. Config is stored at ~/.config/agent-skill-manager/.
|
|
405
437
|
|
|
406
|
-
${
|
|
438
|
+
${W.bold("Subcommands:")}
|
|
407
439
|
show Print current config as JSON
|
|
408
440
|
path Print config file path
|
|
409
441
|
reset Reset config to defaults (with confirmation)
|
|
410
442
|
edit Open config in $EDITOR
|
|
411
443
|
|
|
412
|
-
${
|
|
444
|
+
${W.bold("Options:")}
|
|
413
445
|
-V, --verbose Show debug output
|
|
414
446
|
|
|
415
|
-
${
|
|
416
|
-
asm config show ${
|
|
417
|
-
asm config edit ${
|
|
418
|
-
asm config reset -y ${
|
|
419
|
-
${
|
|
420
|
-
`))
|
|
421
|
-
${
|
|
422
|
-
Done.`))}function
|
|
423
|
-
`))X(
|
|
424
|
-
Auto-removing duplicates...`));for(let J of z.duplicateGroups){let G=
|
|
425
|
-
Done.`))}}async function
|
|
426
|
-
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2)}else if(Z.startsWith("github:")||Z.startsWith("https://github.com/"))await
|
|
427
|
-
`);let J=[];for(let G of z){console.error(` Scanning ${
|
|
428
|
-
Summary:`)),G.dangerous>0)console.log(` ${
|
|
429
|
-
`);let G=await
|
|
447
|
+
${W.bold("Examples:")}
|
|
448
|
+
asm config show ${W.dim("View current config")}
|
|
449
|
+
asm config edit ${W.dim("Edit in $EDITOR")}
|
|
450
|
+
asm config reset -y ${W.dim("Reset without confirmation")}`)}async function kZ($){for(let q of $)q.warnings=await C5(q)}async function nV($){if($.flags.help){hV();return}let q=performance.now(),Z=await v(),Q=await i(Z,$.flags.scope);if($.flags.provider&&$.command==="list")Q=Q.filter((z)=>z.provider===$.flags.provider);await kZ(Q);let X=r4(Q,$.flags.sort);if($.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(d("list",z,q));return}if($.flags.json)console.log(l(X));else if($.flags.flat){let z=$2(X),J=X.filter((G)=>G.warnings&&G.warnings.length>0);if(J.length>0)z+=`
|
|
451
|
+
${W.yellow(`${J.length} skill${J.length===1?"":"s"} with warnings -- use --json for details`)}`;console.log(z)}else console.log(NZ(X))}async function iV($){if($.flags.help){vV();return}let q=$.flags.machine?u0():void 0,Z=performance.now(),Q=$.subcommand;if(!Q){if($.flags.machine)q?.(),console.log(s("search",a.INVALID_ARGUMENT,"Missing required argument: <query>",Z)),process.exit(2);w("Missing required argument: <query>"),console.error('Run "asm search --help" for usage.'),process.exit(2)}let X=!$.flags.available,z=!$.flags.installed,J=[];if(X){let V=await v(),H=await i(V,$.flags.scope);if($.flags.provider)H=H.filter((_)=>_.provider===$.flags.provider);let B=OZ(H,Q);J=r4(B,$.flags.sort)}let G=[];if(z){if(G=await sq(Q),J.length>0){let V=new Set(J.map((H)=>H.name.toLowerCase()));G=G.filter((H)=>!V.has(H.skill.name.toLowerCase()))}}if($.flags.machine){q?.();let V=J.map((B)=>({name:B.name,description:B.description,source:"installed",url:null,match_count:1})),H=G.map((B)=>({name:B.skill.name,description:B.skill.description,source:"index",url:B.skill.installUrl,match_count:1}));console.log(d("search",[...V,...H],Z));return}if($.flags.json){let V=J.map((B)=>({name:B.name,description:B.description,version:B.version,scope:B.scope,provider:B.provider,status:"installed"})),H=G.map((B)=>({name:B.skill.name,description:B.skill.description,version:B.skill.version,repo:`${B.repo.owner}/${B.repo.repo}`,installCommand:`asm install ${B.skill.installUrl}`,status:"available"}));console.log(l([...V,...H]));return}let Y=J.length>0,U=G.length>0;if(!Y&&!U){console.error(`No skills matching "${Q}".`),console.error(W.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(Y)if(console.error(W.bold(`Installed skills matching "${Q}":
|
|
452
|
+
`)),$.flags.flat)console.log($2(J));else console.log(DZ(J,Q));if(U){if(Y)console.error("");let V=RZ(G.map((H)=>({name:H.skill.name,version:H.skill.version,description:H.skill.description,verified:H.skill.verified,repoLabel:`${H.repo.owner}/${H.repo.repo}`,installUrl:H.skill.installUrl})),Q);console.error(V)}}async function oV($){if($.flags.help){gV();return}let q=$.subcommand;if(!q)w("Missing required argument: <skill-name>"),console.error('Run "asm inspect --help" for usage.'),process.exit(2);let Z=await v(),X=(await i(Z,$.flags.scope)).filter((z)=>z.dirName===q);if(X.length===0)w(`Skill "${q}" not found.`),console.error(W.dim(`Try ${W.bold("asm list")} to see all skills or ${W.bold(`asm search "${q}"`)} to search.`)),process.exit(1);if(await kZ(X),$.flags.json)console.log(l(X.length===1?X[0]:X));else console.log(await wZ(X))}async function aV($){if($.flags.help){uV();return}let q=$.subcommand;if(!q)w("Missing required argument: <skill-name>"),console.error('Run "asm uninstall --help" for usage.'),process.exit(2);let Z=await v(),Q=await i(Z,$.flags.scope),X=IZ(q,Q,Z),z=await TZ(X);if(z.length===0)w(`Skill "${q}" not found or nothing to remove.`),process.exit(1);console.error(W.bold("Removal plan:"));for(let G of z)console.error(` ${W.red("•")} ${jZ(G)}`);if(!$.flags.yes){if(!process.stdin.isTTY)w("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`
|
|
453
|
+
${W.bold("Proceed with removal?")} [y/N] `);let G=await q0();if(G.toLowerCase()!=="y"&&G.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let J=await e4(X);for(let G of J)console.error(G);try{await CZ(q)}catch{}console.error(W.green(`
|
|
454
|
+
Done.`))}function q0(){return new Promise(($)=>{let q="",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(),$(Y)}function z(Y){if(q+=Y,q.includes(`
|
|
455
|
+
`))X(q.trim())}function J(){X(q.trim())}let G=setTimeout(()=>{X(q.trim())},30000);process.stdin.setEncoding("utf-8"),process.stdin.on("data",z),process.stdin.on("end",J),process.stdin.resume()})}async function sV($){if($.flags.help){mV();return}let q=performance.now(),Z=$.subcommand??"duplicates";if(Z==="security"){await tV($,q);return}if(Z!=="duplicates")w(`Unknown audit subcommand: "${Z}". Use: duplicates, security`),process.exit(2);let Q=await v(),X=await i(Q,"both"),z=q2(X);if($.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(d("audit duplicates",J,q));return}if($.flags.json){console.log(xZ(z));return}if(console.log(bZ(z)),$.flags.yes&&z.duplicateGroups.length>0){console.error(W.bold(`
|
|
456
|
+
Auto-removing duplicates...`));for(let J of z.duplicateGroups){let G=SZ(J.instances),Y=G[0].path;for(let U=1;U<G.length;U++){let V=G[U],H=AZ(V,Q),B=await e4(H,Y);for(let _ of B)console.error(_)}}console.error(W.green(`
|
|
457
|
+
Done.`))}}async function tV($,q){let Z=$.positional[0];if($.flags.all)await rV($,q);else if(!Z){if($.flags.machine)console.log(s("audit security",a.INVALID_ARGUMENT,"Missing target. Provide a skill name, GitHub source, or use --all.",q)),process.exit(2);w(`Missing target. Provide a skill name, GitHub source, or use --all.
|
|
458
|
+
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2)}else if(Z.startsWith("github:")||Z.startsWith("https://github.com/"))await eV($,Z,q);else await $B($,Z,q)}async function rV($,q){let Z=await v(),Q=await i(Z,$.flags.scope);if(Q.length===0){if($.flags.machine)console.log(d("audit security",[],q));else if($.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":""}...
|
|
459
|
+
`);let J=[];for(let G of z){console.error(` Scanning ${W.bold(G.name)}...`);let Y=await N0(G.realPath,G.name);J.push(Y)}if($.flags.machine)console.log(d("audit security",Q2(J),q));else if($.flags.json)console.log(JSON.stringify(J,null,2));else{for(let Y of J)console.log(uq(Y));let G={safe:0,caution:0,warning:0,dangerous:0};for(let Y of J)G[Y.verdict]++;if(console.log(W.bold(`
|
|
460
|
+
Summary:`)),G.dangerous>0)console.log(` ${W.red(`${G.dangerous} dangerous`)}`);if(G.warning>0)console.log(` ${W.yellow(`${G.warning} warning`)}`);if(G.caution>0)console.log(` ${G.caution} caution`);if(G.safe>0)console.log(` ${W.green(`${G.safe} safe`)}`);console.log("")}}async function eV($,q,Z){let Q=null;try{let X=c0(q);if(X.isLocal)throw Error("Local paths are not supported for remote security audits. Use: asm audit security <installed-skill-name>");await l0(),X=await X9(X),console.error(`Cloning ${q} for audit...`),Q=await n0(X,$.flags.transport);let{join:z}=await import("path"),J=X.subpath?z(Q,X.subpath):Q,{name:G}=await P0(J),Y=await N0(J,G,X.owner,X.repo);if($.flags.machine)console.log(d("audit security",Q2([Y]),Z));else if($.flags.json)console.log(C4(Y));else console.log(uq(Y))}catch(X){if($.flags.machine)console.log(s("audit security",a.AUDIT_FAILED,X.message,Z)),process.exit(1);w(X.message),process.exit(1)}finally{if(Q)await Q0(Q)}}async function $B($,q,Z){let Q=await v(),z=(await i(Q,$.flags.scope)).filter((Y)=>Y.dirName===q);if(z.length===0){if($.flags.machine)console.log(s("audit security",a.SKILL_NOT_FOUND,`Skill "${q}" not found.`,Z)),process.exit(1);w(`Skill "${q}" not found. Use "asm list" to see installed skills.`),process.exit(1)}let J=z[0];console.error(`Auditing installed skill: ${W.bold(J.name)}...
|
|
461
|
+
`);let G=await N0(J.realPath,J.name);if($.flags.machine)console.log(d("audit security",Q2([G]),Z));else if($.flags.json)console.log(C4(G));else console.log(uq(G))}async function qB($){if($.flags.help){lV();return}let q=$.subcommand;if(!q)w("Missing subcommand. Use: show, path, reset, or edit."),console.error('Run "asm config --help" for usage.'),process.exit(2);switch(q){case"show":{let Z=await v();console.log(l(Z));break}case"path":{console.log(f$());break}case"reset":{if(!$.flags.yes){if(!process.stdin.isTTY)w("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`${W.bold("Reset config to defaults?")} [y/N] `);let Q=await q0();if(Q.toLowerCase()!=="y"&&Q.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Z=LZ();await FZ(Z),console.error(W.green("Config reset to defaults."));break}case"edit":{let Z=process.env.VISUAL||process.env.EDITOR||"vi",[Q,X]=yZ(Z),z=f$();await v();let{spawn:J}=await import("child_process");await new Promise((G,Y)=>{let U=J(Q,[...X,z],{stdio:"inherit"});U.on("close",()=>G()),U.on("error",Y)});break}default:w(`Unknown config subcommand: "${q}". Use: show, path, reset, or edit.`),process.exit(2)}}function ZB(){console.log(`${W.bold("Usage:")} asm install <source> [options]
|
|
430
462
|
|
|
431
463
|
Install a skill from a GitHub repository, the curated registry, or a local path.
|
|
432
464
|
|
|
433
|
-
${
|
|
465
|
+
${W.bold("Source Format:")}
|
|
434
466
|
code-review Install by name from the curated registry
|
|
435
467
|
author/code-review Install a scoped name (author/name) from registry
|
|
436
468
|
github:owner/repo Install from default branch
|
|
@@ -443,7 +475,7 @@ ${U.bold("Source Format:")}
|
|
|
443
475
|
./relative/path/to/skill Install from a local folder (relative path)
|
|
444
476
|
~/path/to/skill Install from a local folder (home-relative path)
|
|
445
477
|
|
|
446
|
-
${
|
|
478
|
+
${W.bold("Options:")}
|
|
447
479
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents, all)
|
|
448
480
|
Use "all" to install to all tools (shared + symlinks)
|
|
449
481
|
-s, --scope <scope> Installation scope: global or project (default: prompt)
|
|
@@ -465,73 +497,73 @@ ${U.bold("Options:")}
|
|
|
465
497
|
--no-color Disable ANSI colors
|
|
466
498
|
-V, --verbose Show debug output
|
|
467
499
|
|
|
468
|
-
${
|
|
469
|
-
asm install code-review ${
|
|
470
|
-
asm install luongnv89/code-review ${
|
|
471
|
-
asm install code-review --no-cache ${
|
|
500
|
+
${W.bold("Registry (bare name):")}
|
|
501
|
+
asm install code-review ${W.dim("(resolve from registry)")}
|
|
502
|
+
asm install luongnv89/code-review ${W.dim("(scoped name, no ambiguity)")}
|
|
503
|
+
asm install code-review --no-cache ${W.dim("(force fresh registry fetch)")}
|
|
472
504
|
|
|
473
|
-
${
|
|
474
|
-
asm install ./my-skill ${
|
|
475
|
-
asm install /home/user/skills/my-skill ${
|
|
476
|
-
asm install ~/skills/my-skill ${
|
|
477
|
-
asm install ../other-project/skill ${
|
|
478
|
-
asm install ./skills-dir --all ${
|
|
505
|
+
${W.bold("Local folder:")}
|
|
506
|
+
asm install ./my-skill ${W.dim("(relative path)")}
|
|
507
|
+
asm install /home/user/skills/my-skill ${W.dim("(absolute path)")}
|
|
508
|
+
asm install ~/skills/my-skill ${W.dim("(home-relative path)")}
|
|
509
|
+
asm install ../other-project/skill ${W.dim("(parent-relative path)")}
|
|
510
|
+
asm install ./skills-dir --all ${W.dim("(all skills in directory)")}
|
|
479
511
|
|
|
480
|
-
${
|
|
512
|
+
${W.bold("Single-skill repo:")}
|
|
481
513
|
asm install github:user/my-skill
|
|
482
514
|
asm install github:user/my-skill#v1.0.0 -p claude
|
|
483
515
|
asm install https://github.com/user/my-skill
|
|
484
|
-
asm install github:user/my-skill -p all ${
|
|
485
|
-
asm install github:user/private-skill -t ssh ${
|
|
516
|
+
asm install github:user/my-skill -p all ${W.dim("(install to all tools)")}
|
|
517
|
+
asm install github:user/private-skill -t ssh ${W.dim("(clone via SSH)")}
|
|
486
518
|
|
|
487
|
-
${
|
|
519
|
+
${W.bold("Multi-skill repo:")}
|
|
488
520
|
asm install github:user/skills --path skills/code-review
|
|
489
521
|
asm install github:user/skills --all -p claude -y
|
|
490
|
-
asm install github:user/skills --all -p all -y ${
|
|
522
|
+
asm install github:user/skills --all -p all -y ${W.dim("(all skills, all tools)")}
|
|
491
523
|
asm install https://github.com/user/skills --all
|
|
492
|
-
asm install github:user/skills ${
|
|
524
|
+
asm install github:user/skills ${W.dim("(interactive picker)")}
|
|
493
525
|
|
|
494
|
-
${
|
|
526
|
+
${W.bold("Subfolder URL:")}
|
|
495
527
|
asm install https://github.com/user/skills/tree/main/skills/agent-config
|
|
496
528
|
asm install github:user/skills#main:skills/agent-config
|
|
497
529
|
|
|
498
|
-
${
|
|
530
|
+
${W.bold("Vercel skills CLI:")}
|
|
499
531
|
asm install github:user/skills --method vercel --skill my-skill
|
|
500
532
|
asm install https://github.com/user/skills -m vercel --skill my-skill -y
|
|
501
|
-
${
|
|
502
|
-
${
|
|
503
|
-
${
|
|
504
|
-
${
|
|
505
|
-
${
|
|
506
|
-
${
|
|
507
|
-
${
|
|
508
|
-
Select a skill [1-${S.length}]: `;process.stderr.write(
|
|
509
|
-
Did you mean: ${
|
|
510
|
-
`);for(let
|
|
533
|
+
${W.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function QB($,q,Z,Q,X,z,J,G,Y="global"){let U=await P0(Q),V=await K2(Q),H=Q===Z?null:Q.split(/[/\\]/).pop(),B=X||H||q.repo,_=w0(B),L=G.find((D)=>D.name.toLowerCase()===U.name.toLowerCase()&&D.provider===J.name),K,F=!!L;if(L)if(L.version===U.version)K=$.flags.force?"REINSTALL":`UPDATE: ${L.version} (same version)`;else K=`UPDATE: ${L.version} → ${U.version}`;else K="NEW";let O=z9(q,Z,Q,_,J,$.flags.force||F,Y),A=V.some((D)=>["Shell commands","Code execution","Credentials"].includes(D.category)),M=V.some((D)=>["External URLs"].includes(D.category)),N=A?"high":M?"medium":"safe",T=A?W.red("[!] High Risk"):M?W.yellow("[~] Medium Risk"):W.green("[ok] Safe");return{metadata:U,skillName:_,warnings:V,installStatus:K,riskLevel:N,riskLabel:T,plan:O}}function XB($,q,Z,Q,X,z){let{metadata:J,warnings:G,installStatus:Y,riskLabel:U,plan:V}=$;if(X&&z){let H=W.dim(`[${z.index}/${z.total}]`),B=Y==="NEW"?W.green(`[${Y}]`):W.yellow(`[${Y}]`);console.info(`${H} ${W.bold(J.name)} v${J.version} ${B} ${U}`)}else{let H=Y==="NEW"?W.green(`[${Y}]`):W.yellow(`[${Y}]`);if(console.info(` ${W.bold(J.name)} v${J.version} ${H}`),console.info(`
|
|
534
|
+
${W.bold("Install preview:")}`),console.info(` ${W.bold("Name:")} ${J.name}`),console.info(` ${W.bold("Version:")} ${J.version}`),J.description)console.info(` ${W.bold("Description:")} ${W.dim(J.description)}`);if(J.effort)console.info(` ${W.bold("Effort:")} ${MZ(J.effort)}`);if(console.info(` ${W.bold("Source:")} ${q}`),Q)console.info(` ${W.bold("Tool:")} All (${Q.map((B)=>B.label).join(", ")})`),console.info(` ${W.bold("Primary:")} ${Z.label} (${Z.name})`),console.info(` ${W.bold("Symlinks:")} ${Q.filter((B)=>B.name!==Z.name).map((B)=>B.label).join(", ")}`);else console.info(` ${W.bold("Tool:")} ${Z.label} (${Z.name})`);if(console.info(` ${W.bold("Scope:")} ${V.scope==="project"?"Project":"Global"}`),console.info(` ${W.bold("Target:")} ${V.targetDir}`),console.info(` ${W.bold("Status:")} ${H}`),console.info(` ${W.bold("Risk:")} ${U}`),G.length>0){console.info(`
|
|
535
|
+
${W.bold("Security warnings:")}`);let B=new Map;for(let _ of G){let L=B.get(_.category)||[];L.push(_),B.set(_.category,L)}for(let[_,L]of B){let F=["Shell commands","Code execution","Credentials"].includes(_)?W.red(`[${_}]`):W.yellow(`[${_}]`);console.info(`
|
|
536
|
+
${F} ${W.dim(`(${L.length} match${L.length>1?"es":""})`)}`);for(let O of L.slice(0,5))console.info(` ${W.dim(`${O.file}:${O.line}`)} -- ${O.match}`);if(L.length>5)console.info(W.dim(` ... and ${L.length-5} more`))}}}}async function zB($,q){if(q)return await _2($,q);return await a$($)}async function JB($){if($.flags.help){ZB();return}let q=$.flags.machine?u0():void 0,Z=performance.now(),Q=$.subcommand;if(!Q)w("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=(V)=>{return G++,`
|
|
537
|
+
${W.cyan(`[Step ${G}/${J}]`)} ${W.bold(V)}`},U=()=>{if(X)Q0(X).finally(()=>process.exit(1));else process.exit(1)};process.on("SIGINT",U),process.on("SIGTERM",U);try{if(O4(Q)){console.info(`
|
|
538
|
+
${W.cyan("●")} Resolving "${W.bold(Q)}" from registry...`);let{resolved:I,multipleMatches:j,suggestions:C}=await y5(Q,{noCache:$.flags.noCache});if(I){z="registry";let S=I.manifest,y=S.repository.replace("https://github.com/","");Q=S.skill_path?`github:${y}#${S.commit}:${S.skill_path}`:`github:${y}#${S.commit}`,console.info(` ${W.green("✓")} Resolved: ${W.bold(`${S.author}/${S.name}`)} @ ${S.commit.slice(0,7)}`)}else if(j.length>0){console.info(`
|
|
539
|
+
${W.yellow("⚠")} Multiple skills found for "${W.bold(Q)}":`);let S=j.slice(0,5);for(let H0=0;H0<S.length;H0++){let Z0=S[H0];console.info(` ${W.cyan(`${H0+1}.`)} ${W.bold(`${Z0.author}/${Z0.name}`)} — ${Z0.description}`)}if(!process.stdin.isTTY)w(`Ambiguous skill name "${Q}". Use a scoped name: asm install author/name`),process.exit(2);let y=`
|
|
540
|
+
Select a skill [1-${S.length}]: `;process.stderr.write(y);let c=await new Promise((H0)=>{let Z0="",m0=!1,p$=setTimeout(()=>{if(!m0)m0=!0,process.stdin.removeListener("data",Y$),H0(Z0.trim())},30000);function Y$(p0){if(Z0=p0.toString().trim(),!m0)m0=!0,clearTimeout(p$),process.stdin.removeListener("data",Y$),H0(Z0)}process.stdin.setEncoding("utf-8"),process.stdin.on("data",Y$)}),p=parseInt(c,10);if(isNaN(p)||p<1||p>S.length)w("Invalid selection. Aborting."),process.exit(2);let t=S[p-1];z="registry";let m$=t.repository.replace("https://github.com/","");Q=t.skill_path?`github:${m$}#${t.commit}:${t.skill_path}`:`github:${m$}#${t.commit}`,console.info(` ${W.green("✓")} Selected: ${W.bold(`${t.author}/${t.name}`)} @ ${t.commit.slice(0,7)}`)}else if(A4(Q)){if(w(`Skill "${Q}" not found in the registry.`),C.length>0)console.error(`
|
|
541
|
+
Did you mean: ${C.map((S)=>W.cyan(S)).join(", ")}?`);process.exit(1)}else console.info(` ${W.dim("Not found in registry — trying existing sources...")}`),z="pre-indexed"}console.info(Y("Parsing source"));let V=c0(Q),H=!!V.isLocal;if(H){let I=V.localPath;console.info(` ${W.dim(`local: ${I}`)}`);let{stat:j}=await import("fs/promises");try{if(!(await j(I)).isDirectory())throw Error(`Path is not a directory: ${I}`)}catch(C){if(C.code==="ENOENT")throw Error(`Path does not exist: ${I}`);throw C}}else await l0(),V=await X9(V),console.info(` ${W.dim(Q)}`);if($.flags.method==="vercel"){console.info(Y("Installing via Vercel skills CLI")),await L2();let I=O2(V),j=$.flags.path||null;console.info(` ${W.dim(`npx skills add ${I}${j?` --skill ${j}`:""}`)}`);let{stdout:C,stderr:S}=await F2(I,j);if(C.trim())console.info(` ${W.dim(C.trim())}`);if(S.trim())console.error(` ${W.dim(S.trim())}`);console.info(` ${W.green("✓")} Vercel skills CLI install completed`),$.flags.force=!0,console.info(` ${W.dim("Continuing with asm install to register in local inventory...")}`)}console.info(Y("Selecting provider"));let B=await v(),{provider:_,allProviders:L}=await i0(B,$.flags.provider,!!process.stdin.isTTY);console.info(Y("Selecting scope"));let K;if($.flags.scope==="global"||$.flags.scope==="project")K=$.flags.scope,console.info(` ${W.dim(`scope: ${K}`)}${K==="global"?` (${_.global})`:` (${_.project})`}`);else if(!process.stdin.isTTY||$.flags.yes)K="global",console.info(` ${W.dim("scope: global (default)")} (${_.global})`);else{let I=[{label:`Global (${_.global})`,hint:"Available in all projects",checked:!0},{label:`Project (${_.project})`,hint:"Available only in this project",checked:!1}];console.info("");let j=await d0({items:I});if(j.length===0)throw Error("No scope selected. Aborting.");K=j[0]===0?"global":"project",console.info(` Selected: ${W.bold(K)} ${W.dim(`(${K==="global"?_.global:_.project})`)}`)}if(H)console.info(Y("Reading local source")),console.info(` ${W.dim(V.localPath)}`),X=null;else{console.info(Y("Cloning repository"));let I=$.flags.transport,j=I==="ssh"?V.sshCloneUrl:I==="https"?V.cloneUrl:`${V.cloneUrl} ${W.dim("(auto)")}`;console.info(` ${j}${V.ref?` ${W.dim(`(ref: ${V.ref})`)}`:""}${V.subpath?` ${W.dim(`(path: ${V.subpath})`)}`:""}`),X=await n0(V,I)}let F=H?V.localPath:X;console.info(Y("Scanning for skills"));let{join:O}=await import("path"),A=[],M=$.flags.path||V.subpath,N=[];if(M){let I=O(F,M);try{await P0(I)}catch{throw Error(`No SKILL.md found at path "${M}" in the repository.`)}console.info(` Found skill at ${W.bold(M)}`),N=[{skillDir:I,nameOverride:$.flags.name}]}else{let I=!1;try{await P0(F),I=!0}catch{}if(I){let j=await P0(F);console.info(` Found: ${W.bold(j.name)} v${j.version}`),N=[{skillDir:F,nameOverride:$.flags.name}]}else{console.info(" No SKILL.md at root. Scanning subdirectories...");let j=await o$(F);if(j.length===0)throw Error("No skills found in this repository. Skills must have a SKILL.md file.");console.info(` Found ${W.bold(String(j.length))} skill(s):
|
|
542
|
+
`);for(let y=0;y<j.length;y++){let c=W.cyan(` ${String(y+1).padStart(String(j.length).length)})`);if(console.info(`${c} ${W.bold(j[y].name)} ${W.dim(`v${j[y].version}`)} ${W.dim(`(${j[y].relPath})`)}`),j[y].description)console.info(` ${W.dim(j[y].description)}`)}console.info(Y("Selecting skills")),G--;let C;if($.flags.all&&($.flags.yes||!process.stdin.isTTY))C=j.map((y)=>y.relPath),console.info(` Selected all ${W.bold(String(C.length))} skills`);else if(process.stdin.isTTY)if(j.length===1)C=[j[0].relPath],console.info(` Auto-selected: ${W.bold(j[0].name)} ${W.dim(`v${j[0].version}`)}`);else{let y=j.map((p)=>({label:p.name,hint:`v${p.version}${p.description?" "+p.description:""}`,checked:!!$.flags.all}));console.info("");let c=await d0({items:y});if(c.length===0)throw Error("No skills selected. Aborting.");C=c.map((p)=>j[p].relPath),console.info(` Selected ${W.bold(String(C.length))} skill(s)`)}else{w(`Repository contains ${j.length} skills. Use --path <subdir> to pick one or --all to install all.
|
|
511
543
|
Available skills:
|
|
512
|
-
${
|
|
513
|
-
`)}`),process.exit(2);return}let S=
|
|
514
|
-
`),
|
|
515
|
-
${
|
|
516
|
-
Choose one path per skill name or install with --path.`);throw
|
|
517
|
-
${
|
|
518
|
-
${
|
|
519
|
-
${
|
|
520
|
-
Done! Installed "${
|
|
521
|
-
${
|
|
544
|
+
${j.map((y)=>` --path ${y.relPath}`).join(`
|
|
545
|
+
`)}`),process.exit(2);return}let S=B2(C);if(S.length>0){let y=S.map((p)=>` - ${p.name}: ${p.paths.map((t)=>`"${t}"`).join(", ")}`).join(`
|
|
546
|
+
`),c=Error(`Duplicate skill names detected in selection:
|
|
547
|
+
${y}
|
|
548
|
+
Choose one path per skill name or install with --path.`);throw c.duplicates=S,c}N=C.map((y)=>({skillDir:O(F,y),nameOverride:C.length===1?$.flags.name:null})),G++}}console.info(Y("Inspecting skills"));let T=await i(B,"both"),D=[],x=N.length>1;for(let I=0;I<N.length;I++){let{skillDir:j,nameOverride:C}=N[I],S=await QB($,V,F,j,C,B,_,T,K);D.push(S),XB(S,Q,_,L,x,x?{index:I+1,total:N.length}:void 0)}if(x){if(console.info(""),console.info(` ${W.bold("Install settings:")}`),console.info(` ${W.bold("Source:")} ${Q}`),L)console.info(` ${W.bold("Tool:")} All (${L.map((y)=>y.label).join(", ")})`);else console.info(` ${W.bold("Tool:")} ${_.label} (${_.name})`);console.info(` ${W.bold("Scope:")} ${K==="project"?"Project":"Global"}`);let I=D.filter((y)=>y.riskLevel==="high").length,j=D.filter((y)=>y.riskLevel==="medium").length,C=D.filter((y)=>y.riskLevel==="safe").length,S=[];if(C>0)S.push(W.green(`${C} Safe`));if(j>0)S.push(W.yellow(`${j} Medium Risk`));if(I>0)S.push(W.red(`${I} High Risk`));console.info(` ${W.bold("Risk:")} ${S.join(", ")}`)}if(console.info(Y("Installing")),!$.flags.yes){let I=D.some((y)=>y.riskLevel==="high");if(!process.stdin.isTTY)w("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);let j=x?`${D.length} skills`:`"${D[0].metadata.name}"`,C=I?`
|
|
549
|
+
${W.red("[!]")} ${W.bold(`Install ${j}? Some have high-risk patterns.`)} [y/N] `:`
|
|
550
|
+
${W.bold(`Install ${j}?`)} [Y/n] `;process.stderr.write(C);let S=await q0();if(I){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 P=X?await EZ(X):null,k=[];for(let I=0;I<D.length;I++){let j=D[I],C=x?W.dim(`[${I+1}/${D.length}]`)+" ":" ";try{console.info(`${C}Installing ${W.bold(j.metadata.name)}...`);let S=await zB(j.plan,L);A.push(S),console.info(`${C}${W.green("✓")} ${j.metadata.name} installed to ${W.dim(j.plan.targetDir)}`);try{let y=H?`local:${V.localPath}`:`github:${V.owner}/${V.repo}`,c=H?"local":z==="registry"?"registry":"github";await k$(S.name,{source:y,commitHash:P||"unknown",ref:V.ref||"main",installedAt:new Date().toISOString(),provider:j.plan.providerName,sourceType:c,...z==="registry"?{registryName:S.name}:{}})}catch{}}catch(S){k.push({name:j.metadata.name,error:S.message}),console.error(`${C}${W.red("✗")} ${W.bold(j.metadata.name)} — ${W.red(S.message)}`)}}if(process.removeListener("SIGINT",U),process.removeListener("SIGTERM",U),k.length>0){console.error(`
|
|
551
|
+
${W.yellow(`${k.length} skill(s) failed to install:`)}`);for(let I of k)console.error(` ${W.red("✗")} ${I.name}: ${I.error}`)}if($.flags.machine){q?.();let I=A.map((j)=>({name:j.name,path:j.path,version:j.version,provider:j.provider,source:j.source,resolution_source:z}));console.log(d("install",I.length===1?I[0]:I,Z))}else if($.flags.json){let I=A.map((j)=>({...j,resolutionSource:z}));console.log(JSON.stringify(I.length===1?I[0]:I,null,2))}else if(A.length===1)console.error(W.green(`
|
|
552
|
+
Done! Installed "${A[0].name}" to ${A[0].path}`));else if(A.length>0)console.error(`
|
|
553
|
+
${W.green(`Done! Installed ${A.length} skill(s) successfully.`)}`)}catch(V){if(process.removeListener("SIGINT",U),process.removeListener("SIGTERM",U),$.flags.machine)q?.(),console.log(s("install",a.INSTALL_FAILED,V.message,Z,V?.duplicates?{duplicates:V.duplicates}:void 0));else if($.flags.json){let H={success:!1,error:V.message};if(V?.duplicates)H.duplicates=V.duplicates;console.log(JSON.stringify(H,null,2))}else w(V.message);process.exit(1)}finally{if(X)await Q0(X);q?.()}}function GB(){console.log(`${W.bold("Usage:")} asm export [options]
|
|
522
554
|
|
|
523
555
|
Export skill inventory as a portable JSON manifest. Useful for backup,
|
|
524
556
|
sharing, or scripting.
|
|
525
557
|
|
|
526
|
-
${
|
|
558
|
+
${W.bold("Options:")}
|
|
527
559
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
528
560
|
--no-color Disable ANSI colors
|
|
529
561
|
-V, --verbose Show debug output
|
|
530
562
|
|
|
531
|
-
${
|
|
532
|
-
asm export ${
|
|
533
|
-
asm export -s global ${
|
|
534
|
-
asm export > skills.json ${
|
|
563
|
+
${W.bold("Examples:")}
|
|
564
|
+
asm export ${W.dim("Export all skills")}
|
|
565
|
+
asm export -s global ${W.dim("Export global skills only")}
|
|
566
|
+
asm export > skills.json ${W.dim("Save to file")}`)}async function YB($){if($.flags.help){GB();return}let q=await v(),Z=await i(q,$.flags.scope),Q=k5(Z);console.log(JSON.stringify(Q,null,2))}function UB(){console.log(`${W.bold("Usage:")} asm import <file> [options]
|
|
535
567
|
|
|
536
568
|
Import skills from a previously exported JSON manifest. Recreates skill
|
|
537
569
|
installations based on the manifest metadata.
|
|
@@ -540,7 +572,7 @@ Skills that already exist at the target location are skipped unless --force
|
|
|
540
572
|
is used. Skills whose source files cannot be found locally are reported as
|
|
541
573
|
failed — install them first with "asm install".
|
|
542
574
|
|
|
543
|
-
${
|
|
575
|
+
${W.bold("Options:")}
|
|
544
576
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
545
577
|
-f, --force Overwrite existing skills
|
|
546
578
|
-y, --yes Skip confirmation prompt
|
|
@@ -548,59 +580,114 @@ ${U.bold("Options:")}
|
|
|
548
580
|
--no-color Disable ANSI colors
|
|
549
581
|
-V, --verbose Show debug output
|
|
550
582
|
|
|
551
|
-
${
|
|
552
|
-
asm import skills.json ${
|
|
553
|
-
asm import skills.json --force ${
|
|
554
|
-
asm import skills.json -s global ${
|
|
555
|
-
asm export > backup.json ${
|
|
556
|
-
asm import backup.json ${
|
|
557
|
-
${
|
|
558
|
-
Nothing to import after scope filtering (--scope ${
|
|
583
|
+
${W.bold("Examples:")}
|
|
584
|
+
asm import skills.json ${W.dim("Import from manifest")}
|
|
585
|
+
asm import skills.json --force ${W.dim("Overwrite existing skills")}
|
|
586
|
+
asm import skills.json -s global ${W.dim("Import only global skills")}
|
|
587
|
+
asm export > backup.json ${W.dim("Export first, then import later")}
|
|
588
|
+
asm import backup.json ${W.dim("Restore from backup")}`)}async function WB($){if($.flags.help){UB();return}let q=$.subcommand;if(!q)w("Missing required argument: <file>"),console.error('Run "asm import --help" for usage.'),process.exit(2);let{resolve:Z}=await import("path"),Q=Z(q),X;try{X=await g5(Q)}catch(Y){w(Y.message),process.exit(1)}let z=X.skills.length;if(z===0){if($.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=$.flags.scope==="both"?"all scopes":$.flags.scope;if(console.error(`${W.bold("Importing")} ${z} skill${z>1?"s":""} from ${W.dim(Q)}`),console.error(` Scope filter: ${J}`),$.flags.force)console.error(` ${W.yellow("Force mode: existing skills will be overwritten")}`);if(!$.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
589
|
+
${W.bold("Proceed?")} [y/N] `);let Y=await q0();if(Y.toLowerCase()!=="y"&&Y.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let G=await u5(X,{force:$.flags.force,dryRun:!1,scopeFilter:$.flags.scope});if($.flags.json){console.log(JSON.stringify(G,null,2));return}if(G.total===0){console.error(`
|
|
590
|
+
Nothing to import after scope filtering (--scope ${$.flags.scope}). All skills in the manifest were excluded.`);return}console.error("");for(let Y of G.results){let U=Y.status==="installed"?W.green("+++"):Y.status==="skipped"?W.yellow("---"):Y.status==="dry-run"?W.cyan("~~~"):W.red("!!!"),V=Y.reason?` ${W.dim(Y.reason)}`:"",H=Y.path?` ${W.dim(Y.path)}`:"";console.error(` ${U} ${Y.skillName} (${Y.provider}/${Y.scope})${V}${H}`)}if(console.error(""),console.error(`${W.bold("Summary:")} ${G.total} total, ${W.green(String(G.installed))} installed, ${W.yellow(String(G.skipped))} skipped, ${W.red(String(G.failed))} failed`),G.failed>0)process.exitCode=1}function HB(){console.log(`${W.bold("Usage:")} asm init <name> [options]
|
|
559
591
|
|
|
560
592
|
Scaffold a new skill directory with a SKILL.md template. Creates a
|
|
561
593
|
ready-to-edit skill in the target tool's skill folder.
|
|
562
594
|
|
|
563
|
-
${
|
|
595
|
+
${W.bold("Options:")}
|
|
564
596
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
565
597
|
--path <dir> Scaffold in specified directory instead of provider path
|
|
566
598
|
-f, --force Overwrite if skill already exists
|
|
567
599
|
--no-color Disable ANSI colors
|
|
568
600
|
-V, --verbose Show debug output
|
|
569
601
|
|
|
570
|
-
${
|
|
571
|
-
asm init my-skill ${
|
|
572
|
-
asm init my-skill -p claude ${
|
|
573
|
-
asm init my-skill --path ./skills ${
|
|
574
|
-
${
|
|
602
|
+
${W.bold("Examples:")}
|
|
603
|
+
asm init my-skill ${W.dim("Scaffold (interactive tool)")}
|
|
604
|
+
asm init my-skill -p claude ${W.dim("Scaffold in Claude Code")}
|
|
605
|
+
asm init my-skill --path ./skills ${W.dim("Scaffold in custom directory")}`)}async function VB($){if($.flags.help){HB();return}let q=$.subcommand;if(!q)w("Missing required argument: <name>"),console.error('Run "asm init --help" for usage.'),process.exit(2);let Z=w0(q),Q;if($.flags.path){let{resolve:X}=await import("path");Q=X($.flags.path)}else{let X=await v(),{provider:z}=await i0(X,$.flags.provider,!!process.stdin.isTTY),{join:J}=await import("path"),{resolveProviderPath:G}=await import("./chunk-a26gjzjk.js"),Y=G(X.providers.find((U)=>U.name===z.name).global);Q=J(Y,Z)}if(await p5(Q)){if(!$.flags.force){if(!process.stdin.isTTY)w(`Directory already exists: ${Q}. Use --force to overwrite.`),process.exit(2);process.stderr.write(`${W.yellow(`Directory already exists: ${Q}`)}
|
|
606
|
+
${W.bold("Overwrite?")} [y/N] `);let X=await q0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}}await m5(Z,Q),console.error(W.green(`Done! Created skill "${Z}" at ${Q}`))}function BB(){console.log(`${W.bold("Usage:")} asm stats [options]
|
|
575
607
|
|
|
576
608
|
Show aggregate skill metrics with provider distribution charts,
|
|
577
609
|
scope breakdown, disk usage, and duplicate summary.
|
|
578
610
|
|
|
579
|
-
${
|
|
611
|
+
${W.bold("Options:")}
|
|
580
612
|
--json Output as JSON
|
|
581
613
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
582
614
|
--no-color Disable ANSI colors
|
|
583
615
|
-V, --verbose Show debug output
|
|
584
616
|
|
|
585
|
-
${
|
|
586
|
-
asm stats ${
|
|
587
|
-
asm stats -s global ${
|
|
588
|
-
asm stats --json ${
|
|
617
|
+
${W.bold("Examples:")}
|
|
618
|
+
asm stats ${W.dim("Show full dashboard")}
|
|
619
|
+
asm stats -s global ${W.dim("Global skills only")}
|
|
620
|
+
asm stats --json ${W.dim("Output raw data as JSON")}`)}async function KB($){if($.flags.help){BB();return}let q=await v(),Z=await i(q,$.flags.scope);if(Z.length===0){console.log("No skills found.");return}let Q=q2(Z),X=await l5(Z,Q);if($.flags.json)if(!$.flags.verbose){let{perSkillDiskBytes:z,...J}=X;console.log(l(J))}else console.log(l(X));else console.log(n5(X))}function _B(){console.log(`${W.bold("Usage:")} asm doctor [options]
|
|
589
621
|
|
|
590
622
|
Run environment health checks and diagnostics. Validates all
|
|
591
623
|
prerequisites for using asm — git, GitHub CLI, Node.js, config,
|
|
592
624
|
lock file, registry, installed skills, and disk space.
|
|
593
625
|
|
|
594
|
-
${
|
|
626
|
+
${W.bold("Options:")}
|
|
595
627
|
--json Output as JSON
|
|
596
628
|
--machine Output in stable machine-readable v1 envelope format
|
|
597
629
|
--no-color Disable ANSI colors
|
|
598
630
|
-V, --verbose Show debug output
|
|
599
631
|
|
|
600
|
-
${
|
|
601
|
-
asm doctor ${
|
|
602
|
-
asm doctor --json ${
|
|
603
|
-
asm doctor --machine ${
|
|
632
|
+
${W.bold("Examples:")}
|
|
633
|
+
asm doctor ${W.dim("Run all health checks")}
|
|
634
|
+
asm doctor --json ${W.dim("Output as JSON")}
|
|
635
|
+
asm doctor --machine ${W.dim("Machine-readable v1 envelope output")}`)}async function LB($){if($.flags.help){_B();return}let q=performance.now(),Z=await I8();if($.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(d("doctor",Q,q))}else if($.flags.json)console.log(M8(Z));else console.log(T8(Z));if(Z.failures>0)process.exit(1)}function FB(){console.log(`${W.bold("Usage:")} asm eval <skill-path> [options]
|
|
636
|
+
|
|
637
|
+
Evaluate a skill's SKILL.md against best practices and produce a scored quality
|
|
638
|
+
report. Categories: structure, description quality, prompt engineering, context
|
|
639
|
+
efficiency, safety, testability, and naming conventions.
|
|
640
|
+
|
|
641
|
+
The evaluation runs through the ${W.bold("eval provider framework")}; ${W.bold("asm eval")} uses the
|
|
642
|
+
${W.bold("quality")} provider by default, or the ${W.bold("skillgrade")} runtime provider with
|
|
643
|
+
${W.bold("--runtime")}. Use ${W.bold("asm eval-providers list")} to see available providers.
|
|
644
|
+
|
|
645
|
+
${W.bold("Arguments:")}
|
|
646
|
+
skill-path Path to a skill directory (must contain SKILL.md)
|
|
647
|
+
|
|
648
|
+
${W.bold("Options:")}
|
|
649
|
+
--fix Apply deterministic auto-fixes to SKILL.md (creates .bak)
|
|
650
|
+
--dry-run With --fix, preview the diff without writing
|
|
651
|
+
--runtime Run the skillgrade runtime provider (LLM-judge evals)
|
|
652
|
+
--runtime init Scaffold eval.yaml via \`skillgrade init\`
|
|
653
|
+
--preset <name> Skillgrade preset: smoke | reliable | regression
|
|
654
|
+
--threshold <n> Pass threshold (0..1 fraction or 0..100 integer)
|
|
655
|
+
--provider <name> Skillgrade exec provider: docker | local
|
|
656
|
+
--compare <specs> Diff two provider versions on the same skill
|
|
657
|
+
(format: id@v1,id@v2 — see Examples below)
|
|
658
|
+
--json Output report as JSON
|
|
659
|
+
--machine Output in stable machine-readable v1 envelope format
|
|
660
|
+
--no-color Disable ANSI colors
|
|
661
|
+
-V, --verbose Show debug output
|
|
662
|
+
|
|
663
|
+
${W.bold("Examples:")}
|
|
664
|
+
asm eval ./my-skill ${W.dim("Static quality score")}
|
|
665
|
+
asm eval ./my-skill --json ${W.dim("Output report as JSON")}
|
|
666
|
+
asm eval ./my-skill --fix ${W.dim("Auto-fix deterministic frontmatter issues")}
|
|
667
|
+
asm eval ./my-skill --fix --dry-run ${W.dim("Preview fixes as diff")}
|
|
668
|
+
asm eval ./my-skill --machine ${W.dim("Machine-readable v1 envelope output")}
|
|
669
|
+
asm eval ./my-skill --runtime ${W.dim("Run skillgrade runtime evals")}
|
|
670
|
+
asm eval ./my-skill --runtime init ${W.dim("Scaffold eval.yaml via skillgrade init")}
|
|
671
|
+
asm eval ./my-skill --runtime --preset reliable --threshold 0.9
|
|
672
|
+
asm eval ./my-skill --compare quality@1.0.0,quality@1.0.0
|
|
673
|
+
${W.dim("Diff two provider versions (upgrade safety)")}
|
|
674
|
+
asm eval-providers list ${W.dim("List registered eval providers")}`)}var KZ=!1;function rq(){if(KZ)return;a8(),KZ=!0}function OB($){let q=$.findings.find((Z)=>Z.severity==="error"&&(Z.code==="provider-threw"||Z.code==="timeout"||Z.code==="aborted"));if(q)throw Error(q.message)}async function AB($){if($.flags.help){FB();return}let q=$.flags.machine?u0():void 0,Z=performance.now(),Q=$.subcommand;if(!Q){if($.flags.machine)q?.(),console.log(s("eval",a.INVALID_ARGUMENT,"Missing required argument: <skill-path>",Z)),process.exit(2);w("Missing required argument: <skill-path>"),console.error('Run "asm eval --help" for usage.'),process.exit(2)}try{if($.flags.compare!==null){let[U,V]=qZ($.flags.compare);rq();let{resolve:H}=await import("path"),B=H(Q),_={skillPath:B,skillMdPath:H(B,"SKILL.md")},L=v$(U.id,U.version),K=v$(V.id,V.version),F={};try{let T=(await a4()).defaults.timeoutMs;if(typeof T==="number"&&T>0)F.timeoutMs=T}catch(N){throw Error(`failed to load ~/.asm/config.yml: ${N?.message??String(N)}`)}if($.flags.preset)F.preset=$.flags.preset;if($.flags.provider)F.provider=$.flags.provider;if($.flags.threshold!==null)F.threshold=$.flags.threshold;let O=await h$(L,_,F),A=await h$(K,_,F);if($.flags.machine)q?.(),console.log(d("eval",{before:{provider_id:O.providerId,provider_version:O.providerVersion,schema_version:O.schemaVersion,score:O.score,passed:O.passed,categories:O.categories,findings:O.findings},after:{provider_id:A.providerId,provider_version:A.providerVersion,schema_version:A.schemaVersion,score:A.score,passed:A.passed,categories:A.categories,findings:A.findings}},Z)),process.exit(A.passed?0:1);if($.flags.json)console.log(JSON.stringify({before:O,after:A},null,2)),process.exit(A.passed?0:1);let M=$Z(O,A,{useColor:!$.flags.noColor});console.log(M),process.exit(A.passed?0:1)}if($.flags.fix){let U=await x8(),V=await b8(Q,{dryRun:$.flags.dryRun,gitAuthor:U});if($.flags.machine){q?.(),console.log(d("eval",m4(V.report,V),Z));return}if($.flags.json){console.log(JSON.stringify({report:V.report,fix:{dryRun:V.dryRun,applied:V.applied,skipped:V.skipped,backupPath:V.backupPath,diff:V.diff}},null,2));return}console.log(u4(V.report)),console.log(""),console.log(k8(V));return}if($.flags.runtime){let{resolve:U}=await import("path"),V=U(Q);if($.positional[0]==="init"){let O=await s8({skillPath:V});if($.flags.machine)q?.(),console.log(d("eval",{action:"scaffold",ok:O.ok,exit_code:O.exitCode,message:O.message},Z)),process.exit(O.ok?0:1);if($.flags.json)console.log(JSON.stringify(O,null,2)),process.exit(O.ok?0:1);if(O.ok)console.log(O.message);else w(O.message);process.exit(O.ok?0:1)}if($.flags.provider!==null&&$.flags.provider!=="docker"&&$.flags.provider!=="local")w(`Invalid --provider for --runtime: "${$.flags.provider}". Must be docker or local.`),process.exit(2);if($.flags.preset!==null&&$.flags.preset!=="smoke"&&$.flags.preset!=="reliable"&&$.flags.preset!=="regression")w(`Invalid --preset: "${$.flags.preset}". Must be smoke, reliable, or regression.`),process.exit(2);rq();let H=v$("skillgrade","^1.0.0"),B={skillPath:V,skillMdPath:U(V,"SKILL.md")},_={};try{let O=await a4(),A=O.providers.skillgrade;if(A){if(typeof A.preset==="string")_.preset=A.preset;if(typeof A.threshold==="number")_.threshold=A.threshold;if(A.provider==="docker"||A.provider==="local")_.provider=A.provider}let M=O.defaults.timeoutMs;if(typeof M==="number"&&M>0)_.timeoutMs=M}catch(O){throw Error(`failed to load ~/.asm/config.yml: ${O?.message??String(O)}`)}if($.flags.preset)_.preset=$.flags.preset;if($.flags.provider)_.provider=$.flags.provider;if($.flags.threshold!==null)_.threshold=$.flags.threshold;let L=await H.applicable(B,_);if(!L.ok){if($.flags.machine)q?.(),console.log(s("eval",a.INVALID_ARGUMENT,L.reason??"skillgrade provider not applicable",Z)),process.exit(1);w(L.reason??"skillgrade provider not applicable"),process.exit(1)}let K=await h$(H,B,_);if($.flags.machine)q?.(),console.log(d("eval",{provider_id:K.providerId,provider_version:K.providerVersion,schema_version:K.schemaVersion,score:K.score,passed:K.passed,categories:K.categories,findings:K.findings},Z)),process.exit(K.passed?0:1);if($.flags.json)console.log(JSON.stringify(K,null,2)),process.exit(K.passed?0:1);let F=K.passed?W.green("PASS"):W.red("FAIL");if(console.log(`${W.bold("Skillgrade runtime:")} ${F} score=${K.score}/100`),K.categories.length>0){console.log(""),console.log(W.bold("Tasks:"));for(let O of K.categories)console.log(` ${O.name}: ${O.score}/${O.max} (${O.id})`)}if(K.findings.length>0){console.log(""),console.log(W.bold("Findings:"));for(let O of K.findings){let A=O.severity==="error"?W.red(O.severity):O.severity==="warning"?W.yellow(O.severity):W.dim(O.severity);console.log(` [${A}] ${O.message}`)}}process.exit(K.passed?0:1)}rq();let X=v$("quality","^1.0.0"),{resolve:z}=await import("path"),J=z(Q),G=await h$(X,{skillPath:J,skillMdPath:z(J,"SKILL.md")});OB(G);let Y=G.raw;if($.flags.machine){q?.(),console.log(d("eval",m4(Y,null),Z));return}if($.flags.json){console.log(y8(Y));return}console.log(u4(Y))}catch(X){if($.flags.machine)q?.(),console.log(s("eval",a.SKILL_NOT_FOUND,X?.message??String(X),Z)),process.exit(1);w(X?.message??String(X)),process.exit(1)}}function IB(){console.log(`${W.bold("Usage:")} asm eval-providers <subcommand> [options]
|
|
675
|
+
|
|
676
|
+
Manage evaluation providers registered with the ${W.bold("asm eval")} framework.
|
|
677
|
+
Providers implement the ${W.bold("EvalProvider")} contract (see src/eval/types.ts) and
|
|
678
|
+
are resolved by id and semver range.
|
|
679
|
+
|
|
680
|
+
${W.bold("Subcommands:")}
|
|
681
|
+
list List every registered (id, version) provider
|
|
682
|
+
|
|
683
|
+
${W.bold("Options:")}
|
|
684
|
+
--json Output as JSON (list)
|
|
685
|
+
--no-color Disable ANSI colors
|
|
686
|
+
-V, --verbose Show debug output
|
|
687
|
+
|
|
688
|
+
${W.bold("Examples:")}
|
|
689
|
+
asm eval-providers list ${W.dim("Show registered providers")}
|
|
690
|
+
asm eval-providers list --json ${W.dim("Machine-readable listing")}`)}async function TB($){if($.flags.help){IB();return}let q=$.subcommand;if(!q)w("Missing subcommand. Use: list"),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2);switch(q){case"list":{rq();let Z=v8();if($.flags.json){console.log(l(Z.map((G)=>({id:G.id,version:G.version,schemaVersion:G.schemaVersion,description:G.description,requires:G.requires??[]}))));return}if(Z.length===0){console.log("No eval providers registered.");return}let Q=["id","version","schemaVersion","description","requires"],X=Z.map((G)=>[G.id,G.version,String(G.schemaVersion),G.description,G.requires&&G.requires.length>0?G.requires.join(","):"-"]),z=Q.map((G,Y)=>Math.max(G.length,...X.map((U)=>U[Y].length))),J=(G)=>G.map((Y,U)=>Y.padEnd(z[U])).join(" ");console.log(W.bold(J(Q))),console.log(z.map((G)=>"-".repeat(G)).join(" "));for(let G of X)console.log(J(G));return}default:w(`Unknown eval-providers subcommand: "${q}". Use: list`),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2)}}function MB(){console.log(`${W.bold("Usage:")} asm link <path> [<path2> ...] [options]
|
|
604
691
|
|
|
605
692
|
Symlink a local skill directory into an agent's skill folder. Useful
|
|
606
693
|
for local development — changes to the source are reflected immediately.
|
|
@@ -611,7 +698,7 @@ files, all discovered skills are linked in a single invocation.
|
|
|
611
698
|
|
|
612
699
|
Multiple paths can be provided to link several skills at once.
|
|
613
700
|
|
|
614
|
-
${
|
|
701
|
+
${W.bold("Options:")}
|
|
615
702
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
616
703
|
--name <name> Override symlink name (single skill only)
|
|
617
704
|
-f, --force Overwrite if target already exists
|
|
@@ -619,28 +706,28 @@ ${U.bold("Options:")}
|
|
|
619
706
|
--no-color Disable ANSI colors
|
|
620
707
|
-V, --verbose Show debug output
|
|
621
708
|
|
|
622
|
-
${
|
|
623
|
-
asm link ./my-skill ${
|
|
624
|
-
asm link ./my-skill -p claude ${
|
|
625
|
-
asm link ./my-skill --name alias ${
|
|
626
|
-
asm link ./my-skills-folder ${
|
|
627
|
-
asm link ./skill1 ./skill2 ./skill3 -p claude ${
|
|
628
|
-
${
|
|
629
|
-
${
|
|
630
|
-
Done! Linked ${
|
|
631
|
-
${
|
|
632
|
-
${
|
|
633
|
-
Done! Linked ${
|
|
709
|
+
${W.bold("Examples:")}
|
|
710
|
+
asm link ./my-skill ${W.dim("Link (interactive tool)")}
|
|
711
|
+
asm link ./my-skill -p claude ${W.dim("Link to Claude Code")}
|
|
712
|
+
asm link ./my-skill --name alias ${W.dim("Link with custom name")}
|
|
713
|
+
asm link ./my-skills-folder ${W.dim("Link all skills in folder")}
|
|
714
|
+
asm link ./skill1 ./skill2 ./skill3 -p claude ${W.dim("Link multiple skills at once")}`)}async function jB($,q){if(q)return!0;let{access:Z}=await import("fs/promises"),Q=!1;try{await Z($),Q=!0}catch{}if(!Q)return!1;if(!process.stdin.isTTY)throw Error(`Target already exists: ${$}. Use --force to overwrite.`);process.stderr.write(`${W.yellow(`Target already exists: ${$}`)}
|
|
715
|
+
${W.bold("Overwrite?")} [y/N] `);let X=await q0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0);return!0}async function tq($,q,Z,Q){let{join:X}=await import("path"),z=X(q,Z),J=await jB(z,Q);return await o5($,q,Z,J),{name:Z,symlinkPath:z,targetPath:$}}async function NB($){if($.flags.help){MB();return}let q=[];if($.subcommand)q.push($.subcommand);if(q.push(...$.positional),q.length===0)w("Missing required argument: <path>"),console.error('Run "asm link --help" for usage.'),process.exit(2);if(q.length>1){if($.flags.name)w("--name cannot be used when linking multiple paths. Link each skill individually to use --name."),process.exit(2);let L=await v(),{provider:K}=await i0(L,$.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:F}=await import("./chunk-a26gjzjk.js"),O=F(L.providers.find((D)=>D.name===K.name).global),{resolve:A,basename:M}=await import("path"),N=[],T=[];for(let D of q){let x=A(D),P=!1;try{await j4(x),P=!0}catch{}if(P){let k=M(x);try{let I=await tq(x,O,k,!!$.flags.force);if(N.push(I),!$.flags.json)console.error(W.green(` Linked "${I.name}" -> ${I.targetPath}`))}catch(I){let j=I instanceof Error?I.message:String(I);if(T.push({name:k,error:j}),!$.flags.json)console.error(W.red(` Failed to link "${k}": ${j}`))}}else{let k=[];try{k=await N4(x)}catch(I){let j=I instanceof Error?I.message:String(I);if(T.push({name:D,error:j}),!$.flags.json)console.error(W.red(` Failed to process "${D}": ${j}`));continue}if(k.length===0){let I=`No SKILL.md found in ${x} or its immediate subdirectories.`;if(T.push({name:D,error:I}),!$.flags.json)console.error(W.red(` ${I}`));continue}for(let I of k)try{let j=await tq(I.absPath,O,I.dirName,!!$.flags.force);if(N.push(j),!$.flags.json)console.error(W.green(` Linked "${j.name}" -> ${j.targetPath}`))}catch(j){let C=j instanceof Error?j.message:String(j);if(T.push({name:I.name,error:C}),!$.flags.json)console.error(W.red(` Failed to link "${I.name}": ${C}`))}}}if($.flags.json)console.log(l({success:T.length===0,linked:N,failures:T}));else if(T.length>0)console.error(W.yellow(`
|
|
716
|
+
${N.length} linked, ${T.length} failed.`));else console.error(W.green(`
|
|
717
|
+
Done! Linked ${N.length} skill(s) successfully.`));if(T.length>0)process.exit(1);return}let Z=q[0],{resolve:Q,basename:X}=await import("path"),z=Q(Z),J=!1;try{await j4(z),J=!0}catch{}let G=[];if(!J){if(G=await N4(z),G.length===0)w(`No SKILL.md found in ${z} or its immediate subdirectories.`),process.exit(1);if($.flags.name&&G.length>1)w(`--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:U}=await i0(Y,$.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:V}=await import("./chunk-a26gjzjk.js"),H=V(Y.providers.find((L)=>L.name===U.name).global);if(J){let L=$.flags.name?w0($.flags.name):X(z),K;try{K=await tq(z,H,L,!!$.flags.force)}catch(F){let O=F instanceof Error?F.message:String(F);if($.flags.json)console.log(l({success:!1,error:O}));else w(O);process.exit(2)}if($.flags.json)console.log(l({success:!0,...K}));else console.error(W.green(`Done! Linked "${K.name}" -> ${K.targetPath}`)),console.error(` Symlink: ${K.symlinkPath}`),console.error(W.dim(` If you move or delete the source, run "asm uninstall ${K.name}" to clean up.`));return}console.error(`Found ${W.bold(String(G.length))} skill(s) in ${z}:`);for(let L of G)console.error(` ${W.bold(L.name)} ${W.dim(`v${L.version}`)} ${W.dim(`(${L.dirName}/)`)}`);if(process.stdin.isTTY&&!$.flags.force){process.stderr.write(`
|
|
718
|
+
${W.bold(`Link ${G.length} skill(s)?`)} [Y/n] `);let L=await q0();if(L.toLowerCase()==="n"||L.toLowerCase()==="no")console.error("Aborted."),process.exit(0)}let B=[],_=[];for(let L of G){let K=$.flags.name&&G.length===1?w0($.flags.name):L.dirName;try{let F=await tq(L.absPath,H,K,!!$.flags.force);if(B.push(F),!$.flags.json)console.error(W.green(` Linked "${F.name}" -> ${F.targetPath}`))}catch(F){let O=F instanceof Error?F.message:String(F);if(_.push({name:L.name,error:O}),!$.flags.json)console.error(W.red(` Failed to link "${L.name}": ${O}`))}}if($.flags.json)console.log(l({success:_.length===0,linked:B,failures:_}));else if(_.length>0)console.error(W.yellow(`
|
|
719
|
+
${B.length} linked, ${_.length} failed.`));else console.error(W.green(`
|
|
720
|
+
Done! Linked ${B.length} skill(s) successfully.`));if(_.length>0)process.exit(1)}function DB(){console.log(`${W.bold("Usage:")} asm index <subcommand> [options]
|
|
634
721
|
|
|
635
722
|
Manage the skill index for searching available skills from indexed repos.
|
|
636
723
|
|
|
637
|
-
${
|
|
724
|
+
${W.bold("Subcommands:")}
|
|
638
725
|
ingest <repo> Ingest a skill repository into the index
|
|
639
726
|
search <query> Search indexed skills by name or description
|
|
640
727
|
list List all indexed repositories
|
|
641
728
|
remove <owner/repo> Remove a repo from the index
|
|
642
729
|
|
|
643
|
-
${
|
|
730
|
+
${W.bold("Options:")}
|
|
644
731
|
--json Output as JSON
|
|
645
732
|
--has <field> Only show skills that have <field> (license, creator, version)
|
|
646
733
|
--missing <field> Only show skills missing <field> (license, creator, version)
|
|
@@ -648,49 +735,49 @@ ${U.bold("Options:")}
|
|
|
648
735
|
--no-color Disable ANSI colors
|
|
649
736
|
-V, --verbose Show debug output
|
|
650
737
|
|
|
651
|
-
${
|
|
652
|
-
asm index ingest github:obra/superpowers ${
|
|
653
|
-
asm index search code review ${
|
|
654
|
-
asm index search marketing --has license ${
|
|
655
|
-
asm index search "" --missing creator ${
|
|
656
|
-
asm index list ${
|
|
657
|
-
asm index remove obra/superpowers ${
|
|
658
|
-
`));for(let J of z){let G=J.skill.verified?
|
|
659
|
-
`)}}break}case"list":{let Z=await
|
|
660
|
-
`));for(let X of Z)console.error(`${
|
|
738
|
+
${W.bold("Examples:")}
|
|
739
|
+
asm index ingest github:obra/superpowers ${W.dim("Index superpowers repo")}
|
|
740
|
+
asm index search code review ${W.dim("Search for skills")}
|
|
741
|
+
asm index search marketing --has license ${W.dim("Only with license")}
|
|
742
|
+
asm index search "" --missing creator ${W.dim("Skills missing creator")}
|
|
743
|
+
asm index list ${W.dim("List indexed repos")}
|
|
744
|
+
asm index remove obra/superpowers ${W.dim("Remove from index")}`)}async function RB($){if($.flags.help){DB();return}let q=$.subcommand;if(!q)w("Missing subcommand. Use: ingest, search, list, or remove"),console.error('Run "asm index --help" for usage.'),process.exit(2);switch(q){case"ingest":{let Z=$.positional[0];if(!Z)w("Missing required argument: <repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);console.error(W.blueBold(`Ingesting ${Z}...`));let Q=await HZ(Z);if(!Q.success)w(`Failed to ingest: ${Q.error}`),process.exit(1);if(Q.repoIndex)if($.flags.json)console.log(l({success:!0,owner:Q.repoIndex.owner,repo:Q.repoIndex.repo,skillCount:Q.repoIndex.skillCount,updatedAt:Q.repoIndex.updatedAt}));else console.error(W.green(`Successfully indexed ${Q.repoIndex.owner}/${Q.repoIndex.repo}`)),console.error(` Skills found: ${Q.repoIndex.skillCount}`);break}case"search":{let Z=$.positional.join(" ");if(!Z&&$.flags.has.length===0&&$.flags.missing.length===0)w("Missing required argument: <query>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let Q={};if($.flags.has.length>0)Q.has=$.flags.has;if($.flags.missing.length>0)Q.missing=$.flags.missing;let z=Q.has||Q.missing?await sq(Z||"",20,Q):await sq(Z);if(z.length===0){if($.flags.json)console.log(l([]));else console.info("No skills found matching your query."),console.error(W.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if($.flags.json)console.log(l(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(W.bold(`Found ${z.length} skills:
|
|
745
|
+
`));for(let J of z){let G=J.skill.verified?W.blue(" [verified]"):"";console.error(`${W.cyan(J.skill.name)} ${W.dim(`v${J.skill.version}`)}${G} ${W.dim(`[${J.repo.owner}/${J.repo.repo}]`)}`);for(let U of PZ(J.skill.description,80))console.error(` ${U}`);let Y=YZ(J.skill);if(Y.length>0)console.error(` ${W.yellow(`⚠ Missing: ${Y.join(", ")}`)}`);console.error(` ${W.green(`asm install ${J.skill.installUrl}`)}
|
|
746
|
+
`)}}break}case"list":{let Z=await VZ();if(Z.length===0){if($.flags.json)console.log(l([]));else console.info("No repositories indexed."),console.error(W.dim("Add repos with: asm index ingest <repo>"));return}let Q=await UZ();if($.flags.json)console.log(l(Z));else{console.error(W.bold(`Indexed Repositories (${Q} total skills):
|
|
747
|
+
`));for(let X of Z)console.error(`${W.cyan(`${X.owner}/${X.repo}`)} - ${X.skillCount} skills ${W.dim(`(${new Date(X.updatedAt).toLocaleDateString()})`)}`)}break}case"remove":{let Z=$.positional[0];if(!Z)w("Missing required argument: <owner/repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let[Q,X]=Z.split("/");if(!Q||!X)w("Invalid format. Use: <owner/repo>"),process.exit(2);if(!$.flags.yes&&process.stdin.isTTY){process.stderr.write(`${W.bold("Remove")} ${W.cyan(`${Q}/${X}`)} ${W.bold("from index?")} [y/N] `);let J=await q0();if(J.toLowerCase()!=="y"&&J.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}if(await BZ(Q,X))console.error(W.green(`Removed ${Q}/${X} from index`));else w(`Repository not found in index: ${Q}/${X}`),process.exit(1);break}default:w(`Unknown subcommand: "${q}"`),console.error('Run "asm index --help" for usage.'),process.exit(2)}}function wB(){console.log(`${W.bold("Usage:")} asm bundle <subcommand> [options]
|
|
661
748
|
|
|
662
749
|
Create, install, and manage curated skill bundles. A bundle is a reusable
|
|
663
750
|
recipe of skills for a particular workflow, domain, or project setup.
|
|
664
751
|
|
|
665
|
-
${
|
|
752
|
+
${W.bold("Subcommands:")}
|
|
666
753
|
create <name> Create a new bundle from installed skills
|
|
667
754
|
install <name|file> Install all skills from a bundle
|
|
668
755
|
list List all saved bundles
|
|
669
756
|
show <name|file> Show bundle details
|
|
670
757
|
remove <name> Remove a saved bundle
|
|
671
758
|
|
|
672
|
-
${
|
|
759
|
+
${W.bold("Options:")}
|
|
673
760
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
674
761
|
-y, --yes Skip confirmation prompts
|
|
675
762
|
--json Output as JSON
|
|
676
763
|
--no-color Disable ANSI colors
|
|
677
764
|
-V, --verbose Show debug output
|
|
678
765
|
|
|
679
|
-
${
|
|
680
|
-
asm bundle create my-workflow ${
|
|
681
|
-
asm bundle install my-workflow ${
|
|
682
|
-
asm bundle install ./bundle.json ${
|
|
683
|
-
asm bundle list ${
|
|
684
|
-
asm bundle list --json ${
|
|
685
|
-
asm bundle show my-workflow ${
|
|
686
|
-
asm bundle remove my-workflow ${
|
|
687
|
-
`));let
|
|
688
|
-
${
|
|
689
|
-
${
|
|
690
|
-
Installing ${
|
|
691
|
-
`));for(let Q of Z){let X=Q.tags&&Q.tags.length>0?` ${
|
|
692
|
-
${
|
|
693
|
-
`)),console.log(JSON.stringify(X.manifest,null,2));return}if(X.prUrl)console.error(
|
|
766
|
+
${W.bold("Examples:")}
|
|
767
|
+
asm bundle create my-workflow ${W.dim("Create from installed skills")}
|
|
768
|
+
asm bundle install my-workflow ${W.dim("Install a saved bundle")}
|
|
769
|
+
asm bundle install ./bundle.json ${W.dim("Install from file")}
|
|
770
|
+
asm bundle list ${W.dim("Show all saved bundles")}
|
|
771
|
+
asm bundle list --json ${W.dim("List bundles as JSON")}
|
|
772
|
+
asm bundle show my-workflow ${W.dim("Show bundle details")}
|
|
773
|
+
asm bundle remove my-workflow ${W.dim("Remove a saved bundle")}`)}async function PB($){if($.flags.help){wB();return}let q=$.subcommand;if(!q)w("Missing subcommand. Use: create, install, list, show, or remove"),console.error('Run "asm bundle --help" for usage.'),process.exit(2);switch(q){case"create":{let Z=$.positional[0];if(!Z)w("Missing required argument: <name>"),console.error("Usage: asm bundle create <name>"),process.exit(2);let Q=await v(),X=await i(Q,$.flags.scope);if(X.length===0)w("No skills found to include in the bundle."),process.exit(1);let z=new Set,J=X.filter((K)=>{let F=K.name.toLowerCase();if(z.has(F))return!1;return z.add(F),!0}),G=J;if(process.stdin.isTTY&&!$.flags.yes){let K=J.map((O)=>({label:`${O.name} v${O.version}`,hint:O.description?O.description.slice(0,60)+(O.description.length>60?"...":""):`(${O.provider}/${O.scope})`,checked:!0}));console.error(W.bold(`Select skills for bundle "${Z}":
|
|
774
|
+
`));let F=await d0({items:K});if(F.length===0)w("No skills selected. Bundle not created."),process.exit(1);G=F.map((O)=>J[O])}let{readLock:Y}=await import("./chunk-1becp2v6.js"),U=await Y(),V=await Promise.all(G.map((K)=>s5(K,U))),H=`Bundle of ${V.length} skills`,B="unknown";try{let{execSync:K}=await import("child_process"),F=K("git config user.name",{encoding:"utf-8"}).trim();if(F)B=F}catch{}if(process.stdin.isTTY&&!$.flags.yes){process.stderr.write(`
|
|
775
|
+
${W.bold("Description")} (optional, press Enter to skip): `);let K=await q0();if(K.trim())H=K.trim();process.stderr.write(`${W.bold("Author")} (optional, press Enter to skip): `);let F=await q0();if(F.trim())B=F.trim()}let _=a5(Z,H,B,V),L=await t5(_);if($.flags.json)console.log(JSON.stringify(_,null,2));else console.error(W.green(`Bundle "${Z}" created with ${V.length} skill(s).`)),console.error(` Saved to: ${W.dim(L)}`);break}case"install":{let Z=$.positional[0];if(!Z)w("Missing required argument: <name|file>"),console.error("Usage: asm bundle install <name|file>"),process.exit(2);let Q;try{Q=await w4(Z)}catch(H){w(H.message),process.exit(1)}if(console.error(`${W.bold("Bundle:")} ${Q.name} (${Q.skills.length} skills)`),Q.description)console.error(` ${W.dim(Q.description)}`);console.error("");for(let H of Q.skills){let B=H.version?` v${H.version}`:"";console.error(` ${W.cyan(H.name)}${W.dim(B)} ${W.dim(`-> ${H.installUrl}`)}`)}if(!$.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
776
|
+
${W.bold("Install all skills from this bundle?")} [y/N] `);let H=await q0();if(H.toLowerCase()!=="y"&&H.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let X=[],z=await v(),{provider:J}=await i0(z,$.flags.provider,!1),G=$.flags.scope==="global"||$.flags.scope==="project"?$.flags.scope:"global";for(let H of Q.skills){console.error(`
|
|
777
|
+
Installing ${W.bold(H.name)}...`);try{if(H.installUrl.startsWith("github:")||H.installUrl.startsWith("https://github.com/"))await l0();let _=c0(H.installUrl),L=!!_.isLocal,K=null;try{let F,O;if(!L)K=await n0(_,$.flags.transport),F=K,O=_.subpath?xV(K,_.subpath):K;else F=_.localPath,O=_.localPath;let A=await P0(O),M=w0(H.name||A.name||_.repo),N=z9(_,F,O,M,J,$.flags.force,G);try{await A2(N.targetDir,N.force)}catch(T){if(T.message?.includes("--force")){X.push({name:H.name,status:"skipped",reason:"Already installed. Use --force to overwrite."}),console.error(` ${W.dim("---")} ${H.name} skipped (already installed)`);continue}throw T}await a$(N),X.push({name:H.name,status:"installed"}),console.error(` ${W.green("+++")} ${H.name} installed`)}finally{if(K)await Q0(K)}}catch(B){X.push({name:H.name,status:"failed",reason:B.message}),console.error(` ${W.red("!!!")} ${H.name}: ${B.message}`)}}let Y=X.filter((H)=>H.status==="installed").length,U=X.filter((H)=>H.status==="skipped").length,V=X.filter((H)=>H.status==="failed").length;if($.flags.json)console.log(JSON.stringify({bundleName:Q.name,total:X.length,installed:Y,skipped:U,failed:V,results:X},null,2));else console.error(""),console.error(`${W.bold("Summary:")} ${X.length} total, ${W.green(String(Y))} installed, `+(U>0?`${W.dim(String(U))} skipped, `:"")+`${W.red(String(V))} failed`);if(V>0)process.exitCode=1;break}case"list":{let Z=await r5();if(Z.length===0){if($.flags.json)console.log("[]");else console.log("No bundles found."),console.error(W.dim("Create one with: asm bundle create <name>"));return}if($.flags.json)console.log(JSON.stringify(Z,null,2));else{console.error(W.bold(`Saved Bundles (${Z.length}):
|
|
778
|
+
`));for(let Q of Z){let X=Q.tags&&Q.tags.length>0?` ${W.dim(`[${Q.tags.join(", ")}]`)}`:"";if(console.error(` ${W.cyan(Q.name)} ${W.dim(`(${Q.skills.length} skills)`)}${X}`),Q.description)console.error(` ${W.dim(Q.description)}`);if(Q.author)console.error(` ${W.dim(`by ${Q.author}`)}`)}}break}case"show":{let Z=$.positional[0];if(!Z)w("Missing required argument: <name|file>"),console.error("Usage: asm bundle show <name|file>"),process.exit(2);let Q;try{Q=await w4(Z)}catch(X){w(X.message),process.exit(1)}if($.flags.json)console.log(JSON.stringify(Q,null,2));else{if(console.error(W.bold(`Bundle: ${Q.name}`)),Q.description)console.error(` ${Q.description}`);if(Q.author)console.error(` ${W.dim(`Author: ${Q.author}`)}`);if(console.error(` ${W.dim(`Created: ${new Date(Q.createdAt).toLocaleString()}`)}`),Q.tags&&Q.tags.length>0)console.error(` ${W.dim(`Tags: ${Q.tags.join(", ")}`)}`);console.error(`
|
|
779
|
+
${W.bold(`Skills (${Q.skills.length})`)}:`);for(let X of Q.skills){let z=X.version?` v${X.version}`:"";if(console.error(` ${W.cyan(X.name)}${W.dim(z)}`),X.description)console.error(` ${W.dim(X.description)}`);console.error(` ${W.dim(`install: ${X.installUrl}`)}`)}}break}case"remove":{let Z=$.positional[0];if(!Z)w("Missing required argument: <name>"),console.error("Usage: asm bundle remove <name>"),process.exit(2);if(!$.flags.yes&&process.stdin.isTTY){process.stderr.write(`${W.bold("Remove bundle")} ${W.cyan(Z)}${W.bold("?")} [y/N] `);let X=await q0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Q;try{Q=await e5(Z)}catch(X){w(X.message),process.exit(1)}if(Q)console.error(W.green(`Bundle "${Z}" removed.`));else w(`Bundle "${Z}" not found.`),process.exit(1);break}default:w(`Unknown subcommand: "${q}". Use: create, install, list, show, or remove`),console.error('Run "asm bundle --help" for usage.'),process.exit(2)}}async function CB($){if($.flags.help){pV();return}let q=$.flags.machine?u0():void 0,Z=performance.now(),Q=$.subcommand||".";try{let X=await z8({path:Q,dryRun:$.flags.dryRun,force:$.flags.force,yes:$.flags.yes});if($.flags.machine){if(q?.(),!X.success)console.log(s("publish",a.PUBLISH_FAILED,X.error||"Publish failed",Z,{manifest:X.manifest,security_verdict:X.securityVerdict,fallback:X.fallback??!1})),process.exit(1);console.log(d("publish",{manifest:X.manifest,pr_url:X.prUrl,status:X.securityVerdict},Z));return}if($.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)w(X.error||"Publish failed."),process.exit(1);if(X.fallback){console.log(W.yellow("Manifest generated (gh CLI unavailable):")),console.log(J8(X));return}if($.flags.dryRun){console.error(W.dim(`Dry run — no PR created.
|
|
780
|
+
`)),console.log(JSON.stringify(X.manifest,null,2));return}if(X.prUrl)console.error(W.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(W.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($.flags.machine)q?.(),console.log(s("publish",a.PUBLISH_FAILED,X.message,Z)),process.exit(1);if($.flags.json)console.log(JSON.stringify({success:!1,manifest:null,pr_url:null,error:X.message,security_verdict:null},null,2)),process.exit(1);w(X.message),process.exit(1)}}async function EB($){if($.flags.help){dV();return}let q=$.flags.machine?u0():void 0,Z=performance.now();try{let Q=await x4();if($.flags.machine){q?.();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(d("outdated",z,Z));return}if($.flags.json){console.log(B8(Q));return}let X=!$.flags.noColor&&process.stdout.isTTY!==!1;if(console.log(V8(Q,X)),Q.outdatedCount>0)process.exitCode=1}catch(Q){if($.flags.machine)q?.(),console.log(s("outdated",a.UNKNOWN_ERROR,Q.message,Z)),process.exit(1);w(Q.message),process.exit(1)}}async function SB($){if($.flags.help){cV();return}let q=$.flags.machine?u0():void 0,Z=performance.now(),Q=[];if($.subcommand)Q.push($.subcommand);Q.push(...$.positional);try{let X=await H8(Q.length>0?Q:null,$.flags.yes);if($.flags.machine){q?.();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(d("update",J,Z));return}if($.flags.json){console.log(K8(X));return}if(X.results.length>0)console.error(W.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(W.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(`${W.green("✓")} ${J.name} ${W.dim(J.oldCommit||"")} → ${J.newCommit||""}`),J.securityVerdict==="warning")console.error(W.yellow(` ⚠ Security audit returned warning for ${J.name} — updated because --yes was supplied`));break;case"skipped":console.log(`${W.yellow("○")} ${J.name} ${W.dim(J.reason||"skipped")}`);break;case"failed":console.log(`${W.red("✗")} ${J.name} ${W.dim(J.reason||"failed")}`);break}console.log("");let z=[];if(X.updatedCount>0)z.push(W.green(`${X.updatedCount} updated`));if(X.skippedCount>0)z.push(W.yellow(`${X.skippedCount} skipped`));if(X.failedCount>0)z.push(W.red(`${X.failedCount} failed`));if(console.log(z.join(", ")),X.failedCount>0)process.exitCode=1}catch(X){if($.flags.machine)q?.(),console.log(s("update",a.UNKNOWN_ERROR,X.message,Z)),process.exit(1);w(X.message),process.exit(1)}}async function fZ($){let q=kV($);if(q.flags.json&&q.flags.machine)w("--json and --machine are mutually exclusive. Use one or the other."),process.exit(2);if(q.flags.machine)q.flags.yes=!0;if(q.flags.noColor)globalThis.__CLI_NO_COLOR=!0;if(q.flags.verbose)_Z(!0);if(q.flags.version){console.log(`asm ${Z2}`);return}if(!q.command&&q.flags.help){fV();return}if(!q.command)return;switch(q.command){case"list":await nV(q);break;case"search":await iV(q);break;case"inspect":await oV(q);break;case"uninstall":await aV(q);break;case"audit":await sV(q);break;case"install":await JB(q);break;case"config":await qB(q);break;case"export":await YB(q);break;case"import":await WB(q);break;case"init":await VB(q);break;case"stats":await KB(q);break;case"link":await NB(q);break;case"index":await RB(q);break;case"bundle":await PB(q);break;case"publish":await CB(q);break;case"outdated":await EB(q);break;case"update":await SB(q);break;case"doctor":await LB(q);break;case"eval":await AB(q);break;case"eval-providers":await TB(q);break;default:w(`Unknown command: "${q.command}"`),console.error('Run "asm --help" for usage.'),process.exit(2)}}function hZ($){let q=$.slice(2);if(q.length===0)return!1;let Z=["list","search","inspect","uninstall","audit","config","install","export","import","init","stats","link","index","bundle","publish","outdated","update","doctor","eval","eval-providers"],Q=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(hZ(process.argv))await fZ(process.argv);else if(!(typeof globalThis.Bun<"u")){let{spawn:q}=await import("child_process"),Z=q("bun",[process.argv[1],...process.argv.slice(2)],{stdio:"inherit"});Z.on("error",()=>{console.error(`The interactive TUI requires Bun (https://bun.sh).
|
|
694
781
|
Install it with: curl -fsSL https://bun.sh/install | bash
|
|
695
782
|
|
|
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-
|
|
783
|
+
`+"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-4qbqrrmk.js");
|