agent-skill-manager 2.1.0 → 2.2.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 +1 -1
- package/data/skill-index/Affitor_affiliate-skills.json +2757 -54
- package/data/skill-index/Eronred_aso-skills.json +1561 -31
- package/data/skill-index/GPTomics_bioSkills.json +22829 -440
- package/data/skill-index/Galaxy-Dawn_claude-scholar.json +2497 -49
- package/data/skill-index/Imbad0202_academic-research-skills.json +209 -5
- package/data/skill-index/K-Dense-AI_claude-scientific-skills.json +6969 -135
- package/data/skill-index/Leonxlnx_taste-skill.json +417 -9
- package/data/skill-index/Master-cai_Research-Paper-Writing-Skills.json +53 -2
- package/data/skill-index/MiniMax-AI_skills.json +1197 -24
- package/data/skill-index/affaan-m_everything-claude-code.json +23869 -460
- package/data/skill-index/alirezarezvani_claude-skills.json +26417 -509
- package/data/skill-index/anthropics_skills.json +937 -19
- package/data/skill-index/bytedance_deer-flow.json +1145 -23
- package/data/skill-index/coreyhaines31_marketingskills.json +1873 -37
- package/data/skill-index/github_awesome-copilot.json +22933 -442
- package/data/skill-index/heygen-com_hyperframes.json +261 -6
- package/data/skill-index/himself65_finance-skills.json +1093 -22
- package/data/skill-index/kemiljk_fluid-design.json +53 -2
- package/data/skill-index/kepano_obsidian-skills.json +261 -6
- package/data/skill-index/luongnv89_skills.json +1873 -37
- package/data/skill-index/mattpocock_skills.json +1093 -22
- package/data/skill-index/nextlevelbuilder_ui-ux-pro-max-skill.json +365 -8
- package/data/skill-index/obra_superpowers.json +729 -15
- package/data/skill-index/sickn33_antigravity-awesome-skills.json +230777 -4439
- package/data/skill-index/slavingia_skills.json +521 -11
- package/dist/agent-skill-manager.js +161 -161
- package/dist/chunk-796ss41d.js +15 -0
- package/dist/{chunk-1becp2v6.js → chunk-d61nf7gg.js} +1 -1
- package/dist/{chunk-a26gjzjk.js → chunk-vgzgtfy6.js} +1 -1
- package/dist/{chunk-x537ndd4.js → chunk-y89teqgt.js} +43 -42
- package/package.json +1 -1
- package/dist/chunk-6mbpytcj.js +0 -15
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as k0,b as bq,c as
|
|
3
|
-
`)}}t.defaultYaml={explicit:!1,version:"1.2"};t.defaultTags={"!!":"tag:yaml.org,2002:"};
|
|
4
|
-
`)?
|
|
2
|
+
import{a as k0,b as bq,c as YZ,d as UZ}from"./chunk-d61nf7gg.js";import{B as JZ,C as GZ,D as c,E as d9,F as HZ,H as WZ,I as VZ,J as f8,K as c9,L as BZ,e as s,f as z0,g as q4,h as cq,k as a,l as t8,m as u9,n as r8,o as e8,p as m9,q as qZ,r as U,s as $Z,t as b5,u as ZZ,v as p9,w as QZ,x as XZ,y as zZ}from"./chunk-796ss41d.js";import{M as g,N,O as v,P as o8,Q as E,R as i8,S as xq,T as z8,U as kq,V as u8,W as X0,X as h,Y as s8}from"./chunk-vgzgtfy6.js";var k=N((rZ)=>{var $2=Symbol.for("yaml.alias"),Y4=Symbol.for("yaml.document"),aq=Symbol.for("yaml.map"),U4=Symbol.for("yaml.pair"),Z2=Symbol.for("yaml.scalar"),oq=Symbol.for("yaml.seq"),B0=Symbol.for("yaml.node.type"),lZ=(q)=>!!q&&typeof q==="object"&&q[B0]===$2,nZ=(q)=>!!q&&typeof q==="object"&&q[B0]===Y4,aZ=(q)=>!!q&&typeof q==="object"&&q[B0]===aq,oZ=(q)=>!!q&&typeof q==="object"&&q[B0]===U4,H4=(q)=>!!q&&typeof q==="object"&&q[B0]===Z2,iZ=(q)=>!!q&&typeof q==="object"&&q[B0]===oq;function W4(q){if(q&&typeof q==="object")switch(q[B0]){case aq:case oq:return!0}return!1}function sZ(q){if(q&&typeof q==="object")switch(q[B0]){case $2:case aq:case Z2:case oq:return!0}return!1}var tZ=(q)=>(H4(q)||W4(q))&&!!q.anchor;rZ.ALIAS=$2;rZ.DOC=Y4;rZ.MAP=aq;rZ.NODE_TYPE=B0;rZ.PAIR=U4;rZ.SCALAR=Z2;rZ.SEQ=oq;rZ.hasAnchor=tZ;rZ.isAlias=lZ;rZ.isCollection=W4;rZ.isDocument=nZ;rZ.isMap=aZ;rZ.isNode=sZ;rZ.isPair=oZ;rZ.isScalar=H4;rZ.isSeq=iZ});var Gq=N((_6)=>{var m=k(),n=Symbol("break visit"),V4=Symbol("skip children"),Y0=Symbol("remove node");function iq(q,$){let Z=B4($);if(m.isDocument(q)){if(a0(null,q.contents,Z,Object.freeze([q]))===Y0)q.contents=null}else a0(null,q,Z,Object.freeze([]))}iq.BREAK=n;iq.SKIP=V4;iq.REMOVE=Y0;function a0(q,$,Z,Q){let X=K4(q,$,Z,Q);if(m.isNode(X)||m.isPair(X))return _4(q,Q,X),a0(q,X,Z,Q);if(typeof X!=="symbol"){if(m.isCollection($)){Q=Object.freeze(Q.concat($));for(let z=0;z<$.items.length;++z){let J=a0(z,$.items[z],Z,Q);if(typeof J==="number")z=J-1;else if(J===n)return n;else if(J===Y0)$.items.splice(z,1),z-=1}}else if(m.isPair($)){Q=Object.freeze(Q.concat($));let z=a0("key",$.key,Z,Q);if(z===n)return n;else if(z===Y0)$.key=null;let J=a0("value",$.value,Z,Q);if(J===n)return n;else if(J===Y0)$.value=null}}return X}async function sq(q,$){let Z=B4($);if(m.isDocument(q)){if(await o0(null,q.contents,Z,Object.freeze([q]))===Y0)q.contents=null}else await o0(null,q,Z,Object.freeze([]))}sq.BREAK=n;sq.SKIP=V4;sq.REMOVE=Y0;async function o0(q,$,Z,Q){let X=await K4(q,$,Z,Q);if(m.isNode(X)||m.isPair(X))return _4(q,Q,X),o0(q,X,Z,Q);if(typeof X!=="symbol"){if(m.isCollection($)){Q=Object.freeze(Q.concat($));for(let z=0;z<$.items.length;++z){let J=await o0(z,$.items[z],Z,Q);if(typeof J==="number")z=J-1;else if(J===n)return n;else if(J===Y0)$.items.splice(z,1),z-=1}}else if(m.isPair($)){Q=Object.freeze(Q.concat($));let z=await o0("key",$.key,Z,Q);if(z===n)return n;else if(z===Y0)$.key=null;let J=await o0("value",$.value,Z,Q);if(J===n)return n;else if(J===Y0)$.value=null}}return X}function B4(q){if(typeof q==="object"&&(q.Collection||q.Node||q.Value))return Object.assign({Alias:q.Node,Map:q.Node,Scalar:q.Node,Seq:q.Node},q.Value&&{Map:q.Value,Scalar:q.Value,Seq:q.Value},q.Collection&&{Map:q.Collection,Seq:q.Collection},q);return q}function K4(q,$,Z,Q){if(typeof Z==="function")return Z(q,$,Q);if(m.isMap($))return Z.Map?.(q,$,Q);if(m.isSeq($))return Z.Seq?.(q,$,Q);if(m.isPair($))return Z.Pair?.(q,$,Q);if(m.isScalar($))return Z.Scalar?.(q,$,Q);if(m.isAlias($))return Z.Alias?.(q,$,Q);return}function _4(q,$,Z){let Q=$[$.length-1];if(m.isCollection(Q))Q.items[q]=Z;else if(m.isPair(Q))if(q==="key")Q.key=Z;else Q.value=Z;else if(m.isDocument(Q))Q.contents=Z;else{let X=m.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}_6.visit=iq;_6.visitAsync=sq});var Q2=N((T6)=>{var L4=k(),F6=Gq(),I6={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},A6=(q)=>q.replace(/[!,[\]{}]/g,($)=>I6[$]);class t{constructor(q,$){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,q),this.tags=Object.assign({},t.defaultTags,$)}clone(){let q=new t(this.yaml,this.tags);return q.docStart=this.docStart,q}atDocument(){let q=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return q}add(q,$){if(this.atNextDocument)this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1;let Z=q.trim().split(/[ \t]+/),Q=Z.shift();switch(Q){case"%TAG":{if(Z.length!==2){if($(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[X,z]=Z;return this.tags[X]=z,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return $(0,"%YAML directive should contain exactly one part"),!1;let[X]=Z;if(X==="1.1"||X==="1.2")return this.yaml.version=X,!0;else{let z=/^\d+\.\d+$/.test(X);return $(6,`Unsupported YAML version ${X}`,z),!1}}default:return $(0,`Unknown directive ${Q}`,!0),!1}}tagName(q,$){if(q==="!")return"!";if(q[0]!=="!")return $(`Not a valid tag: ${q}`),null;if(q[1]==="<"){let z=q.slice(2,-1);if(z==="!"||z==="!!")return $(`Verbatim tags aren't resolved, so ${q} is invalid.`),null;if(q[q.length-1]!==">")$("Verbatim tags must end with a >");return z}let[,Z,Q]=q.match(/^(.*!)([^!]*)$/s);if(!Q)$(`The ${q} tag has no suffix`);let X=this.tags[Z];if(X)try{return X+decodeURIComponent(Q)}catch(z){return $(String(z)),null}if(Z==="!")return q;return $(`Could not resolve tag: ${q}`),null}tagString(q){for(let[$,Z]of Object.entries(this.tags))if(q.startsWith(Z))return $+A6(q.substring(Z.length));return q[0]==="!"?q:`!<${q}>`}toString(q){let $=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),Q;if(q&&Z.length>0&&L4.isNode(q.contents)){let X={};F6.visit(q.contents,(z,J)=>{if(L4.isNode(J)&&J.tag)X[J.tag]=!0}),Q=Object.keys(X)}else Q=[];for(let[X,z]of Z){if(X==="!!"&&z==="tag:yaml.org,2002:")continue;if(!q||Q.some((J)=>J.startsWith(z)))$.push(`%TAG ${X} ${z}`)}return $.join(`
|
|
3
|
+
`)}}t.defaultYaml={explicit:!1,version:"1.2"};t.defaultTags={"!!":"tag:yaml.org,2002:"};T6.Directives=t});var tq=N((N6)=>{var O4=k(),j6=Gq();function R6(q){if(/[\x00-\x19\s,[\]{}]/.test(q)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify(q)}`;throw Error(Z)}return!0}function F4(q){let $=new Set;return j6.visit(q,{Value(Z,Q){if(Q.anchor)$.add(Q.anchor)}}),$}function I4(q,$){for(let Z=1;;++Z){let Q=`${q}${Z}`;if(!$.has(Q))return Q}}function D6(q,$){let Z=[],Q=new Map,X=null;return{onAnchor:(z)=>{Z.push(z),X??(X=F4(q));let J=I4($,X);return X.add(J),J},setAnchors:()=>{for(let z of Z){let J=Q.get(z);if(typeof J==="object"&&J.anchor&&(O4.isScalar(J.node)||O4.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=R6;N6.anchorNames=F4;N6.createNodeAnchors=D6;N6.findNewAnchor=I4});var X2=N((S6)=>{function Yq(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=Yq(q,Q,String(X),J);if(G===void 0)delete Q[X];else if(G!==J)Q[X]=G}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let z=Q.get(X),J=Yq(q,Q,X,z);if(J===void 0)Q.delete(X);else if(J!==z)Q.set(X,J)}else if(Q instanceof Set)for(let X of Array.from(Q)){let z=Yq(q,Q,X,X);if(z===void 0)Q.delete(X);else if(z!==X)Q.delete(X),Q.add(z)}else for(let[X,z]of Object.entries(Q)){let J=Yq(q,Q,X,z);if(J===void 0)delete Q[X];else if(J!==z)Q[X]=J}return q.call($,Z,Q)}S6.applyReviver=Yq});var _0=N((y6)=>{var x6=k();function A4(q,$,Z){if(Array.isArray(q))return q.map((Q,X)=>A4(Q,String(X),Z));if(q&&typeof q.toJSON==="function"){if(!Z||!x6.hasAnchor(q))return q.toJSON($,Z);let Q={aliasCount:0,count:1,res:void 0};Z.anchors.set(q,Q),Z.onCreate=(z)=>{Q.res=z,delete Z.onCreate};let X=q.toJSON($,Z);if(Z.onCreate)Z.onCreate(X);return X}if(typeof q==="bigint"&&!Z?.keep)return Number(q);return q}y6.toJS=A4});var rq=N((h6)=>{var k6=X2(),T4=k(),v6=_0();class M4{constructor(q){Object.defineProperty(this,T4.NODE_TYPE,{value:q})}clone(){let q=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)q.range=this.range.slice();return q}toJS(q,{mapAsMap:$,maxAliasCount:Z,onAnchor:Q,reviver:X}={}){if(!T4.isDocument(q))throw TypeError("A document argument is required");let z={anchors:new Map,doc:q,keep:!0,mapAsMap:$===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},J=v6.toJS(this,"",z);if(typeof Q==="function")for(let{count:G,res:Y}of z.anchors.values())Q(Y,G);return typeof X==="function"?k6.applyReviver(X,{"":J},"",J):J}}h6.NodeBase=M4});var Uq=N((c6)=>{var u6=tq(),m6=Gq(),i0=k(),p6=rq(),d6=_0();class j4 extends p6.NodeBase{constructor(q){super(i0.ALIAS);this.source=q,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(q,$){let Z;if($?.aliasResolveCache)Z=$.aliasResolveCache;else if(Z=[],m6.visit(q,{Node:(X,z)=>{if(i0.isAlias(z)||i0.hasAnchor(z))Z.push(z)}}),$)$.aliasResolveCache=Z;let Q=void 0;for(let X of Z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON(q,$){if(!$)return{source:this.source};let{anchors:Z,doc:Q,maxAliasCount:X}=$,z=this.resolve(Q,$);if(!z){let G=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(G)}let J=Z.get(z);if(!J)d6.toJS(z,null,$),J=Z.get(z);if(J?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(X>=0){if(J.count+=1,J.aliasCount===0)J.aliasCount=eq(Q,z,Z);if(J.count*J.aliasCount>X)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return J.res}toString(q,$,Z){let Q=`*${this.source}`;if(q){if(u6.anchorIsValid(this.source),q.options.verifyAliasOrder&&!q.anchors.has(this.source)){let X=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(X)}if(q.implicitKey)return`${Q} `}return Q}}function eq(q,$,Z){if(i0.isAlias($)){let Q=$.resolve(q),X=Z&&Q&&Z.get(Q);return X?X.count*X.aliasCount:0}else if(i0.isCollection($)){let Q=0;for(let X of $.items){let z=eq(q,X,Z);if(z>Q)Q=z}return Q}else if(i0.isPair($)){let Q=eq(q,$.key,Z),X=eq(q,$.value,Z);return Math.max(Q,X)}return 1}c6.Alias=j4});var u=N((s6)=>{var n6=k(),a6=rq(),o6=_0(),i6=(q)=>!q||typeof q!=="function"&&typeof q!=="object";class P0 extends a6.NodeBase{constructor(q){super(n6.SCALAR);this.value=q}toJSON(q,$){return $?.keep?this.value:o6.toJS(this.value,q,$)}toString(){return String(this.value)}}P0.BLOCK_FOLDED="BLOCK_FOLDED";P0.BLOCK_LITERAL="BLOCK_LITERAL";P0.PLAIN="PLAIN";P0.QUOTE_DOUBLE="QUOTE_DOUBLE";P0.QUOTE_SINGLE="QUOTE_SINGLE";s6.Scalar=P0;s6.isScalarValue=i6});var Hq=N((Q7)=>{var e6=Uq(),C0=k(),R4=u(),q7="tag:yaml.org,2002:";function $7(q,$,Z){if($){let Q=Z.filter((z)=>z.tag===$),X=Q.find((z)=>!z.format)??Q[0];if(!X)throw Error(`Tag ${$} not found`);return X}return Z.find((Q)=>Q.identify?.(q)&&!Q.format)}function Z7(q,$,Z){if(C0.isDocument(q))q=q.contents;if(C0.isNode(q))return q;if(C0.isPair(q)){let W=Z.schema[C0.MAP].createNode?.(Z.schema,null,Z);return W.items.push(q),W}if(q instanceof String||q instanceof Number||q instanceof Boolean||typeof BigInt<"u"&&q instanceof BigInt)q=q.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:z,schema:J,sourceObjects:G}=Z,Y=void 0;if(Q&&q&&typeof q==="object")if(Y=G.get(q),Y)return Y.anchor??(Y.anchor=X(q)),new e6.Alias(Y.anchor);else Y={anchor:null,node:null},G.set(q,Y);if($?.startsWith("!!"))$=q7+$.slice(2);let H=$7(q,$,J.tags);if(!H){if(q&&typeof q.toJSON==="function")q=q.toJSON();if(!q||typeof q!=="object"){let W=new R4.Scalar(q);if(Y)Y.node=W;return W}H=q instanceof Map?J[C0.MAP]:(Symbol.iterator in Object(q))?J[C0.SEQ]:J[C0.MAP]}if(z)z(H),delete Z.onTagObj;let V=H?.createNode?H.createNode(Z.schema,q,Z):typeof H?.nodeClass?.from==="function"?H.nodeClass.from(Z.schema,q,Z):new R4.Scalar(q);if($)V.tag=$;else if(!H.default)V.tag=H.tag;if(Y)Y.node=V;return V}Q7.createNode=Z7});var q$=N((G7)=>{var z7=Hq(),U0=k(),J7=rq();function z2(q,$,Z){let Q=Z;for(let X=$.length-1;X>=0;--X){let z=$[X];if(typeof z==="number"&&Number.isInteger(z)&&z>=0){let J=[];J[z]=Q,Q=J}else Q=new Map([[z,Q]])}return z7.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:q,sourceObjects:new Map})}var D4=(q)=>q==null||typeof q==="object"&&!!q[Symbol.iterator]().next().done;class N4 extends J7.NodeBase{constructor(q,$){super(q);Object.defineProperty(this,"schema",{value:$,configurable:!0,enumerable:!1,writable:!0})}clone(q){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(q)$.schema=q;if($.items=$.items.map((Z)=>U0.isNode(Z)||U0.isPair(Z)?Z.clone(q):Z),this.range)$.range=this.range.slice();return $}addIn(q,$){if(D4(q))this.add($);else{let[Z,...Q]=q,X=this.get(Z,!0);if(U0.isCollection(X))X.addIn(Q,$);else if(X===void 0&&this.schema)this.set(Z,z2(this.schema,Q,$));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}deleteIn(q){let[$,...Z]=q;if(Z.length===0)return this.delete($);let Q=this.get($,!0);if(U0.isCollection(Q))return Q.deleteIn(Z);else throw Error(`Expected YAML collection at ${$}. Remaining path: ${Z}`)}getIn(q,$){let[Z,...Q]=q,X=this.get(Z,!0);if(Q.length===0)return!$&&U0.isScalar(X)?X.value:X;else return U0.isCollection(X)?X.getIn(Q,$):void 0}hasAllNullValues(q){return this.items.every(($)=>{if(!U0.isPair($))return!1;let Z=$.value;return Z==null||q&&U0.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn(q){let[$,...Z]=q;if(Z.length===0)return this.has($);let Q=this.get($,!0);return U0.isCollection(Q)?Q.hasIn(Z):!1}setIn(q,$){let[Z,...Q]=q;if(Q.length===0)this.set(Z,$);else{let X=this.get(Z,!0);if(U0.isCollection(X))X.setIn(Q,$);else if(X===void 0&&this.schema)this.set(Z,z2(this.schema,Q,$));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}}G7.Collection=N4;G7.collectionFromPath=z2;G7.isEmptyPath=D4});var Wq=N((B7)=>{var W7=(q)=>q.replace(/^(?!$)(?: $)?/gm,"#");function J2(q,$){if(/^\n+$/.test(q))return q.substring(1);return $?q.replace(/^(?! *$)/gm,$):q}var V7=(q,$,Z)=>q.endsWith(`
|
|
4
|
+
`)?J2(Z,$):Z.includes(`
|
|
5
5
|
`)?`
|
|
6
|
-
`+
|
|
7
|
-
`){if(Z==="block")K=
|
|
6
|
+
`+J2(Z,$):(q.endsWith(" ")?"":" ")+Z;B7.indentComment=J2;B7.lineComment=V7;B7.stringifyComment=W7});var P4=N((F7)=>{function O7(q,$,Z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:z=20,onFold:J,onOverflow:G}={}){if(!X||X<0)return q;if(X<z)z=0;let Y=Math.max(1+z,1+X-$.length);if(q.length<=Y)return q;let H=[],V={},W=X-$.length;if(typeof Q==="number")if(Q>X-Math.max(2,z))H.push(0);else W=X-Q;let B=void 0,_=void 0,L=!1,K=-1,O=-1,F=-1;if(Z==="block"){if(K=w4(q,K,$.length),K!==-1)W=K+Y}for(let M;M=q[K+=1];){if(Z==="quoted"&&M==="\\"){switch(O=K,q[K+1]){case"x":K+=3;break;case"u":K+=5;break;case"U":K+=9;break;default:K+=1}F=K}if(M===`
|
|
7
|
+
`){if(Z==="block")K=w4(q,K,$.length);W=K+$.length+Y,B=void 0}else{if(M===" "&&_&&_!==" "&&_!==`
|
|
8
8
|
`&&_!=="\t"){let R=q[K+1];if(R&&R!==" "&&R!==`
|
|
9
9
|
`&&R!=="\t")B=K}if(K>=W)if(B)H.push(B),W=B+Y,B=void 0;else if(Z==="quoted"){while(_===" "||_==="\t")_=M,M=q[K+=1],L=!0;let R=K>F+1?K-2:O-1;if(V[R])return q;H.push(R),V[R]=!0,W=R+Y,B=void 0}else L=!0}_=M}if(L&&G)G();if(H.length===0)return q;if(J)J();let A=q.slice(0,H[0]);for(let M=0;M<H.length;++M){let R=H[M],T=H[M+1]||q.length;if(R===0)A=`
|
|
10
10
|
${$}${q.slice(0,T)}`;else{if(Z==="quoted"&&V[R])A+=`${q[R]}\\`;A+=`
|
|
11
|
-
${$}${q.slice(R+1,T)}`}}return A}function
|
|
12
|
-
`);Q=$,X=$+1,z=q[X]}return Q}
|
|
13
|
-
`){if(z-J>Q)return!0;if(J=z+1,X-J<=Q)return!1}return!0}function Vq(q,$){let Z=JSON.stringify(q);if($.options.doubleQuotedAsJSON)return Z;let{implicitKey:Q}=$,X=$.options.doubleQuotedMinMultiLineLength,z=$.indent||(
|
|
11
|
+
${$}${q.slice(R+1,T)}`}}return A}function w4(q,$,Z){let Q=$,X=$+1,z=q[X];while(z===" "||z==="\t")if($<X+Z)z=q[++$];else{do z=q[++$];while(z&&z!==`
|
|
12
|
+
`);Q=$,X=$+1,z=q[X]}return Q}F7.FOLD_BLOCK="block";F7.FOLD_FLOW="flow";F7.FOLD_QUOTED="quoted";F7.foldFlowLines=O7});var Bq=N((N7)=>{var J0=u(),L0=P4(),Z$=(q,$)=>({indentAtStart:$?q.indent.length:q.indentAtStart,lineWidth:q.options.lineWidth,minContentWidth:q.options.minContentWidth}),Q$=(q)=>/^(%|---|\.\.\.)/m.test(q);function j7(q,$,Z){if(!$||$<0)return!1;let Q=$-Z,X=q.length;if(X<=Q)return!1;for(let z=0,J=0;z<X;++z)if(q[z]===`
|
|
13
|
+
`){if(z-J>Q)return!0;if(J=z+1,X-J<=Q)return!1}return!0}function Vq(q,$){let Z=JSON.stringify(q);if($.options.doubleQuotedAsJSON)return Z;let{implicitKey:Q}=$,X=$.options.doubleQuotedMinMultiLineLength,z=$.indent||(Q$(q)?" ":""),J="",G=0;for(let Y=0,H=Z[Y];H;H=Z[++Y]){if(H===" "&&Z[Y+1]==="\\"&&Z[Y+2]==="n")J+=Z.slice(G,Y)+"\\ ",Y+=1,G=Y,H="\\";if(H==="\\")switch(Z[Y+1]){case"u":{J+=Z.slice(G,Y);let 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(q))return Vq(q,$);let Z=$.indent||(
|
|
18
|
-
${Z}`)+"'";return $.implicitKey?Q:L0.foldFlowLines(Q,Z,L0.FOLD_FLOW,
|
|
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,Z$($,!1))}function G2(q,$){if($.options.singleQuote===!1||$.implicitKey&&q.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(q))return Vq(q,$);let Z=$.indent||(Q$(q)?" ":""),Q="'"+q.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${Z}`)+"'";return $.implicitKey?Q:L0.foldFlowLines(Q,Z,L0.FOLD_FLOW,Z$($,!1))}function s0(q,$){let{singleQuote:Z}=$.options,Q;if(Z===!1)Q=Vq;else{let X=q.includes('"'),z=q.includes("'");if(X&&!z)Q=G2;else if(z&&!X)Q=Vq;else Q=Z?G2:Vq}return Q(q,$)}var Y2;try{Y2=new RegExp(`(^|(?<!
|
|
19
19
|
))
|
|
20
20
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{
|
|
21
|
+
|$)`,"g")}catch{Y2=/\n+(?!\n|$)/g}function $$({comment:q,type:$,value:Z},Q,X,z){let{blockQuote:J,commentString:G,lineWidth:Y}=Q.options;if(!J||/\n[\t ]+$/.test(Z))return s0(Z,Q);let H=Q.indent||(Q.forceBlockIndent||Q$(Z)?" ":""),V=J==="literal"?!0:J==="folded"||$===J0.Scalar.BLOCK_FOLDED?!1:$===J0.Scalar.BLOCK_LITERAL?!0:!j7(Z,Y,H.length);if(!Z)return V?`|
|
|
22
22
|
`:`>
|
|
23
23
|
`;let W,B;for(B=Z.length;B>0;--B){let T=Z[B-1];if(T!==`
|
|
24
24
|
`&&T!=="\t"&&T!==" ")break}let _=Z.substring(B),L=_.indexOf(`
|
|
25
25
|
`);if(L===-1)W="-";else if(Z===_||L!==_.length-1){if(W="+",z)z()}else W="";if(_){if(Z=Z.slice(0,-_.length),_[_.length-1]===`
|
|
26
|
-
`)_=_.slice(0,-1);_=_.replace(
|
|
26
|
+
`)_=_.slice(0,-1);_=_.replace(Y2,`$&${H}`)}let K=!1,O,F=-1;for(O=0;O<Z.length;++O){let T=Z[O];if(T===" ")K=!0;else if(T===`
|
|
27
27
|
`)F=O;else break}let A=Z.substring(0,F<O?F+1:O);if(A)Z=Z.substring(A.length),A=A.replace(/\n+/g,`$&${H}`);let R=(K?H?"2":"1":"")+W;if(q){if(R+=" "+G(q.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,`$&${H}`),D=!1,x=
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${H}`),D=!1,x=Z$(Q,!0);if(J!=="folded"&&$!==J0.Scalar.BLOCK_FOLDED)x.onOverflow=()=>{D=!0};let w=L0.foldFlowLines(`${A}${T}${_}`,H,L0.FOLD_BLOCK,x);if(!D)return`>${R}
|
|
29
29
|
${H}${w}`}return Z=Z.replace(/\n+/g,`$&${H}`),`|${R}
|
|
30
|
-
${H}${A}${Z}${_}`}function
|
|
30
|
+
${H}${A}${Z}${_}`}function R7(q,$,Z,Q){let{type:X,value:z}=q,{actualString:J,implicitKey:G,indent:Y,indentStep:H,inFlow:V}=$;if(G&&z.includes(`
|
|
31
31
|
`)||V&&/[[\]{},]/.test(z))return s0(z,$);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(z))return G||V||!z.includes(`
|
|
32
|
-
`)?s0(z,$)
|
|
33
|
-
`))return
|
|
34
|
-
${Y}`);if(J){let B=(K)=>K.default&&K.tag!=="tag:yaml.org,2002:str"&&K.test?.test(W),{compat:_,tags:L}=$.doc.schema;if(L.some(B)||_?.some(B))return s0(z,$)}return G?W:L0.foldFlowLines(W,Y,L0.FOLD_FLOW,
|
|
35
|
-
${$.indent}${G}`}
|
|
36
|
-
${G}:`}else if(O=`${O}:`,B)O+=_q.lineComment(O,Z.indent,H(B));let F,A,M;if(K0.isNode($))F=!!$.spaceBefore,A=$.commentBefore,M=$.comment;else if(F=!1,A=null,M=null,$&&typeof $==="object")$=J.createNode($);if(Z.implicitKey=!1,!_&&!B&&K0.isScalar($))Z.indentAtStart=O.length+1;if(K=!1,!V&&Y.length>=2&&!Z.inFlow&&!_&&K0.isSeq($)&&!$.flow&&!$.tag&&!$.anchor)Z.indent=Z.indent.substring(2);let R=!1,T=
|
|
32
|
+
`)?s0(z,$):$$(q,$,Z,Q);if(!G&&!V&&X!==J0.Scalar.PLAIN&&z.includes(`
|
|
33
|
+
`))return $$(q,$,Z,Q);if(Q$(z)){if(Y==="")return $.forceBlockIndent=!0,$$(q,$,Z,Q);else if(G&&Y===H)return s0(z,$)}let W=z.replace(/\n+/g,`$&
|
|
34
|
+
${Y}`);if(J){let B=(K)=>K.default&&K.tag!=="tag:yaml.org,2002:str"&&K.test?.test(W),{compat:_,tags:L}=$.doc.schema;if(L.some(B)||_?.some(B))return s0(z,$)}return G?W:L0.foldFlowLines(W,Y,L0.FOLD_FLOW,Z$($,!1))}function D7(q,$,Z,Q){let{implicitKey:X,inFlow:z}=$,J=typeof q.value==="string"?q:Object.assign({},q,{value:String(q.value)}),{type:G}=q;if(G!==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?s0(J.value,$):$$(J,$,Z,Q);case J0.Scalar.QUOTE_DOUBLE:return Vq(J.value,$);case J0.Scalar.QUOTE_SINGLE:return G2(J.value,$);case J0.Scalar.PLAIN:return R7(J,$,Z,Q);default:return null}},H=Y(G);if(H===null){let{defaultKeyType:V,defaultStringType:W}=$.options,B=X&&V||W;if(H=Y(B),H===null)throw Error(`Unsupported default string type ${B}`)}return H}N7.stringifyString=D7});var Kq=N((f7)=>{var P7=tq(),O0=k(),C7=Wq(),E7=Bq();function S7(q,$){let Z=Object.assign({blockQuote:!0,commentString:C7.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},q.schema.toStringOptions,$),Q;switch(Z.collectionStyle){case"block":Q=!1;break;case"flow":Q=!0;break;default:Q=null}return{anchors:new Set,doc:q,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:Q,options:Z}}function b7(q,$){if($.tag){let X=q.filter((z)=>z.tag===$.tag);if(X.length>0)return X.find((z)=>z.format===$.format)??X[0]}let Z=void 0,Q;if(O0.isScalar($)){Q=$.value;let X=q.filter((z)=>z.identify?.(Q));if(X.length>1){let z=X.filter((J)=>J.test);if(z.length>0)X=z}Z=X.find((z)=>z.format===$.format)??X.find((z)=>!z.format)}else Q=$,Z=q.find((X)=>X.nodeClass&&Q instanceof X.nodeClass);if(!Z){let X=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${X} value`)}return Z}function x7(q,$,{anchors:Z,doc:Q}){if(!Q.directives)return"";let X=[],z=(O0.isScalar(q)||O0.isCollection(q))&&q.anchor;if(z&&P7.anchorIsValid(z))Z.add(z),X.push(`&${z}`);let J=q.tag??($.default?null:$.tag);if(J)X.push(Q.directives.tagString(J));return X.join(" ")}function y7(q,$,Z,Q){if(O0.isPair(q))return q.toString($,Z,Q);if(O0.isAlias(q)){if($.doc.directives)return q.toString($);if($.resolvedAliases?.has(q))throw TypeError("Cannot stringify circular structure without alias nodes");else{if($.resolvedAliases)$.resolvedAliases.add(q);else $.resolvedAliases=new Set([q]);q=q.resolve($.doc)}}let X=void 0,z=O0.isNode(q)?q:$.doc.createNode(q,{onTagObj:(Y)=>X=Y});X??(X=b7($.doc.schema.tags,z));let J=x7(z,X,$);if(J.length>0)$.indentAtStart=($.indentAtStart??0)+J.length+1;let G=typeof X.stringify==="function"?X.stringify(z,$,Z,Q):O0.isScalar(z)?E7.stringifyString(z,$,Z,Q):z.toString($,Z,Q);if(!J)return G;return O0.isScalar(z)||G[0]==="{"||G[0]==="["?`${J} ${G}`:`${J}
|
|
35
|
+
${$.indent}${G}`}f7.createStringifyContext=S7;f7.stringify=y7});var S4=N((g7)=>{var K0=k(),C4=u(),E4=Kq(),_q=Wq();function h7({key:q,value:$},Z,Q,X){let{allNullValues:z,doc:J,indent:G,indentStep:Y,options:{commentString:H,indentSeq:V,simpleKeys:W}}=Z,B=K0.isNode(q)&&q.comment||null;if(W){if(B)throw Error("With simple keys, key nodes cannot have comments");if(K0.isCollection(q)||!K0.isNode(q)&&typeof q==="object")throw Error("With simple keys, collection cannot be used as a key value")}let _=!W&&(!q||B&&$==null&&!Z.inFlow||K0.isCollection(q)||(K0.isScalar(q)?q.type===C4.Scalar.BLOCK_FOLDED||q.type===C4.Scalar.BLOCK_LITERAL:typeof q==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!_&&(W||!z),indent:G+Y});let L=!1,K=!1,O=E4.stringify(q,Z,()=>L=!0,()=>K=!0);if(!_&&!Z.inFlow&&O.length>1024){if(W)throw Error("With simple keys, single line scalar must not span more than 1024 characters");_=!0}if(Z.inFlow){if(z||$==null){if(L&&Q)Q();return O===""?"?":_?`? ${O}`:O}}else if(z&&!W||$==null&&_){if(O=`? ${O}`,B&&!L)O+=_q.lineComment(O,Z.indent,H(B));else if(K&&X)X();return O}if(L)B=null;if(_){if(B)O+=_q.lineComment(O,Z.indent,H(B));O=`? ${O}
|
|
36
|
+
${G}:`}else if(O=`${O}:`,B)O+=_q.lineComment(O,Z.indent,H(B));let F,A,M;if(K0.isNode($))F=!!$.spaceBefore,A=$.commentBefore,M=$.comment;else if(F=!1,A=null,M=null,$&&typeof $==="object")$=J.createNode($);if(Z.implicitKey=!1,!_&&!B&&K0.isScalar($))Z.indentAtStart=O.length+1;if(K=!1,!V&&Y.length>=2&&!Z.inFlow&&!_&&K0.isSeq($)&&!$.flow&&!$.tag&&!$.anchor)Z.indent=Z.indent.substring(2);let R=!1,T=E4.stringify($,Z,()=>R=!0,()=>K=!0),D=" ";if(B||F||A){if(D=F?`
|
|
37
37
|
`:"",A){let x=H(A);D+=`
|
|
38
38
|
${_q.indentComment(x,Z.indent)}`}if(T===""&&!Z.inFlow){if(D===`
|
|
39
39
|
`&&M)D=`
|
|
@@ -42,34 +42,34 @@ ${_q.indentComment(x,Z.indent)}`}if(T===""&&!Z.inFlow){if(D===`
|
|
|
42
42
|
${Z.indent}`}else if(!_&&K0.isCollection($)){let x=T[0],w=T.indexOf(`
|
|
43
43
|
`),f=w!==-1,I=Z.inFlow??$.flow??$.items.length===0;if(f||!I){let j=!1;if(f&&(x==="&"||x==="!")){let C=T.indexOf(" ");if(x==="&"&&C!==-1&&C<w&&T[C+1]==="!")C=T.indexOf(" ",C+1);if(C===-1||w<C)j=!0}if(!j)D=`
|
|
44
44
|
${Z.indent}`}}else if(T===""||T[0]===`
|
|
45
|
-
`)D="";if(O+=D+T,Z.inFlow){if(R&&Q)Q()}else if(M&&!R)O+=_q.lineComment(O,Z.indent,H(M));else if(K&&X)X();return O}
|
|
45
|
+
`)D="";if(O+=D+T,Z.inFlow){if(R&&Q)Q()}else if(M&&!R)O+=_q.lineComment(O,Z.indent,H(M));else if(K&&X)X();return O}g7.stringifyPair=h7});var U2=N((d7)=>{var b4=v("process");function m7(q,...$){if(q==="debug")console.log(...$)}function p7(q,$){if(q==="debug"||q==="warn")if(typeof b4.emitWarning==="function")b4.emitWarning($);else console.warn($)}d7.debug=m7;d7.warn=p7});var J$=N((a7)=>{var Lq=k(),x4=u(),X$="<<",z$={identify:(q)=>q===X$||typeof q==="symbol"&&q.description===X$,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new x4.Scalar(Symbol(X$)),{addToJSMap:y4}),stringify:()=>X$},n7=(q,$)=>(z$.identify($)||Lq.isScalar($)&&(!$.type||$.type===x4.Scalar.PLAIN)&&z$.identify($.value))&&q?.doc.schema.tags.some((Z)=>Z.tag===z$.tag&&Z.default);function y4(q,$,Z){if(Z=q&&Lq.isAlias(Z)?Z.resolve(q.doc):Z,Lq.isSeq(Z))for(let Q of Z.items)H2(q,$,Q);else if(Array.isArray(Z))for(let Q of Z)H2(q,$,Q);else H2(q,$,Z)}function H2(q,$,Z){let Q=q&&Lq.isAlias(Z)?Z.resolve(q.doc):Z;if(!Lq.isMap(Q))throw Error("Merge sources must be maps or map aliases");let X=Q.toJSON(null,q,Map);for(let[z,J]of X)if($ instanceof Map){if(!$.has(z))$.set(z,J)}else if($ instanceof Set)$.add(z);else if(!Object.prototype.hasOwnProperty.call($,z))Object.defineProperty($,z,{value:J,writable:!0,enumerable:!0,configurable:!0});return $}a7.addMergeToJSMap=y4;a7.isMergeKey=n7;a7.merge=z$});var V2=N(($3)=>{var t7=U2(),f4=J$(),r7=Kq(),k4=k(),W2=_0();function e7(q,$,{key:Z,value:Q}){if(k4.isNode(Z)&&Z.addToJSMap)Z.addToJSMap(q,$,Q);else if(f4.isMergeKey(q,Z))f4.addMergeToJSMap(q,$,Q);else{let X=W2.toJS(Z,"",q);if($ instanceof Map)$.set(X,W2.toJS(Q,X,q));else if($ instanceof Set)$.add(X);else{let z=q3(Z,X,q),J=W2.toJS(Q,z,q);if(z in $)Object.defineProperty($,z,{value:J,writable:!0,enumerable:!0,configurable:!0});else $[z]=J}}return $}function q3(q,$,Z){if($===null)return"";if(typeof $!=="object")return String($);if(k4.isNode(q)&&Z?.doc){let Q=r7.createStringifyContext(Z.doc,{});Q.anchors=new Set;for(let z of Z.anchors.keys())Q.anchors.add(z.anchor);Q.inFlow=!0,Q.inStringifyKey=!0;let X=q.toString(Q);if(!Z.mapKeyWarned){let z=JSON.stringify(X);if(z.length>40)z=z.substring(0,36)+'..."';t7.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($)}$3.addPairToJSMap=e7});var F0=N((J3)=>{var v4=Hq(),Q3=S4(),X3=V2(),G$=k();function z3(q,$,Z){let Q=v4.createNode(q,void 0,Z),X=v4.createNode($,void 0,Z);return new Y$(Q,X)}class Y${constructor(q,$=null){Object.defineProperty(this,G$.NODE_TYPE,{value:G$.PAIR}),this.key=q,this.value=$}clone(q){let{key:$,value:Z}=this;if(G$.isNode($))$=$.clone(q);if(G$.isNode(Z))Z=Z.clone(q);return new Y$($,Z)}toJSON(q,$){let Z=$?.mapAsMap?new Map:{};return X3.addPairToJSMap($,Z,this)}toString(q,$,Z){return q?.doc?Q3.stringifyPair(this,q,$,Z):JSON.stringify(this)}}J3.Pair=Y$;J3.createPair=z3});var B2=N((V3)=>{var E0=k(),h4=Kq(),U$=Wq();function U3(q,$,Z){return($.inFlow??q.flow?W3:H3)(q,$,Z)}function H3({comment:q,items:$},Z,{blockItemPrefix:Q,flowChars:X,itemIndent:z,onChompKeep:J,onComment:G}){let{indent:Y,options:{commentString:H}}=Z,V=Object.assign({},Z,{indent:z,type:null}),W=!1,B=[];for(let L=0;L<$.length;++L){let K=$[L],O=null;if(E0.isNode(K)){if(!W&&K.spaceBefore)B.push("");if(H$(Z,B,K.commentBefore,W),K.comment)O=K.comment}else if(E0.isPair(K)){let A=E0.isNode(K.key)?K.key:null;if(A){if(!W&&A.spaceBefore)B.push("");H$(Z,B,A.commentBefore,W)}}W=!1;let F=h4.stringify(K,V,()=>O=null,()=>W=!0);if(O)F+=U$.lineComment(F,z,H(O));if(W&&O)W=!1;B.push(Q+F)}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
46
|
${Y}${K}`:`
|
|
47
47
|
`}}if(q){if(_+=`
|
|
48
|
-
`+
|
|
49
|
-
`)),L<q.length-1)F+=",";else if($.options.trailingComma){if($.options.lineWidth>0)H||(H=W.reduce((A,M)=>A+M.length+2,2)+(F.length+2)>$.options.lineWidth);if(H)F+=","}if(O)F+=
|
|
48
|
+
`+U$.indentComment(H(q),Y),G)G()}else if(W&&J)J();return _}function W3({items:q},$,{flowChars:Z,itemIndent:Q}){let{indent:X,indentStep:z,flowCollectionPadding:J,options:{commentString:G}}=$;Q+=z;let Y=Object.assign({},$,{indent:Q,inFlow:!0,type:null}),H=!1,V=0,W=[];for(let L=0;L<q.length;++L){let K=q[L],O=null;if(E0.isNode(K)){if(K.spaceBefore)W.push("");if(H$($,W,K.commentBefore,!1),K.comment)O=K.comment}else if(E0.isPair(K)){let A=E0.isNode(K.key)?K.key:null;if(A){if(A.spaceBefore)W.push("");if(H$($,W,A.commentBefore,!1),A.comment)H=!0}let M=E0.isNode(K.value)?K.value:null;if(M){if(M.comment)O=M.comment;if(M.commentBefore)H=!0}else if(K.value==null&&A?.comment)O=A.comment}if(O)H=!0;let F=h4.stringify(K,Y,()=>O=null);if(H||(H=W.length>V||F.includes(`
|
|
49
|
+
`)),L<q.length-1)F+=",";else if($.options.trailingComma){if($.options.lineWidth>0)H||(H=W.reduce((A,M)=>A+M.length+2,2)+(F.length+2)>$.options.lineWidth);if(H)F+=","}if(O)F+=U$.lineComment(F,Q,G(O));W.push(F),V=W.length}let{start:B,end:_}=Z;if(W.length===0)return B+_;else{if(!H){let L=W.reduce((K,O)=>K+O.length+2,2);H=$.options.lineWidth>0&&L>$.options.lineWidth}if(H){let L=B;for(let K of W)L+=K?`
|
|
50
50
|
${z}${X}${K}`:`
|
|
51
51
|
`;return`${L}
|
|
52
|
-
${X}${_}`}else return`${B}${J}${W.join(" ")}${J}${_}`}}function
|
|
53
|
-
`:" ")}return
|
|
52
|
+
${X}${_}`}else return`${B}${J}${W.join(" ")}${J}${_}`}}function H$({indent:q,options:{commentString:$}},Z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let z=U$.indentComment($(Q),q);Z.push(z.trimStart())}}V3.stringifyCollection=U3});var A0=N((F3)=>{var K3=B2(),_3=V2(),L3=q$(),I0=k(),W$=F0(),O3=u();function Oq(q,$){let Z=I0.isScalar($)?$.value:$;for(let Q of q)if(I0.isPair(Q)){if(Q.key===$||Q.key===Z)return Q;if(I0.isScalar(Q.key)&&Q.key.value===Z)return Q}return}class g4 extends L3.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(q){super(I0.MAP,q);this.items=[]}static from(q,$,Z){let{keepUndefined:Q,replacer:X}=Z,z=new this(q),J=(G,Y)=>{if(typeof X==="function")Y=X.call($,G,Y);else if(Array.isArray(X)&&!X.includes(G))return;if(Y!==void 0||Q)z.items.push(W$.createPair(G,Y,Z))};if($ instanceof Map)for(let[G,Y]of $)J(G,Y);else if($&&typeof $==="object")for(let G of Object.keys($))J(G,$[G]);if(typeof q.sortMapEntries==="function")z.items.sort(q.sortMapEntries);return z}add(q,$){let Z;if(I0.isPair(q))Z=q;else if(!q||typeof q!=="object"||!("key"in q))Z=new W$.Pair(q,q?.value);else Z=new W$.Pair(q.key,q.value);let Q=Oq(this.items,Z.key),X=this.schema?.sortMapEntries;if(Q){if(!$)throw Error(`Key ${Z.key} already set`);if(I0.isScalar(Q.value)&&O3.isScalarValue(Z.value))Q.value.value=Z.value;else Q.value=Z.value}else if(X){let z=this.items.findIndex((J)=>X(Z,J)<0);if(z===-1)this.items.push(Z);else this.items.splice(z,0,Z)}else this.items.push(Z)}delete(q){let $=Oq(this.items,q);if(!$)return!1;return this.items.splice(this.items.indexOf($),1).length>0}get(q,$){let Q=Oq(this.items,q)?.value;return(!$&&I0.isScalar(Q)?Q.value:Q)??void 0}has(q){return!!Oq(this.items,q)}set(q,$){this.add(new W$.Pair(q,$),!0)}toJSON(q,$,Z){let Q=Z?new Z:$?.mapAsMap?new Map:{};if($?.onCreate)$.onCreate(Q);for(let X of this.items)_3.addPairToJSMap($,Q,X);return Q}toString(q,$,Z){if(!q)return JSON.stringify(this);for(let Q of this.items)if(!I0.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!q.allNullValues&&this.hasAllNullValues(!1))q=Object.assign({},q,{allNullValues:!0});return K3.stringifyCollection(this,q,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:q.indent||"",onChompKeep:Z,onComment:$})}}F3.YAMLMap=g4;F3.findPair=Oq});var t0=N((j3)=>{var T3=k(),u4=A0(),M3={collection:"map",default:!0,nodeClass:u4.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(q,$){if(!T3.isMap(q))$("Expected a mapping for this tag");return q},createNode:(q,$,Z)=>u4.YAMLMap.from(q,$,Z)};j3.map=M3});var T0=N((E3)=>{var D3=Hq(),N3=B2(),w3=q$(),B$=k(),P3=u(),C3=_0();class m4 extends w3.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(q){super(B$.SEQ,q);this.items=[]}add(q){this.items.push(q)}delete(q){let $=V$(q);if(typeof $!=="number")return!1;return this.items.splice($,1).length>0}get(q,$){let Z=V$(q);if(typeof Z!=="number")return;let Q=this.items[Z];return!$&&B$.isScalar(Q)?Q.value:Q}has(q){let $=V$(q);return typeof $==="number"&&$<this.items.length}set(q,$){let Z=V$(q);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${q}.`);let Q=this.items[Z];if(B$.isScalar(Q)&&P3.isScalarValue($))Q.value=$;else this.items[Z]=$}toJSON(q,$){let Z=[];if($?.onCreate)$.onCreate(Z);let Q=0;for(let X of this.items)Z.push(C3.toJS(X,String(Q++),$));return Z}toString(q,$,Z){if(!q)return JSON.stringify(this);return N3.stringifyCollection(this,q,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(q.indent||"")+" ",onChompKeep:Z,onComment:$})}static from(q,$,Z){let{replacer:Q}=Z,X=new this(q);if($&&Symbol.iterator in Object($)){let z=0;for(let J of $){if(typeof Q==="function"){let G=$ instanceof Set?J:String(z++);J=Q.call($,G,J)}X.items.push(D3.createNode(J,void 0,Z))}}return X}}function V$(q){let $=B$.isScalar(q)?q.value:q;if($&&typeof $==="string")$=Number($);return typeof $==="number"&&Number.isInteger($)&&$>=0?$:null}E3.YAMLSeq=m4});var r0=N((y3)=>{var b3=k(),p4=T0(),x3={collection:"seq",default:!0,nodeClass:p4.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(q,$){if(!b3.isSeq(q))$("Expected a sequence for this tag");return q},createNode:(q,$,Z)=>p4.YAMLSeq.from(q,$,Z)};y3.seq=x3});var Fq=N((h3)=>{var k3=Bq(),v3={identify:(q)=>typeof q==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(q)=>q,stringify(q,$,Z,Q){return $=Object.assign({actualString:!0},$),k3.stringifyString(q,$,Z,Q)}};h3.string=v3});var K$=N((u3)=>{var d4=u(),c4={identify:(q)=>q==null,createNode:()=>new d4.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new d4.Scalar(null),stringify:({source:q},$)=>typeof q==="string"&&c4.test.test(q)?q:$.options.nullStr};u3.nullTag=c4});var K2=N((d3)=>{var p3=u(),l4={identify:(q)=>typeof q==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(q)=>new p3.Scalar(q[0]==="t"||q[0]==="T"),stringify({source:q,value:$},Z){if(q&&l4.test.test(q)){let Q=q[0]==="t"||q[0]==="T";if($===Q)return q}return $?Z.options.trueStr:Z.options.falseStr}};d3.boolTag=l4});var e0=N((n3)=>{function l3({format:q,minFractionDigits:$,tag:Z,value:Q}){if(typeof Q==="bigint")return String(Q);let X=typeof Q==="number"?Q:Number(Q);if(!isFinite(X))return isNaN(X)?".nan":X<0?"-.inf":".inf";let z=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!q&&$&&(!Z||Z==="tag:yaml.org,2002:float")&&/^\d/.test(z)){let J=z.indexOf(".");if(J<0)J=z.length,z+=".";let G=$-(z.length-J-1);while(G-- >0)z+="0"}return z}n3.stringifyNumber=l3});var L2=N((r3)=>{var o3=u(),_2=e0(),i3={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:_2.stringifyNumber},s3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(q)=>parseFloat(q),stringify(q){let $=Number(q.value);return isFinite($)?$.toExponential():_2.stringifyNumber(q)}},t3={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(q){let $=new o3.Scalar(parseFloat(q)),Z=q.indexOf(".");if(Z!==-1&&q[q.length-1]==="0")$.minFractionDigits=q.length-Z-1;return $},stringify:_2.stringifyNumber};r3.float=t3;r3.floatExp=s3;r3.floatNaN=i3});var F2=N((zQ)=>{var n4=e0(),_$=(q)=>typeof q==="bigint"||Number.isInteger(q),O2=(q,$,Z,{intAsBigInt:Q})=>Q?BigInt(q):parseInt(q.substring($),Z);function a4(q,$,Z){let{value:Q}=q;if(_$(Q)&&Q>=0)return Z+Q.toString($);return n4.stringifyNumber(q)}var ZQ={identify:(q)=>_$(q)&&q>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(q,$,Z)=>O2(q,2,8,Z),stringify:(q)=>a4(q,8,"0o")},QQ={identify:_$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(q,$,Z)=>O2(q,0,10,Z),stringify:n4.stringifyNumber},XQ={identify:(q)=>_$(q)&&q>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(q,$,Z)=>O2(q,2,16,Z),stringify:(q)=>a4(q,16,"0x")};zQ.int=QQ;zQ.intHex=XQ;zQ.intOct=ZQ});var o4=N((_Q)=>{var UQ=t0(),HQ=K$(),WQ=r0(),VQ=Fq(),BQ=K2(),I2=L2(),A2=F2(),KQ=[UQ.map,WQ.seq,VQ.string,HQ.nullTag,BQ.boolTag,A2.intOct,A2.int,A2.intHex,I2.floatNaN,I2.floatExp,I2.float];_Q.schema=KQ});var s4=N((jQ)=>{var OQ=u(),FQ=t0(),IQ=r0();function i4(q){return typeof q==="bigint"||Number.isInteger(q)}var L$=({value:q})=>JSON.stringify(q),AQ=[{identify:(q)=>typeof q==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(q)=>q,stringify:L$},{identify:(q)=>q==null,createNode:()=>new OQ.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:L$},{identify:(q)=>typeof q==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(q)=>q==="true",stringify:L$},{identify:i4,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(q,$,{intAsBigInt:Z})=>Z?BigInt(q):parseInt(q,10),stringify:({value:q})=>i4(q)?q.toString():JSON.stringify(q)},{identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(q)=>parseFloat(q),stringify:L$}],TQ={default:!0,tag:"",test:/^/,resolve(q,$){return $(`Unresolved plain scalar ${JSON.stringify(q)}`),q}},MQ=[FQ.map,IQ.seq].concat(AQ,TQ);jQ.schema=MQ});var M2=N((wQ)=>{var Iq=v("buffer"),T2=u(),DQ=Bq(),NQ={identify:(q)=>q instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(q,$){if(typeof Iq.Buffer==="function")return Iq.Buffer.from(q,"base64");else if(typeof atob==="function"){let Z=atob(q.replace(/[\n\r]/g,"")),Q=new Uint8Array(Z.length);for(let X=0;X<Z.length;++X)Q[X]=Z.charCodeAt(X);return Q}else return $("This environment does not support reading binary tags; either Buffer or atob is required"),q},stringify({comment:q,type:$,value:Z},Q,X,z){if(!Z)return"";let J=Z,G;if(typeof Iq.Buffer==="function")G=J instanceof Iq.Buffer?J.toString("base64"):Iq.Buffer.from(J.buffer).toString("base64");else if(typeof btoa==="function"){let Y="";for(let H=0;H<J.length;++H)Y+=String.fromCharCode(J[H]);G=btoa(Y)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if($??($=T2.Scalar.BLOCK_LITERAL),$!==T2.Scalar.QUOTE_DOUBLE){let Y=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),H=Math.ceil(G.length/Y),V=Array(H);for(let W=0,B=0;W<H;++W,B+=Y)V[W]=G.substr(B,Y);G=V.join($===T2.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return DQ.stringifyString({comment:q,type:$,value:G},Q,X,z)}};wQ.binary=NQ});var F$=N((bQ)=>{var O$=k(),j2=F0(),CQ=u(),EQ=T0();function t4(q,$){if(O$.isSeq(q))for(let Z=0;Z<q.items.length;++Z){let Q=q.items[Z];if(O$.isPair(Q))continue;else if(O$.isMap(Q)){if(Q.items.length>1)$("Each pair must have its own sequence indicator");let X=Q.items[0]||new j2.Pair(new CQ.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]=_$.isPair(Q)?Q:new T2.Pair(Q)}else $("Expected a sequence for this tag");return q}function t4(q,$,Z){let{replacer:Q}=Z,X=new CQ.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(T2.createPair(G,Y,Z))}return X}var EQ={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:s4,createNode:t4};SQ.createPairs=t4;SQ.pairs=EQ;SQ.resolvePairs=s4});var j2=N((vQ)=>{var r4=k(),M2=_0(),Aq=A0(),fQ=T0(),e4=L$();class S0 extends fQ.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=S0.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(r4.isPair(Q))X=M2.toJS(Q.key,"",$),z=M2.toJS(Q.value,X,$);else X=M2.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=e4.createPairs(q,$,Z),X=new this;return X.items=Q.items,X}}S0.tag="tag:yaml.org,2002:omap";var kQ={collection:"seq",identify:(q)=>q instanceof Map,nodeClass:S0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(q,$){let Z=e4.resolvePairs(q,$),Q=[];for(let{key:X}of Z.items)if(r4.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 S0,Z)},createNode:(q,$,Z)=>S0.from(q,$,Z)};vQ.YAMLOMap=S0;vQ.omap=kQ});var X1=N((uQ)=>{var q1=u();function $1({value:q,source:$},Z){if($&&(q?Z1:Q1).test.test($))return $;return q?Z.options.trueStr:Z.options.falseStr}var Z1={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 q1.Scalar(!0),stringify:$1},Q1={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 q1.Scalar(!1),stringify:$1};uQ.falseTag=Q1;uQ.trueTag=Z1});var z1=N((aQ)=>{var dQ=u(),R2=e0(),cQ={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:R2.stringifyNumber},lQ={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():R2.stringifyNumber(q)}},nQ={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(q){let $=new dQ.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:R2.stringifyNumber};aQ.float=nQ;aQ.floatExp=lQ;aQ.floatNaN=cQ});var G1=N(($X)=>{var J1=e0(),Tq=(q)=>typeof q==="bigint"||Number.isInteger(q);function O$(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 D2(q,$,Z){let{value:Q}=q;if(Tq(Q)){let X=Q.toString($);return Q<0?"-"+Z+X.substr(1):Z+X}return J1.stringifyNumber(q)}var tQ={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(q,$,Z)=>O$(q,2,2,Z),stringify:(q)=>D2(q,2,"0b")},rQ={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(q,$,Z)=>O$(q,1,8,Z),stringify:(q)=>D2(q,8,"0")},eQ={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(q,$,Z)=>O$(q,0,10,Z),stringify:J1.stringifyNumber},qX={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(q,$,Z)=>O$(q,2,16,Z),stringify:(q)=>D2(q,16,"0x")};$X.int=eQ;$X.intBin=tQ;$X.intHex=qX;$X.intOct=rQ});var N2=N((GX)=>{var A$=k(),F$=F0(),I$=A0();class b0 extends I$.YAMLMap{constructor(q){super(q);this.tag=b0.tag}add(q){let $;if(A$.isPair(q))$=q;else if(q&&typeof q==="object"&&"key"in q&&"value"in q&&q.value===null)$=new F$.Pair(q.key,null);else $=new F$.Pair(q,null);if(!I$.findPair(this.items,$.key))this.items.push($)}get(q,$){let Z=I$.findPair(this.items,q);return!$&&A$.isPair(Z)?A$.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=I$.findPair(this.items,q);if(Z&&!$)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&$)this.items.push(new F$.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(F$.createPair(z,null,Z))}return X}}b0.tag="tag:yaml.org,2002:set";var JX={collection:"map",identify:(q)=>q instanceof Set,nodeClass:b0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(q,$,Z)=>b0.from(q,$,Z),resolve(q,$){if(A$.isMap(q))if(q.hasAllNullValues(!0))return Object.assign(new b0,q);else $("Set items must all have null values");else $("Expected a mapping for this tag");return q}};GX.YAMLSet=b0;GX.set=JX});var P2=N((BX)=>{var HX=e0();function w2(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 Y1(q){let{value:$}=q,Z=(J)=>J;if(typeof $==="bigint")Z=(J)=>BigInt(J);else if(isNaN($)||!isFinite($))return HX.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 WX={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})=>w2(q,Z),stringify:Y1},VX={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)=>w2(q,!1),stringify:Y1},U1={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(U1.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),V=$[8];if(V&&V!=="Z"){let W=w2(V,!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$/,"")??""};BX.floatTime=VX;BX.intTime=WX;BX.timestamp=U1});var W1=N((wX)=>{var OX=t0(),FX=V$(),IX=r0(),AX=Fq(),TX=A2(),H1=X1(),C2=z1(),T$=G1(),MX=X$(),jX=j2(),RX=L$(),DX=N2(),E2=P2(),NX=[OX.map,IX.seq,AX.string,FX.nullTag,H1.trueTag,H1.falseTag,T$.intBin,T$.intOct,T$.int,T$.intHex,C2.floatNaN,C2.floatExp,C2.float,TX.binary,MX.merge,jX.omap,RX.pairs,DX.set,E2.intTime,E2.floatTime,E2.timestamp];wX.schema=NX});var T1=N((kX)=>{var _1=t0(),CX=V$(),L1=r0(),EX=Fq(),SX=V2(),S2=K2(),b2=L2(),bX=a4(),xX=i4(),O1=A2(),Mq=X$(),F1=j2(),I1=L$(),V1=W1(),A1=N2(),M$=P2(),B1=new Map([["core",bX.schema],["failsafe",[_1.map,L1.seq,EX.string]],["json",xX.schema],["yaml11",V1.schema],["yaml-1.1",V1.schema]]),K1={binary:O1.binary,bool:SX.boolTag,float:S2.float,floatExp:S2.floatExp,floatNaN:S2.floatNaN,floatTime:M$.floatTime,int:b2.int,intHex:b2.intHex,intOct:b2.intOct,intTime:M$.intTime,map:_1.map,merge:Mq.merge,null:CX.nullTag,omap:F1.omap,pairs:I1.pairs,seq:L1.seq,set:A1.set,timestamp:M$.timestamp},yX={"tag:yaml.org,2002:binary":O1.binary,"tag:yaml.org,2002:merge":Mq.merge,"tag:yaml.org,2002:omap":F1.omap,"tag:yaml.org,2002:pairs":I1.pairs,"tag:yaml.org,2002:set":A1.set,"tag:yaml.org,2002:timestamp":M$.timestamp};function fX(q,$,Z){let Q=B1.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(B1.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"?K1[J]:J;if(!G){let Y=JSON.stringify(J),H=Object.keys(K1).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${Y}; use one of ${H}`)}if(!z.includes(G))z.push(G);return z},[])}kX.coreKnownTags=yX;kX.getTags=fX});var f2=N((dX)=>{var x2=k(),gX=t0(),uX=r0(),mX=Fq(),j$=T1(),pX=(q,$)=>q.key<$.key?-1:q.key>$.key?1:0;class y2{constructor({compat:q,customTags:$,merge:Z,resolveKnownTags:Q,schema:X,sortMapEntries:z,toStringDefaults:J}){this.compat=Array.isArray(q)?j$.getTags(q,"compat"):q?j$.getTags(null,q):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?j$.coreKnownTags:{},this.tags=j$.getTags($,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,x2.MAP,{value:gX.map}),Object.defineProperty(this,x2.SCALAR,{value:mX.string}),Object.defineProperty(this,x2.SEQ,{value:uX.seq}),this.sortMapEntries=typeof z==="function"?z:z===!0?pX:null}clone(){let q=Object.create(y2.prototype,Object.getOwnPropertyDescriptors(this));return q.tags=this.tags.slice(),q}}dX.Schema=y2});var M1=N((aX)=>{var lX=k(),k2=Kq(),jq=Wq();function nX(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=k2.createStringifyContext(q,$),{commentString:z}=X.options;if(q.commentBefore){if(Z.length!==1)Z.unshift("");let Y=z(q.commentBefore);Z.unshift(jq.indentComment(Y,""))}let J=!1,G=null;if(q.contents){if(lX.isNode(q.contents)){if(q.contents.spaceBefore&&Q)Z.push("");if(q.contents.commentBefore){let V=z(q.contents.commentBefore);Z.push(jq.indentComment(V,""))}X.forceBlockIndent=!!q.comment,G=q.contents.comment}let Y=G?void 0:()=>J=!0,H=k2.stringify(q.contents,X,()=>G=null,Y);if(G)H+=jq.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(k2.stringify(q.contents,X));if(q.directives?.docEnd)if(q.comment){let Y=z(q.comment);if(Y.includes(`
|
|
55
|
+
${z.comment}`:Q.comment}Q=X}q.items[Z]=O$.isPair(Q)?Q:new j2.Pair(Q)}else $("Expected a sequence for this tag");return q}function r4(q,$,Z){let{replacer:Q}=Z,X=new EQ.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(j2.createPair(G,Y,Z))}return X}var SQ={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:t4,createNode:r4};bQ.createPairs=r4;bQ.pairs=SQ;bQ.resolvePairs=t4});var D2=N((hQ)=>{var e4=k(),R2=_0(),Aq=A0(),kQ=T0(),q1=F$();class S0 extends kQ.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=S0.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(e4.isPair(Q))X=R2.toJS(Q.key,"",$),z=R2.toJS(Q.value,X,$);else X=R2.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=q1.createPairs(q,$,Z),X=new this;return X.items=Q.items,X}}S0.tag="tag:yaml.org,2002:omap";var vQ={collection:"seq",identify:(q)=>q instanceof Map,nodeClass:S0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(q,$){let Z=q1.resolvePairs(q,$),Q=[];for(let{key:X}of Z.items)if(e4.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 S0,Z)},createNode:(q,$,Z)=>S0.from(q,$,Z)};hQ.YAMLOMap=S0;hQ.omap=vQ});var z1=N((mQ)=>{var $1=u();function Z1({value:q,source:$},Z){if($&&(q?Q1:X1).test.test($))return $;return q?Z.options.trueStr:Z.options.falseStr}var Q1={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 $1.Scalar(!0),stringify:Z1},X1={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 $1.Scalar(!1),stringify:Z1};mQ.falseTag=X1;mQ.trueTag=Q1});var J1=N((oQ)=>{var cQ=u(),N2=e0(),lQ={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:N2.stringifyNumber},nQ={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():N2.stringifyNumber(q)}},aQ={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(q){let $=new cQ.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:N2.stringifyNumber};oQ.float=aQ;oQ.floatExp=nQ;oQ.floatNaN=lQ});var Y1=N((ZX)=>{var G1=e0(),Tq=(q)=>typeof q==="bigint"||Number.isInteger(q);function I$(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 w2(q,$,Z){let{value:Q}=q;if(Tq(Q)){let X=Q.toString($);return Q<0?"-"+Z+X.substr(1):Z+X}return G1.stringifyNumber(q)}var rQ={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(q,$,Z)=>I$(q,2,2,Z),stringify:(q)=>w2(q,2,"0b")},eQ={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(q,$,Z)=>I$(q,1,8,Z),stringify:(q)=>w2(q,8,"0")},qX={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(q,$,Z)=>I$(q,0,10,Z),stringify:G1.stringifyNumber},$X={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(q,$,Z)=>I$(q,2,16,Z),stringify:(q)=>w2(q,16,"0x")};ZX.int=qX;ZX.intBin=rQ;ZX.intHex=$X;ZX.intOct=eQ});var P2=N((YX)=>{var M$=k(),A$=F0(),T$=A0();class b0 extends T$.YAMLMap{constructor(q){super(q);this.tag=b0.tag}add(q){let $;if(M$.isPair(q))$=q;else if(q&&typeof q==="object"&&"key"in q&&"value"in q&&q.value===null)$=new A$.Pair(q.key,null);else $=new A$.Pair(q,null);if(!T$.findPair(this.items,$.key))this.items.push($)}get(q,$){let Z=T$.findPair(this.items,q);return!$&&M$.isPair(Z)?M$.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=T$.findPair(this.items,q);if(Z&&!$)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&$)this.items.push(new A$.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(A$.createPair(z,null,Z))}return X}}b0.tag="tag:yaml.org,2002:set";var GX={collection:"map",identify:(q)=>q instanceof Set,nodeClass:b0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(q,$,Z)=>b0.from(q,$,Z),resolve(q,$){if(M$.isMap(q))if(q.hasAllNullValues(!0))return Object.assign(new b0,q);else $("Set items must all have null values");else $("Expected a mapping for this tag");return q}};YX.YAMLSet=b0;YX.set=GX});var E2=N((KX)=>{var WX=e0();function C2(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 U1(q){let{value:$}=q,Z=(J)=>J;if(typeof $==="bigint")Z=(J)=>BigInt(J);else if(isNaN($)||!isFinite($))return WX.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 VX={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})=>C2(q,Z),stringify:U1},BX={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)=>C2(q,!1),stringify:U1},H1={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(H1.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),V=$[8];if(V&&V!=="Z"){let W=C2(V,!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$/,"")??""};KX.floatTime=BX;KX.intTime=VX;KX.timestamp=H1});var V1=N((PX)=>{var FX=t0(),IX=K$(),AX=r0(),TX=Fq(),MX=M2(),W1=z1(),S2=J1(),j$=Y1(),jX=J$(),RX=D2(),DX=F$(),NX=P2(),b2=E2(),wX=[FX.map,AX.seq,TX.string,IX.nullTag,W1.trueTag,W1.falseTag,j$.intBin,j$.intOct,j$.int,j$.intHex,S2.floatNaN,S2.floatExp,S2.float,MX.binary,jX.merge,RX.omap,DX.pairs,NX.set,b2.intTime,b2.floatTime,b2.timestamp];PX.schema=wX});var M1=N((vX)=>{var L1=t0(),EX=K$(),O1=r0(),SX=Fq(),bX=K2(),x2=L2(),y2=F2(),xX=o4(),yX=s4(),F1=M2(),Mq=J$(),I1=D2(),A1=F$(),B1=V1(),T1=P2(),R$=E2(),K1=new Map([["core",xX.schema],["failsafe",[L1.map,O1.seq,SX.string]],["json",yX.schema],["yaml11",B1.schema],["yaml-1.1",B1.schema]]),_1={binary:F1.binary,bool:bX.boolTag,float:x2.float,floatExp:x2.floatExp,floatNaN:x2.floatNaN,floatTime:R$.floatTime,int:y2.int,intHex:y2.intHex,intOct:y2.intOct,intTime:R$.intTime,map:L1.map,merge:Mq.merge,null:EX.nullTag,omap:I1.omap,pairs:A1.pairs,seq:O1.seq,set:T1.set,timestamp:R$.timestamp},fX={"tag:yaml.org,2002:binary":F1.binary,"tag:yaml.org,2002:merge":Mq.merge,"tag:yaml.org,2002:omap":I1.omap,"tag:yaml.org,2002:pairs":A1.pairs,"tag:yaml.org,2002:set":T1.set,"tag:yaml.org,2002:timestamp":R$.timestamp};function kX(q,$,Z){let Q=K1.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(K1.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"?_1[J]:J;if(!G){let Y=JSON.stringify(J),H=Object.keys(_1).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${Y}; use one of ${H}`)}if(!z.includes(G))z.push(G);return z},[])}vX.coreKnownTags=fX;vX.getTags=kX});var v2=N((cX)=>{var f2=k(),uX=t0(),mX=r0(),pX=Fq(),D$=M1(),dX=(q,$)=>q.key<$.key?-1:q.key>$.key?1:0;class k2{constructor({compat:q,customTags:$,merge:Z,resolveKnownTags:Q,schema:X,sortMapEntries:z,toStringDefaults:J}){this.compat=Array.isArray(q)?D$.getTags(q,"compat"):q?D$.getTags(null,q):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?D$.coreKnownTags:{},this.tags=D$.getTags($,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,f2.MAP,{value:uX.map}),Object.defineProperty(this,f2.SCALAR,{value:pX.string}),Object.defineProperty(this,f2.SEQ,{value:mX.seq}),this.sortMapEntries=typeof z==="function"?z:z===!0?dX:null}clone(){let q=Object.create(k2.prototype,Object.getOwnPropertyDescriptors(this));return q.tags=this.tags.slice(),q}}cX.Schema=k2});var j1=N((oX)=>{var nX=k(),h2=Kq(),jq=Wq();function aX(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=h2.createStringifyContext(q,$),{commentString:z}=X.options;if(q.commentBefore){if(Z.length!==1)Z.unshift("");let Y=z(q.commentBefore);Z.unshift(jq.indentComment(Y,""))}let J=!1,G=null;if(q.contents){if(nX.isNode(q.contents)){if(q.contents.spaceBefore&&Q)Z.push("");if(q.contents.commentBefore){let V=z(q.contents.commentBefore);Z.push(jq.indentComment(V,""))}X.forceBlockIndent=!!q.comment,G=q.contents.comment}let Y=G?void 0:()=>J=!0,H=h2.stringify(q.contents,X,()=>G=null,Y);if(G)H+=jq.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(h2.stringify(q.contents,X));if(q.directives?.docEnd)if(q.comment){let Y=z(q.comment);if(Y.includes(`
|
|
56
56
|
`))Z.push("..."),Z.push(jq.indentComment(Y,""));else Z.push(`... ${Y}`)}else Z.push("...");else{let Y=q.comment;if(Y&&J)Y=Y.replace(/^\n+/,"");if(Y){if((!J||G)&&Z[Z.length-1]!=="")Z.push("");Z.push(jq.indentComment(z(Y),""))}}return Z.join(`
|
|
57
57
|
`)+`
|
|
58
|
-
`}
|
|
58
|
+
`}oX.stringifyDocument=aX});var Rq=N((Qz)=>{var sX=Uq(),qq=q$(),r=k(),tX=F0(),rX=_0(),eX=v2(),qz=j1(),g2=tq(),$z=X2(),Zz=Hq(),u2=Q2();class m2{constructor(q,$,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let Q=null;if(typeof $==="function"||Array.isArray($))Q=$;else if(Z===void 0&&$)Z=$,$=void 0;let X=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=X;let{version:z}=X;if(Z?._directives){if(this.directives=Z._directives.atDocument(),this.directives.yaml.explicit)z=this.directives.yaml.version}else this.directives=new u2.Directives({version:z});this.setSchema(z,Z),this.contents=q===void 0?null:this.createNode(q,Q,Z)}clone(){let q=Object.create(m2.prototype,{[r.NODE_TYPE]:{value:r.DOC}});if(q.commentBefore=this.commentBefore,q.comment=this.comment,q.errors=this.errors.slice(),q.warnings=this.warnings.slice(),q.options=Object.assign({},this.options),this.directives)q.directives=this.directives.clone();if(q.schema=this.schema.clone(),q.contents=r.isNode(this.contents)?this.contents.clone(q.schema):this.contents,this.range)q.range=this.range.slice();return q}add(q){if($q(this.contents))this.contents.add(q)}addIn(q,$){if($q(this.contents))this.contents.addIn(q,$)}createAlias(q,$){if(!q.anchor){let Z=g2.anchorNames(this);q.anchor=!$||Z.has($)?g2.findNewAnchor($||"a",Z):$}return new sX.Alias(q.anchor)}createNode(q,$,Z){let Q=void 0;if(typeof $==="function")q=$.call({"":q},"",q),Q=$;else if(Array.isArray($)){let K=(F)=>typeof F==="number"||F instanceof String||F instanceof Number,O=$.filter(K).map(String);if(O.length>0)$=$.concat(O);Q=$}else if(Z===void 0&&$)Z=$,$=void 0;let{aliasDuplicateObjects:X,anchorPrefix:z,flow:J,keepUndefined:G,onTagObj:Y,tag:H}=Z??{},{onAnchor:V,setAnchors:W,sourceObjects:B}=g2.createNodeAnchors(this,z||"a"),_={aliasDuplicateObjects:X??!0,keepUndefined:G??!1,onAnchor:V,onTagObj:Y,replacer:Q,schema:this.schema,sourceObjects:B},L=Zz.createNode(q,H,_);if(J&&r.isCollection(L))L.flow=!0;return W(),L}createPair(q,$,Z={}){let Q=this.createNode(q,null,Z),X=this.createNode($,null,Z);return new tX.Pair(Q,X)}delete(q){return $q(this.contents)?this.contents.delete(q):!1}deleteIn(q){if(qq.isEmptyPath(q)){if(this.contents==null)return!1;return this.contents=null,!0}return $q(this.contents)?this.contents.deleteIn(q):!1}get(q,$){return r.isCollection(this.contents)?this.contents.get(q,$):void 0}getIn(q,$){if(qq.isEmptyPath(q))return!$&&r.isScalar(this.contents)?this.contents.value:this.contents;return r.isCollection(this.contents)?this.contents.getIn(q,$):void 0}has(q){return r.isCollection(this.contents)?this.contents.has(q):!1}hasIn(q){if(qq.isEmptyPath(q))return this.contents!==void 0;return r.isCollection(this.contents)?this.contents.hasIn(q):!1}set(q,$){if(this.contents==null)this.contents=qq.collectionFromPath(this.schema,[q],$);else if($q(this.contents))this.contents.set(q,$)}setIn(q,$){if(qq.isEmptyPath(q))this.contents=$;else if(this.contents==null)this.contents=qq.collectionFromPath(this.schema,Array.from(q),$);else if($q(this.contents))this.contents.setIn(q,$)}setSchema(q,$={}){if(typeof q==="number")q=String(q);let Z;switch(q){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new u2.Directives({version:"1.1"});Z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=q;else this.directives=new u2.Directives({version:q});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let Q=JSON.stringify(q);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Q}`)}}if($.schema instanceof Object)this.schema=$.schema;else if(Z)this.schema=new eX.Schema(Object.assign(Z,$));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:q,jsonArg:$,mapAsMap:Z,maxAliasCount:Q,onAnchor:X,reviver:z}={}){let J={anchors:new Map,doc:this,keep:!q,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},G=rX.toJS(this.contents,$??"",J);if(typeof X==="function")for(let{count:Y,res:H}of J.anchors.values())X(H,Y);return typeof z==="function"?$z.applyReviver(z,{"":G},"",G):G}toJSON(q,$){return this.toJS({json:!0,jsonArg:q,mapAsMap:!1,onAnchor:$})}toString(q={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in q&&(!Number.isInteger(q.indent)||Number(q.indent)<=0)){let $=JSON.stringify(q.indent);throw Error(`"indent" option must be a positive integer, not ${$}`)}return qz.stringifyDocument(this,q)}}function $q(q){if(r.isCollection(q))return!0;throw Error("Expected a YAML collection as document contents")}Qz.Document=m2});var Dq=N((Jz)=>{class N$ extends Error{constructor(q,$,Z,Q){super();this.name=q,this.code=Z,this.message=Q,this.pos=$}}class R1 extends N${constructor(q,$,Z){super("YAMLParseError",q,$,Z)}}class D1 extends N${constructor(q,$,Z){super("YAMLWarning",q,$,Z)}}var zz=(q,$)=>(Z)=>{if(Z.pos[0]===-1)return;Z.linePos=Z.pos.map((G)=>$.linePos(G));let{line:Q,col:X}=Z.linePos[0];Z.message+=` at line ${Q}, column ${X}`;let z=X-1,J=q.substring($.lineStarts[Q-1],$.lineStarts[Q]).replace(/[\n\r]+$/,"");if(z>=60&&J.length>80){let G=Math.min(z-39,J.length-79);J="…"+J.substring(G),z-=G-1}if(J.length>80)J=J.substring(0,79)+"…";if(Q>1&&/^ *$/.test(J.substring(0,z))){let G=q.substring($.lineStarts[Q-2],$.lineStarts[Q-1]);if(G.length>80)G=G.substring(0,79)+`…
|
|
59
59
|
`;J=G+J}if(/[^ ]/.test(J)){let G=1,Y=Z.linePos[1];if(Y?.line===Q&&Y.col>X)G=Math.max(1,Math.min(Y.col-X,80-z));let H=" ".repeat(z)+"^".repeat(G);Z.message+=`:
|
|
60
60
|
|
|
61
61
|
${J}
|
|
62
62
|
${H}
|
|
63
|
-
`}};
|
|
64
|
-
`))return!0;if(q.end){for(let $ of q.end)if($.type==="newline")return!0}return!1;case"flow-collection":for(let $ of q.items){for(let Z of $.start)if(Z.type==="newline")return!0;if($.sep){for(let Z of $.sep)if(Z.type==="newline")return!0}if(
|
|
65
|
-
`+K.comment;else G.comment=K.comment;continue}if(K.newlineAfterProp||
|
|
66
|
-
`+M.comment;else A.comment=M.comment;let R=new
|
|
67
|
-
`+D.comment;else H.comment=D.comment;W=D.end;continue}if(!J&&Z.options.strict&&
|
|
68
|
-
`+x;else w.comment=x;D.comment=D.comment.substring(x.length+1)}}}if(!J&&!R&&!D.found){let x=T?q(Z,T,D,X):$(Z,D.end,R,null,D,X);if(H.items.push(x),W=x.range[2],
|
|
69
|
-
`+f.comment;else w.comment=f.comment;let j=new
|
|
70
|
-
`+O.comment;else H.comment=O.comment;H.range=[Q.offset,K,O.offset]}else H.range=[Q.offset,K,K];return H}
|
|
63
|
+
`}};Jz.YAMLError=N$;Jz.YAMLParseError=R1;Jz.YAMLWarning=D1;Jz.prettifyError=zz});var Nq=N((Vz)=>{function Wz(q,{flow:$,indicator:Z,next:Q,offset:X,onError:z,parentIndent:J,startOnNewline:G}){let Y=!1,H=G,V=G,W="",B="",_=!1,L=!1,K=null,O=null,F=null,A=null,M=null,R=null,T=null;for(let w of q){if(L){if(w.type!=="space"&&w.type!=="newline"&&w.type!=="comma")z(w.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(K){if(H&&w.type!=="comment"&&w.type!=="newline")z(K,"TAB_AS_INDENT","Tabs are not allowed as indentation");K=null}switch(w.type){case"space":if(!$&&(Z!=="doc-start"||Q?.type!=="flow-collection")&&w.source.includes("\t"))K=w;V=!0;break;case"comment":{if(!V)z(w,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=w.source.substring(1)||" ";if(!W)W=f;else W+=B+f;B="",H=!1;break}case"newline":if(H){if(W)W+=w.source;else if(!R||Z!=="seq-item-ind")Y=!0}else B+=w.source;if(H=!0,_=!0,O||F)A=w;V=!0;break;case"anchor":if(O)z(w,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(w.source.endsWith(":"))z(w.offset+w.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);O=w,T??(T=w.offset),H=!1,V=!1,L=!0;break;case"tag":{if(F)z(w,"MULTIPLE_TAGS","A node can have at most one tag");F=w,T??(T=w.offset),H=!1,V=!1,L=!0;break}case Z:if(O||F)z(w,"BAD_PROP_ORDER",`Anchors and tags must be after the ${w.source} indicator`);if(R)z(w,"UNEXPECTED_TOKEN",`Unexpected ${w.source} in ${$??"collection"}`);R=w,H=Z==="seq-item-ind"||Z==="explicit-key-ind",V=!1;break;case"comma":if($){if(M)z(w,"UNEXPECTED_TOKEN",`Unexpected , in ${$}`);M=w,H=!1,V=!1;break}default:z(w,"UNEXPECTED_TOKEN",`Unexpected ${w.type} token`),H=!1,V=!1}}let D=q[q.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&&(H&&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:R,spaceBefore:Y,comment:W,hasNewline:_,anchor:O,tag:F,newlineAfterProp:A,end:x,start:T??x}}Vz.resolveProps=Wz});var w$=N((Kz)=>{function p2(q){if(!q)return null;switch(q.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(q.source.includes(`
|
|
64
|
+
`))return!0;if(q.end){for(let $ of q.end)if($.type==="newline")return!0}return!1;case"flow-collection":for(let $ of q.items){for(let Z of $.start)if(Z.type==="newline")return!0;if($.sep){for(let Z of $.sep)if(Z.type==="newline")return!0}if(p2($.key)||p2($.value))return!0}return!1;default:return!0}}Kz.containsNewline=p2});var d2=N((Fz)=>{var Lz=w$();function Oz(q,$,Z){if($?.type==="flow-collection"){let Q=$.end[0];if(Q.indent===q&&(Q.source==="]"||Q.source==="}")&&Lz.containsNewline($))Z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Fz.flowIndentCheck=Oz});var c2=N((Tz)=>{var N1=k();function Az(q,$,Z){let{uniqueKeys:Q}=q.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(z,J)=>z===J||N1.isScalar(z)&&N1.isScalar(J)&&z.value===J.value;return $.some((z)=>X(z.key,Z))}Tz.mapIncludes=Az});var S1=N((wz)=>{var w1=F0(),jz=A0(),P1=Nq(),Rz=w$(),C1=d2(),Dz=c2(),E1="All mapping items must start at the same column";function Nz({composeNode:q,composeEmptyNode:$},Z,Q,X,z){let G=new(z?.nodeClass??jz.YAMLMap)(Z.schema);if(Z.atRoot)Z.atRoot=!1;let Y=Q.offset,H=null;for(let V of Q.items){let{start:W,key:B,sep:_,value:L}=V,K=P1.resolveProps(W,{indicator:"explicit-key-ind",next:B??_?.[0],offset:Y,onError:X,parentIndent:Q.indent,startOnNewline:!0}),O=!K.found;if(O){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",E1)}if(!K.anchor&&!K.tag&&!_){if(H=K.end,K.comment)if(G.comment)G.comment+=`
|
|
65
|
+
`+K.comment;else G.comment=K.comment;continue}if(K.newlineAfterProp||Rz.containsNewline(B))X(B??W[W.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",E1);Z.atKey=!0;let F=K.end,A=B?q(Z,B,K,X):$(Z,F,W,null,K,X);if(Z.schema.compat)C1.flowIndentCheck(Q.indent,B,X);if(Z.atKey=!1,Dz.mapIncludes(Z,G.items,A))X(F,"DUPLICATE_KEY","Map keys must be unique");let M=P1.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(O){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 R=L?q(Z,L,M,X):$(Z,Y,_,null,M,X);if(Z.schema.compat)C1.flowIndentCheck(Q.indent,L,X);Y=R.range[2];let T=new w1.Pair(A,R);if(Z.options.keepSourceTokens)T.srcToken=V;G.items.push(T)}else{if(O)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 R=new w1.Pair(A);if(Z.options.keepSourceTokens)R.srcToken=V;G.items.push(R)}}if(H&&H<Y)X(H,"IMPOSSIBLE","Map comment with trailing content");return G.range=[Q.offset,Y,H??Y],G}wz.resolveBlockMap=Nz});var b1=N((xz)=>{var Cz=T0(),Ez=Nq(),Sz=d2();function bz({composeNode:q,composeEmptyNode:$},Z,Q,X,z){let G=new(z?.nodeClass??Cz.YAMLSeq)(Z.schema);if(Z.atRoot)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let Y=Q.offset,H=null;for(let{start:V,value:W}of Q.items){let B=Ez.resolveProps(V,{indicator:"seq-item-ind",next:W,offset:Y,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!B.found)if(B.anchor||B.tag||W)if(W?.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(H=B.end,B.comment)G.comment=B.comment;continue}let _=W?q(Z,W,B,X):$(Z,B.end,V,null,B,X);if(Z.schema.compat)Sz.flowIndentCheck(Q.indent,W,X);Y=_.range[2],G.items.push(_)}return G.range=[Q.offset,Y,H??Y],G}xz.resolveBlockSeq=bz});var Zq=N((kz)=>{function fz(q,$,Z,Q){let X="";if(q){let z=!1,J="";for(let G of q){let{source:Y,type:H}=G;switch(H){case"space":z=!0;break;case"comment":{if(Z&&!z)Q(G,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let 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 ${H} at node end`)}$+=Y.length}}return{comment:X,offset:$}}kz.resolveEnd=fz});var f1=N((lz)=>{var hz=k(),gz=F0(),x1=A0(),uz=T0(),mz=Zq(),y1=Nq(),pz=w$(),dz=c2(),l2="Block collections are not allowed within flow collections",n2=(q)=>q&&(q.type==="block-map"||q.type==="block-seq");function cz({composeNode:q,composeEmptyNode:$},Z,Q,X,z){let J=Q.start.source==="{",G=J?"flow map":"flow sequence",H=new(z?.nodeClass??(J?x1.YAMLMap:uz.YAMLSeq))(Z.schema);H.flow=!0;let V=Z.atRoot;if(V)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let W=Q.offset+Q.start.source.length;for(let O=0;O<Q.items.length;++O){let F=Q.items[O],{start:A,key:M,sep:R,value:T}=F,D=y1.resolveProps(A,{flow:G,indicator:"explicit-key-ind",next:M??R?.[0],offset:W,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!D.found){if(!D.anchor&&!D.tag&&!R&&!T){if(O===0&&D.comma)X(D.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${G}`);else if(O<Q.items.length-1)X(D.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${G}`);if(D.comment)if(H.comment)H.comment+=`
|
|
67
|
+
`+D.comment;else H.comment=D.comment;W=D.end;continue}if(!J&&Z.options.strict&&pz.containsNewline(M))X(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(O===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="";q:for(let w of A)switch(w.type){case"comma":case"space":break;case"comment":x=w.source.substring(1);break q;default:break q}if(x){let w=H.items[H.items.length-1];if(hz.isPair(w))w=w.value??w.key;if(w.comment)w.comment+=`
|
|
68
|
+
`+x;else w.comment=x;D.comment=D.comment.substring(x.length+1)}}}if(!J&&!R&&!D.found){let x=T?q(Z,T,D,X):$(Z,D.end,R,null,D,X);if(H.items.push(x),W=x.range[2],n2(T))X(x.range,"BLOCK_IN_FLOW",l2)}else{Z.atKey=!0;let x=D.end,w=M?q(Z,M,D,X):$(Z,x,A,null,D,X);if(n2(M))X(w.range,"BLOCK_IN_FLOW",l2);Z.atKey=!1;let f=y1.resolveProps(R??[],{flow:G,indicator:"map-value-ind",next:T,offset:w.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(f.found){if(!J&&!D.found&&Z.options.strict){if(R)for(let C of R){if(C===f.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<f.found.offset-1024)X(f.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(f.start,"MISSING_CHAR",`Missing , or : between ${G} items`);let I=T?q(Z,T,f,X):f.found?$(Z,f.end,R,null,f,X):null;if(I){if(n2(T))X(I.range,"BLOCK_IN_FLOW",l2)}else if(f.comment)if(w.comment)w.comment+=`
|
|
69
|
+
`+f.comment;else w.comment=f.comment;let j=new gz.Pair(w,I);if(Z.options.keepSourceTokens)j.srcToken=F;if(J){let C=H;if(dz.mapIncludes(Z,C.items,w))X(x,"DUPLICATE_KEY","Map keys must be unique");C.items.push(j)}else{let C=new x1.YAMLMap(Z.schema);C.flow=!0,C.items.push(j);let S=(I??w).range;C.range=[w.range[0],S[1],S[2]],H.items.push(C)}W=I?I.range[2]:f.end}}let B=J?"}":"]",[_,...L]=Q.end,K=W;if(_?.source===B)K=_.offset+_.source.length;else{let O=G[0].toUpperCase()+G.substring(1),F=V?`${O} must end with a ${B}`:`${O} in block collection must be sufficiently indented and end with a ${B}`;if(X(W,V?"MISSING_CHAR":"BAD_INDENT",F),_&&_.source.length!==1)L.unshift(_)}if(L.length>0){let O=mz.resolveEnd(L,K,Z.options.strict,X);if(O.comment)if(H.comment)H.comment+=`
|
|
70
|
+
`+O.comment;else H.comment=O.comment;H.range=[Q.offset,K,O.offset]}else H.range=[Q.offset,K,K];return H}lz.resolveFlowCollection=cz});var k1=N(($J)=>{var az=k(),oz=u(),iz=A0(),sz=T0(),tz=S1(),rz=b1(),ez=f1();function a2(q,$,Z,Q,X,z){let J=Z.type==="block-map"?tz.resolveBlockMap(q,$,Z,Q,z):Z.type==="block-seq"?rz.resolveBlockSeq(q,$,Z,Q,z):ez.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 qJ(q,$,Z,Q,X){let z=Q.tag,J=!z?null:$.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===iz.YAMLMap.tagName&&G==="map"||J===sz.YAMLSeq.tagName&&G==="seq")return a2(q,$,Z,X,J);let Y=$.schema.tags.find((B)=>B.tag===J&&B.collection===G);if(!Y){let B=$.schema.knownTags[J];if(B?.collection===G)$.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 a2(q,$,Z,X,J)}}let H=a2(q,$,Z,X,J,Y),V=Y.resolve?.(H,(B)=>X(z,"TAG_RESOLVE_FAILED",B),$.options)??H,W=az.isNode(V)?V:new oz.Scalar(V);if(W.range=H.range,W.tag=J,Y?.format)W.format=Y.format;return W}$J.composeCollection=qJ});var i2=N((JJ)=>{var o2=u();function QJ(q,$,Z){let Q=$.offset,X=XJ($,q.options.strict,Z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let z=X.mode===">"?o2.Scalar.BLOCK_FOLDED:o2.Scalar.BLOCK_LITERAL,J=$.source?zJ($.source):[],G=J.length;for(let K=J.length-1;K>=0;--K){let O=J[K][1];if(O===""||O==="\r")G=K;else break}if(G===0){let K=X.chomp==="+"&&J.length>0?`
|
|
71
71
|
`.repeat(Math.max(1,J.length-1)):"",O=Q+X.length;if($.source)O+=$.source.length;return{value:K,type:z,comment:X.comment,range:[Q,O,O]}}let Y=$.indent+X.indent,H=$.offset+X.length,V=0;for(let K=0;K<G;++K){let[O,F]=J[K];if(F===""||F==="\r"){if(X.indent===0&&O.length>Y)Y=O.length}else{if(O.length<Y)Z(H+O.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)Y=O.length;if(V=K,Y===0&&!q.atRoot)Z(H,"BAD_INDENT","Block scalar values in collections must be indented");break}H+=O.length+F.length+1}for(let K=J.length-1;K>=G;--K)if(J[K][0].length>Y)G=K+1;let W="",B="",_=!1;for(let K=0;K<V;++K)W+=J[K][0].slice(Y)+`
|
|
72
|
-
`;for(let K=V;K<G;++K){let[O,F]=J[K];H+=O.length+F.length+1;let A=F[F.length-1]==="\r";if(A)F=F.slice(0,-1);if(F&&O.length<Y){let R=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;Z(H-F.length-(A?2:1),"BAD_INDENT",R),O=""}if(z===
|
|
72
|
+
`;for(let K=V;K<G;++K){let[O,F]=J[K];H+=O.length+F.length+1;let A=F[F.length-1]==="\r";if(A)F=F.slice(0,-1);if(F&&O.length<Y){let R=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;Z(H-F.length-(A?2:1),"BAD_INDENT",R),O=""}if(z===o2.Scalar.BLOCK_LITERAL)W+=B+O.slice(Y)+F,B=`
|
|
73
73
|
`;else if(O.length>Y||F[0]==="\t"){if(B===" ")B=`
|
|
74
74
|
`;else if(!_&&B===`
|
|
75
75
|
`)B=`
|
|
@@ -82,83 +82,83 @@ ${H}
|
|
|
82
82
|
`+J[K][0].slice(Y);if(W[W.length-1]!==`
|
|
83
83
|
`)W+=`
|
|
84
84
|
`;break;default:W+=`
|
|
85
|
-
`}let L=Q+X.length+$.source.length;return{value:W,type:z,comment:X.comment,range:[Q,L,L]}}function
|
|
85
|
+
`}let L=Q+X.length+$.source.length;return{value:W,type:z,comment:X.comment,range:[Q,L,L]}}function XJ({offset:q,props:$},Z,Q){if($[0].type!=="block-scalar-header")return Q($[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=$[0],z=X[0],J=0,G="",Y=-1;for(let 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=q+B}}if(Y!==-1)Q(Y,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let H=!1,V="",W=X.length;for(let B=1;B<$.length;++B){let _=$[B];switch(_.type){case"space":H=!0;case"newline":W+=_.source.length;break;case"comment":if(Z&&!H)Q(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");W+=_.source.length,V=_.source.substring(1);break;case"error":Q(_,"UNEXPECTED_TOKEN",_.message),W+=_.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")W+=K.length}}}return{mode:z,indent:J,chomp:G,comment:V,length:W}}function zJ(q){let $=q.split(/\n( *)/),Z=$[0],Q=Z.match(/^( *)/),z=[Q?.[1]?[Q[1],Z.slice(Q[1].length)]:["",Z]];for(let J=1;J<$.length;J+=2)z.push([$[J],$[J+1]]);return z}JJ.resolveBlockScalar=QJ});var t2=N((LJ)=>{var s2=u(),YJ=Zq();function UJ(q,$,Z){let{offset:Q,type:X,source:z,end:J}=q,G,Y,H=(B,_,L)=>Z(Q+B,_,L);switch(X){case"scalar":G=s2.Scalar.PLAIN,Y=HJ(z,H);break;case"single-quoted-scalar":G=s2.Scalar.QUOTE_SINGLE,Y=WJ(z,H);break;case"double-quoted-scalar":G=s2.Scalar.QUOTE_DOUBLE,Y=VJ(z,H);break;default:return Z(q,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${X}`),{value:"",type:null,comment:"",range:[Q,Q+z.length,Q+z.length]}}let V=Q+z.length,W=YJ.resolveEnd(J,V,$,Z);return{value:Y,type:G,comment:W.comment,range:[Q,V,W.offset]}}function HJ(q,$){let Z="";switch(q[0]){case"\t":Z="a tab character";break;case",":Z="flow indicator character ,";break;case"%":Z="directive indicator character %";break;case"|":case">":{Z=`block scalar indicator ${q[0]}`;break}case"@":case"`":{Z=`reserved character ${q[0]}`;break}}if(Z)$(0,"BAD_SCALAR_START",`Plain value cannot start with ${Z}`);return v1(q)}function WJ(q,$){if(q[q.length-1]!=="'"||q.length===1)$(q.length,"MISSING_CHAR","Missing closing 'quote");return v1(q.slice(1,-1)).replace(/''/g,"'")}function v1(q){let $,Z;try{$=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
86
|
`,"sy"),Z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
87
|
`,"sy")}catch{$=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Q=$.exec(q);if(!Q)return q;let X=Q[1],z=" ",J=$.lastIndex;Z.lastIndex=J;while(Q=Z.exec(q)){if(Q[1]==="")if(z===`
|
|
88
88
|
`)X+=z;else z=`
|
|
89
|
-
`;else X+=z+Q[1],z=" ";J=Z.lastIndex}let G=/[ \t]*(.*)/sy;return G.lastIndex=J,Q=G.exec(q),X+z+(Q?.[1]??"")}function
|
|
89
|
+
`;else X+=z+Q[1],z=" ";J=Z.lastIndex}let G=/[ \t]*(.*)/sy;return G.lastIndex=J,Q=G.exec(q),X+z+(Q?.[1]??"")}function VJ(q,$){let Z="";for(let Q=1;Q<q.length-1;++Q){let X=q[Q];if(X==="\r"&&q[Q+1]===`
|
|
90
90
|
`)continue;if(X===`
|
|
91
|
-
`){let{fold:z,offset:J}=
|
|
91
|
+
`){let{fold:z,offset:J}=BJ(q,Q);Z+=z,Q=J}else if(X==="\\"){let z=q[++Q],J=KJ[z];if(J)Z+=J;else if(z===`
|
|
92
92
|
`){z=q[Q+1];while(z===" "||z==="\t")z=q[++Q+1]}else if(z==="\r"&&q[Q+1]===`
|
|
93
|
-
`){z=q[++Q+1];while(z===" "||z==="\t")z=q[++Q+1]}else if(z==="x"||z==="u"||z==="U"){let G={x:2,u:4,U:8}[z];Z+=
|
|
93
|
+
`){z=q[++Q+1];while(z===" "||z==="\t")z=q[++Q+1]}else if(z==="x"||z==="u"||z==="U"){let G={x:2,u:4,U:8}[z];Z+=_J(q,Q+1,G,$),Q+=G}else{let G=q.substr(Q-1,2);$(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),Z+=G}}else if(X===" "||X==="\t"){let z=Q,J=q[Q+1];while(J===" "||J==="\t")J=q[++Q+1];if(J!==`
|
|
94
94
|
`&&!(J==="\r"&&q[Q+2]===`
|
|
95
|
-
`))Z+=Q>z?q.slice(z,Q+1):X}else Z+=X}if(q[q.length-1]!=='"'||q.length===1)$(q.length,"MISSING_CHAR",'Missing closing "quote');return Z}function
|
|
95
|
+
`))Z+=Q>z?q.slice(z,Q+1):X}else Z+=X}if(q[q.length-1]!=='"'||q.length===1)$(q.length,"MISSING_CHAR",'Missing closing "quote');return Z}function BJ(q,$){let Z="",Q=q[$+1];while(Q===" "||Q==="\t"||Q===`
|
|
96
96
|
`||Q==="\r"){if(Q==="\r"&&q[$+2]!==`
|
|
97
97
|
`)break;if(Q===`
|
|
98
98
|
`)Z+=`
|
|
99
|
-
`;$+=1,Q=q[$+1]}if(!Z)Z=" ";return{fold:Z,offset:$}}var
|
|
100
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
99
|
+
`;$+=1,Q=q[$+1]}if(!Z)Z=" ";return{fold:Z,offset:$}}var KJ={"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 _J(q,$,Z,Q){let X=q.substr($,Z),J=X.length===Z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;if(isNaN(J)){let G=q.substr($-2,Z+2);return Q($-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${G}`),G}return String.fromCodePoint(J)}LJ.resolveFlowScalar=UJ});var g1=N((jJ)=>{var x0=k(),h1=u(),FJ=i2(),IJ=t2();function AJ(q,$,Z,Q){let{value:X,type:z,comment:J,range:G}=$.type==="block-scalar"?FJ.resolveBlockScalar(q,$,Q):IJ.resolveFlowScalar($,q.options.strict,Q),Y=Z?q.directives.tagName(Z.source,(W)=>Q(Z,"TAG_RESOLVE_FAILED",W)):null,H;if(q.options.stringKeys&&q.atKey)H=q.schema[x0.SCALAR];else if(Y)H=TJ(q.schema,X,Y,Z,Q);else if($.type==="scalar")H=MJ(q,X,$,Q);else H=q.schema[x0.SCALAR];let V;try{let W=H.resolve(X,(B)=>Q(Z??$,"TAG_RESOLVE_FAILED",B),q.options);V=x0.isScalar(W)?W:new h1.Scalar(W)}catch(W){let B=W instanceof Error?W.message:String(W);Q(Z??$,"TAG_RESOLVE_FAILED",B),V=new h1.Scalar(X)}if(V.range=G,V.source=X,z)V.type=z;if(Y)V.tag=Y;if(H.format)V.format=H.format;if(J)V.comment=J;return V}function TJ(q,$,Z,Q,X){if(Z==="!")return q[x0.SCALAR];let z=[];for(let G of q.tags)if(!G.collection&&G.tag===Z)if(G.default&&G.test)z.push(G);else return G;for(let G of z)if(G.test?.test($))return G;let J=q.knownTags[Z];if(J&&!J.collection)return q.tags.push(Object.assign({},J,{default:!1,test:void 0})),J;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Z}`,Z!=="tag:yaml.org,2002:str"),q[x0.SCALAR]}function MJ({atKey:q,directives:$,schema:Z},Q,X,z){let J=Z.tags.find((G)=>(G.default===!0||q&&G.default==="key")&&G.test?.test(Q))||Z[x0.SCALAR];if(Z.compat){let G=Z.compat.find((Y)=>Y.default&&Y.test?.test(Q))??Z[x0.SCALAR];if(J.tag!==G.tag){let Y=$.tagString(J.tag),H=$.tagString(G.tag),V=`Value may be parsed as either ${Y} or ${H}`;z(X,"TAG_RESOLVE_FAILED",V,!0)}}return J}jJ.composeScalar=AJ});var u1=N((NJ)=>{function DJ(q,$,Z){if($){Z??(Z=$.length);for(let Q=Z-1;Q>=0;--Q){let X=$[Q];switch(X.type){case"space":case"comment":case"newline":q-=X.source.length;continue}X=$[++Q];while(X?.type==="space")q+=X.source.length,X=$[++Q];break}}return q}NJ.emptyScalarPosition=DJ});var d1=N((fJ)=>{var PJ=Uq(),CJ=k(),EJ=k1(),m1=g1(),SJ=Zq(),bJ=u1(),xJ={composeNode:p1,composeEmptyNode:r2};function p1(q,$,Z,Q){let X=q.atKey,{spaceBefore:z,comment:J,anchor:G,tag:Y}=Z,H,V=!0;switch($.type){case"alias":if(H=yJ(q,$,Q),G||Y)Q($,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(H=m1.composeScalar(q,$,Y,Q),G)H.anchor=G.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(H=EJ.composeCollection(xJ,q,$,Z,Q),G)H.anchor=G.source.substring(1)}catch(W){let B=W instanceof Error?W.message:String(W);Q($,"RESOURCE_EXHAUSTION",B)}break;default:{let W=$.type==="error"?$.message:`Unsupported token (type: ${$.type})`;Q($,"UNEXPECTED_TOKEN",W),V=!1}}if(H??(H=r2(q,$.offset,void 0,null,Z,Q)),G&&H.anchor==="")Q(G,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&q.options.stringKeys&&(!CJ.isScalar(H)||typeof H.value!=="string"||H.tag&&H.tag!=="tag:yaml.org,2002:str"))Q(Y??$,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(z)H.spaceBefore=!0;if(J)if($.type==="scalar"&&$.source==="")H.comment=J;else H.commentBefore=J;if(q.options.keepSourceTokens&&V)H.srcToken=$;return H}function r2(q,$,Z,Q,{spaceBefore:X,comment:z,anchor:J,tag:G,end:Y},H){let V={type:"scalar",offset:bJ.emptyScalarPosition($,Z,Q),indent:-1,source:""},W=m1.composeScalar(q,V,G,H);if(J){if(W.anchor=J.source.substring(1),W.anchor==="")H(J,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)W.spaceBefore=!0;if(z)W.comment=z,W.range[2]=Y;return W}function yJ({options:q},{offset:$,source:Z,end:Q},X){let z=new PJ.Alias(Z.substring(1));if(z.source==="")X($,"BAD_ALIAS","Alias cannot be an empty string");if(z.source.endsWith(":"))X($+Z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let J=$+Z.length,G=SJ.resolveEnd(Q,J,q.strict,X);if(z.range=[$,J,G.offset],G.comment)z.comment=G.comment;return z}fJ.composeEmptyNode=r2;fJ.composeNode=p1});var l1=N((pJ)=>{var hJ=Rq(),c1=d1(),gJ=Zq(),uJ=Nq();function mJ(q,$,{offset:Z,start:Q,value:X,end:z},J){let G=Object.assign({_directives:$},q),Y=new hJ.Document(void 0,G),H={atKey:!1,atRoot:!0,directives:Y.directives,options:Y.options,schema:Y.schema},V=uJ.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?c1.composeNode(H,X,V,J):c1.composeEmptyNode(H,V.end,Q,null,V,J);let W=Y.contents.range[2],B=gJ.resolveEnd(z,W,!1,J);if(B.comment)Y.comment=B.comment;return Y.range=[Z,W,B.offset],Y}pJ.composeDoc=mJ});var e2=N((iJ)=>{var cJ=v("process"),lJ=Q2(),nJ=Rq(),wq=Dq(),n1=k(),aJ=l1(),oJ=Zq();function Pq(q){if(typeof q==="number")return[q,q+1];if(Array.isArray(q))return q.length===2?q:[q[0],q[1]];let{offset:$,source:Z}=q;return[$,$+(typeof Z==="string"?Z.length:1)]}function a1(q){let $="",Z=!1,Q=!1;for(let X=0;X<q.length;++X){let z=q[X];switch(z[0]){case"#":$+=($===""?"":Q?`
|
|
101
101
|
|
|
102
102
|
`:`
|
|
103
|
-
`)+(z.substring(1)||" "),Z=!0,Q=!1;break;case"%":if(q[X+1]?.[0]!=="#")X+=1;Z=!1;break;default:if(!Z)Q=!0;Z=!1}}return{comment:$,afterEmptyLine:Q}}class
|
|
104
|
-
${Z}`:Z;else if(Q||q.directives.docStart||!X)q.commentBefore=Z;else if(
|
|
103
|
+
`)+(z.substring(1)||" "),Z=!0,Q=!1;break;case"%":if(q[X+1]?.[0]!=="#")X+=1;Z=!1;break;default:if(!Z)Q=!0;Z=!1}}return{comment:$,afterEmptyLine:Q}}class o1{constructor(q={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=($,Z,Q,X)=>{let z=Pq($);if(X)this.warnings.push(new wq.YAMLWarning(z,Z,Q));else this.errors.push(new wq.YAMLParseError(z,Z,Q))},this.directives=new lJ.Directives({version:q.version||"1.2"}),this.options=q}decorate(q,$){let{comment:Z,afterEmptyLine:Q}=a1(this.prelude);if(Z){let X=q.contents;if($)q.comment=q.comment?`${q.comment}
|
|
104
|
+
${Z}`:Z;else if(Q||q.directives.docStart||!X)q.commentBefore=Z;else if(n1.isCollection(X)&&!X.flow&&X.items.length>0){let z=X.items[0];if(n1.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($)Array.prototype.push.apply(q.errors,this.errors),Array.prototype.push.apply(q.warnings,this.warnings);else q.errors=this.errors,q.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
107
|
-
${$.comment}`:$.comment}this.doc.range[2]=$.offset;break}default:this.errors.push(new wq.YAMLParseError(Pq(q),"UNEXPECTED_TOKEN",`Unsupported token ${q.type}`))}}*end(q=!1,$=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(q){let Z=Object.assign({_directives:this.directives},this.options),Q=new
|
|
106
|
+
${z}`:Z}}if($)Array.prototype.push.apply(q.errors,this.errors),Array.prototype.push.apply(q.warnings,this.warnings);else q.errors=this.errors,q.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:a1(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(q,$=!1,Z=-1){for(let Q of q)yield*this.next(Q);yield*this.end($,Z)}*next(q){if(cJ.env.LOG_STREAM)console.dir(q,{depth:null});switch(q.type){case"directive":this.directives.add(q.source,($,Z,Q)=>{let X=Pq(q);X[0]+=$,this.onError(X,"BAD_DIRECTIVE",Z,Q)}),this.prelude.push(q.source),this.atDirectives=!0;break;case"document":{let $=aJ.composeDoc(this.options,this.directives,q,this.onError);if(this.atDirectives&&!$.directives.docStart)this.onError(q,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate($,!1),this.doc)yield this.doc;this.doc=$,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(q.source);break;case"error":{let $=q.source?`${q.message}: ${JSON.stringify(q.source)}`:q.message,Z=new wq.YAMLParseError(Pq(q),"UNEXPECTED_TOKEN",$);if(this.atDirectives||!this.doc)this.errors.push(Z);else this.doc.errors.push(Z);break}case"doc-end":{if(!this.doc){this.errors.push(new wq.YAMLParseError(Pq(q),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let $=oJ.resolveEnd(q.end,q.offset+q.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),$.comment){let Z=this.doc.comment;this.doc.comment=Z?`${Z}
|
|
107
|
+
${$.comment}`:$.comment}this.doc.range[2]=$.offset;break}default:this.errors.push(new wq.YAMLParseError(Pq(q),"UNEXPECTED_TOKEN",`Unsupported token ${q.type}`))}}*end(q=!1,$=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(q){let Z=Object.assign({_directives:this.directives},this.options),Q=new nJ.Document(void 0,Z);if(this.atDirectives)this.onError($,"MISSING_CHAR","Missing directives-end indicator line");Q.range=[0,$,$],this.decorate(Q,!1),yield Q}}}iJ.Composer=o1});var t1=N((XG)=>{var tJ=i2(),rJ=t2(),eJ=Dq(),i1=Bq();function qG(q,$=!0,Z){if(q){let Q=(X,z,J)=>{let G=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(Z)Z(G,z,J);else throw new eJ.YAMLParseError([G,G+1],z,J)};switch(q.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return rJ.resolveFlowScalar(q,$,Q);case"block-scalar":return tJ.resolveBlockScalar({options:{strict:$}},q,Q)}}return null}function $G(q,$){let{implicitKey:Z=!1,indent:Q,inFlow:X=!1,offset:z=-1,type:J="PLAIN"}=$,G=i1.stringifyString({type:J,value:q},{implicitKey:Z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),Y=$.end??[{type:"newline",offset:-1,indent:Q,source:`
|
|
108
108
|
`}];switch(G[0]){case"|":case">":{let H=G.indexOf(`
|
|
109
109
|
`),V=G.substring(0,H),W=G.substring(H+1)+`
|
|
110
|
-
`,B=[{type:"block-scalar-header",offset:z,indent:Q,source:V}];if(!
|
|
111
|
-
`});return{type:"block-scalar",offset:z,indent:Q,props:B,source:W}}case'"':return{type:"double-quoted-scalar",offset:z,indent:Q,source:G,end:Y};case"'":return{type:"single-quoted-scalar",offset:z,indent:Q,source:G,end:Y};default:return{type:"scalar",offset:z,indent:Q,source:G,end:Y}}}function
|
|
110
|
+
`,B=[{type:"block-scalar-header",offset:z,indent:Q,source:V}];if(!s1(B,Y))B.push({type:"newline",offset:-1,indent:Q,source:`
|
|
111
|
+
`});return{type:"block-scalar",offset:z,indent:Q,props:B,source:W}}case'"':return{type:"double-quoted-scalar",offset:z,indent:Q,source:G,end:Y};case"'":return{type:"single-quoted-scalar",offset:z,indent:Q,source:G,end:Y};default:return{type:"scalar",offset:z,indent:Q,source:G,end:Y}}}function ZG(q,$,Z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:z=!1,type:J}=Z,G="indent"in q?q.indent:null;if(Q&&typeof G==="number")G+=2;if(!J)switch(q.type){case"single-quoted-scalar":J="QUOTE_SINGLE";break;case"double-quoted-scalar":J="QUOTE_DOUBLE";break;case"block-scalar":{let H=q.props[0];if(H.type!=="block-scalar-header")throw Error("Invalid block scalar header");J=H.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:J="PLAIN"}let Y=i1.stringifyString({type:J,value:$},{implicitKey:X||G===null,indent:G!==null&&G>0?" ".repeat(G):"",inFlow:z,options:{blockQuote:!0,lineWidth:-1}});switch(Y[0]){case"|":case">":QG(q,Y);break;case'"':q9(q,Y,"double-quoted-scalar");break;case"'":q9(q,Y,"single-quoted-scalar");break;default:q9(q,Y,"scalar")}}function QG(q,$){let Z=$.indexOf(`
|
|
112
112
|
`),Q=$.substring(0,Z),X=$.substring(Z+1)+`
|
|
113
|
-
`;if(q.type==="block-scalar"){let z=q.props[0];if(z.type!=="block-scalar-header")throw Error("Invalid block scalar header");z.source=Q,q.source=X}else{let{offset:z}=q,J="indent"in q?q.indent:-1,G=[{type:"block-scalar-header",offset:z,indent:J,source:Q}];if(!
|
|
114
|
-
`});for(let Y of Object.keys(q))if(Y!=="type"&&Y!=="offset")delete q[Y];Object.assign(q,{type:"block-scalar",indent:J,props:G,source:X})}}function
|
|
115
|
-
`};delete q.items,Object.assign(q,{type:Z,source:$,end:[X]});break}default:{let Q="indent"in q?q.indent:-1,X="end"in q&&Array.isArray(q.end)?q.end.filter((z)=>z.type==="space"||z.type==="comment"||z.type==="newline"):[];for(let z of Object.keys(q))if(z!=="type"&&z!=="offset")delete q[z];Object.assign(q,{type:Z,indent:Q,source:$,end:X})}}}
|
|
113
|
+
`;if(q.type==="block-scalar"){let z=q.props[0];if(z.type!=="block-scalar-header")throw Error("Invalid block scalar header");z.source=Q,q.source=X}else{let{offset:z}=q,J="indent"in q?q.indent:-1,G=[{type:"block-scalar-header",offset:z,indent:J,source:Q}];if(!s1(G,"end"in q?q.end:void 0))G.push({type:"newline",offset:-1,indent:J,source:`
|
|
114
|
+
`});for(let Y of Object.keys(q))if(Y!=="type"&&Y!=="offset")delete q[Y];Object.assign(q,{type:"block-scalar",indent:J,props:G,source:X})}}function s1(q,$){if($)for(let Z of $)switch(Z.type){case"space":case"comment":q.push(Z);break;case"newline":return q.push(Z),!0}return!1}function q9(q,$,Z){switch(q.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":q.type=Z,q.source=$;break;case"block-scalar":{let Q=q.props.slice(1),X=$.length;if(q.props[0].type==="block-scalar-header")X-=q.props[0].source.length;for(let z of Q)z.offset+=X;delete q.props,Object.assign(q,{type:Z,source:$,end:Q});break}case"block-map":case"block-seq":{let X={type:"newline",offset:q.offset+$.length,indent:q.indent,source:`
|
|
115
|
+
`};delete q.items,Object.assign(q,{type:Z,source:$,end:[X]});break}default:{let Q="indent"in q?q.indent:-1,X="end"in q&&Array.isArray(q.end)?q.end.filter((z)=>z.type==="space"||z.type==="comment"||z.type==="newline"):[];for(let z of Object.keys(q))if(z!=="type"&&z!=="offset")delete q[z];Object.assign(q,{type:Z,indent:Q,source:$,end:X})}}}XG.createScalarToken=$G;XG.resolveAsScalar=qG;XG.setScalarValue=ZG});var r1=N((UG)=>{var YG=(q)=>("type"in q)?C$(q):P$(q);function C$(q){switch(q.type){case"block-scalar":{let $="";for(let Z of q.props)$+=C$(Z);return $+q.source}case"block-map":case"block-seq":{let $="";for(let Z of q.items)$+=P$(Z);return $}case"flow-collection":{let $=q.start.source;for(let Z of q.items)$+=P$(Z);for(let Z of q.end)$+=Z.source;return $}case"document":{let $=P$(q);if(q.end)for(let Z of q.end)$+=Z.source;return $}default:{let $=q.source;if("end"in q&&q.end)for(let Z of q.end)$+=Z.source;return $}}}function P$({start:q,key:$,sep:Z,value:Q}){let X="";for(let z of q)X+=z.source;if($)X+=C$($);if(Z)for(let z of Z)X+=z.source;if(Q)X+=C$(Q);return X}UG.stringify=YG});var $5=N((VG)=>{var $9=Symbol("break visit"),WG=Symbol("skip children"),e1=Symbol("remove item");function y0(q,$){if("type"in q&&q.type==="document")q={start:q.start,value:q.value};q5(Object.freeze([]),q,$)}y0.BREAK=$9;y0.SKIP=WG;y0.REMOVE=e1;y0.itemAtPath=(q,$)=>{let Z=q;for(let[Q,X]of $){let z=Z?.[Q];if(z&&"items"in z)Z=z.items[X];else return}return Z};y0.parentCollection=(q,$)=>{let Z=y0.itemAtPath(q,$.slice(0,-1)),Q=$[$.length-1][0],X=Z?.[Q];if(X&&"items"in X)return X;throw Error("Parent collection not found")};function q5(q,$,Z){let Q=Z($,q);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let z=$[X];if(z&&"items"in z){for(let J=0;J<z.items.length;++J){let G=q5(Object.freeze(q.concat([[X,J]])),z.items[J],Z);if(typeof G==="number")J=G-1;else if(G===$9)return $9;else if(G===e1)z.items.splice(J,1),J-=1}if(typeof Q==="function"&&X==="key")Q=Q($,q)}}return typeof Q==="function"?Q($,q):Q}VG.visit=y0});var E$=N((AG)=>{var Z9=t1(),KG=r1(),_G=$5(),Q9="\uFEFF",X9="\x02",z9="\x18",J9="\x1F",LG=(q)=>!!q&&("items"in q),OG=(q)=>!!q&&(q.type==="scalar"||q.type==="single-quoted-scalar"||q.type==="double-quoted-scalar"||q.type==="block-scalar");function FG(q){switch(q){case Q9:return"<BOM>";case X9:return"<DOC>";case z9:return"<FLOW_END>";case J9:return"<SCALAR>";default:return JSON.stringify(q)}}function IG(q){switch(q){case Q9:return"byte-order-mark";case X9:return"doc-mode";case z9:return"flow-error-end";case J9:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
116
116
|
`:case`\r
|
|
117
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(q[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
118
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
119
|
-
\r `),
|
|
117
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(q[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}AG.createScalarToken=Z9.createScalarToken;AG.resolveAsScalar=Z9.resolveAsScalar;AG.setScalarValue=Z9.setScalarValue;AG.stringify=KG.stringify;AG.visit=_G.visit;AG.BOM=Q9;AG.DOCUMENT=X9;AG.FLOW_END=z9;AG.SCALAR=J9;AG.isCollection=LG;AG.isScalar=OG;AG.prettyToken=FG;AG.tokenType=IG});var Y9=N((kG)=>{var Cq=E$();function G0(q){switch(q){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case"\t":return!0;default:return!1}}var Z5=new Set("0123456789ABCDEFabcdef"),yG=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),S$=new Set(",[]{}"),fG=new Set(` ,[]{}
|
|
119
|
+
\r `),G9=(q)=>!q||fG.has(q);class Q5{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(q,$=!1){if(q){if(typeof q!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+q:q,this.lineEndPos=null}this.atEnd=!$;let Z=this.next??"stream";while(Z&&($||this.hasChars(1)))Z=yield*this.parseNext(Z)}atLineEnd(){let q=this.pos,$=this.buffer[q];while($===" "||$==="\t")$=this.buffer[++q];if(!$||$==="#"||$===`
|
|
120
120
|
`)return!0;if($==="\r")return this.buffer[q+1]===`
|
|
121
121
|
`;return!1}charAt(q){return this.buffer[this.pos+q]}continueScalar(q){let $=this.buffer[q];if(this.indentNext>0){let Z=0;while($===" ")$=this.buffer[++Z+q];if($==="\r"){let Q=this.buffer[Z+q+1];if(Q===`
|
|
122
122
|
`||!Q&&!this.atEnd)return q+Z+1}return $===`
|
|
123
123
|
`||Z>=this.indentNext||!$&&!this.atEnd?q+Z:-1}if($==="-"||$==="."){let Z=this.buffer.substr(q,3);if((Z==="---"||Z==="...")&&G0(this.buffer[q+3]))return-1}return q}getLine(){let q=this.lineEndPos;if(typeof q!=="number"||q!==-1&&q<this.pos)q=this.buffer.indexOf(`
|
|
124
|
-
`,this.pos),this.lineEndPos=q;if(q===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[q-1]==="\r")q-=1;return this.buffer.substring(this.pos,q)}hasChars(q){return this.pos+q<=this.buffer.length}setNext(q){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=q,null}peek(q){return this.buffer.substr(this.pos,q)}*parseNext(q){switch(q){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let q=this.getLine();if(q===null)return this.setNext("stream");if(q[0]===Cq.BOM)yield*this.pushCount(1),q=q.substring(1);if(q[0]==="%"){let $=q.length,Z=q.indexOf("#");while(Z!==-1){let X=q[Z-1];if(X===" "||X==="\t"){$=Z-1;break}else Z=q.indexOf("#",Z+1)}while(!0){let X=q[$-1];if(X===" "||X==="\t")$-=1;else break}let Q=(yield*this.pushCount($))+(yield*this.pushSpaces(!0));return yield*this.pushCount(q.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let $=yield*this.pushSpaces(!0);return yield*this.pushCount(q.length-$),yield*this.pushNewline(),"stream"}return yield Cq.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let q=this.charAt(0);if(!q&&!this.atEnd)return this.setNext("line-start");if(q==="-"||q==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let $=this.peek(3);if(($==="---"||$==="...")&&G0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,$==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[q,$]=this.peek(2);if(!$&&!this.atEnd)return this.setNext("block-start");if((q==="-"||q==="?"||q===":")&&G0($)){let Z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=Z,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let q=this.getLine();if(q===null)return this.setNext("doc");let $=yield*this.pushIndicators();switch(q[$]){case"#":yield*this.pushCount(q.length-$);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(
|
|
124
|
+
`,this.pos),this.lineEndPos=q;if(q===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[q-1]==="\r")q-=1;return this.buffer.substring(this.pos,q)}hasChars(q){return this.pos+q<=this.buffer.length}setNext(q){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=q,null}peek(q){return this.buffer.substr(this.pos,q)}*parseNext(q){switch(q){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let q=this.getLine();if(q===null)return this.setNext("stream");if(q[0]===Cq.BOM)yield*this.pushCount(1),q=q.substring(1);if(q[0]==="%"){let $=q.length,Z=q.indexOf("#");while(Z!==-1){let X=q[Z-1];if(X===" "||X==="\t"){$=Z-1;break}else Z=q.indexOf("#",Z+1)}while(!0){let X=q[$-1];if(X===" "||X==="\t")$-=1;else break}let Q=(yield*this.pushCount($))+(yield*this.pushSpaces(!0));return yield*this.pushCount(q.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let $=yield*this.pushSpaces(!0);return yield*this.pushCount(q.length-$),yield*this.pushNewline(),"stream"}return yield Cq.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let q=this.charAt(0);if(!q&&!this.atEnd)return this.setNext("line-start");if(q==="-"||q==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let $=this.peek(3);if(($==="---"||$==="...")&&G0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,$==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[q,$]=this.peek(2);if(!$&&!this.atEnd)return this.setNext("block-start");if((q==="-"||q==="?"||q===":")&&G0($)){let Z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=Z,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let q=this.getLine();if(q===null)return this.setNext("doc");let $=yield*this.pushIndicators();switch(q[$]){case"#":yield*this.pushCount(q.length-$);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(G9),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return $+=yield*this.parseBlockScalarHeader(),$+=yield*this.pushSpaces(!0),yield*this.pushCount(q.length-$),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let q,$,Z=-1;do{if(q=yield*this.pushNewline(),q>0)$=yield*this.pushSpaces(!1),this.indentValue=Z=$;else $=0;$+=yield*this.pushSpaces(!0)}while(q+$>0);let Q=this.getLine();if(Q===null)return this.setNext("flow");if(Z!==-1&&Z<this.indentNext&&Q[0]!=="#"||Z===0&&(Q.startsWith("---")||Q.startsWith("..."))&&G0(Q[3])){if(!(Z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield Cq.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(G9),"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 q=this.charAt(0),$=this.buffer.indexOf(q,this.pos+1);if(q==="'")while($!==-1&&this.buffer[$+1]==="'")$=this.buffer.indexOf("'",$+2);else while($!==-1){let X=0;while(this.buffer[$-1-X]==="\\")X+=1;if(X%2===0)break;$=this.buffer.indexOf('"',$+1)}let Z=this.buffer.substring(0,$),Q=Z.indexOf(`
|
|
125
125
|
`,this.pos);if(Q!==-1){while(Q!==-1){let X=this.continueScalar(Q+1);if(X===-1)break;Q=Z.indexOf(`
|
|
126
126
|
`,X)}if(Q!==-1)$=Q-(Z[Q-1]==="\r"?2:1)}if($===-1){if(!this.atEnd)return this.setNext("quoted-scalar");$=this.buffer.length}return yield*this.pushToIndex($+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let q=this.pos;while(!0){let $=this.buffer[++q];if($==="+")this.blockScalarKeep=!0;else if($>"0"&&$<="9")this.blockScalarIndent=Number($)-1;else if($!=="-")break}return yield*this.pushUntil(($)=>G0($)||$==="#")}*parseBlockScalar(){let q=this.pos-1,$=0,Z;q:for(let X=this.pos;Z=this.buffer[X];++X)switch(Z){case" ":$+=1;break;case`
|
|
127
127
|
`:q=X,$=0;break;case"\r":{let z=this.buffer[X+1];if(!z&&!this.atEnd)return this.setNext("block-scalar");if(z===`
|
|
128
128
|
`)break}default:break q}if(!Z&&!this.atEnd)return this.setNext("block-scalar");if($>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=$;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let X=this.continueScalar(q+1);if(X===-1)break;q=this.buffer.indexOf(`
|
|
129
129
|
`,X)}while(q!==-1);if(q===-1){if(!this.atEnd)return this.setNext("block-scalar");q=this.buffer.length}}let Q=q+1;Z=this.buffer[Q];while(Z===" ")Z=this.buffer[++Q];if(Z==="\t"){while(Z==="\t"||Z===" "||Z==="\r"||Z===`
|
|
130
130
|
`)Z=this.buffer[++Q];q=Q-1}else if(!this.blockScalarKeep)do{let X=q-1,z=this.buffer[X];if(z==="\r")z=this.buffer[--X];let J=X;while(z===" ")z=this.buffer[--X];if(z===`
|
|
131
|
-
`&&X>=this.pos&&X+1+$>J)q=X;else break}while(!0);return yield Cq.SCALAR,yield*this.pushToIndex(q+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let q=this.flowLevel>0,$=this.pos-1,Z=this.pos-1,Q;while(Q=this.buffer[++Z])if(Q===":"){let X=this.buffer[Z+1];if(G0(X)||q&&
|
|
131
|
+
`&&X>=this.pos&&X+1+$>J)q=X;else break}while(!0);return yield Cq.SCALAR,yield*this.pushToIndex(q+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let q=this.flowLevel>0,$=this.pos-1,Z=this.pos-1,Q;while(Q=this.buffer[++Z])if(Q===":"){let X=this.buffer[Z+1];if(G0(X)||q&&S$.has(X))break;$=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 $=Z;if(X==="#"||q&&
|
|
134
|
-
`){let z=this.continueScalar(Z+1);if(z===-1)break;Z=Math.max(Z,z-2)}}else{if(q&&
|
|
133
|
+
`,X=this.buffer[Z+1];else $=Z;if(X==="#"||q&&S$.has(X))break;if(Q===`
|
|
134
|
+
`){let z=this.continueScalar(Z+1);if(z===-1)break;Z=Math.max(Z,z-2)}}else{if(q&&S$.has(Q))break;$=Z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield Cq.SCALAR,yield*this.pushToIndex($+1,!0),q?"flow":"doc"}*pushCount(q){if(q>0)return yield this.buffer.substr(this.pos,q),this.pos+=q,q;return 0}*pushToIndex(q,$){let Z=this.buffer.slice(this.pos,q);if(Z)return yield Z,this.pos+=Z.length,Z.length;else if($)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(G9))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let q=this.flowLevel>0,$=this.charAt(1);if(G0($)||q&&S$.has($)){if(!q)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let q=this.pos+2,$=this.buffer[q];while(!G0($)&&$!==">")$=this.buffer[++q];return yield*this.pushToIndex($===">"?q+1:q,!1)}else{let q=this.pos+1,$=this.buffer[q];while($)if(yG.has($))$=this.buffer[++q];else if($==="%"&&Z5.has(this.buffer[q+1])&&Z5.has(this.buffer[q+2]))$=this.buffer[q+=3];else break;return yield*this.pushToIndex(q,!1)}}*pushNewline(){let q=this.buffer[this.pos];if(q===`
|
|
135
135
|
`)return yield*this.pushCount(1);else if(q==="\r"&&this.charAt(1)===`
|
|
136
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces(q){let $=this.pos-1,Z;do Z=this.buffer[++$];while(Z===" "||q&&Z==="\t");let Q=$-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=$;return Q}*pushUntil(q){let $=this.pos,Z=this.buffer[$];while(!q(Z))Z=this.buffer[++$];return yield*this.pushToIndex($,!1)}}
|
|
136
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces(q){let $=this.pos-1,Z;do Z=this.buffer[++$];while(Z===" "||q&&Z==="\t");let Q=$-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=$;return Q}*pushUntil(q){let $=this.pos,Z=this.buffer[$];while(!q(Z))Z=this.buffer[++$];return yield*this.pushToIndex($,!1)}}kG.Lexer=Q5});var U9=N((hG)=>{class X5{constructor(){this.lineStarts=[],this.addNewLine=(q)=>this.lineStarts.push(q),this.linePos=(q)=>{let $=0,Z=this.lineStarts.length;while($<Z){let X=$+Z>>1;if(this.lineStarts[X]<q)$=X+1;else Z=X}if(this.lineStarts[$]===q)return{line:$+1,col:1};if($===0)return{line:0,col:q};let Q=this.lineStarts[$-1];return{line:$,col:q-Q+1}}}}hG.LineCounter=X5});var H9=N((pG)=>{var uG=v("process"),z5=E$(),mG=Y9();function M0(q,$){for(let Z=0;Z<q.length;++Z)if(q[Z].type===$)return!0;return!1}function J5(q){for(let $=0;$<q.length;++$)switch(q[$].type){case"space":case"comment":case"newline":break;default:return $}return-1}function Y5(q){switch(q?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function b$(q){switch(q.type){case"document":return q.start;case"block-map":{let $=q.items[q.items.length-1];return $.sep??$.start}case"block-seq":return q.items[q.items.length-1].start;default:return[]}}function Qq(q){if(q.length===0)return[];let $=q.length;q:while(--$>=0)switch(q[$].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break q}while(q[++$]?.type==="space");return q.splice($,q.length)}function G5(q){if(q.start.type==="flow-seq-start"){for(let $ of q.items)if($.sep&&!$.value&&!M0($.start,"explicit-key-ind")&&!M0($.sep,"map-value-ind")){if($.key)$.value=$.key;if(delete $.key,Y5($.value))if($.value.end)Array.prototype.push.apply($.value.end,$.sep);else $.value.end=$.sep;else Array.prototype.push.apply($.start,$.sep);delete $.sep}}}class U5{constructor(q){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new mG.Lexer,this.onNewLine=q}*parse(q,$=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let Z of this.lexer.lex(q,$))yield*this.next(Z);if(!$)yield*this.end()}*next(q){if(this.source=q,uG.env.LOG_TOKENS)console.log("|",z5.prettyToken(q));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=q.length;return}let $=z5.tokenType(q);if(!$){let Z=`Not a YAML token: ${q}`;yield*this.pop({type:"error",offset:this.offset,message:Z,source:q}),this.offset+=q.length}else if($==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=$,yield*this.step(),$){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+q.length);break;case"space":if(this.atNewLine&&q[0]===" ")this.indent+=q.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=q.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=q.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let q=this.peek(1);if(this.type==="doc-end"&&q?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!q)return yield*this.stream();switch(q.type){case"document":return yield*this.document(q);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(q);case"block-scalar":return yield*this.blockScalar(q);case"block-map":return yield*this.blockMap(q);case"block-seq":return yield*this.blockSequence(q);case"flow-collection":return yield*this.flowCollection(q);case"doc-end":return yield*this.documentEnd(q)}yield*this.pop()}peek(q){return this.stack[this.stack.length-q]}*pop(q){let $=q??this.stack.pop();if(!$)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield $;else{let Z=this.peek(1);if($.type==="block-scalar")$.indent="indent"in Z?Z.indent:0;else if($.type==="flow-collection"&&Z.type==="document")$.indent=0;if($.type==="flow-collection")G5($);switch(Z.type){case"document":Z.value=$;break;case"block-scalar":Z.props.push($);break;case"block-map":{let Q=Z.items[Z.items.length-1];if(Q.value){Z.items.push({start:[],key:$,sep:[]}),this.onKeyLine=!0;return}else if(Q.sep)Q.value=$;else{Object.assign(Q,{key:$,sep:[]}),this.onKeyLine=!Q.explicitKey;return}break}case"block-seq":{let Q=Z.items[Z.items.length-1];if(Q.value)Z.items.push({start:[],value:$});else Q.value=$;break}case"flow-collection":{let Q=Z.items[Z.items.length-1];if(!Q||Q.value)Z.items.push({start:[],key:$,sep:[]});else if(Q.sep)Q.value=$;else Object.assign(Q,{key:$,sep:[]});return}default:yield*this.pop(),yield*this.pop($)}if((Z.type==="document"||Z.type==="block-map"||Z.type==="block-seq")&&($.type==="block-map"||$.type==="block-seq")){let Q=$.items[$.items.length-1];if(Q&&!Q.sep&&!Q.value&&Q.start.length>0&&J5(Q.start)===-1&&($.indent===0||Q.start.every((X)=>X.type!=="comment"||X.indent<$.indent))){if(Z.type==="document")Z.end=Q.start;else Z.items.push({start:Q.start});$.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let q={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")q.start.push(this.sourceToken);this.stack.push(q);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(q){if(q.value)return yield*this.lineEnd(q);switch(this.type){case"doc-start":{if(J5(q.start)!==-1)yield*this.pop(),yield*this.step();else q.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":q.start.push(this.sourceToken);return}let $=this.startBlockValue(q);if($)this.stack.push($);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(q){if(this.type==="map-value-ind"){let $=b$(this.peek(2)),Z=Qq($),Q;if(q.end)Q=q.end,Q.push(this.sourceToken),delete q.end;else Q=[this.sourceToken];let X={type:"block-map",offset:q.offset,indent:q.indent,items:[{start:Z,key:q,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=X}else yield*this.lineEnd(q)}*blockScalar(q){switch(this.type){case"space":case"comment":case"newline":q.props.push(this.sourceToken);return;case"scalar":if(q.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let $=this.source.indexOf(`
|
|
137
137
|
`)+1;while($!==0)this.onNewLine(this.offset+$),$=this.source.indexOf(`
|
|
138
|
-
`,$)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(q){let $=q.items[q.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,$.value){let Z="end"in $.value?$.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else q.items.push({start:[this.sourceToken]})}else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"space":case"comment":if($.value)q.items.push({start:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else{if(this.atIndentedComment($.start,q.indent)){let Q=q.items[q.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,$.start),Q.push(this.sourceToken),q.items.pop();return}}$.start.push(this.sourceToken)}return}if(this.indent>=q.indent){let Z=!this.onKeyLine&&this.indent===q.indent,Q=Z&&($.sep||$.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&$.sep&&!$.value){let z=[];for(let J=0;J<$.sep.length;++J){let G=$.sep[J];switch(G.type){case"newline":z.push(J);break;case"space":break;case"comment":if(G.indent>q.indent)z.length=0;break;default:z.length=0}}if(z.length>=2)X=$.sep.splice(z[1])}switch(this.type){case"anchor":case"tag":if(Q||$.value)X.push(this.sourceToken),q.items.push({start:X}),this.onKeyLine=!0;else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"explicit-key-ind":if(!$.sep&&!$.explicitKey)$.start.push(this.sourceToken),$.explicitKey=!0;else if(Q||$.value)X.push(this.sourceToken),q.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if($.explicitKey)if(!$.sep)if(M0($.start,"newline"))Object.assign($,{key:null,sep:[this.sourceToken]});else{let z=Qq($.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]})}else if($.value)q.items.push({start:[],key:null,sep:[this.sourceToken]});else if(M0($.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(
|
|
138
|
+
`,$)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(q){let $=q.items[q.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,$.value){let Z="end"in $.value?$.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else q.items.push({start:[this.sourceToken]})}else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"space":case"comment":if($.value)q.items.push({start:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else{if(this.atIndentedComment($.start,q.indent)){let Q=q.items[q.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,$.start),Q.push(this.sourceToken),q.items.pop();return}}$.start.push(this.sourceToken)}return}if(this.indent>=q.indent){let Z=!this.onKeyLine&&this.indent===q.indent,Q=Z&&($.sep||$.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&$.sep&&!$.value){let z=[];for(let J=0;J<$.sep.length;++J){let G=$.sep[J];switch(G.type){case"newline":z.push(J);break;case"space":break;case"comment":if(G.indent>q.indent)z.length=0;break;default:z.length=0}}if(z.length>=2)X=$.sep.splice(z[1])}switch(this.type){case"anchor":case"tag":if(Q||$.value)X.push(this.sourceToken),q.items.push({start:X}),this.onKeyLine=!0;else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"explicit-key-ind":if(!$.sep&&!$.explicitKey)$.start.push(this.sourceToken),$.explicitKey=!0;else if(Q||$.value)X.push(this.sourceToken),q.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if($.explicitKey)if(!$.sep)if(M0($.start,"newline"))Object.assign($,{key:null,sep:[this.sourceToken]});else{let z=Qq($.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]})}else if($.value)q.items.push({start:[],key:null,sep:[this.sourceToken]});else if(M0($.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(Y5($.key)&&!M0($.sep,"newline")){let z=Qq($.start),J=$.key,G=$.sep;G.push(this.sourceToken),delete $.key,delete $.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:J,sep:G}]})}else if(X.length>0)$.sep=$.sep.concat(X,this.sourceToken);else $.sep.push(this.sourceToken);else if(!$.sep)Object.assign($,{key:null,sep:[this.sourceToken]});else if($.value||Q)q.items.push({start:X,key:null,sep:[this.sourceToken]});else if(M0($.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else $.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(Q||$.value)q.items.push({start:X,key:z,sep:[]}),this.onKeyLine=!0;else if($.sep)this.stack.push(z);else Object.assign($,{key:z,sep:[]}),this.onKeyLine=!0;return}default:{let z=this.startBlockValue(q);if(z){if(z.type==="block-seq"){if(!$.explicitKey&&$.sep&&!M0($.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(Z)q.items.push({start:X});this.stack.push(z);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(q){let $=q.items[q.items.length-1];switch(this.type){case"newline":if($.value){let Z="end"in $.value?$.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else q.items.push({start:[this.sourceToken]})}else $.start.push(this.sourceToken);return;case"space":case"comment":if($.value)q.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment($.start,q.indent)){let Q=q.items[q.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,$.start),Q.push(this.sourceToken),q.items.pop();return}}$.start.push(this.sourceToken)}return;case"anchor":case"tag":if($.value||this.indent<=q.indent)break;$.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==q.indent)break;if($.value||M0($.start,"seq-item-ind"))q.items.push({start:[this.sourceToken]});else $.start.push(this.sourceToken);return}if(this.indent>q.indent){let Z=this.startBlockValue(q);if(Z){this.stack.push(Z);return}}yield*this.pop(),yield*this.step()}*flowCollection(q){let $=q.items[q.items.length-1];if(this.type==="flow-error-end"){let Z;do yield*this.pop(),Z=this.peek(1);while(Z?.type==="flow-collection")}else if(q.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!$||$.sep)q.items.push({start:[this.sourceToken]});else $.start.push(this.sourceToken);return;case"map-value-ind":if(!$||$.value)q.items.push({start:[],key:null,sep:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else Object.assign($,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!$||$.value)q.items.push({start:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(!$||$.value)q.items.push({start:[],key:Q,sep:[]});else if($.sep)this.stack.push(Q);else Object.assign($,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":q.end.push(this.sourceToken);return}let Z=this.startBlockValue(q);if(Z)this.stack.push(Z);else yield*this.pop(),yield*this.step()}else{let Z=this.peek(2);if(Z.type==="block-map"&&(this.type==="map-value-ind"&&Z.indent===q.indent||this.type==="newline"&&!Z.items[Z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&Z.type!=="flow-collection"){let Q=b$(Z),X=Qq(Q);G5(q);let z=q.end.splice(1,q.end.length);z.push(this.sourceToken);let J={type:"block-map",offset:q.offset,indent:q.indent,items:[{start:X,key:q,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd(q)}}flowScalar(q){if(this.onNewLine){let $=this.source.indexOf(`
|
|
139
139
|
`)+1;while($!==0)this.onNewLine(this.offset+$),$=this.source.indexOf(`
|
|
140
|
-
`,$)+1}return{type:q,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(q){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let $=
|
|
141
|
-
`).length})}catch{}}}catch{continue}}}return await Z(q,""),$}class
|
|
140
|
+
`,$)+1}return{type:q,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(q){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let $=b$(q),Z=Qq($);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 $=b$(q),Z=Qq($);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(q,$){if(this.type!=="comment")return!1;if(this.indent<=$)return!1;return q.every((Z)=>Z.type==="newline"||Z.type==="space")}*documentEnd(q){if(this.type!=="doc-mode"){if(q.end)q.end.push(this.sourceToken);else q.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(q){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(q.end)q.end.push(this.sourceToken);else q.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}pG.Parser=U5});var K5=N((tG)=>{var H5=e2(),cG=Rq(),Eq=Dq(),lG=U2(),nG=k(),aG=U9(),W5=H9();function V5(q){let $=q.prettyErrors!==!1;return{lineCounter:q.lineCounter||$&&new aG.LineCounter||null,prettyErrors:$}}function oG(q,$={}){let{lineCounter:Z,prettyErrors:Q}=V5($),X=new W5.Parser(Z?.addNewLine),z=new H5.Composer($),J=Array.from(z.compose(X.parse(q)));if(Q&&Z)for(let G of J)G.errors.forEach(Eq.prettifyError(q,Z)),G.warnings.forEach(Eq.prettifyError(q,Z));if(J.length>0)return J;return Object.assign([],{empty:!0},z.streamInfo())}function B5(q,$={}){let{lineCounter:Z,prettyErrors:Q}=V5($),X=new W5.Parser(Z?.addNewLine),z=new H5.Composer($),J=null;for(let G of z.compose(X.parse(q),!0,q.length))if(!J)J=G;else if(J.options.logLevel!=="silent"){J.errors.push(new Eq.YAMLParseError(G.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&Z)J.errors.forEach(Eq.prettifyError(q,Z)),J.warnings.forEach(Eq.prettifyError(q,Z));return J}function iG(q,$,Z){let Q=void 0;if(typeof $==="function")Q=$;else if(Z===void 0&&$&&typeof $==="object")Z=$;let X=B5(q,Z);if(!X)return null;if(X.warnings.forEach((z)=>lG.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 sG(q,$,Z){let Q=null;if(typeof $==="function"||Array.isArray($))Q=$;else if(Z===void 0&&$)Z=$;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let X=Math.round(Z);Z=X<1?void 0:X>8?{indent:8}:{indent:X}}if(q===void 0){let{keepUndefined:X}=Z??$??{};if(!X)return}if(nG.isDocument(q)&&!Q)return q.toString(Z);return new cG.Document(q,Q,Z).toString(Z)}tG.parse=iG;tG.parseAllDocuments=oG;tG.parseDocument=B5;tG.stringify=sG});import{execFile as NZ}from"child_process";import{promisify as wZ}from"util";import{mkdtemp as i9,readdir as PZ,readFile as r$,rm as dq,cp as CZ,access as t$,stat as EZ,lstat as SZ,symlink as bZ,mkdir as xZ}from"fs/promises";import{join as V0,resolve as s9,relative as yZ,basename as fZ}from"path";import{homedir as t9}from"os";import{tmpdir as r9}from"os";import{readdir as IZ,readFile as AZ,stat as TZ}from"fs/promises";import{join as MZ}from"path";var jZ=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"]),RZ=524288;async function mq(q){let $=[];async function Z(Q,X){let z;try{z=await IZ(Q)}catch{return}for(let J of z){if(J===".git"||J==="node_modules")continue;let G=MZ(Q,J),Y=X?`${X}/${J}`:J;try{let H=await TZ(G);if(H.isDirectory())await Z(G,Y);else if(H.isFile()){let V=J.includes(".")?`.${J.split(".").pop().toLowerCase()}`:"";if(jZ.has(V))continue;if(H.size>RZ)continue;try{let W=await AZ(G,"utf-8");$.push({relPath:Y,content:W,lineCount:W.split(`
|
|
141
|
+
`).length})}catch{}}}catch{continue}}}return await Z(q,""),$}class o9{selected;cursor;scrollOffset;pageSize;itemCount;filter;searchActive;filteredMap;constructor(q,$){this.selected=q.map((Z)=>Z.checked),this.cursor=1,this.scrollOffset=0,this.pageSize=$,this.itemCount=q.length,this.filter="",this.searchActive=!1,this.filteredMap=q.map((Z,Q)=>Q)}get totalRows(){return this.filteredMap.length+1}applyFilter(q){if(this.filter==="")this.filteredMap=q.map(($,Z)=>Z);else{let $=this.filter.toLowerCase();this.filteredMap=[];for(let Z=0;Z<q.length;Z++)if((q[Z].label.toLowerCase()+" "+(q[Z].hint?.toLowerCase()??"")).includes($))this.filteredMap.push(Z)}if(this.cursor>=this.totalRows)this.cursor=Math.max(0,this.totalRows-1);if(this.scrollOffset>0&&this.scrollOffset>=this.totalRows)this.scrollOffset=Math.max(0,this.totalRows-this.pageSize)}cursorToOriginalIndex(){if(this.cursor===0)return-1;return this.filteredMap[this.cursor-1]??-1}toggleCurrent(){if(this.cursor===0)this.toggleAll();else{let q=this.cursorToOriginalIndex();if(q>=0)this.selected[q]=!this.selected[q]}}toggleAll(){let q=this.filteredMap,Z=!q.every((Q)=>this.selected[Q]);for(let Q of q)this.selected[Q]=Z}moveUp(){if(this.cursor>0)this.cursor--;else this.cursor=this.totalRows-1;this.adjustScroll()}moveDown(){if(this.cursor<this.totalRows-1)this.cursor++;else this.cursor=0;this.adjustScroll()}getSelectedIndices(){let q=[];for(let $=0;$<this.selected.length;$++)if(this.selected[$])q.push($);return q}getVisibleRange(){let q=this.scrollOffset,$=Math.min(this.scrollOffset+this.pageSize,this.totalRows);return{start:q,end:$}}adjustScroll(){if(this.cursor<this.scrollOffset)this.scrollOffset=this.cursor;else if(this.cursor>=this.scrollOffset+this.pageSize)this.scrollOffset=this.cursor-this.pageSize+1}}function DZ(q,$,Z){let Q=[];if(q.searchActive||q.filter!==""){let H=U.cyan("/"),V=q.filter,W=q.searchActive?U.cyan("█"):"";if(Q.push(` ${H}${V}${W}`),q.filteredMap.length===0)Q.push(U.dim(" No matches found"));Q.push("")}let{start:X,end:z}=q.getVisibleRange();if(X>0)Q.push(U.dim(` ... ${X} more above`));for(let H=X;H<z;H++){let W=H===q.cursor?U.cyan(">"):" ";if(H===0){let B=q.filteredMap,L=B.length>0&&B.every((O)=>q.selected[O])?U.green("[*]"):"[ ]",K=q.filter!==""?`Select All Matching (${q.filteredMap.length})`:"Select All / Deselect All";Q.push(`${W} ${L} ${U.bold(K)}`)}else{let B=q.filteredMap[H-1],_=$[B],K=q.selected[B]?U.green("[*]"):"[ ]",O=`${W} ${K} `,F=7,A=U.bold(_.label),M=_.label.length;if(_.hint){let R=Z-7-M-2;if(R>10){let T=i$(_.hint,R);Q.push(`${O}${A} ${U.dim(T)}`)}else{let T=i$(_.label,Z-7);Q.push(`${O}${U.bold(T)}`)}}else{let R=i$(_.label,Z-7);Q.push(`${O}${U.bold(R)}`)}}}let J=q.totalRows-z;if(J>0)Q.push(U.dim(` ... ${J} more below`));let G=q.getSelectedIndices().length,Y=q.filter!==""?` matching: ${q.filteredMap.length}/${q.itemCount}`:"";if(Q.push(""),q.searchActive)Q.push(U.dim(` ${G} of ${q.itemCount} selected${Y} | Type to filter Esc Clear Enter Done searching`));else Q.push(U.dim(` ${G} of ${q.itemCount} selected${Y} | `+"↑/↓ Navigate Space Toggle a All / Search Enter Confirm Esc Cancel"));return Q}function i$(q,$){if($<=0)return"";if(q.length<=$)return q;if($<=3)return q.slice(0,$);return q.slice(0,$-3)+"..."}async function p0(q){let{items:$}=q,Z=q.pageSize??Math.min($.length+1,15),Q=new o9($,Z),X=process.stderr,z=process.stdin,J=X.columns||80;if(typeof z.setRawMode==="function")z.setRawMode(!0);z.resume(),z.setEncoding("utf-8"),X.write("\x1B[?25l");let G=0;function Y(){let H=DZ(Q,$,J);if(G>0)X.write(`\x1B[${G}F`);let V=Math.max(H.length,G),W="";for(let B=0;B<V;B++)W+=`\x1B[2K${B<H.length?H[B]:""}
|
|
142
142
|
`;X.write(W),G=V}return Y(),new Promise((H)=>{let V="",W=null;function B(){if(z.removeListener("data",K),typeof z.setRawMode==="function")z.setRawMode(!1);if(z.pause(),X.write("\x1B[?25h"),W)clearTimeout(W)}function _(O){B(),H(O)}function L(O){if(Q.searchActive){if(O==="\x1B"){Q.searchActive=!1,Q.filter="",Q.applyFilter($),Y();return}if(O==="\r"||O===`
|
|
143
143
|
`){Q.searchActive=!1,Y();return}if(O===""||O==="\b"){if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter($);else Q.searchActive=!1;Y();return}if(O==="\x03"){B(),process.kill(process.pid,"SIGINT");return}if(O==="\x1B[A"){Q.moveUp(),Y();return}if(O==="\x1B[B"){Q.moveDown(),Y();return}if(O===" "){Q.toggleCurrent(),Y();return}if(O.length===1&&O>=" "&&O<="~"){Q.filter+=O,Q.applyFilter($),Y();return}return}switch(O){case"\x1B[A":case"k":Q.moveUp(),Y();break;case"\x1B[B":case"j":Q.moveDown(),Y();break;case" ":Q.toggleCurrent(),Y();break;case"a":Q.toggleAll(),Y();break;case"/":Q.searchActive=!0,Y();break;case"\r":case`
|
|
144
|
-
`:_(Q.getSelectedIndices());break;case"\x1B":if(Q.filter!=="")Q.filter="",Q.applyFilter($),Y();else _([]);break;case"":case"\b":if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter($),Y();break;case"\x03":B(),process.kill(process.pid,"SIGINT");break}}function K(O){if(V.length>0){if(V+=O,W)clearTimeout(W);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 F=V;V="",L("\x1B");for(let A=1;A<F.length;A++)L(F[A]);return}for(let F=0;F<O.length;F++){let A=O[F];if(A==="\x1B"){let M=O.slice(F);if(M.length>=3&&M[1]==="[")L(M.slice(0,3)),F+=2;else if(M.length>=2){V=M,W=setTimeout(()=>{let R=V;V="",L("\x1B");for(let T=1;T<R.length;T++)L(R[T])},50);return}else{V="\x1B",W=setTimeout(()=>{V="",L("\x1B")},50);return}}else L(A)}}z.on("data",K)})}var D0=NZ
|
|
144
|
+
`:_(Q.getSelectedIndices());break;case"\x1B":if(Q.filter!=="")Q.filter="",Q.applyFilter($),Y();else _([]);break;case"":case"\b":if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter($),Y();break;case"\x03":B(),process.kill(process.pid,"SIGINT");break}}function K(O){if(V.length>0){if(V+=O,W)clearTimeout(W);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 F=V;V="",L("\x1B");for(let A=1;A<F.length;A++)L(F[A]);return}for(let F=0;F<O.length;F++){let A=O[F];if(A==="\x1B"){let M=O.slice(F);if(M.length>=3&&M[1]==="[")L(M.slice(0,3)),F+=2;else if(M.length>=2){V=M,W=setTimeout(()=>{let R=V;V="",L("\x1B");for(let T=1;T<R.length;T++)L(R[T])},50);return}else{V="\x1B",W=setTimeout(()=>{V="",L("\x1B")},50);return}}else L(A)}}z.on("data",K)})}var D0=wZ(NZ),kZ=/^[a-zA-Z0-9_-]+$/,vZ=/^[a-zA-Z0-9._-]+$/,hZ=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,e9=128,gZ=/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\/tree\/(.+))?\/?$/;function uZ(q){return q.startsWith("/")||q.startsWith("./")||q.startsWith(".\\")||q.startsWith("../")||q.startsWith("..\\")||q.startsWith("~/")||q.startsWith("~\\")||q==="~"||q==="."||q===".."||/^[a-zA-Z]:[/\\]/.test(q)}function mZ(q){let $;if(q==="~")$=t9();else if(q.startsWith("~/")||q.startsWith("~\\"))$=s9(t9(),q.slice(2));else $=s9(q);let Z=fZ($);return E(`install: parsed local source -> path=${$}`),{owner:"local",repo:Z,ref:null,subpath:null,cloneUrl:"",sshCloneUrl:"",isLocal:!0,localPath:$}}function d0(q){if(uZ(q))return mZ(q);let $=gZ.exec(q);if($){let[,W,B,_]=$,L=B.endsWith(".git")?B.slice(0,-4):B;q=`github:${W}/${L}${_?`#${_}`:""}`}if(!q.startsWith("github:"))throw Error(`Invalid source format. Got: "${q}"
|
|
145
145
|
Supported formats:
|
|
146
146
|
github:owner/repo[#ref]
|
|
147
147
|
github:owner/repo#ref:path
|
|
148
148
|
https://github.com/owner/repo
|
|
149
149
|
https://github.com/owner/repo/tree/branch/path/to/skill
|
|
150
150
|
/path/to/local/skill
|
|
151
|
-
./relative/path/to/skill`);let Z=q.slice(7),Q=Z.indexOf("#"),X,z=null,J=null;if(Q!==-1){X=Z.slice(0,Q);let W=Z.slice(Q+1);if(!W)throw Error("Invalid source: ref cannot be empty after #");let B=W.indexOf(":");if(B!==-1){if(z=W.slice(0,B),!z)throw Error("Invalid source: ref cannot be empty before :");J=W.slice(B+1)||null}else z=W}else{let W=Z.indexOf(":");if(W!==-1)X=Z.slice(0,W),J=Z.slice(W+1)||null;else X=Z}let G=X.indexOf("/");if(G===-1)throw Error(`Invalid source: format must be github:owner/repo. Got: "${q}"`);let Y=X.slice(0,G),H=X.slice(G+1);if(!Y)throw Error("Invalid source: owner cannot be empty");if(!H)throw Error("Invalid source: repo cannot be empty");if(!
|
|
152
|
-
`)){let z=X.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(z)Z.add(z[1])}let Q=q.ref.split("/");for(let X=1;X<Q.length;X++){let z=Q.slice(0,X).join("/");if(Z.has(z)){let J=Q.slice(X).join("/");return E(`install: resolved ref="${z}" subpath="${J}"`),{...q,ref:z,subpath:J||null}}}}catch($){E(`install: ls-remote failed, treating entire ref as branch: ${$}`)}return q}function N0(q){if(!q)throw Error("Invalid skill name: name cannot be empty");if(q.includes("\x00"))throw Error("Invalid skill name: contains unsafe characters (null byte)");if(q.includes(".."))throw Error("Invalid skill name: contains unsafe characters (..)");if(q.includes("/")||q.includes("\\"))throw Error("Invalid skill name: contains unsafe characters (path separator)");if(q.startsWith("."))throw Error("Invalid skill name: must not start with a dot");if(q.length>
|
|
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;E(`install: target ${q} — no conflict`)}}import{readFile as
|
|
157
|
-
`),Z=!1,Q=!1;for(let X of $){if(X.trim()==="---")if(!Z){Z=!0;continue}else{Q=!0;continue}if(Q&&X.trim().length>0)return!0}return!1}function
|
|
151
|
+
./relative/path/to/skill`);let Z=q.slice(7),Q=Z.indexOf("#"),X,z=null,J=null;if(Q!==-1){X=Z.slice(0,Q);let W=Z.slice(Q+1);if(!W)throw Error("Invalid source: ref cannot be empty after #");let B=W.indexOf(":");if(B!==-1){if(z=W.slice(0,B),!z)throw Error("Invalid source: ref cannot be empty before :");J=W.slice(B+1)||null}else z=W}else{let W=Z.indexOf(":");if(W!==-1)X=Z.slice(0,W),J=Z.slice(W+1)||null;else X=Z}let G=X.indexOf("/");if(G===-1)throw Error(`Invalid source: format must be github:owner/repo. Got: "${q}"`);let Y=X.slice(0,G),H=X.slice(G+1);if(!Y)throw Error("Invalid source: owner cannot be empty");if(!H)throw Error("Invalid source: repo cannot be empty");if(!kZ.test(Y))throw Error(`Invalid source: owner contains invalid characters: "${Y}". Allowed: [a-zA-Z0-9_-]`);if(!vZ.test(H))throw Error(`Invalid source: repo contains invalid characters: "${H}". Allowed: [a-zA-Z0-9._-]`);let V={owner:Y,repo:H,ref:z,subpath:J,cloneUrl:`https://github.com/${Y}/${H}.git`,sshCloneUrl:`git@github.com:${Y}/${H}.git`};return E(`install: parsed source -> owner=${Y} repo=${H} ref=${z} subpath=${J}`),V}async function e$(q){if(q.subpath!==null||!q.ref||!q.ref.includes("/"))return q;try{let{stdout:$}=await D0("git",["ls-remote","--heads","--tags",q.cloneUrl],{timeout:15000}),Z=new Set;for(let X of $.split(`
|
|
152
|
+
`)){let z=X.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(z)Z.add(z[1])}let Q=q.ref.split("/");for(let X=1;X<Q.length;X++){let z=Q.slice(0,X).join("/");if(Z.has(z)){let J=Q.slice(X).join("/");return E(`install: resolved ref="${z}" subpath="${J}"`),{...q,ref:z,subpath:J||null}}}}catch($){E(`install: ls-remote failed, treating entire ref as branch: ${$}`)}return q}function N0(q){if(!q)throw Error("Invalid skill name: name cannot be empty");if(q.includes("\x00"))throw Error("Invalid skill name: contains unsafe characters (null byte)");if(q.includes(".."))throw Error("Invalid skill name: contains unsafe characters (..)");if(q.includes("/")||q.includes("\\"))throw Error("Invalid skill name: contains unsafe characters (path separator)");if(q.startsWith("."))throw Error("Invalid skill name: must not start with a dot");if(q.length>e9)throw Error(`Invalid skill name: exceeds maximum length of ${e9} characters`);if(!hZ.test(q))throw Error(`Invalid skill name: "${q}" does not match allowed pattern [a-zA-Z0-9][a-zA-Z0-9._-]*`);return q}function pZ(q){let $=q.split(/[/\\]/).filter(Boolean),Z=$.length>0?$[$.length-1]:q;return N0(Z)}function $4(q){let $=new Map;for(let Z of q){let Q=pZ(Z),X=$.get(Q);if(X)X.push(Z);else $.set(Q,[Z])}return[...$.entries()].filter(([,Z])=>Z.length>1).map(([Z,Q])=>({name:Z,paths:Q}))}async function c0(){try{await D0("git",["--version"]),E("install: git available")}catch{throw Error("git is required for installing skills. Install git from https://git-scm.com")}}function dZ(q){if(q.killed)return!1;let $=(q.stderr||q.message||"").toLowerCase();return $.includes("authentication failed")||$.includes("could not read username")||$.includes("repository not found")||$.includes("returned error: 403")||$.includes("returned error: 401")||$.includes("terminal prompts disabled")||$.includes("permission denied")}function pq(q){return q.killed?"Clone timed out after 60 seconds":`Clone failed: ${q.stderr||q.message}`}async function s$(q,$,Z){if($!==null&&/^[0-9a-f]{40}$/i.test($))return await D0("git",["clone","--no-checkout",q,Z],{timeout:60000}),await D0("git",["checkout",$],{cwd:Z,timeout:30000}),Z;let X=["clone","--depth","1"];if($)X.push("--branch",$);return X.push(q,Z),await D0("git",X,{timeout:60000}),Z}async function l0(q,$="auto"){E(`install: cloning ${q.owner}/${q.repo}${q.ref?` (ref: ${q.ref})`:""} (transport: ${$})`);let Z=await i9(V0(r9(),"asm-install-"));if($==="ssh"||$==="https"){let Q=$==="ssh"?q.sshCloneUrl:q.cloneUrl;try{return await s$(Q,q.ref,Z)}catch(X){throw await Q0(Z),Error(pq(X))}}try{return await s$(q.cloneUrl,q.ref,Z)}catch(Q){if(!dZ(Q))throw await Q0(Z),Error(pq(Q));E("install: HTTPS clone failed with auth error, retrying with SSH..."),await Q0(Z);let X=await i9(V0(r9(),"asm-install-"));try{return await s$(q.sshCloneUrl,q.ref,X)}catch(z){throw await Q0(X),Error(`Clone failed with both transports:
|
|
153
|
+
HTTPS: ${pq(Q)}
|
|
154
|
+
SSH: ${pq(z)}`)}}}async function w0(q){let $=V0(q,"SKILL.md"),Z;try{Z=await r$($,"utf-8")}catch{throw Error("Not a valid skill: SKILL.md not found in repository root")}let Q=s(Z),X=q.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 lq(q,$=5){let Z=[];async function Q(X,z,J){let G;try{G=await PZ(X)}catch{return}for(let Y of G){if(Y===".git"||Y==="node_modules")continue;let H=V0(X,Y);try{if(!(await EZ(H)).isDirectory())continue}catch{continue}let V=z?`${z}/${Y}`:Y,W=J+1,B=V0(H,"SKILL.md");try{let _=await r$(B,"utf-8"),L=s(_);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:q4(L),tokenCount:cq(_)})}catch{if(W<$)await Q(H,V,W)}}}return await Q(q,"",0),Z.sort((X,z)=>X.name.localeCompare(z.name)),Z}var cZ=[{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 Z4(q){let $=[],Z=await mq(q);for(let{relPath:Q,content:X}of Z){let z=X.split(`
|
|
155
|
+
`);for(let J=0;J<z.length;J++)for(let{category:G,pattern:Y}of cZ)if(Y.test(z[J])){let H=z[J].trim();$.push({category:G,file:Q,line:J+1,match:H.length>100?H.slice(0,100)+"…":H})}}return $}async function nq(q){let $=q.source.isLocal?`local:${q.source.localPath}`:`github:${q.source.owner}/${q.source.repo}${q.source.ref?`#${q.source.ref}`:""}${q.source.subpath?`:${q.source.subpath}`:""}`;if(q.force)try{await t$(q.targetDir),await dq(q.targetDir,{recursive:!0,force:!0})}catch{}let Z=q.sourceDir;try{await CZ(Z,q.targetDir,{recursive:!0})}catch(G){throw Error(`Failed to install: ${G.message}`)}let Q=V0(q.targetDir,".git");try{await dq(Q,{recursive:!0,force:!0})}catch{}E(`install: copied files to ${q.targetDir}`);let X=V0(q.targetDir,"SKILL.md");try{await t$(X)}catch{throw Error("Installation verification failed: SKILL.md not found at target")}let z=await r$(X,"utf-8"),J=s(z);return{success:!0,path:q.targetDir,name:J.name||q.skillName,version:z0(J),provider:q.providerLabel,source:$}}async function Q4(q,$){let Z=await nq(q);for(let Q of $){if(Q.name===q.providerName)continue;let X=q.scope==="project"?Q.project:Q.global,z=X0(X),J=V0(z,q.skillName);await xZ(z,{recursive:!0});try{if((await SZ(J)).isSymbolicLink())await dq(J);else{E(`install: skipping ${J} — existing non-symlink directory`);continue}}catch{}let G=yZ(z,q.targetDir);await bZ(G,J,"dir"),E(`install: symlinked ${J} -> ${G}`)}return Z.provider=`All (${$.map((Q)=>Q.label).join(", ")})`,Z}async function Q0(q){try{await dq(q,{recursive:!0,force:!0})}catch{}}async function X4(){try{await D0("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 z4(q,$){let Z=["--yes","skills","add",q];if($)Z.push("--skill",$);E(`install: running npx ${Z.join(" ")}`);try{let Q=await D0("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 J4(q){if(q.isLocal)return q.localPath;let $=`https://github.com/${q.owner}/${q.repo}`;if(q.ref)return`${$}/tree/${q.ref}${q.subpath?`/${q.subpath}`:""}`;return $}async function n0(q,$,Z){let Q=q.providers.filter((_)=>_.enabled);if($==="all"){if(Q.length===0)throw Error("No providers are enabled. Enable a provider in your config.");return{provider:Q.find((L)=>L.name==="agents")||Q[0],allProviders:Q}}if($){let _=q.providers.find((L)=>L.name===$);if(!_){let L=q.providers.map((K)=>K.name).join(", ");throw Error(`Unknown provider: "${$}". Valid providers: ${L}, all`)}if(!_.enabled)throw Error(`Provider "${$}" 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=q.preferences.selectedTools,J=X&&X.length>0?new Set(X):null,G=q.providers.map((_)=>({label:`${_.label} (${_.name})`,hint:_.global,checked:J?J.has(_.name):_.name==="agents"})),Y=await p0({items:G});if(Y.length===0)throw Error("No tools selected. Aborting.");let H=Y.map((_)=>q.providers[_]),V=H.map((_)=>_.name),{saveSelectedTools:W}=await import("./chunk-vgzgtfy6.js");if(await W(V),H.length===1)return{provider:H[0],allProviders:null};return{provider:H.find((_)=>_.name==="agents")||H[0],allProviders:H}}function q2(q,$,Z,Q,X,z,J="global"){let G=J==="project"?X.project:X.global,Y=X0(G),H=V0(Y,Q);return{source:q,tempDir:$,sourceDir:Z,targetDir:H,skillName:Q,force:z,providerName:X.name,providerLabel:X.label,scope:J}}async function G4(q,$){try{if(await t$(q),E(`install: target ${q} — conflict (exists)${$?", force overwrite":""}`),!$)throw Error(`Skill already exists at: ${q}
|
|
156
|
+
Use --force to overwrite.`)}catch(Z){if(Z.message?.includes("--force"))throw Z;E(`install: target ${q} — no conflict`)}}import{readFile as uY}from"fs/promises";import{join as mY}from"path";var ZY=e2(),QY=Rq(),XY=v2(),W9=Dq(),zY=Uq(),j0=k(),JY=F0(),GY=u(),YY=A0(),UY=T0(),wK=E$(),HY=Y9(),WY=U9(),VY=H9(),x$=K5(),_5=Gq();var BY=ZY.Composer,KY=QY.Document,_Y=XY.Schema,LY=W9.YAMLError,OY=W9.YAMLParseError,FY=W9.YAMLWarning,IY=zY.Alias,AY=j0.isAlias,TY=j0.isCollection,MY=j0.isDocument,jY=j0.isMap,RY=j0.isNode,DY=j0.isPair,NY=j0.isScalar,wY=j0.isSeq,PY=JY.Pair,CY=GY.Scalar,EY=YY.YAMLMap,SY=UY.YAMLSeq;var bY=HY.Lexer,xY=WY.LineCounter,yY=VY.Parser,V9=x$.parse,fY=x$.parseAllDocuments,kY=x$.parseDocument,vY=x$.stringify,hY=_5.visit,gY=_5.visitAsync;var L5=500;function pY(q){let $=q.split(`
|
|
157
|
+
`),Z=!1,Q=!1;for(let X of $){if(X.trim()==="---")if(!Z){Z=!0;continue}else{Q=!0;continue}if(Q&&X.trim().length>0)return!0}return!1}function dY(q){let $=q.split(`
|
|
158
158
|
`),Z=-1;for(let Q=0;Q<$.length;Q++)if($[Q].trim()==="---")if(Z===-1)Z=Q+1;else return $.slice(Z,Q).join(`
|
|
159
|
-
`);return null}function
|
|
159
|
+
`);return null}function cY(q){let $=dY(q);if($===null)return null;try{return V9($),null}catch(Z){return Z.message||"invalid YAML"}}async function O5(q){let $=[];if(!q.description||q.description.trim()==="")$.push({category:"missing-description",message:"Skill has no description in SKILL.md frontmatter"});if(!q.version||q.version==="0.0.0")$.push({category:"missing-version",message:"Skill has no version (or default 0.0.0) in SKILL.md frontmatter"});try{let Q=mY(q.path,"SKILL.md"),X=await uY(Q,"utf-8");if(!pY(X))$.push({category:"empty-body",message:"SKILL.md contains only frontmatter with no body content"});let z=cY(X);if(z)$.push({category:"invalid-yaml",message:`SKILL.md has invalid YAML frontmatter: ${z}`})}catch{}let Z=q.fileCount;if(Z!==void 0&&Z>L5)$.push({category:"high-file-count",message:`Skill has ${Z} files (threshold: ${L5})`});return $}import{join as rY}from"path";import{homedir as eY}from"os";import{readFile as lY,writeFile as nY,mkdir as aY}from"fs/promises";import{dirname as oY}from"path";async function iY(q){try{let $=await lY(q,"utf-8"),Z=JSON.parse($);if(!Z.fetched_at||Z.data===void 0||Z.data===null)return null;return Z}catch{return null}}async function sY(q,$,Z){let Q={fetched_at:new Date().toISOString(),ttl_seconds:Z,data:$};try{await aY(oY(q),{recursive:!0}),await nY(q,JSON.stringify(Q,null,2),"utf-8"),E(`http: wrote cache -> ${q}`)}catch(X){E(`http: failed to write cache: ${X}`)}}function tY(q){let $=new Date(q.fetched_at).getTime();return(Date.now()-$)/1000<q.ttl_seconds}async function F5(q,$,Z={}){let Q=Z.ttl??3600,X=Z.noCache??!1,z=await iY($);if(z&&!X&&tY(z))return E(`http: cache hit (fresh) -> ${$}`),z.data;try{E(`http: fetching -> ${q}`);let J=await fetch(q);if(!J.ok)throw Error(`HTTP ${J.status}: ${J.statusText}`);let G=await J.json();return await sY($,G,Q),G}catch(J){if(E(`http: fetch failed: ${J}`),z)return E(`http: using stale cache as fallback -> ${$}`),z.data;return null}}var qU=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,$U=/^[a-zA-Z0-9_-]+$/,T5=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/,ZU=/^[0-9a-f]{40}$/,QU=/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/,XU=/^[a-z0-9-]+$/,zU=/^sha256:[0-9a-f]{64}$/,I5=["pass","warning","dangerous"];function y$(q){let $=[];if(!q||typeof q!=="object"||Array.isArray(q))return[{field:"(root)",message:"manifest must be a non-null object"}];let Z=q,Q=new Set(["name","author","description","repository","commit","skill_path","version","license","tags","security_verdict","published_at","checksum"]);for(let J of Object.keys(Z))if(!Q.has(J))$.push({field:J,message:`unknown property "${J}" is not allowed`});let X=[{field:"name",pattern:qU,maxLength:128},{field:"author",pattern:$U,maxLength:39},{field:"description",maxLength:256},{field:"repository",pattern:T5},{field:"commit",pattern:ZU},{field:"published_at"}];for(let{field:J,pattern:G,maxLength:Y}of X){let H=Z[J];if(H===void 0||H===null){$.push({field:J,message:`required field "${J}" is missing`});continue}if(typeof H!=="string"){$.push({field:J,message:`"${J}" must be a string`});continue}if(H.length===0){$.push({field:J,message:`"${J}" must not be empty`});continue}if(Y&&H.length>Y)$.push({field:J,message:`"${J}" exceeds maximum length of ${Y}`});if(G&&!G.test(H))$.push({field:J,message:`"${J}" does not match required pattern`})}let z=Z.security_verdict;if(z===void 0||z===null)$.push({field:"security_verdict",message:'required field "security_verdict" is missing'});else if(typeof z!=="string"||!I5.includes(z))$.push({field:"security_verdict",message:`"security_verdict" must be one of: ${I5.join(", ")}`});if(typeof Z.published_at==="string"&&Z.published_at.length>0){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/.test(Z.published_at))$.push({field:"published_at",message:'"published_at" must be a valid ISO 8601 date-time'})}if(Z.version!==void 0){if(typeof Z.version!=="string"||!QU.test(Z.version))$.push({field:"version",message:'"version" must be a valid semver string'})}if(Z.license!==void 0){if(typeof Z.license!=="string")$.push({field:"license",message:'"license" must be a string'});else if(Z.license.length>64)$.push({field:"license",message:'"license" exceeds maximum length of 64'})}if(Z.tags!==void 0)if(!Array.isArray(Z.tags))$.push({field:"tags",message:'"tags" must be an array'});else{if(Z.tags.length>10)$.push({field:"tags",message:'"tags" has more than 10 items'});let J=new Set;for(let G=0;G<Z.tags.length;G++){let Y=Z.tags[G];if(typeof Y!=="string"){$.push({field:`tags[${G}]`,message:"tag must be a string"});continue}if(Y.length>32)$.push({field:`tags[${G}]`,message:`tag "${Y}" exceeds maximum length of 32`});if(!XU.test(Y))$.push({field:`tags[${G}]`,message:`tag "${Y}" does not match pattern (lowercase alphanumeric and hyphens)`});if(J.has(Y))$.push({field:`tags[${G}]`,message:`duplicate tag "${Y}"`});J.add(Y)}}if(Z.checksum!==void 0){if(typeof Z.checksum!=="string"||!zU.test(Z.checksum))$.push({field:"checksum",message:'"checksum" must match pattern sha256:<64-hex-chars>'})}if(Z.skill_path!==void 0){if(typeof Z.skill_path!=="string")$.push({field:"skill_path",message:'"skill_path" must be a string'});else if(Z.skill_path.length===0)$.push({field:"skill_path",message:'"skill_path" must not be empty'});else if(Z.skill_path.length>256)$.push({field:"skill_path",message:'"skill_path" exceeds maximum length of 256'});else if(/\.\.|^\//.test(Z.skill_path))$.push({field:"skill_path",message:'"skill_path" must not contain ".." or start with "/"'})}return $}function JU(q,$){let Z=q.length,Q=$.length;if(Z===0)return Q;if(Q===0)return Z;let X=Array(Q+1),z=Array(Q+1);for(let J=0;J<=Q;J++)X[J]=J;for(let J=1;J<=Z;J++){z[0]=J;for(let G=1;G<=Q;G++){let Y=q[J-1]===$[G-1]?0:1;z[G]=Math.min(X[G]+1,z[G-1]+1,X[G-1]+Y)}[X,z]=[z,X]}return X[Q]}function GU(q,$,Z=2){let Q=[];for(let X of $){if(q===X)continue;let z=JU(q,X);if(z<=Z)Q.push({existingName:X,distance:z})}return Q.sort((X,z)=>X.distance-z.distance)}var B9=process.env.ASM_REGISTRY_URL??"https://raw.githubusercontent.com/luongnv89/asm-registry/main/index.json",YU=process.env.ASM_REGISTRY_CACHE??rY(eY(),".config","agent-skill-manager","registry-cache.json"),UU=3600;function K9(q){if(q.startsWith("github:")||q.startsWith("http://")||q.startsWith("https://")||q.startsWith("/")||q.startsWith("./")||q.startsWith("../")||q.startsWith("~/")||q==="~"||q==="."||q==="..")return!1;let $=(q.match(/\//g)||[]).length;if($>1)return!1;if($===1){let[Z,Q]=q.split("/");return/^[a-zA-Z0-9_-]+$/.test(Z)&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(Q)}return/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(q)}function _9(q){if(!K9(q))return!1;return q.includes("/")}async function L9(q){let $=await F5(B9,YU,{ttl:UU,noCache:q?.noCache});if(!$)return null;if(typeof $!=="object"||!Array.isArray($.manifests)||typeof $.generated_at!=="string")return E("registry: fetched index has invalid structure — discarding"),null;let Z=[];for(let Q of $.manifests){let X=y$(Q);if(X.length>0){E(`registry: dropping invalid manifest entry (${Q?.name??"unknown"}): ${X.map((z)=>z.message).join(", ")}`);continue}if(!T5.test(Q.repository)){E(`registry: dropping manifest with unexpected repository URL: ${Q.repository}`);continue}Z.push(Q)}return{generated_at:$.generated_at,manifests:Z}}function HU(q,$){return $.manifests.filter((Z)=>Z.name.toLowerCase()===q.toLowerCase())}function WU(q,$,Z){return Z.manifests.find((Q)=>Q.author.toLowerCase()===q.toLowerCase()&&Q.name.toLowerCase()===$.toLowerCase())??null}function A5(q,$,Z=5){return GU(q,$.manifests.map((X)=>X.name),3).slice(0,Z).map((X)=>X.existingName)}async function M5(q,$){let Z=await L9($);if(!Z)return E("registry: failed to fetch index — skipping registry resolution"),{resolved:null,multipleMatches:[],suggestions:[]};if(_9(q)){let[z,J]=q.split("/"),G=WU(z,J,Z);if(G)return{resolved:{manifest:G,source:"registry"},multipleMatches:[],suggestions:[]};let Y=A5(J,Z);return{resolved:null,multipleMatches:[],suggestions:Y}}let Q=HU(q,Z);if(Q.length===1)return{resolved:{manifest:Q[0],source:"registry"},multipleMatches:[],suggestions:[]};if(Q.length>1)return{resolved:null,multipleMatches:Q,suggestions:[]};let X=A5(q,Z);return{resolved:null,multipleMatches:[],suggestions:X}}function j5(q){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:$}}import{readFile as VU,access as D5,mkdir as BU,cp as R5,rm as KU,symlink as _U}from"fs/promises";import{join as N5,basename as LU}from"path";function OU(q){let $=[];if(typeof q!=="object"||q===null||Array.isArray(q))return{valid:!1,errors:["Manifest must be a JSON object."]};let Z=q;if(Z.version!==1)$.push(`Unsupported manifest version: ${JSON.stringify(Z.version)}. Expected 1.`);if(typeof Z.exportedAt!=="string")$.push("Missing or invalid 'exportedAt' field.");if(!Array.isArray(Z.skills))return $.push("Missing or invalid 'skills' array."),{valid:!1,errors:$};for(let Q=0;Q<Z.skills.length;Q++){let X=Z.skills[Q];if(typeof X!=="object"||X===null){$.push(`skills[${Q}]: must be an object.`);continue}let z=X;if(typeof z.name!=="string"||!z.name)$.push(`skills[${Q}]: missing or empty 'name'.`);if(typeof z.dirName!=="string"||!z.dirName)$.push(`skills[${Q}]: missing or empty 'dirName'.`);if(typeof z.provider!=="string"||!z.provider)$.push(`skills[${Q}]: missing or empty 'provider'.`);if(z.scope!=="global"&&z.scope!=="project")$.push(`skills[${Q}]: invalid 'scope' "${String(z.scope)}". Must be "global" or "project".`)}return{valid:$.length===0,errors:$}}async function w5(q){let $;try{$=await VU(q,"utf-8")}catch(X){if(X?.code==="ENOENT")throw Error(`Manifest file not found: ${q}`);throw Error(`Failed to read manifest file: ${X.message}`)}let Z;try{Z=JSON.parse($)}catch{throw Error("Manifest file is not valid JSON.")}let Q=OU(Z);if(!Q.valid)throw Error(`Invalid manifest:
|
|
160
160
|
${Q.errors.join(`
|
|
161
|
-
`)}`);return Z}async function
|
|
161
|
+
`)}`);return Z}async function FU(q){try{return await D5(q),!0}catch{return!1}}function IU(q,$){return q.providers.find((Z)=>Z.name===$&&Z.enabled)}function AU(q,$,Z,Q){let X=IU(q,$);if(!X)return null;let z=Z==="global"?X.global:X.project,J=X0(z),G=LU(Q);if(!G||G==="."||G==="..")return null;return N5(J,G)}function TU(q,$){let Z=q.find((Q)=>Q.dirName===$.dirName&&Q.provider===$.provider);if(Z)return Z;return q.find((Q)=>Q.dirName===$.dirName)||null}async function P5(q,$,Z){let Q=Z?.config??await h(),X=Z?.installedSkills??await a(Q,"both"),z=[];for(let H of q.skills){if($.scopeFilter!=="both"&&H.scope!==$.scopeFilter){E(`import: skipping "${H.name}" — scope "${H.scope}" filtered out`);continue}let V=AU(Q,H.provider,H.scope,H.dirName);if(!V){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"failed",reason:`Provider "${H.provider}" not found or not enabled.`});continue}let W=await FU(V);if(W&&!$.force){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"skipped",reason:"Already installed.",path:V});continue}if($.dryRun){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"dry-run",reason:W?"Would overwrite (--force).":"Would install.",path:V});continue}let B=TU(X,H);if(!B){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"failed",reason:"No installed source found. Install the skill first with: asm install <source>"});continue}try{if(await BU(N5(V,".."),{recursive:!0}),W)await KU(V,{recursive:!0,force:!0});if(H.isSymlink&&H.symlinkTarget)try{await D5(H.symlinkTarget),await _U(H.symlinkTarget,V),E(`import: symlinked "${H.name}" -> ${H.symlinkTarget} at ${V}`)}catch{await R5(B.realPath,V,{recursive:!0}),E(`import: symlink target unreachable, copied "${H.name}" from ${B.realPath} to ${V}`)}else await R5(B.realPath,V,{recursive:!0}),E(`import: copied "${H.name}" from ${B.realPath} to ${V}`);z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"installed",path:V})}catch(_){z.push({skillName:H.name,provider:H.provider,scope:H.scope,status:"failed",reason:`Copy failed: ${_.message}`})}}let J=z.filter((H)=>H.status==="installed").length,G=z.filter((H)=>H.status==="skipped").length,Y=z.filter((H)=>H.status==="failed").length;return{total:z.length,installed:J,skipped:G,failed:Y,results:z}}import{mkdir as MU,writeFile as jU,access as RU}from"fs/promises";import{join as DU}from"path";function NU(q){return`---
|
|
162
162
|
name: ${q}
|
|
163
163
|
description: ""
|
|
164
164
|
license: ""
|
|
@@ -179,58 +179,58 @@ 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"),E(`bundle: saved to ${Z}`),Z}async function
|
|
182
|
+
`}async function C5(q,$){await MU($,{recursive:!0});let Z=DU($,"SKILL.md"),Q=NU(q);await jU(Z,Q,"utf-8")}async function E5(q){try{return await RU(q),!0}catch{return!1}}import{readdir as wU,stat as PU}from"fs/promises";import{join as CU}from"path";async function EU(q){let $=0;try{let Q=(await wU(q,{recursive:!0})).map(async(z)=>{try{let J=await PU(CU(q,z));if(J.isFile())return J.size}catch{}return 0});$=(await Promise.all(Q)).reduce((z,J)=>z+J,0)}catch{}return $}async function x5(q,$){let Z={},Q={global:0,project:0},X={},z=q.map(async(Y)=>{Z[Y.provider]=(Z[Y.provider]||0)+1,Q[Y.scope]++;let H=await EU(Y.path);return X[Y.path]=H,H}),G=(await Promise.all(z)).reduce((Y,H)=>Y+H,0);return{totalSkills:q.length,byProvider:Z,byScope:Q,totalDiskBytes:G,perSkillDiskBytes:X,duplicateGroups:$.duplicateGroups.length,duplicateInstances:$.totalDuplicateInstances}}function SU(q){if(q<1024)return`${q} B`;if(q<1048576)return`${(q/1024).toFixed(1)} KB`;if(q<1073741824)return`${(q/1048576).toFixed(1)} MB`;return`${(q/1073741824).toFixed(1)} GB`}function O9(q,$,Z=20){let Q=Math.round(q/$*Z),X=Z-Q;return U.green("#".repeat(Q))+U.dim("-".repeat(X))}var S5={claude:"Claude Code",codex:"Codex",openclaw:"OpenClaw",agents:"Agents"};function y5(q){let $=[];$.push(""),$.push(U.blueBold(" Skill Statistics")),$.push(U.dim(" "+"-".repeat(20))),$.push(""),$.push(` ${U.bold("Total:")} ${U.cyan(String(q.totalSkills))} skills`),$.push(` ${U.bold("Disk:")} ${U.cyan(SU(q.totalDiskBytes))}`),$.push(""),$.push(U.bold(" By Tool"));let Z=Object.entries(q.byProvider).sort((Y,H)=>H[1]-Y[1]),Q=Math.max(...Z.map(([,Y])=>Y)),X=Math.max(...Z.map(([Y])=>(S5[Y]||Y).length));for(let[Y,H]of Z){let V=S5[Y]||Y,W=b5(Y,V.padEnd(X)),B=String(H).padStart(4);$.push(` ${W} ${B} ${O9(H,Q)}`)}$.push(""),$.push(U.bold(" By Scope"));let z=Math.max(q.byScope.global,q.byScope.project),J=String(q.byScope.global).padStart(4),G=String(q.byScope.project).padStart(4);if($.push(` ${"global ".padEnd(X)} ${J} ${O9(q.byScope.global,z)}`),$.push(` ${"project".padEnd(X)} ${G} ${O9(q.byScope.project,z)}`),$.push(""),$.push(U.bold(" Duplicates")),q.duplicateGroups>0)$.push(` ${U.yellow(`${q.duplicateGroups} group(s), ${q.duplicateInstances} total instance(s)`)}`),$.push(U.dim(` Run ${U.bold("asm audit")} to review`));else $.push(` ${U.green("None")}`);return $.push(""),$.join(`
|
|
183
|
+
`)}import{access as bU,lstat as F9,mkdir as xU,readdir as yU,readFile as f5,rm as fU,symlink as kU}from"fs/promises";import{join as f$}from"path";async function I9(q){let $;try{$=await F9(q)}catch{throw Error(`Path does not exist: ${q}`)}if(!$.isDirectory())throw Error(`Path is not a directory: ${q}`);let Z=f$(q,"SKILL.md"),Q;try{Q=await f5(Z,"utf-8")}catch{throw Error(`No SKILL.md found in ${q}`)}let X=s(Q);if(!X.name)throw Error(`Invalid SKILL.md in ${q}: missing "name" in frontmatter`);return{name:X.name,version:z0(X)}}async function k5(q,$,Z,Q){let X=f$($,Z),z=!1;try{await bU(X),z=!0}catch{}if(z){if(!Q)throw Error(`Target already exists: ${X}. Use --force to overwrite.`);await fU(X,{recursive:!0,force:!0})}await xU($,{recursive:!0}),await kU(q,X,"dir")}async function A9(q){let $;try{$=await F9(q)}catch{throw Error(`Path does not exist: ${q}`)}if(!$.isDirectory())throw Error(`Path is not a directory: ${q}`);let Z=await yU(q),Q=[];for(let X of Z){if(X.startsWith(".")||X==="node_modules")continue;let z=f$(q,X);try{if(!(await F9(z)).isDirectory())continue}catch{continue}let J=f$(z,"SKILL.md");try{let G=await f5(J,"utf-8"),Y=s(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 vU,writeFile as hU,readdir as gU,access as uU,mkdir as mU,rm as pU}from"fs/promises";import{join as Sq,resolve as dU}from"path";import{homedir as cU}from"os";var f0=Sq(cU(),".config","agent-skill-manager","bundles");function lU(q){let $=[];if(typeof q!=="object"||q===null||Array.isArray(q))return{valid:!1,errors:["Bundle must be a JSON object."]};let Z=q;if(Z.version!==1)$.push(`Unsupported bundle version: ${JSON.stringify(Z.version)}. Expected 1.`);if(typeof Z.name!=="string"||!Z.name)$.push("Missing or empty 'name' field.");if(typeof Z.description!=="string"||!Z.description)$.push("Missing or empty 'description' field.");if(typeof Z.author!=="string"||!Z.author)$.push("Missing or empty 'author' field.");if(typeof Z.createdAt!=="string")$.push("Missing or invalid 'createdAt' field.");if(!Array.isArray(Z.skills))return $.push("Missing or invalid 'skills' array."),{valid:!1,errors:$};if(Z.skills.length===0)$.push("Bundle must contain at least one skill.");for(let Q=0;Q<Z.skills.length;Q++){let X=Z.skills[Q];if(typeof X!=="object"||X===null){$.push(`skills[${Q}]: must be an object.`);continue}let z=X;if(typeof z.name!=="string"||!z.name)$.push(`skills[${Q}]: missing or empty 'name'.`);if(typeof z.installUrl!=="string"||!z.installUrl)$.push(`skills[${Q}]: missing or empty 'installUrl'.`)}if(Z.tags!==void 0){if(!Array.isArray(Z.tags))$.push("'tags' must be an array of strings if provided.");else if(Z.tags.some((Q)=>typeof Q!=="string"))$.push("'tags' must contain only strings.")}return{valid:$.length===0,errors:$}}function v5(q,$,Z,Q,X){return{version:1,name:q,description:$,author:Z,createdAt:new Date().toISOString(),skills:Q,tags:X}}async function h5(q,$){let Z=$??await k0(),Q=Z.skills[q.name]||Z.skills[q.dirName],X;if(q.isSymlink&&q.symlinkTarget)X=q.symlinkTarget;else if(Q?.source)X=Q.source;else X=q.path;return{name:q.name,installUrl:X,description:q.description||void 0,version:q.version||void 0}}async function nU(){await mU(f0,{recursive:!0})}function M9(q){let $=q.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if($=$.replace(/^\.+|\.+$/g,""),!$||$==="."||$==="..")throw Error("Invalid bundle name: results in an empty filename after sanitization.");return $}async function g5(q){await nU();let $=`${M9(q.name)}.json`,Z=Sq(f0,$);return await hU(Z,JSON.stringify(q,null,2)+`
|
|
184
|
+
`,"utf-8"),E(`bundle: saved to ${Z}`),Z}async function T9(q){let $;try{$=await vU(q,"utf-8")}catch(X){if(X?.code==="ENOENT")throw Error(`Bundle file not found: ${q}`);throw Error(`Failed to read bundle file: ${X.message}`)}let Z;try{Z=JSON.parse($)}catch{throw Error("Bundle file is not valid JSON.")}let Q=lU(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],H=Y.trim();for(let V of
|
|
188
|
-
`)}function
|
|
189
|
-
About to publish "${o}" by ${
|
|
186
|
+
`)}`);return Z}async function j9(q){if(q.includes("/")||q.includes("\\")||q.endsWith(".json")){let Q=dU(q);return T9(Q)}let $=`${M9(q)}.json`,Z=Sq(f0,$);return T9(Z)}async function u5(){let q=[];try{await uU(f0)}catch{return q}let $;try{$=await gU(f0)}catch{return q}for(let Z of $){if(!Z.endsWith(".json"))continue;let Q=Sq(f0,Z);try{let X=await T9(Q);q.push(X)}catch{E(`bundle: skipping invalid file ${Q}`)}}return q.sort((Z,Q)=>Z.name.localeCompare(Q.name)),q}async function m5(q){let $=`${M9(q)}.json`,Z=Sq(f0,$);try{return await pU(Z),E(`bundle: removed ${Z}`),!0}catch(Q){if(Q?.code==="ENOENT")return!1;throw Q}}import{readFile as ZH,realpath as QH}from"fs/promises";import{join as XH,resolve as zH,relative as JH}from"path";var c5=[{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bcurl\b/,severity:"critical",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bwget\b/,severity:"critical",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bfetch\s*\(/,severity:"warning",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\baxios\b/,severity:"warning",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bhttp\.request\b/,severity:"warning",permissionType:"network"},{category:"Network requests",description:"Commands or APIs that download or upload data over the network",pattern:/\bXMLHttpRequest\b/,severity:"warning",permissionType:"network"},{category:"External URLs",description:"Hardcoded URLs that may indicate data exfiltration or remote payload loading",pattern:/https?:\/\/(?!github\.com|localhost|127\.0\.0\.1|example\.com)/,severity:"warning",permissionType:"network"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bexec\s*\(/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bexecSync\b/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bchild_process\b/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bspawn\s*\(/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bBun\.spawn\b/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\bshelljs\b/,severity:"critical",permissionType:"shell"},{category:"Shell execution",description:"Commands that execute shell processes or arbitrary system commands",pattern:/\b(?:bash|sh|zsh)\s+-c\b/,severity:"critical",permissionType:"shell"},{category:"Dynamic code execution",description:"Patterns that execute dynamically constructed code at runtime",pattern:/\beval\s*\(/,severity:"critical",permissionType:"code-execution"},{category:"Dynamic code execution",description:"Patterns that execute dynamically constructed code at runtime",pattern:/\bnew\s+Function\b/,severity:"critical",permissionType:"code-execution"},{category:"Dynamic code execution",description:"Patterns that execute dynamically constructed code at runtime",pattern:/\bFunction\s*\(/,severity:"critical",permissionType:"code-execution"},{category:"Dynamic code execution",description:"Patterns that execute dynamically constructed code at runtime",pattern:/\bimport\s*\(\s*[^'"]/,severity:"warning",permissionType:"code-execution"},{category:"File system access",description:"Operations that read, write, or modify files on disk",pattern:/\bfs\.(?:write|append|unlink|rm|mkdir|rename)\b/,severity:"warning",permissionType:"filesystem"},{category:"File system access",description:"Operations that read, write, or modify files on disk",pattern:/\bwriteFile(?:Sync)?\b/,severity:"warning",permissionType:"filesystem"},{category:"File system access",description:"Operations that read, write, or modify files on disk",pattern:/\brm\s+-rf?\b/,severity:"critical",permissionType:"filesystem"},{category:"File system access",description:"Operations that read, write, or modify files on disk",pattern:/\bchmod\b/,severity:"warning",permissionType:"filesystem"},{category:"Embedded credentials",description:"Hardcoded secrets, API keys, tokens, or passwords",pattern:/\b(?:API_KEY|SECRET_KEY|ACCESS_TOKEN|PRIVATE_KEY)\s*[=:]/,severity:"critical"},{category:"Embedded credentials",description:"Hardcoded secrets, API keys, tokens, or passwords",pattern:/\bPASSWORD\s*[=:]/,severity:"critical"},{category:"Embedded credentials",description:"Hardcoded secrets, API keys, tokens, or passwords",pattern:/(?:sk|pk)[-_](?:live|test)[-_][a-zA-Z0-9]{20,}/,severity:"critical"},{category:"Environment variable access",description:"Reading environment variables which may contain secrets or configuration",pattern:/\bprocess\.env\b/,severity:"info",permissionType:"environment"},{category:"Environment variable access",description:"Reading environment variables which may contain secrets or configuration",pattern:/\bBun\.env\b/,severity:"info",permissionType:"environment"},{category:"Obfuscation patterns",description:"Base64 encoding, hex strings, or other obfuscation techniques",pattern:/\batob\s*\(/,severity:"warning"},{category:"Obfuscation patterns",description:"Base64 encoding, hex strings, or other obfuscation techniques",pattern:/\bBuffer\.from\s*\([^,]+,\s*['"]base64['"]\)/,severity:"warning"},{category:"Obfuscation patterns",description:"Base64 encoding, hex strings, or other obfuscation techniques",pattern:/\\x[0-9a-fA-F]{2}(?:\\x[0-9a-fA-F]{2}){5,}/,severity:"warning"}];async function aU(q,$){let Z={owner:q,repo:$,profileUrl:`https://github.com/${q}`,reposUrl:`https://github.com/${q}?tab=repositories`,isOrganization:null,publicRepos:null,accountAge:null,fetchError:null};try{let Q=await fetch(`https://api.github.com/users/${q}`,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"agent-skill-manager"},signal:AbortSignal.timeout(1e4)});if(!Q.ok)return Z.fetchError=`GitHub API returned ${Q.status}`,Z;let X=await Q.json();if(Z.isOrganization=X.type==="Organization",Z.publicRepos=typeof X.public_repos==="number"?X.public_repos:null,typeof X.created_at==="string"){let z=new Date(X.created_at),J=new Date,G=Math.floor((J.getTime()-z.getTime())/31557600000),Y=Math.floor((J.getTime()-z.getTime())%31557600000/2630016000.0000005);Z.accountAge=G>0?`${G}y ${Y}m`:`${Y}m`}E(`security-audit: source analysis for ${q} -> repos=${Z.publicRepos}, org=${Z.isOrganization}, age=${Z.accountAge}`)}catch(Q){Z.fetchError=Q.message||"Failed to fetch GitHub profile",E(`security-audit: source analysis failed -> ${Z.fetchError}`)}return Z}function oU(q){let $=new Map;for(let{relPath:X,content:z}of q){let J=z.split(`
|
|
187
|
+
`);for(let G=0;G<J.length;G++){let Y=J[G],H=Y.trim();for(let V of c5)if(V.pattern.test(Y)){let W=V.category;if(!$.has(W))$.set(W,{description:V.description,matches:[]});let B=H.length>120?H.slice(0,120)+"...":H;$.get(W).matches.push({file:X,line:G+1,match:B,severity:V.severity})}}}let Z=[];for(let[X,z]of $)Z.push({category:X,description:z.description,matches:z.matches});let Q={critical:0,warning:1,info:2};return Z.sort((X,z)=>{let J=Math.min(...X.matches.map((Y)=>Q[Y.severity])),G=Math.min(...z.matches.map((Y)=>Q[Y.severity]));return J-G}),Z}function iU(q){let $=new Map;for(let z of q)for(let J of z.matches)for(let G of c5)if(G.permissionType&&G.category===z.category&&G.pattern.test(J.match)){let Y=G.permissionType;if(!$.has(Y))$.set(Y,{evidence:[],categories:new Set});let H=$.get(Y);H.evidence.push({file:J.file,line:J.line,match:J.match}),H.categories.add(z.category);break}let Z={filesystem:"Skill reads, writes, or modifies files on disk. Verify it only accesses intended paths.",shell:"Skill executes shell commands or spawns processes. This allows arbitrary system access.",network:"Skill makes network requests or downloads external content. Data may be sent to remote servers.","code-execution":"Skill dynamically constructs and executes code. This can bypass static analysis.",environment:"Skill reads environment variables, which may contain secrets or API keys."},Q=[];for(let[z,J]of $)Q.push({type:z,evidence:J.evidence,reason:Z[z]});let X={shell:0,"code-execution":1,network:2,filesystem:3,environment:4};return Q.sort((z,J)=>(X[z.type]??99)-(X[J.type]??99)),Q}function sU(q,$,Z){let Q=0,X=0;for(let Y of q)for(let H of Y.matches){if(H.severity==="critical")Q++;if(H.severity==="warning")X++}let z=$.some((Y)=>Y.type==="shell"),J=$.some((Y)=>Y.type==="code-execution"),G=$.some((Y)=>Y.type==="network");if(z&&G)return{verdict:"dangerous",reason:"Skill has both shell execution and network access -- potential data exfiltration risk."};if(J&&G)return{verdict:"dangerous",reason:"Skill has dynamic code execution and network access -- potential remote code execution risk."};if(Q>=10)return{verdict:"dangerous",reason:`${Q} critical findings detected. High concentration of risky patterns.`};if(z||J)return{verdict:"warning",reason:z?"Skill executes shell commands. Review commands carefully before installing.":"Skill uses dynamic code execution. Review usage carefully."};if(Q>0)return{verdict:"warning",reason:`${Q} critical finding${Q>1?"s":""} detected. Manual review recommended.`};if(X>0)return{verdict:"caution",reason:`${X} warning${X>1?"s":""} found. Generally acceptable but worth reviewing.`};if(Z&&Z.publicRepos!==null&&Z.publicRepos<3)return{verdict:"caution",reason:"No code issues found, but the author has very few public repositories."};return{verdict:"safe",reason:"No suspicious patterns detected."}}async function R0(q,$,Z,Q){E(`security-audit: scanning ${q}`);let X=await mq(q),z=X.reduce((W,B)=>W+B.lineCount,0),J=null;if(Z&&Q)J=await aU(Z,Q);let G=oU(X),Y=iU(G),{verdict:H,reason:V}=sU(G,Y,J);return{scannedAt:new Date().toISOString(),skillName:$,skillPath:q,source:J,codeScans:G,permissions:Y,totalFiles:X.length,totalLines:z,verdict:H,verdictReason:V}}var b=U,v0=56,tU={"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"},p5={critical:0,warning:1,info:2};function rU(q){switch(q){case"safe":return b.bgGreen(" SAFE ");case"caution":return b.bgCyan(" CAUTION ");case"warning":return b.bgYellow(" WARNING ");case"dangerous":return b.bgRed(" DANGEROUS ")}}function eU(q){switch(q){case"safe":return b.green;case"caution":return b.cyan;case"warning":return b.yellow;case"dangerous":return b.red}}function Xq(q){switch(q){case"critical":return b.red("!!");case"warning":return b.yellow(" !");case"info":return b.dim(" i")}}function R9(q,$){return q.length>$?q.slice(0,$-3)+"...":q}function k$(q){return q.toLocaleString("en-US")}function l5(q){return q.replace(/\x1b\[[0-9;]*m/g,"")}function d5(q){return l5(q).length}function qH(q){let $=new Map;for(let Z of q){let Q=`${Z.file}:${Z.line}`,X=$.get(Q);if(!X||p5[Z.severity]<p5[X.severity])$.set(Q,Z)}return Array.from($.values())}function $H(q){let $=new Map;for(let Z of q){let Q=$.get(Z.file);if(!Q)Q={file:Z.file,entries:[]},$.set(Z.file,Q);Q.entries.push({line:Z.line,match:Z.match,severity:Z.severity})}return Array.from($.values())}function v$(q){let $=[],Z=rU(q.verdict),Q=l5(Z),X=` ${b.bold(q.skillName)}`,z=` ${q.skillName}`,J=v0-4,G=Math.max(1,J-z.length-Q.length);if($.push(""),$.push(b.dim(" +-- ")+b.bold("Security Audit")+b.dim(" "+"-".repeat(v0-19)+"+")),$.push(b.dim(" |")+X+" ".repeat(G)+Z+b.dim("|")),$.push(b.dim(" |")+b.dim(` ${k$(q.totalFiles)} files | ${k$(q.totalLines)} lines`)+" ".repeat(Math.max(1,J-` ${k$(q.totalFiles)} files | ${k$(q.totalLines)} lines`.length))+b.dim("|")),$.push(b.dim(" +"+"-".repeat(v0-2)+"+")),q.source){let W=q.source;if(W.fetchError)$.push(` ${b.yellow("!")} Could not fetch profile: ${W.fetchError}`);else{let B=[];if(B.push(`${W.owner} ${W.isOrganization?b.cyan("(org)"):b.dim("(user)")}`),W.publicRepos!==null){let _=W.publicRepos,L=_<3?b.yellow(`${_} repos`):_<10?b.cyan(`${_} repos`):b.green(`${_} repos`);B.push(L)}if(W.accountAge)B.push(W.accountAge);$.push(` ${b.dim("Author:")} ${B.join(b.dim(" | "))}`)}}if($.push(""),q.codeScans.length===0)$.push(` ${b.green("*")} ${b.green("No suspicious patterns detected.")}`);else{let W=eU(q.verdict),B=q.verdict==="dangerous"||q.verdict==="warning"?Xq("critical"):q.verdict==="caution"?Xq("warning"):Xq("info");$.push(` ${B} ${W(q.verdictReason)}`);let _=0,L=0,K=0;for(let M of q.codeScans)for(let R of M.matches)if(R.severity==="critical")_++;else if(R.severity==="warning")L++;else K++;let 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 F=q.permissions.map((M)=>M.type),A=F.length>0?b.dim(`Perms: ${F.join(", ")}`):"";$.push(` ${O.join(b.dim(" | "))} ${A}`)}if($.push(""),q.codeScans.length>0){$.push(` ${b.bold("Findings")}`),$.push(b.dim(" "+"=".repeat(v0-2)));for(let W of q.codeScans){let B=qH(W.matches),_=B.filter((I)=>I.severity==="critical").length,L=B.filter((I)=>I.severity==="warning").length,K=B.filter((I)=>I.severity==="info").length,O=_>0?Xq("critical"):L>0?Xq("warning"):Xq("info"),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 A=tU[W.category],M=A?b.dim(`PERM: ${A}`):"",R=` ${O} ${b.bold(W.category)} (${F.join(", ")})`;if(M){let I=d5(R),j=d5(M),C=Math.max(2,v0-I-j);$.push(R+" ".repeat(C)+M)}else $.push(R);let T=$H(B),D=Math.min(24,Math.max(...T.map((I)=>I.file.length))),x=0,w=3;for(let I of T){if(x>=w)break;let j=R9(I.file,24),C=b.dim(j.padEnd(D));if(I.entries.length===1){let S=I.entries[0],y=R9(S.match,50);$.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((d)=>`:${d.line}`).join(", "),y=R9(I.entries[0].match,40);$.push(` ${C} ${S} ${b.dim("--")} ${b.dim(y)}`),x++}else{let y=I.entries.slice(0,3).map((p)=>`:${p.line}`).join(", "),d=I.entries.length-3;$.push(` ${C} ${y} ${b.dim(`(+${d} more)`)}`),x++}}let f=T.length-Math.min(T.length,w);if(f>0){let I=B.length-T.slice(0,w).reduce((j,C)=>j+C.entries.length,0);if(I>0)$.push(` ${b.dim(`... ${I} more in ${f} file${f>1?"s":""}`)}`)}$.push("")}}$.push(b.dim(" "+"=".repeat(v0-2)));let Y=new Date(q.scannedAt),H=`${Y.getFullYear()}-${String(Y.getMonth()+1).padStart(2,"0")}-${String(Y.getDate()).padStart(2,"0")} ${String(Y.getHours()).padStart(2,"0")}:${String(Y.getMinutes()).padStart(2,"0")}`,V=q.source&&!q.source.fetchError?`github.com/${q.source.owner}`:"";if(V){let W=Math.max(2,v0-2-H.length-V.length);$.push(b.dim(` ${H}${" ".repeat(W)}${V}`))}else $.push(b.dim(` ${H}`));return $.push(""),$.join(`
|
|
188
|
+
`)}function D9(q){return JSON.stringify(q,null,2)}function h$(q){return q.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07]*\x07/g,"").replace(/\x1b[^[\]]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}function GH(q){return q.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/</g,"<").replace(/>/g,">").replace(/\|/g,"\\|")}function N9(q){return GH(h$(q))}var h0="luongnv89/asm-registry";async function YH(q){let $=XH(q,"SKILL.md"),Z;try{Z=await ZH($,"utf-8")}catch{throw Error(`No SKILL.md found in ${q}. Run "asm init" to create one.`)}let Q=s(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 UH(q){if(await Bun.spawn(["git","rev-parse","--git-dir"],{cwd:q,stdout:"pipe",stderr:"pipe"}).exited!==0)throw Error(`${q} is not inside a git repository.`)}async function HH(q){let $=Bun.spawn(["git","rev-parse","HEAD"],{cwd:q,stdout:"pipe",stderr:"pipe"}),Z=await new Response($.stdout).text();if(await $.exited!==0)throw Error("Failed to get HEAD commit. Is this a git repository?");return Z.trim()}async function WH(q){let $=Bun.spawn(["git","rev-parse","--show-toplevel"],{cwd:q,stdout:"pipe",stderr:"pipe"}),Z=await new Response($.stdout).text();if(await $.exited!==0)throw Error("Failed to determine git repository root.");return Z.trim()}async function VH(q){let $=Bun.spawn(["git","remote","get-url","origin"],{cwd:q,stdout:"pipe",stderr:"pipe"}),Z=await new Response($.stdout).text();if(await $.exited!==0)throw Error("No remote origin found. Add one with: git remote add origin <url>");let X=Z.trim(),z=X.match(/^git@github\.com:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+?)(?:\.git)?$/);if(z)return`https://github.com/${z[1]}/${z[2]}`;return X.replace(/\.git$/,"")}async function BH(){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 KH(q){switch(q){case"safe":case"caution":return"pass";case"warning":return"warning";case"dangerous":return"dangerous"}}function n5(q){let $={name:q.metadata.name,author:q.author,description:q.metadata.description,repository:q.repository,commit:q.commit,security_verdict:q.securityVerdict,published_at:new Date().toISOString()};if(q.skillPath)$.skill_path=q.skillPath;if(q.metadata.version&&q.metadata.version!=="0.0.0"&&/^\d+\.\d+\.\d+/.test(q.metadata.version))$.version=q.metadata.version;if(q.metadata.license)$.license=q.metadata.license;if(q.metadata.tags&&q.metadata.tags.length>0)$.tags=q.metadata.tags.slice(0,10);return $}function _H(q){let $=n5({metadata:q.metadata,author:q.metadata.creator||"unknown",commit:q.commit,repository:q.repository,securityVerdict:q.registryVerdict}),Z=y$($);if(Z.length>0)return{success:!1,manifest:$,prUrl:null,error:`Manifest validation failed: ${Z.map((Q)=>`${Q.field}: ${Q.message}`).join("; ")}`,securityVerdict:q.registryVerdict,securityReport:q.securityReport};return{success:!0,manifest:$,prUrl:null,error:null,securityVerdict:q.registryVerdict,securityReport:q.securityReport,fallback:!0,fallbackReason:q.fallbackReason}}async function a5(q){let $=zH(q.path);E(`publish: starting for ${$}`),await UH($);let Z=await YH($);E(`publish: parsed metadata for "${Z.name}"`);let X=await(q._auditFn??R0)($,Z.name),z=KH(X.verdict);if(z==="dangerous")return{success:!1,manifest:null,prUrl:null,error:`Security audit verdict: dangerous. ${X.verdictReason}`,securityVerdict:z,securityReport:X};if(z==="warning"&&!q.force)return{success:!1,manifest:null,prUrl:null,error:"Security audit verdict: warning. Use --force to override warnings.",securityVerdict:z,securityReport:X};let J=await HH($),G=await VH($),Y=await WH($),H=await QH($),V=JH(Y,H),W=V&&V!=="."?V:void 0,_=await(q._checkGhCliFn??BH)();if(!_.available||!_.authenticated){let o=!_.available?"gh CLI not found":"gh CLI not authenticated";return _H({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=n5({metadata:Z,author:L,commit:J,repository:G,skillPath:W,securityVerdict:z}),O=y$(K);if(O.length>0)return{success:!1,manifest:K,prUrl:null,error:`Manifest validation failed: ${O.map((o)=>`${o.field}: ${o.message}`).join("; ")}`,securityVerdict:z,securityReport:X};if(q.dryRun)return{success:!0,manifest:K,prUrl:null,error:null,securityVerdict:z,securityReport:X};if(!q.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=h$(Z.name),gq=h$(L);process.stderr.write(`
|
|
189
|
+
About to publish "${o}" by ${gq} to ${h0}.
|
|
190
190
|
Security verdict: ${z}
|
|
191
191
|
|
|
192
|
-
Proceed? [y/N] `);let
|
|
193
|
-
`))process.stdin.removeListener("data",
|
|
194
|
-
`,T=Buffer.from(R,"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 f=x.trim();if(await Bun.spawn(["gh","api",`repos/${L}/asm-registry/git/refs`,"-X","POST","-f",`ref=refs/heads/${A}`,"-f",`sha=${f}`],{stdout:"pipe",stderr:"pipe"}).exited!==0)await Bun.spawn(["gh","api",`repos/${L}/asm-registry/git/refs/heads/${A}`,"-X","PATCH","-f",`sha=${f}`,"-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"}),
|
|
195
|
-
`),Z0=Bun.spawn(["gh","pr","create","--repo",h0,"--head",`${L}:${A}`,"--title",
|
|
192
|
+
Proceed? [y/N] `);let o$=await new Promise((n9)=>{let uq="",a9=(FZ)=>{if(uq+=FZ.toString(),uq.includes(`
|
|
193
|
+
`))process.stdin.removeListener("data",a9),process.stdin.pause(),n9(uq.trim())};process.stdin.resume(),process.stdin.on("data",a9)});if(o$.toLowerCase()!=="y"&&o$.toLowerCase()!=="yes")return{success:!1,manifest:K,prUrl:null,error:"Publish aborted by user.",securityVerdict:z,securityReport:X}}E(`publish: forking ${h0}`),await Bun.spawn(["gh","repo","fork",h0,"--clone=false"],{stdout:"pipe",stderr:"pipe"}).exited;let A=`publish/${L}/${Z.name}`,M=`manifests/${L}/${Z.name}.json`,R=JSON.stringify(K,null,2)+`
|
|
194
|
+
`,T=Buffer.from(R,"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 f=x.trim();if(await Bun.spawn(["gh","api",`repos/${L}/asm-registry/git/refs`,"-X","POST","-f",`ref=refs/heads/${A}`,"-f",`sha=${f}`],{stdout:"pipe",stderr:"pipe"}).exited!==0)await Bun.spawn(["gh","api",`repos/${L}/asm-registry/git/refs/heads/${A}`,"-X","PATCH","-f",`sha=${f}`,"-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"}),gq=(await new Response(o.stdout).text()).trim();if(await o.exited===0&&gq){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=${gq}`],{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 d=N9(Z.name),p=N9(Z.description),i=N9(Z.license),vq=`Publish ${L}/${h$(Z.name)}`,W0=[`## Skill: ${d}`,"",`**Author:** ${L}`,`**Version:** ${Z.version}`,`**Description:** ${p}`,`**License:** ${i}`,`**Repository:** ${G}`,`**Commit:** \`${J}\``,`**Security verdict:** ${z}`,"","---","","*This PR was generated by `asm publish`.*"].join(`
|
|
195
|
+
`),Z0=Bun.spawn(["gh","pr","create","--repo",h0,"--head",`${L}:${A}`,"--title",vq,"--body",W0],{stdout:"pipe",stderr:"pipe"}),u0=await new Response(Z0.stdout).text(),hq=await new Response(Z0.stderr).text(),Jq=await Z0.exited,m0=null;if(Jq===0)m0=u0.trim();else{let o=hq.match(/https:\/\/github\.com\/[^\s]+\/pull\/\d+/);if(o)m0=o[0]}if(!m0)return{success:!1,manifest:K,prUrl:null,error:`Failed to create PR against ${h0}. ${hq}`,securityVerdict:z,securityReport:X};return{success:!0,manifest:K,prUrl:m0,error:null,securityVerdict:z,securityReport:X}}function o5(q){let $=q.manifest;if(!$)return"";return["",` gh CLI is unavailable (${q.fallbackReason}).`," To publish manually:","",` 1. Fork ${h0} on GitHub`,` 2. Create branch: publish/${$.author}/${$.name}`,` 3. Add file: manifests/${$.author}/${$.name}.json`," 4. Paste the manifest below into that file",` 5. Open a PR against ${h0}`,"",' Run "asm doctor" to fix your environment.',""," Generated manifest:",JSON.stringify($,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 E(`updater: git ls-remote failed for ${q}: ${Z}`),null}}function
|
|
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
|
|
198
|
+
`)}import{execFile as LH}from"child_process";import{promisify as OH}from"util";import{rm as g$,rename as i5,cp as s5,access as FH,mkdir as IH}from"fs/promises";import{join as u$}from"path";import{homedir as t5}from"os";var w9=OH(LH);async function AH(q,$,Z){let Q=Array(q.length),X=0;async function z(){while(X<q.length){let G=X++;Q[G]=await Z(q[G])}}let J=[];for(let G=0;G<Math.min($,q.length);G++)J.push(z());return await Promise.all(J),Q}async function TH(q,$){try{let Z=["ls-remote",q];if($)Z.push($);else Z.push("HEAD");let{stdout:Q}=await w9("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 ${q}: ${Z}`),null}}function P9(q){if(q.sourceType)return q.sourceType;if(q.source.startsWith("local:"))return"local";return"github"}function r5(q){if(q.startsWith("github:")){let $=q.slice(7),Z=$.indexOf("#");if(Z!==-1)$=$.slice(0,Z);return`https://github.com/${$}.git`}if(q.startsWith("file://"))return q;return null}function MH(q){if(!q.startsWith("github:"))return null;let $=q.slice(7),Z=$.indexOf("#");if(Z!==-1)$=$.slice(0,Z);let Q=$.split("/");if(Q.length<2||!Q[0]||!Q[1])return null;return{owner:Q[0],repo:Q[1]}}async function C9(q){let $=q?.readLockFn??k0,Z=q?.fetchRegistryIndexFn??L9,Q=q?.lock??await $(),X=Object.entries(Q.skills);if(X.length===0)return{entries:[],outdatedCount:0,upToDateCount:0,untrackedCount:0,errorCount:0};let z=null;if(X.some(([,Y])=>P9(Y)==="registry"||Y.registryName))z=await Z();let G=await AH(X,5,async([Y,H])=>{let V=P9(H);if(!H.commitHash||H.commitHash==="unknown")return{name:Y,installedCommit:H.commitHash||"unknown",latestCommit:"unknown",source:H.source,sourceType:V,status:"untracked"};if(V==="local")return{name:Y,installedCommit:H.commitHash,latestCommit:H.commitHash,source:H.source,sourceType:V,status:"up-to-date"};if(V==="registry"&&z){let L=H.registryName||Y,K=z.manifests.find((O)=>O.name.toLowerCase()===L.toLowerCase());if(K){let O=K.commit!==H.commitHash;return{name:Y,installedCommit:H0(H.commitHash),latestCommit:H0(K.commit),source:H.source,sourceType:V,status:O?"outdated":"up-to-date"}}}let W=r5(H.source);if(!W)return{name:Y,installedCommit:H0(H.commitHash),latestCommit:"unknown",source:H.source,sourceType:V,status:"error",error:"Cannot determine remote URL"};let B=await TH(W,H.ref);if(!B)return{name:Y,installedCommit:H0(H.commitHash),latestCommit:"unknown",source:H.source,sourceType:V,status:"error",error:"Failed to fetch remote commit"};let _=B!==H.commitHash;return{name:Y,installedCommit:H0(H.commitHash),latestCommit:H0(B),source:H.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 jH(q,$,Z,Q){if(P9($)==="local")return{name:q,status:"skipped",reason:"Local skill (not updatable)"};let z=r5($.source);if(!z)return{name:q,status:"failed",reason:"Cannot determine remote URL"};let J=u$(t5(),".config","agent-skill-manager",".tmp",`${q}-${Date.now()}`);try{let G=u$(t5(),".config","agent-skill-manager",".tmp");await IH(G,{recursive:!0}),E(`updater: cloning latest ${q} to ${J}`);let Y=["clone","--depth","1"];if($.ref&&$.ref!=="HEAD")Y.push("--branch",$.ref);Y.push(z,J);try{await w9("git",Y,{timeout:60000})}catch(T){return{name:q,status:"failed",reason:`Clone failed: ${T.stderr||T.message}`}}let H=null;try{let{stdout:T}=await w9("git",["rev-parse","HEAD"],{cwd:J,timeout:5000});H=T.trim()}catch{return{name:q,status:"failed",reason:"Could not read new commit"}}if(H===$.commitHash)return{name:q,status:"skipped",reason:"Already up to date"};E(`updater: running security audit on ${q}`);let V="safe";try{let T=Q?.auditFn??R0,D=MH($.source);if(V=(await T(J,q,D?.owner,D?.repo)).verdict,V==="dangerous")return{name:q,status:"skipped",reason:"Security audit: dangerous — update blocked",securityVerdict:V};if(V==="warning"||V==="caution"){if(!Z)return{name:q,status:"skipped",reason:`Security audit: ${V} — use --yes to override`,securityVerdict:V};E(`updater: security audit ${V} for ${q} — proceeding (--yes)`)}}catch(T){return E(`updater: security audit failed for ${q}: ${T.message}`),{name:q,status:"failed",reason:`Security audit failed — skipping update: ${T.message}`}}let W=Q?.loadConfigFn??h,B=Q?.resolveProviderPathFn??X0,L=(await W()).providers.find((T)=>T.name===$.provider),K=L?L.global:`~/.${$.provider}/skills`,O=B(K),F=u$(O,q),A=u$(J,".git");try{await g$(A,{recursive:!0,force:!0})}catch{}try{await FH(F)}catch{let T=Q?.writeLockEntryFn??bq;return await s5(J,F,{recursive:!0}),await T(q,{...$,commitHash:H,installedAt:new Date().toISOString()}),{name:q,status:"updated",oldCommit:H0($.commitHash),newCommit:H0(H),securityVerdict:V}}let M=`${F}.bak-${Date.now()}`;try{await i5(F,M),await s5(J,F,{recursive:!0}),await g$(M,{recursive:!0,force:!0})}catch(T){try{await g$(F,{recursive:!0,force:!0}),await i5(M,F)}catch{}return{name:q,status:"failed",reason:`Atomic swap failed: ${T.message}`}}return await(Q?.writeLockEntryFn??bq)(q,{...$,commitHash:H,installedAt:new Date().toISOString()}),{name:q,status:"updated",oldCommit:H0($.commitHash),newCommit:H0(H),securityVerdict:V}}finally{try{await g$(J,{recursive:!0,force:!0})}catch{}}}async function e5(q,$,Z){let Q=Z?.readLockFn??k0,X=Z?.checkOutdatedFn??C9,z=Z?.updateSkillFn??jH,J=await Q(),G=await X({lock:J}),Y=G.entries.filter((W)=>W.status==="outdated"),H=[];if(q&&q.length>0){let W=new Set(q.map((B)=>B.toLowerCase()));Y=Y.filter((B)=>W.has(B.name.toLowerCase()));for(let B of q)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`),H.push(B);else E(`updater: skill "${B}" is already up to date`)}if(Y.length===0)return{results:[],updatedCount:0,skippedCount:0,failedCount:0,...H.length>0?{warnings:H}:{}};let V=[];for(let W of Y){let B=J.skills[W.name];if(!B)continue;let _=await z(W.name,B,$);V.push(_)}return{results:V,updatedCount:V.filter((W)=>W.status==="updated").length,skippedCount:V.filter((W)=>W.status==="skipped").length,failedCount:V.filter((W)=>W.status==="failed").length,...H.length>0?{warnings:H}:{}}}function H0(q){if(!q||q==="unknown")return"unknown";return q.slice(0,7)}function q8(q,$){if(q.entries.length===0)return"No skills installed.";let Z=(W)=>W,Q=$?U.red:Z,X=$?U.green:Z,z=$?U.yellow:Z,J=$?U.dim:Z,G=`${"Skill".padEnd(22)}${"Installed".padEnd(14)}${"Latest".padEnd(14)}Source`,Y="─".repeat(60),H=[G,Y];for(let W of q.entries){let B=W.name.padEnd(22),_=W.installedCommit.padEnd(14),L,K;switch(W.status){case"outdated":L=Q(W.latestCommit.padEnd(14)),K=W.sourceType;break;case"up-to-date":L=X(W.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(W.error||"error");break}H.push(`${B}${_}${L}${K}`)}H.push("");let V=[];if(q.outdatedCount>0)V.push(Q(`${q.outdatedCount} outdated`));if(q.upToDateCount>0)V.push(X(`${q.upToDateCount} up to date`));if(q.untrackedCount>0)V.push(z(`${q.untrackedCount} untracked`));if(q.errorCount>0)V.push(J(`${q.errorCount} error`));return H.push(V.join(", ")),H.join(`
|
|
200
|
+
`)}function $8(q){return JSON.stringify({skills:q.entries.map(($)=>({name:$.name,installed:$.installedCommit,latest:$.latestCommit,source:$.sourceType,status:$.status,...$.error?{error:$.error}:{}})),summary:{outdated:q.outdatedCount,upToDate:q.upToDateCount,untracked:q.untrackedCount,errors:q.errorCount}},null,2)}function Z8(q){return JSON.stringify({results:q.results.map(($)=>({name:$.name,status:$.status,...$.reason?{reason:$.reason}:{},...$.oldCommit?{oldCommit:$.oldCommit}:{},...$.newCommit?{newCommit:$.newCommit}:{},...$.securityVerdict?{securityVerdict:$.securityVerdict}:{}})),summary:{updated:q.updatedCount,skipped:q.skippedCount,failed:q.failedCount}},null,2)}import{execFile as kH}from"child_process";import{promisify as vH}from"util";import{access as Q8,readFile as J8,readdir as hH,writeFile as gH,rm as uH,stat as G8}from"fs/promises";import{join as E9}from"path";import{homedir as mH}from"os";import{constants as X8}from"fs";import{access as RH,realpath as DH,stat as NH}from"fs/promises";import{constants as wH}from"fs";import{delimiter as PH,resolve as CH,sep as EH}from"path";var SH="asm";function bH(q){if(!q)return[];let $=new Set,Z=[];for(let Q of q.split(PH)){let X=Q.trim();if(!X)continue;let z=X.endsWith(EH)?X.slice(0,-1):X;if($.has(z))continue;$.add(z),Z.push(z)}return Z}async function xH(q){try{if(!(await NH(q)).isFile())return!1}catch{return!1}try{return await RH(q,wH.X_OK),!0}catch{return!1}}async function yH(q){try{return await DH(q)}catch{return q}}async function fH(q=process.env.PATH){let $=new Set,Z=[];for(let Q of bH(q)){let X=CH(Q,SH);if(!await xH(X))continue;let z=await yH(X);if($.has(z))continue;$.add(z),Z.push({path:X,realPath:z})}return Z}async function m$(q=process.env.PATH){let $=await fH(q);if($.length===0)return{resolved:null,shadowed:[]};let[Z,...Q]=$;return{resolved:Z,shadowed:Q}}var zq=vH(kH);async function pH(q){let $=q?.execFn??zq;try{let{stdout:Z}=await $("git",["--version"],{timeout:5000});return{name:"Git available",status:"pass",message:Z.trim().replace("git version ","")}}catch{return{name:"Git available",status:"fail",message:"git not found",fix:"Install git: https://git-scm.com/downloads"}}}async function dH(q){let $=q?.execFn??zq;try{let{stdout:Z}=await $("git",["--version"],{timeout:5000}),Q=Z.match(/(\d+)\.(\d+)/);if(!Q)return{name:"Git version",status:"warn",message:"Could not parse git version",fix:"Upgrade git: https://git-scm.com/downloads"};let X=parseInt(Q[1],10),z=parseInt(Q[2],10);if(X>2||X===2&&z>=20)return{name:"Git version",status:"pass",message:`${X}.${z} (>= 2.20)`};return{name:"Git version",status:"fail",message:`${X}.${z} (requires >= 2.20)`,fix:"Upgrade git: https://git-scm.com/downloads"}}catch{return{name:"Git version",status:"pass",message:"Skipped — git not available"}}}async function cH(q){let $=q?.execFn??zq;try{let{stdout:Z}=await $("gh",["--version"],{timeout:5000}),Q=Z.trim().split(`
|
|
201
|
+
`)[0],X=Q.match(/(\d+\.\d+\.\d+)/);return{name:"GitHub CLI available",status:"pass",message:X?X[1]:Q}}catch{return{name:"GitHub CLI available",status:"fail",message:"gh not found",fix:"Install GitHub CLI: https://cli.github.com"}}}async function lH(q){let $=q?.execFn??zq;try{let{stdout:Z}=await $("gh",["auth","status"],{timeout:1e4}),Q=Z.match(/Logged in to .+ account (\S+)/);return{name:"GitHub CLI authenticated",status:"pass",message:Q?Q[1]:"authenticated"}}catch(Z){let X=(Z?.stderr??"").match(/Logged in to .+ account (\S+)/);if(X)return{name:"GitHub CLI authenticated",status:"pass",message:X[1]};return{name:"GitHub CLI authenticated",status:"fail",message:"Not authenticated",fix:"Run: gh auth login"}}}async function nH(q){let $=q?.execFn??zq;try{let{stdout:Z}=await $("node",["--version"],{timeout:5000}),Q=Z.trim().replace(/^v/,"");if(parseInt(Q.split(".")[0],10)>=18)return{name:"Node.js version",status:"pass",message:Q};return{name:"Node.js version",status:"fail",message:`${Q} (requires >= 18.0)`,fix:"Upgrade Node.js: https://nodejs.org"}}catch{return{name:"Node.js version",status:"fail",message:"node not found",fix:"Install Node.js >= 18: https://nodejs.org"}}}async function aH(q){try{let $=E9(q,".asm-doctor-write-test");return await gH($,"test","utf-8"),await uH($),{writable:!0,exists:!0}}catch{}try{return await Q8(q,X8.W_OK),{writable:!0,exists:!0}}catch{}try{return await Q8(q,X8.F_OK),{writable:!1,exists:!0}}catch{return{writable:!0,exists:!1}}}async function oH(q){let $=q.providers.filter((z)=>z.enabled),Z=0,Q=0;for(let z of $){let J=X0(z.global);if(Q++,(await aH(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 iH(){let q=xq();try{let $=await J8(q,"utf-8"),Z=JSON.parse($),Q=[];if(Z.version===void 0)Q.push("version");if(!Array.isArray(Z.providers))Q.push("providers");if(Q.length>0)return{name:"Config file valid",status:"fail",message:`Missing required fields: ${Q.join(", ")}`,fix:"Run: asm init"};return{name:"Config file valid",status:"pass",message:"OK"}}catch($){if($?.code==="ENOENT")return{name:"Config file valid",status:"pass",message:"No config file (using defaults)"};return{name:"Config file valid",status:"fail",message:"Corrupted or unreadable config",fix:"Run: asm init, or delete corrupted config"}}}async function sH(){let q=z8();try{let $=await J8(q,"utf-8"),Z=JSON.parse($);if(Z.version!==1||typeof Z.skills!=="object")return{name:"Lock file integrity",status:"fail",message:"Invalid lock file schema",fix:"Run: asm install to regenerate"};let Q=Z.skills,X=Object.entries(Q),z=["source","installedAt","provider"],J=[];for(let[G,Y]of X){if(typeof Y!=="object"||Y===null){J.push(G);continue}let H=Y;for(let V of z)if(!H[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($){if($?.code==="ENOENT")return{name:"Lock file integrity",status:"pass",message:"No lock file (first-time user)"};return{name:"Lock file integrity",status:"fail",message:"Corrupted lock file",fix:"Run: asm install to regenerate"}}}async function tH(){try{let q=await fetch(B9,{method:"HEAD",signal:AbortSignal.timeout(5000)});if(q.ok)return{name:"Registry reachable",status:"pass",message:"OK"};return{name:"Registry reachable",status:"fail",message:`HTTP ${q.status}`,fix:"Check network connection or proxy settings"}}catch{return{name:"Registry reachable",status:"fail",message:"Network error",fix:"Check network connection or proxy settings"}}}async function rH(q,$){let Z=Object.entries($.skills);if(Z.length===0)return{name:"Installed skills intact",status:"pass",message:"No skills in lock file"};let Q=[];for(let[J,G]of Z){let Y=q.providers.find((W)=>W.name===G.provider);if(!Y){Q.push(J);continue}let H=X0(Y.global),V=E9(H,J);try{if(!(await G8(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 eH(q,$){let Z=new Set(Object.keys($.skills)),Q=[];for(let X of q.providers.filter((z)=>z.enabled)){let z=X0(X.global);try{let J=await hH(z);for(let G of J)try{if((await G8(E9(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 qW(q){let $=q?.execFn??zq;try{let{stdout:Z}=await $("df",["-Pk",mH()],{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 $W(){try{let q=await m$();if(q.shadowed.length===0){if(!q.resolved)return{name:"No PATH shadowing",status:"pass",message:"asm not yet on PATH"};return{name:"No PATH shadowing",status:"pass",message:`single install at ${q.resolved.path}`}}let $=q.resolved,Z=q.shadowed[0].path,Q=q.shadowed.length>1?` (+${q.shadowed.length-1} more)`:"";return{name:"No PATH shadowing",status:"warn",message:`resolved ${$.path}, shadowed ${Z}${Q}`,fix:"Remove the duplicate install (e.g. `bun remove -g agent-skill-manager` or `npm uninstall -g agent-skill-manager`) and keep only one."}}catch(q){return{name:"No PATH shadowing",status:"warn",message:`Could not scan PATH: ${q?.message??q}`}}}async function Y8(){let q=await h(),$=await k0(),Q=(await Promise.allSettled([pH(),dH(),cH(),lH(),nH(),oH(q),iH(),sH(),tH(),rH(q,$),eH(q,$),qW(),$W()])).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","No PATH shadowing"][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 ZW={pass:"✅",warn:"⚠️ ",fail:"❌"};function U8(q){let $=["Checking your environment...",""];for(let Z of q.checks){let X=` ${ZW[Z.status]} ${Z.name}${Z.message?` (${Z.message})`:""}`;if($.push(X),Z.fix&&Z.status!=="pass"){let z;if(Z.fix.startsWith("Run: "))z=Z.fix;else if(/^[a-z/~]/.test(Z.fix))z=`Run: ${Z.fix}`;else z=`Fix: ${Z.fix}`;$.push(` → ${z}`)}}return $.push(""),$.push(`${q.passed} passed, ${q.warnings} warning${q.warnings!==1?"s":""}, ${q.failures} error${q.failures!==1?"s":""}`),$.join(`
|
|
203
|
+
`)}function H8(q){return JSON.stringify({checks:q.checks.map(($)=>({name:$.name,status:$.status,message:$.message,...$.fix?{fix:$.fix}:{}})),summary:{passed:q.passed,warnings:q.warnings,failures:q.failures}},null,2)}import{readFile as b9,writeFile as QW,stat as B8,copyFile as XW}from"fs/promises";import{join as K8,resolve as _8,basename as x9,isAbsolute as L8}from"path";var W8=["name","description","version","license","creator","compatibility","allowed-tools","effort","tags","metadata"],V8=["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"],zW=["confirm","confirmation","error","errors","fail","failure","caution","warning","prerequisite","prerequisites","requires","requirements","rollback","dry-run","dry run","safety","validate","validation","check","backup"],JW=["acceptance criteria","expected output","expected result","edge case","edge cases","test","tests","testing","verify","verification","assert","example input","example output","given","then"],GW=["reference","references","see","template","templates","script","scripts","helper","helpers","link"],YW=["when to use","quick start","overview","instructions","steps","workflow","phases","progressive"];function O8(q){let $=q.split(`
|
|
204
204
|
`);if($.length===0||$[0].trim()!=="---")return{rawFrontmatter:null,body:q};for(let Z=1;Z<$.length;Z++)if($[Z].trim()==="---"){let Q=$.slice(1,Z).join(`
|
|
205
205
|
`),X=$.slice(Z+1).join(`
|
|
206
206
|
`);return{rawFrontmatter:Q,body:X}}return{rawFrontmatter:$.slice(1).join(`
|
|
207
|
-
`),body:""}}function
|
|
208
|
-
`).length}function x9(q){if(!q)return 0;return q.split(/\s+/).map(($)=>$.trim()).filter(Boolean).length}function YW(q,$=1){return(q.match(/^#{1,6}\s+\S/gm)||[]).length>=$}function u$(q,$){let Z=q.toLowerCase();return $.filter((Q)=>Z.includes(Q))}function UW(q){return/```[\s\S]+?```/m.test(q)}function HW(q){return/^\s*[-*]\s+\S/m.test(q)||/^\s*\d+\.\s+\S/m.test(q)}function WW(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(q.name&&q.name.trim()),G=Boolean(q.description&&q.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(q);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(q.creator||q["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(q.license))z+=1;else Q.push("Missing `license`."),X.push("Add a `license` field (e.g. `license: MIT`).");let B=$.trim().length>=20,_=YW($,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 VW(q,$){let Z=[],Q=[],X=0,z=(q.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=x9(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&&(W8.includes(G)||W8.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 BW(q,$){let Z=[],Q=[],X=0,z=u$($,GW);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(HW($))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=UW($),G=/\bexample\b/i.test($);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=($.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 H=x9($);if(H>=80&&H<=3000)X+=1,Z.push(`Body length within healthy range (${H} words).`);else if(H<80)Z.push(`Body is very short (${H} words).`),Q.push("Expand the instructions; an underspecified skill gives the agent too much freedom.");else Z.push(`Body is very long (${H} 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 KW(q,$){let Z=[],Q=[],X=0,z=x9($);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=u$($,JW);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=($.match(/```[\s\S]+?```/g)||[]).filter((H)=>O8(H)>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($))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 _W(q,$){let Z=[],Q=[],X=0,z=u$($,XW);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($),G=/\bconfirm\b|\bdry-?run\b|\bare you sure\b|\bbackup\b/i.test($);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($)||/\brequire/i.test($)||/\bdepend/i.test($))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 LW(q,$){let Z=[],Q=[],X=0,z=u$($,zW);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($))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($))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 OW(q,$){let Z=[],Q=[],X=0,z=(q.name||"").trim();if(z){let Y=/^[a-z][a-z0-9-]*$/.test(z),H=z.length<=40;if(Y&&H)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(!H)Z.push(`name is ${z.length} chars; keep it <= 40.`)}}else Q.push("Add a kebab-case `name` (e.g. `my-skill`).");let J=$.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(q.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 b9(q){let{content:$,skillPath:Z,skillMdPath:Q}=q,X=s($),{rawFrontmatter:z,body:J}=L8($),G=[WW(X,J,z),VW(X,J),BW(X,J),KW(X,J),_W(X,J),LW(X,J),OW(X,J)];if(X.name&&S9(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),H=G.reduce((L,K)=>L+K.max,0),V=Math.round(Y/H*100),W="F";if(V>=90)W="A";else if(V>=80)W="B";else if(V>=65)W="C";else if(V>=50)W="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:W,topSuggestions:B,frontmatter:X}}async function F8(q){let $=_8(q)?q:K8(q),Z;try{Z=await V8($)}catch{throw Error(`Skill path does not exist: ${$}`)}let Q,X;if(Z.isFile())return Q=$,X=await E9(Q,"utf-8"),b9({content:X,skillPath:S9($)==="SKILL.md"?S9($):$,skillMdPath:Q});if(!Z.isDirectory())throw Error(`Skill path is not a directory or file: ${$}`);Q=B8($,"SKILL.md");try{X=await E9(Q,"utf-8")}catch{throw Error(`SKILL.md not found in ${$}. Run "asm init" to create one.`)}return b9({content:X,skillPath:$,skillMdPath:Q})}function FW(q){if(q<=20)return"low";if(q<=80)return"medium";if(q<=250)return"high";return"max"}function IW(q){let $=q.split(`
|
|
207
|
+
`),body:""}}function F8(q){if(!q)return 0;return q.split(`
|
|
208
|
+
`).length}function y9(q){if(!q)return 0;return q.split(/\s+/).map(($)=>$.trim()).filter(Boolean).length}function UW(q,$=1){return(q.match(/^#{1,6}\s+\S/gm)||[]).length>=$}function p$(q,$){let Z=q.toLowerCase();return $.filter((Q)=>Z.includes(Q))}function HW(q){return/```[\s\S]+?```/m.test(q)}function WW(q){return/^\s*[-*]\s+\S/m.test(q)||/^\s*\d+\.\s+\S/m.test(q)}function VW(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(q.name&&q.name.trim()),G=Boolean(q.description&&q.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(q);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(q.creator||q["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(q.license))z+=1;else Q.push("Missing `license`."),X.push("Add a `license` field (e.g. `license: MIT`).");let B=$.trim().length>=20,_=UW($,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 BW(q,$){let Z=[],Q=[],X=0,z=(q.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=y9(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&&(V8.includes(G)||V8.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 KW(q,$){let Z=[],Q=[],X=0,z=p$($,YW);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(WW($))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=HW($),G=/\bexample\b/i.test($);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=($.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 H=y9($);if(H>=80&&H<=3000)X+=1,Z.push(`Body length within healthy range (${H} words).`);else if(H<80)Z.push(`Body is very short (${H} words).`),Q.push("Expand the instructions; an underspecified skill gives the agent too much freedom.");else Z.push(`Body is very long (${H} 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 _W(q,$){let Z=[],Q=[],X=0,z=y9($);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=p$($,GW);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=($.match(/```[\s\S]+?```/g)||[]).filter((H)=>F8(H)>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($))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 LW(q,$){let Z=[],Q=[],X=0,z=p$($,zW);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($),G=/\bconfirm\b|\bdry-?run\b|\bare you sure\b|\bbackup\b/i.test($);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($)||/\brequire/i.test($)||/\bdepend/i.test($))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 OW(q,$){let Z=[],Q=[],X=0,z=p$($,JW);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($))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($))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 FW(q,$){let Z=[],Q=[],X=0,z=(q.name||"").trim();if(z){let Y=/^[a-z][a-z0-9-]*$/.test(z),H=z.length<=40;if(Y&&H)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(!H)Z.push(`name is ${z.length} chars; keep it <= 40.`)}}else Q.push("Add a kebab-case `name` (e.g. `my-skill`).");let J=$.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(q.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 yq(q){let{content:$,skillPath:Z,skillMdPath:Q}=q,X=s($),{rawFrontmatter:z,body:J}=O8($),G=[VW(X,J,z),BW(X,J),KW(X,J),_W(X,J),LW(X,J),OW(X,J),FW(X,J)];if(X.name&&x9(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),H=G.reduce((L,K)=>L+K.max,0),V=Math.round(Y/H*100),W="F";if(V>=90)W="A";else if(V>=80)W="B";else if(V>=65)W="C";else if(V>=50)W="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:W,topSuggestions:B,frontmatter:X}}async function I8(q){let $=L8(q)?q:_8(q),Z;try{Z=await B8($)}catch{throw Error(`Skill path does not exist: ${$}`)}let Q,X;if(Z.isFile())return Q=$,X=await b9(Q,"utf-8"),yq({content:X,skillPath:x9($)==="SKILL.md"?x9($):$,skillMdPath:Q});if(!Z.isDirectory())throw Error(`Skill path is not a directory or file: ${$}`);Q=K8($,"SKILL.md");try{X=await b9(Q,"utf-8")}catch{throw Error(`SKILL.md not found in ${$}. Run "asm init" to create one.`)}return yq({content:X,skillPath:$,skillMdPath:Q})}function IW(q){if(q<=20)return"low";if(q<=80)return"medium";if(q<=250)return"high";return"max"}function AW(q){let $=q.split(`
|
|
209
209
|
`),Z=[],Q=[],X=0;while(X<$.length){let H=$[X];if(!H.trim()){X++;continue}let W=H.match(/^([A-Za-z_][\w-]*):\s*(.*)$/);if(!W)return{newFrontmatter:q,changed:!1};let B=W[1],_=W[2];if(_===""||_===">"||_==="|"){let L=[H];X++;while(X<$.length){let K=$[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:H}),X++}let z=(H)=>{let V=
|
|
211
|
-
`),changed:G}}function
|
|
210
|
+
`)})}else Z.push({key:B,text:H}),X++}let z=(H)=>{let V=W8.indexOf(H);return V===-1?W8.length+1:V},J=[...Z].sort((H,V)=>{let W=z(H.key),B=z(V.key);if(W!==B)return W-B;return Z.indexOf(H)-Z.indexOf(V)}),G=J.some((H,V)=>H!==Z[V]);return{newFrontmatter:[...J.map((H)=>H.text),...Q.map((H)=>H.text)].join(`
|
|
211
|
+
`),changed:G}}function TW(q,$={}){let Z=[],Q=[],X=q.replace(/\r\n/g,`
|
|
212
212
|
`);if(X!==q)Z.push({id:"normalise-line-endings",description:"Convert CRLF line endings to LF."});let z=X.split(`
|
|
213
213
|
`),J=z.map((O)=>O.replace(/[ \t]+$/g,""));if(J.some((O,F)=>O!==z[F]))Z.push({id:"strip-trailing-whitespace",description:"Strip trailing whitespace from lines."});X=J.join(`
|
|
214
|
-
`);let{rawFrontmatter:G,body:Y}=
|
|
214
|
+
`);let{rawFrontmatter:G,body:Y}=O8(X),H=s(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(H.version||H["metadata.version"]))V=S9(V,"version","0.1.0"),Z.push({id:"add-missing-version",description:"Add `version: 0.1.0`."});if(!Boolean(H.creator||H["metadata.creator"])){let O=$.gitAuthor?.trim();if(O)V=S9(V,"creator",O),Z.push({id:"add-missing-creator",description:`Add \`creator: ${O}\` from git config.`});else Q.push({id:"add-missing-creator",description:"Missing `creator` — no git user.name found to fill in safely."})}if(!H.effort){let O=IW(F8(Y));V=S9(V,"effort",O),Z.push({id:"infer-missing-effort",description:`Infer \`effort: ${O}\` from body size.`})}if(!H.description)Q.push({id:"missing-description",description:"Missing `description` — content-level fix, left to the author."});let _=AW(V);if(_.changed)Z.push({id:"reorder-frontmatter",description:"Reorder frontmatter fields to canonical order."}),V=_.newFrontmatter;let L=Y.replace(/^\n+/,""),K=`---
|
|
215
215
|
${V.replace(/^\n+|\n+$/g,"")}
|
|
216
216
|
---
|
|
217
217
|
|
|
218
218
|
${L}`;if(!K.endsWith(`
|
|
219
219
|
`))K+=`
|
|
220
220
|
`;if(K===q.replace(/\r\n/g,`
|
|
221
|
-
`));return{newContent:K,applied:Z,skipped:Q}}function
|
|
221
|
+
`));return{newContent:K,applied:Z,skipped:Q}}function S9(q,$,Z){if(new RegExp(`^${$}:\\s*`,"m").test(q))return q;let X=/[:#{}\[\],&*?|<>=!%@`"']/.test(Z)?JSON.stringify(Z):Z,z=q.length===0||q.endsWith(`
|
|
222
222
|
`)?"":`
|
|
223
223
|
`;return`${q}${z}${$}: ${X}
|
|
224
|
-
`}function
|
|
224
|
+
`}function MW(q,$,Z="SKILL.md"){if(q===$)return"";let Q=q.split(`
|
|
225
225
|
`),X=$.split(`
|
|
226
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),H=X.slice(J,X.length-G),V=J+1,W=J+1;z.push(`@@ -${V},${Y.length} +${W},${H.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 H)z.push(`+${L}`);return z.push(..._),z.join(`
|
|
227
|
-
`)}async function
|
|
228
|
-
`)}function
|
|
227
|
+
`)}async function A8(q,$){let Z=L8(q)?q:_8(q),Q,X=await B8(Z).catch(()=>null);if(!X)throw Error(`Skill path does not exist: ${Z}`);if(X.isFile())Q=Z;else if(X.isDirectory())Q=K8(Z,"SKILL.md");else throw Error(`Skill path is not a directory or file: ${Z}`);let z;try{z=await b9(Q,"utf-8")}catch{throw Error(`SKILL.md not found at ${Q}.`)}let J=TW(z,{gitAuthor:$.gitAuthor}),G=MW(z,J.newContent),Y=null;if(!$.dryRun&&J.newContent!==z)Y=`${Q}.bak`,await XW(Q,Y),await QW(Q,J.newContent,"utf-8");return{report:yq({content:$.dryRun?z:J.newContent,skillPath:Z,skillMdPath:Q}),applied:J.applied,skipped:J.skipped,diff:G,dryRun:$.dryRun,backupPath:Y,skillMdPath:Q}}async function T8(){try{let q=Bun.spawn(["git","config","--global","--get","user.name"],{stdout:"pipe",stderr:"pipe"}),$=await new Response(q.stdout).text();if(await q.exited!==0)return null;let Q=$.trim();return Q?Q:null}catch{return null}}function jW(q,$,Z=20){let Q=Math.round(q/$*Z);return"█".repeat(Q)+"░".repeat(Math.max(0,Z-Q))}function f9(q){let $=[];$.push(`Skill evaluation: ${q.skillPath}`),$.push(`SKILL.md: ${q.skillMdPath}`),$.push(""),$.push(`Overall score: ${q.overallScore}/100 (${q.grade})`),$.push(""),$.push("Categories:");for(let Z of q.categories)$.push(` ${Z.name.padEnd(28)} ${String(Z.score).padStart(2)}/${Z.max} ${jW(Z.score,Z.max)}`);if($.push(""),q.topSuggestions.length>0){$.push("Top suggestions:");for(let Z of q.topSuggestions)$.push(` • ${Z}`)}else $.push("No suggestions — skill looks great.");return $.join(`
|
|
228
|
+
`)}function M8(q){return JSON.stringify(q,null,2)}function j8(q){let $=[];if(q.applied.length===0&&q.skipped.length===0)return $.push("No fixes needed — SKILL.md is already clean."),$.join(`
|
|
229
229
|
`);if(q.applied.length>0){$.push(`${q.dryRun?"Would apply":"Applied"} ${q.applied.length} fix(es):`);for(let Z of q.applied)$.push(` • ${Z.description}`)}if(q.skipped.length>0){$.push(""),$.push(`Skipped ${q.skipped.length} issue(s) (not auto-fixable):`);for(let Z of q.skipped)$.push(` • ${Z.description}`)}if(q.diff)$.push(""),$.push("Diff:"),$.push(q.diff);if(!q.dryRun&&q.backupPath)$.push(""),$.push(`Backup: ${q.backupPath}`);return $.join(`
|
|
230
|
-
`)}function
|
|
231
|
-
`);return console.log=Z,console.info=Z,()=>{console.log=q,console.info=$}}function
|
|
232
|
-
---`,3);if(Z===-1)return"";return $.slice(Z+4)}async function
|
|
233
|
-
`,"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
|
|
230
|
+
`)}function k9(q,$=null){return{skill_path:q.skillPath,skill_md_path:q.skillMdPath,overall_score:q.overallScore,grade:q.grade,categories:q.categories.map((Z)=>({id:Z.id,name:Z.name,score:Z.score,max:Z.max,findings:Z.findings,suggestions:Z.suggestions})),top_suggestions:q.topSuggestions,fix:$?{dry_run:$.dryRun,applied:$.applied,skipped:$.skipped,backup_path:$.backupPath,diff:$.diff}:null}}function R8(q){if(q instanceof Error)return q.message;if(typeof q==="string")return q;try{return JSON.stringify(q)}catch{return String(q)}}function D8(q,$,Z,Q,X){let z={severity:"error",message:Q,code:X};return{providerId:q.id,providerVersion:q.version,schemaVersion:q.schemaVersion,score:0,passed:!1,categories:[],findings:[z],raw:void 0,startedAt:$,durationMs:Z}}async function N8(q,$,Z={}){let Q=new Date().toISOString(),X=performance.now(),z={id:q.id,version:q.version,schemaVersion:q.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 H=await Promise.race([q.run($,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(H.kind==="timeout"){let B=J.signal.reason,_=B instanceof Error&&B.message==="timeout"?`provider timed out after ${Z.timeoutMs}ms`:`provider aborted: ${R8(B)}`;return D8(z,Q,V,_,B instanceof Error&&B.message==="timeout"?"timeout":"aborted")}let W=H.value;return{...W,providerId:z.id,providerVersion:z.version,schemaVersion:W.schemaVersion??z.schemaVersion,startedAt:Q,durationMs:V}}catch(H){let V=Math.max(0,Math.round(performance.now()-X));return D8(z,Q,V,R8(H),"provider-threw")}finally{if(G)clearTimeout(G)}}var RW=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function fq(q){if(typeof q!=="string")return null;let $=RW.exec(q.trim());if(!$)return null;let[,Z,Q,X,z]=$;return{major:Number(Z),minor:Number(Q),patch:Number(X),prerelease:z?z.split("."):[]}}function d$(q,$){if(q.major!==$.major)return q.major-$.major;if(q.minor!==$.minor)return q.minor-$.minor;if(q.patch!==$.patch)return q.patch-$.patch;if(q.prerelease.length===0&&$.prerelease.length>0)return 1;if(q.prerelease.length>0&&$.prerelease.length===0)return-1;let Z=Math.max(q.prerelease.length,$.prerelease.length);for(let Q=0;Q<Z;Q++){let X=q.prerelease[Q],z=$.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 v9(q,$){let Z=fq(q);if(!Z)throw Error(`invalid semver: ${$} "${q}"`);return Z}function DW(q,$){if(typeof $!=="string"||$.trim().length===0)throw Error(`invalid semver range: ${JSON.stringify($)}`);let Z=fq(q);if(!Z)return!1;let Q=$.trim();if(Q==="*"||Q==="x"||Q==="X")return!0;if(Q.startsWith("^")){let J=v9(Q.slice(1),"range base");if(d$(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=v9(Q.slice(1),"range base");if(d$(Z,J)<0)return!1;return Z.major===J.major&&Z.minor===J.minor}let X=Q.startsWith("=")?Q.slice(1).trim():Q,z=fq(X);if(!z)throw Error(`invalid semver range: ${JSON.stringify($)}`);return d$(Z,z)===0}var c$=new Map;function w8(q){if(!q||typeof q.id!=="string"||q.id.length===0)throw Error("register: provider.id is required");if(v9(q.version,`provider ${q.id} version`),typeof q.schemaVersion!=="number"||!Number.isInteger(q.schemaVersion))throw Error(`register: provider ${q.id} schemaVersion must be an integer`);let $=c$.get(q.id)??[];if($.some((Z)=>Z.version===q.version))throw Error(`register: provider ${q.id}@${q.version} already registered`);$.push(q),c$.set(q.id,$)}function P8(q,$){if(typeof q!=="string"||q.length===0)throw Error("resolve: id is required");let Z=c$.get(q);if(!Z||Z.length===0)throw Error(`resolve: provider "${q}" is not registered`);let Q=Z.filter((X)=>DW(X.version,$));if(Q.length===0){let X=Z.map((z)=>z.version).join(", ");throw Error(`resolve: no version of "${q}" satisfies "${$}" (have: ${X})`)}return Q.sort((X,z)=>d$(fq(z.version),fq(X.version))),Q[0]}function C8(){let q=[];for(let $ of c$.values())for(let Z of $)q.push(Z);return q}import{stat as NW}from"fs/promises";var E8="quality",S8="1.0.0",b8=1;function wW(q){return q.topSuggestions.map(($)=>({severity:"info",message:$}))}function PW(q){return q.categories.map(($)=>({id:$.id,name:$.name,score:$.score,max:$.max}))}var x8={id:E8,version:S8,schemaVersion:b8,description:"Static linter for SKILL.md structure, description, and safety.",async applicable(q){try{if(!(await NW(q.skillMdPath)).isFile())return{ok:!1,reason:`${q.skillMdPath} is not a file`};return{ok:!0}}catch{return{ok:!1,reason:`SKILL.md not found at ${q.skillMdPath}`}}},async run(q,$){let Z=await I8(q.skillPath);return{providerId:E8,providerVersion:S8,schemaVersion:b8,score:Z.overallScore,passed:Z.grade!=="F",categories:PW(Z),findings:wW(Z),raw:Z,startedAt:"",durationMs:0}}};function y8(){w8(x8)}var e={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 g0(){let{log:q,info:$}=console,Z=(...Q)=>process.stderr.write(Q.map(String).join(" ")+`
|
|
231
|
+
`);return console.log=Z,console.info=Z,()=>{console.log=q,console.info=$}}function k8(q){return{timestamp:new Date().toISOString(),asm_version:f8,duration_ms:Math.round(performance.now()-q)}}function l(q,$,Z){let Q={version:1,command:q,status:"ok",data:$,meta:k8(Z)},X=process.stdout.isTTY?2:0;return JSON.stringify(Q,null,X)}function q0(q,$,Z,Q,X){let z={version:1,command:q,status:"error",error:{code:$,message:Z,...X!==void 0?{details:X}:{}},meta:k8(Q)},J=process.stdout.isTTY?2:0;return JSON.stringify(z,null,J)}import{writeFile as mW,mkdir as pW,unlink as dW,readFile as cW}from"fs/promises";import{join as g9}from"path";import{readdir as CW,readFile as EW}from"fs/promises";import{join as SW}from"path";function h9(q){let $=new Set,Z=q.toLowerCase().split(/[\s\-_.,;:()[\]{}"']+/);for(let Q of Z)if(Q.length>=2)$.add(Q);return $}var bW=10,xW=5,yW=3,fW=1;function kW(q,$){let Z=h9(q),Q=h9($.name),X=h9($.description),z=0;for(let J of Z){if(Q.has(J))z+=bW;if(X.has(J))z+=yW;if($.name.toLowerCase().includes(J))z+=xW;if($.description.toLowerCase().includes(J))z+=fW}return z}async function v8(q){let $=new Map,Z;try{Z=await CW(q)}catch{return $}for(let Q of Z){if(!Q.endsWith(".json"))continue;let X=SW(q,Q);try{let z=await EW(X,"utf-8"),J=JSON.parse(z);for(let G of J.skills){if(!("license"in G))G.license="";if(!("creator"in G))G.creator="";if(!("compatibility"in G))G.compatibility="";if(!("allowedTools"in G))G.allowedTools=[];if(!("verified"in G))G.verified=!1}$.set(`${J.owner}/${J.repo}`,J)}catch{}}return $}async function l$(){let q=await v8(u8()),$=await v8(kq()),Z=new Map(q);for(let[Q,X]of $)Z.set(Q,X);return Array.from(Z.values())}var vW=["license","creator","version"];function h8(q){return vW.includes(q)}function g8(q,$){return q[$]||""}function hW(q,$){if($.has)for(let Z of $.has){if(!h8(Z))continue;if(!g8(q,Z))return!1}if($.missing)for(let Z of $.missing){if(!h8(Z))continue;if(g8(q,Z))return!1}return!0}function m8(q){let $=[];if(!q.license)$.push("license");if(!q.creator)$.push("creator");if(!q.version||q.version==="0.0.0")$.push("version");return $}async function n$(q,$=20,Z){let Q=await l$(),X=[],z=!q&&Z;for(let J of Q)for(let G of J.skills){if(Z&&!hW(G,Z))continue;let Y=z?1:kW(q,G);if(Y>0)X.push({skill:G,repo:{owner:J.owner,repo:J.repo},score:Y})}return X.sort((J,G)=>G.score-J.score),X.slice(0,$)}async function p8(){return(await l$()).reduce(($,Z)=>$+Z.skillCount,0)}var gW=[{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 d8(q,$){let Z=[];if(!q.name||!q.name.trim())Z.push("missing frontmatter field: name");if(!q.description||!q.description.trim())Z.push("missing frontmatter field: description");if(uW($).trim().length<20)Z.push("SKILL.md body too short (less than 20 chars of instructions)");for(let{label:X,pattern:z}of gW)if(z.test($))Z.push(`malicious pattern detected: ${X}`);return{verified:Z.length===0,reasons:Z}}function uW(q){let $=q.trimStart();if(!$.startsWith("---"))return $;let Z=$.indexOf(`
|
|
232
|
+
---`,3);if(Z===-1)return"";return $.slice(Z+4)}async function lW(){let q=kq();return await pW(q,{recursive:!0}),q}async function c8(q){await c0();let $;try{$=d0(q)}catch(Q){return{success:!1,repoIndex:null,error:Q.message}}if($.isLocal)return{success:!1,repoIndex:null,error:"Local paths are not supported for indexing. Use a GitHub source instead."};E(`ingester: cloning ${$.owner}/${$.repo}`);let Z=null;try{Z=await l0($),E(`ingester: discovering skills in ${Z}`);let Q=await lq(Z);E(`ingester: found ${Q.length} skills`);let X=[];for(let Y of Q){let H=g9(Z,Y.relPath,"SKILL.md"),V="";try{V=await cW(H,"utf-8")}catch{E(`ingester: could not read SKILL.md at ${H}`)}let W=d8(Y,V);if(!W.verified)E(`ingester: ${Y.name} not verified: ${W.reasons.join(", ")}`);let B=typeof Y.tokenCount==="number"?Y.tokenCount:V?cq(V):void 0,_;if(V)try{let L=yq({content:V,skillPath:Y.relPath||Y.name,skillMdPath:H});_={overallScore:L.overallScore,grade:L.grade,categories:L.categories.map((K)=>({id:K.id,name:K.name,score:K.score,max:K.max})),evaluatedAt:L.evaluatedAt,evaluatedVersion:Y.version||void 0}}catch(L){E(`ingester: eval failed for ${Y.name}: ${L}`)}X.push({name:Y.name,description:Y.description,version:Y.version,license:Y.license,creator:Y.creator,compatibility:Y.compatibility,allowedTools:Y.allowedTools,installUrl:`github:${$.owner}/${$.repo}${$.ref?`#${$.ref}`:""}${Y.relPath?`:${Y.relPath}`:""}`,relPath:Y.relPath,verified:W.verified,tokenCount:B,evalSummary:_})}let z={repoUrl:$.cloneUrl,owner:$.owner,repo:$.repo,updatedAt:new Date().toISOString(),skillCount:X.length,skills:X},J=await lW(),G=g9(J,`${$.owner}_${$.repo}.json`);return await mW(G,JSON.stringify(z,null,2)+`
|
|
233
|
+
`,"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 l8(){return(await l$()).map(($)=>({owner:$.owner,repo:$.repo,skillCount:$.skillCount,updatedAt:$.updatedAt})).sort(($,Z)=>Z.skillCount-$.skillCount)}async function n8(q,$){let Z=kq(),Q=g9(Z,`${q}_${$}.json`);try{return await dW(Q),!0}catch{return!1}}import{join as nW}from"path";function aW(q){switch(q){case"dangerous":return 3;case"warning":return 2;case"caution":return 1;default:return 0}}function l9(q){return{verdict:q.every(($)=>$.verdict==="safe")?"safe":q.some(($)=>$.verdict==="dangerous")?"dangerous":"warning",findings:q.map(($)=>({skill:$.skillName,verdict:$.verdict,verdict_reason:$.verdictReason,total_files:$.totalFiles,total_lines:$.totalLines})),risk_score:q.reduce(($,Z)=>$+aW(Z.verdict),0)}}function oW(q){let $=q.slice(2),Z={command:null,subcommand:null,positional:[],flags:{help:!1,version:!1,json:!1,yes:!1,noColor:!1,scope:"both",sort:"name",provider:null,name:null,force:!1,path:null,all:!1,verbose:!1,flat:!1,transport:"auto",method:"default",installed:!1,available:!1,has:[],missing:[],dryRun:!1,machine:!1,noCache:!1,fix:!1}},Q=0;while(Q<$.length){let X=$[Q];if(X==="--help"||X==="-h")Z.flags.help=!0;else if(X==="--version"||X==="-v")Z.flags.version=!0;else if(X==="--json")Z.flags.json=!0;else if(X==="--yes"||X==="-y")Z.flags.yes=!0;else if(X==="--no-color")Z.flags.noColor=!0;else if(X==="--scope"||X==="-s"){Q++;let z=$[Q];if(z==="global"||z==="project"||z==="both")Z.flags.scope=z;else P(`Invalid scope: "${z}". Must be global, project, or both.`),process.exit(2)}else if(X==="--sort"){Q++;let z=$[Q];if(z==="name"||z==="version"||z==="location")Z.flags.sort=z;else P(`Invalid sort: "${z}". Must be name, version, or location.`),process.exit(2)}else if(X==="--provider"||X==="-p"||X==="--tool")Q++,Z.flags.provider=$[Q]||null;else if(X==="--name")Q++,Z.flags.name=$[Q]||null;else if(X==="--force"||X==="-f")Z.flags.force=!0;else if(X==="--path")Q++,Z.flags.path=$[Q]||null;else if(X==="--all")Z.flags.all=!0;else if(X==="--verbose"||X==="-V")Z.flags.verbose=!0;else if(X==="--flat")Z.flags.flat=!0;else if(X==="--installed")Z.flags.installed=!0;else if(X==="--available")Z.flags.available=!0;else if(X==="--transport"||X==="-t"){Q++;let z=$[Q];if(z==="https"||z==="ssh"||z==="auto")Z.flags.transport=z;else P(`Invalid transport: "${z}". Must be https, ssh, or auto.`),process.exit(2)}else if(X==="--method"||X==="-m"){Q++;let z=$[Q];if(z==="default"||z==="vercel")Z.flags.method=z;else P(`Invalid method: "${z}". Must be default or vercel.`),process.exit(2)}else if(X==="--skill")Q++,Z.flags.path=$[Q]||null;else if(X==="--dry-run")Z.flags.dryRun=!0;else if(X==="--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])Z.flags.has.push($[Q])}else if(X==="--missing"){if(Q++,$[Q])Z.flags.missing.push($[Q])}else if(X.startsWith("-"))P(`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 P(q){console.error(U.red(`Error: ${q}`))}function iW(){console.log(`${U.blueBold("agent-skill-manager")} (${U.bold("asm")}) ${c9}
|
|
234
234
|
|
|
235
235
|
Interactive TUI and CLI for managing installed skills for AI coding agents.
|
|
236
236
|
|
|
@@ -275,7 +275,7 @@ ${U.bold("Global Options:")}
|
|
|
275
275
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
276
276
|
--flat Show one row per tool instance (list, search)
|
|
277
277
|
-y, --yes Skip confirmation prompts
|
|
278
|
-
-V, --verbose Show debug output`)}function
|
|
278
|
+
-V, --verbose Show debug output`)}function sW(){console.log(`${U.bold("Usage:")} asm list [options]
|
|
279
279
|
|
|
280
280
|
List all discovered skills. By default, skills installed across multiple
|
|
281
281
|
tools are grouped into a single row with tool badges.
|
|
@@ -297,7 +297,7 @@ ${U.bold("Examples:")}
|
|
|
297
297
|
asm list -s project ${U.dim("Only project-scoped skills")}
|
|
298
298
|
asm list --sort version ${U.dim("Sort by version")}
|
|
299
299
|
asm list --json ${U.dim("Output as JSON")}
|
|
300
|
-
asm list --machine ${U.dim("Machine-readable v1 envelope output")}`)}function
|
|
300
|
+
asm list --machine ${U.dim("Machine-readable v1 envelope output")}`)}function tW(){console.log(`${U.bold("Usage:")} asm search <query> [options]
|
|
301
301
|
|
|
302
302
|
Search both installed skills and the skill index. Results show installation
|
|
303
303
|
status and include copy-paste install commands for available skills.
|
|
@@ -320,7 +320,7 @@ ${U.bold("Examples:")}
|
|
|
320
320
|
asm search "test" --installed ${U.dim("Search installed skills only")}
|
|
321
321
|
asm search "test" --available ${U.dim("Search available skills only")}
|
|
322
322
|
asm search openspec --json ${U.dim("Output matches as JSON")}
|
|
323
|
-
asm search openspec --machine ${U.dim("Machine-readable v1 envelope output")}`)}function
|
|
323
|
+
asm search openspec --machine ${U.dim("Machine-readable v1 envelope output")}`)}function rW(){console.log(`${U.bold("Usage:")} asm inspect <skill-name> [options]
|
|
324
324
|
|
|
325
325
|
Show detailed information for a skill. The <skill-name> is the directory name.
|
|
326
326
|
Shows version, description, file count, and all provider installations.
|
|
@@ -334,7 +334,7 @@ ${U.bold("Options:")}
|
|
|
334
334
|
${U.bold("Examples:")}
|
|
335
335
|
asm inspect code-review ${U.dim("Show details for code-review")}
|
|
336
336
|
asm inspect code-review --json ${U.dim("Output as JSON")}
|
|
337
|
-
asm inspect code-review -s global ${U.dim("Global installations only")}`)}function
|
|
337
|
+
asm inspect code-review -s global ${U.dim("Global installations only")}`)}function eW(){console.log(`${U.bold("Usage:")} asm uninstall <skill-name> [options]
|
|
338
338
|
|
|
339
339
|
Remove a skill and its associated rule files. Shows a removal plan
|
|
340
340
|
before proceeding and asks for confirmation.
|
|
@@ -348,7 +348,7 @@ ${U.bold("Options:")}
|
|
|
348
348
|
${U.bold("Examples:")}
|
|
349
349
|
asm uninstall code-review ${U.dim("Remove with confirmation")}
|
|
350
350
|
asm uninstall code-review -y ${U.dim("Remove without confirmation")}
|
|
351
|
-
asm uninstall code-review -s project ${U.dim("Remove project copy only")}`)}function
|
|
351
|
+
asm uninstall code-review -s project ${U.dim("Remove project copy only")}`)}function qV(){console.log(`${U.bold("Usage:")} asm audit [subcommand] [options]
|
|
352
352
|
|
|
353
353
|
Detect duplicate skills or run security audits on installed/remote skills.
|
|
354
354
|
|
|
@@ -374,7 +374,7 @@ ${U.bold("Examples:")}
|
|
|
374
374
|
asm audit security code-review --json ${U.dim("Output audit as JSON")}
|
|
375
375
|
asm audit security code-review --machine ${U.dim("Machine-readable v1 envelope output")}
|
|
376
376
|
asm audit security https://github.com/user/skills/tree/main/skills/agent-config
|
|
377
|
-
${U.dim("Audit a skill from a subfolder URL")}`)}function
|
|
377
|
+
${U.dim("Audit a skill from a subfolder URL")}`)}function $V(){console.log(`${U.bold("Usage:")} asm publish [path] [options]
|
|
378
378
|
|
|
379
379
|
Validate a skill, run a security audit, generate a registry manifest,
|
|
380
380
|
and open a PR against the asm-registry.
|
|
@@ -397,7 +397,7 @@ ${U.bold("Examples:")}
|
|
|
397
397
|
asm publish --dry-run ${U.dim("Preview manifest without side effects")}
|
|
398
398
|
asm publish --force ${U.dim("Override warning-level security findings")}
|
|
399
399
|
asm publish --json ${U.dim("Output as JSON")}
|
|
400
|
-
asm publish --machine ${U.dim("Machine-readable v1 envelope output")}`)}function
|
|
400
|
+
asm publish --machine ${U.dim("Machine-readable v1 envelope output")}`)}function ZV(){console.log(`${U.bold("Usage:")} asm outdated [options]
|
|
401
401
|
|
|
402
402
|
Show which installed skills have newer versions available.
|
|
403
403
|
|
|
@@ -410,7 +410,7 @@ ${U.bold("Options:")}
|
|
|
410
410
|
${U.bold("Examples:")}
|
|
411
411
|
asm outdated ${U.dim("Show outdated skills")}
|
|
412
412
|
asm outdated --json ${U.dim("Output as JSON")}
|
|
413
|
-
asm outdated --machine ${U.dim("Machine-readable output")}`)}function
|
|
413
|
+
asm outdated --machine ${U.dim("Machine-readable output")}`)}function QV(){console.log(`${U.bold("Usage:")} asm update [name...] [options]
|
|
414
414
|
|
|
415
415
|
Update outdated skills to their latest version with security re-audit.
|
|
416
416
|
|
|
@@ -428,7 +428,7 @@ ${U.bold("Examples:")}
|
|
|
428
428
|
asm update ${U.dim("Update all outdated skills")}
|
|
429
429
|
asm update code-review ${U.dim("Update a specific skill")}
|
|
430
430
|
asm update --yes ${U.dim("Skip confirmation prompts")}
|
|
431
|
-
asm update --json ${U.dim("Output as JSON")}`)}function
|
|
431
|
+
asm update --json ${U.dim("Output as JSON")}`)}function XV(){console.log(`${U.bold("Usage:")} asm config <subcommand>
|
|
432
432
|
|
|
433
433
|
Manage configuration. Config is stored at ~/.config/agent-skill-manager/.
|
|
434
434
|
|
|
@@ -444,18 +444,18 @@ ${U.bold("Options:")}
|
|
|
444
444
|
${U.bold("Examples:")}
|
|
445
445
|
asm config show ${U.dim("View current config")}
|
|
446
446
|
asm config edit ${U.dim("Edit in $EDITOR")}
|
|
447
|
-
asm config reset -y ${U.dim("Reset without confirmation")}`)}async function
|
|
448
|
-
${U.yellow(`${J.length} skill${J.length===1?"":"s"} with warnings -- use --json for details`)}`;console.log(z)}else console.log(
|
|
449
|
-
`)),q.flags.flat)console.log(
|
|
450
|
-
${U.bold("Proceed with removal?")} [y/N] `);let G=await $0();if(G.toLowerCase()!=="y"&&G.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let J=await
|
|
447
|
+
asm config reset -y ${U.dim("Reset without confirmation")}`)}async function KZ(q){for(let $ of q)$.warnings=await O5($)}async function zV(q){if(q.flags.help){sW();return}let $=performance.now(),Z=await h(),Q=await a(Z,q.flags.scope);if(q.flags.provider&&q.command==="list")Q=Q.filter((z)=>z.provider===q.flags.provider);await KZ(Q);let X=u9(Q,q.flags.sort);if(q.flags.machine){let z=X.map((J)=>({name:J.name,version:J.version,description:J.description,scope:J.scope,provider:J.provider,path:J.path}));console.log(l("list",z,$));return}if(q.flags.json)console.log(c(X));else if(q.flags.flat){let z=p9(X),J=X.filter((G)=>G.warnings&&G.warnings.length>0);if(J.length>0)z+=`
|
|
448
|
+
${U.yellow(`${J.length} skill${J.length===1?"":"s"} with warnings -- use --json for details`)}`;console.log(z)}else console.log(QZ(X))}async function JV(q){if(q.flags.help){tW();return}let $=q.flags.machine?g0():void 0,Z=performance.now(),Q=q.subcommand;if(!Q){if(q.flags.machine)$?.(),console.log(q0("search",e.INVALID_ARGUMENT,"Missing required argument: <query>",Z)),process.exit(2);P("Missing required argument: <query>"),console.error('Run "asm search --help" for usage.'),process.exit(2)}let X=!q.flags.available,z=!q.flags.installed,J=[];if(X){let V=await h(),W=await a(V,q.flags.scope);if(q.flags.provider)W=W.filter((_)=>_.provider===q.flags.provider);let B=t8(W,Q);J=u9(B,q.flags.sort)}let G=[];if(z){if(G=await n$(Q),J.length>0){let V=new Set(J.map((W)=>W.name.toLowerCase()));G=G.filter((W)=>!V.has(W.skill.name.toLowerCase()))}}if(q.flags.machine){$?.();let V=J.map((B)=>({name:B.name,description:B.description,source:"installed",url:null,match_count:1})),W=G.map((B)=>({name:B.skill.name,description:B.skill.description,source:"index",url:B.skill.installUrl,match_count:1}));console.log(l("search",[...V,...W],Z));return}if(q.flags.json){let V=J.map((B)=>({name:B.name,description:B.description,version:B.version,scope:B.scope,provider:B.provider,status:"installed"})),W=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(c([...V,...W]));return}let Y=J.length>0,H=G.length>0;if(!Y&&!H){console.error(`No skills matching "${Q}".`),console.error(U.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(Y)if(console.error(U.bold(`Installed skills matching "${Q}":
|
|
449
|
+
`)),q.flags.flat)console.log(p9(J));else console.log(XZ(J,Q));if(H){if(Y)console.error("");let V=zZ(G.map((W)=>({name:W.skill.name,version:W.skill.version,description:W.skill.description,verified:W.skill.verified,repoLabel:`${W.repo.owner}/${W.repo.repo}`,installUrl:W.skill.installUrl})),Q);console.error(V)}}async function GV(q){if(q.flags.help){rW();return}let $=q.subcommand;if(!$)P("Missing required argument: <skill-name>"),console.error('Run "asm inspect --help" for usage.'),process.exit(2);let Z=await h(),X=(await a(Z,q.flags.scope)).filter((z)=>z.dirName===$);if(X.length===0)P(`Skill "${$}" not found.`),console.error(U.dim(`Try ${U.bold("asm list")} to see all skills or ${U.bold(`asm search "${$}"`)} to search.`)),process.exit(1);if(await KZ(X),q.flags.json)console.log(c(X.length===1?X[0]:X));else console.log(await JZ(X))}async function YV(q){if(q.flags.help){eW();return}let $=q.subcommand;if(!$)P("Missing required argument: <skill-name>"),console.error('Run "asm uninstall --help" for usage.'),process.exit(2);let Z=await h(),Q=await a(Z,q.flags.scope),X=e8($,Q,Z),z=await qZ(X);if(z.length===0)P(`Skill "${$}" not found or nothing to remove.`),process.exit(1);console.error(U.bold("Removal plan:"));for(let G of z)console.error(` ${U.red("•")} ${ZZ(G)}`);if(!q.flags.yes){if(!process.stdin.isTTY)P("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`
|
|
450
|
+
${U.bold("Proceed with removal?")} [y/N] `);let G=await $0();if(G.toLowerCase()!=="y"&&G.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let J=await m9(X);for(let G of J)console.error(G);try{await YZ($)}catch{}console.error(U.green(`
|
|
451
451
|
Done.`))}function $0(){return new Promise((q)=>{let $="",Z=!1;function Q(){process.stdin.removeListener("data",z),process.stdin.removeListener("end",J),process.stdin.pause(),clearTimeout(G)}function X(Y){if(Z)return;Z=!0,Q(),q(Y)}function z(Y){if($+=Y,$.includes(`
|
|
452
|
-
`))X($.trim())}function J(){X($.trim())}let G=setTimeout(()=>{X($.trim())},30000);process.stdin.setEncoding("utf-8"),process.stdin.on("data",z),process.stdin.on("end",J),process.stdin.resume()})}async function
|
|
453
|
-
Auto-removing duplicates...`));for(let J of z.duplicateGroups){let G=
|
|
454
|
-
Done.`))}}async function
|
|
455
|
-
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2)}else if(Z.startsWith("github:")||Z.startsWith("https://github.com/"))await
|
|
456
|
-
`);let J=[];for(let G of z){console.error(` Scanning ${U.bold(G.name)}...`);let Y=await R0(G.realPath,G.name);J.push(Y)}if(q.flags.machine)console.log(l("audit security",
|
|
457
|
-
Summary:`)),G.dangerous>0)console.log(` ${U.red(`${G.dangerous} dangerous`)}`);if(G.warning>0)console.log(` ${U.yellow(`${G.warning} warning`)}`);if(G.caution>0)console.log(` ${G.caution} caution`);if(G.safe>0)console.log(` ${U.green(`${G.safe} safe`)}`);console.log("")}}async function
|
|
458
|
-
`);let G=await R0(J.realPath,J.name);if(q.flags.machine)console.log(l("audit security",
|
|
452
|
+
`))X($.trim())}function J(){X($.trim())}let G=setTimeout(()=>{X($.trim())},30000);process.stdin.setEncoding("utf-8"),process.stdin.on("data",z),process.stdin.on("end",J),process.stdin.resume()})}async function UV(q){if(q.flags.help){qV();return}let $=performance.now(),Z=q.subcommand??"duplicates";if(Z==="security"){await HV(q,$);return}if(Z!=="duplicates")P(`Unknown audit subcommand: "${Z}". Use: duplicates, security`),process.exit(2);let Q=await h(),X=await a(Q,"both"),z=d9(X);if(q.flags.machine){let J={duplicate_groups:z.duplicateGroups.map((G)=>({name:G.key,count:G.instances.length,instances:G.instances.map((Y)=>({path:Y.path,scope:Y.scope,provider:Y.provider}))})),total_duplicates:z.duplicateGroups.length};console.log(l("audit duplicates",J,$));return}if(q.flags.json){console.log(VZ(z));return}if(console.log(WZ(z)),q.flags.yes&&z.duplicateGroups.length>0){console.error(U.bold(`
|
|
453
|
+
Auto-removing duplicates...`));for(let J of z.duplicateGroups){let G=HZ(J.instances),Y=G[0].path;for(let H=1;H<G.length;H++){let V=G[H],W=r8(V,Q),B=await m9(W,Y);for(let _ of B)console.error(_)}}console.error(U.green(`
|
|
454
|
+
Done.`))}}async function HV(q,$){let Z=q.positional[0];if(q.flags.all)await WV(q,$);else if(!Z){if(q.flags.machine)console.log(q0("audit security",e.INVALID_ARGUMENT,"Missing target. Provide a skill name, GitHub source, or use --all.",$)),process.exit(2);P(`Missing target. Provide a skill name, GitHub source, or use --all.
|
|
455
|
+
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2)}else if(Z.startsWith("github:")||Z.startsWith("https://github.com/"))await VV(q,Z,$);else await BV(q,Z,$)}async function WV(q,$){let Z=await h(),Q=await a(Z,q.flags.scope);if(Q.length===0){if(q.flags.machine)console.log(l("audit security",[],$));else if(q.flags.json)console.log("[]");else console.log("No skills found to audit.");return}let X=new Set,z=Q.filter((G)=>{if(X.has(G.realPath))return!1;return X.add(G.realPath),!0});console.error(`Auditing ${z.length} skill${z.length>1?"s":""}...
|
|
456
|
+
`);let J=[];for(let G of z){console.error(` Scanning ${U.bold(G.name)}...`);let Y=await R0(G.realPath,G.name);J.push(Y)}if(q.flags.machine)console.log(l("audit security",l9(J),$));else if(q.flags.json)console.log(JSON.stringify(J,null,2));else{for(let Y of J)console.log(v$(Y));let G={safe:0,caution:0,warning:0,dangerous:0};for(let Y of J)G[Y.verdict]++;if(console.log(U.bold(`
|
|
457
|
+
Summary:`)),G.dangerous>0)console.log(` ${U.red(`${G.dangerous} dangerous`)}`);if(G.warning>0)console.log(` ${U.yellow(`${G.warning} warning`)}`);if(G.caution>0)console.log(` ${G.caution} caution`);if(G.safe>0)console.log(` ${U.green(`${G.safe} safe`)}`);console.log("")}}async function VV(q,$,Z){let Q=null;try{let X=d0($);if(X.isLocal)throw Error("Local paths are not supported for remote security audits. Use: asm audit security <installed-skill-name>");await c0(),X=await e$(X),console.error(`Cloning ${$} for audit...`),Q=await l0(X,q.flags.transport);let{join:z}=await import("path"),J=X.subpath?z(Q,X.subpath):Q,{name:G}=await w0(J),Y=await R0(J,G,X.owner,X.repo);if(q.flags.machine)console.log(l("audit security",l9([Y]),Z));else if(q.flags.json)console.log(D9(Y));else console.log(v$(Y))}catch(X){if(q.flags.machine)console.log(q0("audit security",e.AUDIT_FAILED,X.message,Z)),process.exit(1);P(X.message),process.exit(1)}finally{if(Q)await Q0(Q)}}async function BV(q,$,Z){let Q=await h(),z=(await a(Q,q.flags.scope)).filter((Y)=>Y.dirName===$);if(z.length===0){if(q.flags.machine)console.log(q0("audit security",e.SKILL_NOT_FOUND,`Skill "${$}" not found.`,Z)),process.exit(1);P(`Skill "${$}" not found. Use "asm list" to see installed skills.`),process.exit(1)}let J=z[0];console.error(`Auditing installed skill: ${U.bold(J.name)}...
|
|
458
|
+
`);let G=await R0(J.realPath,J.name);if(q.flags.machine)console.log(l("audit security",l9([G]),Z));else if(q.flags.json)console.log(D9(G));else console.log(v$(G))}async function KV(q){if(q.flags.help){XV();return}let $=q.subcommand;if(!$)P("Missing subcommand. Use: show, path, reset, or edit."),console.error('Run "asm config --help" for usage.'),process.exit(2);switch($){case"show":{let Z=await h();console.log(c(Z));break}case"path":{console.log(xq());break}case"reset":{if(!q.flags.yes){if(!process.stdin.isTTY)P("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`${U.bold("Reset config to defaults?")} [y/N] `);let Q=await $0();if(Q.toLowerCase()!=="y"&&Q.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Z=i8();await s8(Z),console.error(U.green("Config reset to defaults."));break}case"edit":{let Z=process.env.VISUAL||process.env.EDITOR||"vi",[Q,X]=BZ(Z),z=xq();await h();let{spawn:J}=await import("child_process");await new Promise((G,Y)=>{let H=J(Q,[...X,z],{stdio:"inherit"});H.on("close",()=>G()),H.on("error",Y)});break}default:P(`Unknown config subcommand: "${$}". Use: show, path, reset, or edit.`),process.exit(2)}}function _V(){console.log(`${U.bold("Usage:")} asm install <source> [options]
|
|
459
459
|
|
|
460
460
|
Install a skill from a GitHub repository, the curated registry, or a local path.
|
|
461
461
|
|
|
@@ -527,27 +527,27 @@ ${U.bold("Subfolder URL:")}
|
|
|
527
527
|
${U.bold("Vercel skills CLI:")}
|
|
528
528
|
asm install github:user/skills --method vercel --skill my-skill
|
|
529
529
|
asm install https://github.com/user/skills -m vercel --skill my-skill -y
|
|
530
|
-
${U.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function
|
|
531
|
-
${U.bold("Install preview:")}`),console.info(` ${U.bold("Name:")} ${J.name}`),console.info(` ${U.bold("Version:")} ${J.version}`),J.description)console.info(` ${U.bold("Description:")} ${U.dim(J.description)}`);if(J.effort)console.info(` ${U.bold("Effort:")} ${
|
|
530
|
+
${U.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function LV(q,$,Z,Q,X,z,J,G,Y="global"){let H=await w0(Q),V=await Z4(Q),W=Q===Z?null:Q.split(/[/\\]/).pop(),B=X||W||$.repo,_=N0(B),L=G.find((D)=>D.name.toLowerCase()===H.name.toLowerCase()&&D.provider===J.name),K,O=!!L;if(L)if(L.version===H.version)K=q.flags.force?"REINSTALL":`UPDATE: ${L.version} (same version)`;else K=`UPDATE: ${L.version} → ${H.version}`;else K="NEW";let F=q2($,Z,Q,_,J,q.flags.force||O,Y),A=V.some((D)=>["Shell commands","Code execution","Credentials"].includes(D.category)),M=V.some((D)=>["External URLs"].includes(D.category)),R=A?"high":M?"medium":"safe",T=A?U.red("[!] High Risk"):M?U.yellow("[~] Medium Risk"):U.green("[ok] Safe");return{metadata:H,skillName:_,warnings:V,installStatus:K,riskLevel:R,riskLabel:T,plan:F}}function OV(q,$,Z,Q,X,z){let{metadata:J,warnings:G,installStatus:Y,riskLabel:H,plan:V}=q;if(X&&z){let W=U.dim(`[${z.index}/${z.total}]`),B=Y==="NEW"?U.green(`[${Y}]`):U.yellow(`[${Y}]`);console.info(`${W} ${U.bold(J.name)} v${J.version} ${B} ${H}`)}else{let W=Y==="NEW"?U.green(`[${Y}]`):U.yellow(`[${Y}]`);if(console.info(` ${U.bold(J.name)} v${J.version} ${W}`),console.info(`
|
|
531
|
+
${U.bold("Install preview:")}`),console.info(` ${U.bold("Name:")} ${J.name}`),console.info(` ${U.bold("Version:")} ${J.version}`),J.description)console.info(` ${U.bold("Description:")} ${U.dim(J.description)}`);if(J.effort)console.info(` ${U.bold("Effort:")} ${$Z(J.effort)}`);if(console.info(` ${U.bold("Source:")} ${$}`),Q)console.info(` ${U.bold("Tool:")} All (${Q.map((B)=>B.label).join(", ")})`),console.info(` ${U.bold("Primary:")} ${Z.label} (${Z.name})`),console.info(` ${U.bold("Symlinks:")} ${Q.filter((B)=>B.name!==Z.name).map((B)=>B.label).join(", ")}`);else console.info(` ${U.bold("Tool:")} ${Z.label} (${Z.name})`);if(console.info(` ${U.bold("Scope:")} ${V.scope==="project"?"Project":"Global"}`),console.info(` ${U.bold("Target:")} ${V.targetDir}`),console.info(` ${U.bold("Status:")} ${W}`),console.info(` ${U.bold("Risk:")} ${H}`),G.length>0){console.info(`
|
|
532
532
|
${U.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 O=["Shell commands","Code execution","Credentials"].includes(_)?U.red(`[${_}]`):U.yellow(`[${_}]`);console.info(`
|
|
533
|
-
${O} ${U.dim(`(${L.length} match${L.length>1?"es":""})`)}`);for(let F of L.slice(0,5))console.info(` ${U.dim(`${F.file}:${F.line}`)} -- ${F.match}`);if(L.length>5)console.info(U.dim(` ... and ${L.length-5} more`))}}}}async function
|
|
534
|
-
${U.cyan(`[Step ${G}/${J}]`)} ${U.bold(V)}`},H=()=>{if(X)Q0(X).finally(()=>process.exit(1));else process.exit(1)};process.on("SIGINT",H),process.on("SIGTERM",H);try{if(
|
|
535
|
-
${U.cyan("●")} Resolving "${U.bold(Q)}" from registry...`);let{resolved:I,multipleMatches:j,suggestions:C}=await
|
|
533
|
+
${O} ${U.dim(`(${L.length} match${L.length>1?"es":""})`)}`);for(let F of L.slice(0,5))console.info(` ${U.dim(`${F.file}:${F.line}`)} -- ${F.match}`);if(L.length>5)console.info(U.dim(` ... and ${L.length-5} more`))}}}}async function FV(q,$){if($)return await Q4(q,$);return await nq(q)}async function IV(q){if(q.flags.help){_V();return}let $=q.flags.machine?g0():void 0,Z=performance.now(),Q=q.subcommand;if(!Q)P("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++,`
|
|
534
|
+
${U.cyan(`[Step ${G}/${J}]`)} ${U.bold(V)}`},H=()=>{if(X)Q0(X).finally(()=>process.exit(1));else process.exit(1)};process.on("SIGINT",H),process.on("SIGTERM",H);try{if(K9(Q)){console.info(`
|
|
535
|
+
${U.cyan("●")} Resolving "${U.bold(Q)}" from registry...`);let{resolved:I,multipleMatches:j,suggestions:C}=await M5(Q,{noCache:q.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(` ${U.green("✓")} Resolved: ${U.bold(`${S.author}/${S.name}`)} @ ${S.commit.slice(0,7)}`)}else if(j.length>0){console.info(`
|
|
536
536
|
${U.yellow("⚠")} Multiple skills found for "${U.bold(Q)}":`);let S=j.slice(0,5);for(let W0=0;W0<S.length;W0++){let Z0=S[W0];console.info(` ${U.cyan(`${W0+1}.`)} ${U.bold(`${Z0.author}/${Z0.name}`)} — ${Z0.description}`)}if(!process.stdin.isTTY)P(`Ambiguous skill name "${Q}". Use a scoped name: asm install author/name`),process.exit(2);let y=`
|
|
537
|
-
Select a skill [1-${S.length}]: `;process.stderr.write(y);let d=await new Promise((W0)=>{let Z0="",u0=!1,
|
|
538
|
-
Did you mean: ${C.map((S)=>U.cyan(S)).join(", ")}?`);process.exit(1)}else console.info(` ${U.dim("Not found in registry — trying existing sources...")}`),z="pre-indexed"}console.info(Y("Parsing source"));let V=d0(Q),W=!!V.isLocal;if(W){let I=V.localPath;console.info(` ${U.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 c0(),V=await
|
|
537
|
+
Select a skill [1-${S.length}]: `;process.stderr.write(y);let d=await new Promise((W0)=>{let Z0="",u0=!1,hq=setTimeout(()=>{if(!u0)u0=!0,process.stdin.removeListener("data",Jq),W0(Z0.trim())},30000);function Jq(m0){if(Z0=m0.toString().trim(),!u0)u0=!0,clearTimeout(hq),process.stdin.removeListener("data",Jq),W0(Z0)}process.stdin.setEncoding("utf-8"),process.stdin.on("data",Jq)}),p=parseInt(d,10);if(isNaN(p)||p<1||p>S.length)P("Invalid selection. Aborting."),process.exit(2);let i=S[p-1];z="registry";let vq=i.repository.replace("https://github.com/","");Q=i.skill_path?`github:${vq}#${i.commit}:${i.skill_path}`:`github:${vq}#${i.commit}`,console.info(` ${U.green("✓")} Selected: ${U.bold(`${i.author}/${i.name}`)} @ ${i.commit.slice(0,7)}`)}else if(_9(Q)){if(P(`Skill "${Q}" not found in the registry.`),C.length>0)console.error(`
|
|
538
|
+
Did you mean: ${C.map((S)=>U.cyan(S)).join(", ")}?`);process.exit(1)}else console.info(` ${U.dim("Not found in registry — trying existing sources...")}`),z="pre-indexed"}console.info(Y("Parsing source"));let V=d0(Q),W=!!V.isLocal;if(W){let I=V.localPath;console.info(` ${U.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 c0(),V=await e$(V),console.info(` ${U.dim(Q)}`);if(q.flags.method==="vercel"){console.info(Y("Installing via Vercel skills CLI")),await X4();let I=J4(V),j=q.flags.path||null;console.info(` ${U.dim(`npx skills add ${I}${j?` --skill ${j}`:""}`)}`);let{stdout:C,stderr:S}=await z4(I,j);if(C.trim())console.info(` ${U.dim(C.trim())}`);if(S.trim())console.error(` ${U.dim(S.trim())}`);console.info(` ${U.green("✓")} Vercel skills CLI install completed`),q.flags.force=!0,console.info(` ${U.dim("Continuing with asm install to register in local inventory...")}`)}console.info(Y("Selecting provider"));let B=await h(),{provider:_,allProviders:L}=await n0(B,q.flags.provider,!!process.stdin.isTTY);console.info(Y("Selecting scope"));let K;if(q.flags.scope==="global"||q.flags.scope==="project")K=q.flags.scope,console.info(` ${U.dim(`scope: ${K}`)}${K==="global"?` (${_.global})`:` (${_.project})`}`);else if(!process.stdin.isTTY||q.flags.yes)K="global",console.info(` ${U.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 p0({items:I});if(j.length===0)throw Error("No scope selected. Aborting.");K=j[0]===0?"global":"project",console.info(` Selected: ${U.bold(K)} ${U.dim(`(${K==="global"?_.global:_.project})`)}`)}if(W)console.info(Y("Reading local source")),console.info(` ${U.dim(V.localPath)}`),X=null;else{console.info(Y("Cloning repository"));let I=q.flags.transport,j=I==="ssh"?V.sshCloneUrl:I==="https"?V.cloneUrl:`${V.cloneUrl} ${U.dim("(auto)")}`;console.info(` ${j}${V.ref?` ${U.dim(`(ref: ${V.ref})`)}`:""}${V.subpath?` ${U.dim(`(path: ${V.subpath})`)}`:""}`),X=await l0(V,I)}let O=W?V.localPath:X;console.info(Y("Scanning for skills"));let{join:F}=await import("path"),A=[],M=q.flags.path||V.subpath,R=[];if(M){let I=F(O,M);try{await w0(I)}catch{throw Error(`No SKILL.md found at path "${M}" in the repository.`)}console.info(` Found skill at ${U.bold(M)}`),R=[{skillDir:I,nameOverride:q.flags.name}]}else{let I=!1;try{await w0(O),I=!0}catch{}if(I){let j=await w0(O);console.info(` Found: ${U.bold(j.name)} v${j.version}`),R=[{skillDir:O,nameOverride:q.flags.name}]}else{console.info(" No SKILL.md at root. Scanning subdirectories...");let j=await lq(O);if(j.length===0)throw Error("No skills found in this repository. Skills must have a SKILL.md file.");console.info(` Found ${U.bold(String(j.length))} skill(s):
|
|
539
539
|
`);for(let y=0;y<j.length;y++){let d=U.cyan(` ${String(y+1).padStart(String(j.length).length)})`);if(console.info(`${d} ${U.bold(j[y].name)} ${U.dim(`v${j[y].version}`)} ${U.dim(`(${j[y].relPath})`)}`),j[y].description)console.info(` ${U.dim(j[y].description)}`)}console.info(Y("Selecting skills")),G--;let C;if(q.flags.all&&(q.flags.yes||!process.stdin.isTTY))C=j.map((y)=>y.relPath),console.info(` Selected all ${U.bold(String(C.length))} skills`);else if(process.stdin.isTTY)if(j.length===1)C=[j[0].relPath],console.info(` Auto-selected: ${U.bold(j[0].name)} ${U.dim(`v${j[0].version}`)}`);else{let y=j.map((p)=>({label:p.name,hint:`v${p.version}${p.description?" "+p.description:""}`,checked:!!q.flags.all}));console.info("");let d=await p0({items:y});if(d.length===0)throw Error("No skills selected. Aborting.");C=d.map((p)=>j[p].relPath),console.info(` Selected ${U.bold(String(C.length))} skill(s)`)}else{P(`Repository contains ${j.length} skills. Use --path <subdir> to pick one or --all to install all.
|
|
540
540
|
Available skills:
|
|
541
541
|
${j.map((y)=>` --path ${y.relPath}`).join(`
|
|
542
|
-
`)}`),process.exit(2);return}let S
|
|
542
|
+
`)}`),process.exit(2);return}let S=$4(C);if(S.length>0){let y=S.map((p)=>` - ${p.name}: ${p.paths.map((i)=>`"${i}"`).join(", ")}`).join(`
|
|
543
543
|
`),d=Error(`Duplicate skill names detected in selection:
|
|
544
544
|
${y}
|
|
545
|
-
Choose one path per skill name or install with --path.`);throw d.duplicates=S,d}R=C.map((y)=>({skillDir:F(O,y),nameOverride:C.length===1?q.flags.name:null})),G++}}console.info(Y("Inspecting skills"));let T=await a(B,"both"),D=[],x=R.length>1;for(let I=0;I<R.length;I++){let{skillDir:j,nameOverride:C}=R[I],S=await
|
|
545
|
+
Choose one path per skill name or install with --path.`);throw d.duplicates=S,d}R=C.map((y)=>({skillDir:F(O,y),nameOverride:C.length===1?q.flags.name:null})),G++}}console.info(Y("Inspecting skills"));let T=await a(B,"both"),D=[],x=R.length>1;for(let I=0;I<R.length;I++){let{skillDir:j,nameOverride:C}=R[I],S=await LV(q,V,O,j,C,B,_,T,K);D.push(S),OV(S,Q,_,L,x,x?{index:I+1,total:R.length}:void 0)}if(x){if(console.info(""),console.info(` ${U.bold("Install settings:")}`),console.info(` ${U.bold("Source:")} ${Q}`),L)console.info(` ${U.bold("Tool:")} All (${L.map((y)=>y.label).join(", ")})`);else console.info(` ${U.bold("Tool:")} ${_.label} (${_.name})`);console.info(` ${U.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(U.green(`${C} Safe`));if(j>0)S.push(U.yellow(`${j} Medium Risk`));if(I>0)S.push(U.red(`${I} High Risk`));console.info(` ${U.bold("Risk:")} ${S.join(", ")}`)}if(console.info(Y("Installing")),!q.flags.yes){let I=D.some((y)=>y.riskLevel==="high");if(!process.stdin.isTTY)P("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?`
|
|
546
546
|
${U.red("[!]")} ${U.bold(`Install ${j}? Some have high-risk patterns.`)} [y/N] `:`
|
|
547
|
-
${U.bold(`Install ${j}?`)} [Y/n] `;process.stderr.write(C);let S=await $0();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 w=X?await
|
|
547
|
+
${U.bold(`Install ${j}?`)} [Y/n] `;process.stderr.write(C);let S=await $0();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 w=X?await UZ(X):null,f=[];for(let I=0;I<D.length;I++){let j=D[I],C=x?U.dim(`[${I+1}/${D.length}]`)+" ":" ";try{console.info(`${C}Installing ${U.bold(j.metadata.name)}...`);let S=await FV(j.plan,L);A.push(S),console.info(`${C}${U.green("✓")} ${j.metadata.name} installed to ${U.dim(j.plan.targetDir)}`);try{let y=W?`local:${V.localPath}`:`github:${V.owner}/${V.repo}`,d=W?"local":z==="registry"?"registry":"github";await bq(S.name,{source:y,commitHash:w||"unknown",ref:V.ref||"main",installedAt:new Date().toISOString(),provider:j.plan.providerName,sourceType:d,...z==="registry"?{registryName:S.name}:{}})}catch{}}catch(S){f.push({name:j.metadata.name,error:S.message}),console.error(`${C}${U.red("✗")} ${U.bold(j.metadata.name)} — ${U.red(S.message)}`)}}if(process.removeListener("SIGINT",H),process.removeListener("SIGTERM",H),f.length>0){console.error(`
|
|
548
548
|
${U.yellow(`${f.length} skill(s) failed to install:`)}`);for(let I of f)console.error(` ${U.red("✗")} ${I.name}: ${I.error}`)}if(q.flags.machine){$?.();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(l("install",I.length===1?I[0]:I,Z))}else if(q.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(U.green(`
|
|
549
549
|
Done! Installed "${A[0].name}" to ${A[0].path}`));else if(A.length>0)console.error(`
|
|
550
|
-
${U.green(`Done! Installed ${A.length} skill(s) successfully.`)}`)}catch(V){if(process.removeListener("SIGINT",H),process.removeListener("SIGTERM",H),q.flags.machine)$?.(),console.log(q0("install",e.INSTALL_FAILED,V.message,Z,V?.duplicates?{duplicates:V.duplicates}:void 0));else if(q.flags.json){let W={success:!1,error:V.message};if(V?.duplicates)W.duplicates=V.duplicates;console.log(JSON.stringify(W,null,2))}else P(V.message);process.exit(1)}finally{if(X)await Q0(X);$?.()}}function
|
|
550
|
+
${U.green(`Done! Installed ${A.length} skill(s) successfully.`)}`)}catch(V){if(process.removeListener("SIGINT",H),process.removeListener("SIGTERM",H),q.flags.machine)$?.(),console.log(q0("install",e.INSTALL_FAILED,V.message,Z,V?.duplicates?{duplicates:V.duplicates}:void 0));else if(q.flags.json){let W={success:!1,error:V.message};if(V?.duplicates)W.duplicates=V.duplicates;console.log(JSON.stringify(W,null,2))}else P(V.message);process.exit(1)}finally{if(X)await Q0(X);$?.()}}function AV(){console.log(`${U.bold("Usage:")} asm export [options]
|
|
551
551
|
|
|
552
552
|
Export skill inventory as a portable JSON manifest. Useful for backup,
|
|
553
553
|
sharing, or scripting.
|
|
@@ -560,7 +560,7 @@ ${U.bold("Options:")}
|
|
|
560
560
|
${U.bold("Examples:")}
|
|
561
561
|
asm export ${U.dim("Export all skills")}
|
|
562
562
|
asm export -s global ${U.dim("Export global skills only")}
|
|
563
|
-
asm export > skills.json ${U.dim("Save to file")}`)}async function
|
|
563
|
+
asm export > skills.json ${U.dim("Save to file")}`)}async function TV(q){if(q.flags.help){AV();return}let $=await h(),Z=await a($,q.flags.scope),Q=j5(Z);console.log(JSON.stringify(Q,null,2))}function MV(){console.log(`${U.bold("Usage:")} asm import <file> [options]
|
|
564
564
|
|
|
565
565
|
Import skills from a previously exported JSON manifest. Recreates skill
|
|
566
566
|
installations based on the manifest metadata.
|
|
@@ -582,9 +582,9 @@ ${U.bold("Examples:")}
|
|
|
582
582
|
asm import skills.json --force ${U.dim("Overwrite existing skills")}
|
|
583
583
|
asm import skills.json -s global ${U.dim("Import only global skills")}
|
|
584
584
|
asm export > backup.json ${U.dim("Export first, then import later")}
|
|
585
|
-
asm import backup.json ${U.dim("Restore from backup")}`)}async function
|
|
586
|
-
${U.bold("Proceed?")} [y/N] `);let Y=await $0();if(Y.toLowerCase()!=="y"&&Y.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let G=await
|
|
587
|
-
Nothing to import after scope filtering (--scope ${q.flags.scope}). All skills in the manifest were excluded.`);return}console.error("");for(let Y of G.results){let H=Y.status==="installed"?U.green("+++"):Y.status==="skipped"?U.yellow("---"):Y.status==="dry-run"?U.cyan("~~~"):U.red("!!!"),V=Y.reason?` ${U.dim(Y.reason)}`:"",W=Y.path?` ${U.dim(Y.path)}`:"";console.error(` ${H} ${Y.skillName} (${Y.provider}/${Y.scope})${V}${W}`)}if(console.error(""),console.error(`${U.bold("Summary:")} ${G.total} total, ${U.green(String(G.installed))} installed, ${U.yellow(String(G.skipped))} skipped, ${U.red(String(G.failed))} failed`),G.failed>0)process.exitCode=1}function
|
|
585
|
+
asm import backup.json ${U.dim("Restore from backup")}`)}async function jV(q){if(q.flags.help){MV();return}let $=q.subcommand;if(!$)P("Missing required argument: <file>"),console.error('Run "asm import --help" for usage.'),process.exit(2);let{resolve:Z}=await import("path"),Q=Z($),X;try{X=await w5(Q)}catch(Y){P(Y.message),process.exit(1)}let z=X.skills.length;if(z===0){if(q.flags.json)console.log(JSON.stringify({total:0,installed:0,skipped:0,failed:0,results:[]},null,2));else console.log("Manifest contains no skills. Nothing to import.");return}let J=q.flags.scope==="both"?"all scopes":q.flags.scope;if(console.error(`${U.bold("Importing")} ${z} skill${z>1?"s":""} from ${U.dim(Q)}`),console.error(` Scope filter: ${J}`),q.flags.force)console.error(` ${U.yellow("Force mode: existing skills will be overwritten")}`);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
586
|
+
${U.bold("Proceed?")} [y/N] `);let Y=await $0();if(Y.toLowerCase()!=="y"&&Y.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let G=await P5(X,{force:q.flags.force,dryRun:!1,scopeFilter:q.flags.scope});if(q.flags.json){console.log(JSON.stringify(G,null,2));return}if(G.total===0){console.error(`
|
|
587
|
+
Nothing to import after scope filtering (--scope ${q.flags.scope}). All skills in the manifest were excluded.`);return}console.error("");for(let Y of G.results){let H=Y.status==="installed"?U.green("+++"):Y.status==="skipped"?U.yellow("---"):Y.status==="dry-run"?U.cyan("~~~"):U.red("!!!"),V=Y.reason?` ${U.dim(Y.reason)}`:"",W=Y.path?` ${U.dim(Y.path)}`:"";console.error(` ${H} ${Y.skillName} (${Y.provider}/${Y.scope})${V}${W}`)}if(console.error(""),console.error(`${U.bold("Summary:")} ${G.total} total, ${U.green(String(G.installed))} installed, ${U.yellow(String(G.skipped))} skipped, ${U.red(String(G.failed))} failed`),G.failed>0)process.exitCode=1}function RV(){console.log(`${U.bold("Usage:")} asm init <name> [options]
|
|
588
588
|
|
|
589
589
|
Scaffold a new skill directory with a SKILL.md template. Creates a
|
|
590
590
|
ready-to-edit skill in the target tool's skill folder.
|
|
@@ -599,8 +599,8 @@ ${U.bold("Options:")}
|
|
|
599
599
|
${U.bold("Examples:")}
|
|
600
600
|
asm init my-skill ${U.dim("Scaffold (interactive tool)")}
|
|
601
601
|
asm init my-skill -p claude ${U.dim("Scaffold in Claude Code")}
|
|
602
|
-
asm init my-skill --path ./skills ${U.dim("Scaffold in custom directory")}`)}async function
|
|
603
|
-
${U.bold("Overwrite?")} [y/N] `);let X=await $0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}}await
|
|
602
|
+
asm init my-skill --path ./skills ${U.dim("Scaffold in custom directory")}`)}async function DV(q){if(q.flags.help){RV();return}let $=q.subcommand;if(!$)P("Missing required argument: <name>"),console.error('Run "asm init --help" for usage.'),process.exit(2);let Z=N0($),Q;if(q.flags.path){let{resolve:X}=await import("path");Q=X(q.flags.path)}else{let X=await h(),{provider:z}=await n0(X,q.flags.provider,!!process.stdin.isTTY),{join:J}=await import("path"),{resolveProviderPath:G}=await import("./chunk-vgzgtfy6.js"),Y=G(X.providers.find((H)=>H.name===z.name).global);Q=J(Y,Z)}if(await E5(Q)){if(!q.flags.force){if(!process.stdin.isTTY)P(`Directory already exists: ${Q}. Use --force to overwrite.`),process.exit(2);process.stderr.write(`${U.yellow(`Directory already exists: ${Q}`)}
|
|
603
|
+
${U.bold("Overwrite?")} [y/N] `);let X=await $0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}}await C5(Z,Q),console.error(U.green(`Done! Created skill "${Z}" at ${Q}`))}function NV(){console.log(`${U.bold("Usage:")} asm stats [options]
|
|
604
604
|
|
|
605
605
|
Show aggregate skill metrics with provider distribution charts,
|
|
606
606
|
scope breakdown, disk usage, and duplicate summary.
|
|
@@ -614,7 +614,7 @@ ${U.bold("Options:")}
|
|
|
614
614
|
${U.bold("Examples:")}
|
|
615
615
|
asm stats ${U.dim("Show full dashboard")}
|
|
616
616
|
asm stats -s global ${U.dim("Global skills only")}
|
|
617
|
-
asm stats --json ${U.dim("Output raw data as JSON")}`)}async function
|
|
617
|
+
asm stats --json ${U.dim("Output raw data as JSON")}`)}async function wV(q){if(q.flags.help){NV();return}let $=await h(),Z=await a($,q.flags.scope);if(Z.length===0){console.log("No skills found.");return}let Q=d9(Z),X=await x5(Z,Q);if(q.flags.json)if(!q.flags.verbose){let{perSkillDiskBytes:z,...J}=X;console.log(c(J))}else console.log(c(X));else console.log(y5(X))}function PV(){console.log(`${U.bold("Usage:")} asm doctor [options]
|
|
618
618
|
|
|
619
619
|
Run environment health checks and diagnostics. Validates all
|
|
620
620
|
prerequisites for using asm — git, GitHub CLI, Node.js, config,
|
|
@@ -629,7 +629,7 @@ ${U.bold("Options:")}
|
|
|
629
629
|
${U.bold("Examples:")}
|
|
630
630
|
asm doctor ${U.dim("Run all health checks")}
|
|
631
631
|
asm doctor --json ${U.dim("Output as JSON")}
|
|
632
|
-
asm doctor --machine ${U.dim("Machine-readable v1 envelope output")}`)}async function
|
|
632
|
+
asm doctor --machine ${U.dim("Machine-readable v1 envelope output")}`)}async function CV(q){if(q.flags.help){PV();return}let $=performance.now(),Z=await Y8();if(q.flags.machine){let Q={checks:Z.checks.map((X)=>({name:X.name,status:X.status,message:X.message,...X.fix?{fix:X.fix}:{}})),passed:Z.passed,warnings:Z.warnings,failures:Z.failures};console.log(l("doctor",Q,$))}else if(q.flags.json)console.log(H8(Z));else console.log(U8(Z));if(Z.failures>0)process.exit(1)}function EV(){console.log(`${U.bold("Usage:")} asm eval <skill-path> [options]
|
|
633
633
|
|
|
634
634
|
Evaluate a skill's SKILL.md against best practices and produce a scored quality
|
|
635
635
|
report with recommendations. Zero configuration — just point it at a skill
|
|
@@ -653,7 +653,7 @@ ${U.bold("Examples:")}
|
|
|
653
653
|
asm eval ./my-skill --fix ${U.dim("Auto-fix deterministic frontmatter issues")}
|
|
654
654
|
asm eval ./my-skill --fix --dry-run ${U.dim("Preview fixes as diff")}
|
|
655
655
|
asm eval ./my-skill --machine ${U.dim("Machine-readable v1 envelope output")}
|
|
656
|
-
asm eval-providers list ${U.dim("List registered eval providers")}`)}var
|
|
656
|
+
asm eval-providers list ${U.dim("List registered eval providers")}`)}var a8=!1;function _Z(){if(a8)return;y8(),a8=!0}function SV(q){let $=q.findings.find((Z)=>Z.severity==="error"&&(Z.code==="provider-threw"||Z.code==="timeout"||Z.code==="aborted"));if($)throw Error($.message)}async function bV(q){if(q.flags.help){EV();return}let $=q.flags.machine?g0():void 0,Z=performance.now(),Q=q.subcommand;if(!Q){if(q.flags.machine)$?.(),console.log(q0("eval",e.INVALID_ARGUMENT,"Missing required argument: <skill-path>",Z)),process.exit(2);P("Missing required argument: <skill-path>"),console.error('Run "asm eval --help" for usage.'),process.exit(2)}try{if(q.flags.fix){let H=await T8(),V=await A8(Q,{dryRun:q.flags.dryRun,gitAuthor:H});if(q.flags.machine){$?.(),console.log(l("eval",k9(V.report,V),Z));return}if(q.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(f9(V.report)),console.log(""),console.log(j8(V));return}_Z();let X=P8("quality","^1.0.0"),{resolve:z}=await import("path"),J=z(Q),G=await N8(X,{skillPath:J,skillMdPath:z(J,"SKILL.md")});SV(G);let Y=G.raw;if(q.flags.machine){$?.(),console.log(l("eval",k9(Y,null),Z));return}if(q.flags.json){console.log(M8(Y));return}console.log(f9(Y))}catch(X){if(q.flags.machine)$?.(),console.log(q0("eval",e.SKILL_NOT_FOUND,X?.message??String(X),Z)),process.exit(1);P(X?.message??String(X)),process.exit(1)}}function xV(){console.log(`${U.bold("Usage:")} asm eval-providers <subcommand> [options]
|
|
657
657
|
|
|
658
658
|
Manage evaluation providers registered with the ${U.bold("asm eval")} framework.
|
|
659
659
|
Providers implement the ${U.bold("EvalProvider")} contract (see src/eval/types.ts) and
|
|
@@ -669,7 +669,7 @@ ${U.bold("Options:")}
|
|
|
669
669
|
|
|
670
670
|
${U.bold("Examples:")}
|
|
671
671
|
asm eval-providers list ${U.dim("Show registered providers")}
|
|
672
|
-
asm eval-providers list --json ${U.dim("Machine-readable listing")}`)}async function
|
|
672
|
+
asm eval-providers list --json ${U.dim("Machine-readable listing")}`)}async function yV(q){if(q.flags.help){xV();return}let $=q.subcommand;if(!$)P("Missing subcommand. Use: list"),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2);switch($){case"list":{_Z();let Z=C8();if(q.flags.json){console.log(c(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((H)=>H[Y].length))),J=(G)=>G.map((Y,H)=>Y.padEnd(z[H])).join(" ");console.log(U.bold(J(Q))),console.log(z.map((G)=>"-".repeat(G)).join(" "));for(let G of X)console.log(J(G));return}default:P(`Unknown eval-providers subcommand: "${$}". Use: list`),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2)}}function fV(){console.log(`${U.bold("Usage:")} asm link <path> [<path2> ...] [options]
|
|
673
673
|
|
|
674
674
|
Symlink a local skill directory into an agent's skill folder. Useful
|
|
675
675
|
for local development — changes to the source are reflected immediately.
|
|
@@ -693,13 +693,13 @@ ${U.bold("Examples:")}
|
|
|
693
693
|
asm link ./my-skill -p claude ${U.dim("Link to Claude Code")}
|
|
694
694
|
asm link ./my-skill --name alias ${U.dim("Link with custom name")}
|
|
695
695
|
asm link ./my-skills-folder ${U.dim("Link all skills in folder")}
|
|
696
|
-
asm link ./skill1 ./skill2 ./skill3 -p claude ${U.dim("Link multiple skills at once")}`)}async function
|
|
697
|
-
${U.bold("Overwrite?")} [y/N] `);let X=await $0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0);return!0}async function
|
|
696
|
+
asm link ./skill1 ./skill2 ./skill3 -p claude ${U.dim("Link multiple skills at once")}`)}async function kV(q,$){if($)return!0;let{access:Z}=await import("fs/promises"),Q=!1;try{await Z(q),Q=!0}catch{}if(!Q)return!1;if(!process.stdin.isTTY)throw Error(`Target already exists: ${q}. Use --force to overwrite.`);process.stderr.write(`${U.yellow(`Target already exists: ${q}`)}
|
|
697
|
+
${U.bold("Overwrite?")} [y/N] `);let X=await $0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0);return!0}async function a$(q,$,Z,Q){let{join:X}=await import("path"),z=X($,Z),J=await kV(z,Q);return await k5(q,$,Z,J),{name:Z,symlinkPath:z,targetPath:q}}async function vV(q){if(q.flags.help){fV();return}let $=[];if(q.subcommand)$.push(q.subcommand);if($.push(...q.positional),$.length===0)P("Missing required argument: <path>"),console.error('Run "asm link --help" for usage.'),process.exit(2);if($.length>1){if(q.flags.name)P("--name cannot be used when linking multiple paths. Link each skill individually to use --name."),process.exit(2);let L=await h(),{provider:K}=await n0(L,q.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:O}=await import("./chunk-vgzgtfy6.js"),F=O(L.providers.find((D)=>D.name===K.name).global),{resolve:A,basename:M}=await import("path"),R=[],T=[];for(let D of $){let x=A(D),w=!1;try{await I9(x),w=!0}catch{}if(w){let f=M(x);try{let I=await a$(x,F,f,!!q.flags.force);if(R.push(I),!q.flags.json)console.error(U.green(` Linked "${I.name}" -> ${I.targetPath}`))}catch(I){let j=I instanceof Error?I.message:String(I);if(T.push({name:f,error:j}),!q.flags.json)console.error(U.red(` Failed to link "${f}": ${j}`))}}else{let f=[];try{f=await A9(x)}catch(I){let j=I instanceof Error?I.message:String(I);if(T.push({name:D,error:j}),!q.flags.json)console.error(U.red(` Failed to process "${D}": ${j}`));continue}if(f.length===0){let I=`No SKILL.md found in ${x} or its immediate subdirectories.`;if(T.push({name:D,error:I}),!q.flags.json)console.error(U.red(` ${I}`));continue}for(let I of f)try{let j=await a$(I.absPath,F,I.dirName,!!q.flags.force);if(R.push(j),!q.flags.json)console.error(U.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}),!q.flags.json)console.error(U.red(` Failed to link "${I.name}": ${C}`))}}}if(q.flags.json)console.log(c({success:T.length===0,linked:R,failures:T}));else if(T.length>0)console.error(U.yellow(`
|
|
698
698
|
${R.length} linked, ${T.length} failed.`));else console.error(U.green(`
|
|
699
|
-
Done! Linked ${R.length} skill(s) successfully.`));if(T.length>0)process.exit(1);return}let Z=$[0],{resolve:Q,basename:X}=await import("path"),z=Q(Z),J=!1;try{await
|
|
700
|
-
${U.bold(`Link ${G.length} skill(s)?`)} [Y/n] `);let L=await $0();if(L.toLowerCase()==="n"||L.toLowerCase()==="no")console.error("Aborted."),process.exit(0)}let B=[],_=[];for(let L of G){let K=q.flags.name&&G.length===1?N0(q.flags.name):L.dirName;try{let O=await
|
|
699
|
+
Done! Linked ${R.length} skill(s) successfully.`));if(T.length>0)process.exit(1);return}let Z=$[0],{resolve:Q,basename:X}=await import("path"),z=Q(Z),J=!1;try{await I9(z),J=!0}catch{}let G=[];if(!J){if(G=await A9(z),G.length===0)P(`No SKILL.md found in ${z} or its immediate subdirectories.`),process.exit(1);if(q.flags.name&&G.length>1)P(`--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 h(),{provider:H}=await n0(Y,q.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:V}=await import("./chunk-vgzgtfy6.js"),W=V(Y.providers.find((L)=>L.name===H.name).global);if(J){let L=q.flags.name?N0(q.flags.name):X(z),K;try{K=await a$(z,W,L,!!q.flags.force)}catch(O){let F=O instanceof Error?O.message:String(O);if(q.flags.json)console.log(c({success:!1,error:F}));else P(F);process.exit(2)}if(q.flags.json)console.log(c({success:!0,...K}));else console.error(U.green(`Done! Linked "${K.name}" -> ${K.targetPath}`)),console.error(` Symlink: ${K.symlinkPath}`),console.error(U.dim(` If you move or delete the source, run "asm uninstall ${K.name}" to clean up.`));return}console.error(`Found ${U.bold(String(G.length))} skill(s) in ${z}:`);for(let L of G)console.error(` ${U.bold(L.name)} ${U.dim(`v${L.version}`)} ${U.dim(`(${L.dirName}/)`)}`);if(process.stdin.isTTY&&!q.flags.force){process.stderr.write(`
|
|
700
|
+
${U.bold(`Link ${G.length} skill(s)?`)} [Y/n] `);let L=await $0();if(L.toLowerCase()==="n"||L.toLowerCase()==="no")console.error("Aborted."),process.exit(0)}let B=[],_=[];for(let L of G){let K=q.flags.name&&G.length===1?N0(q.flags.name):L.dirName;try{let O=await a$(L.absPath,W,K,!!q.flags.force);if(B.push(O),!q.flags.json)console.error(U.green(` Linked "${O.name}" -> ${O.targetPath}`))}catch(O){let F=O instanceof Error?O.message:String(O);if(_.push({name:L.name,error:F}),!q.flags.json)console.error(U.red(` Failed to link "${L.name}": ${F}`))}}if(q.flags.json)console.log(c({success:_.length===0,linked:B,failures:_}));else if(_.length>0)console.error(U.yellow(`
|
|
701
701
|
${B.length} linked, ${_.length} failed.`));else console.error(U.green(`
|
|
702
|
-
Done! Linked ${B.length} skill(s) successfully.`));if(_.length>0)process.exit(1)}function
|
|
702
|
+
Done! Linked ${B.length} skill(s) successfully.`));if(_.length>0)process.exit(1)}function hV(){console.log(`${U.bold("Usage:")} asm index <subcommand> [options]
|
|
703
703
|
|
|
704
704
|
Manage the skill index for searching available skills from indexed repos.
|
|
705
705
|
|
|
@@ -723,10 +723,10 @@ ${U.bold("Examples:")}
|
|
|
723
723
|
asm index search marketing --has license ${U.dim("Only with license")}
|
|
724
724
|
asm index search "" --missing creator ${U.dim("Skills missing creator")}
|
|
725
725
|
asm index list ${U.dim("List indexed repos")}
|
|
726
|
-
asm index remove obra/superpowers ${U.dim("Remove from index")}`)}async function
|
|
727
|
-
`));for(let J of z){let G=J.skill.verified?U.blue(" [verified]"):"";console.error(`${U.cyan(J.skill.name)} ${U.dim(`v${J.skill.version}`)}${G} ${U.dim(`[${J.repo.owner}/${J.repo.repo}]`)}`);for(let H of
|
|
728
|
-
`)}}break}case"list":{let Z=await
|
|
729
|
-
`));for(let X of Z)console.error(`${U.cyan(`${X.owner}/${X.repo}`)} - ${X.skillCount} skills ${U.dim(`(${new Date(X.updatedAt).toLocaleDateString()})`)}`)}break}case"remove":{let Z=q.positional[0];if(!Z)P("Missing required argument: <owner/repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let[Q,X]=Z.split("/");if(!Q||!X)P("Invalid format. Use: <owner/repo>"),process.exit(2);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`${U.bold("Remove")} ${U.cyan(`${Q}/${X}`)} ${U.bold("from index?")} [y/N] `);let J=await $0();if(J.toLowerCase()!=="y"&&J.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}if(await
|
|
726
|
+
asm index remove obra/superpowers ${U.dim("Remove from index")}`)}async function gV(q){if(q.flags.help){hV();return}let $=q.subcommand;if(!$)P("Missing subcommand. Use: ingest, search, list, or remove"),console.error('Run "asm index --help" for usage.'),process.exit(2);switch($){case"ingest":{let Z=q.positional[0];if(!Z)P("Missing required argument: <repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);console.error(U.blueBold(`Ingesting ${Z}...`));let Q=await c8(Z);if(!Q.success)P(`Failed to ingest: ${Q.error}`),process.exit(1);if(Q.repoIndex)if(q.flags.json)console.log(c({success:!0,owner:Q.repoIndex.owner,repo:Q.repoIndex.repo,skillCount:Q.repoIndex.skillCount,updatedAt:Q.repoIndex.updatedAt}));else console.error(U.green(`Successfully indexed ${Q.repoIndex.owner}/${Q.repoIndex.repo}`)),console.error(` Skills found: ${Q.repoIndex.skillCount}`);break}case"search":{let Z=q.positional.join(" ");if(!Z&&q.flags.has.length===0&&q.flags.missing.length===0)P("Missing required argument: <query>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let Q={};if(q.flags.has.length>0)Q.has=q.flags.has;if(q.flags.missing.length>0)Q.missing=q.flags.missing;let z=Q.has||Q.missing?await n$(Z||"",20,Q):await n$(Z);if(z.length===0){if(q.flags.json)console.log(c([]));else console.info("No skills found matching your query."),console.error(U.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(q.flags.json)console.log(c(z.map((J)=>({name:J.skill.name,description:J.skill.description,version:J.skill.version,license:J.skill.license||"",creator:J.skill.creator||"",compatibility:J.skill.compatibility||"",allowedTools:J.skill.allowedTools||[],verified:J.skill.verified===!0,installUrl:J.skill.installUrl,installCommand:`asm install ${J.skill.installUrl}`,repo:`${J.repo.owner}/${J.repo.repo}`}))));else{console.error(U.bold(`Found ${z.length} skills:
|
|
727
|
+
`));for(let J of z){let G=J.skill.verified?U.blue(" [verified]"):"";console.error(`${U.cyan(J.skill.name)} ${U.dim(`v${J.skill.version}`)}${G} ${U.dim(`[${J.repo.owner}/${J.repo.repo}]`)}`);for(let H of GZ(J.skill.description,80))console.error(` ${H}`);let Y=m8(J.skill);if(Y.length>0)console.error(` ${U.yellow(`⚠ Missing: ${Y.join(", ")}`)}`);console.error(` ${U.green(`asm install ${J.skill.installUrl}`)}
|
|
728
|
+
`)}}break}case"list":{let Z=await l8();if(Z.length===0){if(q.flags.json)console.log(c([]));else console.info("No repositories indexed."),console.error(U.dim("Add repos with: asm index ingest <repo>"));return}let Q=await p8();if(q.flags.json)console.log(c(Z));else{console.error(U.bold(`Indexed Repositories (${Q} total skills):
|
|
729
|
+
`));for(let X of Z)console.error(`${U.cyan(`${X.owner}/${X.repo}`)} - ${X.skillCount} skills ${U.dim(`(${new Date(X.updatedAt).toLocaleDateString()})`)}`)}break}case"remove":{let Z=q.positional[0];if(!Z)P("Missing required argument: <owner/repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let[Q,X]=Z.split("/");if(!Q||!X)P("Invalid format. Use: <owner/repo>"),process.exit(2);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`${U.bold("Remove")} ${U.cyan(`${Q}/${X}`)} ${U.bold("from index?")} [y/N] `);let J=await $0();if(J.toLowerCase()!=="y"&&J.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}if(await n8(Q,X))console.error(U.green(`Removed ${Q}/${X} from index`));else P(`Repository not found in index: ${Q}/${X}`),process.exit(1);break}default:P(`Unknown subcommand: "${$}"`),console.error('Run "asm index --help" for usage.'),process.exit(2)}}function uV(){console.log(`${U.bold("Usage:")} asm bundle <subcommand> [options]
|
|
730
730
|
|
|
731
731
|
Create, install, and manage curated skill bundles. A bundle is a reusable
|
|
732
732
|
recipe of skills for a particular workflow, domain, or project setup.
|
|
@@ -752,14 +752,14 @@ ${U.bold("Examples:")}
|
|
|
752
752
|
asm bundle list ${U.dim("Show all saved bundles")}
|
|
753
753
|
asm bundle list --json ${U.dim("List bundles as JSON")}
|
|
754
754
|
asm bundle show my-workflow ${U.dim("Show bundle details")}
|
|
755
|
-
asm bundle remove my-workflow ${U.dim("Remove a saved bundle")}`)}async function
|
|
756
|
-
`));let O=await p0({items:K});if(O.length===0)P("No skills selected. Bundle not created."),process.exit(1);G=O.map((F)=>J[F])}let{readLock:Y}=await import("./chunk-
|
|
757
|
-
${U.bold("Description")} (optional, press Enter to skip): `);let K=await $0();if(K.trim())W=K.trim();process.stderr.write(`${U.bold("Author")} (optional, press Enter to skip): `);let O=await $0();if(O.trim())B=O.trim()}let _=
|
|
755
|
+
asm bundle remove my-workflow ${U.dim("Remove a saved bundle")}`)}async function mV(q){if(q.flags.help){uV();return}let $=q.subcommand;if(!$)P("Missing subcommand. Use: create, install, list, show, or remove"),console.error('Run "asm bundle --help" for usage.'),process.exit(2);switch($){case"create":{let Z=q.positional[0];if(!Z)P("Missing required argument: <name>"),console.error("Usage: asm bundle create <name>"),process.exit(2);let Q=await h(),X=await a(Q,q.flags.scope);if(X.length===0)P("No skills found to include in the bundle."),process.exit(1);let z=new Set,J=X.filter((K)=>{let O=K.name.toLowerCase();if(z.has(O))return!1;return z.add(O),!0}),G=J;if(process.stdin.isTTY&&!q.flags.yes){let K=J.map((F)=>({label:`${F.name} v${F.version}`,hint:F.description?F.description.slice(0,60)+(F.description.length>60?"...":""):`(${F.provider}/${F.scope})`,checked:!0}));console.error(U.bold(`Select skills for bundle "${Z}":
|
|
756
|
+
`));let O=await p0({items:K});if(O.length===0)P("No skills selected. Bundle not created."),process.exit(1);G=O.map((F)=>J[F])}let{readLock:Y}=await import("./chunk-d61nf7gg.js"),H=await Y(),V=await Promise.all(G.map((K)=>h5(K,H))),W=`Bundle of ${V.length} skills`,B="unknown";try{let{execSync:K}=await import("child_process"),O=K("git config user.name",{encoding:"utf-8"}).trim();if(O)B=O}catch{}if(process.stdin.isTTY&&!q.flags.yes){process.stderr.write(`
|
|
757
|
+
${U.bold("Description")} (optional, press Enter to skip): `);let K=await $0();if(K.trim())W=K.trim();process.stderr.write(`${U.bold("Author")} (optional, press Enter to skip): `);let O=await $0();if(O.trim())B=O.trim()}let _=v5(Z,W,B,V),L=await g5(_);if(q.flags.json)console.log(JSON.stringify(_,null,2));else console.error(U.green(`Bundle "${Z}" created with ${V.length} skill(s).`)),console.error(` Saved to: ${U.dim(L)}`);break}case"install":{let Z=q.positional[0];if(!Z)P("Missing required argument: <name|file>"),console.error("Usage: asm bundle install <name|file>"),process.exit(2);let Q;try{Q=await j9(Z)}catch(W){P(W.message),process.exit(1)}if(console.error(`${U.bold("Bundle:")} ${Q.name} (${Q.skills.length} skills)`),Q.description)console.error(` ${U.dim(Q.description)}`);console.error("");for(let W of Q.skills){let B=W.version?` v${W.version}`:"";console.error(` ${U.cyan(W.name)}${U.dim(B)} ${U.dim(`-> ${W.installUrl}`)}`)}if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
758
758
|
${U.bold("Install all skills from this bundle?")} [y/N] `);let W=await $0();if(W.toLowerCase()!=="y"&&W.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let X=[],z=await h(),{provider:J}=await n0(z,q.flags.provider,!1),G=q.flags.scope==="global"||q.flags.scope==="project"?q.flags.scope:"global";for(let W of Q.skills){console.error(`
|
|
759
|
-
Installing ${U.bold(W.name)}...`);try{if(W.installUrl.startsWith("github:")||W.installUrl.startsWith("https://github.com/"))await c0();let _=d0(W.installUrl),L=!!_.isLocal,K=null;try{let O,F;if(!L)K=await l0(_,q.flags.transport),O=K,F=_.subpath?
|
|
760
|
-
`));for(let Q of Z){let X=Q.tags&&Q.tags.length>0?` ${U.dim(`[${Q.tags.join(", ")}]`)}`:"";if(console.error(` ${U.cyan(Q.name)} ${U.dim(`(${Q.skills.length} skills)`)}${X}`),Q.description)console.error(` ${U.dim(Q.description)}`);if(Q.author)console.error(` ${U.dim(`by ${Q.author}`)}`)}}break}case"show":{let Z=q.positional[0];if(!Z)P("Missing required argument: <name|file>"),console.error("Usage: asm bundle show <name|file>"),process.exit(2);let Q;try{Q=await
|
|
761
|
-
${U.bold(`Skills (${Q.skills.length})`)}:`);for(let X of Q.skills){let z=X.version?` v${X.version}`:"";if(console.error(` ${U.cyan(X.name)}${U.dim(z)}`),X.description)console.error(` ${U.dim(X.description)}`);console.error(` ${U.dim(`install: ${X.installUrl}`)}`)}}break}case"remove":{let Z=q.positional[0];if(!Z)P("Missing required argument: <name>"),console.error("Usage: asm bundle remove <name>"),process.exit(2);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`${U.bold("Remove bundle")} ${U.cyan(Z)}${U.bold("?")} [y/N] `);let X=await $0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Q;try{Q=await
|
|
762
|
-
`)),console.log(JSON.stringify(X.manifest,null,2));return}if(X.prUrl)console.error(U.green("Published successfully!")),console.error(""),console.error(` PR: ${X.prUrl}`),console.error(` Manifest: manifests/${X.manifest?.author}/${X.manifest?.name}.json`),console.error(` Security: ${X.securityVerdict}`),console.error(""),console.error(U.dim("The registry maintainers will review your submission."))}catch(X){let z={success:!1,manifest:null,prUrl:null,error:X.message,securityVerdict:"pass",securityReport:{scannedAt:new Date().toISOString(),skillName:"",skillPath:"",source:null,codeScans:[],permissions:[],totalFiles:0,totalLines:0,verdict:"safe",verdictReason:""}};if(q.flags.machine)$?.(),console.log(q0("publish",e.PUBLISH_FAILED,X.message,Z)),process.exit(1);if(q.flags.json)console.log(JSON.stringify({success:!1,manifest:null,pr_url:null,error:X.message,security_verdict:null},null,2)),process.exit(1);P(X.message),process.exit(1)}}async function
|
|
759
|
+
Installing ${U.bold(W.name)}...`);try{if(W.installUrl.startsWith("github:")||W.installUrl.startsWith("https://github.com/"))await c0();let _=d0(W.installUrl),L=!!_.isLocal,K=null;try{let O,F;if(!L)K=await l0(_,q.flags.transport),O=K,F=_.subpath?nW(K,_.subpath):K;else O=_.localPath,F=_.localPath;let A=await w0(F),M=N0(W.name||A.name||_.repo),R=q2(_,O,F,M,J,q.flags.force,G);try{await G4(R.targetDir,R.force)}catch(T){if(T.message?.includes("--force")){X.push({name:W.name,status:"skipped",reason:"Already installed. Use --force to overwrite."}),console.error(` ${U.dim("---")} ${W.name} skipped (already installed)`);continue}throw T}await nq(R),X.push({name:W.name,status:"installed"}),console.error(` ${U.green("+++")} ${W.name} installed`)}finally{if(K)await Q0(K)}}catch(B){X.push({name:W.name,status:"failed",reason:B.message}),console.error(` ${U.red("!!!")} ${W.name}: ${B.message}`)}}let Y=X.filter((W)=>W.status==="installed").length,H=X.filter((W)=>W.status==="skipped").length,V=X.filter((W)=>W.status==="failed").length;if(q.flags.json)console.log(JSON.stringify({bundleName:Q.name,total:X.length,installed:Y,skipped:H,failed:V,results:X},null,2));else console.error(""),console.error(`${U.bold("Summary:")} ${X.length} total, ${U.green(String(Y))} installed, `+(H>0?`${U.dim(String(H))} skipped, `:"")+`${U.red(String(V))} failed`);if(V>0)process.exitCode=1;break}case"list":{let Z=await u5();if(Z.length===0){if(q.flags.json)console.log("[]");else console.log("No bundles found."),console.error(U.dim("Create one with: asm bundle create <name>"));return}if(q.flags.json)console.log(JSON.stringify(Z,null,2));else{console.error(U.bold(`Saved Bundles (${Z.length}):
|
|
760
|
+
`));for(let Q of Z){let X=Q.tags&&Q.tags.length>0?` ${U.dim(`[${Q.tags.join(", ")}]`)}`:"";if(console.error(` ${U.cyan(Q.name)} ${U.dim(`(${Q.skills.length} skills)`)}${X}`),Q.description)console.error(` ${U.dim(Q.description)}`);if(Q.author)console.error(` ${U.dim(`by ${Q.author}`)}`)}}break}case"show":{let Z=q.positional[0];if(!Z)P("Missing required argument: <name|file>"),console.error("Usage: asm bundle show <name|file>"),process.exit(2);let Q;try{Q=await j9(Z)}catch(X){P(X.message),process.exit(1)}if(q.flags.json)console.log(JSON.stringify(Q,null,2));else{if(console.error(U.bold(`Bundle: ${Q.name}`)),Q.description)console.error(` ${Q.description}`);if(Q.author)console.error(` ${U.dim(`Author: ${Q.author}`)}`);if(console.error(` ${U.dim(`Created: ${new Date(Q.createdAt).toLocaleString()}`)}`),Q.tags&&Q.tags.length>0)console.error(` ${U.dim(`Tags: ${Q.tags.join(", ")}`)}`);console.error(`
|
|
761
|
+
${U.bold(`Skills (${Q.skills.length})`)}:`);for(let X of Q.skills){let z=X.version?` v${X.version}`:"";if(console.error(` ${U.cyan(X.name)}${U.dim(z)}`),X.description)console.error(` ${U.dim(X.description)}`);console.error(` ${U.dim(`install: ${X.installUrl}`)}`)}}break}case"remove":{let Z=q.positional[0];if(!Z)P("Missing required argument: <name>"),console.error("Usage: asm bundle remove <name>"),process.exit(2);if(!q.flags.yes&&process.stdin.isTTY){process.stderr.write(`${U.bold("Remove bundle")} ${U.cyan(Z)}${U.bold("?")} [y/N] `);let X=await $0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Q;try{Q=await m5(Z)}catch(X){P(X.message),process.exit(1)}if(Q)console.error(U.green(`Bundle "${Z}" removed.`));else P(`Bundle "${Z}" not found.`),process.exit(1);break}default:P(`Unknown subcommand: "${$}". Use: create, install, list, show, or remove`),console.error('Run "asm bundle --help" for usage.'),process.exit(2)}}async function pV(q){if(q.flags.help){$V();return}let $=q.flags.machine?g0():void 0,Z=performance.now(),Q=q.subcommand||".";try{let X=await a5({path:Q,dryRun:q.flags.dryRun,force:q.flags.force,yes:q.flags.yes});if(q.flags.machine){if($?.(),!X.success)console.log(q0("publish",e.PUBLISH_FAILED,X.error||"Publish failed",Z,{manifest:X.manifest,security_verdict:X.securityVerdict,fallback:X.fallback??!1})),process.exit(1);console.log(l("publish",{manifest:X.manifest,pr_url:X.prUrl,status:X.securityVerdict},Z));return}if(q.flags.json){if(console.log(JSON.stringify({success:X.success,manifest:X.manifest,pr_url:X.prUrl,error:X.error,security_verdict:X.securityVerdict},null,2)),!X.success)process.exit(1);return}if(!X.success)P(X.error||"Publish failed."),process.exit(1);if(X.fallback){console.log(U.yellow("Manifest generated (gh CLI unavailable):")),console.log(o5(X));return}if(q.flags.dryRun){console.error(U.dim(`Dry run — no PR created.
|
|
762
|
+
`)),console.log(JSON.stringify(X.manifest,null,2));return}if(X.prUrl)console.error(U.green("Published successfully!")),console.error(""),console.error(` PR: ${X.prUrl}`),console.error(` Manifest: manifests/${X.manifest?.author}/${X.manifest?.name}.json`),console.error(` Security: ${X.securityVerdict}`),console.error(""),console.error(U.dim("The registry maintainers will review your submission."))}catch(X){let z={success:!1,manifest:null,prUrl:null,error:X.message,securityVerdict:"pass",securityReport:{scannedAt:new Date().toISOString(),skillName:"",skillPath:"",source:null,codeScans:[],permissions:[],totalFiles:0,totalLines:0,verdict:"safe",verdictReason:""}};if(q.flags.machine)$?.(),console.log(q0("publish",e.PUBLISH_FAILED,X.message,Z)),process.exit(1);if(q.flags.json)console.log(JSON.stringify({success:!1,manifest:null,pr_url:null,error:X.message,security_verdict:null},null,2)),process.exit(1);P(X.message),process.exit(1)}}async function dV(q){if(q.flags.help){ZV();return}let $=q.flags.machine?g0():void 0,Z=performance.now();try{let Q=await C9();if(q.flags.machine){$?.();let z=Q.entries.map((J)=>({name:J.name,installed_commit:J.installedCommit,latest_commit:J.latestCommit,source:J.sourceType,status:J.status}));console.log(l("outdated",z,Z));return}if(q.flags.json){console.log($8(Q));return}let X=!q.flags.noColor&&process.stdout.isTTY!==!1;if(console.log(q8(Q,X)),Q.outdatedCount>0)process.exitCode=1}catch(Q){if(q.flags.machine)$?.(),console.log(q0("outdated",e.UNKNOWN_ERROR,Q.message,Z)),process.exit(1);P(Q.message),process.exit(1)}}async function cV(q){if(q.flags.help){QV();return}let $=q.flags.machine?g0():void 0,Z=performance.now(),Q=[];if(q.subcommand)Q.push(q.subcommand);Q.push(...q.positional);try{let X=await e5(Q.length>0?Q:null,q.flags.yes);if(q.flags.machine){$?.();let J=X.results.map((G)=>({name:G.name,status:G.status,reason:G.reason||null,old_commit:G.oldCommit||null,new_commit:G.newCommit||null,security_verdict:G.securityVerdict||null}));console.log(l("update",J,Z));return}if(q.flags.json){console.log(Z8(X));return}if(X.results.length>0)console.error(U.yellow("Note: project-scoped skill detection is not yet supported. All updates target the global skill path."));if(X.warnings&&X.warnings.length>0)for(let J of X.warnings)console.error(U.yellow(`Warning: skill "${J}" not found in lock file — skipped`));if(X.results.length===0){console.log("All skills are up to date.");return}for(let J of X.results)switch(J.status){case"updated":if(console.log(`${U.green("✓")} ${J.name} ${U.dim(J.oldCommit||"")} → ${J.newCommit||""}`),J.securityVerdict==="warning")console.error(U.yellow(` ⚠ Security audit returned warning for ${J.name} — updated because --yes was supplied`));break;case"skipped":console.log(`${U.yellow("○")} ${J.name} ${U.dim(J.reason||"skipped")}`);break;case"failed":console.log(`${U.red("✗")} ${J.name} ${U.dim(J.reason||"failed")}`);break}console.log("");let z=[];if(X.updatedCount>0)z.push(U.green(`${X.updatedCount} updated`));if(X.skippedCount>0)z.push(U.yellow(`${X.skippedCount} skipped`));if(X.failedCount>0)z.push(U.red(`${X.failedCount} failed`));if(console.log(z.join(", ")),X.failedCount>0)process.exitCode=1}catch(X){if(q.flags.machine)$?.(),console.log(q0("update",e.UNKNOWN_ERROR,X.message,Z)),process.exit(1);P(X.message),process.exit(1)}}async function LZ(q){let $=oW(q);if($.flags.json&&$.flags.machine)P("--json and --machine are mutually exclusive. Use one or the other."),process.exit(2);if($.flags.machine)$.flags.yes=!0;if($.flags.noColor)globalThis.__CLI_NO_COLOR=!0;if($.flags.verbose)o8(!0);if($.flags.version){console.log(`asm ${c9}`);let Z=await m$();if($.flags.verbose&&Z.resolved){if(console.log(` path: ${Z.resolved.path}`),Z.resolved.realPath!==Z.resolved.path)console.log(` real: ${Z.resolved.realPath}`)}if(Z.shadowed.length>0&&Z.resolved){console.error(""),console.error(U.yellow(`Warning: ${Z.shadowed.length+1} \`asm\` binaries on PATH — you may be running a shadowed install.`)),console.error(` resolved: ${Z.resolved.path}`);for(let Q of Z.shadowed)console.error(` shadowed: ${Q.path}`);console.error(U.dim(" Pick one package manager (npm OR bun) and remove the other install.")),console.error(U.dim(" See: https://github.com/luongnv89/agent-skill-manager#troubleshooting"))}return}if(!$.command&&$.flags.help){iW();return}if(!$.command)return;switch($.command){case"list":await zV($);break;case"search":await JV($);break;case"inspect":await GV($);break;case"uninstall":await YV($);break;case"audit":await UV($);break;case"install":await IV($);break;case"config":await KV($);break;case"export":await TV($);break;case"import":await jV($);break;case"init":await DV($);break;case"stats":await wV($);break;case"link":await vV($);break;case"index":await gV($);break;case"bundle":await mV($);break;case"publish":await pV($);break;case"outdated":await dV($);break;case"update":await cV($);break;case"doctor":await CV($);break;case"eval":await bV($);break;case"eval-providers":await yV($);break;default:P(`Unknown command: "${$.command}"`),console.error('Run "asm --help" for usage.'),process.exit(2)}}function OZ(q){let $=q.slice(2);if($.length===0)return!1;let Z=["list","search","inspect","uninstall","audit","config","install","export","import","init","stats","link","index","bundle","publish","outdated","update","doctor","eval","eval-providers"],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(OZ(process.argv))await LZ(process.argv);else if(!(typeof globalThis.Bun<"u")){let{spawn:$}=await import("child_process"),Z=$("bun",[process.argv[1],...process.argv.slice(2)],{stdio:"inherit"});Z.on("error",()=>{console.error(`The interactive TUI requires Bun (https://bun.sh).
|
|
763
763
|
Install it with: curl -fsSL https://bun.sh/install | bash
|
|
764
764
|
|
|
765
|
-
`+"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-
|
|
765
|
+
`+"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-y89teqgt.js");
|