agent-skill-manager 2.1.0 → 2.3.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 +10 -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 +413 -383
- package/dist/chunk-76faq0t9.js +93 -0
- package/dist/{chunk-1becp2v6.js → chunk-83zxj8cj.js} +1 -1
- package/dist/{chunk-a26gjzjk.js → chunk-chw0sgjp.js} +1 -1
- package/dist/chunk-dtg819nd.js +19 -0
- package/package.json +1 -1
- package/dist/chunk-6mbpytcj.js +0 -15
- package/dist/chunk-x537ndd4.js +0 -92
|
@@ -1,165 +1,165 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as
|
|
3
|
-
`)}}
|
|
4
|
-
`)?
|
|
2
|
+
import{a as m0,b as v$,c as S6,d as b6}from"./chunk-83zxj8cj.js";import{A as Y1,B as N6,C as D6,D as P6,G as C6,H as E6,I as c,J as Q2,K as x6,M as f6,N as y6,O as Z6,P as X2,Q as k6,e as $0,f as J0,g as K2,h as o$,k as o,l as F6,m as e4,n as A6,o as I6,p as $2,q as T6,r as W,s as M6,t as n5,u as R6,v as q2,w as Z2,x as r4,y as j6,z as w6}from"./chunk-dtg819nd.js";import{$ as z0,R as g,S as N,T as v,U as _6,V as E,W as O6,X as h$,Y as A8,Z as m$,_ as Y6,aa as h,ba as L6}from"./chunk-chw0sgjp.js";var k=N((TZ)=>{var K1=Symbol.for("yaml.alias"),M2=Symbol.for("yaml.document"),e$=Symbol.for("yaml.map"),R2=Symbol.for("yaml.pair"),_1=Symbol.for("yaml.scalar"),$q=Symbol.for("yaml.seq"),K0=Symbol.for("yaml.node.type"),KZ=($)=>!!$&&typeof $==="object"&&$[K0]===K1,_Z=($)=>!!$&&typeof $==="object"&&$[K0]===M2,OZ=($)=>!!$&&typeof $==="object"&&$[K0]===e$,LZ=($)=>!!$&&typeof $==="object"&&$[K0]===R2,j2=($)=>!!$&&typeof $==="object"&&$[K0]===_1,FZ=($)=>!!$&&typeof $==="object"&&$[K0]===$q;function w2($){if($&&typeof $==="object")switch($[K0]){case e$:case $q:return!0}return!1}function AZ($){if($&&typeof $==="object")switch($[K0]){case K1:case e$:case _1:case $q:return!0}return!1}var IZ=($)=>(j2($)||w2($))&&!!$.anchor;TZ.ALIAS=K1;TZ.DOC=M2;TZ.MAP=e$;TZ.NODE_TYPE=K0;TZ.PAIR=R2;TZ.SCALAR=_1;TZ.SEQ=$q;TZ.hasAnchor=IZ;TZ.isAlias=KZ;TZ.isCollection=w2;TZ.isDocument=_Z;TZ.isMap=OZ;TZ.isNode=AZ;TZ.isPair=LZ;TZ.isScalar=j2;TZ.isSeq=FZ});var V$=N((hZ)=>{var m=k(),i=Symbol("break visit"),N2=Symbol("skip children"),U0=Symbol("remove node");function qq($,q){let Z=D2(q);if(m.isDocument($)){if(o0(null,$.contents,Z,Object.freeze([$]))===U0)$.contents=null}else o0(null,$,Z,Object.freeze([]))}qq.BREAK=i;qq.SKIP=N2;qq.REMOVE=U0;function o0($,q,Z,Q){let X=P2($,q,Z,Q);if(m.isNode(X)||m.isPair(X))return C2($,Q,X),o0($,X,Z,Q);if(typeof X!=="symbol"){if(m.isCollection(q)){Q=Object.freeze(Q.concat(q));for(let z=0;z<q.items.length;++z){let J=o0(z,q.items[z],Z,Q);if(typeof J==="number")z=J-1;else if(J===i)return i;else if(J===U0)q.items.splice(z,1),z-=1}}else if(m.isPair(q)){Q=Object.freeze(Q.concat(q));let z=o0("key",q.key,Z,Q);if(z===i)return i;else if(z===U0)q.key=null;let J=o0("value",q.value,Z,Q);if(J===i)return i;else if(J===U0)q.value=null}}return X}async function Zq($,q){let Z=D2(q);if(m.isDocument($)){if(await s0(null,$.contents,Z,Object.freeze([$]))===U0)$.contents=null}else await s0(null,$,Z,Object.freeze([]))}Zq.BREAK=i;Zq.SKIP=N2;Zq.REMOVE=U0;async function s0($,q,Z,Q){let X=await P2($,q,Z,Q);if(m.isNode(X)||m.isPair(X))return C2($,Q,X),s0($,X,Z,Q);if(typeof X!=="symbol"){if(m.isCollection(q)){Q=Object.freeze(Q.concat(q));for(let z=0;z<q.items.length;++z){let J=await s0(z,q.items[z],Z,Q);if(typeof J==="number")z=J-1;else if(J===i)return i;else if(J===U0)q.items.splice(z,1),z-=1}}else if(m.isPair(q)){Q=Object.freeze(Q.concat(q));let z=await s0("key",q.key,Z,Q);if(z===i)return i;else if(z===U0)q.key=null;let J=await s0("value",q.value,Z,Q);if(J===i)return i;else if(J===U0)q.value=null}}return X}function D2($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function P2($,q,Z,Q){if(typeof Z==="function")return Z($,q,Q);if(m.isMap(q))return Z.Map?.($,q,Q);if(m.isSeq(q))return Z.Seq?.($,q,Q);if(m.isPair(q))return Z.Pair?.($,q,Q);if(m.isScalar(q))return Z.Scalar?.($,q,Q);if(m.isAlias(q))return Z.Alias?.($,q,Q);return}function C2($,q,Z){let Q=q[q.length-1];if(m.isCollection(Q))Q.items[$]=Z;else if(m.isPair(Q))if($==="key")Q.key=Z;else Q.value=Z;else if(m.isDocument(Q))Q.contents=Z;else{let X=m.isAlias(Q)?"alias":"scalar";throw Error(`Cannot replace node with ${X} parent`)}}hZ.visit=qq;hZ.visitAsync=Zq});var O1=N((cZ)=>{var E2=k(),mZ=V$(),pZ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},dZ=($)=>$.replace(/[!,[\]{}]/g,(q)=>pZ[q]);class q0{constructor($,q){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},q0.defaultYaml,$),this.tags=Object.assign({},q0.defaultTags,q)}clone(){let $=new q0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new q0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:q0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},q0.defaultTags);break}return $}add($,q){if(this.atNextDocument)this.yaml={explicit:q0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},q0.defaultTags),this.atNextDocument=!1;let Z=$.trim().split(/[ \t]+/),Q=Z.shift();switch(Q){case"%TAG":{if(Z.length!==2){if(q(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[X,z]=Z;return this.tags[X]=z,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return q(0,"%YAML directive should contain exactly one part"),!1;let[X]=Z;if(X==="1.1"||X==="1.2")return this.yaml.version=X,!0;else{let z=/^\d+\.\d+$/.test(X);return q(6,`Unsupported YAML version ${X}`,z),!1}}default:return q(0,`Unknown directive ${Q}`,!0),!1}}tagName($,q){if($==="!")return"!";if($[0]!=="!")return q(`Not a valid tag: ${$}`),null;if($[1]==="<"){let z=$.slice(2,-1);if(z==="!"||z==="!!")return q(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")q("Verbatim tags must end with a >");return z}let[,Z,Q]=$.match(/^(.*!)([^!]*)$/s);if(!Q)q(`The ${$} tag has no suffix`);let X=this.tags[Z];if(X)try{return X+decodeURIComponent(Q)}catch(z){return q(String(z)),null}if(Z==="!")return $;return q(`Could not resolve tag: ${$}`),null}tagString($){for(let[q,Z]of Object.entries(this.tags))if($.startsWith(Z))return q+dZ($.substring(Z.length));return $[0]==="!"?$:`!<${$}>`}toString($){let q=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),Q;if($&&Z.length>0&&E2.isNode($.contents)){let X={};mZ.visit($.contents,(z,J)=>{if(E2.isNode(J)&&J.tag)X[J.tag]=!0}),Q=Object.keys(X)}else Q=[];for(let[X,z]of Z){if(X==="!!"&&z==="tag:yaml.org,2002:")continue;if(!$||Q.some((J)=>J.startsWith(z)))q.push(`%TAG ${X} ${z}`)}return q.join(`
|
|
3
|
+
`)}}q0.defaultYaml={explicit:!1,version:"1.2"};q0.defaultTags={"!!":"tag:yaml.org,2002:"};cZ.Directives=q0});var Qq=N((oZ)=>{var S2=k(),nZ=V$();function aZ($){if(/[\x00-\x19\s,[\]{}]/.test($)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(Z)}return!0}function b2($){let q=new Set;return nZ.visit($,{Value(Z,Q){if(Q.anchor)q.add(Q.anchor)}}),q}function x2($,q){for(let Z=1;;++Z){let Q=`${$}${Z}`;if(!q.has(Q))return Q}}function iZ($,q){let Z=[],Q=new Map,X=null;return{onAnchor:(z)=>{Z.push(z),X??(X=b2($));let J=x2(q,X);return X.add(J),J},setAnchors:()=>{for(let z of Z){let J=Q.get(z);if(typeof J==="object"&&J.anchor&&(S2.isScalar(J.node)||S2.isCollection(J.node)))J.node.anchor=J.anchor;else{let Y=Error("Failed to resolve repeated object (this should not happen)");throw Y.source=z,Y}}},sourceObjects:Q}}oZ.anchorIsValid=aZ;oZ.anchorNames=b2;oZ.createNodeAnchors=iZ;oZ.findNewAnchor=x2});var L1=N(($3)=>{function H$($,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],Y=H$($,Q,String(X),J);if(Y===void 0)delete Q[X];else if(Y!==J)Q[X]=Y}else if(Q instanceof Map)for(let X of Array.from(Q.keys())){let z=Q.get(X),J=H$($,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=H$($,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=H$($,Q,X,z);if(J===void 0)delete Q[X];else if(J!==z)Q[X]=J}return $.call(q,Z,Q)}$3.applyReviver=H$});var L0=N((Q3)=>{var Z3=k();function f2($,q,Z){if(Array.isArray($))return $.map((Q,X)=>f2(Q,String(X),Z));if($&&typeof $.toJSON==="function"){if(!Z||!Z3.hasAnchor($))return $.toJSON(q,Z);let Q={aliasCount:0,count:1,res:void 0};Z.anchors.set($,Q),Z.onCreate=(z)=>{Q.res=z,delete Z.onCreate};let X=$.toJSON(q,Z);if(Z.onCreate)Z.onCreate(X);return X}if(typeof $==="bigint"&&!Z?.keep)return Number($);return $}Q3.toJS=f2});var Xq=N((Y3)=>{var z3=L1(),y2=k(),J3=L0();class k2{constructor($){Object.defineProperty(this,y2.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:q,maxAliasCount:Z,onAnchor:Q,reviver:X}={}){if(!y2.isDocument($))throw TypeError("A document argument is required");let z={anchors:new Map,doc:$,keep:!0,mapAsMap:q===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},J=J3.toJS(this,"",z);if(typeof Q==="function")for(let{count:Y,res:G}of z.anchors.values())Q(G,Y);return typeof X==="function"?z3.applyReviver(X,{"":J},"",J):J}}Y3.NodeBase=k2});var B$=N((B3)=>{var U3=Qq(),W3=V$(),t0=k(),V3=Xq(),H3=L0();class v2 extends V3.NodeBase{constructor($){super(t0.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,q){let Z;if(q?.aliasResolveCache)Z=q.aliasResolveCache;else if(Z=[],W3.visit($,{Node:(X,z)=>{if(t0.isAlias(z)||t0.hasAnchor(z))Z.push(z)}}),q)q.aliasResolveCache=Z;let Q=void 0;for(let X of Z){if(X===this)break;if(X.anchor===this.source)Q=X}return Q}toJSON($,q){if(!q)return{source:this.source};let{anchors:Z,doc:Q,maxAliasCount:X}=q,z=this.resolve(Q,q);if(!z){let Y=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(Y)}let J=Z.get(z);if(!J)H3.toJS(z,null,q),J=Z.get(z);if(J?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(X>=0){if(J.count+=1,J.aliasCount===0)J.aliasCount=zq(Q,z,Z);if(J.count*J.aliasCount>X)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return J.res}toString($,q,Z){let Q=`*${this.source}`;if($){if(U3.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let X=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(X)}if($.implicitKey)return`${Q} `}return Q}}function zq($,q,Z){if(t0.isAlias(q)){let Q=q.resolve($),X=Z&&Q&&Z.get(Q);return X?X.count*X.aliasCount:0}else if(t0.isCollection(q)){let Q=0;for(let X of q.items){let z=zq($,X,Z);if(z>Q)Q=z}return Q}else if(t0.isPair(q)){let Q=zq($,q.key,Z),X=zq($,q.value,Z);return Math.max(Q,X)}return 1}B3.Alias=v2});var u=N((A3)=>{var _3=k(),O3=Xq(),L3=L0(),F3=($)=>!$||typeof $!=="function"&&typeof $!=="object";class x0 extends O3.NodeBase{constructor($){super(_3.SCALAR);this.value=$}toJSON($,q){return q?.keep?this.value:L3.toJS(this.value,$,q)}toString(){return String(this.value)}}x0.BLOCK_FOLDED="BLOCK_FOLDED";x0.BLOCK_LITERAL="BLOCK_LITERAL";x0.PLAIN="PLAIN";x0.QUOTE_DOUBLE="QUOTE_DOUBLE";x0.QUOTE_SINGLE="QUOTE_SINGLE";A3.Scalar=x0;A3.isScalarValue=F3});var K$=N((N3)=>{var M3=B$(),f0=k(),h2=u(),R3="tag:yaml.org,2002:";function j3($,q,Z){if(q){let Q=Z.filter((z)=>z.tag===q),X=Q.find((z)=>!z.format)??Q[0];if(!X)throw Error(`Tag ${q} not found`);return X}return Z.find((Q)=>Q.identify?.($)&&!Q.format)}function w3($,q,Z){if(f0.isDocument($))$=$.contents;if(f0.isNode($))return $;if(f0.isPair($)){let V=Z.schema[f0.MAP].createNode?.(Z.schema,null,Z);return V.items.push($),V}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:Q,onAnchor:X,onTagObj:z,schema:J,sourceObjects:Y}=Z,G=void 0;if(Q&&$&&typeof $==="object")if(G=Y.get($),G)return G.anchor??(G.anchor=X($)),new M3.Alias(G.anchor);else G={anchor:null,node:null},Y.set($,G);if(q?.startsWith("!!"))q=R3+q.slice(2);let U=j3($,q,J.tags);if(!U){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new h2.Scalar($);if(G)G.node=V;return V}U=$ instanceof Map?J[f0.MAP]:(Symbol.iterator in Object($))?J[f0.SEQ]:J[f0.MAP]}if(z)z(U),delete Z.onTagObj;let H=U?.createNode?U.createNode(Z.schema,$,Z):typeof U?.nodeClass?.from==="function"?U.nodeClass.from(Z.schema,$,Z):new h2.Scalar($);if(q)H.tag=q;else if(!U.default)H.tag=U.tag;if(G)G.node=H;return H}N3.createNode=w3});var Jq=N((E3)=>{var P3=K$(),W0=k(),C3=Xq();function F1($,q,Z){let Q=Z;for(let X=q.length-1;X>=0;--X){let z=q[X];if(typeof z==="number"&&Number.isInteger(z)&&z>=0){let J=[];J[z]=Q,Q=J}else Q=new Map([[z,Q]])}return P3.createNode(Q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var g2=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class u2 extends C3.NodeBase{constructor($,q){super($);Object.defineProperty(this,"schema",{value:q,configurable:!0,enumerable:!1,writable:!0})}clone($){let q=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)q.schema=$;if(q.items=q.items.map((Z)=>W0.isNode(Z)||W0.isPair(Z)?Z.clone($):Z),this.range)q.range=this.range.slice();return q}addIn($,q){if(g2($))this.add(q);else{let[Z,...Q]=$,X=this.get(Z,!0);if(W0.isCollection(X))X.addIn(Q,q);else if(X===void 0&&this.schema)this.set(Z,F1(this.schema,Q,q));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}deleteIn($){let[q,...Z]=$;if(Z.length===0)return this.delete(q);let Q=this.get(q,!0);if(W0.isCollection(Q))return Q.deleteIn(Z);else throw Error(`Expected YAML collection at ${q}. Remaining path: ${Z}`)}getIn($,q){let[Z,...Q]=$,X=this.get(Z,!0);if(Q.length===0)return!q&&W0.isScalar(X)?X.value:X;else return W0.isCollection(X)?X.getIn(Q,q):void 0}hasAllNullValues($){return this.items.every((q)=>{if(!W0.isPair(q))return!1;let Z=q.value;return Z==null||$&&W0.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn($){let[q,...Z]=$;if(Z.length===0)return this.has(q);let Q=this.get(q,!0);return W0.isCollection(Q)?Q.hasIn(Z):!1}setIn($,q){let[Z,...Q]=$;if(Q.length===0)this.set(Z,q);else{let X=this.get(Z,!0);if(W0.isCollection(X))X.setIn(Q,q);else if(X===void 0&&this.schema)this.set(Z,F1(this.schema,Q,q));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${Q}`)}}}E3.Collection=u2;E3.collectionFromPath=F1;E3.isEmptyPath=g2});var _$=N((k3)=>{var f3=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function A1($,q){if(/^\n+$/.test($))return $.substring(1);return q?$.replace(/^(?! *$)/gm,q):$}var y3=($,q,Z)=>$.endsWith(`
|
|
4
|
+
`)?A1(Z,q):Z.includes(`
|
|
5
5
|
`)?`
|
|
6
|
-
`+
|
|
7
|
-
`){if(Z==="block")K=
|
|
8
|
-
`&&_!=="\t"){let
|
|
9
|
-
`&&
|
|
10
|
-
${
|
|
11
|
-
${
|
|
12
|
-
`);Q
|
|
13
|
-
`){if(z-J>Q)return!0;if(J=z+1,X-J<=Q)return!1}return!0}function
|
|
14
|
-
|
|
15
|
-
`;while(Z[
|
|
16
|
-
`,
|
|
17
|
-
`)||/[ \t]\n|\n[ \t]/.test(
|
|
18
|
-
${Z}`)+"'";return
|
|
6
|
+
`+A1(Z,q):($.endsWith(" ")?"":" ")+Z;k3.indentComment=A1;k3.lineComment=y3;k3.stringifyComment=f3});var p2=N((m3)=>{function u3($,q,Z="flow",{indentAtStart:Q,lineWidth:X=80,minContentWidth:z=20,onFold:J,onOverflow:Y}={}){if(!X||X<0)return $;if(X<z)z=0;let G=Math.max(1+z,1+X-q.length);if($.length<=G)return $;let U=[],H={},V=X-q.length;if(typeof Q==="number")if(Q>X-Math.max(2,z))U.push(0);else V=X-Q;let B=void 0,_=void 0,O=!1,K=-1,L=-1,F=-1;if(Z==="block"){if(K=m2($,K,q.length),K!==-1)V=K+G}for(let M;M=$[K+=1];){if(Z==="quoted"&&M==="\\"){switch(L=K,$[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=m2($,K,q.length);V=K+q.length+G,B=void 0}else{if(M===" "&&_&&_!==" "&&_!==`
|
|
8
|
+
`&&_!=="\t"){let j=$[K+1];if(j&&j!==" "&&j!==`
|
|
9
|
+
`&&j!=="\t")B=K}if(K>=V)if(B)U.push(B),V=B+G,B=void 0;else if(Z==="quoted"){while(_===" "||_==="\t")_=M,M=$[K+=1],O=!0;let j=K>F+1?K-2:L-1;if(H[j])return $;U.push(j),H[j]=!0,V=j+G,B=void 0}else O=!0}_=M}if(O&&Y)Y();if(U.length===0)return $;if(J)J();let A=$.slice(0,U[0]);for(let M=0;M<U.length;++M){let j=U[M],T=U[M+1]||$.length;if(j===0)A=`
|
|
10
|
+
${q}${$.slice(0,T)}`;else{if(Z==="quoted"&&H[j])A+=`${$[j]}\\`;A+=`
|
|
11
|
+
${q}${$.slice(j+1,T)}`}}return A}function m2($,q,Z){let Q=q,X=q+1,z=$[X];while(z===" "||z==="\t")if(q<X+Z)z=$[++q];else{do z=$[++q];while(z&&z!==`
|
|
12
|
+
`);Q=q,X=q+1,z=$[X]}return Q}m3.FOLD_BLOCK="block";m3.FOLD_FLOW="flow";m3.FOLD_QUOTED="quoted";m3.foldFlowLines=u3});var L$=N((o3)=>{var Y0=u(),F0=p2(),Gq=($,q)=>({indentAtStart:q?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),Uq=($)=>/^(%|---|\.\.\.)/m.test($);function n3($,q,Z){if(!q||q<0)return!1;let Q=q-Z,X=$.length;if(X<=Q)return!1;for(let z=0,J=0;z<X;++z)if($[z]===`
|
|
13
|
+
`){if(z-J>Q)return!0;if(J=z+1,X-J<=Q)return!1}return!0}function O$($,q){let Z=JSON.stringify($);if(q.options.doubleQuotedAsJSON)return Z;let{implicitKey:Q}=q,X=q.options.doubleQuotedMinMultiLineLength,z=q.indent||(Uq($)?" ":""),J="",Y=0;for(let G=0,U=Z[G];U;U=Z[++G]){if(U===" "&&Z[G+1]==="\\"&&Z[G+2]==="n")J+=Z.slice(Y,G)+"\\ ",G+=1,Y=G,U="\\";if(U==="\\")switch(Z[G+1]){case"u":{J+=Z.slice(Y,G);let H=Z.substr(G+2,4);switch(H){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(H.substr(0,2)==="00")J+="\\x"+H.substr(2);else J+=Z.substr(G,6)}G+=5,Y=G+1}break;case"n":if(Q||Z[G+2]==='"'||Z.length<X)G+=1;else{J+=Z.slice(Y,G)+`
|
|
14
|
+
|
|
15
|
+
`;while(Z[G+2]==="\\"&&Z[G+3]==="n"&&Z[G+4]!=='"')J+=`
|
|
16
|
+
`,G+=2;if(J+=z,Z[G+2]===" ")J+="\\";G+=1,Y=G+1}break;default:G+=1}}return J=Y?J+Z.slice(Y):Z,Q?J:F0.foldFlowLines(J,z,F0.FOLD_QUOTED,Gq(q,!1))}function I1($,q){if(q.options.singleQuote===!1||q.implicitKey&&$.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return O$($,q);let Z=q.indent||(Uq($)?" ":""),Q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${Z}`)+"'";return q.implicitKey?Q:F0.foldFlowLines(Q,Z,F0.FOLD_FLOW,Gq(q,!1))}function r0($,q){let{singleQuote:Z}=q.options,Q;if(Z===!1)Q=O$;else{let X=$.includes('"'),z=$.includes("'");if(X&&!z)Q=I1;else if(z&&!X)Q=O$;else Q=Z?I1:O$}return Q($,q)}var T1;try{T1=new RegExp(`(^|(?<!
|
|
19
19
|
))
|
|
20
20
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{
|
|
21
|
+
|$)`,"g")}catch{T1=/\n+(?!\n|$)/g}function Yq({comment:$,type:q,value:Z},Q,X,z){let{blockQuote:J,commentString:Y,lineWidth:G}=Q.options;if(!J||/\n[\t ]+$/.test(Z))return r0(Z,Q);let U=Q.indent||(Q.forceBlockIndent||Uq(Z)?" ":""),H=J==="literal"?!0:J==="folded"||q===Y0.Scalar.BLOCK_FOLDED?!1:q===Y0.Scalar.BLOCK_LITERAL?!0:!n3(Z,G,U.length);if(!Z)return H?`|
|
|
22
22
|
`:`>
|
|
23
|
-
`;let
|
|
24
|
-
`&&T!=="\t"&&T!==" ")break}let _=Z.substring(B),
|
|
25
|
-
`);if(
|
|
26
|
-
`)_=_.slice(0,-1);_=_.replace(
|
|
27
|
-
`)F=
|
|
28
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${
|
|
29
|
-
${
|
|
30
|
-
${
|
|
31
|
-
`)||
|
|
32
|
-
`)?
|
|
33
|
-
`))return
|
|
34
|
-
${
|
|
35
|
-
${
|
|
36
|
-
${
|
|
37
|
-
`:"",A){let x=
|
|
38
|
-
${
|
|
39
|
-
`&&M)
|
|
40
|
-
|
|
41
|
-
`}else
|
|
42
|
-
${Z.indent}`}else if(!_&&
|
|
43
|
-
`),
|
|
23
|
+
`;let V,B;for(B=Z.length;B>0;--B){let T=Z[B-1];if(T!==`
|
|
24
|
+
`&&T!=="\t"&&T!==" ")break}let _=Z.substring(B),O=_.indexOf(`
|
|
25
|
+
`);if(O===-1)V="-";else if(Z===_||O!==_.length-1){if(V="+",z)z()}else V="";if(_){if(Z=Z.slice(0,-_.length),_[_.length-1]===`
|
|
26
|
+
`)_=_.slice(0,-1);_=_.replace(T1,`$&${U}`)}let K=!1,L,F=-1;for(L=0;L<Z.length;++L){let T=Z[L];if(T===" ")K=!0;else if(T===`
|
|
27
|
+
`)F=L;else break}let A=Z.substring(0,F<L?F+1:L);if(A)Z=Z.substring(A.length),A=A.replace(/\n+/g,`$&${U}`);let j=(K?U?"2":"1":"")+V;if($){if(j+=" "+Y($.replace(/ ?[\r\n]+/g," ")),X)X()}if(!H){let T=Z.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${U}`),w=!1,x=Gq(Q,!0);if(J!=="folded"&&q!==Y0.Scalar.BLOCK_FOLDED)x.onOverflow=()=>{w=!0};let P=F0.foldFlowLines(`${A}${T}${_}`,U,F0.FOLD_BLOCK,x);if(!w)return`>${j}
|
|
29
|
+
${U}${P}`}return Z=Z.replace(/\n+/g,`$&${U}`),`|${j}
|
|
30
|
+
${U}${A}${Z}${_}`}function a3($,q,Z,Q){let{type:X,value:z}=$,{actualString:J,implicitKey:Y,indent:G,indentStep:U,inFlow:H}=q;if(Y&&z.includes(`
|
|
31
|
+
`)||H&&/[[\]{},]/.test(z))return r0(z,q);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(z))return Y||H||!z.includes(`
|
|
32
|
+
`)?r0(z,q):Yq($,q,Z,Q);if(!Y&&!H&&X!==Y0.Scalar.PLAIN&&z.includes(`
|
|
33
|
+
`))return Yq($,q,Z,Q);if(Uq(z)){if(G==="")return q.forceBlockIndent=!0,Yq($,q,Z,Q);else if(Y&&G===U)return r0(z,q)}let V=z.replace(/\n+/g,`$&
|
|
34
|
+
${G}`);if(J){let B=(K)=>K.default&&K.tag!=="tag:yaml.org,2002:str"&&K.test?.test(V),{compat:_,tags:O}=q.doc.schema;if(O.some(B)||_?.some(B))return r0(z,q)}return Y?V:F0.foldFlowLines(V,G,F0.FOLD_FLOW,Gq(q,!1))}function i3($,q,Z,Q){let{implicitKey:X,inFlow:z}=q,J=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:Y}=$;if(Y!==Y0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(J.value))Y=Y0.Scalar.QUOTE_DOUBLE}let G=(H)=>{switch(H){case Y0.Scalar.BLOCK_FOLDED:case Y0.Scalar.BLOCK_LITERAL:return X||z?r0(J.value,q):Yq(J,q,Z,Q);case Y0.Scalar.QUOTE_DOUBLE:return O$(J.value,q);case Y0.Scalar.QUOTE_SINGLE:return I1(J.value,q);case Y0.Scalar.PLAIN:return a3(J,q,Z,Q);default:return null}},U=G(Y);if(U===null){let{defaultKeyType:H,defaultStringType:V}=q.options,B=X&&H||V;if(U=G(B),U===null)throw Error(`Unsupported default string type ${B}`)}return U}o3.stringifyString=i3});var F$=N((X7)=>{var t3=Qq(),A0=k(),r3=_$(),e3=L$();function $7($,q){let Z=Object.assign({blockQuote:!0,commentString:r3.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,q),Q;switch(Z.collectionStyle){case"block":Q=!1;break;case"flow":Q=!0;break;default:Q=null}return{anchors:new Set,doc:$,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:Q,options:Z}}function q7($,q){if(q.tag){let X=$.filter((z)=>z.tag===q.tag);if(X.length>0)return X.find((z)=>z.format===q.format)??X[0]}let Z=void 0,Q;if(A0.isScalar(q)){Q=q.value;let X=$.filter((z)=>z.identify?.(Q));if(X.length>1){let z=X.filter((J)=>J.test);if(z.length>0)X=z}Z=X.find((z)=>z.format===q.format)??X.find((z)=>!z.format)}else Q=q,Z=$.find((X)=>X.nodeClass&&Q instanceof X.nodeClass);if(!Z){let X=Q?.constructor?.name??(Q===null?"null":typeof Q);throw Error(`Tag not resolved for ${X} value`)}return Z}function Z7($,q,{anchors:Z,doc:Q}){if(!Q.directives)return"";let X=[],z=(A0.isScalar($)||A0.isCollection($))&&$.anchor;if(z&&t3.anchorIsValid(z))Z.add(z),X.push(`&${z}`);let J=$.tag??(q.default?null:q.tag);if(J)X.push(Q.directives.tagString(J));return X.join(" ")}function Q7($,q,Z,Q){if(A0.isPair($))return $.toString(q,Z,Q);if(A0.isAlias($)){if(q.doc.directives)return $.toString(q);if(q.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(q.resolvedAliases)q.resolvedAliases.add($);else q.resolvedAliases=new Set([$]);$=$.resolve(q.doc)}}let X=void 0,z=A0.isNode($)?$:q.doc.createNode($,{onTagObj:(G)=>X=G});X??(X=q7(q.doc.schema.tags,z));let J=Z7(z,X,q);if(J.length>0)q.indentAtStart=(q.indentAtStart??0)+J.length+1;let Y=typeof X.stringify==="function"?X.stringify(z,q,Z,Q):A0.isScalar(z)?e3.stringifyString(z,q,Z,Q):z.toString(q,Z,Q);if(!J)return Y;return A0.isScalar(z)||Y[0]==="{"||Y[0]==="["?`${J} ${Y}`:`${J}
|
|
35
|
+
${q.indent}${Y}`}X7.createStringifyContext=$7;X7.stringify=Q7});var l2=N((G7)=>{var _0=k(),d2=u(),c2=F$(),A$=_$();function Y7({key:$,value:q},Z,Q,X){let{allNullValues:z,doc:J,indent:Y,indentStep:G,options:{commentString:U,indentSeq:H,simpleKeys:V}}=Z,B=_0.isNode($)&&$.comment||null;if(V){if(B)throw Error("With simple keys, key nodes cannot have comments");if(_0.isCollection($)||!_0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let _=!V&&(!$||B&&q==null&&!Z.inFlow||_0.isCollection($)||(_0.isScalar($)?$.type===d2.Scalar.BLOCK_FOLDED||$.type===d2.Scalar.BLOCK_LITERAL:typeof $==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!_&&(V||!z),indent:Y+G});let O=!1,K=!1,L=c2.stringify($,Z,()=>O=!0,()=>K=!0);if(!_&&!Z.inFlow&&L.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");_=!0}if(Z.inFlow){if(z||q==null){if(O&&Q)Q();return L===""?"?":_?`? ${L}`:L}}else if(z&&!V||q==null&&_){if(L=`? ${L}`,B&&!O)L+=A$.lineComment(L,Z.indent,U(B));else if(K&&X)X();return L}if(O)B=null;if(_){if(B)L+=A$.lineComment(L,Z.indent,U(B));L=`? ${L}
|
|
36
|
+
${Y}:`}else if(L=`${L}:`,B)L+=A$.lineComment(L,Z.indent,U(B));let F,A,M;if(_0.isNode(q))F=!!q.spaceBefore,A=q.commentBefore,M=q.comment;else if(F=!1,A=null,M=null,q&&typeof q==="object")q=J.createNode(q);if(Z.implicitKey=!1,!_&&!B&&_0.isScalar(q))Z.indentAtStart=L.length+1;if(K=!1,!H&&G.length>=2&&!Z.inFlow&&!_&&_0.isSeq(q)&&!q.flow&&!q.tag&&!q.anchor)Z.indent=Z.indent.substring(2);let j=!1,T=c2.stringify(q,Z,()=>j=!0,()=>K=!0),w=" ";if(B||F||A){if(w=F?`
|
|
37
|
+
`:"",A){let x=U(A);w+=`
|
|
38
|
+
${A$.indentComment(x,Z.indent)}`}if(T===""&&!Z.inFlow){if(w===`
|
|
39
|
+
`&&M)w=`
|
|
40
|
+
|
|
41
|
+
`}else w+=`
|
|
42
|
+
${Z.indent}`}else if(!_&&_0.isCollection(q)){let x=T[0],P=T.indexOf(`
|
|
43
|
+
`),y=P!==-1,I=Z.inFlow??q.flow??q.items.length===0;if(y||!I){let R=!1;if(y&&(x==="&"||x==="!")){let C=T.indexOf(" ");if(x==="&"&&C!==-1&&C<P&&T[C+1]==="!")C=T.indexOf(" ",C+1);if(C===-1||P<C)R=!0}if(!R)w=`
|
|
44
44
|
${Z.indent}`}}else if(T===""||T[0]===`
|
|
45
|
-
`)
|
|
46
|
-
${
|
|
47
|
-
`}}if(
|
|
48
|
-
`+
|
|
49
|
-
`)),
|
|
45
|
+
`)w="";if(L+=w+T,Z.inFlow){if(j&&Q)Q()}else if(M&&!j)L+=A$.lineComment(L,Z.indent,U(M));else if(K&&X)X();return L}G7.stringifyPair=Y7});var M1=N((H7)=>{var n2=v("process");function W7($,...q){if($==="debug")console.log(...q)}function V7($,q){if($==="debug"||$==="warn")if(typeof n2.emitWarning==="function")n2.emitWarning(q);else console.warn(q)}H7.debug=W7;H7.warn=V7});var Hq=N((O7)=>{var I$=k(),a2=u(),Wq="<<",Vq={identify:($)=>$===Wq||typeof $==="symbol"&&$.description===Wq,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new a2.Scalar(Symbol(Wq)),{addToJSMap:i2}),stringify:()=>Wq},_7=($,q)=>(Vq.identify(q)||I$.isScalar(q)&&(!q.type||q.type===a2.Scalar.PLAIN)&&Vq.identify(q.value))&&$?.doc.schema.tags.some((Z)=>Z.tag===Vq.tag&&Z.default);function i2($,q,Z){if(Z=$&&I$.isAlias(Z)?Z.resolve($.doc):Z,I$.isSeq(Z))for(let Q of Z.items)R1($,q,Q);else if(Array.isArray(Z))for(let Q of Z)R1($,q,Q);else R1($,q,Z)}function R1($,q,Z){let Q=$&&I$.isAlias(Z)?Z.resolve($.doc):Z;if(!I$.isMap(Q))throw Error("Merge sources must be maps or map aliases");let X=Q.toJSON(null,$,Map);for(let[z,J]of X)if(q instanceof Map){if(!q.has(z))q.set(z,J)}else if(q instanceof Set)q.add(z);else if(!Object.prototype.hasOwnProperty.call(q,z))Object.defineProperty(q,z,{value:J,writable:!0,enumerable:!0,configurable:!0});return q}O7.addMergeToJSMap=i2;O7.isMergeKey=_7;O7.merge=Vq});var w1=N((j7)=>{var I7=M1(),o2=Hq(),T7=F$(),s2=k(),j1=L0();function M7($,q,{key:Z,value:Q}){if(s2.isNode(Z)&&Z.addToJSMap)Z.addToJSMap($,q,Q);else if(o2.isMergeKey($,Z))o2.addMergeToJSMap($,q,Q);else{let X=j1.toJS(Z,"",$);if(q instanceof Map)q.set(X,j1.toJS(Q,X,$));else if(q instanceof Set)q.add(X);else{let z=R7(Z,X,$),J=j1.toJS(Q,z,$);if(z in q)Object.defineProperty(q,z,{value:J,writable:!0,enumerable:!0,configurable:!0});else q[z]=J}}return q}function R7($,q,Z){if(q===null)return"";if(typeof q!=="object")return String(q);if(s2.isNode($)&&Z?.doc){let Q=T7.createStringifyContext(Z.doc,{});Q.anchors=new Set;for(let z of Z.anchors.keys())Q.anchors.add(z.anchor);Q.inFlow=!0,Q.inStringifyKey=!0;let X=$.toString(Q);if(!Z.mapKeyWarned){let z=JSON.stringify(X);if(z.length>40)z=z.substring(0,36)+'..."';I7.warn(Z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${z}. Set mapAsMap: true to use object keys.`),Z.mapKeyWarned=!0}return X}return JSON.stringify(q)}j7.addPairToJSMap=M7});var I0=N((C7)=>{var t2=K$(),N7=l2(),D7=w1(),Bq=k();function P7($,q,Z){let Q=t2.createNode($,void 0,Z),X=t2.createNode(q,void 0,Z);return new Kq(Q,X)}class Kq{constructor($,q=null){Object.defineProperty(this,Bq.NODE_TYPE,{value:Bq.PAIR}),this.key=$,this.value=q}clone($){let{key:q,value:Z}=this;if(Bq.isNode(q))q=q.clone($);if(Bq.isNode(Z))Z=Z.clone($);return new Kq(q,Z)}toJSON($,q){let Z=q?.mapAsMap?new Map:{};return D7.addPairToJSMap(q,Z,this)}toString($,q,Z){return $?.doc?N7.stringifyPair(this,$,q,Z):JSON.stringify(this)}}C7.Pair=Kq;C7.createPair=P7});var N1=N((y7)=>{var y0=k(),r2=F$(),_q=_$();function b7($,q,Z){return(q.inFlow??$.flow?f7:x7)($,q,Z)}function x7({comment:$,items:q},Z,{blockItemPrefix:Q,flowChars:X,itemIndent:z,onChompKeep:J,onComment:Y}){let{indent:G,options:{commentString:U}}=Z,H=Object.assign({},Z,{indent:z,type:null}),V=!1,B=[];for(let O=0;O<q.length;++O){let K=q[O],L=null;if(y0.isNode(K)){if(!V&&K.spaceBefore)B.push("");if(Oq(Z,B,K.commentBefore,V),K.comment)L=K.comment}else if(y0.isPair(K)){let A=y0.isNode(K.key)?K.key:null;if(A){if(!V&&A.spaceBefore)B.push("");Oq(Z,B,A.commentBefore,V)}}V=!1;let F=r2.stringify(K,H,()=>L=null,()=>V=!0);if(L)F+=_q.lineComment(F,z,U(L));if(V&&L)V=!1;B.push(Q+F)}let _;if(B.length===0)_=X.start+X.end;else{_=B[0];for(let O=1;O<B.length;++O){let K=B[O];_+=K?`
|
|
46
|
+
${G}${K}`:`
|
|
47
|
+
`}}if($){if(_+=`
|
|
48
|
+
`+_q.indentComment(U($),G),Y)Y()}else if(V&&J)J();return _}function f7({items:$},q,{flowChars:Z,itemIndent:Q}){let{indent:X,indentStep:z,flowCollectionPadding:J,options:{commentString:Y}}=q;Q+=z;let G=Object.assign({},q,{indent:Q,inFlow:!0,type:null}),U=!1,H=0,V=[];for(let O=0;O<$.length;++O){let K=$[O],L=null;if(y0.isNode(K)){if(K.spaceBefore)V.push("");if(Oq(q,V,K.commentBefore,!1),K.comment)L=K.comment}else if(y0.isPair(K)){let A=y0.isNode(K.key)?K.key:null;if(A){if(A.spaceBefore)V.push("");if(Oq(q,V,A.commentBefore,!1),A.comment)U=!0}let M=y0.isNode(K.value)?K.value:null;if(M){if(M.comment)L=M.comment;if(M.commentBefore)U=!0}else if(K.value==null&&A?.comment)L=A.comment}if(L)U=!0;let F=r2.stringify(K,G,()=>L=null);if(U||(U=V.length>H||F.includes(`
|
|
49
|
+
`)),O<$.length-1)F+=",";else if(q.options.trailingComma){if(q.options.lineWidth>0)U||(U=V.reduce((A,M)=>A+M.length+2,2)+(F.length+2)>q.options.lineWidth);if(U)F+=","}if(L)F+=_q.lineComment(F,Q,Y(L));V.push(F),H=V.length}let{start:B,end:_}=Z;if(V.length===0)return B+_;else{if(!U){let O=V.reduce((K,L)=>K+L.length+2,2);U=q.options.lineWidth>0&&O>q.options.lineWidth}if(U){let O=B;for(let K of V)O+=K?`
|
|
50
50
|
${z}${X}${K}`:`
|
|
51
|
-
`;return`${
|
|
52
|
-
${X}${_}`}else return`${B}${J}${
|
|
53
|
-
`:" ")}return
|
|
51
|
+
`;return`${O}
|
|
52
|
+
${X}${_}`}else return`${B}${J}${V.join(" ")}${J}${_}`}}function Oq({indent:$,options:{commentString:q}},Z,Q,X){if(Q&&X)Q=Q.replace(/^\n+/,"");if(Q){let z=_q.indentComment(q(Q),$);Z.push(z.trimStart())}}y7.stringifyCollection=b7});var M0=N((m7)=>{var v7=N1(),h7=w1(),g7=Jq(),T0=k(),Lq=I0(),u7=u();function T$($,q){let Z=T0.isScalar(q)?q.value:q;for(let Q of $)if(T0.isPair(Q)){if(Q.key===q||Q.key===Z)return Q;if(T0.isScalar(Q.key)&&Q.key.value===Z)return Q}return}class e2 extends g7.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(T0.MAP,$);this.items=[]}static from($,q,Z){let{keepUndefined:Q,replacer:X}=Z,z=new this($),J=(Y,G)=>{if(typeof X==="function")G=X.call(q,Y,G);else if(Array.isArray(X)&&!X.includes(Y))return;if(G!==void 0||Q)z.items.push(Lq.createPair(Y,G,Z))};if(q instanceof Map)for(let[Y,G]of q)J(Y,G);else if(q&&typeof q==="object")for(let Y of Object.keys(q))J(Y,q[Y]);if(typeof $.sortMapEntries==="function")z.items.sort($.sortMapEntries);return z}add($,q){let Z;if(T0.isPair($))Z=$;else if(!$||typeof $!=="object"||!("key"in $))Z=new Lq.Pair($,$?.value);else Z=new Lq.Pair($.key,$.value);let Q=T$(this.items,Z.key),X=this.schema?.sortMapEntries;if(Q){if(!q)throw Error(`Key ${Z.key} already set`);if(T0.isScalar(Q.value)&&u7.isScalarValue(Z.value))Q.value.value=Z.value;else Q.value=Z.value}else if(X){let z=this.items.findIndex((J)=>X(Z,J)<0);if(z===-1)this.items.push(Z);else this.items.splice(z,0,Z)}else this.items.push(Z)}delete($){let q=T$(this.items,$);if(!q)return!1;return this.items.splice(this.items.indexOf(q),1).length>0}get($,q){let Q=T$(this.items,$)?.value;return(!q&&T0.isScalar(Q)?Q.value:Q)??void 0}has($){return!!T$(this.items,$)}set($,q){this.add(new Lq.Pair($,q),!0)}toJSON($,q,Z){let Q=Z?new Z:q?.mapAsMap?new Map:{};if(q?.onCreate)q.onCreate(Q);for(let X of this.items)h7.addPairToJSMap(q,Q,X);return Q}toString($,q,Z){if(!$)return JSON.stringify(this);for(let Q of this.items)if(!T0.isPair(Q))throw Error(`Map items must all be pairs; found ${JSON.stringify(Q)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return v7.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:Z,onComment:q})}}m7.YAMLMap=e2;m7.findPair=T$});var e0=N((n7)=>{var c7=k(),$9=M0(),l7={collection:"map",default:!0,nodeClass:$9.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,q){if(!c7.isMap($))q("Expected a mapping for this tag");return $},createNode:($,q,Z)=>$9.YAMLMap.from($,q,Z)};n7.map=l7});var R0=N((e7)=>{var i7=K$(),o7=N1(),s7=Jq(),Aq=k(),t7=u(),r7=L0();class q9 extends s7.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(Aq.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let q=Fq($);if(typeof q!=="number")return!1;return this.items.splice(q,1).length>0}get($,q){let Z=Fq($);if(typeof Z!=="number")return;let Q=this.items[Z];return!q&&Aq.isScalar(Q)?Q.value:Q}has($){let q=Fq($);return typeof q==="number"&&q<this.items.length}set($,q){let Z=Fq($);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${$}.`);let Q=this.items[Z];if(Aq.isScalar(Q)&&t7.isScalarValue(q))Q.value=q;else this.items[Z]=q}toJSON($,q){let Z=[];if(q?.onCreate)q.onCreate(Z);let Q=0;for(let X of this.items)Z.push(r7.toJS(X,String(Q++),q));return Z}toString($,q,Z){if(!$)return JSON.stringify(this);return o7.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:Z,onComment:q})}static from($,q,Z){let{replacer:Q}=Z,X=new this($);if(q&&Symbol.iterator in Object(q)){let z=0;for(let J of q){if(typeof Q==="function"){let Y=q instanceof Set?J:String(z++);J=Q.call(q,Y,J)}X.items.push(i7.createNode(J,void 0,Z))}}return X}}function Fq($){let q=Aq.isScalar($)?$.value:$;if(q&&typeof q==="string")q=Number(q);return typeof q==="number"&&Number.isInteger(q)&&q>=0?q:null}e7.YAMLSeq=q9});var $$=N((QQ)=>{var qQ=k(),Z9=R0(),ZQ={collection:"seq",default:!0,nodeClass:Z9.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,q){if(!qQ.isSeq($))q("Expected a sequence for this tag");return $},createNode:($,q,Z)=>Z9.YAMLSeq.from($,q,Z)};QQ.seq=ZQ});var M$=N((YQ)=>{var zQ=L$(),JQ={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,q,Z,Q){return q=Object.assign({actualString:!0},q),zQ.stringifyString($,q,Z,Q)}};YQ.string=JQ});var Iq=N((UQ)=>{var Q9=u(),X9={identify:($)=>$==null,createNode:()=>new Q9.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Q9.Scalar(null),stringify:({source:$},q)=>typeof $==="string"&&X9.test.test($)?$:q.options.nullStr};UQ.nullTag=X9});var D1=N((HQ)=>{var VQ=u(),z9={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new VQ.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:q},Z){if($&&z9.test.test($)){let Q=$[0]==="t"||$[0]==="T";if(q===Q)return $}return q?Z.options.trueStr:Z.options.falseStr}};HQ.boolTag=z9});var q$=N((_Q)=>{function KQ({format:$,minFractionDigits:q,tag:Z,value:Q}){if(typeof Q==="bigint")return String(Q);let X=typeof Q==="number"?Q:Number(Q);if(!isFinite(X))return isNaN(X)?".nan":X<0?"-.inf":".inf";let z=Object.is(Q,-0)?"-0":JSON.stringify(Q);if(!$&&q&&(!Z||Z==="tag:yaml.org,2002:float")&&/^\d/.test(z)){let J=z.indexOf(".");if(J<0)J=z.length,z+=".";let Y=q-(z.length-J-1);while(Y-- >0)z+="0"}return z}_Q.stringifyNumber=KQ});var C1=N((TQ)=>{var LQ=u(),P1=q$(),FQ={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:P1.stringifyNumber},AQ={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let q=Number($.value);return isFinite(q)?q.toExponential():P1.stringifyNumber($)}},IQ={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let q=new LQ.Scalar(parseFloat($)),Z=$.indexOf(".");if(Z!==-1&&$[$.length-1]==="0")q.minFractionDigits=$.length-Z-1;return q},stringify:P1.stringifyNumber};TQ.float=IQ;TQ.floatExp=AQ;TQ.floatNaN=FQ});var S1=N((PQ)=>{var J9=q$(),Tq=($)=>typeof $==="bigint"||Number.isInteger($),E1=($,q,Z,{intAsBigInt:Q})=>Q?BigInt($):parseInt($.substring(q),Z);function Y9($,q,Z){let{value:Q}=$;if(Tq(Q)&&Q>=0)return Z+Q.toString(q);return J9.stringifyNumber($)}var wQ={identify:($)=>Tq($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,q,Z)=>E1($,2,8,Z),stringify:($)=>Y9($,8,"0o")},NQ={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,q,Z)=>E1($,0,10,Z),stringify:J9.stringifyNumber},DQ={identify:($)=>Tq($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,q,Z)=>E1($,2,16,Z),stringify:($)=>Y9($,16,"0x")};PQ.int=NQ;PQ.intHex=DQ;PQ.intOct=wQ});var G9=N((hQ)=>{var bQ=e0(),xQ=Iq(),fQ=$$(),yQ=M$(),kQ=D1(),b1=C1(),x1=S1(),vQ=[bQ.map,fQ.seq,yQ.string,xQ.nullTag,kQ.boolTag,x1.intOct,x1.int,x1.intHex,b1.floatNaN,b1.floatExp,b1.float];hQ.schema=vQ});var W9=N((nQ)=>{var uQ=u(),mQ=e0(),pQ=$$();function U9($){return typeof $==="bigint"||Number.isInteger($)}var Mq=({value:$})=>JSON.stringify($),dQ=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:Mq},{identify:($)=>$==null,createNode:()=>new uQ.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Mq},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:Mq},{identify:U9,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,q,{intAsBigInt:Z})=>Z?BigInt($):parseInt($,10),stringify:({value:$})=>U9($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:Mq}],cQ={default:!0,tag:"",test:/^/,resolve($,q){return q(`Unresolved plain scalar ${JSON.stringify($)}`),$}},lQ=[mQ.map,pQ.seq].concat(dQ,cQ);nQ.schema=lQ});var y1=N((sQ)=>{var R$=v("buffer"),f1=u(),iQ=L$(),oQ={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,q){if(typeof R$.Buffer==="function")return R$.Buffer.from($,"base64");else if(typeof atob==="function"){let Z=atob($.replace(/[\n\r]/g,"")),Q=new Uint8Array(Z.length);for(let X=0;X<Z.length;++X)Q[X]=Z.charCodeAt(X);return Q}else return q("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:q,value:Z},Q,X,z){if(!Z)return"";let J=Z,Y;if(typeof R$.Buffer==="function")Y=J instanceof R$.Buffer?J.toString("base64"):R$.Buffer.from(J.buffer).toString("base64");else if(typeof btoa==="function"){let G="";for(let U=0;U<J.length;++U)G+=String.fromCharCode(J[U]);Y=btoa(G)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(q??(q=f1.Scalar.BLOCK_LITERAL),q!==f1.Scalar.QUOTE_DOUBLE){let G=Math.max(Q.options.lineWidth-Q.indent.length,Q.options.minContentWidth),U=Math.ceil(Y.length/G),H=Array(U);for(let V=0,B=0;V<U;++V,B+=G)H[V]=Y.substr(B,G);Y=H.join(q===f1.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return iQ.stringifyString({comment:$,type:q,value:Y},Q,X,z)}};sQ.binary=oQ});var jq=N((qX)=>{var Rq=k(),k1=I0(),rQ=u(),eQ=R0();function V9($,q){if(Rq.isSeq($))for(let Z=0;Z<$.items.length;++Z){let Q=$.items[Z];if(Rq.isPair(Q))continue;else if(Rq.isMap(Q)){if(Q.items.length>1)q("Each pair must have its own sequence indicator");let X=Q.items[0]||new k1.Pair(new rQ.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(`
|
|
56
|
-
`))Z.push("..."),Z.push(
|
|
55
|
+
${z.comment}`:Q.comment}Q=X}$.items[Z]=Rq.isPair(Q)?Q:new k1.Pair(Q)}else q("Expected a sequence for this tag");return $}function H9($,q,Z){let{replacer:Q}=Z,X=new eQ.YAMLSeq($);X.tag="tag:yaml.org,2002:pairs";let z=0;if(q&&Symbol.iterator in Object(q))for(let J of q){if(typeof Q==="function")J=Q.call(q,String(z++),J);let Y,G;if(Array.isArray(J))if(J.length===2)Y=J[0],G=J[1];else throw TypeError(`Expected [key, value] tuple: ${J}`);else if(J&&J instanceof Object){let U=Object.keys(J);if(U.length===1)Y=U[0],G=J[Y];else throw TypeError(`Expected tuple with one key, not ${U.length} keys`)}else Y=J;X.items.push(k1.createPair(Y,G,Z))}return X}var $X={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:V9,createNode:H9};qX.createPairs=H9;qX.pairs=$X;qX.resolvePairs=V9});var h1=N((YX)=>{var B9=k(),v1=L0(),j$=M0(),zX=R0(),K9=jq();class k0 extends zX.YAMLSeq{constructor(){super();this.add=j$.YAMLMap.prototype.add.bind(this),this.delete=j$.YAMLMap.prototype.delete.bind(this),this.get=j$.YAMLMap.prototype.get.bind(this),this.has=j$.YAMLMap.prototype.has.bind(this),this.set=j$.YAMLMap.prototype.set.bind(this),this.tag=k0.tag}toJSON($,q){if(!q)return super.toJSON($);let Z=new Map;if(q?.onCreate)q.onCreate(Z);for(let Q of this.items){let X,z;if(B9.isPair(Q))X=v1.toJS(Q.key,"",q),z=v1.toJS(Q.value,X,q);else X=v1.toJS(Q,"",q);if(Z.has(X))throw Error("Ordered maps must not include duplicate keys");Z.set(X,z)}return Z}static from($,q,Z){let Q=K9.createPairs($,q,Z),X=new this;return X.items=Q.items,X}}k0.tag="tag:yaml.org,2002:omap";var JX={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:k0,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,q){let Z=K9.resolvePairs($,q),Q=[];for(let{key:X}of Z.items)if(B9.isScalar(X))if(Q.includes(X.value))q(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new k0,Z)},createNode:($,q,Z)=>k0.from($,q,Z)};YX.YAMLOMap=k0;YX.omap=JX});var A9=N((WX)=>{var _9=u();function O9({value:$,source:q},Z){if(q&&($?L9:F9).test.test(q))return q;return $?Z.options.trueStr:Z.options.falseStr}var L9={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new _9.Scalar(!0),stringify:O9},F9={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new _9.Scalar(!1),stringify:O9};WX.falseTag=F9;WX.trueTag=L9});var I9=N((LX)=>{var BX=u(),g1=q$(),KX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:g1.stringifyNumber},_X={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let q=Number($.value);return isFinite(q)?q.toExponential():g1.stringifyNumber($)}},OX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let q=new BX.Scalar(parseFloat($.replace(/_/g,""))),Z=$.indexOf(".");if(Z!==-1){let Q=$.substring(Z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")q.minFractionDigits=Q.length}return q},stringify:g1.stringifyNumber};LX.float=OX;LX.floatExp=_X;LX.floatNaN=KX});var M9=N((wX)=>{var T9=q$(),w$=($)=>typeof $==="bigint"||Number.isInteger($);function wq($,q,Z,{intAsBigInt:Q}){let X=$[0];if(X==="-"||X==="+")q+=1;if($=$.substring(q).replace(/_/g,""),Q){switch(Z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let J=BigInt($);return X==="-"?BigInt(-1)*J:J}let z=parseInt($,Z);return X==="-"?-1*z:z}function u1($,q,Z){let{value:Q}=$;if(w$(Q)){let X=Q.toString(q);return Q<0?"-"+Z+X.substr(1):Z+X}return T9.stringifyNumber($)}var TX={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,q,Z)=>wq($,2,2,Z),stringify:($)=>u1($,2,"0b")},MX={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,q,Z)=>wq($,1,8,Z),stringify:($)=>u1($,8,"0")},RX={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,q,Z)=>wq($,0,10,Z),stringify:T9.stringifyNumber},jX={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,q,Z)=>wq($,2,16,Z),stringify:($)=>u1($,16,"0x")};wX.int=RX;wX.intBin=TX;wX.intHex=jX;wX.intOct=MX});var m1=N((SX)=>{var Pq=k(),Nq=I0(),Dq=M0();class v0 extends Dq.YAMLMap{constructor($){super($);this.tag=v0.tag}add($){let q;if(Pq.isPair($))q=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)q=new Nq.Pair($.key,null);else q=new Nq.Pair($,null);if(!Dq.findPair(this.items,q.key))this.items.push(q)}get($,q){let Z=Dq.findPair(this.items,$);return!q&&Pq.isPair(Z)?Pq.isScalar(Z.key)?Z.key.value:Z.key:Z}set($,q){if(typeof q!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof q}`);let Z=Dq.findPair(this.items,$);if(Z&&!q)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&q)this.items.push(new Nq.Pair($))}toJSON($,q){return super.toJSON($,q,Set)}toString($,q,Z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),q,Z);else throw Error("Set items must all have null values")}static from($,q,Z){let{replacer:Q}=Z,X=new this($);if(q&&Symbol.iterator in Object(q))for(let z of q){if(typeof Q==="function")z=Q.call(q,z,z);X.items.push(Nq.createPair(z,null,Z))}return X}}v0.tag="tag:yaml.org,2002:set";var EX={collection:"map",identify:($)=>$ instanceof Set,nodeClass:v0,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,q,Z)=>v0.from($,q,Z),resolve($,q){if(Pq.isMap($))if($.hasAllNullValues(!0))return Object.assign(new v0,$);else q("Set items must all have null values");else q("Expected a mapping for this tag");return $}};SX.YAMLSet=v0;SX.set=EX});var d1=N((vX)=>{var fX=q$();function p1($,q){let Z=$[0],Q=Z==="-"||Z==="+"?$.substring(1):$,X=(J)=>q?BigInt(J):Number(J),z=Q.replace(/_/g,"").split(":").reduce((J,Y)=>J*X(60)+X(Y),X(0));return Z==="-"?X(-1)*z:z}function R9($){let{value:q}=$,Z=(J)=>J;if(typeof q==="bigint")Z=(J)=>BigInt(J);else if(isNaN(q)||!isFinite(q))return fX.stringifyNumber($);let Q="";if(q<0)Q="-",q*=Z(-1);let X=Z(60),z=[q%X];if(q<60)z.unshift(0);else if(q=(q-z[0])/X,z.unshift(q%X),q>=60)q=(q-z[0])/X,z.unshift(q);return Q+z.map((J)=>String(J).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var yX={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,q,{intAsBigInt:Z})=>p1($,Z),stringify:R9},kX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>p1($,!1),stringify:R9},j9={identify:($)=>$ instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve($){let q=$.match(j9.test);if(!q)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,Q,X,z,J,Y]=q.map(Number),G=q[7]?Number((q[7]+"00").substr(1,3)):0,U=Date.UTC(Z,Q-1,X,z||0,J||0,Y||0,G),H=q[8];if(H&&H!=="Z"){let V=p1(H,!1);if(Math.abs(V)<30)V*=60;U-=60000*V}return new Date(U)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};vX.floatTime=kX;vX.intTime=yX;vX.timestamp=j9});var N9=N((tX)=>{var mX=e0(),pX=Iq(),dX=$$(),cX=M$(),lX=y1(),w9=A9(),c1=I9(),Cq=M9(),nX=Hq(),aX=h1(),iX=jq(),oX=m1(),l1=d1(),sX=[mX.map,dX.seq,cX.string,pX.nullTag,w9.trueTag,w9.falseTag,Cq.intBin,Cq.intOct,Cq.int,Cq.intHex,c1.floatNaN,c1.floatExp,c1.float,lX.binary,nX.merge,aX.omap,iX.pairs,oX.set,l1.intTime,l1.floatTime,l1.timestamp];tX.schema=sX});var k9=N((Jz)=>{var E9=e0(),eX=Iq(),S9=$$(),$z=M$(),qz=D1(),n1=C1(),a1=S1(),Zz=G9(),Qz=W9(),b9=y1(),N$=Hq(),x9=h1(),f9=jq(),D9=N9(),y9=m1(),Eq=d1(),P9=new Map([["core",Zz.schema],["failsafe",[E9.map,S9.seq,$z.string]],["json",Qz.schema],["yaml11",D9.schema],["yaml-1.1",D9.schema]]),C9={binary:b9.binary,bool:qz.boolTag,float:n1.float,floatExp:n1.floatExp,floatNaN:n1.floatNaN,floatTime:Eq.floatTime,int:a1.int,intHex:a1.intHex,intOct:a1.intOct,intTime:Eq.intTime,map:E9.map,merge:N$.merge,null:eX.nullTag,omap:x9.omap,pairs:f9.pairs,seq:S9.seq,set:y9.set,timestamp:Eq.timestamp},Xz={"tag:yaml.org,2002:binary":b9.binary,"tag:yaml.org,2002:merge":N$.merge,"tag:yaml.org,2002:omap":x9.omap,"tag:yaml.org,2002:pairs":f9.pairs,"tag:yaml.org,2002:set":y9.set,"tag:yaml.org,2002:timestamp":Eq.timestamp};function zz($,q,Z){let Q=P9.get(q);if(Q&&!$)return Z&&!Q.includes(N$.merge)?Q.concat(N$.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let z=Array.from(P9.keys()).filter((J)=>J!=="yaml11").map((J)=>JSON.stringify(J)).join(", ");throw Error(`Unknown schema "${q}"; use one of ${z} or define customTags array`)}if(Array.isArray($))for(let z of $)X=X.concat(z);else if(typeof $==="function")X=$(X.slice());if(Z)X=X.concat(N$.merge);return X.reduce((z,J)=>{let Y=typeof J==="string"?C9[J]:J;if(!Y){let G=JSON.stringify(J),U=Object.keys(C9).map((H)=>JSON.stringify(H)).join(", ");throw Error(`Unknown custom tag ${G}; use one of ${U}`)}if(!z.includes(Y))z.push(Y);return z},[])}Jz.coreKnownTags=Xz;Jz.getTags=zz});var s1=N((Bz)=>{var i1=k(),Uz=e0(),Wz=$$(),Vz=M$(),Sq=k9(),Hz=($,q)=>$.key<q.key?-1:$.key>q.key?1:0;class o1{constructor({compat:$,customTags:q,merge:Z,resolveKnownTags:Q,schema:X,sortMapEntries:z,toStringDefaults:J}){this.compat=Array.isArray($)?Sq.getTags($,"compat"):$?Sq.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?Sq.coreKnownTags:{},this.tags=Sq.getTags(q,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,i1.MAP,{value:Uz.map}),Object.defineProperty(this,i1.SCALAR,{value:Vz.string}),Object.defineProperty(this,i1.SEQ,{value:Wz.seq}),this.sortMapEntries=typeof z==="function"?z:z===!0?Hz:null}clone(){let $=Object.create(o1.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}Bz.Schema=o1});var v9=N((Lz)=>{var _z=k(),t1=F$(),D$=_$();function Oz($,q){let Z=[],Q=q.directives===!0;if(q.directives!==!1&&$.directives){let G=$.directives.toString($);if(G)Z.push(G),Q=!0;else if($.directives.docStart)Q=!0}if(Q)Z.push("---");let X=t1.createStringifyContext($,q),{commentString:z}=X.options;if($.commentBefore){if(Z.length!==1)Z.unshift("");let G=z($.commentBefore);Z.unshift(D$.indentComment(G,""))}let J=!1,Y=null;if($.contents){if(_z.isNode($.contents)){if($.contents.spaceBefore&&Q)Z.push("");if($.contents.commentBefore){let H=z($.contents.commentBefore);Z.push(D$.indentComment(H,""))}X.forceBlockIndent=!!$.comment,Y=$.contents.comment}let G=Y?void 0:()=>J=!0,U=t1.stringify($.contents,X,()=>Y=null,G);if(Y)U+=D$.lineComment(U,"",z(Y));if((U[0]==="|"||U[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${U}`;else Z.push(U)}else Z.push(t1.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let G=z($.comment);if(G.includes(`
|
|
56
|
+
`))Z.push("..."),Z.push(D$.indentComment(G,""));else Z.push(`... ${G}`)}else Z.push("...");else{let G=$.comment;if(G&&J)G=G.replace(/^\n+/,"");if(G){if((!J||Y)&&Z[Z.length-1]!=="")Z.push("");Z.push(D$.indentComment(z(G),""))}}return Z.join(`
|
|
57
57
|
`)+`
|
|
58
|
-
`}
|
|
59
|
-
`;J=
|
|
58
|
+
`}Lz.stringifyDocument=Oz});var P$=N((Nz)=>{var Az=B$(),Z$=Jq(),Z0=k(),Iz=I0(),Tz=L0(),Mz=s1(),Rz=v9(),r1=Qq(),jz=L1(),wz=K$(),e1=O1();class $4{constructor($,q,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Z0.NODE_TYPE,{value:Z0.DOC});let Q=null;if(typeof q==="function"||Array.isArray(q))Q=q;else if(Z===void 0&&q)Z=q,q=void 0;let X=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=X;let{version:z}=X;if(Z?._directives){if(this.directives=Z._directives.atDocument(),this.directives.yaml.explicit)z=this.directives.yaml.version}else this.directives=new e1.Directives({version:z});this.setSchema(z,Z),this.contents=$===void 0?null:this.createNode($,Q,Z)}clone(){let $=Object.create($4.prototype,{[Z0.NODE_TYPE]:{value:Z0.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=Z0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(Q$(this.contents))this.contents.add($)}addIn($,q){if(Q$(this.contents))this.contents.addIn($,q)}createAlias($,q){if(!$.anchor){let Z=r1.anchorNames(this);$.anchor=!q||Z.has(q)?r1.findNewAnchor(q||"a",Z):q}return new Az.Alias($.anchor)}createNode($,q,Z){let Q=void 0;if(typeof q==="function")$=q.call({"":$},"",$),Q=q;else if(Array.isArray(q)){let K=(F)=>typeof F==="number"||F instanceof String||F instanceof Number,L=q.filter(K).map(String);if(L.length>0)q=q.concat(L);Q=q}else if(Z===void 0&&q)Z=q,q=void 0;let{aliasDuplicateObjects:X,anchorPrefix:z,flow:J,keepUndefined:Y,onTagObj:G,tag:U}=Z??{},{onAnchor:H,setAnchors:V,sourceObjects:B}=r1.createNodeAnchors(this,z||"a"),_={aliasDuplicateObjects:X??!0,keepUndefined:Y??!1,onAnchor:H,onTagObj:G,replacer:Q,schema:this.schema,sourceObjects:B},O=wz.createNode($,U,_);if(J&&Z0.isCollection(O))O.flow=!0;return V(),O}createPair($,q,Z={}){let Q=this.createNode($,null,Z),X=this.createNode(q,null,Z);return new Iz.Pair(Q,X)}delete($){return Q$(this.contents)?this.contents.delete($):!1}deleteIn($){if(Z$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return Q$(this.contents)?this.contents.deleteIn($):!1}get($,q){return Z0.isCollection(this.contents)?this.contents.get($,q):void 0}getIn($,q){if(Z$.isEmptyPath($))return!q&&Z0.isScalar(this.contents)?this.contents.value:this.contents;return Z0.isCollection(this.contents)?this.contents.getIn($,q):void 0}has($){return Z0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(Z$.isEmptyPath($))return this.contents!==void 0;return Z0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,q){if(this.contents==null)this.contents=Z$.collectionFromPath(this.schema,[$],q);else if(Q$(this.contents))this.contents.set($,q)}setIn($,q){if(Z$.isEmptyPath($))this.contents=q;else if(this.contents==null)this.contents=Z$.collectionFromPath(this.schema,Array.from($),q);else if(Q$(this.contents))this.contents.setIn($,q)}setSchema($,q={}){if(typeof $==="number")$=String($);let Z;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new e1.Directives({version:"1.1"});Z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new e1.Directives({version:$});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let Q=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${Q}`)}}if(q.schema instanceof Object)this.schema=q.schema;else if(Z)this.schema=new Mz.Schema(Object.assign(Z,q));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:q,mapAsMap:Z,maxAliasCount:Q,onAnchor:X,reviver:z}={}){let J={anchors:new Map,doc:this,keep:!$,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof Q==="number"?Q:100},Y=Tz.toJS(this.contents,q??"",J);if(typeof X==="function")for(let{count:G,res:U}of J.anchors.values())X(U,G);return typeof z==="function"?jz.applyReviver(z,{"":Y},"",Y):Y}toJSON($,q){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:q})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let q=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${q}`)}return Rz.stringifyDocument(this,$)}}function Q$($){if(Z0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}Nz.Document=$4});var C$=N((Cz)=>{class bq extends Error{constructor($,q,Z,Q){super();this.name=$,this.code=Z,this.message=Q,this.pos=q}}class h9 extends bq{constructor($,q,Z){super("YAMLParseError",$,q,Z)}}class g9 extends bq{constructor($,q,Z){super("YAMLWarning",$,q,Z)}}var Pz=($,q)=>(Z)=>{if(Z.pos[0]===-1)return;Z.linePos=Z.pos.map((Y)=>q.linePos(Y));let{line:Q,col:X}=Z.linePos[0];Z.message+=` at line ${Q}, column ${X}`;let z=X-1,J=$.substring(q.lineStarts[Q-1],q.lineStarts[Q]).replace(/[\n\r]+$/,"");if(z>=60&&J.length>80){let Y=Math.min(z-39,J.length-79);J="…"+J.substring(Y),z-=Y-1}if(J.length>80)J=J.substring(0,79)+"…";if(Q>1&&/^ *$/.test(J.substring(0,z))){let Y=$.substring(q.lineStarts[Q-2],q.lineStarts[Q-1]);if(Y.length>80)Y=Y.substring(0,79)+`…
|
|
59
|
+
`;J=Y+J}if(/[^ ]/.test(J)){let Y=1,G=Z.linePos[1];if(G?.line===Q&&G.col>X)Y=Math.max(1,Math.min(G.col-X,80-z));let U=" ".repeat(z)+"^".repeat(Y);Z.message+=`:
|
|
60
60
|
|
|
61
61
|
${J}
|
|
62
|
-
${
|
|
63
|
-
`}};
|
|
64
|
-
`))return!0;if(
|
|
65
|
-
`+K.comment;else
|
|
66
|
-
`+M.comment;else A.comment=M.comment;let
|
|
67
|
-
`+
|
|
68
|
-
`+x;else
|
|
69
|
-
`+
|
|
70
|
-
`+
|
|
71
|
-
`.repeat(Math.max(1,J.length-1)):"",
|
|
72
|
-
`;for(let K=
|
|
73
|
-
`;else if(
|
|
62
|
+
${U}
|
|
63
|
+
`}};Cz.YAMLError=bq;Cz.YAMLParseError=h9;Cz.YAMLWarning=g9;Cz.prettifyError=Pz});var E$=N((yz)=>{function fz($,{flow:q,indicator:Z,next:Q,offset:X,onError:z,parentIndent:J,startOnNewline:Y}){let G=!1,U=Y,H=Y,V="",B="",_=!1,O=!1,K=null,L=null,F=null,A=null,M=null,j=null,T=null;for(let P of $){if(O){if(P.type!=="space"&&P.type!=="newline"&&P.type!=="comma")z(P.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");O=!1}if(K){if(U&&P.type!=="comment"&&P.type!=="newline")z(K,"TAB_AS_INDENT","Tabs are not allowed as indentation");K=null}switch(P.type){case"space":if(!q&&(Z!=="doc-start"||Q?.type!=="flow-collection")&&P.source.includes("\t"))K=P;H=!0;break;case"comment":{if(!H)z(P,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let y=P.source.substring(1)||" ";if(!V)V=y;else V+=B+y;B="",U=!1;break}case"newline":if(U){if(V)V+=P.source;else if(!j||Z!=="seq-item-ind")G=!0}else B+=P.source;if(U=!0,_=!0,L||F)A=P;H=!0;break;case"anchor":if(L)z(P,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(P.source.endsWith(":"))z(P.offset+P.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);L=P,T??(T=P.offset),U=!1,H=!1,O=!0;break;case"tag":{if(F)z(P,"MULTIPLE_TAGS","A node can have at most one tag");F=P,T??(T=P.offset),U=!1,H=!1,O=!0;break}case Z:if(L||F)z(P,"BAD_PROP_ORDER",`Anchors and tags must be after the ${P.source} indicator`);if(j)z(P,"UNEXPECTED_TOKEN",`Unexpected ${P.source} in ${q??"collection"}`);j=P,U=Z==="seq-item-ind"||Z==="explicit-key-ind",H=!1;break;case"comma":if(q){if(M)z(P,"UNEXPECTED_TOKEN",`Unexpected , in ${q}`);M=P,U=!1,H=!1;break}default:z(P,"UNEXPECTED_TOKEN",`Unexpected ${P.type} token`),U=!1,H=!1}}let w=$[$.length-1],x=w?w.offset+w.source.length:X;if(O&&Q&&Q.type!=="space"&&Q.type!=="newline"&&Q.type!=="comma"&&(Q.type!=="scalar"||Q.source!==""))z(Q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(K&&(U&&K.indent<=J||Q?.type==="block-map"||Q?.type==="block-seq"))z(K,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:M,found:j,spaceBefore:G,comment:V,hasNewline:_,anchor:L,tag:F,newlineAfterProp:A,end:x,start:T??x}}yz.resolveProps=fz});var xq=N((vz)=>{function q4($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
|
|
64
|
+
`))return!0;if($.end){for(let q of $.end)if(q.type==="newline")return!0}return!1;case"flow-collection":for(let q of $.items){for(let Z of q.start)if(Z.type==="newline")return!0;if(q.sep){for(let Z of q.sep)if(Z.type==="newline")return!0}if(q4(q.key)||q4(q.value))return!0}return!1;default:return!0}}vz.containsNewline=q4});var Z4=N((mz)=>{var gz=xq();function uz($,q,Z){if(q?.type==="flow-collection"){let Q=q.end[0];if(Q.indent===$&&(Q.source==="]"||Q.source==="}")&&gz.containsNewline(q))Z(Q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}mz.flowIndentCheck=uz});var Q4=N((cz)=>{var u9=k();function dz($,q,Z){let{uniqueKeys:Q}=$.options;if(Q===!1)return!1;let X=typeof Q==="function"?Q:(z,J)=>z===J||u9.isScalar(z)&&u9.isScalar(J)&&z.value===J.value;return q.some((z)=>X(z.key,Z))}cz.mapIncludes=dz});var l9=N((sz)=>{var m9=I0(),nz=M0(),p9=E$(),az=xq(),d9=Z4(),iz=Q4(),c9="All mapping items must start at the same column";function oz({composeNode:$,composeEmptyNode:q},Z,Q,X,z){let Y=new(z?.nodeClass??nz.YAMLMap)(Z.schema);if(Z.atRoot)Z.atRoot=!1;let G=Q.offset,U=null;for(let H of Q.items){let{start:V,key:B,sep:_,value:O}=H,K=p9.resolveProps(V,{indicator:"explicit-key-ind",next:B??_?.[0],offset:G,onError:X,parentIndent:Q.indent,startOnNewline:!0}),L=!K.found;if(L){if(B){if(B.type==="block-seq")X(G,"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(G,"BAD_INDENT",c9)}if(!K.anchor&&!K.tag&&!_){if(U=K.end,K.comment)if(Y.comment)Y.comment+=`
|
|
65
|
+
`+K.comment;else Y.comment=K.comment;continue}if(K.newlineAfterProp||az.containsNewline(B))X(B??V[V.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(K.found?.indent!==Q.indent)X(G,"BAD_INDENT",c9);Z.atKey=!0;let F=K.end,A=B?$(Z,B,K,X):q(Z,F,V,null,K,X);if(Z.schema.compat)d9.flowIndentCheck(Q.indent,B,X);if(Z.atKey=!1,iz.mapIncludes(Z,Y.items,A))X(F,"DUPLICATE_KEY","Map keys must be unique");let M=p9.resolveProps(_??[],{indicator:"map-value-ind",next:O,offset:A.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!B||B.type==="block-scalar"});if(G=M.end,M.found){if(L){if(O?.type==="block-map"&&!M.hasNewline)X(G,"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 j=O?$(Z,O,M,X):q(Z,G,_,null,M,X);if(Z.schema.compat)d9.flowIndentCheck(Q.indent,O,X);G=j.range[2];let T=new m9.Pair(A,j);if(Z.options.keepSourceTokens)T.srcToken=H;Y.items.push(T)}else{if(L)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 j=new m9.Pair(A);if(Z.options.keepSourceTokens)j.srcToken=H;Y.items.push(j)}}if(U&&U<G)X(U,"IMPOSSIBLE","Map comment with trailing content");return Y.range=[Q.offset,G,U??G],Y}sz.resolveBlockMap=oz});var n9=N((ZJ)=>{var rz=R0(),ez=E$(),$J=Z4();function qJ({composeNode:$,composeEmptyNode:q},Z,Q,X,z){let Y=new(z?.nodeClass??rz.YAMLSeq)(Z.schema);if(Z.atRoot)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let G=Q.offset,U=null;for(let{start:H,value:V}of Q.items){let B=ez.resolveProps(H,{indicator:"seq-item-ind",next:V,offset:G,onError:X,parentIndent:Q.indent,startOnNewline:!0});if(!B.found)if(B.anchor||B.tag||V)if(V?.type==="block-seq")X(B.end,"BAD_INDENT","All sequence items must start at the same column");else X(G,"MISSING_CHAR","Sequence item without - indicator");else{if(U=B.end,B.comment)Y.comment=B.comment;continue}let _=V?$(Z,V,B,X):q(Z,B.end,H,null,B,X);if(Z.schema.compat)$J.flowIndentCheck(Q.indent,V,X);G=_.range[2],Y.items.push(_)}return Y.range=[Q.offset,G,U??G],Y}ZJ.resolveBlockSeq=qJ});var X$=N((zJ)=>{function XJ($,q,Z,Q){let X="";if($){let z=!1,J="";for(let Y of $){let{source:G,type:U}=Y;switch(U){case"space":z=!0;break;case"comment":{if(Z&&!z)Q(Y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let H=G.substring(1)||" ";if(!X)X=H;else X+=J+H;J="";break}case"newline":if(X)J+=G;z=!0;break;default:Q(Y,"UNEXPECTED_TOKEN",`Unexpected ${U} at node end`)}q+=G.length}}return{comment:X,offset:q}}zJ.resolveEnd=XJ});var o9=N((KJ)=>{var YJ=k(),GJ=I0(),a9=M0(),UJ=R0(),WJ=X$(),i9=E$(),VJ=xq(),HJ=Q4(),X4="Block collections are not allowed within flow collections",z4=($)=>$&&($.type==="block-map"||$.type==="block-seq");function BJ({composeNode:$,composeEmptyNode:q},Z,Q,X,z){let J=Q.start.source==="{",Y=J?"flow map":"flow sequence",U=new(z?.nodeClass??(J?a9.YAMLMap:UJ.YAMLSeq))(Z.schema);U.flow=!0;let H=Z.atRoot;if(H)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let V=Q.offset+Q.start.source.length;for(let L=0;L<Q.items.length;++L){let F=Q.items[L],{start:A,key:M,sep:j,value:T}=F,w=i9.resolveProps(A,{flow:Y,indicator:"explicit-key-ind",next:M??j?.[0],offset:V,onError:X,parentIndent:Q.indent,startOnNewline:!1});if(!w.found){if(!w.anchor&&!w.tag&&!j&&!T){if(L===0&&w.comma)X(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Y}`);else if(L<Q.items.length-1)X(w.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${Y}`);if(w.comment)if(U.comment)U.comment+=`
|
|
67
|
+
`+w.comment;else U.comment=w.comment;V=w.end;continue}if(!J&&Z.options.strict&&VJ.containsNewline(M))X(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(L===0){if(w.comma)X(w.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Y}`)}else{if(!w.comma)X(w.start,"MISSING_CHAR",`Missing , between ${Y} items`);if(w.comment){let x="";$:for(let P of A)switch(P.type){case"comma":case"space":break;case"comment":x=P.source.substring(1);break $;default:break $}if(x){let P=U.items[U.items.length-1];if(YJ.isPair(P))P=P.value??P.key;if(P.comment)P.comment+=`
|
|
68
|
+
`+x;else P.comment=x;w.comment=w.comment.substring(x.length+1)}}}if(!J&&!j&&!w.found){let x=T?$(Z,T,w,X):q(Z,w.end,j,null,w,X);if(U.items.push(x),V=x.range[2],z4(T))X(x.range,"BLOCK_IN_FLOW",X4)}else{Z.atKey=!0;let x=w.end,P=M?$(Z,M,w,X):q(Z,x,A,null,w,X);if(z4(M))X(P.range,"BLOCK_IN_FLOW",X4);Z.atKey=!1;let y=i9.resolveProps(j??[],{flow:Y,indicator:"map-value-ind",next:T,offset:P.range[2],onError:X,parentIndent:Q.indent,startOnNewline:!1});if(y.found){if(!J&&!w.found&&Z.options.strict){if(j)for(let C of j){if(C===y.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(w.start<y.found.offset-1024)X(y.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(T)if("source"in T&&T.source?.[0]===":")X(T,"MISSING_CHAR",`Missing space after : in ${Y}`);else X(y.start,"MISSING_CHAR",`Missing , or : between ${Y} items`);let I=T?$(Z,T,y,X):y.found?q(Z,y.end,j,null,y,X):null;if(I){if(z4(T))X(I.range,"BLOCK_IN_FLOW",X4)}else if(y.comment)if(P.comment)P.comment+=`
|
|
69
|
+
`+y.comment;else P.comment=y.comment;let R=new GJ.Pair(P,I);if(Z.options.keepSourceTokens)R.srcToken=F;if(J){let C=U;if(HJ.mapIncludes(Z,C.items,P))X(x,"DUPLICATE_KEY","Map keys must be unique");C.items.push(R)}else{let C=new a9.YAMLMap(Z.schema);C.flow=!0,C.items.push(R);let S=(I??P).range;C.range=[P.range[0],S[1],S[2]],U.items.push(C)}V=I?I.range[2]:y.end}}let B=J?"}":"]",[_,...O]=Q.end,K=V;if(_?.source===B)K=_.offset+_.source.length;else{let L=Y[0].toUpperCase()+Y.substring(1),F=H?`${L} must end with a ${B}`:`${L} in block collection must be sufficiently indented and end with a ${B}`;if(X(V,H?"MISSING_CHAR":"BAD_INDENT",F),_&&_.source.length!==1)O.unshift(_)}if(O.length>0){let L=WJ.resolveEnd(O,K,Z.options.strict,X);if(L.comment)if(U.comment)U.comment+=`
|
|
70
|
+
`+L.comment;else U.comment=L.comment;U.range=[Q.offset,K,L.offset]}else U.range=[Q.offset,K,K];return U}KJ.resolveFlowCollection=BJ});var s9=N((jJ)=>{var OJ=k(),LJ=u(),FJ=M0(),AJ=R0(),IJ=l9(),TJ=n9(),MJ=o9();function J4($,q,Z,Q,X,z){let J=Z.type==="block-map"?IJ.resolveBlockMap($,q,Z,Q,z):Z.type==="block-seq"?TJ.resolveBlockSeq($,q,Z,Q,z):MJ.resolveFlowCollection($,q,Z,Q,z),Y=J.constructor;if(X==="!"||X===Y.tagName)return J.tag=Y.tagName,J;if(X)J.tag=X;return J}function RJ($,q,Z,Q,X){let z=Q.tag,J=!z?null:q.directives.tagName(z.source,(B)=>X(z,"TAG_RESOLVE_FAILED",B));if(Z.type==="block-seq"){let{anchor:B,newlineAfterProp:_}=Q,O=B&&z?B.offset>z.offset?B:z:B??z;if(O&&(!_||_.offset<O.offset))X(O,"MISSING_CHAR","Missing newline after block sequence props")}let Y=Z.type==="block-map"?"map":Z.type==="block-seq"?"seq":Z.start.source==="{"?"map":"seq";if(!z||!J||J==="!"||J===FJ.YAMLMap.tagName&&Y==="map"||J===AJ.YAMLSeq.tagName&&Y==="seq")return J4($,q,Z,X,J);let G=q.schema.tags.find((B)=>B.tag===J&&B.collection===Y);if(!G){let B=q.schema.knownTags[J];if(B?.collection===Y)q.schema.tags.push(Object.assign({},B,{default:!1})),G=B;else{if(B)X(z,"BAD_COLLECTION_TYPE",`${B.tag} used for ${Y} collection, but expects ${B.collection??"scalar"}`,!0);else X(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${J}`,!0);return J4($,q,Z,X,J)}}let U=J4($,q,Z,X,J,G),H=G.resolve?.(U,(B)=>X(z,"TAG_RESOLVE_FAILED",B),q.options)??U,V=OJ.isNode(H)?H:new LJ.Scalar(H);if(V.range=U.range,V.tag=J,G?.format)V.format=G.format;return V}jJ.composeCollection=RJ});var G4=N((CJ)=>{var Y4=u();function NJ($,q,Z){let Q=q.offset,X=DJ(q,$.options.strict,Z);if(!X)return{value:"",type:null,comment:"",range:[Q,Q,Q]};let z=X.mode===">"?Y4.Scalar.BLOCK_FOLDED:Y4.Scalar.BLOCK_LITERAL,J=q.source?PJ(q.source):[],Y=J.length;for(let K=J.length-1;K>=0;--K){let L=J[K][1];if(L===""||L==="\r")Y=K;else break}if(Y===0){let K=X.chomp==="+"&&J.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,J.length-1)):"",L=Q+X.length;if(q.source)L+=q.source.length;return{value:K,type:z,comment:X.comment,range:[Q,L,L]}}let G=q.indent+X.indent,U=q.offset+X.length,H=0;for(let K=0;K<Y;++K){let[L,F]=J[K];if(F===""||F==="\r"){if(X.indent===0&&L.length>G)G=L.length}else{if(L.length<G)Z(U+L.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(X.indent===0)G=L.length;if(H=K,G===0&&!$.atRoot)Z(U,"BAD_INDENT","Block scalar values in collections must be indented");break}U+=L.length+F.length+1}for(let K=J.length-1;K>=Y;--K)if(J[K][0].length>G)Y=K+1;let V="",B="",_=!1;for(let K=0;K<H;++K)V+=J[K][0].slice(G)+`
|
|
72
|
+
`;for(let K=H;K<Y;++K){let[L,F]=J[K];U+=L.length+F.length+1;let A=F[F.length-1]==="\r";if(A)F=F.slice(0,-1);if(F&&L.length<G){let j=`Block scalar lines must not be less indented than their ${X.indent?"explicit indentation indicator":"first line"}`;Z(U-F.length-(A?2:1),"BAD_INDENT",j),L=""}if(z===Y4.Scalar.BLOCK_LITERAL)V+=B+L.slice(G)+F,B=`
|
|
73
|
+
`;else if(L.length>G||F[0]==="\t"){if(B===" ")B=`
|
|
74
74
|
`;else if(!_&&B===`
|
|
75
75
|
`)B=`
|
|
76
76
|
|
|
77
|
-
`;
|
|
77
|
+
`;V+=B+L.slice(G)+F,B=`
|
|
78
78
|
`,_=!0}else if(F==="")if(B===`
|
|
79
|
-
`)
|
|
79
|
+
`)V+=`
|
|
80
80
|
`;else B=`
|
|
81
|
-
`;else
|
|
82
|
-
`+J[K][0].slice(
|
|
83
|
-
`)
|
|
84
|
-
`;break;default:
|
|
85
|
-
`}let
|
|
81
|
+
`;else V+=B+F,B=" ",_=!1}switch(X.chomp){case"-":break;case"+":for(let K=Y;K<J.length;++K)V+=`
|
|
82
|
+
`+J[K][0].slice(G);if(V[V.length-1]!==`
|
|
83
|
+
`)V+=`
|
|
84
|
+
`;break;default:V+=`
|
|
85
|
+
`}let O=Q+X.length+q.source.length;return{value:V,type:z,comment:X.comment,range:[Q,O,O]}}function DJ({offset:$,props:q},Z,Q){if(q[0].type!=="block-scalar-header")return Q(q[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:X}=q[0],z=X[0],J=0,Y="",G=-1;for(let B=1;B<X.length;++B){let _=X[B];if(!Y&&(_==="-"||_==="+"))Y=_;else{let O=Number(_);if(!J&&O)J=O;else if(G===-1)G=$+B}}if(G!==-1)Q(G,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${X}`);let U=!1,H="",V=X.length;for(let B=1;B<q.length;++B){let _=q[B];switch(_.type){case"space":U=!0;case"newline":V+=_.source.length;break;case"comment":if(Z&&!U)Q(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=_.source.length,H=_.source.substring(1);break;case"error":Q(_,"UNEXPECTED_TOKEN",_.message),V+=_.source.length;break;default:{let O=`Unexpected token in block scalar header: ${_.type}`;Q(_,"UNEXPECTED_TOKEN",O);let K=_.source;if(K&&typeof K==="string")V+=K.length}}}return{mode:z,indent:J,chomp:Y,comment:H,length:V}}function PJ($){let q=$.split(/\n( *)/),Z=q[0],Q=Z.match(/^( *)/),z=[Q?.[1]?[Q[1],Z.slice(Q[1].length)]:["",Z]];for(let J=1;J<q.length;J+=2)z.push([q[J],q[J+1]]);return z}CJ.resolveBlockScalar=NJ});var W4=N((gJ)=>{var U4=u(),SJ=X$();function bJ($,q,Z){let{offset:Q,type:X,source:z,end:J}=$,Y,G,U=(B,_,O)=>Z(Q+B,_,O);switch(X){case"scalar":Y=U4.Scalar.PLAIN,G=xJ(z,U);break;case"single-quoted-scalar":Y=U4.Scalar.QUOTE_SINGLE,G=fJ(z,U);break;case"double-quoted-scalar":Y=U4.Scalar.QUOTE_DOUBLE,G=yJ(z,U);break;default:return Z($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${X}`),{value:"",type:null,comment:"",range:[Q,Q+z.length,Q+z.length]}}let H=Q+z.length,V=SJ.resolveEnd(J,H,q,Z);return{value:G,type:Y,comment:V.comment,range:[Q,H,V.offset]}}function xJ($,q){let Z="";switch($[0]){case"\t":Z="a tab character";break;case",":Z="flow indicator character ,";break;case"%":Z="directive indicator character %";break;case"|":case">":{Z=`block scalar indicator ${$[0]}`;break}case"@":case"`":{Z=`reserved character ${$[0]}`;break}}if(Z)q(0,"BAD_SCALAR_START",`Plain value cannot start with ${Z}`);return t9($)}function fJ($,q){if($[$.length-1]!=="'"||$.length===1)q($.length,"MISSING_CHAR","Missing closing 'quote");return t9($.slice(1,-1)).replace(/''/g,"'")}function t9($){let q,Z;try{q=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
86
|
`,"sy"),Z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
|
-
`,"sy")}catch{
|
|
87
|
+
`,"sy")}catch{q=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let Q=q.exec($);if(!Q)return $;let X=Q[1],z=" ",J=q.lastIndex;Z.lastIndex=J;while(Q=Z.exec($)){if(Q[1]==="")if(z===`
|
|
88
88
|
`)X+=z;else z=`
|
|
89
|
-
`;else X+=z+Q[1],z=" ";J=Z.lastIndex}let
|
|
89
|
+
`;else X+=z+Q[1],z=" ";J=Z.lastIndex}let Y=/[ \t]*(.*)/sy;return Y.lastIndex=J,Q=Y.exec($),X+z+(Q?.[1]??"")}function yJ($,q){let Z="";for(let Q=1;Q<$.length-1;++Q){let X=$[Q];if(X==="\r"&&$[Q+1]===`
|
|
90
90
|
`)continue;if(X===`
|
|
91
|
-
`){let{fold:z,offset:J}=
|
|
92
|
-
`){z
|
|
93
|
-
`){z
|
|
94
|
-
`&&!(J==="\r"
|
|
95
|
-
`))Z+=Q>z
|
|
96
|
-
`||Q==="\r"){if(Q==="\r"
|
|
91
|
+
`){let{fold:z,offset:J}=kJ($,Q);Z+=z,Q=J}else if(X==="\\"){let z=$[++Q],J=vJ[z];if(J)Z+=J;else if(z===`
|
|
92
|
+
`){z=$[Q+1];while(z===" "||z==="\t")z=$[++Q+1]}else if(z==="\r"&&$[Q+1]===`
|
|
93
|
+
`){z=$[++Q+1];while(z===" "||z==="\t")z=$[++Q+1]}else if(z==="x"||z==="u"||z==="U"){let Y={x:2,u:4,U:8}[z];Z+=hJ($,Q+1,Y,q),Q+=Y}else{let Y=$.substr(Q-1,2);q(Q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Y}`),Z+=Y}}else if(X===" "||X==="\t"){let z=Q,J=$[Q+1];while(J===" "||J==="\t")J=$[++Q+1];if(J!==`
|
|
94
|
+
`&&!(J==="\r"&&$[Q+2]===`
|
|
95
|
+
`))Z+=Q>z?$.slice(z,Q+1):X}else Z+=X}if($[$.length-1]!=='"'||$.length===1)q($.length,"MISSING_CHAR",'Missing closing "quote');return Z}function kJ($,q){let Z="",Q=$[q+1];while(Q===" "||Q==="\t"||Q===`
|
|
96
|
+
`||Q==="\r"){if(Q==="\r"&&$[q+2]!==`
|
|
97
97
|
`)break;if(Q===`
|
|
98
98
|
`)Z+=`
|
|
99
|
-
|
|
100
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
99
|
+
`;q+=1,Q=$[q+1]}if(!Z)Z=" ";return{fold:Z,offset:q}}var vJ={"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 hJ($,q,Z,Q){let X=$.substr(q,Z),J=X.length===Z&&/^[0-9a-fA-F]+$/.test(X)?parseInt(X,16):NaN;if(isNaN(J)){let Y=$.substr(q-2,Z+2);return Q(q-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Y}`),Y}return String.fromCodePoint(J)}gJ.resolveFlowScalar=bJ});var e9=N((nJ)=>{var h0=k(),r9=u(),mJ=G4(),pJ=W4();function dJ($,q,Z,Q){let{value:X,type:z,comment:J,range:Y}=q.type==="block-scalar"?mJ.resolveBlockScalar($,q,Q):pJ.resolveFlowScalar(q,$.options.strict,Q),G=Z?$.directives.tagName(Z.source,(V)=>Q(Z,"TAG_RESOLVE_FAILED",V)):null,U;if($.options.stringKeys&&$.atKey)U=$.schema[h0.SCALAR];else if(G)U=cJ($.schema,X,G,Z,Q);else if(q.type==="scalar")U=lJ($,X,q,Q);else U=$.schema[h0.SCALAR];let H;try{let V=U.resolve(X,(B)=>Q(Z??q,"TAG_RESOLVE_FAILED",B),$.options);H=h0.isScalar(V)?V:new r9.Scalar(V)}catch(V){let B=V instanceof Error?V.message:String(V);Q(Z??q,"TAG_RESOLVE_FAILED",B),H=new r9.Scalar(X)}if(H.range=Y,H.source=X,z)H.type=z;if(G)H.tag=G;if(U.format)H.format=U.format;if(J)H.comment=J;return H}function cJ($,q,Z,Q,X){if(Z==="!")return $[h0.SCALAR];let z=[];for(let Y of $.tags)if(!Y.collection&&Y.tag===Z)if(Y.default&&Y.test)z.push(Y);else return Y;for(let Y of z)if(Y.test?.test(q))return Y;let J=$.knownTags[Z];if(J&&!J.collection)return $.tags.push(Object.assign({},J,{default:!1,test:void 0})),J;return X(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Z}`,Z!=="tag:yaml.org,2002:str"),$[h0.SCALAR]}function lJ({atKey:$,directives:q,schema:Z},Q,X,z){let J=Z.tags.find((Y)=>(Y.default===!0||$&&Y.default==="key")&&Y.test?.test(Q))||Z[h0.SCALAR];if(Z.compat){let Y=Z.compat.find((G)=>G.default&&G.test?.test(Q))??Z[h0.SCALAR];if(J.tag!==Y.tag){let G=q.tagString(J.tag),U=q.tagString(Y.tag),H=`Value may be parsed as either ${G} or ${U}`;z(X,"TAG_RESOLVE_FAILED",H,!0)}}return J}nJ.composeScalar=dJ});var $5=N((oJ)=>{function iJ($,q,Z){if(q){Z??(Z=q.length);for(let Q=Z-1;Q>=0;--Q){let X=q[Q];switch(X.type){case"space":case"comment":case"newline":$-=X.source.length;continue}X=q[++Q];while(X?.type==="space")$+=X.source.length,X=q[++Q];break}}return $}oJ.emptyScalarPosition=iJ});var Q5=N((XY)=>{var tJ=B$(),rJ=k(),eJ=s9(),q5=e9(),$Y=X$(),qY=$5(),ZY={composeNode:Z5,composeEmptyNode:V4};function Z5($,q,Z,Q){let X=$.atKey,{spaceBefore:z,comment:J,anchor:Y,tag:G}=Z,U,H=!0;switch(q.type){case"alias":if(U=QY($,q,Q),Y||G)Q(q,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(U=q5.composeScalar($,q,G,Q),Y)U.anchor=Y.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(U=eJ.composeCollection(ZY,$,q,Z,Q),Y)U.anchor=Y.source.substring(1)}catch(V){let B=V instanceof Error?V.message:String(V);Q(q,"RESOURCE_EXHAUSTION",B)}break;default:{let V=q.type==="error"?q.message:`Unsupported token (type: ${q.type})`;Q(q,"UNEXPECTED_TOKEN",V),H=!1}}if(U??(U=V4($,q.offset,void 0,null,Z,Q)),Y&&U.anchor==="")Q(Y,"BAD_ALIAS","Anchor cannot be an empty string");if(X&&$.options.stringKeys&&(!rJ.isScalar(U)||typeof U.value!=="string"||U.tag&&U.tag!=="tag:yaml.org,2002:str"))Q(G??q,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(z)U.spaceBefore=!0;if(J)if(q.type==="scalar"&&q.source==="")U.comment=J;else U.commentBefore=J;if($.options.keepSourceTokens&&H)U.srcToken=q;return U}function V4($,q,Z,Q,{spaceBefore:X,comment:z,anchor:J,tag:Y,end:G},U){let H={type:"scalar",offset:qY.emptyScalarPosition(q,Z,Q),indent:-1,source:""},V=q5.composeScalar($,H,Y,U);if(J){if(V.anchor=J.source.substring(1),V.anchor==="")U(J,"BAD_ALIAS","Anchor cannot be an empty string")}if(X)V.spaceBefore=!0;if(z)V.comment=z,V.range[2]=G;return V}function QY({options:$},{offset:q,source:Z,end:Q},X){let z=new tJ.Alias(Z.substring(1));if(z.source==="")X(q,"BAD_ALIAS","Alias cannot be an empty string");if(z.source.endsWith(":"))X(q+Z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let J=q+Z.length,Y=$Y.resolveEnd(Q,J,$.strict,X);if(z.range=[q,J,Y.offset],Y.comment)z.comment=Y.comment;return z}XY.composeEmptyNode=V4;XY.composeNode=Z5});var z5=N((VY)=>{var YY=P$(),X5=Q5(),GY=X$(),UY=E$();function WY($,q,{offset:Z,start:Q,value:X,end:z},J){let Y=Object.assign({_directives:q},$),G=new YY.Document(void 0,Y),U={atKey:!1,atRoot:!0,directives:G.directives,options:G.options,schema:G.schema},H=UY.resolveProps(Q,{indicator:"doc-start",next:X??z?.[0],offset:Z,onError:J,parentIndent:0,startOnNewline:!0});if(H.found){if(G.directives.docStart=!0,X&&(X.type==="block-map"||X.type==="block-seq")&&!H.hasNewline)J(H.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}G.contents=X?X5.composeNode(U,X,H,J):X5.composeEmptyNode(U,H.end,Q,null,H,J);let V=G.contents.range[2],B=GY.resolveEnd(z,V,!1,J);if(B.comment)G.comment=B.comment;return G.range=[Z,V,B.offset],G}VY.composeDoc=WY});var H4=N((FY)=>{var BY=v("process"),KY=O1(),_Y=P$(),S$=C$(),J5=k(),OY=z5(),LY=X$();function b$($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:q,source:Z}=$;return[q,q+(typeof Z==="string"?Z.length:1)]}function Y5($){let q="",Z=!1,Q=!1;for(let X=0;X<$.length;++X){let z=$[X];switch(z[0]){case"#":q+=(q===""?"":Q?`
|
|
101
101
|
|
|
102
102
|
`:`
|
|
103
|
-
`)+(z.substring(1)||" "),Z=!0,Q=!1;break;case"%":if(
|
|
104
|
-
${Z}`:Z;else if(Q
|
|
103
|
+
`)+(z.substring(1)||" "),Z=!0,Q=!1;break;case"%":if($[X+1]?.[0]!=="#")X+=1;Z=!1;break;default:if(!Z)Q=!0;Z=!1}}return{comment:q,afterEmptyLine:Q}}class G5{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(q,Z,Q,X)=>{let z=b$(q);if(X)this.warnings.push(new S$.YAMLWarning(z,Z,Q));else this.errors.push(new S$.YAMLParseError(z,Z,Q))},this.directives=new KY.Directives({version:$.version||"1.2"}),this.options=$}decorate($,q){let{comment:Z,afterEmptyLine:Q}=Y5(this.prelude);if(Z){let X=$.contents;if(q)$.comment=$.comment?`${$.comment}
|
|
104
|
+
${Z}`:Z;else if(Q||$.directives.docStart||!X)$.commentBefore=Z;else if(J5.isCollection(X)&&!X.flow&&X.items.length>0){let z=X.items[0];if(J5.isPair(z))z=z.key;let J=z.commentBefore;z.commentBefore=J?`${Z}
|
|
105
105
|
${J}`:Z}else{let z=X.commentBefore;X.commentBefore=z?`${Z}
|
|
106
|
-
${z}`:Z}}if(
|
|
107
|
-
${
|
|
108
|
-
`}];switch(
|
|
109
|
-
`),
|
|
110
|
-
`,B=[{type:"block-scalar-header",offset:z,indent:Q,source:
|
|
111
|
-
`});return{type:"block-scalar",offset:z,indent:Q,props:B,source:
|
|
112
|
-
`),Q
|
|
113
|
-
`;if(
|
|
114
|
-
`});for(let
|
|
115
|
-
`};delete
|
|
106
|
+
${z}`:Z}}if(q)Array.prototype.push.apply($.errors,this.errors),Array.prototype.push.apply($.warnings,this.warnings);else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Y5(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,q=!1,Z=-1){for(let Q of $)yield*this.next(Q);yield*this.end(q,Z)}*next($){if(BY.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(q,Z,Q)=>{let X=b$($);X[0]+=q,this.onError(X,"BAD_DIRECTIVE",Z,Q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let q=OY.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!q.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(q,!1),this.doc)yield this.doc;this.doc=q,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let q=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,Z=new S$.YAMLParseError(b$($),"UNEXPECTED_TOKEN",q);if(this.atDirectives||!this.doc)this.errors.push(Z);else this.doc.errors.push(Z);break}case"doc-end":{if(!this.doc){this.errors.push(new S$.YAMLParseError(b$($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let q=LY.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),q.comment){let Z=this.doc.comment;this.doc.comment=Z?`${Z}
|
|
107
|
+
${q.comment}`:q.comment}this.doc.range[2]=q.offset;break}default:this.errors.push(new S$.YAMLParseError(b$($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,q=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let Z=Object.assign({_directives:this.directives},this.options),Q=new _Y.Document(void 0,Z);if(this.atDirectives)this.onError(q,"MISSING_CHAR","Missing directives-end indicator line");Q.range=[0,q,q],this.decorate(Q,!1),yield Q}}}FY.Composer=G5});var V5=N((DY)=>{var IY=G4(),TY=W4(),MY=C$(),U5=L$();function RY($,q=!0,Z){if($){let Q=(X,z,J)=>{let Y=typeof X==="number"?X:Array.isArray(X)?X[0]:X.offset;if(Z)Z(Y,z,J);else throw new MY.YAMLParseError([Y,Y+1],z,J)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return TY.resolveFlowScalar($,q,Q);case"block-scalar":return IY.resolveBlockScalar({options:{strict:q}},$,Q)}}return null}function jY($,q){let{implicitKey:Z=!1,indent:Q,inFlow:X=!1,offset:z=-1,type:J="PLAIN"}=q,Y=U5.stringifyString({type:J,value:$},{implicitKey:Z,indent:Q>0?" ".repeat(Q):"",inFlow:X,options:{blockQuote:!0,lineWidth:-1}}),G=q.end??[{type:"newline",offset:-1,indent:Q,source:`
|
|
108
|
+
`}];switch(Y[0]){case"|":case">":{let U=Y.indexOf(`
|
|
109
|
+
`),H=Y.substring(0,U),V=Y.substring(U+1)+`
|
|
110
|
+
`,B=[{type:"block-scalar-header",offset:z,indent:Q,source:H}];if(!W5(B,G))B.push({type:"newline",offset:-1,indent:Q,source:`
|
|
111
|
+
`});return{type:"block-scalar",offset:z,indent:Q,props:B,source:V}}case'"':return{type:"double-quoted-scalar",offset:z,indent:Q,source:Y,end:G};case"'":return{type:"single-quoted-scalar",offset:z,indent:Q,source:Y,end:G};default:return{type:"scalar",offset:z,indent:Q,source:Y,end:G}}}function wY($,q,Z={}){let{afterKey:Q=!1,implicitKey:X=!1,inFlow:z=!1,type:J}=Z,Y="indent"in $?$.indent:null;if(Q&&typeof Y==="number")Y+=2;if(!J)switch($.type){case"single-quoted-scalar":J="QUOTE_SINGLE";break;case"double-quoted-scalar":J="QUOTE_DOUBLE";break;case"block-scalar":{let U=$.props[0];if(U.type!=="block-scalar-header")throw Error("Invalid block scalar header");J=U.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:J="PLAIN"}let G=U5.stringifyString({type:J,value:q},{implicitKey:X||Y===null,indent:Y!==null&&Y>0?" ".repeat(Y):"",inFlow:z,options:{blockQuote:!0,lineWidth:-1}});switch(G[0]){case"|":case">":NY($,G);break;case'"':B4($,G,"double-quoted-scalar");break;case"'":B4($,G,"single-quoted-scalar");break;default:B4($,G,"scalar")}}function NY($,q){let Z=q.indexOf(`
|
|
112
|
+
`),Q=q.substring(0,Z),X=q.substring(Z+1)+`
|
|
113
|
+
`;if($.type==="block-scalar"){let z=$.props[0];if(z.type!=="block-scalar-header")throw Error("Invalid block scalar header");z.source=Q,$.source=X}else{let{offset:z}=$,J="indent"in $?$.indent:-1,Y=[{type:"block-scalar-header",offset:z,indent:J,source:Q}];if(!W5(Y,"end"in $?$.end:void 0))Y.push({type:"newline",offset:-1,indent:J,source:`
|
|
114
|
+
`});for(let G of Object.keys($))if(G!=="type"&&G!=="offset")delete $[G];Object.assign($,{type:"block-scalar",indent:J,props:Y,source:X})}}function W5($,q){if(q)for(let Z of q)switch(Z.type){case"space":case"comment":$.push(Z);break;case"newline":return $.push(Z),!0}return!1}function B4($,q,Z){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=Z,$.source=q;break;case"block-scalar":{let Q=$.props.slice(1),X=q.length;if($.props[0].type==="block-scalar-header")X-=$.props[0].source.length;for(let z of Q)z.offset+=X;delete $.props,Object.assign($,{type:Z,source:q,end:Q});break}case"block-map":case"block-seq":{let X={type:"newline",offset:$.offset+q.length,indent:$.indent,source:`
|
|
115
|
+
`};delete $.items,Object.assign($,{type:Z,source:q,end:[X]});break}default:{let Q="indent"in $?$.indent:-1,X="end"in $&&Array.isArray($.end)?$.end.filter((z)=>z.type==="space"||z.type==="comment"||z.type==="newline"):[];for(let z of Object.keys($))if(z!=="type"&&z!=="offset")delete $[z];Object.assign($,{type:Z,indent:Q,source:q,end:X})}}}DY.createScalarToken=jY;DY.resolveAsScalar=RY;DY.setScalarValue=wY});var H5=N((bY)=>{var SY=($)=>("type"in $)?yq($):fq($);function yq($){switch($.type){case"block-scalar":{let q="";for(let Z of $.props)q+=yq(Z);return q+$.source}case"block-map":case"block-seq":{let q="";for(let Z of $.items)q+=fq(Z);return q}case"flow-collection":{let q=$.start.source;for(let Z of $.items)q+=fq(Z);for(let Z of $.end)q+=Z.source;return q}case"document":{let q=fq($);if($.end)for(let Z of $.end)q+=Z.source;return q}default:{let q=$.source;if("end"in $&&$.end)for(let Z of $.end)q+=Z.source;return q}}}function fq({start:$,key:q,sep:Z,value:Q}){let X="";for(let z of $)X+=z.source;if(q)X+=yq(q);if(Z)for(let z of Z)X+=z.source;if(Q)X+=yq(Q);return X}bY.stringify=SY});var _5=N((yY)=>{var K4=Symbol("break visit"),fY=Symbol("skip children"),B5=Symbol("remove item");function g0($,q){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};K5(Object.freeze([]),$,q)}g0.BREAK=K4;g0.SKIP=fY;g0.REMOVE=B5;g0.itemAtPath=($,q)=>{let Z=$;for(let[Q,X]of q){let z=Z?.[Q];if(z&&"items"in z)Z=z.items[X];else return}return Z};g0.parentCollection=($,q)=>{let Z=g0.itemAtPath($,q.slice(0,-1)),Q=q[q.length-1][0],X=Z?.[Q];if(X&&"items"in X)return X;throw Error("Parent collection not found")};function K5($,q,Z){let Q=Z(q,$);if(typeof Q==="symbol")return Q;for(let X of["key","value"]){let z=q[X];if(z&&"items"in z){for(let J=0;J<z.items.length;++J){let Y=K5(Object.freeze($.concat([[X,J]])),z.items[J],Z);if(typeof Y==="number")J=Y-1;else if(Y===K4)return K4;else if(Y===B5)z.items.splice(J,1),J-=1}if(typeof Q==="function"&&X==="key")Q=Q(q,$)}}return typeof Q==="function"?Q(q,$):Q}yY.visit=g0});var kq=N((dY)=>{var _4=V5(),vY=H5(),hY=_5(),O4="\uFEFF",L4="\x02",F4="\x18",A4="\x1F",gY=($)=>!!$&&("items"in $),uY=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function mY($){switch($){case O4:return"<BOM>";case L4:return"<DOC>";case F4:return"<FLOW_END>";case A4:return"<SCALAR>";default:return JSON.stringify($)}}function pY($){switch($){case O4:return"byte-order-mark";case L4:return"doc-mode";case F4:return"flow-error-end";case A4:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
116
116
|
`:case`\r
|
|
117
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(
|
|
118
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
119
|
-
\r `),
|
|
120
|
-
`)return!0;if(
|
|
121
|
-
`;return!1}charAt(
|
|
122
|
-
`||!Q&&!this.atEnd)return
|
|
123
|
-
`||Z>=this.indentNext
|
|
124
|
-
`,this.pos),this.lineEndPos
|
|
117
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch($[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}dY.createScalarToken=_4.createScalarToken;dY.resolveAsScalar=_4.resolveAsScalar;dY.setScalarValue=_4.setScalarValue;dY.stringify=vY.stringify;dY.visit=hY.visit;dY.BOM=O4;dY.DOCUMENT=L4;dY.FLOW_END=F4;dY.SCALAR=A4;dY.isCollection=gY;dY.isScalar=uY;dY.prettyToken=mY;dY.tokenType=pY});var T4=N((zG)=>{var x$=kq();function G0($){switch($){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case"\t":return!0;default:return!1}}var O5=new Set("0123456789ABCDEFabcdef"),QG=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),vq=new Set(",[]{}"),XG=new Set(` ,[]{}
|
|
119
|
+
\r `),I4=($)=>!$||XG.has($);class L5{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex($,q=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!q;let Z=this.next??"stream";while(Z&&(q||this.hasChars(1)))Z=yield*this.parseNext(Z)}atLineEnd(){let $=this.pos,q=this.buffer[$];while(q===" "||q==="\t")q=this.buffer[++$];if(!q||q==="#"||q===`
|
|
120
|
+
`)return!0;if(q==="\r")return this.buffer[$+1]===`
|
|
121
|
+
`;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let q=this.buffer[$];if(this.indentNext>0){let Z=0;while(q===" ")q=this.buffer[++Z+$];if(q==="\r"){let Q=this.buffer[Z+$+1];if(Q===`
|
|
122
|
+
`||!Q&&!this.atEnd)return $+Z+1}return q===`
|
|
123
|
+
`||Z>=this.indentNext||!q&&!this.atEnd?$+Z:-1}if(q==="-"||q==="."){let Z=this.buffer.substr($,3);if((Z==="---"||Z==="...")&&G0(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
|
|
124
|
+
`,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let $=this.getLine();if($===null)return this.setNext("stream");if($[0]===x$.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let q=$.length,Z=$.indexOf("#");while(Z!==-1){let X=$[Z-1];if(X===" "||X==="\t"){q=Z-1;break}else Z=$.indexOf("#",Z+1)}while(!0){let X=$[q-1];if(X===" "||X==="\t")q-=1;else break}let Q=(yield*this.pushCount(q))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-Q),this.pushNewline(),"stream"}if(this.atLineEnd()){let q=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-q),yield*this.pushNewline(),"stream"}return yield x$.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let q=this.peek(3);if((q==="---"||q==="...")&&G0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,q==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,q]=this.peek(2);if(!q&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&G0(q)){let Z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=Z,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let q=yield*this.pushIndicators();switch($[q]){case"#":yield*this.pushCount($.length-q);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(I4),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return q+=yield*this.parseBlockScalarHeader(),q+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-q),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,q,Z=-1;do{if($=yield*this.pushNewline(),$>0)q=yield*this.pushSpaces(!1),this.indentValue=Z=q;else q=0;q+=yield*this.pushSpaces(!0)}while($+q>0);let Q=this.getLine();if(Q===null)return this.setNext("flow");if(Z!==-1&&Z<this.indentNext&&Q[0]!=="#"||Z===0&&(Q.startsWith("---")||Q.startsWith("..."))&&G0(Q[3])){if(!(Z===this.indentNext-1&&this.flowLevel===1&&(Q[0]==="]"||Q[0]==="}")))return this.flowLevel=0,yield x$.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(I4),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let z=this.charAt(1);if(this.flowKey||G0(z)||z===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),q=this.buffer.indexOf($,this.pos+1);if($==="'")while(q!==-1&&this.buffer[q+1]==="'")q=this.buffer.indexOf("'",q+2);else while(q!==-1){let X=0;while(this.buffer[q-1-X]==="\\")X+=1;if(X%2===0)break;q=this.buffer.indexOf('"',q+1)}let Z=this.buffer.substring(0,q),Q=Z.indexOf(`
|
|
125
125
|
`,this.pos);if(Q!==-1){while(Q!==-1){let X=this.continueScalar(Q+1);if(X===-1)break;Q=Z.indexOf(`
|
|
126
|
-
`,X)}if(Q!==-1)
|
|
127
|
-
|
|
128
|
-
`)break}default:break
|
|
129
|
-
`,X)}while(
|
|
130
|
-
`)Z=this.buffer[++Q]
|
|
131
|
-
`&&X>=this.pos&&X+1
|
|
126
|
+
`,X)}if(Q!==-1)q=Q-(Z[Q-1]==="\r"?2:1)}if(q===-1){if(!this.atEnd)return this.setNext("quoted-scalar");q=this.buffer.length}return yield*this.pushToIndex(q+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let q=this.buffer[++$];if(q==="+")this.blockScalarKeep=!0;else if(q>"0"&&q<="9")this.blockScalarIndent=Number(q)-1;else if(q!=="-")break}return yield*this.pushUntil((q)=>G0(q)||q==="#")}*parseBlockScalar(){let $=this.pos-1,q=0,Z;$:for(let X=this.pos;Z=this.buffer[X];++X)switch(Z){case" ":q+=1;break;case`
|
|
127
|
+
`:$=X,q=0;break;case"\r":{let z=this.buffer[X+1];if(!z&&!this.atEnd)return this.setNext("block-scalar");if(z===`
|
|
128
|
+
`)break}default:break $}if(!Z&&!this.atEnd)return this.setNext("block-scalar");if(q>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=q;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let X=this.continueScalar($+1);if(X===-1)break;$=this.buffer.indexOf(`
|
|
129
|
+
`,X)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let Q=$+1;Z=this.buffer[Q];while(Z===" ")Z=this.buffer[++Q];if(Z==="\t"){while(Z==="\t"||Z===" "||Z==="\r"||Z===`
|
|
130
|
+
`)Z=this.buffer[++Q];$=Q-1}else if(!this.blockScalarKeep)do{let X=$-1,z=this.buffer[X];if(z==="\r")z=this.buffer[--X];let J=X;while(z===" ")z=this.buffer[--X];if(z===`
|
|
131
|
+
`&&X>=this.pos&&X+1+q>J)$=X;else break}while(!0);return yield x$.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,q=this.pos-1,Z=this.pos-1,Q;while(Q=this.buffer[++Z])if(Q===":"){let X=this.buffer[Z+1];if(G0(X)||$&&vq.has(X))break;q=Z}else if(G0(Q)){let X=this.buffer[Z+1];if(Q==="\r")if(X===`
|
|
132
132
|
`)Z+=1,Q=`
|
|
133
|
-
`,X=this.buffer[Z+1];else
|
|
134
|
-
`){let z=this.continueScalar(Z+1);if(z===-1)break;Z=Math.max(Z,z-2)}}else{if(
|
|
135
|
-
`)return yield*this.pushCount(1);else if(
|
|
136
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces(
|
|
137
|
-
`)+1;while(
|
|
138
|
-
|
|
139
|
-
`)+1;while(
|
|
140
|
-
|
|
141
|
-
`).length})}catch{}}}catch{continue}}}return await Z(
|
|
142
|
-
`;X.write(
|
|
143
|
-
`){Q.searchActive=!1,
|
|
144
|
-
`:_(Q.getSelectedIndices());break;case"\x1B":if(Q.filter!=="")Q.filter="",Q.applyFilter(
|
|
133
|
+
`,X=this.buffer[Z+1];else q=Z;if(X==="#"||$&&vq.has(X))break;if(Q===`
|
|
134
|
+
`){let z=this.continueScalar(Z+1);if(z===-1)break;Z=Math.max(Z,z-2)}}else{if($&&vq.has(Q))break;q=Z}if(!Q&&!this.atEnd)return this.setNext("plain-scalar");return yield x$.SCALAR,yield*this.pushToIndex(q+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,q){let Z=this.buffer.slice(this.pos,$);if(Z)return yield Z,this.pos+=Z.length,Z.length;else if(q)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(I4))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,q=this.charAt(1);if(G0(q)||$&&vq.has(q)){if(!$)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let $=this.pos+2,q=this.buffer[$];while(!G0(q)&&q!==">")q=this.buffer[++$];return yield*this.pushToIndex(q===">"?$+1:$,!1)}else{let $=this.pos+1,q=this.buffer[$];while(q)if(QG.has(q))q=this.buffer[++$];else if(q==="%"&&O5.has(this.buffer[$+1])&&O5.has(this.buffer[$+2]))q=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
|
|
135
|
+
`)return yield*this.pushCount(1);else if($==="\r"&&this.charAt(1)===`
|
|
136
|
+
`)return yield*this.pushCount(2);else return 0}*pushSpaces($){let q=this.pos-1,Z;do Z=this.buffer[++q];while(Z===" "||$&&Z==="\t");let Q=q-this.pos;if(Q>0)yield this.buffer.substr(this.pos,Q),this.pos=q;return Q}*pushUntil($){let q=this.pos,Z=this.buffer[q];while(!$(Z))Z=this.buffer[++q];return yield*this.pushToIndex(q,!1)}}zG.Lexer=L5});var M4=N((YG)=>{class F5{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let q=0,Z=this.lineStarts.length;while(q<Z){let X=q+Z>>1;if(this.lineStarts[X]<$)q=X+1;else Z=X}if(this.lineStarts[q]===$)return{line:q+1,col:1};if(q===0)return{line:0,col:$};let Q=this.lineStarts[q-1];return{line:q,col:$-Q+1}}}}YG.LineCounter=F5});var R4=N((VG)=>{var UG=v("process"),A5=kq(),WG=T4();function j0($,q){for(let Z=0;Z<$.length;++Z)if($[Z].type===q)return!0;return!1}function I5($){for(let q=0;q<$.length;++q)switch($[q].type){case"space":case"comment":case"newline":break;default:return q}return-1}function M5($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function hq($){switch($.type){case"document":return $.start;case"block-map":{let q=$.items[$.items.length-1];return q.sep??q.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function z$($){if($.length===0)return[];let q=$.length;$:while(--q>=0)switch($[q].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++q]?.type==="space");return $.splice(q,$.length)}function T5($){if($.start.type==="flow-seq-start"){for(let q of $.items)if(q.sep&&!q.value&&!j0(q.start,"explicit-key-ind")&&!j0(q.sep,"map-value-ind")){if(q.key)q.value=q.key;if(delete q.key,M5(q.value))if(q.value.end)Array.prototype.push.apply(q.value.end,q.sep);else q.value.end=q.sep;else Array.prototype.push.apply(q.start,q.sep);delete q.sep}}}class R5{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new WG.Lexer,this.onNewLine=$}*parse($,q=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let Z of this.lexer.lex($,q))yield*this.next(Z);if(!q)yield*this.end()}*next($){if(this.source=$,UG.env.LOG_TOKENS)console.log("|",A5.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let q=A5.tokenType($);if(!q){let Z=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:Z,source:$}),this.offset+=$.length}else if(q==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=q,yield*this.step(),q){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let $=this.peek(1);if(this.type==="doc-end"&&$?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let q=$??this.stack.pop();if(!q)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield q;else{let Z=this.peek(1);if(q.type==="block-scalar")q.indent="indent"in Z?Z.indent:0;else if(q.type==="flow-collection"&&Z.type==="document")q.indent=0;if(q.type==="flow-collection")T5(q);switch(Z.type){case"document":Z.value=q;break;case"block-scalar":Z.props.push(q);break;case"block-map":{let Q=Z.items[Z.items.length-1];if(Q.value){Z.items.push({start:[],key:q,sep:[]}),this.onKeyLine=!0;return}else if(Q.sep)Q.value=q;else{Object.assign(Q,{key:q,sep:[]}),this.onKeyLine=!Q.explicitKey;return}break}case"block-seq":{let Q=Z.items[Z.items.length-1];if(Q.value)Z.items.push({start:[],value:q});else Q.value=q;break}case"flow-collection":{let Q=Z.items[Z.items.length-1];if(!Q||Q.value)Z.items.push({start:[],key:q,sep:[]});else if(Q.sep)Q.value=q;else Object.assign(Q,{key:q,sep:[]});return}default:yield*this.pop(),yield*this.pop(q)}if((Z.type==="document"||Z.type==="block-map"||Z.type==="block-seq")&&(q.type==="block-map"||q.type==="block-seq")){let Q=q.items[q.items.length-1];if(Q&&!Q.sep&&!Q.value&&Q.start.length>0&&I5(Q.start)===-1&&(q.indent===0||Q.start.every((X)=>X.type!=="comment"||X.indent<q.indent))){if(Z.type==="document")Z.end=Q.start;else Z.items.push({start:Q.start});q.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(I5($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let q=this.startBlockValue($);if(q)this.stack.push(q);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let q=hq(this.peek(2)),Z=z$(q),Q;if($.end)Q=$.end,Q.push(this.sourceToken),delete $.end;else Q=[this.sourceToken];let X={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:Z,key:$,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=X}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let q=this.source.indexOf(`
|
|
137
|
+
`)+1;while(q!==0)this.onNewLine(this.offset+q),q=this.source.indexOf(`
|
|
138
|
+
`,q)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let q=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,q.value){let Z="end"in q.value?q.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(q.sep)q.sep.push(this.sourceToken);else q.start.push(this.sourceToken);return;case"space":case"comment":if(q.value)$.items.push({start:[this.sourceToken]});else if(q.sep)q.sep.push(this.sourceToken);else{if(this.atIndentedComment(q.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,q.start),Q.push(this.sourceToken),$.items.pop();return}}q.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let Z=!this.onKeyLine&&this.indent===$.indent,Q=Z&&(q.sep||q.explicitKey)&&this.type!=="seq-item-ind",X=[];if(Q&&q.sep&&!q.value){let z=[];for(let J=0;J<q.sep.length;++J){let Y=q.sep[J];switch(Y.type){case"newline":z.push(J);break;case"space":break;case"comment":if(Y.indent>$.indent)z.length=0;break;default:z.length=0}}if(z.length>=2)X=q.sep.splice(z[1])}switch(this.type){case"anchor":case"tag":if(Q||q.value)X.push(this.sourceToken),$.items.push({start:X}),this.onKeyLine=!0;else if(q.sep)q.sep.push(this.sourceToken);else q.start.push(this.sourceToken);return;case"explicit-key-ind":if(!q.sep&&!q.explicitKey)q.start.push(this.sourceToken),q.explicitKey=!0;else if(Q||q.value)X.push(this.sourceToken),$.items.push({start:X,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(q.explicitKey)if(!q.sep)if(j0(q.start,"newline"))Object.assign(q,{key:null,sep:[this.sourceToken]});else{let z=z$(q.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]})}else if(q.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(j0(q.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]});else if(M5(q.key)&&!j0(q.sep,"newline")){let z=z$(q.start),J=q.key,Y=q.sep;Y.push(this.sourceToken),delete q.key,delete q.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:J,sep:Y}]})}else if(X.length>0)q.sep=q.sep.concat(X,this.sourceToken);else q.sep.push(this.sourceToken);else if(!q.sep)Object.assign(q,{key:null,sep:[this.sourceToken]});else if(q.value||Q)$.items.push({start:X,key:null,sep:[this.sourceToken]});else if(j0(q.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else q.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(Q||q.value)$.items.push({start:X,key:z,sep:[]}),this.onKeyLine=!0;else if(q.sep)this.stack.push(z);else Object.assign(q,{key:z,sep:[]}),this.onKeyLine=!0;return}default:{let z=this.startBlockValue($);if(z){if(z.type==="block-seq"){if(!q.explicitKey&&q.sep&&!j0(q.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else if(Z)$.items.push({start:X});this.stack.push(z);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let q=$.items[$.items.length-1];switch(this.type){case"newline":if(q.value){let Z="end"in q.value?q.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else q.start.push(this.sourceToken);return;case"space":case"comment":if(q.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(q.start,$.indent)){let Q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(Q)){Array.prototype.push.apply(Q,q.start),Q.push(this.sourceToken),$.items.pop();return}}q.start.push(this.sourceToken)}return;case"anchor":case"tag":if(q.value||this.indent<=$.indent)break;q.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(q.value||j0(q.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else q.start.push(this.sourceToken);return}if(this.indent>$.indent){let Z=this.startBlockValue($);if(Z){this.stack.push(Z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let q=$.items[$.items.length-1];if(this.type==="flow-error-end"){let Z;do yield*this.pop(),Z=this.peek(1);while(Z?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!q||q.sep)$.items.push({start:[this.sourceToken]});else q.start.push(this.sourceToken);return;case"map-value-ind":if(!q||q.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(q.sep)q.sep.push(this.sourceToken);else Object.assign(q,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!q||q.value)$.items.push({start:[this.sourceToken]});else if(q.sep)q.sep.push(this.sourceToken);else q.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(!q||q.value)$.items.push({start:[],key:Q,sep:[]});else if(q.sep)this.stack.push(Q);else Object.assign(q,{key:Q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let Z=this.startBlockValue($);if(Z)this.stack.push(Z);else yield*this.pop(),yield*this.step()}else{let Z=this.peek(2);if(Z.type==="block-map"&&(this.type==="map-value-ind"&&Z.indent===$.indent||this.type==="newline"&&!Z.items[Z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&Z.type!=="flow-collection"){let Q=hq(Z),X=z$(Q);T5($);let z=$.end.splice(1,$.end.length);z.push(this.sourceToken);let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let q=this.source.indexOf(`
|
|
139
|
+
`)+1;while(q!==0)this.onNewLine(this.offset+q),q=this.source.indexOf(`
|
|
140
|
+
`,q)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let q=hq($),Z=z$(q);return Z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let q=hq($),Z=z$(q);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,q){if(this.type!=="comment")return!1;if(this.indent<=q)return!1;return $.every((Z)=>Z.type==="newline"||Z.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}VG.Parser=R5});var P5=N((IG)=>{var j5=H4(),BG=P$(),f$=C$(),KG=M1(),_G=k(),OG=M4(),w5=R4();function N5($){let q=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||q&&new OG.LineCounter||null,prettyErrors:q}}function LG($,q={}){let{lineCounter:Z,prettyErrors:Q}=N5(q),X=new w5.Parser(Z?.addNewLine),z=new j5.Composer(q),J=Array.from(z.compose(X.parse($)));if(Q&&Z)for(let Y of J)Y.errors.forEach(f$.prettifyError($,Z)),Y.warnings.forEach(f$.prettifyError($,Z));if(J.length>0)return J;return Object.assign([],{empty:!0},z.streamInfo())}function D5($,q={}){let{lineCounter:Z,prettyErrors:Q}=N5(q),X=new w5.Parser(Z?.addNewLine),z=new j5.Composer(q),J=null;for(let Y of z.compose(X.parse($),!0,$.length))if(!J)J=Y;else if(J.options.logLevel!=="silent"){J.errors.push(new f$.YAMLParseError(Y.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(Q&&Z)J.errors.forEach(f$.prettifyError($,Z)),J.warnings.forEach(f$.prettifyError($,Z));return J}function FG($,q,Z){let Q=void 0;if(typeof q==="function")Q=q;else if(Z===void 0&&q&&typeof q==="object")Z=q;let X=D5($,Z);if(!X)return null;if(X.warnings.forEach((z)=>KG.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 AG($,q,Z){let Q=null;if(typeof q==="function"||Array.isArray(q))Q=q;else if(Z===void 0&&q)Z=q;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let X=Math.round(Z);Z=X<1?void 0:X>8?{indent:8}:{indent:X}}if($===void 0){let{keepUndefined:X}=Z??q??{};if(!X)return}if(_G.isDocument($)&&!Q)return $.toString(Z);return new BG.Document($,Q,Z).toString(Z)}IG.parse=FG;IG.parseAllDocuments=LG;IG.parseDocument=D5;IG.stringify=AG});import{execFile as o6}from"child_process";import{promisify as s6}from"util";import{mkdtemp as U2,readdir as t6,readFile as H1,rm as i$,cp as r6,access as V1,stat as e6,lstat as $Z,symlink as qZ,mkdir as ZZ}from"fs/promises";import{join as B0,resolve as W2,relative as QZ,basename as XZ}from"path";import{homedir as V2}from"os";import{tmpdir as H2}from"os";import{readdir as p6,readFile as d6,stat as c6}from"fs/promises";import{join as l6}from"path";var n6=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"]),a6=524288;async function n$($){let q=[];async function Z(Q,X){let z;try{z=await p6(Q)}catch{return}for(let J of z){if(J===".git"||J==="node_modules")continue;let Y=l6(Q,J),G=X?`${X}/${J}`:J;try{let U=await c6(Y);if(U.isDirectory())await Z(Y,G);else if(U.isFile()){let H=J.includes(".")?`.${J.split(".").pop().toLowerCase()}`:"";if(n6.has(H))continue;if(U.size>a6)continue;try{let V=await d6(Y,"utf-8");q.push({relPath:G,content:V,lineCount:V.split(`
|
|
141
|
+
`).length})}catch{}}}catch{continue}}}return await Z($,""),q}class G2{selected;cursor;scrollOffset;pageSize;itemCount;filter;searchActive;filteredMap;constructor($,q){this.selected=$.map((Z)=>Z.checked),this.cursor=1,this.scrollOffset=0,this.pageSize=q,this.itemCount=$.length,this.filter="",this.searchActive=!1,this.filteredMap=$.map((Z,Q)=>Q)}get totalRows(){return this.filteredMap.length+1}applyFilter($){if(this.filter==="")this.filteredMap=$.map((q,Z)=>Z);else{let q=this.filter.toLowerCase();this.filteredMap=[];for(let Z=0;Z<$.length;Z++)if(($[Z].label.toLowerCase()+" "+($[Z].hint?.toLowerCase()??"")).includes(q))this.filteredMap.push(Z)}if(this.cursor>=this.totalRows)this.cursor=Math.max(0,this.totalRows-1);if(this.scrollOffset>0&&this.scrollOffset>=this.totalRows)this.scrollOffset=Math.max(0,this.totalRows-this.pageSize)}cursorToOriginalIndex(){if(this.cursor===0)return-1;return this.filteredMap[this.cursor-1]??-1}toggleCurrent(){if(this.cursor===0)this.toggleAll();else{let $=this.cursorToOriginalIndex();if($>=0)this.selected[$]=!this.selected[$]}}toggleAll(){let $=this.filteredMap,Z=!$.every((Q)=>this.selected[Q]);for(let Q of $)this.selected[Q]=Z}moveUp(){if(this.cursor>0)this.cursor--;else this.cursor=this.totalRows-1;this.adjustScroll()}moveDown(){if(this.cursor<this.totalRows-1)this.cursor++;else this.cursor=0;this.adjustScroll()}getSelectedIndices(){let $=[];for(let q=0;q<this.selected.length;q++)if(this.selected[q])$.push(q);return $}getVisibleRange(){let $=this.scrollOffset,q=Math.min(this.scrollOffset+this.pageSize,this.totalRows);return{start:$,end:q}}adjustScroll(){if(this.cursor<this.scrollOffset)this.scrollOffset=this.cursor;else if(this.cursor>=this.scrollOffset+this.pageSize)this.scrollOffset=this.cursor-this.pageSize+1}}function i6($,q,Z){let Q=[];if($.searchActive||$.filter!==""){let U=W.cyan("/"),H=$.filter,V=$.searchActive?W.cyan("█"):"";if(Q.push(` ${U}${H}${V}`),$.filteredMap.length===0)Q.push(W.dim(" No matches found"));Q.push("")}let{start:X,end:z}=$.getVisibleRange();if(X>0)Q.push(W.dim(` ... ${X} more above`));for(let U=X;U<z;U++){let V=U===$.cursor?W.cyan(">"):" ";if(U===0){let B=$.filteredMap,O=B.length>0&&B.every((L)=>$.selected[L])?W.green("[*]"):"[ ]",K=$.filter!==""?`Select All Matching (${$.filteredMap.length})`:"Select All / Deselect All";Q.push(`${V} ${O} ${W.bold(K)}`)}else{let B=$.filteredMap[U-1],_=q[B],K=$.selected[B]?W.green("[*]"):"[ ]",L=`${V} ${K} `,F=7,A=W.bold(_.label),M=_.label.length;if(_.hint){let j=Z-7-M-2;if(j>10){let T=U1(_.hint,j);Q.push(`${L}${A} ${W.dim(T)}`)}else{let T=U1(_.label,Z-7);Q.push(`${L}${W.bold(T)}`)}}else{let j=U1(_.label,Z-7);Q.push(`${L}${W.bold(j)}`)}}}let J=$.totalRows-z;if(J>0)Q.push(W.dim(` ... ${J} more below`));let Y=$.getSelectedIndices().length,G=$.filter!==""?` matching: ${$.filteredMap.length}/${$.itemCount}`:"";if(Q.push(""),$.searchActive)Q.push(W.dim(` ${Y} of ${$.itemCount} selected${G} | Type to filter Esc Clear Enter Done searching`));else Q.push(W.dim(` ${Y} of ${$.itemCount} selected${G} | `+"↑/↓ Navigate Space Toggle a All / Search Enter Confirm Esc Cancel"));return Q}function U1($,q){if(q<=0)return"";if($.length<=q)return $;if(q<=3)return $.slice(0,q);return $.slice(0,q-3)+"..."}async function a0($){let{items:q}=$,Z=$.pageSize??Math.min(q.length+1,15),Q=new G2(q,Z),X=process.stderr,z=process.stdin,J=X.columns||80;if(typeof z.setRawMode==="function")z.setRawMode(!0);z.resume(),z.setEncoding("utf-8"),X.write("\x1B[?25l");let Y=0;function G(){let U=i6(Q,q,J);if(Y>0)X.write(`\x1B[${Y}F`);let H=Math.max(U.length,Y),V="";for(let B=0;B<H;B++)V+=`\x1B[2K${B<U.length?U[B]:""}
|
|
142
|
+
`;X.write(V),Y=H}return G(),new Promise((U)=>{let H="",V=null;function B(){if(z.removeListener("data",K),typeof z.setRawMode==="function")z.setRawMode(!1);if(z.pause(),X.write("\x1B[?25h"),V)clearTimeout(V)}function _(L){B(),U(L)}function O(L){if(Q.searchActive){if(L==="\x1B"){Q.searchActive=!1,Q.filter="",Q.applyFilter(q),G();return}if(L==="\r"||L===`
|
|
143
|
+
`){Q.searchActive=!1,G();return}if(L===""||L==="\b"){if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter(q);else Q.searchActive=!1;G();return}if(L==="\x03"){B(),process.kill(process.pid,"SIGINT");return}if(L==="\x1B[A"){Q.moveUp(),G();return}if(L==="\x1B[B"){Q.moveDown(),G();return}if(L===" "){Q.toggleCurrent(),G();return}if(L.length===1&&L>=" "&&L<="~"){Q.filter+=L,Q.applyFilter(q),G();return}return}switch(L){case"\x1B[A":case"k":Q.moveUp(),G();break;case"\x1B[B":case"j":Q.moveDown(),G();break;case" ":Q.toggleCurrent(),G();break;case"a":Q.toggleAll(),G();break;case"/":Q.searchActive=!0,G();break;case"\r":case`
|
|
144
|
+
`:_(Q.getSelectedIndices());break;case"\x1B":if(Q.filter!=="")Q.filter="",Q.applyFilter(q),G();else _([]);break;case"":case"\b":if(Q.filter.length>0)Q.filter=Q.filter.slice(0,-1),Q.applyFilter(q),G();break;case"\x03":B(),process.kill(process.pid,"SIGINT");break}}function K(L){if(H.length>0){if(H+=L,V)clearTimeout(V);if(H.length>=3&&H[1]==="["){let A=H.slice(0,3),M=H.slice(3);if(H="",O(A),M)K(M);return}let F=H;H="",O("\x1B");for(let A=1;A<F.length;A++)O(F[A]);return}for(let F=0;F<L.length;F++){let A=L[F];if(A==="\x1B"){let M=L.slice(F);if(M.length>=3&&M[1]==="[")O(M.slice(0,3)),F+=2;else if(M.length>=2){H=M,V=setTimeout(()=>{let j=H;H="",O("\x1B");for(let T=1;T<j.length;T++)O(j[T])},50);return}else{H="\x1B",V=setTimeout(()=>{H="",O("\x1B")},50);return}}else O(A)}}z.on("data",K)})}var D0=s6(o6),zZ=/^[a-zA-Z0-9_-]+$/,JZ=/^[a-zA-Z0-9._-]+$/,YZ=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,B2=128,GZ=/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\/tree\/(.+))?\/?$/;function UZ($){return $.startsWith("/")||$.startsWith("./")||$.startsWith(".\\")||$.startsWith("../")||$.startsWith("..\\")||$.startsWith("~/")||$.startsWith("~\\")||$==="~"||$==="."||$===".."||/^[a-zA-Z]:[/\\]/.test($)}function WZ($){let q;if($==="~")q=V2();else if($.startsWith("~/")||$.startsWith("~\\"))q=W2(V2(),$.slice(2));else q=W2($);let Z=XZ(q);return E(`install: parsed local source -> path=${q}`),{owner:"local",repo:Z,ref:null,subpath:null,cloneUrl:"",sshCloneUrl:"",isLocal:!0,localPath:q}}function P0($){if(UZ($))return WZ($);let q=GZ.exec($);if(q){let[,V,B,_]=q,O=B.endsWith(".git")?B.slice(0,-4):B;$=`github:${V}/${O}${_?`#${_}`:""}`}if(!$.startsWith("github:"))throw Error(`Invalid source format. Got: "${$}"
|
|
145
145
|
Supported formats:
|
|
146
146
|
github:owner/repo[#ref]
|
|
147
147
|
github:owner/repo#ref:path
|
|
148
148
|
https://github.com/owner/repo
|
|
149
149
|
https://github.com/owner/repo/tree/branch/path/to/skill
|
|
150
150
|
/path/to/local/skill
|
|
151
|
-
./relative/path/to/skill`);let Z
|
|
152
|
-
`)){let z=X.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(z)Z.add(z[1])}let Q
|
|
153
|
-
HTTPS: ${
|
|
154
|
-
SSH: ${
|
|
155
|
-
`);for(let J=0;J<z.length;J++)for(let{category:
|
|
156
|
-
Use --force to overwrite.`)}catch(Z){if(Z.message?.includes("--force"))throw Z;E(`install: target ${
|
|
157
|
-
`),Z=!1,Q=!1;for(let X of
|
|
158
|
-
`),Z=-1;for(let Q=0;Q
|
|
159
|
-
`);return null}function
|
|
151
|
+
./relative/path/to/skill`);let Z=$.slice(7),Q=Z.indexOf("#"),X,z=null,J=null;if(Q!==-1){X=Z.slice(0,Q);let V=Z.slice(Q+1);if(!V)throw Error("Invalid source: ref cannot be empty after #");let B=V.indexOf(":");if(B!==-1){if(z=V.slice(0,B),!z)throw Error("Invalid source: ref cannot be empty before :");J=V.slice(B+1)||null}else z=V}else{let V=Z.indexOf(":");if(V!==-1)X=Z.slice(0,V),J=Z.slice(V+1)||null;else X=Z}let Y=X.indexOf("/");if(Y===-1)throw Error(`Invalid source: format must be github:owner/repo. Got: "${$}"`);let G=X.slice(0,Y),U=X.slice(Y+1);if(!G)throw Error("Invalid source: owner cannot be empty");if(!U)throw Error("Invalid source: repo cannot be empty");if(!zZ.test(G))throw Error(`Invalid source: owner contains invalid characters: "${G}". Allowed: [a-zA-Z0-9_-]`);if(!JZ.test(U))throw Error(`Invalid source: repo contains invalid characters: "${U}". Allowed: [a-zA-Z0-9._-]`);let H={owner:G,repo:U,ref:z,subpath:J,cloneUrl:`https://github.com/${G}/${U}.git`,sshCloneUrl:`git@github.com:${G}/${U}.git`};return E(`install: parsed source -> owner=${G} repo=${U} ref=${z} subpath=${J}`),H}async function s$($){if($.subpath!==null||!$.ref||!$.ref.includes("/"))return $;try{let{stdout:q}=await D0("git",["ls-remote","--heads","--tags",$.cloneUrl],{timeout:15000}),Z=new Set;for(let X of q.split(`
|
|
152
|
+
`)){let z=X.match(/\trefs\/(?:heads|tags)\/(.+)$/);if(z)Z.add(z[1])}let Q=$.ref.split("/");for(let X=1;X<Q.length;X++){let z=Q.slice(0,X).join("/");if(Z.has(z)){let J=Q.slice(X).join("/");return E(`install: resolved ref="${z}" subpath="${J}"`),{...$,ref:z,subpath:J||null}}}}catch(q){E(`install: ls-remote failed, treating entire ref as branch: ${q}`)}return $}function C0($){if(!$)throw Error("Invalid skill name: name cannot be empty");if($.includes("\x00"))throw Error("Invalid skill name: contains unsafe characters (null byte)");if($.includes(".."))throw Error("Invalid skill name: contains unsafe characters (..)");if($.includes("/")||$.includes("\\"))throw Error("Invalid skill name: contains unsafe characters (path separator)");if($.startsWith("."))throw Error("Invalid skill name: must not start with a dot");if($.length>B2)throw Error(`Invalid skill name: exceeds maximum length of ${B2} characters`);if(!YZ.test($))throw Error(`Invalid skill name: "${$}" does not match allowed pattern [a-zA-Z0-9][a-zA-Z0-9._-]*`);return $}function VZ($){let q=$.split(/[/\\]/).filter(Boolean),Z=q.length>0?q[q.length-1]:$;return C0(Z)}function _2($){let q=new Map;for(let Z of $){let Q=VZ(Z),X=q.get(Q);if(X)X.push(Z);else q.set(Q,[Z])}return[...q.entries()].filter(([,Z])=>Z.length>1).map(([Z,Q])=>({name:Z,paths:Q}))}async function E0(){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 HZ($){if($.killed)return!1;let q=($.stderr||$.message||"").toLowerCase();return q.includes("authentication failed")||q.includes("could not read username")||q.includes("repository not found")||q.includes("returned error: 403")||q.includes("returned error: 401")||q.includes("terminal prompts disabled")||q.includes("permission denied")}function a$($){return $.killed?"Clone timed out after 60 seconds":`Clone failed: ${$.stderr||$.message}`}async function W1($,q,Z){if(q!==null&&/^[0-9a-f]{40}$/i.test(q))return await D0("git",["clone","--no-checkout",$,Z],{timeout:60000}),await D0("git",["checkout",q],{cwd:Z,timeout:30000}),Z;let X=["clone","--depth","1"];if(q)X.push("--branch",q);return X.push($,Z),await D0("git",X,{timeout:60000}),Z}async function S0($,q="auto"){E(`install: cloning ${$.owner}/${$.repo}${$.ref?` (ref: ${$.ref})`:""} (transport: ${q})`);let Z=await U2(B0(H2(),"asm-install-"));if(q==="ssh"||q==="https"){let Q=q==="ssh"?$.sshCloneUrl:$.cloneUrl;try{return await W1(Q,$.ref,Z)}catch(X){throw await e(Z),Error(a$(X))}}try{return await W1($.cloneUrl,$.ref,Z)}catch(Q){if(!HZ(Q))throw await e(Z),Error(a$(Q));E("install: HTTPS clone failed with auth error, retrying with SSH..."),await e(Z);let X=await U2(B0(H2(),"asm-install-"));try{return await W1($.sshCloneUrl,$.ref,X)}catch(z){throw await e(X),Error(`Clone failed with both transports:
|
|
153
|
+
HTTPS: ${a$(Q)}
|
|
154
|
+
SSH: ${a$(z)}`)}}}async function b0($){let q=B0($,"SKILL.md"),Z;try{Z=await H1(q,"utf-8")}catch{throw Error("Not a valid skill: SKILL.md not found in repository root")}let Q=$0(Z),X=$.split(/[/\\]/).pop()||"unknown",z=Q.name||X,J=J0(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 t$($,q=5){let Z=[];async function Q(X,z,J){let Y;try{Y=await t6(X)}catch{return}for(let G of Y){if(G===".git"||G==="node_modules")continue;let U=B0(X,G);try{if(!(await e6(U)).isDirectory())continue}catch{continue}let H=z?`${z}/${G}`:G,V=J+1,B=B0(U,"SKILL.md");try{let _=await H1(B,"utf-8"),O=$0(_);Z.push({relPath:H,name:O.name||G,version:J0(O),description:(O.description||"").replace(/\s*\n\s*/g," ").trim(),effort:O.effort||O["metadata.effort"]||void 0,license:(O.license||"").trim(),creator:(O["metadata.creator"]||"").trim(),compatibility:(O.compatibility||"").trim(),allowedTools:K2(O),tokenCount:o$(_)})}catch{if(V<q)await Q(U,H,V)}}}return await Q($,"",0),Z.sort((X,z)=>X.name.localeCompare(z.name)),Z}var BZ=[{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 O2($){let q=[],Z=await n$($);for(let{relPath:Q,content:X}of Z){let z=X.split(`
|
|
155
|
+
`);for(let J=0;J<z.length;J++)for(let{category:Y,pattern:G}of BZ)if(G.test(z[J])){let U=z[J].trim();q.push({category:Y,file:Q,line:J+1,match:U.length>100?U.slice(0,100)+"…":U})}}return q}async function r$($){let q=$.source.isLocal?`local:${$.source.localPath}`:`github:${$.source.owner}/${$.source.repo}${$.source.ref?`#${$.source.ref}`:""}${$.source.subpath?`:${$.source.subpath}`:""}`;if($.force)try{await V1($.targetDir),await i$($.targetDir,{recursive:!0,force:!0})}catch{}let Z=$.sourceDir;try{await r6(Z,$.targetDir,{recursive:!0})}catch(Y){throw Error(`Failed to install: ${Y.message}`)}let Q=B0($.targetDir,".git");try{await i$(Q,{recursive:!0,force:!0})}catch{}E(`install: copied files to ${$.targetDir}`);let X=B0($.targetDir,"SKILL.md");try{await V1(X)}catch{throw Error("Installation verification failed: SKILL.md not found at target")}let z=await H1(X,"utf-8"),J=$0(z);return{success:!0,path:$.targetDir,name:J.name||$.skillName,version:J0(J),provider:$.providerLabel,source:q}}async function L2($,q){let Z=await r$($);for(let Q of q){if(Q.name===$.providerName)continue;let X=$.scope==="project"?Q.project:Q.global,z=z0(X),J=B0(z,$.skillName);await ZZ(z,{recursive:!0});try{if((await $Z(J)).isSymbolicLink())await i$(J);else{E(`install: skipping ${J} — existing non-symlink directory`);continue}}catch{}let Y=QZ(z,$.targetDir);await qZ(Y,J,"dir"),E(`install: symlinked ${J} -> ${Y}`)}return Z.provider=`All (${q.map((Q)=>Q.label).join(", ")})`,Z}async function e($){try{await i$($,{recursive:!0,force:!0})}catch{}}async function F2(){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 A2($,q){let Z=["--yes","skills","add",$];if(q)Z.push("--skill",q);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 I2($){if($.isLocal)return $.localPath;let q=`https://github.com/${$.owner}/${$.repo}`;if($.ref)return`${q}/tree/${$.ref}${$.subpath?`/${$.subpath}`:""}`;return q}async function i0($,q,Z){let Q=$.providers.filter((_)=>_.enabled);if(q==="all"){if(Q.length===0)throw Error("No providers are enabled. Enable a provider in your config.");return{provider:Q.find((O)=>O.name==="agents")||Q[0],allProviders:Q}}if(q){let _=$.providers.find((O)=>O.name===q);if(!_){let O=$.providers.map((K)=>K.name).join(", ");throw Error(`Unknown provider: "${q}". Valid providers: ${O}, all`)}if(!_.enabled)throw Error(`Provider "${q}" is disabled. Enable it in your config or choose another provider.`);return{provider:_,allProviders:null}}if(Q.length===1)return{provider:Q[0],allProviders:null};if(!Z){if(Q.length===0)throw Error("No providers are enabled. Enable a provider in your config.");let _=Q.map((O)=>O.name).join(", ");throw Error(`--tool (or --provider) is required in non-interactive mode. Available: ${_}, all`)}let X=$.preferences.selectedTools,J=X&&X.length>0?new Set(X):null,Y=$.providers.map((_)=>({label:`${_.label} (${_.name})`,hint:_.global,checked:J?J.has(_.name):_.name==="agents"})),G=await a0({items:Y});if(G.length===0)throw Error("No tools selected. Aborting.");let U=G.map((_)=>$.providers[_]),H=U.map((_)=>_.name),{saveSelectedTools:V}=await import("./chunk-chw0sgjp.js");if(await V(H),U.length===1)return{provider:U[0],allProviders:null};return{provider:U.find((_)=>_.name==="agents")||U[0],allProviders:U}}function B1($,q,Z,Q,X,z,J="global"){let Y=J==="project"?X.project:X.global,G=z0(Y),U=B0(G,Q);return{source:$,tempDir:q,sourceDir:Z,targetDir:U,skillName:Q,force:z,providerName:X.name,providerLabel:X.label,scope:J}}async function T2($,q){try{if(await V1($),E(`install: target ${$} — conflict (exists)${q?", force overwrite":""}`),!q)throw Error(`Skill already exists at: ${$}
|
|
156
|
+
Use --force to overwrite.`)}catch(Z){if(Z.message?.includes("--force"))throw Z;E(`install: target ${$} — no conflict`)}}import{readFile as UU}from"fs/promises";import{join as WU}from"path";var wG=H4(),NG=P$(),DG=s1(),j4=C$(),PG=B$(),w0=k(),CG=I0(),EG=u(),SG=M0(),bG=R0(),J_=kq(),xG=T4(),fG=M4(),yG=R4(),gq=P5(),C5=V$();var kG=wG.Composer,vG=NG.Document,hG=DG.Schema,gG=j4.YAMLError,uG=j4.YAMLParseError,mG=j4.YAMLWarning,pG=PG.Alias,dG=w0.isAlias,cG=w0.isCollection,lG=w0.isDocument,nG=w0.isMap,aG=w0.isNode,iG=w0.isPair,oG=w0.isScalar,sG=w0.isSeq,tG=CG.Pair,rG=EG.Scalar,eG=SG.YAMLMap,$U=bG.YAMLSeq;var qU=xG.Lexer,ZU=fG.LineCounter,QU=yG.Parser,y$=gq.parse,XU=gq.parseAllDocuments,zU=gq.parseDocument,JU=gq.stringify,YU=C5.visit,GU=C5.visitAsync;var E5=500;function VU($){let q=$.split(`
|
|
157
|
+
`),Z=!1,Q=!1;for(let X of q){if(X.trim()==="---")if(!Z){Z=!0;continue}else{Q=!0;continue}if(Q&&X.trim().length>0)return!0}return!1}function HU($){let q=$.split(`
|
|
158
|
+
`),Z=-1;for(let Q=0;Q<q.length;Q++)if(q[Q].trim()==="---")if(Z===-1)Z=Q+1;else return q.slice(Z,Q).join(`
|
|
159
|
+
`);return null}function BU($){let q=HU($);if(q===null)return null;try{return y$(q),null}catch(Z){return Z.message||"invalid YAML"}}async function S5($){let q=[];if(!$.description||$.description.trim()==="")q.push({category:"missing-description",message:"Skill has no description in SKILL.md frontmatter"});if(!$.version||$.version==="0.0.0")q.push({category:"missing-version",message:"Skill has no version (or default 0.0.0) in SKILL.md frontmatter"});try{let Q=WU($.path,"SKILL.md"),X=await UU(Q,"utf-8");if(!VU(X))q.push({category:"empty-body",message:"SKILL.md contains only frontmatter with no body content"});let z=BU(X);if(z)q.push({category:"invalid-yaml",message:`SKILL.md has invalid YAML frontmatter: ${z}`})}catch{}let Z=$.fileCount;if(Z!==void 0&&Z>E5)q.push({category:"high-file-count",message:`Skill has ${Z} files (threshold: ${E5})`});return q}import{join as TU}from"path";import{homedir as MU}from"os";import{readFile as KU,writeFile as _U,mkdir as OU}from"fs/promises";import{dirname as LU}from"path";async function FU($){try{let q=await KU($,"utf-8"),Z=JSON.parse(q);if(!Z.fetched_at||Z.data===void 0||Z.data===null)return null;return Z}catch{return null}}async function AU($,q,Z){let Q={fetched_at:new Date().toISOString(),ttl_seconds:Z,data:q};try{await OU(LU($),{recursive:!0}),await _U($,JSON.stringify(Q,null,2),"utf-8"),E(`http: wrote cache -> ${$}`)}catch(X){E(`http: failed to write cache: ${X}`)}}function IU($){let q=new Date($.fetched_at).getTime();return(Date.now()-q)/1000<$.ttl_seconds}async function b5($,q,Z={}){let Q=Z.ttl??3600,X=Z.noCache??!1,z=await FU(q);if(z&&!X&&IU(z))return E(`http: cache hit (fresh) -> ${q}`),z.data;try{E(`http: fetching -> ${$}`);let J=await fetch($);if(!J.ok)throw Error(`HTTP ${J.status}: ${J.statusText}`);let Y=await J.json();return await AU(q,Y,Q),Y}catch(J){if(E(`http: fetch failed: ${J}`),z)return E(`http: using stale cache as fallback -> ${q}`),z.data;return null}}var RU=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,jU=/^[a-zA-Z0-9_-]+$/,y5=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/,wU=/^[0-9a-f]{40}$/,NU=/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/,DU=/^[a-z0-9-]+$/,PU=/^sha256:[0-9a-f]{64}$/,x5=["pass","warning","dangerous"];function uq($){let q=[];if(!$||typeof $!=="object"||Array.isArray($))return[{field:"(root)",message:"manifest must be a non-null object"}];let Z=$,Q=new Set(["name","author","description","repository","commit","skill_path","version","license","tags","security_verdict","published_at","checksum"]);for(let J of Object.keys(Z))if(!Q.has(J))q.push({field:J,message:`unknown property "${J}" is not allowed`});let X=[{field:"name",pattern:RU,maxLength:128},{field:"author",pattern:jU,maxLength:39},{field:"description",maxLength:256},{field:"repository",pattern:y5},{field:"commit",pattern:wU},{field:"published_at"}];for(let{field:J,pattern:Y,maxLength:G}of X){let U=Z[J];if(U===void 0||U===null){q.push({field:J,message:`required field "${J}" is missing`});continue}if(typeof U!=="string"){q.push({field:J,message:`"${J}" must be a string`});continue}if(U.length===0){q.push({field:J,message:`"${J}" must not be empty`});continue}if(G&&U.length>G)q.push({field:J,message:`"${J}" exceeds maximum length of ${G}`});if(Y&&!Y.test(U))q.push({field:J,message:`"${J}" does not match required pattern`})}let z=Z.security_verdict;if(z===void 0||z===null)q.push({field:"security_verdict",message:'required field "security_verdict" is missing'});else if(typeof z!=="string"||!x5.includes(z))q.push({field:"security_verdict",message:`"security_verdict" must be one of: ${x5.join(", ")}`});if(typeof Z.published_at==="string"&&Z.published_at.length>0){if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/.test(Z.published_at))q.push({field:"published_at",message:'"published_at" must be a valid ISO 8601 date-time'})}if(Z.version!==void 0){if(typeof Z.version!=="string"||!NU.test(Z.version))q.push({field:"version",message:'"version" must be a valid semver string'})}if(Z.license!==void 0){if(typeof Z.license!=="string")q.push({field:"license",message:'"license" must be a string'});else if(Z.license.length>64)q.push({field:"license",message:'"license" exceeds maximum length of 64'})}if(Z.tags!==void 0)if(!Array.isArray(Z.tags))q.push({field:"tags",message:'"tags" must be an array'});else{if(Z.tags.length>10)q.push({field:"tags",message:'"tags" has more than 10 items'});let J=new Set;for(let Y=0;Y<Z.tags.length;Y++){let G=Z.tags[Y];if(typeof G!=="string"){q.push({field:`tags[${Y}]`,message:"tag must be a string"});continue}if(G.length>32)q.push({field:`tags[${Y}]`,message:`tag "${G}" exceeds maximum length of 32`});if(!DU.test(G))q.push({field:`tags[${Y}]`,message:`tag "${G}" does not match pattern (lowercase alphanumeric and hyphens)`});if(J.has(G))q.push({field:`tags[${Y}]`,message:`duplicate tag "${G}"`});J.add(G)}}if(Z.checksum!==void 0){if(typeof Z.checksum!=="string"||!PU.test(Z.checksum))q.push({field:"checksum",message:'"checksum" must match pattern sha256:<64-hex-chars>'})}if(Z.skill_path!==void 0){if(typeof Z.skill_path!=="string")q.push({field:"skill_path",message:'"skill_path" must be a string'});else if(Z.skill_path.length===0)q.push({field:"skill_path",message:'"skill_path" must not be empty'});else if(Z.skill_path.length>256)q.push({field:"skill_path",message:'"skill_path" exceeds maximum length of 256'});else if(/\.\.|^\//.test(Z.skill_path))q.push({field:"skill_path",message:'"skill_path" must not contain ".." or start with "/"'})}return q}function CU($,q){let Z=$.length,Q=q.length;if(Z===0)return Q;if(Q===0)return Z;let X=Array(Q+1),z=Array(Q+1);for(let J=0;J<=Q;J++)X[J]=J;for(let J=1;J<=Z;J++){z[0]=J;for(let Y=1;Y<=Q;Y++){let G=$[J-1]===q[Y-1]?0:1;z[Y]=Math.min(X[Y]+1,z[Y-1]+1,X[Y-1]+G)}[X,z]=[z,X]}return X[Q]}function EU($,q,Z=2){let Q=[];for(let X of q){if($===X)continue;let z=CU($,X);if(z<=Z)Q.push({existingName:X,distance:z})}return Q.sort((X,z)=>X.distance-z.distance)}var w4=process.env.ASM_REGISTRY_URL??"https://raw.githubusercontent.com/luongnv89/asm-registry/main/index.json",SU=process.env.ASM_REGISTRY_CACHE??TU(MU(),".config","agent-skill-manager","registry-cache.json"),bU=3600;function N4($){if($.startsWith("github:")||$.startsWith("http://")||$.startsWith("https://")||$.startsWith("/")||$.startsWith("./")||$.startsWith("../")||$.startsWith("~/")||$==="~"||$==="."||$==="..")return!1;let q=($.match(/\//g)||[]).length;if(q>1)return!1;if(q===1){let[Z,Q]=$.split("/");return/^[a-zA-Z0-9_-]+$/.test(Z)&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(Q)}return/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test($)}function D4($){if(!N4($))return!1;return $.includes("/")}async function P4($){let q=await b5(w4,SU,{ttl:bU,noCache:$?.noCache});if(!q)return null;if(typeof q!=="object"||!Array.isArray(q.manifests)||typeof q.generated_at!=="string")return E("registry: fetched index has invalid structure — discarding"),null;let Z=[];for(let Q of q.manifests){let X=uq(Q);if(X.length>0){E(`registry: dropping invalid manifest entry (${Q?.name??"unknown"}): ${X.map((z)=>z.message).join(", ")}`);continue}if(!y5.test(Q.repository)){E(`registry: dropping manifest with unexpected repository URL: ${Q.repository}`);continue}Z.push(Q)}return{generated_at:q.generated_at,manifests:Z}}function xU($,q){return q.manifests.filter((Z)=>Z.name.toLowerCase()===$.toLowerCase())}function fU($,q,Z){return Z.manifests.find((Q)=>Q.author.toLowerCase()===$.toLowerCase()&&Q.name.toLowerCase()===q.toLowerCase())??null}function f5($,q,Z=5){return EU($,q.manifests.map((X)=>X.name),3).slice(0,Z).map((X)=>X.existingName)}async function k5($,q){let Z=await P4(q);if(!Z)return E("registry: failed to fetch index — skipping registry resolution"),{resolved:null,multipleMatches:[],suggestions:[]};if(D4($)){let[z,J]=$.split("/"),Y=fU(z,J,Z);if(Y)return{resolved:{manifest:Y,source:"registry"},multipleMatches:[],suggestions:[]};let G=f5(J,Z);return{resolved:null,multipleMatches:[],suggestions:G}}let Q=xU($,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=f5($,Z);return{resolved:null,multipleMatches:[],suggestions:X}}function v5($){let q=$.filter((Z)=>Z.provider!=="plugin").map((Z)=>({name:Z.name,version:Z.version,dirName:Z.dirName,provider:Z.provider,scope:Z.scope,path:Z.path,isSymlink:Z.isSymlink,symlinkTarget:Z.symlinkTarget,effort:Z.effort}));return{version:1,exportedAt:new Date().toISOString(),skills:q}}import{readFile as yU,access as g5,mkdir as kU,cp as h5,rm as vU,symlink as hU}from"fs/promises";import{join as u5,basename as gU}from"path";function uU($){let q=[];if(typeof $!=="object"||$===null||Array.isArray($))return{valid:!1,errors:["Manifest must be a JSON object."]};let Z=$;if(Z.version!==1)q.push(`Unsupported manifest version: ${JSON.stringify(Z.version)}. Expected 1.`);if(typeof Z.exportedAt!=="string")q.push("Missing or invalid 'exportedAt' field.");if(!Array.isArray(Z.skills))return q.push("Missing or invalid 'skills' array."),{valid:!1,errors:q};for(let Q=0;Q<Z.skills.length;Q++){let X=Z.skills[Q];if(typeof X!=="object"||X===null){q.push(`skills[${Q}]: must be an object.`);continue}let z=X;if(typeof z.name!=="string"||!z.name)q.push(`skills[${Q}]: missing or empty 'name'.`);if(typeof z.dirName!=="string"||!z.dirName)q.push(`skills[${Q}]: missing or empty 'dirName'.`);if(typeof z.provider!=="string"||!z.provider)q.push(`skills[${Q}]: missing or empty 'provider'.`);if(z.scope!=="global"&&z.scope!=="project")q.push(`skills[${Q}]: invalid 'scope' "${String(z.scope)}". Must be "global" or "project".`)}return{valid:q.length===0,errors:q}}async function m5($){let q;try{q=await yU($,"utf-8")}catch(X){if(X?.code==="ENOENT")throw Error(`Manifest file not found: ${$}`);throw Error(`Failed to read manifest file: ${X.message}`)}let Z;try{Z=JSON.parse(q)}catch{throw Error("Manifest file is not valid JSON.")}let Q=uU(Z);if(!Q.valid)throw Error(`Invalid manifest:
|
|
160
160
|
${Q.errors.join(`
|
|
161
|
-
`)}`);return Z}async function
|
|
162
|
-
name: ${
|
|
161
|
+
`)}`);return Z}async function mU($){try{return await g5($),!0}catch{return!1}}function pU($,q){return $.providers.find((Z)=>Z.name===q&&Z.enabled)}function dU($,q,Z,Q){let X=pU($,q);if(!X)return null;let z=Z==="global"?X.global:X.project,J=z0(z),Y=gU(Q);if(!Y||Y==="."||Y==="..")return null;return u5(J,Y)}function cU($,q){let Z=$.find((Q)=>Q.dirName===q.dirName&&Q.provider===q.provider);if(Z)return Z;return $.find((Q)=>Q.dirName===q.dirName)||null}async function p5($,q,Z){let Q=Z?.config??await h(),X=Z?.installedSkills??await o(Q,"both"),z=[];for(let U of $.skills){if(q.scopeFilter!=="both"&&U.scope!==q.scopeFilter){E(`import: skipping "${U.name}" — scope "${U.scope}" filtered out`);continue}let H=dU(Q,U.provider,U.scope,U.dirName);if(!H){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"failed",reason:`Provider "${U.provider}" not found or not enabled.`});continue}let V=await mU(H);if(V&&!q.force){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"skipped",reason:"Already installed.",path:H});continue}if(q.dryRun){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"dry-run",reason:V?"Would overwrite (--force).":"Would install.",path:H});continue}let B=cU(X,U);if(!B){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"failed",reason:"No installed source found. Install the skill first with: asm install <source>"});continue}try{if(await kU(u5(H,".."),{recursive:!0}),V)await vU(H,{recursive:!0,force:!0});if(U.isSymlink&&U.symlinkTarget)try{await g5(U.symlinkTarget),await hU(U.symlinkTarget,H),E(`import: symlinked "${U.name}" -> ${U.symlinkTarget} at ${H}`)}catch{await h5(B.realPath,H,{recursive:!0}),E(`import: symlink target unreachable, copied "${U.name}" from ${B.realPath} to ${H}`)}else await h5(B.realPath,H,{recursive:!0}),E(`import: copied "${U.name}" from ${B.realPath} to ${H}`);z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"installed",path:H})}catch(_){z.push({skillName:U.name,provider:U.provider,scope:U.scope,status:"failed",reason:`Copy failed: ${_.message}`})}}let J=z.filter((U)=>U.status==="installed").length,Y=z.filter((U)=>U.status==="skipped").length,G=z.filter((U)=>U.status==="failed").length;return{total:z.length,installed:J,skipped:Y,failed:G,results:z}}import{mkdir as lU,writeFile as nU,access as aU}from"fs/promises";import{join as iU}from"path";function oU($){return`---
|
|
162
|
+
name: ${$}
|
|
163
163
|
description: ""
|
|
164
164
|
license: ""
|
|
165
165
|
metadata:
|
|
@@ -167,7 +167,7 @@ metadata:
|
|
|
167
167
|
creator: ""
|
|
168
168
|
---
|
|
169
169
|
|
|
170
|
-
# ${
|
|
170
|
+
# ${$}
|
|
171
171
|
|
|
172
172
|
Describe what this skill does here. This content will be loaded by the AI agent
|
|
173
173
|
as instructions for when and how to use this skill.
|
|
@@ -179,66 +179,70 @@ 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 d5($,q){await lU(q,{recursive:!0});let Z=iU(q,"SKILL.md"),Q=oU($);await nU(Z,Q,"utf-8")}async function c5($){try{return await aU($),!0}catch{return!1}}import{readdir as sU,stat as tU}from"fs/promises";import{join as rU}from"path";async function eU($){let q=0;try{let Q=(await sU($,{recursive:!0})).map(async(z)=>{try{let J=await tU(rU($,z));if(J.isFile())return J.size}catch{}return 0});q=(await Promise.all(Q)).reduce((z,J)=>z+J,0)}catch{}return q}async function a5($,q){let Z={},Q={global:0,project:0},X={},z=$.map(async(G)=>{Z[G.provider]=(Z[G.provider]||0)+1,Q[G.scope]++;let U=await eU(G.path);return X[G.path]=U,U}),Y=(await Promise.all(z)).reduce((G,U)=>G+U,0);return{totalSkills:$.length,byProvider:Z,byScope:Q,totalDiskBytes:Y,perSkillDiskBytes:X,duplicateGroups:q.duplicateGroups.length,duplicateInstances:q.totalDuplicateInstances}}function $W($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;if($<1073741824)return`${($/1048576).toFixed(1)} MB`;return`${($/1073741824).toFixed(1)} GB`}function C4($,q,Z=20){let Q=Math.round($/q*Z),X=Z-Q;return W.green("#".repeat(Q))+W.dim("-".repeat(X))}var l5={claude:"Claude Code",codex:"Codex",openclaw:"OpenClaw",agents:"Agents"};function i5($){let q=[];q.push(""),q.push(W.blueBold(" Skill Statistics")),q.push(W.dim(" "+"-".repeat(20))),q.push(""),q.push(` ${W.bold("Total:")} ${W.cyan(String($.totalSkills))} skills`),q.push(` ${W.bold("Disk:")} ${W.cyan($W($.totalDiskBytes))}`),q.push(""),q.push(W.bold(" By Tool"));let Z=Object.entries($.byProvider).sort((G,U)=>U[1]-G[1]),Q=Math.max(...Z.map(([,G])=>G)),X=Math.max(...Z.map(([G])=>(l5[G]||G).length));for(let[G,U]of Z){let H=l5[G]||G,V=n5(G,H.padEnd(X)),B=String(U).padStart(4);q.push(` ${V} ${B} ${C4(U,Q)}`)}q.push(""),q.push(W.bold(" By Scope"));let z=Math.max($.byScope.global,$.byScope.project),J=String($.byScope.global).padStart(4),Y=String($.byScope.project).padStart(4);if(q.push(` ${"global ".padEnd(X)} ${J} ${C4($.byScope.global,z)}`),q.push(` ${"project".padEnd(X)} ${Y} ${C4($.byScope.project,z)}`),q.push(""),q.push(W.bold(" Duplicates")),$.duplicateGroups>0)q.push(` ${W.yellow(`${$.duplicateGroups} group(s), ${$.duplicateInstances} total instance(s)`)}`),q.push(W.dim(` Run ${W.bold("asm audit")} to review`));else q.push(` ${W.green("None")}`);return q.push(""),q.join(`
|
|
183
|
+
`)}import{access as qW,lstat as E4,mkdir as ZW,readdir as QW,readFile as o5,rm as XW,symlink as zW}from"fs/promises";import{join as mq}from"path";async function S4($){let q;try{q=await E4($)}catch{throw Error(`Path does not exist: ${$}`)}if(!q.isDirectory())throw Error(`Path is not a directory: ${$}`);let Z=mq($,"SKILL.md"),Q;try{Q=await o5(Z,"utf-8")}catch{throw Error(`No SKILL.md found in ${$}`)}let X=$0(Q);if(!X.name)throw Error(`Invalid SKILL.md in ${$}: missing "name" in frontmatter`);return{name:X.name,version:J0(X)}}async function s5($,q,Z,Q){let X=mq(q,Z),z=!1;try{await qW(X),z=!0}catch{}if(z){if(!Q)throw Error(`Target already exists: ${X}. Use --force to overwrite.`);await XW(X,{recursive:!0,force:!0})}await ZW(q,{recursive:!0}),await zW($,X,"dir")}async function b4($){let q;try{q=await E4($)}catch{throw Error(`Path does not exist: ${$}`)}if(!q.isDirectory())throw Error(`Path is not a directory: ${$}`);let Z=await QW($),Q=[];for(let X of Z){if(X.startsWith(".")||X==="node_modules")continue;let z=mq($,X);try{if(!(await E4(z)).isDirectory())continue}catch{continue}let J=mq(z,"SKILL.md");try{let Y=await o5(J,"utf-8"),G=$0(Y);if(G.name)Q.push({absPath:z,dirName:X,name:G.name,version:J0(G)})}catch{}}return Q.sort((X,z)=>X.name.localeCompare(z.name)),Q}import{readFile as JW,writeFile as YW,readdir as GW,access as UW,mkdir as WW,rm as VW}from"fs/promises";import{join as k$,resolve as HW}from"path";import{homedir as BW}from"os";var u0=k$(BW(),".config","agent-skill-manager","bundles");function KW($){let q=[];if(typeof $!=="object"||$===null||Array.isArray($))return{valid:!1,errors:["Bundle must be a JSON object."]};let Z=$;if(Z.version!==1)q.push(`Unsupported bundle version: ${JSON.stringify(Z.version)}. Expected 1.`);if(typeof Z.name!=="string"||!Z.name)q.push("Missing or empty 'name' field.");if(typeof Z.description!=="string"||!Z.description)q.push("Missing or empty 'description' field.");if(typeof Z.author!=="string"||!Z.author)q.push("Missing or empty 'author' field.");if(typeof Z.createdAt!=="string")q.push("Missing or invalid 'createdAt' field.");if(!Array.isArray(Z.skills))return q.push("Missing or invalid 'skills' array."),{valid:!1,errors:q};if(Z.skills.length===0)q.push("Bundle must contain at least one skill.");for(let Q=0;Q<Z.skills.length;Q++){let X=Z.skills[Q];if(typeof X!=="object"||X===null){q.push(`skills[${Q}]: must be an object.`);continue}let z=X;if(typeof z.name!=="string"||!z.name)q.push(`skills[${Q}]: missing or empty 'name'.`);if(typeof z.installUrl!=="string"||!z.installUrl)q.push(`skills[${Q}]: missing or empty 'installUrl'.`)}if(Z.tags!==void 0){if(!Array.isArray(Z.tags))q.push("'tags' must be an array of strings if provided.");else if(Z.tags.some((Q)=>typeof Q!=="string"))q.push("'tags' must contain only strings.")}return{valid:q.length===0,errors:q}}function t5($,q,Z,Q,X){return{version:1,name:$,description:q,author:Z,createdAt:new Date().toISOString(),skills:Q,tags:X}}async function r5($,q){let Z=q??await m0(),Q=Z.skills[$.name]||Z.skills[$.dirName],X;if($.isSymlink&&$.symlinkTarget)X=$.symlinkTarget;else if(Q?.source)X=Q.source;else X=$.path;return{name:$.name,installUrl:X,description:$.description||void 0,version:$.version||void 0}}async function _W(){await WW(u0,{recursive:!0})}function f4($){let q=$.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(q=q.replace(/^\.+|\.+$/g,""),!q||q==="."||q==="..")throw Error("Invalid bundle name: results in an empty filename after sanitization.");return q}async function e5($){await _W();let q=`${f4($.name)}.json`,Z=k$(u0,q);return await YW(Z,JSON.stringify($,null,2)+`
|
|
184
|
+
`,"utf-8"),E(`bundle: saved to ${Z}`),Z}async function x4($){let q;try{q=await JW($,"utf-8")}catch(X){if(X?.code==="ENOENT")throw Error(`Bundle file not found: ${$}`);throw Error(`Failed to read bundle file: ${X.message}`)}let Z;try{Z=JSON.parse(q)}catch{throw Error("Bundle file is not valid JSON.")}let Q=KW(Z);if(!Q.valid)throw Error(`Invalid bundle:
|
|
185
185
|
${Q.errors.join(`
|
|
186
|
-
`)}`);return Z}async function
|
|
187
|
-
`);for(let
|
|
188
|
-
`)}function
|
|
189
|
-
About to publish "${
|
|
186
|
+
`)}`);return Z}async function y4($){if($.includes("/")||$.includes("\\")||$.endsWith(".json")){let Q=HW($);return x4(Q)}let q=`${f4($)}.json`,Z=k$(u0,q);return x4(Z)}async function $8(){let $=[];try{await UW(u0)}catch{return $}let q;try{q=await GW(u0)}catch{return $}for(let Z of q){if(!Z.endsWith(".json"))continue;let Q=k$(u0,Z);try{let X=await x4(Q);$.push(X)}catch{E(`bundle: skipping invalid file ${Q}`)}}return $.sort((Z,Q)=>Z.name.localeCompare(Q.name)),$}async function q8($){let q=`${f4($)}.json`,Z=k$(u0,q);try{return await VW(Z),E(`bundle: removed ${Z}`),!0}catch(Q){if(Q?.code==="ENOENT")return!1;throw Q}}import{readFile as wW,realpath as NW}from"fs/promises";import{join as DW,resolve as PW,relative as CW}from"path";var X8=[{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 OW($,q){let Z={owner:$,repo:q,profileUrl:`https://github.com/${$}`,reposUrl:`https://github.com/${$}?tab=repositories`,isOrganization:null,publicRepos:null,accountAge:null,fetchError:null};try{let Q=await fetch(`https://api.github.com/users/${$}`,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"agent-skill-manager"},signal:AbortSignal.timeout(1e4)});if(!Q.ok)return Z.fetchError=`GitHub API returned ${Q.status}`,Z;let X=await Q.json();if(Z.isOrganization=X.type==="Organization",Z.publicRepos=typeof X.public_repos==="number"?X.public_repos:null,typeof X.created_at==="string"){let z=new Date(X.created_at),J=new Date,Y=Math.floor((J.getTime()-z.getTime())/31557600000),G=Math.floor((J.getTime()-z.getTime())%31557600000/2630016000.0000005);Z.accountAge=Y>0?`${Y}y ${G}m`:`${G}m`}E(`security-audit: source analysis for ${$} -> repos=${Z.publicRepos}, org=${Z.isOrganization}, age=${Z.accountAge}`)}catch(Q){Z.fetchError=Q.message||"Failed to fetch GitHub profile",E(`security-audit: source analysis failed -> ${Z.fetchError}`)}return Z}function LW($){let q=new Map;for(let{relPath:X,content:z}of $){let J=z.split(`
|
|
187
|
+
`);for(let Y=0;Y<J.length;Y++){let G=J[Y],U=G.trim();for(let H of X8)if(H.pattern.test(G)){let V=H.category;if(!q.has(V))q.set(V,{description:H.description,matches:[]});let B=U.length>120?U.slice(0,120)+"...":U;q.get(V).matches.push({file:X,line:Y+1,match:B,severity:H.severity})}}}let Z=[];for(let[X,z]of q)Z.push({category:X,description:z.description,matches:z.matches});let Q={critical:0,warning:1,info:2};return Z.sort((X,z)=>{let J=Math.min(...X.matches.map((G)=>Q[G.severity])),Y=Math.min(...z.matches.map((G)=>Q[G.severity]));return J-Y}),Z}function FW($){let q=new Map;for(let z of $)for(let J of z.matches)for(let Y of X8)if(Y.permissionType&&Y.category===z.category&&Y.pattern.test(J.match)){let G=Y.permissionType;if(!q.has(G))q.set(G,{evidence:[],categories:new Set});let U=q.get(G);U.evidence.push({file:J.file,line:J.line,match:J.match}),U.categories.add(z.category);break}let Z={filesystem:"Skill reads, writes, or modifies files on disk. Verify it only accesses intended paths.",shell:"Skill executes shell commands or spawns processes. This allows arbitrary system access.",network:"Skill makes network requests or downloads external content. Data may be sent to remote servers.","code-execution":"Skill dynamically constructs and executes code. This can bypass static analysis.",environment:"Skill reads environment variables, which may contain secrets or API keys."},Q=[];for(let[z,J]of q)Q.push({type:z,evidence:J.evidence,reason:Z[z]});let X={shell:0,"code-execution":1,network:2,filesystem:3,environment:4};return Q.sort((z,J)=>(X[z.type]??99)-(X[J.type]??99)),Q}function AW($,q,Z){let Q=0,X=0;for(let G of $)for(let U of G.matches){if(U.severity==="critical")Q++;if(U.severity==="warning")X++}let z=q.some((G)=>G.type==="shell"),J=q.some((G)=>G.type==="code-execution"),Y=q.some((G)=>G.type==="network");if(z&&Y)return{verdict:"dangerous",reason:"Skill has both shell execution and network access -- potential data exfiltration risk."};if(J&&Y)return{verdict:"dangerous",reason:"Skill has dynamic code execution and network access -- potential remote code execution risk."};if(Q>=10)return{verdict:"dangerous",reason:`${Q} critical findings detected. High concentration of risky patterns.`};if(z||J)return{verdict:"warning",reason:z?"Skill executes shell commands. Review commands carefully before installing.":"Skill uses dynamic code execution. Review usage carefully."};if(Q>0)return{verdict:"warning",reason:`${Q} critical finding${Q>1?"s":""} detected. Manual review recommended.`};if(X>0)return{verdict:"caution",reason:`${X} warning${X>1?"s":""} found. Generally acceptable but worth reviewing.`};if(Z&&Z.publicRepos!==null&&Z.publicRepos<3)return{verdict:"caution",reason:"No code issues found, but the author has very few public repositories."};return{verdict:"safe",reason:"No suspicious patterns detected."}}async function N0($,q,Z,Q){E(`security-audit: scanning ${$}`);let X=await n$($),z=X.reduce((V,B)=>V+B.lineCount,0),J=null;if(Z&&Q)J=await OW(Z,Q);let Y=LW(X),G=FW(Y),{verdict:U,reason:H}=AW(Y,G,J);return{scannedAt:new Date().toISOString(),skillName:q,skillPath:$,source:J,codeScans:Y,permissions:G,totalFiles:X.length,totalLines:z,verdict:U,verdictReason:H}}var b=W,p0=56,IW={"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"},Z8={critical:0,warning:1,info:2};function TW($){switch($){case"safe":return b.bgGreen(" SAFE ");case"caution":return b.bgCyan(" CAUTION ");case"warning":return b.bgYellow(" WARNING ");case"dangerous":return b.bgRed(" DANGEROUS ")}}function MW($){switch($){case"safe":return b.green;case"caution":return b.cyan;case"warning":return b.yellow;case"dangerous":return b.red}}function J$($){switch($){case"critical":return b.red("!!");case"warning":return b.yellow(" !");case"info":return b.dim(" i")}}function k4($,q){return $.length>q?$.slice(0,q-3)+"...":$}function pq($){return $.toLocaleString("en-US")}function z8($){return $.replace(/\x1b\[[0-9;]*m/g,"")}function Q8($){return z8($).length}function RW($){let q=new Map;for(let Z of $){let Q=`${Z.file}:${Z.line}`,X=q.get(Q);if(!X||Z8[Z.severity]<Z8[X.severity])q.set(Q,Z)}return Array.from(q.values())}function jW($){let q=new Map;for(let Z of $){let Q=q.get(Z.file);if(!Q)Q={file:Z.file,entries:[]},q.set(Z.file,Q);Q.entries.push({line:Z.line,match:Z.match,severity:Z.severity})}return Array.from(q.values())}function dq($){let q=[],Z=TW($.verdict),Q=z8(Z),X=` ${b.bold($.skillName)}`,z=` ${$.skillName}`,J=p0-4,Y=Math.max(1,J-z.length-Q.length);if(q.push(""),q.push(b.dim(" +-- ")+b.bold("Security Audit")+b.dim(" "+"-".repeat(p0-19)+"+")),q.push(b.dim(" |")+X+" ".repeat(Y)+Z+b.dim("|")),q.push(b.dim(" |")+b.dim(` ${pq($.totalFiles)} files | ${pq($.totalLines)} lines`)+" ".repeat(Math.max(1,J-` ${pq($.totalFiles)} files | ${pq($.totalLines)} lines`.length))+b.dim("|")),q.push(b.dim(" +"+"-".repeat(p0-2)+"+")),$.source){let V=$.source;if(V.fetchError)q.push(` ${b.yellow("!")} Could not fetch profile: ${V.fetchError}`);else{let B=[];if(B.push(`${V.owner} ${V.isOrganization?b.cyan("(org)"):b.dim("(user)")}`),V.publicRepos!==null){let _=V.publicRepos,O=_<3?b.yellow(`${_} repos`):_<10?b.cyan(`${_} repos`):b.green(`${_} repos`);B.push(O)}if(V.accountAge)B.push(V.accountAge);q.push(` ${b.dim("Author:")} ${B.join(b.dim(" | "))}`)}}if(q.push(""),$.codeScans.length===0)q.push(` ${b.green("*")} ${b.green("No suspicious patterns detected.")}`);else{let V=MW($.verdict),B=$.verdict==="dangerous"||$.verdict==="warning"?J$("critical"):$.verdict==="caution"?J$("warning"):J$("info");q.push(` ${B} ${V($.verdictReason)}`);let _=0,O=0,K=0;for(let M of $.codeScans)for(let j of M.matches)if(j.severity==="critical")_++;else if(j.severity==="warning")O++;else K++;let L=[];if(_>0)L.push(b.red(`${_} critical`));if(O>0)L.push(b.yellow(`${O} warning`));if(K>0)L.push(b.dim(`${K} info`));let F=$.permissions.map((M)=>M.type),A=F.length>0?b.dim(`Perms: ${F.join(", ")}`):"";q.push(` ${L.join(b.dim(" | "))} ${A}`)}if(q.push(""),$.codeScans.length>0){q.push(` ${b.bold("Findings")}`),q.push(b.dim(" "+"=".repeat(p0-2)));for(let V of $.codeScans){let B=RW(V.matches),_=B.filter((I)=>I.severity==="critical").length,O=B.filter((I)=>I.severity==="warning").length,K=B.filter((I)=>I.severity==="info").length,L=_>0?J$("critical"):O>0?J$("warning"):J$("info"),F=[];if(_>0)F.push(b.red(`${_} critical`));if(O>0)F.push(b.yellow(`${O} warning`));if(K>0)F.push(b.dim(`${K} info`));let A=IW[V.category],M=A?b.dim(`PERM: ${A}`):"",j=` ${L} ${b.bold(V.category)} (${F.join(", ")})`;if(M){let I=Q8(j),R=Q8(M),C=Math.max(2,p0-I-R);q.push(j+" ".repeat(C)+M)}else q.push(j);let T=jW(B),w=Math.min(24,Math.max(...T.map((I)=>I.file.length))),x=0,P=3;for(let I of T){if(x>=P)break;let R=k4(I.file,24),C=b.dim(R.padEnd(w));if(I.entries.length===1){let S=I.entries[0],f=k4(S.match,50);q.push(` ${C} :${S.line} ${b.dim("--")} ${S.severity==="critical"?f:b.dim(f)}`),x++}else if(I.entries.length<=3){let S=I.entries.map((d)=>`:${d.line}`).join(", "),f=k4(I.entries[0].match,40);q.push(` ${C} ${S} ${b.dim("--")} ${b.dim(f)}`),x++}else{let f=I.entries.slice(0,3).map((p)=>`:${p.line}`).join(", "),d=I.entries.length-3;q.push(` ${C} ${f} ${b.dim(`(+${d} more)`)}`),x++}}let y=T.length-Math.min(T.length,P);if(y>0){let I=B.length-T.slice(0,P).reduce((R,C)=>R+C.entries.length,0);if(I>0)q.push(` ${b.dim(`... ${I} more in ${y} file${y>1?"s":""}`)}`)}q.push("")}}q.push(b.dim(" "+"=".repeat(p0-2)));let G=new Date($.scannedAt),U=`${G.getFullYear()}-${String(G.getMonth()+1).padStart(2,"0")}-${String(G.getDate()).padStart(2,"0")} ${String(G.getHours()).padStart(2,"0")}:${String(G.getMinutes()).padStart(2,"0")}`,H=$.source&&!$.source.fetchError?`github.com/${$.source.owner}`:"";if(H){let V=Math.max(2,p0-2-U.length-H.length);q.push(b.dim(` ${U}${" ".repeat(V)}${H}`))}else q.push(b.dim(` ${U}`));return q.push(""),q.join(`
|
|
188
|
+
`)}function v4($){return JSON.stringify($,null,2)}function cq($){return $.replace(/\x1b\[[0-9;]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07]*\x07/g,"").replace(/\x1b[^[\]]/g,"").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"")}function EW($){return $.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/</g,"<").replace(/>/g,">").replace(/\|/g,"\\|")}function h4($){return EW(cq($))}var d0="luongnv89/asm-registry";async function SW($){let q=DW($,"SKILL.md"),Z;try{Z=await wW(q,"utf-8")}catch{throw Error(`No SKILL.md found in ${$}. Run "asm init" to create one.`)}let Q=$0(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=J0(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 bW($){if(await Bun.spawn(["git","rev-parse","--git-dir"],{cwd:$,stdout:"pipe",stderr:"pipe"}).exited!==0)throw Error(`${$} is not inside a git repository.`)}async function xW($){let q=Bun.spawn(["git","rev-parse","HEAD"],{cwd:$,stdout:"pipe",stderr:"pipe"}),Z=await new Response(q.stdout).text();if(await q.exited!==0)throw Error("Failed to get HEAD commit. Is this a git repository?");return Z.trim()}async function fW($){let q=Bun.spawn(["git","rev-parse","--show-toplevel"],{cwd:$,stdout:"pipe",stderr:"pipe"}),Z=await new Response(q.stdout).text();if(await q.exited!==0)throw Error("Failed to determine git repository root.");return Z.trim()}async function yW($){let q=Bun.spawn(["git","remote","get-url","origin"],{cwd:$,stdout:"pipe",stderr:"pipe"}),Z=await new Response(q.stdout).text();if(await q.exited!==0)throw Error("No remote origin found. Add one with: git remote add origin <url>");let X=Z.trim(),z=X.match(/^git@github\.com:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+?)(?:\.git)?$/);if(z)return`https://github.com/${z[1]}/${z[2]}`;return X.replace(/\.git$/,"")}async function kW(){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 vW($){switch($){case"safe":case"caution":return"pass";case"warning":return"warning";case"dangerous":return"dangerous"}}function J8($){let q={name:$.metadata.name,author:$.author,description:$.metadata.description,repository:$.repository,commit:$.commit,security_verdict:$.securityVerdict,published_at:new Date().toISOString()};if($.skillPath)q.skill_path=$.skillPath;if($.metadata.version&&$.metadata.version!=="0.0.0"&&/^\d+\.\d+\.\d+/.test($.metadata.version))q.version=$.metadata.version;if($.metadata.license)q.license=$.metadata.license;if($.metadata.tags&&$.metadata.tags.length>0)q.tags=$.metadata.tags.slice(0,10);return q}function hW($){let q=J8({metadata:$.metadata,author:$.metadata.creator||"unknown",commit:$.commit,repository:$.repository,securityVerdict:$.registryVerdict}),Z=uq(q);if(Z.length>0)return{success:!1,manifest:q,prUrl:null,error:`Manifest validation failed: ${Z.map((Q)=>`${Q.field}: ${Q.message}`).join("; ")}`,securityVerdict:$.registryVerdict,securityReport:$.securityReport};return{success:!0,manifest:q,prUrl:null,error:null,securityVerdict:$.registryVerdict,securityReport:$.securityReport,fallback:!0,fallbackReason:$.fallbackReason}}async function Y8($){let q=PW($.path);E(`publish: starting for ${q}`),await bW(q);let Z=await SW(q);E(`publish: parsed metadata for "${Z.name}"`);let X=await($._auditFn??N0)(q,Z.name),z=vW(X.verdict);if(z==="dangerous")return{success:!1,manifest:null,prUrl:null,error:`Security audit verdict: dangerous. ${X.verdictReason}`,securityVerdict:z,securityReport:X};if(z==="warning"&&!$.force)return{success:!1,manifest:null,prUrl:null,error:"Security audit verdict: warning. Use --force to override warnings.",securityVerdict:z,securityReport:X};let J=await xW(q),Y=await yW(q),G=await fW(q),U=await NW(q),H=CW(G,U),V=H&&H!=="."?H:void 0,_=await($._checkGhCliFn??kW)();if(!_.available||!_.authenticated){let s=!_.available?"gh CLI not found":"gh CLI not authenticated";return hW({metadata:Z,commit:J,repository:Y,registryVerdict:z,securityReport:X,fallbackReason:s})}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 O=_.login,K=J8({metadata:Z,author:O,commit:J,repository:Y,skillPath:V,securityVerdict:z}),L=uq(K);if(L.length>0)return{success:!1,manifest:K,prUrl:null,error:`Manifest validation failed: ${L.map((s)=>`${s.field}: ${s.message}`).join("; ")}`,securityVerdict:z,securityReport:X};if($.dryRun)return{success:!0,manifest:K,prUrl:null,error:null,securityVerdict:z,securityReport:X};if(!$.yes){if(!process.stdin.isTTY)return{success:!1,manifest:K,prUrl:null,error:"Cannot prompt for confirmation in non-interactive mode. Use --yes to skip.",securityVerdict:z,securityReport:X};let s=cq(Z.name),c$=cq(O);process.stderr.write(`
|
|
189
|
+
About to publish "${s}" by ${c$} to ${d0}.
|
|
190
190
|
Security verdict: ${z}
|
|
191
191
|
|
|
192
|
-
Proceed? [y/N] `);let
|
|
193
|
-
`))process.stdin.removeListener("data",
|
|
194
|
-
`,T=Buffer.from(
|
|
195
|
-
`),
|
|
192
|
+
Proceed? [y/N] `);let G1=await new Promise((J2)=>{let l$="",Y2=(m6)=>{if(l$+=m6.toString(),l$.includes(`
|
|
193
|
+
`))process.stdin.removeListener("data",Y2),process.stdin.pause(),J2(l$.trim())};process.stdin.resume(),process.stdin.on("data",Y2)});if(G1.toLowerCase()!=="y"&&G1.toLowerCase()!=="yes")return{success:!1,manifest:K,prUrl:null,error:"Publish aborted by user.",securityVerdict:z,securityReport:X}}E(`publish: forking ${d0}`),await Bun.spawn(["gh","repo","fork",d0,"--clone=false"],{stdout:"pipe",stderr:"pipe"}).exited;let A=`publish/${O}/${Z.name}`,M=`manifests/${O}/${Z.name}.json`,j=JSON.stringify(K,null,2)+`
|
|
194
|
+
`,T=Buffer.from(j,"utf-8").toString("base64"),w=Bun.spawn(["gh","api",`repos/${O}/asm-registry/git/refs/heads/main`,"--jq",".object.sha"],{stdout:"pipe",stderr:"pipe"}),x=await new Response(w.stdout).text();if(await w.exited!==0)return{success:!1,manifest:K,prUrl:null,error:`Failed to read fork's main branch. Ensure the fork exists at ${O}/asm-registry.`,securityVerdict:z,securityReport:X};let y=x.trim();if(await Bun.spawn(["gh","api",`repos/${O}/asm-registry/git/refs`,"-X","POST","-f",`ref=refs/heads/${A}`,"-f",`sha=${y}`],{stdout:"pipe",stderr:"pipe"}).exited!==0)await Bun.spawn(["gh","api",`repos/${O}/asm-registry/git/refs/heads/${A}`,"-X","PATCH","-f",`sha=${y}`,"-f","force=true"],{stdout:"pipe",stderr:"pipe"}).exited;let C=Bun.spawn(["gh","api",`repos/${O}/asm-registry/contents/${M}`,"-X","PUT","-f",`message=Publish ${O}/${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 s=Bun.spawn(["gh","api",`repos/${O}/asm-registry/contents/${M}?ref=${A}`,"-q",".sha"],{stdout:"pipe",stderr:"pipe"}),c$=(await new Response(s.stdout).text()).trim();if(await s.exited===0&&c$){if(await Bun.spawn(["gh","api",`repos/${O}/asm-registry/contents/${M}`,"-X","PUT","-f",`message=Update ${O}/${Z.name}`,"-f",`content=${T}`,"-f",`branch=${A}`,"-f",`sha=${c$}`],{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=h4(Z.name),p=h4(Z.description),r=h4(Z.license),p$=`Publish ${O}/${cq(Z.name)}`,H0=[`## Skill: ${d}`,"",`**Author:** ${O}`,`**Version:** ${Z.version}`,`**Description:** ${p}`,`**License:** ${r}`,`**Repository:** ${Y}`,`**Commit:** \`${J}\``,`**Security verdict:** ${z}`,"","---","","*This PR was generated by `asm publish`.*"].join(`
|
|
195
|
+
`),X0=Bun.spawn(["gh","pr","create","--repo",d0,"--head",`${O}:${A}`,"--title",p$,"--body",H0],{stdout:"pipe",stderr:"pipe"}),l0=await new Response(X0.stdout).text(),d$=await new Response(X0.stderr).text(),W$=await X0.exited,n0=null;if(W$===0)n0=l0.trim();else{let s=d$.match(/https:\/\/github\.com\/[^\s]+\/pull\/\d+/);if(s)n0=s[0]}if(!n0)return{success:!1,manifest:K,prUrl:null,error:`Failed to create PR against ${d0}. ${d$}`,securityVerdict:z,securityReport:X};return{success:!0,manifest:K,prUrl:n0,error:null,securityVerdict:z,securityReport:X}}function G8($){let q=$.manifest;if(!q)return"";return["",` gh CLI is unavailable (${$.fallbackReason}).`," To publish manually:","",` 1. Fork ${d0} on GitHub`,` 2. Create branch: publish/${q.author}/${q.name}`,` 3. Add file: manifests/${q.author}/${q.name}.json`," 4. Paste the manifest below into that file",` 5. Open a PR against ${d0}`,"",' Run "asm doctor" to fix your environment.',""," Generated manifest:",JSON.stringify(q,null,2).split(`
|
|
196
196
|
`).map((Q)=>` ${Q}`).join(`
|
|
197
197
|
`)].join(`
|
|
198
|
-
`)}import{execFile as
|
|
199
|
-
`)[0];if(!X)return null;let z=X.split(/\s+/)[0];return z&&/^[0-9a-f]{40}$/.test(z)?z:null}catch(Z){return E(`updater: git ls-remote failed for ${
|
|
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,
|
|
203
|
-
`)}function
|
|
204
|
-
`);if(
|
|
205
|
-
`),X
|
|
206
|
-
`);return{rawFrontmatter:Q,body:X}}return{rawFrontmatter
|
|
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(`
|
|
209
|
-
`),Z=[],Q=[],X=0;while(X
|
|
210
|
-
`)})}else Z.push({key:B,text:
|
|
211
|
-
`),changed:
|
|
212
|
-
`);if(X
|
|
213
|
-
`),J=z.map((
|
|
214
|
-
`);let{rawFrontmatter:
|
|
215
|
-
${
|
|
198
|
+
`)}import{execFile as gW}from"child_process";import{promisify as uW}from"util";import{rm as lq,rename as U8,cp as W8,access as mW,mkdir as pW}from"fs/promises";import{join as nq}from"path";import{homedir as V8}from"os";var g4=uW(gW);async function dW($,q,Z){let Q=Array($.length),X=0;async function z(){while(X<$.length){let Y=X++;Q[Y]=await Z($[Y])}}let J=[];for(let Y=0;Y<Math.min(q,$.length);Y++)J.push(z());return await Promise.all(J),Q}async function cW($,q){try{let Z=["ls-remote",$];if(q)Z.push(q);else Z.push("HEAD");let{stdout:Q}=await g4("git",Z,{timeout:1e4}),X=Q.split(`
|
|
199
|
+
`)[0];if(!X)return null;let z=X.split(/\s+/)[0];return z&&/^[0-9a-f]{40}$/.test(z)?z:null}catch(Z){return E(`updater: git ls-remote failed for ${$}: ${Z}`),null}}function u4($){if($.sourceType)return $.sourceType;if($.source.startsWith("local:"))return"local";return"github"}function H8($){if($.startsWith("github:")){let q=$.slice(7),Z=q.indexOf("#");if(Z!==-1)q=q.slice(0,Z);return`https://github.com/${q}.git`}if($.startsWith("file://"))return $;return null}function lW($){if(!$.startsWith("github:"))return null;let q=$.slice(7),Z=q.indexOf("#");if(Z!==-1)q=q.slice(0,Z);let Q=q.split("/");if(Q.length<2||!Q[0]||!Q[1])return null;return{owner:Q[0],repo:Q[1]}}async function m4($){let q=$?.readLockFn??m0,Z=$?.fetchRegistryIndexFn??P4,Q=$?.lock??await q(),X=Object.entries(Q.skills);if(X.length===0)return{entries:[],outdatedCount:0,upToDateCount:0,untrackedCount:0,errorCount:0};let z=null;if(X.some(([,G])=>u4(G)==="registry"||G.registryName))z=await Z();let Y=await dW(X,5,async([G,U])=>{let H=u4(U);if(!U.commitHash||U.commitHash==="unknown")return{name:G,installedCommit:U.commitHash||"unknown",latestCommit:"unknown",source:U.source,sourceType:H,status:"untracked"};if(H==="local")return{name:G,installedCommit:U.commitHash,latestCommit:U.commitHash,source:U.source,sourceType:H,status:"up-to-date"};if(H==="registry"&&z){let O=U.registryName||G,K=z.manifests.find((L)=>L.name.toLowerCase()===O.toLowerCase());if(K){let L=K.commit!==U.commitHash;return{name:G,installedCommit:V0(U.commitHash),latestCommit:V0(K.commit),source:U.source,sourceType:H,status:L?"outdated":"up-to-date"}}}let V=H8(U.source);if(!V)return{name:G,installedCommit:V0(U.commitHash),latestCommit:"unknown",source:U.source,sourceType:H,status:"error",error:"Cannot determine remote URL"};let B=await cW(V,U.ref);if(!B)return{name:G,installedCommit:V0(U.commitHash),latestCommit:"unknown",source:U.source,sourceType:H,status:"error",error:"Failed to fetch remote commit"};let _=B!==U.commitHash;return{name:G,installedCommit:V0(U.commitHash),latestCommit:V0(B),source:U.source,sourceType:H,status:_?"outdated":"up-to-date"}});return{entries:Y,outdatedCount:Y.filter((G)=>G.status==="outdated").length,upToDateCount:Y.filter((G)=>G.status==="up-to-date").length,untrackedCount:Y.filter((G)=>G.status==="untracked").length,errorCount:Y.filter((G)=>G.status==="error").length}}async function nW($,q,Z,Q){if(u4(q)==="local")return{name:$,status:"skipped",reason:"Local skill (not updatable)"};let z=H8(q.source);if(!z)return{name:$,status:"failed",reason:"Cannot determine remote URL"};let J=nq(V8(),".config","agent-skill-manager",".tmp",`${$}-${Date.now()}`);try{let Y=nq(V8(),".config","agent-skill-manager",".tmp");await pW(Y,{recursive:!0}),E(`updater: cloning latest ${$} to ${J}`);let G=["clone","--depth","1"];if(q.ref&&q.ref!=="HEAD")G.push("--branch",q.ref);G.push(z,J);try{await g4("git",G,{timeout:60000})}catch(T){return{name:$,status:"failed",reason:`Clone failed: ${T.stderr||T.message}`}}let U=null;try{let{stdout:T}=await g4("git",["rev-parse","HEAD"],{cwd:J,timeout:5000});U=T.trim()}catch{return{name:$,status:"failed",reason:"Could not read new commit"}}if(U===q.commitHash)return{name:$,status:"skipped",reason:"Already up to date"};E(`updater: running security audit on ${$}`);let H="safe";try{let T=Q?.auditFn??N0,w=lW(q.source);if(H=(await T(J,$,w?.owner,w?.repo)).verdict,H==="dangerous")return{name:$,status:"skipped",reason:"Security audit: dangerous — update blocked",securityVerdict:H};if(H==="warning"||H==="caution"){if(!Z)return{name:$,status:"skipped",reason:`Security audit: ${H} — use --yes to override`,securityVerdict:H};E(`updater: security audit ${H} for ${$} — proceeding (--yes)`)}}catch(T){return E(`updater: security audit failed for ${$}: ${T.message}`),{name:$,status:"failed",reason:`Security audit failed — skipping update: ${T.message}`}}let V=Q?.loadConfigFn??h,B=Q?.resolveProviderPathFn??z0,O=(await V()).providers.find((T)=>T.name===q.provider),K=O?O.global:`~/.${q.provider}/skills`,L=B(K),F=nq(L,$),A=nq(J,".git");try{await lq(A,{recursive:!0,force:!0})}catch{}try{await mW(F)}catch{let T=Q?.writeLockEntryFn??v$;return await W8(J,F,{recursive:!0}),await T($,{...q,commitHash:U,installedAt:new Date().toISOString()}),{name:$,status:"updated",oldCommit:V0(q.commitHash),newCommit:V0(U),securityVerdict:H}}let M=`${F}.bak-${Date.now()}`;try{await U8(F,M),await W8(J,F,{recursive:!0}),await lq(M,{recursive:!0,force:!0})}catch(T){try{await lq(F,{recursive:!0,force:!0}),await U8(M,F)}catch{}return{name:$,status:"failed",reason:`Atomic swap failed: ${T.message}`}}return await(Q?.writeLockEntryFn??v$)($,{...q,commitHash:U,installedAt:new Date().toISOString()}),{name:$,status:"updated",oldCommit:V0(q.commitHash),newCommit:V0(U),securityVerdict:H}}finally{try{await lq(J,{recursive:!0,force:!0})}catch{}}}async function B8($,q,Z){let Q=Z?.readLockFn??m0,X=Z?.checkOutdatedFn??m4,z=Z?.updateSkillFn??nW,J=await Q(),Y=await X({lock:J}),G=Y.entries.filter((V)=>V.status==="outdated"),U=[];if($&&$.length>0){let V=new Set($.map((B)=>B.toLowerCase()));G=G.filter((B)=>V.has(B.name.toLowerCase()));for(let B of $)if(!G.find((_)=>_.name.toLowerCase()===B.toLowerCase()))if(!Y.entries.find((O)=>O.name.toLowerCase()===B.toLowerCase()))E(`updater: skill "${B}" not found in lock file`),U.push(B);else E(`updater: skill "${B}" is already up to date`)}if(G.length===0)return{results:[],updatedCount:0,skippedCount:0,failedCount:0,...U.length>0?{warnings:U}:{}};let H=[];for(let V of G){let B=J.skills[V.name];if(!B)continue;let _=await z(V.name,B,q);H.push(_)}return{results:H,updatedCount:H.filter((V)=>V.status==="updated").length,skippedCount:H.filter((V)=>V.status==="skipped").length,failedCount:H.filter((V)=>V.status==="failed").length,...U.length>0?{warnings:U}:{}}}function V0($){if(!$||$==="unknown")return"unknown";return $.slice(0,7)}function K8($,q){if($.entries.length===0)return"No skills installed.";let Z=(V)=>V,Q=q?W.red:Z,X=q?W.green:Z,z=q?W.yellow:Z,J=q?W.dim:Z,Y=`${"Skill".padEnd(22)}${"Installed".padEnd(14)}${"Latest".padEnd(14)}Source`,G="─".repeat(60),U=[Y,G];for(let V of $.entries){let B=V.name.padEnd(22),_=V.installedCommit.padEnd(14),O,K;switch(V.status){case"outdated":O=Q(V.latestCommit.padEnd(14)),K=V.sourceType;break;case"up-to-date":O=X(V.latestCommit.padEnd(14)),K=J("(up to date)");break;case"untracked":O=z("untracked".padEnd(14)),K=z("untracked");break;case"error":O=J("error".padEnd(14)),K=J(V.error||"error");break}U.push(`${B}${_}${O}${K}`)}U.push("");let H=[];if($.outdatedCount>0)H.push(Q(`${$.outdatedCount} outdated`));if($.upToDateCount>0)H.push(X(`${$.upToDateCount} up to date`));if($.untrackedCount>0)H.push(z(`${$.untrackedCount} untracked`));if($.errorCount>0)H.push(J(`${$.errorCount} error`));return U.push(H.join(", ")),U.join(`
|
|
200
|
+
`)}function _8($){return JSON.stringify({skills:$.entries.map((q)=>({name:q.name,installed:q.installedCommit,latest:q.latestCommit,source:q.sourceType,status:q.status,...q.error?{error:q.error}:{}})),summary:{outdated:$.outdatedCount,upToDate:$.upToDateCount,untracked:$.untrackedCount,errors:$.errorCount}},null,2)}function O8($){return JSON.stringify({results:$.results.map((q)=>({name:q.name,status:q.status,...q.reason?{reason:q.reason}:{},...q.oldCommit?{oldCommit:q.oldCommit}:{},...q.newCommit?{newCommit:q.newCommit}:{},...q.securityVerdict?{securityVerdict:q.securityVerdict}:{}})),summary:{updated:$.updatedCount,skipped:$.skippedCount,failed:$.failedCount}},null,2)}import{execFile as zV}from"child_process";import{promisify as JV}from"util";import{access as L8,readFile as I8,readdir as YV,writeFile as GV,rm as UV,stat as T8}from"fs/promises";import{join as p4}from"path";import{homedir as WV}from"os";import{constants as F8}from"fs";import{access as aW,realpath as iW,stat as oW}from"fs/promises";import{constants as sW}from"fs";import{delimiter as tW,resolve as rW,sep as eW}from"path";var $V="asm";function qV($){if(!$)return[];let q=new Set,Z=[];for(let Q of $.split(tW)){let X=Q.trim();if(!X)continue;let z=X.endsWith(eW)?X.slice(0,-1):X;if(q.has(z))continue;q.add(z),Z.push(z)}return Z}async function ZV($){try{if(!(await oW($)).isFile())return!1}catch{return!1}try{return await aW($,sW.X_OK),!0}catch{return!1}}async function QV($){try{return await iW($)}catch{return $}}async function XV($=process.env.PATH){let q=new Set,Z=[];for(let Q of qV($)){let X=rW(Q,$V);if(!await ZV(X))continue;let z=await QV(X);if(q.has(z))continue;q.add(z),Z.push({path:X,realPath:z})}return Z}async function aq($=process.env.PATH){let q=await XV($);if(q.length===0)return{resolved:null,shadowed:[]};let[Z,...Q]=q;return{resolved:Z,shadowed:Q}}var Y$=JV(zV);async function VV($){let q=$?.execFn??Y$;try{let{stdout:Z}=await q("git",["--version"],{timeout:5000});return{name:"Git available",status:"pass",message:Z.trim().replace("git version ","")}}catch{return{name:"Git available",status:"fail",message:"git not found",fix:"Install git: https://git-scm.com/downloads"}}}async function HV($){let q=$?.execFn??Y$;try{let{stdout:Z}=await q("git",["--version"],{timeout:5000}),Q=Z.match(/(\d+)\.(\d+)/);if(!Q)return{name:"Git version",status:"warn",message:"Could not parse git version",fix:"Upgrade git: https://git-scm.com/downloads"};let X=parseInt(Q[1],10),z=parseInt(Q[2],10);if(X>2||X===2&&z>=20)return{name:"Git version",status:"pass",message:`${X}.${z} (>= 2.20)`};return{name:"Git version",status:"fail",message:`${X}.${z} (requires >= 2.20)`,fix:"Upgrade git: https://git-scm.com/downloads"}}catch{return{name:"Git version",status:"pass",message:"Skipped — git not available"}}}async function BV($){let q=$?.execFn??Y$;try{let{stdout:Z}=await q("gh",["--version"],{timeout:5000}),Q=Z.trim().split(`
|
|
201
|
+
`)[0],X=Q.match(/(\d+\.\d+\.\d+)/);return{name:"GitHub CLI available",status:"pass",message:X?X[1]:Q}}catch{return{name:"GitHub CLI available",status:"fail",message:"gh not found",fix:"Install GitHub CLI: https://cli.github.com"}}}async function KV($){let q=$?.execFn??Y$;try{let{stdout:Z}=await q("gh",["auth","status"],{timeout:1e4}),Q=Z.match(/Logged in to .+ account (\S+)/);return{name:"GitHub CLI authenticated",status:"pass",message:Q?Q[1]:"authenticated"}}catch(Z){let X=(Z?.stderr??"").match(/Logged in to .+ account (\S+)/);if(X)return{name:"GitHub CLI authenticated",status:"pass",message:X[1]};return{name:"GitHub CLI authenticated",status:"fail",message:"Not authenticated",fix:"Run: gh auth login"}}}async function _V($){let q=$?.execFn??Y$;try{let{stdout:Z}=await q("node",["--version"],{timeout:5000}),Q=Z.trim().replace(/^v/,"");if(parseInt(Q.split(".")[0],10)>=18)return{name:"Node.js version",status:"pass",message:Q};return{name:"Node.js version",status:"fail",message:`${Q} (requires >= 18.0)`,fix:"Upgrade Node.js: https://nodejs.org"}}catch{return{name:"Node.js version",status:"fail",message:"node not found",fix:"Install Node.js >= 18: https://nodejs.org"}}}async function OV($){try{let q=p4($,".asm-doctor-write-test");return await GV(q,"test","utf-8"),await UV(q),{writable:!0,exists:!0}}catch{}try{return await L8($,F8.W_OK),{writable:!0,exists:!0}}catch{}try{return await L8($,F8.F_OK),{writable:!1,exists:!0}}catch{return{writable:!0,exists:!1}}}async function LV($){let q=$.providers.filter((z)=>z.enabled),Z=0,Q=0;for(let z of q){let J=z0(z.global);if(Q++,(await OV(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 FV(){let $=h$();try{let q=await I8($,"utf-8"),Z=JSON.parse(q),Q=[];if(Z.version===void 0)Q.push("version");if(!Array.isArray(Z.providers))Q.push("providers");if(Q.length>0)return{name:"Config file valid",status:"fail",message:`Missing required fields: ${Q.join(", ")}`,fix:"Run: asm init"};return{name:"Config file valid",status:"pass",message:"OK"}}catch(q){if(q?.code==="ENOENT")return{name:"Config file valid",status:"pass",message:"No config file (using defaults)"};return{name:"Config file valid",status:"fail",message:"Corrupted or unreadable config",fix:"Run: asm init, or delete corrupted config"}}}async function AV(){let $=A8();try{let q=await I8($,"utf-8"),Z=JSON.parse(q);if(Z.version!==1||typeof Z.skills!=="object")return{name:"Lock file integrity",status:"fail",message:"Invalid lock file schema",fix:"Run: asm install to regenerate"};let Q=Z.skills,X=Object.entries(Q),z=["source","installedAt","provider"],J=[];for(let[Y,G]of X){if(typeof G!=="object"||G===null){J.push(Y);continue}let U=G;for(let H of z)if(!U[H]){J.push(Y);break}}if(J.length>0)return{name:"Lock file integrity",status:"warn",message:`${X.length} skills tracked, ${J.length} with missing fields`,fix:"Run: asm install to regenerate"};return{name:"Lock file integrity",status:"pass",message:`${X.length} skills tracked`}}catch(q){if(q?.code==="ENOENT")return{name:"Lock file integrity",status:"pass",message:"No lock file (first-time user)"};return{name:"Lock file integrity",status:"fail",message:"Corrupted lock file",fix:"Run: asm install to regenerate"}}}async function IV(){try{let $=await fetch(w4,{method:"HEAD",signal:AbortSignal.timeout(5000)});if($.ok)return{name:"Registry reachable",status:"pass",message:"OK"};return{name:"Registry reachable",status:"fail",message:`HTTP ${$.status}`,fix:"Check network connection or proxy settings"}}catch{return{name:"Registry reachable",status:"fail",message:"Network error",fix:"Check network connection or proxy settings"}}}async function TV($,q){let Z=Object.entries(q.skills);if(Z.length===0)return{name:"Installed skills intact",status:"pass",message:"No skills in lock file"};let Q=[];for(let[J,Y]of Z){let G=$.providers.find((V)=>V.name===Y.provider);if(!G){Q.push(J);continue}let U=z0(G.global),H=p4(U,J);try{if(!(await T8(H)).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 MV($,q){let Z=new Set(Object.keys(q.skills)),Q=[];for(let X of $.providers.filter((z)=>z.enabled)){let z=z0(X.global);try{let J=await YV(z);for(let Y of J)try{if((await T8(p4(z,Y))).isDirectory()&&!Z.has(Y))Q.push(Y)}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 RV($){let q=$?.execFn??Y$;try{let{stdout:Z}=await q("df",["-Pk",WV()],{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,Y=J/1024;if(J>100)return{name:"Disk space",status:"pass",message:`OK (${Y>=1?`${Y.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 jV(){try{let $=await aq();if($.shadowed.length===0){if(!$.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 ${$.resolved.path}`}}let q=$.resolved,Z=$.shadowed[0].path,Q=$.shadowed.length>1?` (+${$.shadowed.length-1} more)`:"";return{name:"No PATH shadowing",status:"warn",message:`resolved ${q.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($){return{name:"No PATH shadowing",status:"warn",message:`Could not scan PATH: ${$?.message??$}`}}}async function M8(){let $=await h(),q=await m0(),Q=(await Promise.allSettled([VV(),HV(),BV(),KV(),_V(),LV($),FV(),AV(),IV(),TV($,q),MV($,q),RV(),jV()])).map((Y,G)=>{if(Y.status==="fulfilled")return Y.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"][G],status:"fail",message:`Check threw: ${Y.reason}`}}),X=Q.filter((Y)=>Y.status==="pass").length,z=Q.filter((Y)=>Y.status==="warn").length,J=Q.filter((Y)=>Y.status==="fail").length;return{checks:Q,passed:X,warnings:z,failures:J}}var wV={pass:"✅",warn:"⚠️ ",fail:"❌"};function R8($){let q=["Checking your environment...",""];for(let Z of $.checks){let X=` ${wV[Z.status]} ${Z.name}${Z.message?` (${Z.message})`:""}`;if(q.push(X),Z.fix&&Z.status!=="pass"){let z;if(Z.fix.startsWith("Run: "))z=Z.fix;else if(/^[a-z/~]/.test(Z.fix))z=`Run: ${Z.fix}`;else z=`Fix: ${Z.fix}`;q.push(` → ${z}`)}}return q.push(""),q.push(`${$.passed} passed, ${$.warnings} warning${$.warnings!==1?"s":""}, ${$.failures} error${$.failures!==1?"s":""}`),q.join(`
|
|
203
|
+
`)}function j8($){return JSON.stringify({checks:$.checks.map((q)=>({name:q.name,status:q.status,message:q.message,...q.fix?{fix:q.fix}:{}})),summary:{passed:$.passed,warnings:$.warnings,failures:$.failures}},null,2)}import{readFile as c4,writeFile as NV,stat as G$,copyFile as DV,readdir as PV}from"fs/promises";import{join as U$,resolve as l4,basename as O0,isAbsolute as n4}from"path";var w8=["name","description","version","license","creator","compatibility","allowed-tools","effort","tags","metadata"],N8=["add","analyze","audit","build","check","configure","convert","create","debug","deploy","detect","edit","evaluate","explain","export","extract","fetch","find","fix","format","generate","identify","improve","index","inspect","install","list","manage","migrate","optimize","parse","plan","prepare","publish","refactor","remove","rename","report","research","review","run","scaffold","scan","score","search","set","setup","show","summarize","sync","test","transform","translate","update","validate","verify","write"],CV=["confirm","confirmation","error","errors","fail","failure","caution","warning","prerequisite","prerequisites","requires","requirements","rollback","dry-run","dry run","safety","validate","validation","check","backup"],EV=["acceptance criteria","expected output","expected result","edge case","edge cases","test","tests","testing","verify","verification","assert","example input","example output","given","then"],SV=["reference","references","see","template","templates","script","scripts","helper","helpers","link"],bV=["when to use","quick start","overview","instructions","steps","workflow","phases","progressive"];function C8($){let q=$.split(`
|
|
204
|
+
`);if(q.length===0||q[0].trim()!=="---")return{rawFrontmatter:null,body:$};for(let Z=1;Z<q.length;Z++)if(q[Z].trim()==="---"){let Q=q.slice(1,Z).join(`
|
|
205
|
+
`),X=q.slice(Z+1).join(`
|
|
206
|
+
`);return{rawFrontmatter:Q,body:X}}return{rawFrontmatter:q.slice(1).join(`
|
|
207
|
+
`),body:""}}function E8($){if(!$)return 0;return $.split(`
|
|
208
|
+
`).length}function a4($){if(!$)return 0;return $.split(/\s+/).map((q)=>q.trim()).filter(Boolean).length}function xV($,q=1){return($.match(/^#{1,6}\s+\S/gm)||[]).length>=q}function iq($,q){let Z=$.toLowerCase();return q.filter((Q)=>Z.includes(Q))}function fV($){return/```[\s\S]+?```/m.test($)}function yV($){return/^\s*[-*]\s+\S/m.test($)||/^\s*\d+\.\s+\S/m.test($)}function kV($,q,Z){let Q=[],X=[],z=0;if(Z!==null)z+=2,Q.push("Has YAML frontmatter block.");else Q.push("SKILL.md has no YAML frontmatter."),X.push("Add a YAML frontmatter block delimited by `---` with at least `name` and `description` fields.");let J=Boolean($.name&&$.name.trim()),Y=Boolean($.description&&$.description.trim());if(J)z+=1.5;else Q.push("Missing required field: name."),X.push("Add `name:` to frontmatter (use the skill directory name).");if(Y)z+=1.5;else Q.push("Missing required field: description."),X.push("Add a one-line `description:` to frontmatter.");let G=J0($);if(G&&G!=="0.0.0")z+=1;else Q.push("Missing or default version."),X.push("Set `metadata.version` (or top-level `version`) using semver (e.g. 0.1.0).");if(Boolean($.creator||$["metadata.creator"]))z+=1;else Q.push("Missing `creator`."),X.push("Add a `creator` field so users know who authored and maintains the skill.");if(Boolean($.license))z+=1;else Q.push("Missing `license`."),X.push("Add a `license` field (e.g. `license: MIT`).");let B=q.trim().length>=20,_=xV(q,1);if(B)z+=1,Q.push("Body has meaningful content.");else Q.push("Body content is too short (<20 chars of instructions)."),X.push("Flesh out the markdown body with at least one paragraph of instructions for the agent.");if(_)z+=1,Q.push("Body uses markdown headings.");else Q.push("Body has no markdown headings."),X.push("Add section headings (e.g. `## When to Use`, `## Instructions`) so the agent can navigate the skill quickly.");return{id:"structure",name:"Structure & completeness",score:Math.round(z),max:10,findings:Q,suggestions:X}}function vV($,q){let Z=[],Q=[],X=0,z=($.description||"").trim();if(!z)return Z.push("No description."),Q.push("Write a one-sentence description that says specifically what the skill does and when to use it."),{id:"description",name:"Description quality",score:0,max:10,findings:Z,suggestions:Q};let J=a4(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 Y=z.split(/\s+/)[0]?.toLowerCase().replace(/[^\w-]/g,"");if(Boolean(Y&&(N8.includes(Y)||N8.includes(Y.replace(/s$/,"")))))X+=3,Z.push("Starts with an action verb.");else Z.push(`Does not start with a recognized action verb (got "${Y??""}").`),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 hV($,q){let Z=[],Q=[],X=0,z=iq(q,bV);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(yV(q))X+=2,Z.push("Uses lists or numbered steps.");else Z.push("No lists or steps detected."),Q.push("Use bulleted or numbered steps to narrow the agent's degrees of freedom.");let J=fV(q),Y=/\bexample\b/i.test(q);if(J&&Y)X+=2,Z.push("Includes example code block.");else if(J||Y)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 G=(q.match(/^\s*[-*0-9.]*\s*(Do|Use|Run|Call|Check|Validate|Return|Emit|Write|Read|Ask|Confirm|Avoid|Never|Always)\b/gim)||[]).length;if(G>=3)X+=2,Z.push(`Uses imperative voice (${G} cues).`);else if(G>=1)X+=1,Q.push("Favor imperative voice (Do / Use / Avoid / Never) to narrow the agent's choices.");else Q.push('Rewrite instructions in the imperative mood — e.g. "Run `git status` first" instead of "you might want to run".');let U=a4(q);if(U>=80&&U<=3000)X+=1,Z.push(`Body length within healthy range (${U} words).`);else if(U<80)Z.push(`Body is very short (${U} words).`),Q.push("Expand the instructions; an underspecified skill gives the agent too much freedom.");else Z.push(`Body is very long (${U} words).`),Q.push("Split large content into referenced files; keep SKILL.md focused under ~3000 words.");return{id:"prompt-engineering",name:"Prompt engineering",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function gV($,q){let Z=[],Q=[],X=0,z=a4(q);if(Z.push(`Body is ${z} words.`),z>=120&&z<=1500)X+=4;else if(z>=60&&z<120)X+=2,Q.push("Expand instructions slightly — too little context can push the agent to improvise.");else if(z>1500&&z<=3000)X+=2,Q.push("Consider moving large sections into referenced files (e.g. `references/*.md`) and linking them instead of inlining.");else if(z>3000)X+=0,Q.push("Body is over 3000 words — split long content into referenced files or templates.");let J=iq(q,SV);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 G=(q.match(/```[\s\S]+?```/g)||[]).filter((U)=>E8(U)>60);if(G.length===0)X+=2,Z.push("No oversized code blocks.");else Z.push(`${G.length} code block(s) longer than 60 lines.`),Q.push("Move large code blocks into referenced template files; link to them from SKILL.md.");if(/\btoken\b|\bbudget\b|\bcontext window\b/i.test(q))X+=1,Z.push("Mentions tokens/budget/context window.");return{id:"context-efficiency",name:"Context efficiency",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function uV($,q){let Z=[],Q=[],X=0,z=iq(q,CV);if(z.length>=4)X+=4,Z.push(`Covers multiple safety cues (${z.slice(0,4).join(", ")}).`);else if(z.length>=2)X+=2,Z.push(`Mentions a few safety cues: ${z.join(", ")}.`),Q.push("Add explicit error-handling and confirmation steps so the agent knows how to recover from failures.");else if(z.length===1)X+=1,Q.push('Expand the safety section — include prerequisites, validation steps, and what to do "on error".');else Q.push("Describe prerequisites, confirmation prompts, and error-handling steps to reduce blast radius.");let J=/\b(rm\s|delete|remove|drop|force|overwrite|destructive)\b/i.test(q),Y=/\bconfirm\b|\bdry-?run\b|\bare you sure\b|\bbackup\b/i.test(q);if(J&&Y)X+=3,Z.push("Destructive actions paired with confirmation/dry-run.");else if(J)Z.push("References destructive actions without explicit confirmation/dry-run."),Q.push("Pair any destructive command with an explicit confirmation prompt, dry-run flag, or backup step.");else X+=1.5;if(/\bprerequisit/i.test(q)||/\brequire/i.test(q)||/\bdepend/i.test(q))X+=3,Z.push("Declares prerequisites or requirements.");else Z.push("No prerequisites / requirements section."),Q.push('Add a "## Prerequisites" block listing required tools, credentials, and environment state.');return{id:"safety",name:"Safety & guardrails",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function mV($,q){let Z=[],Q=[],X=0,z=iq(q,EV);if(z.length>=4)X+=5,Z.push(`Many testability cues present (${z.slice(0,4).join(", ")}).`);else if(z.length>=2)X+=3,Z.push(`Some testability cues: ${z.join(", ")}.`),Q.push('Add an "## Acceptance Criteria" block listing verifiable outputs or checklist items.');else if(z.length===1)X+=1,Q.push('Add concrete "expected output" examples so the agent can self-check.');else Q.push('Add a "## Acceptance Criteria" section with testable statements (e.g. "produces a JSON report with overall_score").');if(/expected\s+(output|result|response)/i.test(q))X+=3,Z.push("Describes expected output/result.");else Q.push('Include an "Expected output" example so reviewers and the agent can verify correctness.');if(/\bedge case|gotcha|pitfall|limitation/i.test(q))X+=2,Z.push("Mentions edge cases or limitations.");else Q.push('Add a short "Edge cases" list to describe inputs the skill should reject or handle carefully.');return{id:"testability",name:"Testability",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function pV($,q){let Z=[],Q=[],X=0,z=($.name||"").trim();if(z){let G=/^[a-z][a-z0-9-]*$/.test(z),U=z.length<=40;if(G&&U)X+=4,Z.push(`name "${z}" follows kebab-case convention.`);else{if(!G)Z.push(`name "${z}" is not lowercase kebab-case.`),Q.push(`Rename to lowercase kebab-case (e.g. "${z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}").`);if(!U)Z.push(`name is ${z.length} chars; keep it <= 40.`)}}else Q.push("Add a kebab-case `name` (e.g. `my-skill`).");let J=q.match(/^#{1,6}\s+(.+)$/gm)||[];if(J.length>0)if(J.filter((H)=>/^#{1,6}\s+([A-Z][a-z]+|Use|How|When|Workflow|Instructions|Examples|Steps|Acceptance)/.test(H)).length/J.length>=0.5)X+=3,Z.push("Most headings use action/imperative labels.");else X+=1,Q.push("Rename body headings to action-oriented labels (e.g. `## Instructions`, `## When to Use`).");if(!/(?:\s\s|\bTODO\b|\bFIXME\b|\?{2,})/.test($.description||""))X+=2,Z.push("Description looks clean (no TODO/FIXME/stray noise).");else Q.push("Clean up description — remove TODOs, FIXMEs, double spaces, or trailing punctuation.");return{id:"naming",name:"Naming & conventions",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function g$($){let{content:q,skillPath:Z,skillMdPath:Q}=$,X=$0(q),{rawFrontmatter:z,body:J}=C8(q),Y=[kV(X,J,z),vV(X,J),hV(X,J),gV(X,J),uV(X,J),mV(X,J),pV(X,J)];if(X.name&&O0(Z)===X.name){let O=Y.find((K)=>K.id==="naming");if(O.score<O.max)O.score=Math.min(O.max,O.score+1),O.findings.push("Directory name matches frontmatter `name`.")}let G=Y.reduce((O,K)=>O+K.score,0),U=Y.reduce((O,K)=>O+K.max,0),H=Math.round(G/U*100),V="F";if(H>=90)V="A";else if(H>=80)V="B";else if(H>=65)V="C";else if(H>=50)V="D";let B=[],_=[...Y].sort((O,K)=>O.score/O.max-K.score/K.max);for(let O of _){for(let K of O.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:Y,overallScore:H,grade:V,topSuggestions:B,frontmatter:X}}async function S8($){let q=n4($)?$:l4($),Z;try{Z=await G$(q)}catch{throw Error(`Skill path does not exist: ${q}`)}let Q,X;if(Z.isFile())return Q=q,X=await c4(Q,"utf-8"),g$({content:X,skillPath:O0(q)==="SKILL.md"?O0(q):q,skillMdPath:Q});if(!Z.isDirectory())throw Error(`Skill path is not a directory or file: ${q}`);Q=U$(q,"SKILL.md");try{X=await c4(Q,"utf-8")}catch{throw Error(`SKILL.md not found in ${q}. Run "asm init" to create one.`)}return g$({content:X,skillPath:q,skillMdPath:Q})}function dV($){if($<=20)return"low";if($<=80)return"medium";if($<=250)return"high";return"max"}function cV($){let q=$.split(`
|
|
209
|
+
`),Z=[],Q=[],X=0;while(X<q.length){let U=q[X];if(!U.trim()){X++;continue}let V=U.match(/^([A-Za-z_][\w-]*):\s*(.*)$/);if(!V)return{newFrontmatter:$,changed:!1};let B=V[1],_=V[2];if(_===""||_===">"||_==="|"){let O=[U];X++;while(X<q.length){let K=q[X];if(K.trim()===""){O.push(K),X++;continue}if(/^\s+/.test(K))O.push(K),X++;else break}Q.push({key:B,text:O.join(`
|
|
210
|
+
`)})}else Z.push({key:B,text:U}),X++}let z=(U)=>{let H=w8.indexOf(U);return H===-1?w8.length+1:H},J=[...Z].sort((U,H)=>{let V=z(U.key),B=z(H.key);if(V!==B)return V-B;return Z.indexOf(U)-Z.indexOf(H)}),Y=J.some((U,H)=>U!==Z[H]);return{newFrontmatter:[...J.map((U)=>U.text),...Q.map((U)=>U.text)].join(`
|
|
211
|
+
`),changed:Y}}function lV($,q={}){let Z=[],Q=[],X=$.replace(/\r\n/g,`
|
|
212
|
+
`);if(X!==$)Z.push({id:"normalise-line-endings",description:"Convert CRLF line endings to LF."});let z=X.split(`
|
|
213
|
+
`),J=z.map((L)=>L.replace(/[ \t]+$/g,""));if(J.some((L,F)=>L!==z[F]))Z.push({id:"strip-trailing-whitespace",description:"Strip trailing whitespace from lines."});X=J.join(`
|
|
214
|
+
`);let{rawFrontmatter:Y,body:G}=C8(X),U=$0(X);if(Y===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 H=Y;if(!Boolean(U.version||U["metadata.version"]))H=d4(H,"version","0.1.0"),Z.push({id:"add-missing-version",description:"Add `version: 0.1.0`."});if(!Boolean(U.creator||U["metadata.creator"])){let L=q.gitAuthor?.trim();if(L)H=d4(H,"creator",L),Z.push({id:"add-missing-creator",description:`Add \`creator: ${L}\` from git config.`});else Q.push({id:"add-missing-creator",description:"Missing `creator` — no git user.name found to fill in safely."})}if(!U.effort){let L=dV(E8(G));H=d4(H,"effort",L),Z.push({id:"infer-missing-effort",description:`Infer \`effort: ${L}\` from body size.`})}if(!U.description)Q.push({id:"missing-description",description:"Missing `description` — content-level fix, left to the author."});let _=cV(H);if(_.changed)Z.push({id:"reorder-frontmatter",description:"Reorder frontmatter fields to canonical order."}),H=_.newFrontmatter;let O=G.replace(/^\n+/,""),K=`---
|
|
215
|
+
${H.replace(/^\n+|\n+$/g,"")}
|
|
216
216
|
---
|
|
217
217
|
|
|
218
|
-
${
|
|
218
|
+
${O}`;if(!K.endsWith(`
|
|
219
219
|
`))K+=`
|
|
220
|
-
`;if(K
|
|
221
|
-
`));return{newContent:K,applied:Z,skipped:Q}}function
|
|
220
|
+
`;if(K===$.replace(/\r\n/g,`
|
|
221
|
+
`));return{newContent:K,applied:Z,skipped:Q}}function d4($,q,Z){if(new RegExp(`^${q}:\\s*`,"m").test($))return $;let X=/[:#{}\[\],&*?|<>=!%@`"']/.test(Z)?JSON.stringify(Z):Z,z=$.length===0||$.endsWith(`
|
|
222
222
|
`)?"":`
|
|
223
|
-
`;return`${
|
|
224
|
-
`}function
|
|
225
|
-
`),X
|
|
226
|
-
`),z=[`--- a/${Z}`,`+++ b/${Z}`],J=0;while(J<Q.length&&J<X.length&&Q[J]===X[J])J++;let
|
|
227
|
-
`)}async function
|
|
228
|
-
`)}function
|
|
229
|
-
`);if(
|
|
230
|
-
`)}
|
|
231
|
-
`)
|
|
232
|
-
|
|
233
|
-
|
|
223
|
+
`;return`${$}${z}${q}: ${X}
|
|
224
|
+
`}function nV($,q,Z="SKILL.md"){if($===q)return"";let Q=$.split(`
|
|
225
|
+
`),X=q.split(`
|
|
226
|
+
`),z=[`--- a/${Z}`,`+++ b/${Z}`],J=0;while(J<Q.length&&J<X.length&&Q[J]===X[J])J++;let Y=0;while(Y<Q.length-J&&Y<X.length-J&&Q[Q.length-1-Y]===X[X.length-1-Y])Y++;let G=Q.slice(J,Q.length-Y),U=X.slice(J,X.length-Y),H=J+1,V=J+1;z.push(`@@ -${H},${G.length} +${V},${U.length} @@`);let B=Q.slice(Math.max(0,J-3),J).map((O)=>` ${O}`),_=Q.slice(Q.length-Y,Math.min(Q.length,Q.length-Y+3)).map((O)=>` ${O}`);z.push(...B);for(let O of G)z.push(`-${O}`);for(let O of U)z.push(`+${O}`);return z.push(..._),z.join(`
|
|
227
|
+
`)}async function b8($,q){let Z=n4($)?$:l4($),Q,X=await G$(Z).catch(()=>null);if(!X)throw Error(`Skill path does not exist: ${Z}`);if(X.isFile())Q=Z;else if(X.isDirectory())Q=U$(Z,"SKILL.md");else throw Error(`Skill path is not a directory or file: ${Z}`);let z;try{z=await c4(Q,"utf-8")}catch{throw Error(`SKILL.md not found at ${Q}.`)}let J=lV(z,{gitAuthor:q.gitAuthor}),Y=nV(z,J.newContent),G=null;if(!q.dryRun&&J.newContent!==z)G=`${Q}.bak`,await DV(Q,G),await NV(Q,J.newContent,"utf-8");return{report:g$({content:q.dryRun?z:J.newContent,skillPath:Z,skillMdPath:Q}),applied:J.applied,skipped:J.skipped,diff:Y,dryRun:q.dryRun,backupPath:G,skillMdPath:Q}}async function x8(){try{let $=Bun.spawn(["git","config","--global","--get","user.name"],{stdout:"pipe",stderr:"pipe"}),q=await new Response($.stdout).text();if(await $.exited!==0)return null;let Q=q.trim();return Q?Q:null}catch{return null}}function aV($,q,Z=20){let Q=Math.round($/q*Z);return"█".repeat(Q)+"░".repeat(Math.max(0,Z-Q))}function oq($){let q=[];q.push(`Skill evaluation: ${$.skillPath}`),q.push(`SKILL.md: ${$.skillMdPath}`),q.push(""),q.push(`Overall score: ${$.overallScore}/100 (${$.grade})`);let Z=($.providers??[]).filter((Q)=>Q.id!=="quality");for(let Q of Z){let X=Q.passed?"pass":"fail",z=`${Q.id}@${Q.version}`;q.push(` ${z}: ${Q.score}/100 ${X}`)}q.push(""),q.push("Categories:");for(let Q of $.categories)q.push(` ${Q.name.padEnd(28)} ${String(Q.score).padStart(2)}/${Q.max} ${aV(Q.score,Q.max)}`);if(q.push(""),$.topSuggestions.length>0){q.push("Top suggestions:");for(let Q of $.topSuggestions)q.push(` • ${Q}`)}else q.push("No suggestions — skill looks great.");for(let Q of Z){if(Q.findings.length===0)continue;q.push(""),q.push(`${Q.id}@${Q.version} findings:`);for(let X of Q.findings)q.push(` [${X.severity}] ${X.message}`)}return q.join(`
|
|
228
|
+
`)}function f8($){return JSON.stringify($,null,2)}function y8($){let q=[];if($.applied.length===0&&$.skipped.length===0)return q.push("No fixes needed — SKILL.md is already clean."),q.join(`
|
|
229
|
+
`);if($.applied.length>0){q.push(`${$.dryRun?"Would apply":"Applied"} ${$.applied.length} fix(es):`);for(let Z of $.applied)q.push(` • ${Z.description}`)}if($.skipped.length>0){q.push(""),q.push(`Skipped ${$.skipped.length} issue(s) (not auto-fixable):`);for(let Z of $.skipped)q.push(` • ${Z.description}`)}if($.diff)q.push(""),q.push("Diff:"),q.push($.diff);if(!$.dryRun&&$.backupPath)q.push(""),q.push(`Backup: ${$.backupPath}`);return q.join(`
|
|
230
|
+
`)}async function iV($){let q;try{q=await PV($)}catch{return[]}let Z=[];for(let Q of q){if(Q.startsWith(".")||Q==="node_modules"||Q==="dist"||Q==="build")continue;let X=U$($,Q),z;try{z=await G$(X)}catch{continue}if(!z.isDirectory())continue;let J=U$(X,"SKILL.md");try{if((await G$(J)).isFile())Z.push(X)}catch{}}return Z.sort((Q,X)=>O0(Q).localeCompare(O0(X))),Z}async function D8($){let q=U$($,"SKILL.md");try{if((await G$(q)).isFile())return{kind:"single",skillDirs:[$]}}catch{}let Z=await iV($);if(Z.length>0)return{kind:"collection",skillDirs:Z};return{kind:"none",skillDirs:[]}}function i4($){if(!$)return!1;if($.startsWith("github:"))return!0;if(/^https?:\/\/github\.com\//i.test($))return!0;return!1}function P8($){return{skillPath:$,skillMdPath:U$($,"SKILL.md"),label:O0($)}}async function k8($,q={}){if(!$)throw Error("resolveEvalInput: input must be a non-empty string");if(i4($)){if(!q.fetchRemote)throw Error(`Remote evaluation is not available in this context: "${$}"`);let z=await q.fetchRemote($),J;try{J=await D8(z.rootDir)}catch(Y){throw await z.cleanup().catch(()=>{}),Y}if(J.kind==="none")throw await z.cleanup().catch(()=>{}),Error(`No SKILL.md found at ${z.rootDir} (source: ${$}). The location is neither a single skill nor a skill collection.`);return{targets:J.skillDirs.map(P8),isCollection:J.kind==="collection",cleanup:z.cleanup,provenance:{input:$,remote:!0,sourceRef:z.sourceRef,commitSha:z.commitSha,tempPath:z.rootDir}}}let Z=n4($)?$:l4($),Q;try{Q=await G$(Z)}catch{throw Error(`Skill path does not exist: ${Z}`)}if(Q.isFile())return{targets:[{skillPath:O0(Z)==="SKILL.md"?O0(Z):Z,skillMdPath:Z,label:O0(Z)}],isCollection:!1,cleanup:async()=>{},provenance:{input:$,remote:!1,sourceRef:null}};if(!Q.isDirectory())throw Error(`Skill path is not a directory or file: ${Z}`);let X=await D8(Z);if(X.kind==="none")throw Error(`No SKILL.md found in ${Z}. Pass a skill directory, a SKILL.md file, or a collection root with SKILL.md in its children.`);return{targets:X.skillDirs.map(P8),isCollection:X.kind==="collection",cleanup:async()=>{},provenance:{input:$,remote:!1,sourceRef:null}}}function v8($){let q=$.filter((H)=>H.report!==null),Z=$.length,Q=Z-q.length;if(q.length===0)return{total:Z,succeeded:0,failed:Q,meanScore:null,top:null,bottom:null};let X=q.map((H)=>H.report.overallScore),z=X.reduce((H,V)=>H+V,0)/X.length,J=Math.round(z),Y=[...q].sort((H,V)=>V.report.overallScore-H.report.overallScore),G=Y[0],U=Y[Y.length-1];return{total:Z,succeeded:q.length,failed:Q,meanScore:J,top:{label:G.label,score:G.report.overallScore},bottom:{label:U.label,score:U.report.overallScore}}}async function h8($,q,Z){let Q=Array($.length),X=0,z=Math.max(1,Math.floor(q)),J=[],Y=Math.min(z,$.length);for(let G=0;G<Y;G++)J.push((async()=>{while(!0){let U=X++;if(U>=$.length)break;Q[U]=await Z($[U],U)}})());return await Promise.all(J),Q}function g8($,q=28){let Z=[];if(Z.push(""),Z.push("Batch summary:"),Z.push(` Skills evaluated: ${$.aggregate.succeeded}/${$.aggregate.total}`+($.aggregate.failed>0?` (${$.aggregate.failed} failed)`:"")),$.aggregate.meanScore!==null)Z.push(` Mean score: ${$.aggregate.meanScore}/100`);if($.aggregate.top)Z.push(` Top: ${$.aggregate.top.label} (${$.aggregate.top.score}/100)`);if($.aggregate.bottom&&$.aggregate.bottom.label!==$.aggregate.top?.label)Z.push(` Bottom: ${$.aggregate.bottom.label} (${$.aggregate.bottom.score}/100)`);if($.provenance.remote){if($.provenance.sourceRef)Z.push(` Source: ${$.provenance.sourceRef}`);if($.provenance.commitSha)Z.push(` Commit: ${$.provenance.commitSha}`);if($.provenance.tempPath)Z.push(` Fetched to: ${$.provenance.tempPath}`)}return Z.join(`
|
|
231
|
+
`)}function u8($){return{provenance:{input:$.provenance.input,remote:$.provenance.remote,source_ref:$.provenance.sourceRef??null,commit_sha:$.provenance.commitSha??null,temp_path:$.provenance.tempPath??null},aggregate:{total:$.aggregate.total,succeeded:$.aggregate.succeeded,failed:$.aggregate.failed,mean_score:$.aggregate.meanScore,top:$.aggregate.top,bottom:$.aggregate.bottom},results:$.results.map((q)=>({label:q.label,skill_path:q.skillPath,error:q.error,report:q.report?sq(q.report,null):null}))}}function sq($,q=null){return{skill_path:$.skillPath,skill_md_path:$.skillMdPath,overall_score:$.overallScore,grade:$.grade,categories:$.categories.map((Z)=>({id:Z.id,name:Z.name,score:Z.score,max:Z.max,findings:Z.findings,suggestions:Z.suggestions})),top_suggestions:$.topSuggestions,providers:$.providers?.map((Z)=>({id:Z.id,version:Z.version,schemaVersion:Z.schemaVersion,score:Z.score,passed:Z.passed,categories:Z.categories.map((Q)=>({id:Q.id,name:Q.name,score:Q.score,max:Q.max,findings:Q.findings??[]})),findings:Z.findings}))??[],fix:q?{dry_run:q.dryRun,applied:q.applied,skipped:q.skipped,backup_path:q.backupPath,diff:q.diff}:null}}var oV=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function sV($){if(typeof $!=="string")return null;let q=oV.exec($.trim());if(!q)return null;let[,Z,Q,X,z]=q;return{major:Number(Z),minor:Number(Q),patch:Number(X),prerelease:z?z.split("."):[]}}function tV($,q){let Z=sV($);if(!Z)throw Error(`invalid semver: ${q} "${$}"`);return Z}var o4=new Map;function s4($){if(!$||typeof $.id!=="string"||$.id.length===0)throw Error("register: provider.id is required");if(tV($.version,`provider ${$.id} version`),typeof $.schemaVersion!=="number"||!Number.isInteger($.schemaVersion))throw Error(`register: provider ${$.id} schemaVersion must be an integer`);let q=o4.get($.id)??[];if(q.some((Z)=>Z.version===$.version))throw Error(`register: provider ${$.id}@${$.version} already registered`);q.push($),o4.set($.id,q)}function tq(){let $=[];for(let q of o4.values())for(let Z of q)$.push(Z);return $}import{stat as rV}from"fs/promises";var m8="quality",p8="1.0.0",d8=1;function eV($){return $.topSuggestions.map((q)=>({severity:"info",message:q}))}function $H($){return $.categories.map((q)=>({id:q.id,name:q.name,score:q.score,max:q.max}))}var c8={id:m8,version:p8,schemaVersion:d8,description:"Static linter for SKILL.md structure, description, and safety.",async applicable($){try{if(!(await rV($.skillMdPath)).isFile())return{ok:!1,reason:`${$.skillMdPath} is not a file`};return{ok:!0}}catch{return{ok:!1,reason:`SKILL.md not found at ${$.skillMdPath}`}}},async run($,q){let Z=await S8($.skillPath);return{providerId:m8,providerVersion:p8,schemaVersion:d8,score:Z.overallScore,passed:Z.grade!=="F",categories:$H(Z),findings:eV(Z),raw:Z,startedAt:"",durationMs:0}}};import{readFile as qH,stat as ZH}from"fs/promises";var l8="skill-creator",n8="1.0.0",a8=1,QH=new Set(["name","description","license","allowed-tools","metadata","compatibility","effort"]),i8=new Set(["low","medium","high","max"]);function XH($){if(!$.startsWith("---"))return null;let q=$.split(`
|
|
232
|
+
`);if(q.length<3||q[0]?.trim()!=="---")return null;let Z=q.findIndex((Q,X)=>X>0&&Q.trim()==="---");if(Z===-1)return null;return q.slice(1,Z).join(`
|
|
233
|
+
`)}function rq($){return{severity:$.severity,message:$.message,code:$.id,categoryId:"validation"}}function t($,q,Z,Q,X,z){$.push({id:q,label:Z,passed:Q,severity:X,message:z})}function eq($,q,Z){let Q=q.filter((X)=>X.severity==="error");return{skillPath:$.skillPath,skillMdPath:$.skillMdPath,validatedAt:new Date().toISOString(),checkCount:Q.length,passedChecks:Q.filter((X)=>X.passed).length,checks:q,frontmatter:Z}}async function zH($){let q=await qH($.skillMdPath,"utf-8"),Z=[],Q=XH(q);if(Q===null){t(Z,"missing-frontmatter","Frontmatter exists",!1,"error","SKILL.md must start with a YAML frontmatter block.");let F=eq($,Z,null);return{score:0,passed:!1,findings:Z.map(rq),raw:F}}t(Z,"frontmatter-present","Frontmatter exists",!0,"error","SKILL.md contains a YAML frontmatter block.");let X;try{X=y$(Q)}catch(F){t(Z,"invalid-yaml","Frontmatter parses as YAML",!1,"error",`Invalid YAML in frontmatter: ${F?.message??String(F)}`);let A=eq($,Z,null);return{score:0,passed:!1,findings:Z.map(rq),raw:A}}if(!X||typeof X!=="object"||Array.isArray(X)){t(Z,"frontmatter-not-object","Frontmatter is a mapping",!1,"error","Frontmatter must parse to a YAML object.");let F=eq($,Z,null);return{score:0,passed:!1,findings:Z.map(rq),raw:F}}let z=X;t(Z,"frontmatter-object","Frontmatter is a mapping",!0,"error","Frontmatter parses to a YAML object.");let J=Object.keys(z).filter((F)=>!QH.has(F));t(Z,"allowed-keys","Allowed top-level keys only",J.length===0,"error",J.length===0?"Frontmatter uses only the allowed top-level keys.":`Unexpected frontmatter key(s): ${J.sort().join(", ")}.`);let Y=z.name,G=typeof Y==="string"?Y.trim():"";if(t(Z,"name-present","Name is present and non-empty",G.length>0,"error",G.length>0?"Frontmatter includes a non-empty `name`.":"Frontmatter must include a non-empty string `name`."),G.length>0){let F=/^[a-z0-9-]+$/.test(G)&&!G.startsWith("-")&&!G.endsWith("-")&&!G.includes("--")&&G.length<=64;t(Z,"name-kebab-case","Name follows skill-creator naming rules",F,"error",F?"Name follows the skill-creator kebab-case naming rules.":"Name must be kebab-case, avoid consecutive/edge hyphens, and stay within 64 characters.")}let U=z.description,H=typeof U==="string"?U.trim():"";if(t(Z,"description-present","Description is present and non-empty",H.length>0,"error",H.length>0?"Frontmatter includes a non-empty `description`.":"Frontmatter must include a non-empty string `description`."),H.length>0){let F=!H.includes(`
|
|
234
|
+
`)&&!H.includes("\r")&&!H.includes("<")&&!H.includes(">")&&H.length<=1024;t(Z,"description-shape","Description follows skill-creator formatting rules",F,"error",F?"Description is single-line, angle-bracket free, and within 1024 characters.":"Description must be a single line, avoid angle brackets, and stay within 1024 characters.")}let V=z.effort;t(Z,"effort-enum","Effort uses the supported enum",V===void 0||typeof V==="string"&&i8.has(V.trim()),"error",V===void 0||typeof V==="string"&&i8.has(V.trim())?"Effort is omitted or uses a supported value.":"Effort must be one of: low, medium, high, max.");let B=z.compatibility;if(B!==void 0){let F=typeof B==="string"&&B.length<=500;t(Z,"compatibility-shape","Compatibility is a short string",F,"error",F?"Compatibility is a valid short string.":"Compatibility must be a string no longer than 500 characters.")}let _=/don'?t use (?:for|when|if|on)|not (?:for|intended for|suitable for|meant for)\b|skip (?:for|when|if)|avoid (?:using )?(?:for|when|on)|never (?:use )?for\b|only (?:use )?for\b/i.test(H);t(Z,"negative-trigger-clause","Description includes a negative-trigger clause",_,"warning",_?"Description names adjacent cases that should not trigger the skill.":"Description appears to lack a negative-trigger clause; consider naming adjacent cases that should not trigger the skill.");let O=eq($,Z,z),K=O.checkCount===0?100:Math.round(O.passedChecks/O.checkCount*100),L=Z.filter((F)=>!F.passed).map(rq);return{score:K,passed:L.every((F)=>F.severity!=="error"),findings:L,raw:O}}var o8={id:l8,version:n8,schemaVersion:a8,description:"Deterministic SKILL.md validation ported from skill-creator rules.",async applicable($){try{if(!(await ZH($.skillMdPath)).isFile())return{ok:!1,reason:`${$.skillMdPath} is not a file`};return{ok:!0}}catch{return{ok:!1,reason:`SKILL.md not found at ${$.skillMdPath}`}}},async run($,q){let Z=await zH($);return{providerId:l8,providerVersion:n8,schemaVersion:a8,score:Z.score,passed:Z.passed,categories:[{id:"validation",name:"Deterministic validation",score:Z.raw.passedChecks,max:Z.raw.checkCount,findings:Z.findings.length>0?Z.findings:void 0}],findings:Z.findings,raw:Z.raw,startedAt:"",durationMs:0}}};function s8(){s4(c8),s4(o8)}var t8=!1;function $1(){if(t8)return;s8(),t8=!0}function q1(){return $1(),tq()}function r8($){if($ instanceof Error)return $.message;if(typeof $==="string")return $;try{return JSON.stringify($)}catch{return String($)}}function e8($,q,Z,Q,X){let z={severity:"error",message:Q,code:X};return{providerId:$.id,providerVersion:$.version,schemaVersion:$.schemaVersion,score:0,passed:!1,categories:[],findings:[z],raw:void 0,startedAt:q,durationMs:Z}}async function Z1($,q,Z={}){let Q=new Date().toISOString(),X=performance.now(),z={id:$.id,version:$.version,schemaVersion:$.schemaVersion},J=new AbortController;if(Z.signal)if(Z.signal.aborted)J.abort(Z.signal.reason);else Z.signal.addEventListener("abort",()=>J.abort(Z.signal?.reason));let Y=null;if(typeof Z.timeoutMs==="number"&&Z.timeoutMs>0)Y=setTimeout(()=>J.abort(Error("timeout")),Z.timeoutMs);let G={...Z,signal:J.signal};try{let U=await Promise.race([$.run(q,G).then((B)=>({kind:"ok",value:B})),new Promise((B)=>{if(J.signal.aborted){B({kind:"timeout"});return}J.signal.addEventListener("abort",()=>B({kind:"timeout"}))})]),H=Math.max(0,Math.round(performance.now()-X));if(U.kind==="timeout"){let B=J.signal.reason,_=B instanceof Error&&B.message==="timeout"?`provider timed out after ${Z.timeoutMs}ms`:`provider aborted: ${r8(B)}`;return e8(z,Q,H,_,B instanceof Error&&B.message==="timeout"?"timeout":"aborted")}let V=U.value;return{...V,providerId:z.id,providerVersion:z.version,schemaVersion:V.schemaVersion??z.schemaVersion,startedAt:Q,durationMs:H}}catch(U){let H=Math.max(0,Math.round(performance.now()-X));return e8(z,Q,H,r8(U),"provider-threw")}finally{if(Y)clearTimeout(Y)}}function JH($){if($>=90)return"A";if($>=80)return"B";if($>=65)return"C";if($>=50)return"D";return"F"}function $6($){return{id:$.providerId,version:$.providerVersion,schemaVersion:$.schemaVersion,score:$.score,passed:$.passed,categories:$.categories,findings:$.findings,raw:$.raw}}function q6($,q){return{providerId:$.providerId,providerVersion:$.providerVersion,schemaVersion:$.schemaVersion,passed:$.passed,overallScore:$.score,grade:JH($.score),categories:$.categories.map((Z)=>({id:Z.id,name:Z.name,score:Z.score,max:Z.max})),evaluatedAt:$.startedAt,evaluatedVersion:q}}function u$($){return[...$].sort((q,Z)=>{if(q.id==="quality"&&Z.id!=="quality")return-1;if(Z.id==="quality"&&q.id!=="quality")return 1;return q.id.localeCompare(Z.id)})}var n={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 c0(){let{log:$,info:q}=console,Z=(...Q)=>process.stderr.write(Q.map(String).join(" ")+`
|
|
235
|
+
`);return console.log=Z,console.info=Z,()=>{console.log=$,console.info=q}}function Q6($){return{timestamp:new Date().toISOString(),asm_version:Z6,duration_ms:Math.round(performance.now()-$)}}function l($,q,Z){let Q={version:1,command:$,status:"ok",data:q,meta:Q6(Z)},X=process.stdout.isTTY?2:0;return JSON.stringify(Q,null,X)}function a($,q,Z,Q,X){let z={version:1,command:$,status:"error",error:{code:q,message:Z,...X!==void 0?{details:X}:{}},meta:Q6(Q)},J=process.stdout.isTTY?2:0;return JSON.stringify(z,null,J)}import{writeFile as AH,mkdir as IH,unlink as TH,readFile as MH}from"fs/promises";import{join as z1}from"path";import{readdir as YH,readFile as GH}from"fs/promises";import{join as UH}from"path";function t4($){let q=new Set,Z=$.toLowerCase().split(/[\s\-_.,;:()[\]{}"']+/);for(let Q of Z)if(Q.length>=2)q.add(Q);return q}var WH=10,VH=5,HH=3,BH=1;function KH($,q){let Z=t4($),Q=t4(q.name),X=t4(q.description),z=0;for(let J of Z){if(Q.has(J))z+=WH;if(X.has(J))z+=HH;if(q.name.toLowerCase().includes(J))z+=VH;if(q.description.toLowerCase().includes(J))z+=BH}return z}async function X6($){let q=new Map,Z;try{Z=await YH($)}catch{return q}for(let Q of Z){if(!Q.endsWith(".json"))continue;let X=UH($,Q);try{let z=await GH(X,"utf-8"),J=JSON.parse(z);for(let Y of J.skills){if(!("license"in Y))Y.license="";if(!("creator"in Y))Y.creator="";if(!("compatibility"in Y))Y.compatibility="";if(!("allowedTools"in Y))Y.allowedTools=[];if(!("verified"in Y))Y.verified=!1}q.set(`${J.owner}/${J.repo}`,J)}catch{}}return q}async function Q1(){let $=await X6(Y6()),q=await X6(m$()),Z=new Map($);for(let[Q,X]of q)Z.set(Q,X);return Array.from(Z.values())}var _H=["license","creator","version"];function z6($){return _H.includes($)}function J6($,q){return $[q]||""}function OH($,q){if(q.has)for(let Z of q.has){if(!z6(Z))continue;if(!J6($,Z))return!1}if(q.missing)for(let Z of q.missing){if(!z6(Z))continue;if(J6($,Z))return!1}return!0}function G6($){let q=[];if(!$.license)q.push("license");if(!$.creator)q.push("creator");if(!$.version||$.version==="0.0.0")q.push("version");return q}async function X1($,q=20,Z){let Q=await Q1(),X=[],z=!$&&Z;for(let J of Q)for(let Y of J.skills){if(Z&&!OH(Y,Z))continue;let G=z?1:KH($,Y);if(G>0)X.push({skill:Y,repo:{owner:J.owner,repo:J.repo},score:G})}return X.sort((J,Y)=>Y.score-J.score),X.slice(0,q)}async function U6(){return(await Q1()).reduce((q,Z)=>q+Z.skillCount,0)}var LH=[{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 W6($,q){let Z=[];if(!$.name||!$.name.trim())Z.push("missing frontmatter field: name");if(!$.description||!$.description.trim())Z.push("missing frontmatter field: description");if(FH(q).trim().length<20)Z.push("SKILL.md body too short (less than 20 chars of instructions)");for(let{label:X,pattern:z}of LH)if(z.test(q))Z.push(`malicious pattern detected: ${X}`);return{verified:Z.length===0,reasons:Z}}function FH($){let q=$.trimStart();if(!q.startsWith("---"))return q;let Z=q.indexOf(`
|
|
236
|
+
---`,3);if(Z===-1)return"";return q.slice(Z+4)}async function RH(){let $=m$();return await IH($,{recursive:!0}),$}async function V6($){await E0();let q;try{q=P0($)}catch(Q){return{success:!1,repoIndex:null,error:Q.message}}if(q.isLocal)return{success:!1,repoIndex:null,error:"Local paths are not supported for indexing. Use a GitHub source instead."};E(`ingester: cloning ${q.owner}/${q.repo}`);let Z=null;try{Z=await S0(q),E(`ingester: discovering skills in ${Z}`);let Q=await t$(Z);E(`ingester: found ${Q.length} skills`);let X=[];for(let G of Q){let U=z1(Z,G.relPath,"SKILL.md"),H="";try{H=await MH(U,"utf-8")}catch{E(`ingester: could not read SKILL.md at ${U}`)}let V=W6(G,H);if(!V.verified)E(`ingester: ${G.name} not verified: ${V.reasons.join(", ")}`);let B=typeof G.tokenCount==="number"?G.tokenCount:H?o$(H):void 0,_,O;if(H){try{let K=g$({content:H,skillPath:G.relPath||G.name,skillMdPath:U});_={overallScore:K.overallScore,grade:K.grade,categories:K.categories.map((L)=>({id:L.id,name:L.name,score:L.score,max:L.max})),evaluatedAt:K.evaluatedAt,evaluatedVersion:G.version||void 0}}catch(K){E(`ingester: eval failed for ${G.name}: ${K}`)}try{let K={skillPath:z1(Z,G.relPath),skillMdPath:U},F=(await Promise.all(u$(q1()).map(async(A)=>{if(!(await A.applicable(K,{})).ok)return null;return Z1(A,K)}))).filter((A)=>A!==null).map((A)=>q6(A,G.version||void 0));if(F.length>0)O=Object.fromEntries(F.filter((A)=>A.providerId).map((A)=>[A.providerId,A]))}catch(K){E(`ingester: provider eval failed for ${G.name}: ${K}`)}}X.push({name:G.name,description:G.description,version:G.version,license:G.license,creator:G.creator,compatibility:G.compatibility,allowedTools:G.allowedTools,installUrl:`github:${q.owner}/${q.repo}${q.ref?`#${q.ref}`:""}${G.relPath?`:${G.relPath}`:""}`,relPath:G.relPath,verified:V.verified,tokenCount:B,evalSummary:_,evalSummaries:O})}let z={repoUrl:q.cloneUrl,owner:q.owner,repo:q.repo,updatedAt:new Date().toISOString(),skillCount:X.length,skills:X},J=await RH(),Y=z1(J,`${q.owner}_${q.repo}.json`);return await AH(Y,JSON.stringify(z,null,2)+`
|
|
237
|
+
`,"utf-8"),E(`ingester: wrote index to ${Y}`),{success:!0,repoIndex:z}}catch(Q){return{success:!1,repoIndex:null,error:Q.message}}finally{if(Z)await e(Z)}}async function H6(){return(await Q1()).map((q)=>({owner:q.owner,repo:q.repo,skillCount:q.skillCount,updatedAt:q.updatedAt})).sort((q,Z)=>Z.skillCount-q.skillCount)}async function B6($,q){let Z=m$(),Q=z1(Z,`${$}_${q}.json`);try{return await TH(Q),!0}catch{return!1}}import{join as v6}from"path";function jH($){switch($){case"dangerous":return 3;case"warning":return 2;case"caution":return 1;default:return 0}}function z2($){return{verdict:$.every((q)=>q.verdict==="safe")?"safe":$.some((q)=>q.verdict==="dangerous")?"dangerous":"warning",findings:$.map((q)=>({skill:q.skillName,verdict:q.verdict,verdict_reason:q.verdictReason,total_files:q.totalFiles,total_lines:q.totalLines})),risk_score:$.reduce((q,Z)=>q+jH(Z.verdict),0)}}function wH($){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,compact:!1,summary:!1,groupBy:null,limit:0,concurrency:0,keep:!1}},Q=0;while(Q<q.length){let X=q[Q];if(X==="--help"||X==="-h")Z.flags.help=!0;else if(X==="--version"||X==="-v")Z.flags.version=!0;else if(X==="--json")Z.flags.json=!0;else if(X==="--yes"||X==="-y")Z.flags.yes=!0;else if(X==="--no-color")Z.flags.noColor=!0;else if(X==="--scope"||X==="-s"){Q++;let z=q[Q];if(z==="global"||z==="project"||z==="both")Z.flags.scope=z;else D(`Invalid scope: "${z}". Must be global, project, or both.`),process.exit(2)}else if(X==="--sort"){Q++;let z=q[Q];if(z==="name"||z==="version"||z==="location")Z.flags.sort=z;else D(`Invalid sort: "${z}". Must be name, version, or location.`),process.exit(2)}else if(X==="--provider"||X==="-p"||X==="--tool")Q++,Z.flags.provider=q[Q]||null;else if(X==="--name")Q++,Z.flags.name=q[Q]||null;else if(X==="--force"||X==="-f")Z.flags.force=!0;else if(X==="--path")Q++,Z.flags.path=q[Q]||null;else if(X==="--all")Z.flags.all=!0;else if(X==="--verbose"||X==="-V")Z.flags.verbose=!0;else if(X==="--flat")Z.flags.flat=!0;else if(X==="--compact")Z.flags.compact=!0;else if(X==="--summary")Z.flags.summary=!0;else if(X==="--group-by"){Q++;let z=q[Q];if(z==="tool"||z==="scope"||z==="effort")Z.flags.groupBy=z;else D(`Invalid --group-by: "${z}". Must be tool, scope, or effort.`),process.exit(2)}else if(X==="--limit"){Q++;let z=q[Q],J=Number(z);if(!Number.isFinite(J)||J<0||!Number.isInteger(J))D(`Invalid --limit: "${z}". Must be a non-negative integer (0 means no limit).`),process.exit(2);Z.flags.limit=J}else if(X==="--installed")Z.flags.installed=!0;else if(X==="--available")Z.flags.available=!0;else if(X==="--concurrency"){Q++;let z=q[Q],J=Number(z);if(!Number.isFinite(J)||J<1||!Number.isInteger(J))D(`Invalid --concurrency: "${z}". Must be a positive integer.`),process.exit(2);Z.flags.concurrency=J}else if(X==="--keep")Z.flags.keep=!0;else if(X==="--transport"||X==="-t"){Q++;let z=q[Q];if(z==="https"||z==="ssh"||z==="auto")Z.flags.transport=z;else D(`Invalid transport: "${z}". Must be https, ssh, or auto.`),process.exit(2)}else if(X==="--method"||X==="-m"){Q++;let z=q[Q];if(z==="default"||z==="vercel")Z.flags.method=z;else D(`Invalid method: "${z}". Must be default or vercel.`),process.exit(2)}else if(X==="--skill")Q++,Z.flags.path=q[Q]||null;else if(X==="--dry-run")Z.flags.dryRun=!0;else if(X==="--fix")Z.flags.fix=!0;else if(X==="--machine")Z.flags.machine=!0;else if(X==="--no-cache")Z.flags.noCache=!0;else if(X==="--has"){if(Q++,q[Q])Z.flags.has.push(q[Q])}else if(X==="--missing"){if(Q++,q[Q])Z.flags.missing.push(q[Q])}else if(X.startsWith("-"))D(`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 D($){console.error(W.red(`Error: ${$}`))}function NH(){console.log(`${W.blueBold("agent-skill-manager")} (${W.bold("asm")}) ${X2}
|
|
234
238
|
|
|
235
239
|
Interactive TUI and CLI for managing installed skills for AI coding agents.
|
|
236
240
|
|
|
237
|
-
${
|
|
241
|
+
${W.bold("Usage:")}
|
|
238
242
|
asm Launch interactive TUI
|
|
239
243
|
asm <command> [options] Run a CLI command
|
|
240
244
|
|
|
241
|
-
${
|
|
245
|
+
${W.bold("Commands:")}
|
|
242
246
|
list List all discovered skills
|
|
243
247
|
search <query> Search skills by name/description/tool
|
|
244
248
|
inspect <skill-name> Show detailed info for a skill
|
|
@@ -264,7 +268,7 @@ ${U.bold("Commands:")}
|
|
|
264
268
|
config reset Reset config to defaults
|
|
265
269
|
config edit Open config in $EDITOR
|
|
266
270
|
|
|
267
|
-
${
|
|
271
|
+
${W.bold("Global Options:")}
|
|
268
272
|
-h, --help Show help for any command
|
|
269
273
|
-v, --version Print version and exit
|
|
270
274
|
--json Output as JSON (list, search, inspect)
|
|
@@ -275,34 +279,46 @@ ${U.bold("Global Options:")}
|
|
|
275
279
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
276
280
|
--flat Show one row per tool instance (list, search)
|
|
277
281
|
-y, --yes Skip confirmation prompts
|
|
278
|
-
-V, --verbose Show debug output`)}function
|
|
282
|
+
-V, --verbose Show debug output`)}function DH(){console.log(`${W.bold("Usage:")} asm list [options]
|
|
279
283
|
|
|
280
284
|
List all discovered skills. By default, skills installed across multiple
|
|
281
|
-
tools are grouped into a single row with tool badges.
|
|
285
|
+
tools are grouped into a single row with tool badges. When more than
|
|
286
|
+
${Z2} skills are present, a compact summary is
|
|
287
|
+
automatically prepended above the table.
|
|
282
288
|
|
|
283
|
-
${
|
|
289
|
+
${W.bold("Options:")}
|
|
284
290
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
285
291
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
286
292
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
287
293
|
--flat Show one row per tool instance (ungrouped)
|
|
294
|
+
--compact One-line-per-skill dense view
|
|
295
|
+
--summary Print only the summary (counts by tool/scope/effort)
|
|
296
|
+
--group-by <axis> Group rows under headers (axis: tool | scope | effort)
|
|
297
|
+
--limit <N> Limit rendered rows (0 = no limit)
|
|
288
298
|
--json Output as JSON array
|
|
289
299
|
--machine Output in stable machine-readable v1 envelope format
|
|
290
300
|
--no-color Disable ANSI colors
|
|
291
301
|
-V, --verbose Show debug output
|
|
292
302
|
|
|
293
|
-
${
|
|
294
|
-
asm list ${
|
|
295
|
-
asm list --flat ${
|
|
296
|
-
asm list
|
|
297
|
-
asm list
|
|
298
|
-
asm list --
|
|
299
|
-
asm list --
|
|
300
|
-
asm list --
|
|
303
|
+
${W.bold("Examples:")}
|
|
304
|
+
asm list ${W.dim("List all skills (grouped)")}
|
|
305
|
+
asm list --flat ${W.dim("One row per tool instance")}
|
|
306
|
+
asm list --compact ${W.dim("One line per skill (dense)")}
|
|
307
|
+
asm list --summary ${W.dim("Counts by tool/scope/effort only")}
|
|
308
|
+
asm list --group-by tool ${W.dim("Group rows under tool headers")}
|
|
309
|
+
asm list --group-by scope ${W.dim("Group rows under scope headers")}
|
|
310
|
+
asm list --group-by effort ${W.dim("Group rows under effort headers")}
|
|
311
|
+
asm list --limit 20 ${W.dim("Show first 20 rows only")}
|
|
312
|
+
asm list -p claude ${W.dim("Only Claude Code skills")}
|
|
313
|
+
asm list -s project ${W.dim("Only project-scoped skills")}
|
|
314
|
+
asm list --sort version ${W.dim("Sort by version")}
|
|
315
|
+
asm list --json ${W.dim("Output as JSON")}
|
|
316
|
+
asm list --machine ${W.dim("Machine-readable v1 envelope output")}`)}function PH(){console.log(`${W.bold("Usage:")} asm search <query> [options]
|
|
301
317
|
|
|
302
318
|
Search both installed skills and the skill index. Results show installation
|
|
303
319
|
status and include copy-paste install commands for available skills.
|
|
304
320
|
|
|
305
|
-
${
|
|
321
|
+
${W.bold("Options:")}
|
|
306
322
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
307
323
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
308
324
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
@@ -314,49 +330,49 @@ ${U.bold("Options:")}
|
|
|
314
330
|
--no-color Disable ANSI colors
|
|
315
331
|
-V, --verbose Show debug output
|
|
316
332
|
|
|
317
|
-
${
|
|
318
|
-
asm search code ${
|
|
319
|
-
asm search review -p claude ${
|
|
320
|
-
asm search "test" --installed ${
|
|
321
|
-
asm search "test" --available ${
|
|
322
|
-
asm search openspec --json ${
|
|
323
|
-
asm search openspec --machine ${
|
|
333
|
+
${W.bold("Examples:")}
|
|
334
|
+
asm search code ${W.dim("Search installed and available skills")}
|
|
335
|
+
asm search review -p claude ${W.dim("Search within Claude Code only")}
|
|
336
|
+
asm search "test" --installed ${W.dim("Search installed skills only")}
|
|
337
|
+
asm search "test" --available ${W.dim("Search available skills only")}
|
|
338
|
+
asm search openspec --json ${W.dim("Output matches as JSON")}
|
|
339
|
+
asm search openspec --machine ${W.dim("Machine-readable v1 envelope output")}`)}function CH(){console.log(`${W.bold("Usage:")} asm inspect <skill-name> [options]
|
|
324
340
|
|
|
325
341
|
Show detailed information for a skill. The <skill-name> is the directory name.
|
|
326
342
|
Shows version, description, file count, and all provider installations.
|
|
327
343
|
|
|
328
|
-
${
|
|
344
|
+
${W.bold("Options:")}
|
|
329
345
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
330
346
|
--json Output as JSON object
|
|
331
347
|
--no-color Disable ANSI colors
|
|
332
348
|
-V, --verbose Show debug output
|
|
333
349
|
|
|
334
|
-
${
|
|
335
|
-
asm inspect code-review ${
|
|
336
|
-
asm inspect code-review --json ${
|
|
337
|
-
asm inspect code-review -s global ${
|
|
350
|
+
${W.bold("Examples:")}
|
|
351
|
+
asm inspect code-review ${W.dim("Show details for code-review")}
|
|
352
|
+
asm inspect code-review --json ${W.dim("Output as JSON")}
|
|
353
|
+
asm inspect code-review -s global ${W.dim("Global installations only")}`)}function EH(){console.log(`${W.bold("Usage:")} asm uninstall <skill-name> [options]
|
|
338
354
|
|
|
339
355
|
Remove a skill and its associated rule files. Shows a removal plan
|
|
340
356
|
before proceeding and asks for confirmation.
|
|
341
357
|
|
|
342
|
-
${
|
|
358
|
+
${W.bold("Options:")}
|
|
343
359
|
-y, --yes Skip confirmation prompt
|
|
344
360
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
345
361
|
--no-color Disable ANSI colors
|
|
346
362
|
-V, --verbose Show debug output
|
|
347
363
|
|
|
348
|
-
${
|
|
349
|
-
asm uninstall code-review ${
|
|
350
|
-
asm uninstall code-review -y ${
|
|
351
|
-
asm uninstall code-review -s project ${
|
|
364
|
+
${W.bold("Examples:")}
|
|
365
|
+
asm uninstall code-review ${W.dim("Remove with confirmation")}
|
|
366
|
+
asm uninstall code-review -y ${W.dim("Remove without confirmation")}
|
|
367
|
+
asm uninstall code-review -s project ${W.dim("Remove project copy only")}`)}function SH(){console.log(`${W.bold("Usage:")} asm audit [subcommand] [options]
|
|
352
368
|
|
|
353
369
|
Detect duplicate skills or run security audits on installed/remote skills.
|
|
354
370
|
|
|
355
|
-
${
|
|
371
|
+
${W.bold("Subcommands:")}
|
|
356
372
|
duplicates Find duplicate skills (default)
|
|
357
373
|
security <name|source> Run security audit on an installed skill or GitHub source
|
|
358
374
|
|
|
359
|
-
${
|
|
375
|
+
${W.bold("Options:")}
|
|
360
376
|
--json Output as JSON
|
|
361
377
|
--machine Output in stable machine-readable v1 envelope format
|
|
362
378
|
-y, --yes Auto-remove duplicates, keeping one instance per group
|
|
@@ -364,25 +380,25 @@ ${U.bold("Options:")}
|
|
|
364
380
|
--no-color Disable ANSI colors
|
|
365
381
|
-V, --verbose Show debug output
|
|
366
382
|
|
|
367
|
-
${
|
|
368
|
-
asm audit ${
|
|
369
|
-
asm audit -y ${
|
|
370
|
-
asm audit --json ${
|
|
371
|
-
asm audit security code-review ${
|
|
372
|
-
asm audit security github:user/repo ${
|
|
373
|
-
asm audit security --all ${
|
|
374
|
-
asm audit security code-review --json ${
|
|
375
|
-
asm audit security code-review --machine ${
|
|
383
|
+
${W.bold("Examples:")}
|
|
384
|
+
asm audit ${W.dim("Find duplicates")}
|
|
385
|
+
asm audit -y ${W.dim("Auto-remove duplicates")}
|
|
386
|
+
asm audit --json ${W.dim("Output as JSON")}
|
|
387
|
+
asm audit security code-review ${W.dim("Audit an installed skill")}
|
|
388
|
+
asm audit security github:user/repo ${W.dim("Audit a remote skill before installing")}
|
|
389
|
+
asm audit security --all ${W.dim("Audit all installed skills")}
|
|
390
|
+
asm audit security code-review --json ${W.dim("Output audit as JSON")}
|
|
391
|
+
asm audit security code-review --machine ${W.dim("Machine-readable v1 envelope output")}
|
|
376
392
|
asm audit security https://github.com/user/skills/tree/main/skills/agent-config
|
|
377
|
-
${
|
|
393
|
+
${W.dim("Audit a skill from a subfolder URL")}`)}function bH(){console.log(`${W.bold("Usage:")} asm publish [path] [options]
|
|
378
394
|
|
|
379
395
|
Validate a skill, run a security audit, generate a registry manifest,
|
|
380
396
|
and open a PR against the asm-registry.
|
|
381
397
|
|
|
382
|
-
${
|
|
398
|
+
${W.bold("Arguments:")}
|
|
383
399
|
path Path to skill directory (default: current directory)
|
|
384
400
|
|
|
385
|
-
${
|
|
401
|
+
${W.bold("Options:")}
|
|
386
402
|
--dry-run Print generated manifest without opening a PR
|
|
387
403
|
--force Override 'warning' security verdict (blocks 'dangerous')
|
|
388
404
|
-y, --yes Skip confirmation prompts
|
|
@@ -391,75 +407,76 @@ ${U.bold("Options:")}
|
|
|
391
407
|
--no-color Disable ANSI colors
|
|
392
408
|
-V, --verbose Show debug output
|
|
393
409
|
|
|
394
|
-
${
|
|
395
|
-
asm publish ${
|
|
396
|
-
asm publish ./my-skill ${
|
|
397
|
-
asm publish --dry-run ${
|
|
398
|
-
asm publish --force ${
|
|
399
|
-
asm publish --json ${
|
|
400
|
-
asm publish --machine ${
|
|
410
|
+
${W.bold("Examples:")}
|
|
411
|
+
asm publish ${W.dim("Publish skill in current directory")}
|
|
412
|
+
asm publish ./my-skill ${W.dim("Publish skill at the given path")}
|
|
413
|
+
asm publish --dry-run ${W.dim("Preview manifest without side effects")}
|
|
414
|
+
asm publish --force ${W.dim("Override warning-level security findings")}
|
|
415
|
+
asm publish --json ${W.dim("Output as JSON")}
|
|
416
|
+
asm publish --machine ${W.dim("Machine-readable v1 envelope output")}`)}function xH(){console.log(`${W.bold("Usage:")} asm outdated [options]
|
|
401
417
|
|
|
402
418
|
Show which installed skills have newer versions available.
|
|
403
419
|
|
|
404
|
-
${
|
|
420
|
+
${W.bold("Options:")}
|
|
405
421
|
--json Output as JSON
|
|
406
422
|
--machine Output in stable machine-readable format
|
|
407
423
|
--no-color Disable ANSI colors
|
|
408
424
|
-V, --verbose Show debug output
|
|
409
425
|
|
|
410
|
-
${
|
|
411
|
-
asm outdated ${
|
|
412
|
-
asm outdated --json ${
|
|
413
|
-
asm outdated --machine ${
|
|
426
|
+
${W.bold("Examples:")}
|
|
427
|
+
asm outdated ${W.dim("Show outdated skills")}
|
|
428
|
+
asm outdated --json ${W.dim("Output as JSON")}
|
|
429
|
+
asm outdated --machine ${W.dim("Machine-readable output")}`)}function fH(){console.log(`${W.bold("Usage:")} asm update [name...] [options]
|
|
414
430
|
|
|
415
431
|
Update outdated skills to their latest version with security re-audit.
|
|
416
432
|
|
|
417
|
-
${
|
|
433
|
+
${W.bold("Arguments:")}
|
|
418
434
|
name Specific skill(s) to update (default: all outdated)
|
|
419
435
|
|
|
420
|
-
${
|
|
436
|
+
${W.bold("Options:")}
|
|
421
437
|
-y, --yes Skip confirmation prompts
|
|
422
438
|
--json Output as JSON
|
|
423
439
|
--machine Output in stable machine-readable format
|
|
424
440
|
--no-color Disable ANSI colors
|
|
425
441
|
-V, --verbose Show debug output
|
|
426
442
|
|
|
427
|
-
${
|
|
428
|
-
asm update ${
|
|
429
|
-
asm update code-review ${
|
|
430
|
-
asm update --yes ${
|
|
431
|
-
asm update --json ${
|
|
443
|
+
${W.bold("Examples:")}
|
|
444
|
+
asm update ${W.dim("Update all outdated skills")}
|
|
445
|
+
asm update code-review ${W.dim("Update a specific skill")}
|
|
446
|
+
asm update --yes ${W.dim("Skip confirmation prompts")}
|
|
447
|
+
asm update --json ${W.dim("Output as JSON")}`)}function yH(){console.log(`${W.bold("Usage:")} asm config <subcommand>
|
|
432
448
|
|
|
433
449
|
Manage configuration. Config is stored at ~/.config/agent-skill-manager/.
|
|
434
450
|
|
|
435
|
-
${
|
|
451
|
+
${W.bold("Subcommands:")}
|
|
436
452
|
show Print current config as JSON
|
|
437
453
|
path Print config file path
|
|
438
454
|
reset Reset config to defaults (with confirmation)
|
|
439
455
|
edit Open config in $EDITOR
|
|
440
456
|
|
|
441
|
-
${
|
|
457
|
+
${W.bold("Options:")}
|
|
442
458
|
-V, --verbose Show debug output
|
|
443
459
|
|
|
444
|
-
${
|
|
445
|
-
asm config show ${
|
|
446
|
-
asm config edit ${
|
|
447
|
-
asm config reset -y ${
|
|
448
|
-
${
|
|
449
|
-
`))
|
|
450
|
-
${
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
460
|
+
${W.bold("Examples:")}
|
|
461
|
+
asm config show ${W.dim("View current config")}
|
|
462
|
+
asm config edit ${W.dim("Edit in $EDITOR")}
|
|
463
|
+
asm config reset -y ${W.dim("Reset without confirmation")}`)}async function h6($){for(let q of $)q.warnings=await S5(q)}async function kH($){if($.flags.help){DH();return}let q=performance.now(),Z=await h(),Q=await o(Z,$.flags.scope);if($.flags.provider&&$.command==="list")Q=Q.filter((z)=>z.provider===$.flags.provider);await h6(Q);let X=e4(Q,$.flags.sort);if($.flags.machine){let z=X.map((J)=>({name:J.name,version:J.version,description:J.description,scope:J.scope,provider:J.provider,path:J.path}));console.log(l("list",z,q));return}if($.flags.json)console.log(c(X));else if($.flags.flat){let z=q2(X),J=X.filter((Y)=>Y.warnings&&Y.warnings.length>0);if(J.length>0)z+=`
|
|
464
|
+
${W.yellow(`${J.length} skill${J.length===1?"":"s"} with warnings -- use --json for details`)}`;console.log(z)}else if($.flags.summary)console.log(r4(X));else if($.flags.groupBy){let{skills:z,hint:J}=Y1(X,$.flags.limit);if(console.log(w6(z,$.flags.groupBy)),J)console.log(J)}else if($.flags.compact){let{skills:z,hint:J}=Y1(X,$.flags.limit);if(console.log(j6(z)),J)console.log(J)}else{let z=[];if(X.length>Z2)z.push(r4(X,{showHint:!1})),z.push("");let{skills:J,hint:Y}=Y1(X,$.flags.limit);if(z.push(N6(J)),Y)z.push(Y);console.log(z.join(`
|
|
465
|
+
`))}}async function vH($){if($.flags.help){PH();return}let q=$.flags.machine?c0():void 0,Z=performance.now(),Q=$.subcommand;if(!Q){if($.flags.machine)q?.(),console.log(a("search",n.INVALID_ARGUMENT,"Missing required argument: <query>",Z)),process.exit(2);D("Missing required argument: <query>"),console.error('Run "asm search --help" for usage.'),process.exit(2)}let X=!$.flags.available,z=!$.flags.installed,J=[];if(X){let H=await h(),V=await o(H,$.flags.scope);if($.flags.provider)V=V.filter((_)=>_.provider===$.flags.provider);let B=F6(V,Q);J=e4(B,$.flags.sort)}let Y=[];if(z){if(Y=await X1(Q),J.length>0){let H=new Set(J.map((V)=>V.name.toLowerCase()));Y=Y.filter((V)=>!H.has(V.skill.name.toLowerCase()))}}if($.flags.machine){q?.();let H=J.map((B)=>({name:B.name,description:B.description,source:"installed",url:null,match_count:1})),V=Y.map((B)=>({name:B.skill.name,description:B.skill.description,source:"index",url:B.skill.installUrl,match_count:1}));console.log(l("search",[...H,...V],Z));return}if($.flags.json){let H=J.map((B)=>({name:B.name,description:B.description,version:B.version,scope:B.scope,provider:B.provider,status:"installed"})),V=Y.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([...H,...V]));return}let G=J.length>0,U=Y.length>0;if(!G&&!U){console.error(`No skills matching "${Q}".`),console.error(W.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(G)if(console.error(W.bold(`Installed skills matching "${Q}":
|
|
466
|
+
`)),$.flags.flat)console.log(q2(J));else console.log(D6(J,Q));if(U){if(G)console.error("");let H=P6(Y.map((V)=>({name:V.skill.name,version:V.skill.version,description:V.skill.description,verified:V.skill.verified,repoLabel:`${V.repo.owner}/${V.repo.repo}`,installUrl:V.skill.installUrl})),Q);console.error(H)}}async function hH($){if($.flags.help){CH();return}let q=$.subcommand;if(!q)D("Missing required argument: <skill-name>"),console.error('Run "asm inspect --help" for usage.'),process.exit(2);let Z=await h(),X=(await o(Z,$.flags.scope)).filter((z)=>z.dirName===q);if(X.length===0)D(`Skill "${q}" not found.`),console.error(W.dim(`Try ${W.bold("asm list")} to see all skills or ${W.bold(`asm search "${q}"`)} to search.`)),process.exit(1);if(await h6(X),$.flags.json)console.log(c(X.length===1?X[0]:X));else console.log(await C6(X))}async function gH($){if($.flags.help){EH();return}let q=$.subcommand;if(!q)D("Missing required argument: <skill-name>"),console.error('Run "asm uninstall --help" for usage.'),process.exit(2);let Z=await h(),Q=await o(Z,$.flags.scope),X=I6(q,Q,Z),z=await T6(X);if(z.length===0)D(`Skill "${q}" not found or nothing to remove.`),process.exit(1);console.error(W.bold("Removal plan:"));for(let Y of z)console.error(` ${W.red("•")} ${R6(Y)}`);if(!$.flags.yes){if(!process.stdin.isTTY)D("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`
|
|
467
|
+
${W.bold("Proceed with removal?")} [y/N] `);let Y=await Q0();if(Y.toLowerCase()!=="y"&&Y.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let J=await $2(X);for(let Y of J)console.error(Y);try{await S6(q)}catch{}console.error(W.green(`
|
|
468
|
+
Done.`))}function Q0(){return new Promise(($)=>{let q="",Z=!1;function Q(){process.stdin.removeListener("data",z),process.stdin.removeListener("end",J),process.stdin.pause(),clearTimeout(Y)}function X(G){if(Z)return;Z=!0,Q(),$(G)}function z(G){if(q+=G,q.includes(`
|
|
469
|
+
`))X(q.trim())}function J(){X(q.trim())}let Y=setTimeout(()=>{X(q.trim())},30000);process.stdin.setEncoding("utf-8"),process.stdin.on("data",z),process.stdin.on("end",J),process.stdin.resume()})}async function uH($){if($.flags.help){SH();return}let q=performance.now(),Z=$.subcommand??"duplicates";if(Z==="security"){await mH($,q);return}if(Z!=="duplicates")D(`Unknown audit subcommand: "${Z}". Use: duplicates, security`),process.exit(2);let Q=await h(),X=await o(Q,"both"),z=Q2(X);if($.flags.machine){let J={duplicate_groups:z.duplicateGroups.map((Y)=>({name:Y.key,count:Y.instances.length,instances:Y.instances.map((G)=>({path:G.path,scope:G.scope,provider:G.provider}))})),total_duplicates:z.duplicateGroups.length};console.log(l("audit duplicates",J,q));return}if($.flags.json){console.log(y6(z));return}if(console.log(f6(z)),$.flags.yes&&z.duplicateGroups.length>0){console.error(W.bold(`
|
|
470
|
+
Auto-removing duplicates...`));for(let J of z.duplicateGroups){let Y=x6(J.instances),G=Y[0].path;for(let U=1;U<Y.length;U++){let H=Y[U],V=A6(H,Q),B=await $2(V,G);for(let _ of B)console.error(_)}}console.error(W.green(`
|
|
471
|
+
Done.`))}}async function mH($,q){let Z=$.positional[0];if($.flags.all)await pH($,q);else if(!Z){if($.flags.machine)console.log(a("audit security",n.INVALID_ARGUMENT,"Missing target. Provide a skill name, GitHub source, or use --all.",q)),process.exit(2);D(`Missing target. Provide a skill name, GitHub source, or use --all.
|
|
472
|
+
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2)}else if(Z.startsWith("github:")||Z.startsWith("https://github.com/"))await dH($,Z,q);else await cH($,Z,q)}async function pH($,q){let Z=await h(),Q=await o(Z,$.flags.scope);if(Q.length===0){if($.flags.machine)console.log(l("audit security",[],q));else if($.flags.json)console.log("[]");else console.log("No skills found to audit.");return}let X=new Set,z=Q.filter((Y)=>{if(X.has(Y.realPath))return!1;return X.add(Y.realPath),!0});console.error(`Auditing ${z.length} skill${z.length>1?"s":""}...
|
|
473
|
+
`);let J=[];for(let Y of z){console.error(` Scanning ${W.bold(Y.name)}...`);let G=await N0(Y.realPath,Y.name);J.push(G)}if($.flags.machine)console.log(l("audit security",z2(J),q));else if($.flags.json)console.log(JSON.stringify(J,null,2));else{for(let G of J)console.log(dq(G));let Y={safe:0,caution:0,warning:0,dangerous:0};for(let G of J)Y[G.verdict]++;if(console.log(W.bold(`
|
|
474
|
+
Summary:`)),Y.dangerous>0)console.log(` ${W.red(`${Y.dangerous} dangerous`)}`);if(Y.warning>0)console.log(` ${W.yellow(`${Y.warning} warning`)}`);if(Y.caution>0)console.log(` ${Y.caution} caution`);if(Y.safe>0)console.log(` ${W.green(`${Y.safe} safe`)}`);console.log("")}}async function dH($,q,Z){let Q=null;try{let X=P0(q);if(X.isLocal)throw Error("Local paths are not supported for remote security audits. Use: asm audit security <installed-skill-name>");await E0(),X=await s$(X),console.error(`Cloning ${q} for audit...`),Q=await S0(X,$.flags.transport);let{join:z}=await import("path"),J=X.subpath?z(Q,X.subpath):Q,{name:Y}=await b0(J),G=await N0(J,Y,X.owner,X.repo);if($.flags.machine)console.log(l("audit security",z2([G]),Z));else if($.flags.json)console.log(v4(G));else console.log(dq(G))}catch(X){if($.flags.machine)console.log(a("audit security",n.AUDIT_FAILED,X.message,Z)),process.exit(1);D(X.message),process.exit(1)}finally{if(Q)await e(Q)}}async function cH($,q,Z){let Q=await h(),z=(await o(Q,$.flags.scope)).filter((G)=>G.dirName===q);if(z.length===0){if($.flags.machine)console.log(a("audit security",n.SKILL_NOT_FOUND,`Skill "${q}" not found.`,Z)),process.exit(1);D(`Skill "${q}" not found. Use "asm list" to see installed skills.`),process.exit(1)}let J=z[0];console.error(`Auditing installed skill: ${W.bold(J.name)}...
|
|
475
|
+
`);let Y=await N0(J.realPath,J.name);if($.flags.machine)console.log(l("audit security",z2([Y]),Z));else if($.flags.json)console.log(v4(Y));else console.log(dq(Y))}async function lH($){if($.flags.help){yH();return}let q=$.subcommand;if(!q)D("Missing subcommand. Use: show, path, reset, or edit."),console.error('Run "asm config --help" for usage.'),process.exit(2);switch(q){case"show":{let Z=await h();console.log(c(Z));break}case"path":{console.log(h$());break}case"reset":{if(!$.flags.yes){if(!process.stdin.isTTY)D("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);process.stderr.write(`${W.bold("Reset config to defaults?")} [y/N] `);let Q=await Q0();if(Q.toLowerCase()!=="y"&&Q.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Z=O6();await L6(Z),console.error(W.green("Config reset to defaults."));break}case"edit":{let Z=process.env.VISUAL||process.env.EDITOR||"vi",[Q,X]=k6(Z),z=h$();await h();let{spawn:J}=await import("child_process");await new Promise((Y,G)=>{let U=J(Q,[...X,z],{stdio:"inherit"});U.on("close",()=>Y()),U.on("error",G)});break}default:D(`Unknown config subcommand: "${q}". Use: show, path, reset, or edit.`),process.exit(2)}}function nH(){console.log(`${W.bold("Usage:")} asm install <source> [options]
|
|
459
476
|
|
|
460
477
|
Install a skill from a GitHub repository, the curated registry, or a local path.
|
|
461
478
|
|
|
462
|
-
${
|
|
479
|
+
${W.bold("Source Format:")}
|
|
463
480
|
code-review Install by name from the curated registry
|
|
464
481
|
author/code-review Install a scoped name (author/name) from registry
|
|
465
482
|
github:owner/repo Install from default branch
|
|
@@ -472,7 +489,7 @@ ${U.bold("Source Format:")}
|
|
|
472
489
|
./relative/path/to/skill Install from a local folder (relative path)
|
|
473
490
|
~/path/to/skill Install from a local folder (home-relative path)
|
|
474
491
|
|
|
475
|
-
${
|
|
492
|
+
${W.bold("Options:")}
|
|
476
493
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents, all)
|
|
477
494
|
Use "all" to install to all tools (shared + symlinks)
|
|
478
495
|
-s, --scope <scope> Installation scope: global or project (default: prompt)
|
|
@@ -494,73 +511,73 @@ ${U.bold("Options:")}
|
|
|
494
511
|
--no-color Disable ANSI colors
|
|
495
512
|
-V, --verbose Show debug output
|
|
496
513
|
|
|
497
|
-
${
|
|
498
|
-
asm install code-review ${
|
|
499
|
-
asm install luongnv89/code-review ${
|
|
500
|
-
asm install code-review --no-cache ${
|
|
514
|
+
${W.bold("Registry (bare name):")}
|
|
515
|
+
asm install code-review ${W.dim("(resolve from registry)")}
|
|
516
|
+
asm install luongnv89/code-review ${W.dim("(scoped name, no ambiguity)")}
|
|
517
|
+
asm install code-review --no-cache ${W.dim("(force fresh registry fetch)")}
|
|
501
518
|
|
|
502
|
-
${
|
|
503
|
-
asm install ./my-skill ${
|
|
504
|
-
asm install /home/user/skills/my-skill ${
|
|
505
|
-
asm install ~/skills/my-skill ${
|
|
506
|
-
asm install ../other-project/skill ${
|
|
507
|
-
asm install ./skills-dir --all ${
|
|
519
|
+
${W.bold("Local folder:")}
|
|
520
|
+
asm install ./my-skill ${W.dim("(relative path)")}
|
|
521
|
+
asm install /home/user/skills/my-skill ${W.dim("(absolute path)")}
|
|
522
|
+
asm install ~/skills/my-skill ${W.dim("(home-relative path)")}
|
|
523
|
+
asm install ../other-project/skill ${W.dim("(parent-relative path)")}
|
|
524
|
+
asm install ./skills-dir --all ${W.dim("(all skills in directory)")}
|
|
508
525
|
|
|
509
|
-
${
|
|
526
|
+
${W.bold("Single-skill repo:")}
|
|
510
527
|
asm install github:user/my-skill
|
|
511
528
|
asm install github:user/my-skill#v1.0.0 -p claude
|
|
512
529
|
asm install https://github.com/user/my-skill
|
|
513
|
-
asm install github:user/my-skill -p all ${
|
|
514
|
-
asm install github:user/private-skill -t ssh ${
|
|
530
|
+
asm install github:user/my-skill -p all ${W.dim("(install to all tools)")}
|
|
531
|
+
asm install github:user/private-skill -t ssh ${W.dim("(clone via SSH)")}
|
|
515
532
|
|
|
516
|
-
${
|
|
533
|
+
${W.bold("Multi-skill repo:")}
|
|
517
534
|
asm install github:user/skills --path skills/code-review
|
|
518
535
|
asm install github:user/skills --all -p claude -y
|
|
519
|
-
asm install github:user/skills --all -p all -y ${
|
|
536
|
+
asm install github:user/skills --all -p all -y ${W.dim("(all skills, all tools)")}
|
|
520
537
|
asm install https://github.com/user/skills --all
|
|
521
|
-
asm install github:user/skills ${
|
|
538
|
+
asm install github:user/skills ${W.dim("(interactive picker)")}
|
|
522
539
|
|
|
523
|
-
${
|
|
540
|
+
${W.bold("Subfolder URL:")}
|
|
524
541
|
asm install https://github.com/user/skills/tree/main/skills/agent-config
|
|
525
542
|
asm install github:user/skills#main:skills/agent-config
|
|
526
543
|
|
|
527
|
-
${
|
|
544
|
+
${W.bold("Vercel skills CLI:")}
|
|
528
545
|
asm install github:user/skills --method vercel --skill my-skill
|
|
529
546
|
asm install https://github.com/user/skills -m vercel --skill my-skill -y
|
|
530
|
-
${
|
|
531
|
-
${
|
|
532
|
-
${
|
|
533
|
-
${
|
|
534
|
-
${
|
|
535
|
-
${
|
|
536
|
-
${
|
|
537
|
-
Select a skill [1-${S.length}]: `;process.stderr.write(
|
|
538
|
-
Did you mean: ${C.map((S)=>
|
|
539
|
-
`);for(let
|
|
547
|
+
${W.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function aH($,q,Z,Q,X,z,J,Y,G="global"){let U=await b0(Q),H=await O2(Q),V=Q===Z?null:Q.split(/[/\\]/).pop(),B=X||V||q.repo,_=C0(B),O=Y.find((w)=>w.name.toLowerCase()===U.name.toLowerCase()&&w.provider===J.name),K,L=!!O;if(O)if(O.version===U.version)K=$.flags.force?"REINSTALL":`UPDATE: ${O.version} (same version)`;else K=`UPDATE: ${O.version} → ${U.version}`;else K="NEW";let F=B1(q,Z,Q,_,J,$.flags.force||L,G),A=H.some((w)=>["Shell commands","Code execution","Credentials"].includes(w.category)),M=H.some((w)=>["External URLs"].includes(w.category)),j=A?"high":M?"medium":"safe",T=A?W.red("[!] High Risk"):M?W.yellow("[~] Medium Risk"):W.green("[ok] Safe");return{metadata:U,skillName:_,warnings:H,installStatus:K,riskLevel:j,riskLabel:T,plan:F}}function iH($,q,Z,Q,X,z){let{metadata:J,warnings:Y,installStatus:G,riskLabel:U,plan:H}=$;if(X&&z){let V=W.dim(`[${z.index}/${z.total}]`),B=G==="NEW"?W.green(`[${G}]`):W.yellow(`[${G}]`);console.info(`${V} ${W.bold(J.name)} v${J.version} ${B} ${U}`)}else{let V=G==="NEW"?W.green(`[${G}]`):W.yellow(`[${G}]`);if(console.info(` ${W.bold(J.name)} v${J.version} ${V}`),console.info(`
|
|
548
|
+
${W.bold("Install preview:")}`),console.info(` ${W.bold("Name:")} ${J.name}`),console.info(` ${W.bold("Version:")} ${J.version}`),J.description)console.info(` ${W.bold("Description:")} ${W.dim(J.description)}`);if(J.effort)console.info(` ${W.bold("Effort:")} ${M6(J.effort)}`);if(console.info(` ${W.bold("Source:")} ${q}`),Q)console.info(` ${W.bold("Tool:")} All (${Q.map((B)=>B.label).join(", ")})`),console.info(` ${W.bold("Primary:")} ${Z.label} (${Z.name})`),console.info(` ${W.bold("Symlinks:")} ${Q.filter((B)=>B.name!==Z.name).map((B)=>B.label).join(", ")}`);else console.info(` ${W.bold("Tool:")} ${Z.label} (${Z.name})`);if(console.info(` ${W.bold("Scope:")} ${H.scope==="project"?"Project":"Global"}`),console.info(` ${W.bold("Target:")} ${H.targetDir}`),console.info(` ${W.bold("Status:")} ${V}`),console.info(` ${W.bold("Risk:")} ${U}`),Y.length>0){console.info(`
|
|
549
|
+
${W.bold("Security warnings:")}`);let B=new Map;for(let _ of Y){let O=B.get(_.category)||[];O.push(_),B.set(_.category,O)}for(let[_,O]of B){let L=["Shell commands","Code execution","Credentials"].includes(_)?W.red(`[${_}]`):W.yellow(`[${_}]`);console.info(`
|
|
550
|
+
${L} ${W.dim(`(${O.length} match${O.length>1?"es":""})`)}`);for(let F of O.slice(0,5))console.info(` ${W.dim(`${F.file}:${F.line}`)} -- ${F.match}`);if(O.length>5)console.info(W.dim(` ... and ${O.length-5} more`))}}}}async function oH($,q){if(q)return await L2($,q);return await r$($)}async function sH($){if($.flags.help){nH();return}let q=$.flags.machine?c0():void 0,Z=performance.now(),Q=$.subcommand;if(!Q)D("Missing required argument: <source>"),console.error('Run "asm install --help" for usage.'),process.exit(2);let X=null,z="github",J=8,Y=0,G=(H)=>{return Y++,`
|
|
551
|
+
${W.cyan(`[Step ${Y}/${J}]`)} ${W.bold(H)}`},U=()=>{if(X)e(X).finally(()=>process.exit(1));else process.exit(1)};process.on("SIGINT",U),process.on("SIGTERM",U);try{if(N4(Q)){console.info(`
|
|
552
|
+
${W.cyan("●")} Resolving "${W.bold(Q)}" from registry...`);let{resolved:I,multipleMatches:R,suggestions:C}=await k5(Q,{noCache:$.flags.noCache});if(I){z="registry";let S=I.manifest,f=S.repository.replace("https://github.com/","");Q=S.skill_path?`github:${f}#${S.commit}:${S.skill_path}`:`github:${f}#${S.commit}`,console.info(` ${W.green("✓")} Resolved: ${W.bold(`${S.author}/${S.name}`)} @ ${S.commit.slice(0,7)}`)}else if(R.length>0){console.info(`
|
|
553
|
+
${W.yellow("⚠")} Multiple skills found for "${W.bold(Q)}":`);let S=R.slice(0,5);for(let H0=0;H0<S.length;H0++){let X0=S[H0];console.info(` ${W.cyan(`${H0+1}.`)} ${W.bold(`${X0.author}/${X0.name}`)} — ${X0.description}`)}if(!process.stdin.isTTY)D(`Ambiguous skill name "${Q}". Use a scoped name: asm install author/name`),process.exit(2);let f=`
|
|
554
|
+
Select a skill [1-${S.length}]: `;process.stderr.write(f);let d=await new Promise((H0)=>{let X0="",l0=!1,d$=setTimeout(()=>{if(!l0)l0=!0,process.stdin.removeListener("data",W$),H0(X0.trim())},30000);function W$(n0){if(X0=n0.toString().trim(),!l0)l0=!0,clearTimeout(d$),process.stdin.removeListener("data",W$),H0(X0)}process.stdin.setEncoding("utf-8"),process.stdin.on("data",W$)}),p=parseInt(d,10);if(isNaN(p)||p<1||p>S.length)D("Invalid selection. Aborting."),process.exit(2);let r=S[p-1];z="registry";let p$=r.repository.replace("https://github.com/","");Q=r.skill_path?`github:${p$}#${r.commit}:${r.skill_path}`:`github:${p$}#${r.commit}`,console.info(` ${W.green("✓")} Selected: ${W.bold(`${r.author}/${r.name}`)} @ ${r.commit.slice(0,7)}`)}else if(D4(Q)){if(D(`Skill "${Q}" not found in the registry.`),C.length>0)console.error(`
|
|
555
|
+
Did you mean: ${C.map((S)=>W.cyan(S)).join(", ")}?`);process.exit(1)}else console.info(` ${W.dim("Not found in registry — trying existing sources...")}`),z="pre-indexed"}console.info(G("Parsing source"));let H=P0(Q),V=!!H.isLocal;if(V){let I=H.localPath;console.info(` ${W.dim(`local: ${I}`)}`);let{stat:R}=await import("fs/promises");try{if(!(await R(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 E0(),H=await s$(H),console.info(` ${W.dim(Q)}`);if($.flags.method==="vercel"){console.info(G("Installing via Vercel skills CLI")),await F2();let I=I2(H),R=$.flags.path||null;console.info(` ${W.dim(`npx skills add ${I}${R?` --skill ${R}`:""}`)}`);let{stdout:C,stderr:S}=await A2(I,R);if(C.trim())console.info(` ${W.dim(C.trim())}`);if(S.trim())console.error(` ${W.dim(S.trim())}`);console.info(` ${W.green("✓")} Vercel skills CLI install completed`),$.flags.force=!0,console.info(` ${W.dim("Continuing with asm install to register in local inventory...")}`)}console.info(G("Selecting provider"));let B=await h(),{provider:_,allProviders:O}=await i0(B,$.flags.provider,!!process.stdin.isTTY);console.info(G("Selecting scope"));let K;if($.flags.scope==="global"||$.flags.scope==="project")K=$.flags.scope,console.info(` ${W.dim(`scope: ${K}`)}${K==="global"?` (${_.global})`:` (${_.project})`}`);else if(!process.stdin.isTTY||$.flags.yes)K="global",console.info(` ${W.dim("scope: global (default)")} (${_.global})`);else{let I=[{label:`Global (${_.global})`,hint:"Available in all projects",checked:!0},{label:`Project (${_.project})`,hint:"Available only in this project",checked:!1}];console.info("");let R=await a0({items:I});if(R.length===0)throw Error("No scope selected. Aborting.");K=R[0]===0?"global":"project",console.info(` Selected: ${W.bold(K)} ${W.dim(`(${K==="global"?_.global:_.project})`)}`)}if(V)console.info(G("Reading local source")),console.info(` ${W.dim(H.localPath)}`),X=null;else{console.info(G("Cloning repository"));let I=$.flags.transport,R=I==="ssh"?H.sshCloneUrl:I==="https"?H.cloneUrl:`${H.cloneUrl} ${W.dim("(auto)")}`;console.info(` ${R}${H.ref?` ${W.dim(`(ref: ${H.ref})`)}`:""}${H.subpath?` ${W.dim(`(path: ${H.subpath})`)}`:""}`),X=await S0(H,I)}let L=V?H.localPath:X;console.info(G("Scanning for skills"));let{join:F}=await import("path"),A=[],M=$.flags.path||H.subpath,j=[];if(M){let I=F(L,M);try{await b0(I)}catch{throw Error(`No SKILL.md found at path "${M}" in the repository.`)}console.info(` Found skill at ${W.bold(M)}`),j=[{skillDir:I,nameOverride:$.flags.name}]}else{let I=!1;try{await b0(L),I=!0}catch{}if(I){let R=await b0(L);console.info(` Found: ${W.bold(R.name)} v${R.version}`),j=[{skillDir:L,nameOverride:$.flags.name}]}else{console.info(" No SKILL.md at root. Scanning subdirectories...");let R=await t$(L);if(R.length===0)throw Error("No skills found in this repository. Skills must have a SKILL.md file.");console.info(` Found ${W.bold(String(R.length))} skill(s):
|
|
556
|
+
`);for(let f=0;f<R.length;f++){let d=W.cyan(` ${String(f+1).padStart(String(R.length).length)})`);if(console.info(`${d} ${W.bold(R[f].name)} ${W.dim(`v${R[f].version}`)} ${W.dim(`(${R[f].relPath})`)}`),R[f].description)console.info(` ${W.dim(R[f].description)}`)}console.info(G("Selecting skills")),Y--;let C;if($.flags.all&&($.flags.yes||!process.stdin.isTTY))C=R.map((f)=>f.relPath),console.info(` Selected all ${W.bold(String(C.length))} skills`);else if(process.stdin.isTTY)if(R.length===1)C=[R[0].relPath],console.info(` Auto-selected: ${W.bold(R[0].name)} ${W.dim(`v${R[0].version}`)}`);else{let f=R.map((p)=>({label:p.name,hint:`v${p.version}${p.description?" "+p.description:""}`,checked:!!$.flags.all}));console.info("");let d=await a0({items:f});if(d.length===0)throw Error("No skills selected. Aborting.");C=d.map((p)=>R[p].relPath),console.info(` Selected ${W.bold(String(C.length))} skill(s)`)}else{D(`Repository contains ${R.length} skills. Use --path <subdir> to pick one or --all to install all.
|
|
540
557
|
Available skills:
|
|
541
|
-
${
|
|
542
|
-
`)}`),process.exit(2);return}let S=
|
|
558
|
+
${R.map((f)=>` --path ${f.relPath}`).join(`
|
|
559
|
+
`)}`),process.exit(2);return}let S=_2(C);if(S.length>0){let f=S.map((p)=>` - ${p.name}: ${p.paths.map((r)=>`"${r}"`).join(", ")}`).join(`
|
|
543
560
|
`),d=Error(`Duplicate skill names detected in selection:
|
|
544
|
-
${
|
|
545
|
-
Choose one path per skill name or install with --path.`);throw d.duplicates=S,d}
|
|
546
|
-
${
|
|
547
|
-
${
|
|
548
|
-
${
|
|
561
|
+
${f}
|
|
562
|
+
Choose one path per skill name or install with --path.`);throw d.duplicates=S,d}j=C.map((f)=>({skillDir:F(L,f),nameOverride:C.length===1?$.flags.name:null})),Y++}}console.info(G("Inspecting skills"));let T=await o(B,"both"),w=[],x=j.length>1;for(let I=0;I<j.length;I++){let{skillDir:R,nameOverride:C}=j[I],S=await aH($,H,L,R,C,B,_,T,K);w.push(S),iH(S,Q,_,O,x,x?{index:I+1,total:j.length}:void 0)}if(x){if(console.info(""),console.info(` ${W.bold("Install settings:")}`),console.info(` ${W.bold("Source:")} ${Q}`),O)console.info(` ${W.bold("Tool:")} All (${O.map((f)=>f.label).join(", ")})`);else console.info(` ${W.bold("Tool:")} ${_.label} (${_.name})`);console.info(` ${W.bold("Scope:")} ${K==="project"?"Project":"Global"}`);let I=w.filter((f)=>f.riskLevel==="high").length,R=w.filter((f)=>f.riskLevel==="medium").length,C=w.filter((f)=>f.riskLevel==="safe").length,S=[];if(C>0)S.push(W.green(`${C} Safe`));if(R>0)S.push(W.yellow(`${R} Medium Risk`));if(I>0)S.push(W.red(`${I} High Risk`));console.info(` ${W.bold("Risk:")} ${S.join(", ")}`)}if(console.info(G("Installing")),!$.flags.yes){let I=w.some((f)=>f.riskLevel==="high");if(!process.stdin.isTTY)D("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2);let R=x?`${w.length} skills`:`"${w[0].metadata.name}"`,C=I?`
|
|
563
|
+
${W.red("[!]")} ${W.bold(`Install ${R}? Some have high-risk patterns.`)} [y/N] `:`
|
|
564
|
+
${W.bold(`Install ${R}?`)} [Y/n] `;process.stderr.write(C);let S=await Q0();if(I){if(S.toLowerCase()!=="y"&&S.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}else if(S.toLowerCase()==="n"||S.toLowerCase()==="no")console.error("Aborted."),process.exit(0)}let P=X?await b6(X):null,y=[];for(let I=0;I<w.length;I++){let R=w[I],C=x?W.dim(`[${I+1}/${w.length}]`)+" ":" ";try{console.info(`${C}Installing ${W.bold(R.metadata.name)}...`);let S=await oH(R.plan,O);A.push(S),console.info(`${C}${W.green("✓")} ${R.metadata.name} installed to ${W.dim(R.plan.targetDir)}`);try{let f=V?`local:${H.localPath}`:`github:${H.owner}/${H.repo}`,d=V?"local":z==="registry"?"registry":"github";await v$(S.name,{source:f,commitHash:P||"unknown",ref:H.ref||"main",installedAt:new Date().toISOString(),provider:R.plan.providerName,sourceType:d,...z==="registry"?{registryName:S.name}:{}})}catch{}}catch(S){y.push({name:R.metadata.name,error:S.message}),console.error(`${C}${W.red("✗")} ${W.bold(R.metadata.name)} — ${W.red(S.message)}`)}}if(process.removeListener("SIGINT",U),process.removeListener("SIGTERM",U),y.length>0){console.error(`
|
|
565
|
+
${W.yellow(`${y.length} skill(s) failed to install:`)}`);for(let I of y)console.error(` ${W.red("✗")} ${I.name}: ${I.error}`)}if($.flags.machine){q?.();let I=A.map((R)=>({name:R.name,path:R.path,version:R.version,provider:R.provider,source:R.source,resolution_source:z}));console.log(l("install",I.length===1?I[0]:I,Z))}else if($.flags.json){let I=A.map((R)=>({...R,resolutionSource:z}));console.log(JSON.stringify(I.length===1?I[0]:I,null,2))}else if(A.length===1)console.error(W.green(`
|
|
549
566
|
Done! Installed "${A[0].name}" to ${A[0].path}`));else if(A.length>0)console.error(`
|
|
550
|
-
${
|
|
567
|
+
${W.green(`Done! Installed ${A.length} skill(s) successfully.`)}`)}catch(H){if(process.removeListener("SIGINT",U),process.removeListener("SIGTERM",U),$.flags.machine)q?.(),console.log(a("install",n.INSTALL_FAILED,H.message,Z,H?.duplicates?{duplicates:H.duplicates}:void 0));else if($.flags.json){let V={success:!1,error:H.message};if(H?.duplicates)V.duplicates=H.duplicates;console.log(JSON.stringify(V,null,2))}else D(H.message);process.exit(1)}finally{if(X)await e(X);q?.()}}function tH(){console.log(`${W.bold("Usage:")} asm export [options]
|
|
551
568
|
|
|
552
569
|
Export skill inventory as a portable JSON manifest. Useful for backup,
|
|
553
570
|
sharing, or scripting.
|
|
554
571
|
|
|
555
|
-
${
|
|
572
|
+
${W.bold("Options:")}
|
|
556
573
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
557
574
|
--no-color Disable ANSI colors
|
|
558
575
|
-V, --verbose Show debug output
|
|
559
576
|
|
|
560
|
-
${
|
|
561
|
-
asm export ${
|
|
562
|
-
asm export -s global ${
|
|
563
|
-
asm export > skills.json ${
|
|
577
|
+
${W.bold("Examples:")}
|
|
578
|
+
asm export ${W.dim("Export all skills")}
|
|
579
|
+
asm export -s global ${W.dim("Export global skills only")}
|
|
580
|
+
asm export > skills.json ${W.dim("Save to file")}`)}async function rH($){if($.flags.help){tH();return}let q=await h(),Z=await o(q,$.flags.scope),Q=v5(Z);console.log(JSON.stringify(Q,null,2))}function eH(){console.log(`${W.bold("Usage:")} asm import <file> [options]
|
|
564
581
|
|
|
565
582
|
Import skills from a previously exported JSON manifest. Recreates skill
|
|
566
583
|
installations based on the manifest metadata.
|
|
@@ -569,7 +586,7 @@ Skills that already exist at the target location are skipped unless --force
|
|
|
569
586
|
is used. Skills whose source files cannot be found locally are reported as
|
|
570
587
|
failed — install them first with "asm install".
|
|
571
588
|
|
|
572
|
-
${
|
|
589
|
+
${W.bold("Options:")}
|
|
573
590
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
574
591
|
-f, --force Overwrite existing skills
|
|
575
592
|
-y, --yes Skip confirmation prompt
|
|
@@ -577,99 +594,112 @@ ${U.bold("Options:")}
|
|
|
577
594
|
--no-color Disable ANSI colors
|
|
578
595
|
-V, --verbose Show debug output
|
|
579
596
|
|
|
580
|
-
${
|
|
581
|
-
asm import skills.json ${
|
|
582
|
-
asm import skills.json --force ${
|
|
583
|
-
asm import skills.json -s global ${
|
|
584
|
-
asm export > backup.json ${
|
|
585
|
-
asm import backup.json ${
|
|
586
|
-
${
|
|
587
|
-
Nothing to import after scope filtering (--scope ${
|
|
597
|
+
${W.bold("Examples:")}
|
|
598
|
+
asm import skills.json ${W.dim("Import from manifest")}
|
|
599
|
+
asm import skills.json --force ${W.dim("Overwrite existing skills")}
|
|
600
|
+
asm import skills.json -s global ${W.dim("Import only global skills")}
|
|
601
|
+
asm export > backup.json ${W.dim("Export first, then import later")}
|
|
602
|
+
asm import backup.json ${W.dim("Restore from backup")}`)}async function $B($){if($.flags.help){eH();return}let q=$.subcommand;if(!q)D("Missing required argument: <file>"),console.error('Run "asm import --help" for usage.'),process.exit(2);let{resolve:Z}=await import("path"),Q=Z(q),X;try{X=await m5(Q)}catch(G){D(G.message),process.exit(1)}let z=X.skills.length;if(z===0){if($.flags.json)console.log(JSON.stringify({total:0,installed:0,skipped:0,failed:0,results:[]},null,2));else console.log("Manifest contains no skills. Nothing to import.");return}let J=$.flags.scope==="both"?"all scopes":$.flags.scope;if(console.error(`${W.bold("Importing")} ${z} skill${z>1?"s":""} from ${W.dim(Q)}`),console.error(` Scope filter: ${J}`),$.flags.force)console.error(` ${W.yellow("Force mode: existing skills will be overwritten")}`);if(!$.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
603
|
+
${W.bold("Proceed?")} [y/N] `);let G=await Q0();if(G.toLowerCase()!=="y"&&G.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Y=await p5(X,{force:$.flags.force,dryRun:!1,scopeFilter:$.flags.scope});if($.flags.json){console.log(JSON.stringify(Y,null,2));return}if(Y.total===0){console.error(`
|
|
604
|
+
Nothing to import after scope filtering (--scope ${$.flags.scope}). All skills in the manifest were excluded.`);return}console.error("");for(let G of Y.results){let U=G.status==="installed"?W.green("+++"):G.status==="skipped"?W.yellow("---"):G.status==="dry-run"?W.cyan("~~~"):W.red("!!!"),H=G.reason?` ${W.dim(G.reason)}`:"",V=G.path?` ${W.dim(G.path)}`:"";console.error(` ${U} ${G.skillName} (${G.provider}/${G.scope})${H}${V}`)}if(console.error(""),console.error(`${W.bold("Summary:")} ${Y.total} total, ${W.green(String(Y.installed))} installed, ${W.yellow(String(Y.skipped))} skipped, ${W.red(String(Y.failed))} failed`),Y.failed>0)process.exitCode=1}function qB(){console.log(`${W.bold("Usage:")} asm init <name> [options]
|
|
588
605
|
|
|
589
606
|
Scaffold a new skill directory with a SKILL.md template. Creates a
|
|
590
607
|
ready-to-edit skill in the target tool's skill folder.
|
|
591
608
|
|
|
592
|
-
${
|
|
609
|
+
${W.bold("Options:")}
|
|
593
610
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
594
611
|
--path <dir> Scaffold in specified directory instead of provider path
|
|
595
612
|
-f, --force Overwrite if skill already exists
|
|
596
613
|
--no-color Disable ANSI colors
|
|
597
614
|
-V, --verbose Show debug output
|
|
598
615
|
|
|
599
|
-
${
|
|
600
|
-
asm init my-skill ${
|
|
601
|
-
asm init my-skill -p claude ${
|
|
602
|
-
asm init my-skill --path ./skills ${
|
|
603
|
-
${
|
|
616
|
+
${W.bold("Examples:")}
|
|
617
|
+
asm init my-skill ${W.dim("Scaffold (interactive tool)")}
|
|
618
|
+
asm init my-skill -p claude ${W.dim("Scaffold in Claude Code")}
|
|
619
|
+
asm init my-skill --path ./skills ${W.dim("Scaffold in custom directory")}`)}async function ZB($){if($.flags.help){qB();return}let q=$.subcommand;if(!q)D("Missing required argument: <name>"),console.error('Run "asm init --help" for usage.'),process.exit(2);let Z=C0(q),Q;if($.flags.path){let{resolve:X}=await import("path");Q=X($.flags.path)}else{let X=await h(),{provider:z}=await i0(X,$.flags.provider,!!process.stdin.isTTY),{join:J}=await import("path"),{resolveProviderPath:Y}=await import("./chunk-chw0sgjp.js"),G=Y(X.providers.find((U)=>U.name===z.name).global);Q=J(G,Z)}if(await c5(Q)){if(!$.flags.force){if(!process.stdin.isTTY)D(`Directory already exists: ${Q}. Use --force to overwrite.`),process.exit(2);process.stderr.write(`${W.yellow(`Directory already exists: ${Q}`)}
|
|
620
|
+
${W.bold("Overwrite?")} [y/N] `);let X=await Q0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}}await d5(Z,Q),console.error(W.green(`Done! Created skill "${Z}" at ${Q}`))}function QB(){console.log(`${W.bold("Usage:")} asm stats [options]
|
|
604
621
|
|
|
605
622
|
Show aggregate skill metrics with provider distribution charts,
|
|
606
623
|
scope breakdown, disk usage, and duplicate summary.
|
|
607
624
|
|
|
608
|
-
${
|
|
625
|
+
${W.bold("Options:")}
|
|
609
626
|
--json Output as JSON
|
|
610
627
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
611
628
|
--no-color Disable ANSI colors
|
|
612
629
|
-V, --verbose Show debug output
|
|
613
630
|
|
|
614
|
-
${
|
|
615
|
-
asm stats ${
|
|
616
|
-
asm stats -s global ${
|
|
617
|
-
asm stats --json ${
|
|
631
|
+
${W.bold("Examples:")}
|
|
632
|
+
asm stats ${W.dim("Show full dashboard")}
|
|
633
|
+
asm stats -s global ${W.dim("Global skills only")}
|
|
634
|
+
asm stats --json ${W.dim("Output raw data as JSON")}`)}async function XB($){if($.flags.help){QB();return}let q=await h(),Z=await o(q,$.flags.scope);if(Z.length===0){console.log("No skills found.");return}let Q=Q2(Z),X=await a5(Z,Q);if($.flags.json)if(!$.flags.verbose){let{perSkillDiskBytes:z,...J}=X;console.log(c(J))}else console.log(c(X));else console.log(i5(X))}function zB(){console.log(`${W.bold("Usage:")} asm doctor [options]
|
|
618
635
|
|
|
619
636
|
Run environment health checks and diagnostics. Validates all
|
|
620
637
|
prerequisites for using asm — git, GitHub CLI, Node.js, config,
|
|
621
638
|
lock file, registry, installed skills, and disk space.
|
|
622
639
|
|
|
623
|
-
${
|
|
640
|
+
${W.bold("Options:")}
|
|
624
641
|
--json Output as JSON
|
|
625
642
|
--machine Output in stable machine-readable v1 envelope format
|
|
626
643
|
--no-color Disable ANSI colors
|
|
627
644
|
-V, --verbose Show debug output
|
|
628
645
|
|
|
629
|
-
${
|
|
630
|
-
asm doctor ${
|
|
631
|
-
asm doctor --json ${
|
|
632
|
-
asm doctor --machine ${
|
|
646
|
+
${W.bold("Examples:")}
|
|
647
|
+
asm doctor ${W.dim("Run all health checks")}
|
|
648
|
+
asm doctor --json ${W.dim("Output as JSON")}
|
|
649
|
+
asm doctor --machine ${W.dim("Machine-readable v1 envelope output")}`)}async function JB($){if($.flags.help){zB();return}let q=performance.now(),Z=await M8();if($.flags.machine){let Q={checks:Z.checks.map((X)=>({name:X.name,status:X.status,message:X.message,...X.fix?{fix:X.fix}:{}})),passed:Z.passed,warnings:Z.warnings,failures:Z.failures};console.log(l("doctor",Q,q))}else if($.flags.json)console.log(j8(Z));else console.log(R8(Z));if(Z.failures>0)process.exit(1)}function YB(){console.log(`${W.bold("Usage:")} asm eval <target> [options]
|
|
633
650
|
|
|
634
651
|
Evaluate a skill's SKILL.md against best practices and produce a scored quality
|
|
635
652
|
report with recommendations. Zero configuration — just point it at a skill
|
|
636
653
|
directory. Categories: structure, description quality, prompt engineering,
|
|
637
654
|
context efficiency, safety, testability, and naming conventions.
|
|
638
655
|
|
|
639
|
-
|
|
640
|
-
|
|
656
|
+
Accepts a local path, a GitHub shorthand, or a GitHub URL. When the target is a
|
|
657
|
+
collection (no SKILL.md at the root but each immediate child has one), every
|
|
658
|
+
child skill is evaluated and an aggregate summary is printed.
|
|
641
659
|
|
|
642
|
-
${
|
|
660
|
+
${W.bold("Arguments:")}
|
|
661
|
+
target Local path, github:owner/repo[#ref][:subpath], or
|
|
662
|
+
https://github.com/owner/repo[/tree/<ref>/<sub>]
|
|
663
|
+
|
|
664
|
+
${W.bold("Options:")}
|
|
643
665
|
--fix Apply deterministic auto-fixes to SKILL.md (creates .bak)
|
|
644
666
|
--dry-run With --fix, preview the diff without writing
|
|
645
667
|
--json Output report as JSON
|
|
646
668
|
--machine Output in stable machine-readable v1 envelope format
|
|
669
|
+
--concurrency N Cap parallel per-skill evals in batch mode (default: 4)
|
|
670
|
+
--keep Preserve the temp dir used for remote clones
|
|
671
|
+
-t, --transport M Git transport (auto|https|ssh) for remote targets
|
|
647
672
|
--no-color Disable ANSI colors
|
|
648
673
|
-V, --verbose Show debug output
|
|
649
674
|
|
|
650
|
-
${
|
|
651
|
-
asm eval ./my-skill
|
|
652
|
-
asm eval ./
|
|
653
|
-
asm eval
|
|
654
|
-
asm eval
|
|
655
|
-
asm eval
|
|
656
|
-
asm eval
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
675
|
+
${W.bold("Examples:")}
|
|
676
|
+
asm eval ./my-skill ${W.dim("Score a single skill")}
|
|
677
|
+
asm eval ./skills/ ${W.dim("Batch-score every skill in the dir")}
|
|
678
|
+
asm eval github:mattpocock/skills:grill-me ${W.dim("Fetch a remote skill and score it")}
|
|
679
|
+
asm eval github:mattpocock/skills ${W.dim("Batch-score a remote collection")}
|
|
680
|
+
asm eval https://github.com/mattpocock/skills/tree/main/grill-me
|
|
681
|
+
asm eval ./my-skill --json ${W.dim("Output report as JSON")}
|
|
682
|
+
asm eval ./my-skill --fix ${W.dim("Auto-fix deterministic issues")}
|
|
683
|
+
asm eval ./my-skill --fix --dry-run ${W.dim("Preview fixes as diff")}
|
|
684
|
+
asm eval ./my-skill --machine ${W.dim("Machine-readable v1 envelope")}
|
|
685
|
+
asm eval-providers list ${W.dim("List registered eval providers")}`)}function GB($){let q=$.findings.find((Z)=>Z.severity==="error"&&(Z.code==="provider-threw"||Z.code==="timeout"||Z.code==="aborted"));if(q)throw Error(q.message)}async function UB($,q,Z){await E0();let Q=P0($);if(Q.isLocal)throw Error(`fetchRemoteForEval received a local path: "${$}". This is a bug — local paths should use the non-remote branch.`);Q=await s$(Q);let X=await S0(Q,q),z=Q.subpath?v6(X,Q.subpath):X,J=null;try{let{execFile:U}=await import("child_process"),{promisify:H}=await import("util"),V=H(U),{stdout:B}=await V("git",["-C",X,"rev-parse","HEAD"],{timeout:5000}),_=B.trim();if(/^[0-9a-f]{40}$/i.test(_))J=_}catch{}let Y=`github:${Q.owner}/${Q.repo}${Q.ref?`#${Q.ref}`:""}${Q.subpath?`:${Q.subpath}`:""}`;return{rootDir:z,cleanup:async()=>{if(Z)return;await e(X)},sourceRef:Y,commitSha:J}}async function K6($){$1();try{let q={skillPath:$.skillPath,skillMdPath:$.skillMdPath},Z=(await Promise.all(u$(q1()).map(async(z)=>{if(!(await z.applicable(q,{})).ok)return null;return Z1(z,q)}))).filter((z)=>z!==null),Q=Z.find((z)=>z.providerId==="quality");if(!Q)throw Error("quality provider did not produce a result");return GB(Q),{report:{...Q.raw,providers:u$(Z.map($6))},error:null}}catch(q){return{report:null,error:q?.message??String(q)}}}async function WB($){if($.flags.help){YB();return}let q=$.flags.machine?c0():void 0,Z=performance.now(),Q=$.subcommand;if(!Q){if($.flags.machine)q?.(),console.log(a("eval",n.INVALID_ARGUMENT,"Missing required argument: <skill-path>",Z)),process.exit(2);D("Missing required argument: <skill-path>"),console.error('Run "asm eval --help" for usage.'),process.exit(2)}if($.flags.fix){if(i4(Q)){if($.flags.machine)q?.(),console.log(a("eval",n.INVALID_ARGUMENT,"--fix is only supported for local skill paths. Clone the repo first or run `asm install` to materialise it locally.",Z)),process.exit(2);D("--fix is only supported for local skill paths. Clone the repo first or run `asm install` to materialise it locally."),process.exit(2)}try{let z=await x8(),J=await b8(Q,{dryRun:$.flags.dryRun,gitAuthor:z});if($.flags.machine){q?.(),console.log(l("eval",sq(J.report,J),Z));return}if($.flags.json){console.log(JSON.stringify({report:J.report,fix:{dryRun:J.dryRun,applied:J.applied,skipped:J.skipped,backupPath:J.backupPath,diff:J.diff}},null,2));return}console.log(oq(J.report)),console.log(""),console.log(y8(J));return}catch(z){if($.flags.machine)q?.(),console.log(a("eval",n.SKILL_NOT_FOUND,z?.message??String(z),Z)),process.exit(1);D(z?.message??String(z)),process.exit(1)}return}let X=null;try{X=await k8(Q,{fetchRemote:(z)=>UB(z,$.flags.transport,$.flags.keep)})}catch(z){if($.flags.machine)q?.(),console.log(a("eval",n.SKILL_NOT_FOUND,z?.message??String(z),Z)),process.exit(1);D(z?.message??String(z)),process.exit(1)}try{if(!X.isCollection&&X.targets.length===1){let U=X.targets[0],{report:H,error:V}=await K6(U);if(!H)throw Error(V??"eval failed");if($.flags.machine){q?.();let B=sq(H,null),_=X.provenance.remote?{...B,provenance:{input:X.provenance.input,remote:!0,source_ref:X.provenance.sourceRef??null,commit_sha:X.provenance.commitSha??null,temp_path:X.provenance.tempPath??null}}:B;console.log(l("eval",_,Z));return}if($.flags.json){if(X.provenance.remote)console.log(JSON.stringify({...H,provenance:{input:X.provenance.input,remote:!0,sourceRef:X.provenance.sourceRef??null,commitSha:X.provenance.commitSha??null,tempPath:X.provenance.tempPath??null}},null,2));else console.log(f8(H));return}if(console.log(oq(H)),X.provenance.remote)VB(X.provenance);return}let z=$.flags.concurrency||4;if(X.targets.length===0)throw Error(`No skills to evaluate at "${Q}" — the resolved location has no SKILL.md in itself or its immediate children.`);let J=await h8(X.targets,z,async(U)=>{let{report:H,error:V}=await K6(U);return{label:U.label,skillPath:U.skillPath,report:H,error:V}}),Y=v8(J),G={provenance:X.provenance,aggregate:Y,results:J};if($.flags.machine){q?.(),console.log(l("eval",u8(G),Z));return}if($.flags.json){console.log(JSON.stringify({provenance:G.provenance,aggregate:G.aggregate,results:G.results.map((U)=>({label:U.label,skillPath:U.skillPath,error:U.error,report:U.report}))},null,2));return}for(let U of G.results){if(U.report)console.log(oq(U.report));else console.log(`Skill evaluation: ${U.skillPath}`),console.log(` ${W.red("error:")} ${U.error??"unknown failure"}`);console.log("")}if(console.log(g8(G)),X.provenance.remote&&!$.flags.verbose);}catch(z){if($.flags.machine)q?.(),console.log(a("eval",n.SKILL_NOT_FOUND,z?.message??String(z),Z)),process.exit(1);D(z?.message??String(z)),process.exit(1)}finally{if(X)try{await X.cleanup()}catch{}}}function VB($){let q=[];if(q.push(""),q.push(W.dim("Fetched remote skill:")),$.sourceRef)q.push(W.dim(` Source: ${$.sourceRef}`));if($.commitSha)q.push(W.dim(` Commit: ${$.commitSha}`));if($.tempPath)q.push(W.dim(` Temp: ${$.tempPath}`));console.log(q.join(`
|
|
686
|
+
`))}function HB(){console.log(`${W.bold("Usage:")} asm eval-providers <subcommand> [options]
|
|
687
|
+
|
|
688
|
+
Manage evaluation providers registered with the ${W.bold("asm eval")} framework.
|
|
689
|
+
Providers implement the ${W.bold("EvalProvider")} contract (see src/eval/types.ts) and
|
|
660
690
|
are resolved by id and semver range.
|
|
661
691
|
|
|
662
|
-
${
|
|
692
|
+
${W.bold("Subcommands:")}
|
|
663
693
|
list List every registered (id, version) provider
|
|
664
694
|
|
|
665
|
-
${
|
|
695
|
+
${W.bold("Options:")}
|
|
666
696
|
--json Output as JSON (list)
|
|
667
697
|
--no-color Disable ANSI colors
|
|
668
698
|
-V, --verbose Show debug output
|
|
669
699
|
|
|
670
|
-
${
|
|
671
|
-
asm eval-providers list ${
|
|
672
|
-
asm eval-providers list --json ${
|
|
700
|
+
${W.bold("Examples:")}
|
|
701
|
+
asm eval-providers list ${W.dim("Show registered providers")}
|
|
702
|
+
asm eval-providers list --json ${W.dim("Machine-readable listing")}`)}async function BB($){if($.flags.help){HB();return}let q=$.subcommand;if(!q)D("Missing subcommand. Use: list"),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2);switch(q){case"list":{$1();let Z=tq();if($.flags.json){console.log(c(Z.map((Y)=>({id:Y.id,version:Y.version,schemaVersion:Y.schemaVersion,description:Y.description,requires:Y.requires??[]}))));return}if(Z.length===0){console.log("No eval providers registered.");return}let Q=["id","version","schemaVersion","description","requires"],X=Z.map((Y)=>[Y.id,Y.version,String(Y.schemaVersion),Y.description,Y.requires&&Y.requires.length>0?Y.requires.join(","):"-"]),z=Q.map((Y,G)=>Math.max(Y.length,...X.map((U)=>U[G].length))),J=(Y)=>Y.map((G,U)=>G.padEnd(z[U])).join(" ");console.log(W.bold(J(Q))),console.log(z.map((Y)=>"-".repeat(Y)).join(" "));for(let Y of X)console.log(J(Y));return}default:D(`Unknown eval-providers subcommand: "${q}". Use: list`),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2)}}function KB(){console.log(`${W.bold("Usage:")} asm link <path> [<path2> ...] [options]
|
|
673
703
|
|
|
674
704
|
Symlink a local skill directory into an agent's skill folder. Useful
|
|
675
705
|
for local development — changes to the source are reflected immediately.
|
|
@@ -680,7 +710,7 @@ files, all discovered skills are linked in a single invocation.
|
|
|
680
710
|
|
|
681
711
|
Multiple paths can be provided to link several skills at once.
|
|
682
712
|
|
|
683
|
-
${
|
|
713
|
+
${W.bold("Options:")}
|
|
684
714
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
685
715
|
--name <name> Override symlink name (single skill only)
|
|
686
716
|
-f, --force Overwrite if target already exists
|
|
@@ -688,28 +718,28 @@ ${U.bold("Options:")}
|
|
|
688
718
|
--no-color Disable ANSI colors
|
|
689
719
|
-V, --verbose Show debug output
|
|
690
720
|
|
|
691
|
-
${
|
|
692
|
-
asm link ./my-skill ${
|
|
693
|
-
asm link ./my-skill -p claude ${
|
|
694
|
-
asm link ./my-skill --name alias ${
|
|
695
|
-
asm link ./my-skills-folder ${
|
|
696
|
-
asm link ./skill1 ./skill2 ./skill3 -p claude ${
|
|
697
|
-
${
|
|
698
|
-
${
|
|
699
|
-
Done! Linked ${
|
|
700
|
-
${
|
|
701
|
-
${B.length} linked, ${_.length} failed.`));else console.error(
|
|
702
|
-
Done! Linked ${B.length} skill(s) successfully.`));if(_.length>0)process.exit(1)}function
|
|
721
|
+
${W.bold("Examples:")}
|
|
722
|
+
asm link ./my-skill ${W.dim("Link (interactive tool)")}
|
|
723
|
+
asm link ./my-skill -p claude ${W.dim("Link to Claude Code")}
|
|
724
|
+
asm link ./my-skill --name alias ${W.dim("Link with custom name")}
|
|
725
|
+
asm link ./my-skills-folder ${W.dim("Link all skills in folder")}
|
|
726
|
+
asm link ./skill1 ./skill2 ./skill3 -p claude ${W.dim("Link multiple skills at once")}`)}async function _B($,q){if(q)return!0;let{access:Z}=await import("fs/promises"),Q=!1;try{await Z($),Q=!0}catch{}if(!Q)return!1;if(!process.stdin.isTTY)throw Error(`Target already exists: ${$}. Use --force to overwrite.`);process.stderr.write(`${W.yellow(`Target already exists: ${$}`)}
|
|
727
|
+
${W.bold("Overwrite?")} [y/N] `);let X=await Q0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0);return!0}async function J1($,q,Z,Q){let{join:X}=await import("path"),z=X(q,Z),J=await _B(z,Q);return await s5($,q,Z,J),{name:Z,symlinkPath:z,targetPath:$}}async function OB($){if($.flags.help){KB();return}let q=[];if($.subcommand)q.push($.subcommand);if(q.push(...$.positional),q.length===0)D("Missing required argument: <path>"),console.error('Run "asm link --help" for usage.'),process.exit(2);if(q.length>1){if($.flags.name)D("--name cannot be used when linking multiple paths. Link each skill individually to use --name."),process.exit(2);let O=await h(),{provider:K}=await i0(O,$.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:L}=await import("./chunk-chw0sgjp.js"),F=L(O.providers.find((w)=>w.name===K.name).global),{resolve:A,basename:M}=await import("path"),j=[],T=[];for(let w of q){let x=A(w),P=!1;try{await S4(x),P=!0}catch{}if(P){let y=M(x);try{let I=await J1(x,F,y,!!$.flags.force);if(j.push(I),!$.flags.json)console.error(W.green(` Linked "${I.name}" -> ${I.targetPath}`))}catch(I){let R=I instanceof Error?I.message:String(I);if(T.push({name:y,error:R}),!$.flags.json)console.error(W.red(` Failed to link "${y}": ${R}`))}}else{let y=[];try{y=await b4(x)}catch(I){let R=I instanceof Error?I.message:String(I);if(T.push({name:w,error:R}),!$.flags.json)console.error(W.red(` Failed to process "${w}": ${R}`));continue}if(y.length===0){let I=`No SKILL.md found in ${x} or its immediate subdirectories.`;if(T.push({name:w,error:I}),!$.flags.json)console.error(W.red(` ${I}`));continue}for(let I of y)try{let R=await J1(I.absPath,F,I.dirName,!!$.flags.force);if(j.push(R),!$.flags.json)console.error(W.green(` Linked "${R.name}" -> ${R.targetPath}`))}catch(R){let C=R instanceof Error?R.message:String(R);if(T.push({name:I.name,error:C}),!$.flags.json)console.error(W.red(` Failed to link "${I.name}": ${C}`))}}}if($.flags.json)console.log(c({success:T.length===0,linked:j,failures:T}));else if(T.length>0)console.error(W.yellow(`
|
|
728
|
+
${j.length} linked, ${T.length} failed.`));else console.error(W.green(`
|
|
729
|
+
Done! Linked ${j.length} skill(s) successfully.`));if(T.length>0)process.exit(1);return}let Z=q[0],{resolve:Q,basename:X}=await import("path"),z=Q(Z),J=!1;try{await S4(z),J=!0}catch{}let Y=[];if(!J){if(Y=await b4(z),Y.length===0)D(`No SKILL.md found in ${z} or its immediate subdirectories.`),process.exit(1);if($.flags.name&&Y.length>1)D(`--name cannot be used when linking multiple skills (found ${Y.length} skills). Link each skill individually to use --name.`),process.exit(2)}let G=await h(),{provider:U}=await i0(G,$.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:H}=await import("./chunk-chw0sgjp.js"),V=H(G.providers.find((O)=>O.name===U.name).global);if(J){let O=$.flags.name?C0($.flags.name):X(z),K;try{K=await J1(z,V,O,!!$.flags.force)}catch(L){let F=L instanceof Error?L.message:String(L);if($.flags.json)console.log(c({success:!1,error:F}));else D(F);process.exit(2)}if($.flags.json)console.log(c({success:!0,...K}));else console.error(W.green(`Done! Linked "${K.name}" -> ${K.targetPath}`)),console.error(` Symlink: ${K.symlinkPath}`),console.error(W.dim(` If you move or delete the source, run "asm uninstall ${K.name}" to clean up.`));return}console.error(`Found ${W.bold(String(Y.length))} skill(s) in ${z}:`);for(let O of Y)console.error(` ${W.bold(O.name)} ${W.dim(`v${O.version}`)} ${W.dim(`(${O.dirName}/)`)}`);if(process.stdin.isTTY&&!$.flags.force){process.stderr.write(`
|
|
730
|
+
${W.bold(`Link ${Y.length} skill(s)?`)} [Y/n] `);let O=await Q0();if(O.toLowerCase()==="n"||O.toLowerCase()==="no")console.error("Aborted."),process.exit(0)}let B=[],_=[];for(let O of Y){let K=$.flags.name&&Y.length===1?C0($.flags.name):O.dirName;try{let L=await J1(O.absPath,V,K,!!$.flags.force);if(B.push(L),!$.flags.json)console.error(W.green(` Linked "${L.name}" -> ${L.targetPath}`))}catch(L){let F=L instanceof Error?L.message:String(L);if(_.push({name:O.name,error:F}),!$.flags.json)console.error(W.red(` Failed to link "${O.name}": ${F}`))}}if($.flags.json)console.log(c({success:_.length===0,linked:B,failures:_}));else if(_.length>0)console.error(W.yellow(`
|
|
731
|
+
${B.length} linked, ${_.length} failed.`));else console.error(W.green(`
|
|
732
|
+
Done! Linked ${B.length} skill(s) successfully.`));if(_.length>0)process.exit(1)}function LB(){console.log(`${W.bold("Usage:")} asm index <subcommand> [options]
|
|
703
733
|
|
|
704
734
|
Manage the skill index for searching available skills from indexed repos.
|
|
705
735
|
|
|
706
|
-
${
|
|
736
|
+
${W.bold("Subcommands:")}
|
|
707
737
|
ingest <repo> Ingest a skill repository into the index
|
|
708
738
|
search <query> Search indexed skills by name or description
|
|
709
739
|
list List all indexed repositories
|
|
710
740
|
remove <owner/repo> Remove a repo from the index
|
|
711
741
|
|
|
712
|
-
${
|
|
742
|
+
${W.bold("Options:")}
|
|
713
743
|
--json Output as JSON
|
|
714
744
|
--has <field> Only show skills that have <field> (license, creator, version)
|
|
715
745
|
--missing <field> Only show skills missing <field> (license, creator, version)
|
|
@@ -717,49 +747,49 @@ ${U.bold("Options:")}
|
|
|
717
747
|
--no-color Disable ANSI colors
|
|
718
748
|
-V, --verbose Show debug output
|
|
719
749
|
|
|
720
|
-
${
|
|
721
|
-
asm index ingest github:obra/superpowers ${
|
|
722
|
-
asm index search code review ${
|
|
723
|
-
asm index search marketing --has license ${
|
|
724
|
-
asm index search "" --missing creator ${
|
|
725
|
-
asm index list ${
|
|
726
|
-
asm index remove obra/superpowers ${
|
|
727
|
-
`));for(let J of z){let
|
|
728
|
-
`)}}break}case"list":{let Z=await
|
|
729
|
-
`));for(let X of Z)console.error(`${
|
|
750
|
+
${W.bold("Examples:")}
|
|
751
|
+
asm index ingest github:obra/superpowers ${W.dim("Index superpowers repo")}
|
|
752
|
+
asm index search code review ${W.dim("Search for skills")}
|
|
753
|
+
asm index search marketing --has license ${W.dim("Only with license")}
|
|
754
|
+
asm index search "" --missing creator ${W.dim("Skills missing creator")}
|
|
755
|
+
asm index list ${W.dim("List indexed repos")}
|
|
756
|
+
asm index remove obra/superpowers ${W.dim("Remove from index")}`)}async function FB($){if($.flags.help){LB();return}let q=$.subcommand;if(!q)D("Missing subcommand. Use: ingest, search, list, or remove"),console.error('Run "asm index --help" for usage.'),process.exit(2);switch(q){case"ingest":{let Z=$.positional[0];if(!Z)D("Missing required argument: <repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);console.error(W.blueBold(`Ingesting ${Z}...`));let Q=await V6(Z);if(!Q.success)D(`Failed to ingest: ${Q.error}`),process.exit(1);if(Q.repoIndex)if($.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(W.green(`Successfully indexed ${Q.repoIndex.owner}/${Q.repoIndex.repo}`)),console.error(` Skills found: ${Q.repoIndex.skillCount}`);break}case"search":{let Z=$.positional.join(" ");if(!Z&&$.flags.has.length===0&&$.flags.missing.length===0)D("Missing required argument: <query>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let Q={};if($.flags.has.length>0)Q.has=$.flags.has;if($.flags.missing.length>0)Q.missing=$.flags.missing;let z=Q.has||Q.missing?await X1(Z||"",20,Q):await X1(Z);if(z.length===0){if($.flags.json)console.log(c([]));else console.info("No skills found matching your query."),console.error(W.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if($.flags.json)console.log(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(W.bold(`Found ${z.length} skills:
|
|
757
|
+
`));for(let J of z){let Y=J.skill.verified?W.blue(" [verified]"):"";console.error(`${W.cyan(J.skill.name)} ${W.dim(`v${J.skill.version}`)}${Y} ${W.dim(`[${J.repo.owner}/${J.repo.repo}]`)}`);for(let U of E6(J.skill.description,80))console.error(` ${U}`);let G=G6(J.skill);if(G.length>0)console.error(` ${W.yellow(`⚠ Missing: ${G.join(", ")}`)}`);console.error(` ${W.green(`asm install ${J.skill.installUrl}`)}
|
|
758
|
+
`)}}break}case"list":{let Z=await H6();if(Z.length===0){if($.flags.json)console.log(c([]));else console.info("No repositories indexed."),console.error(W.dim("Add repos with: asm index ingest <repo>"));return}let Q=await U6();if($.flags.json)console.log(c(Z));else{console.error(W.bold(`Indexed Repositories (${Q} total skills):
|
|
759
|
+
`));for(let X of Z)console.error(`${W.cyan(`${X.owner}/${X.repo}`)} - ${X.skillCount} skills ${W.dim(`(${new Date(X.updatedAt).toLocaleDateString()})`)}`)}break}case"remove":{let Z=$.positional[0];if(!Z)D("Missing required argument: <owner/repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2);let[Q,X]=Z.split("/");if(!Q||!X)D("Invalid format. Use: <owner/repo>"),process.exit(2);if(!$.flags.yes&&process.stdin.isTTY){process.stderr.write(`${W.bold("Remove")} ${W.cyan(`${Q}/${X}`)} ${W.bold("from index?")} [y/N] `);let J=await Q0();if(J.toLowerCase()!=="y"&&J.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}if(await B6(Q,X))console.error(W.green(`Removed ${Q}/${X} from index`));else D(`Repository not found in index: ${Q}/${X}`),process.exit(1);break}default:D(`Unknown subcommand: "${q}"`),console.error('Run "asm index --help" for usage.'),process.exit(2)}}function AB(){console.log(`${W.bold("Usage:")} asm bundle <subcommand> [options]
|
|
730
760
|
|
|
731
761
|
Create, install, and manage curated skill bundles. A bundle is a reusable
|
|
732
762
|
recipe of skills for a particular workflow, domain, or project setup.
|
|
733
763
|
|
|
734
|
-
${
|
|
764
|
+
${W.bold("Subcommands:")}
|
|
735
765
|
create <name> Create a new bundle from installed skills
|
|
736
766
|
install <name|file> Install all skills from a bundle
|
|
737
767
|
list List all saved bundles
|
|
738
768
|
show <name|file> Show bundle details
|
|
739
769
|
remove <name> Remove a saved bundle
|
|
740
770
|
|
|
741
|
-
${
|
|
771
|
+
${W.bold("Options:")}
|
|
742
772
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
743
773
|
-y, --yes Skip confirmation prompts
|
|
744
774
|
--json Output as JSON
|
|
745
775
|
--no-color Disable ANSI colors
|
|
746
776
|
-V, --verbose Show debug output
|
|
747
777
|
|
|
748
|
-
${
|
|
749
|
-
asm bundle create my-workflow ${
|
|
750
|
-
asm bundle install my-workflow ${
|
|
751
|
-
asm bundle install ./bundle.json ${
|
|
752
|
-
asm bundle list ${
|
|
753
|
-
asm bundle list --json ${
|
|
754
|
-
asm bundle show my-workflow ${
|
|
755
|
-
asm bundle remove my-workflow ${
|
|
756
|
-
`));let
|
|
757
|
-
${
|
|
758
|
-
${
|
|
759
|
-
Installing ${
|
|
760
|
-
`));for(let Q of Z){let X=Q.tags&&Q.tags.length>0?` ${
|
|
761
|
-
${
|
|
762
|
-
`)),console.log(JSON.stringify(X.manifest,null,2));return}if(X.prUrl)console.error(
|
|
778
|
+
${W.bold("Examples:")}
|
|
779
|
+
asm bundle create my-workflow ${W.dim("Create from installed skills")}
|
|
780
|
+
asm bundle install my-workflow ${W.dim("Install a saved bundle")}
|
|
781
|
+
asm bundle install ./bundle.json ${W.dim("Install from file")}
|
|
782
|
+
asm bundle list ${W.dim("Show all saved bundles")}
|
|
783
|
+
asm bundle list --json ${W.dim("List bundles as JSON")}
|
|
784
|
+
asm bundle show my-workflow ${W.dim("Show bundle details")}
|
|
785
|
+
asm bundle remove my-workflow ${W.dim("Remove a saved bundle")}`)}async function IB($){if($.flags.help){AB();return}let q=$.subcommand;if(!q)D("Missing subcommand. Use: create, install, list, show, or remove"),console.error('Run "asm bundle --help" for usage.'),process.exit(2);switch(q){case"create":{let Z=$.positional[0];if(!Z)D("Missing required argument: <name>"),console.error("Usage: asm bundle create <name>"),process.exit(2);let Q=await h(),X=await o(Q,$.flags.scope);if(X.length===0)D("No skills found to include in the bundle."),process.exit(1);let z=new Set,J=X.filter((K)=>{let L=K.name.toLowerCase();if(z.has(L))return!1;return z.add(L),!0}),Y=J;if(process.stdin.isTTY&&!$.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(W.bold(`Select skills for bundle "${Z}":
|
|
786
|
+
`));let L=await a0({items:K});if(L.length===0)D("No skills selected. Bundle not created."),process.exit(1);Y=L.map((F)=>J[F])}let{readLock:G}=await import("./chunk-83zxj8cj.js"),U=await G(),H=await Promise.all(Y.map((K)=>r5(K,U))),V=`Bundle of ${H.length} skills`,B="unknown";try{let{execSync:K}=await import("child_process"),L=K("git config user.name",{encoding:"utf-8"}).trim();if(L)B=L}catch{}if(process.stdin.isTTY&&!$.flags.yes){process.stderr.write(`
|
|
787
|
+
${W.bold("Description")} (optional, press Enter to skip): `);let K=await Q0();if(K.trim())V=K.trim();process.stderr.write(`${W.bold("Author")} (optional, press Enter to skip): `);let L=await Q0();if(L.trim())B=L.trim()}let _=t5(Z,V,B,H),O=await e5(_);if($.flags.json)console.log(JSON.stringify(_,null,2));else console.error(W.green(`Bundle "${Z}" created with ${H.length} skill(s).`)),console.error(` Saved to: ${W.dim(O)}`);break}case"install":{let Z=$.positional[0];if(!Z)D("Missing required argument: <name|file>"),console.error("Usage: asm bundle install <name|file>"),process.exit(2);let Q;try{Q=await y4(Z)}catch(V){D(V.message),process.exit(1)}if(console.error(`${W.bold("Bundle:")} ${Q.name} (${Q.skills.length} skills)`),Q.description)console.error(` ${W.dim(Q.description)}`);console.error("");for(let V of Q.skills){let B=V.version?` v${V.version}`:"";console.error(` ${W.cyan(V.name)}${W.dim(B)} ${W.dim(`-> ${V.installUrl}`)}`)}if(!$.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
788
|
+
${W.bold("Install all skills from this bundle?")} [y/N] `);let V=await Q0();if(V.toLowerCase()!=="y"&&V.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let X=[],z=await h(),{provider:J}=await i0(z,$.flags.provider,!1),Y=$.flags.scope==="global"||$.flags.scope==="project"?$.flags.scope:"global";for(let V of Q.skills){console.error(`
|
|
789
|
+
Installing ${W.bold(V.name)}...`);try{if(V.installUrl.startsWith("github:")||V.installUrl.startsWith("https://github.com/"))await E0();let _=P0(V.installUrl),O=!!_.isLocal,K=null;try{let L,F;if(!O)K=await S0(_,$.flags.transport),L=K,F=_.subpath?v6(K,_.subpath):K;else L=_.localPath,F=_.localPath;let A=await b0(F),M=C0(V.name||A.name||_.repo),j=B1(_,L,F,M,J,$.flags.force,Y);try{await T2(j.targetDir,j.force)}catch(T){if(T.message?.includes("--force")){X.push({name:V.name,status:"skipped",reason:"Already installed. Use --force to overwrite."}),console.error(` ${W.dim("---")} ${V.name} skipped (already installed)`);continue}throw T}await r$(j),X.push({name:V.name,status:"installed"}),console.error(` ${W.green("+++")} ${V.name} installed`)}finally{if(K)await e(K)}}catch(B){X.push({name:V.name,status:"failed",reason:B.message}),console.error(` ${W.red("!!!")} ${V.name}: ${B.message}`)}}let G=X.filter((V)=>V.status==="installed").length,U=X.filter((V)=>V.status==="skipped").length,H=X.filter((V)=>V.status==="failed").length;if($.flags.json)console.log(JSON.stringify({bundleName:Q.name,total:X.length,installed:G,skipped:U,failed:H,results:X},null,2));else console.error(""),console.error(`${W.bold("Summary:")} ${X.length} total, ${W.green(String(G))} installed, `+(U>0?`${W.dim(String(U))} skipped, `:"")+`${W.red(String(H))} failed`);if(H>0)process.exitCode=1;break}case"list":{let Z=await $8();if(Z.length===0){if($.flags.json)console.log("[]");else console.log("No bundles found."),console.error(W.dim("Create one with: asm bundle create <name>"));return}if($.flags.json)console.log(JSON.stringify(Z,null,2));else{console.error(W.bold(`Saved Bundles (${Z.length}):
|
|
790
|
+
`));for(let Q of Z){let X=Q.tags&&Q.tags.length>0?` ${W.dim(`[${Q.tags.join(", ")}]`)}`:"";if(console.error(` ${W.cyan(Q.name)} ${W.dim(`(${Q.skills.length} skills)`)}${X}`),Q.description)console.error(` ${W.dim(Q.description)}`);if(Q.author)console.error(` ${W.dim(`by ${Q.author}`)}`)}}break}case"show":{let Z=$.positional[0];if(!Z)D("Missing required argument: <name|file>"),console.error("Usage: asm bundle show <name|file>"),process.exit(2);let Q;try{Q=await y4(Z)}catch(X){D(X.message),process.exit(1)}if($.flags.json)console.log(JSON.stringify(Q,null,2));else{if(console.error(W.bold(`Bundle: ${Q.name}`)),Q.description)console.error(` ${Q.description}`);if(Q.author)console.error(` ${W.dim(`Author: ${Q.author}`)}`);if(console.error(` ${W.dim(`Created: ${new Date(Q.createdAt).toLocaleString()}`)}`),Q.tags&&Q.tags.length>0)console.error(` ${W.dim(`Tags: ${Q.tags.join(", ")}`)}`);console.error(`
|
|
791
|
+
${W.bold(`Skills (${Q.skills.length})`)}:`);for(let X of Q.skills){let z=X.version?` v${X.version}`:"";if(console.error(` ${W.cyan(X.name)}${W.dim(z)}`),X.description)console.error(` ${W.dim(X.description)}`);console.error(` ${W.dim(`install: ${X.installUrl}`)}`)}}break}case"remove":{let Z=$.positional[0];if(!Z)D("Missing required argument: <name>"),console.error("Usage: asm bundle remove <name>"),process.exit(2);if(!$.flags.yes&&process.stdin.isTTY){process.stderr.write(`${W.bold("Remove bundle")} ${W.cyan(Z)}${W.bold("?")} [y/N] `);let X=await Q0();if(X.toLowerCase()!=="y"&&X.toLowerCase()!=="yes")console.error("Aborted."),process.exit(0)}let Q;try{Q=await q8(Z)}catch(X){D(X.message),process.exit(1)}if(Q)console.error(W.green(`Bundle "${Z}" removed.`));else D(`Bundle "${Z}" not found.`),process.exit(1);break}default:D(`Unknown subcommand: "${q}". Use: create, install, list, show, or remove`),console.error('Run "asm bundle --help" for usage.'),process.exit(2)}}async function TB($){if($.flags.help){bH();return}let q=$.flags.machine?c0():void 0,Z=performance.now(),Q=$.subcommand||".";try{let X=await Y8({path:Q,dryRun:$.flags.dryRun,force:$.flags.force,yes:$.flags.yes});if($.flags.machine){if(q?.(),!X.success)console.log(a("publish",n.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($.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)D(X.error||"Publish failed."),process.exit(1);if(X.fallback){console.log(W.yellow("Manifest generated (gh CLI unavailable):")),console.log(G8(X));return}if($.flags.dryRun){console.error(W.dim(`Dry run — no PR created.
|
|
792
|
+
`)),console.log(JSON.stringify(X.manifest,null,2));return}if(X.prUrl)console.error(W.green("Published successfully!")),console.error(""),console.error(` PR: ${X.prUrl}`),console.error(` Manifest: manifests/${X.manifest?.author}/${X.manifest?.name}.json`),console.error(` Security: ${X.securityVerdict}`),console.error(""),console.error(W.dim("The registry maintainers will review your submission."))}catch(X){let z={success:!1,manifest:null,prUrl:null,error:X.message,securityVerdict:"pass",securityReport:{scannedAt:new Date().toISOString(),skillName:"",skillPath:"",source:null,codeScans:[],permissions:[],totalFiles:0,totalLines:0,verdict:"safe",verdictReason:""}};if($.flags.machine)q?.(),console.log(a("publish",n.PUBLISH_FAILED,X.message,Z)),process.exit(1);if($.flags.json)console.log(JSON.stringify({success:!1,manifest:null,pr_url:null,error:X.message,security_verdict:null},null,2)),process.exit(1);D(X.message),process.exit(1)}}async function MB($){if($.flags.help){xH();return}let q=$.flags.machine?c0():void 0,Z=performance.now();try{let Q=await m4();if($.flags.machine){q?.();let z=Q.entries.map((J)=>({name:J.name,installed_commit:J.installedCommit,latest_commit:J.latestCommit,source:J.sourceType,status:J.status}));console.log(l("outdated",z,Z));return}if($.flags.json){console.log(_8(Q));return}let X=!$.flags.noColor&&process.stdout.isTTY!==!1;if(console.log(K8(Q,X)),Q.outdatedCount>0)process.exitCode=1}catch(Q){if($.flags.machine)q?.(),console.log(a("outdated",n.UNKNOWN_ERROR,Q.message,Z)),process.exit(1);D(Q.message),process.exit(1)}}async function RB($){if($.flags.help){fH();return}let q=$.flags.machine?c0():void 0,Z=performance.now(),Q=[];if($.subcommand)Q.push($.subcommand);Q.push(...$.positional);try{let X=await B8(Q.length>0?Q:null,$.flags.yes);if($.flags.machine){q?.();let J=X.results.map((Y)=>({name:Y.name,status:Y.status,reason:Y.reason||null,old_commit:Y.oldCommit||null,new_commit:Y.newCommit||null,security_verdict:Y.securityVerdict||null}));console.log(l("update",J,Z));return}if($.flags.json){console.log(O8(X));return}if(X.results.length>0)console.error(W.yellow("Note: project-scoped skill detection is not yet supported. All updates target the global skill path."));if(X.warnings&&X.warnings.length>0)for(let J of X.warnings)console.error(W.yellow(`Warning: skill "${J}" not found in lock file — skipped`));if(X.results.length===0){console.log("All skills are up to date.");return}for(let J of X.results)switch(J.status){case"updated":if(console.log(`${W.green("✓")} ${J.name} ${W.dim(J.oldCommit||"")} → ${J.newCommit||""}`),J.securityVerdict==="warning")console.error(W.yellow(` ⚠ Security audit returned warning for ${J.name} — updated because --yes was supplied`));break;case"skipped":console.log(`${W.yellow("○")} ${J.name} ${W.dim(J.reason||"skipped")}`);break;case"failed":console.log(`${W.red("✗")} ${J.name} ${W.dim(J.reason||"failed")}`);break}console.log("");let z=[];if(X.updatedCount>0)z.push(W.green(`${X.updatedCount} updated`));if(X.skippedCount>0)z.push(W.yellow(`${X.skippedCount} skipped`));if(X.failedCount>0)z.push(W.red(`${X.failedCount} failed`));if(console.log(z.join(", ")),X.failedCount>0)process.exitCode=1}catch(X){if($.flags.machine)q?.(),console.log(a("update",n.UNKNOWN_ERROR,X.message,Z)),process.exit(1);D(X.message),process.exit(1)}}async function g6($){let q=wH($);if(q.flags.json&&q.flags.machine)D("--json and --machine are mutually exclusive. Use one or the other."),process.exit(2);if(q.flags.machine)q.flags.yes=!0;if(q.flags.noColor)globalThis.__CLI_NO_COLOR=!0;if(q.flags.verbose)_6(!0);if(q.flags.version){console.log(`asm ${X2}`);let Z=await aq();if(q.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(W.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(W.dim(" Pick one package manager (npm OR bun) and remove the other install.")),console.error(W.dim(" See: https://github.com/luongnv89/agent-skill-manager#troubleshooting"))}return}if(!q.command&&q.flags.help){NH();return}if(!q.command)return;switch(q.command){case"list":await kH(q);break;case"search":await vH(q);break;case"inspect":await hH(q);break;case"uninstall":await gH(q);break;case"audit":await uH(q);break;case"install":await sH(q);break;case"config":await lH(q);break;case"export":await rH(q);break;case"import":await $B(q);break;case"init":await ZB(q);break;case"stats":await XB(q);break;case"link":await OB(q);break;case"index":await FB(q);break;case"bundle":await IB(q);break;case"publish":await TB(q);break;case"outdated":await MB(q);break;case"update":await RB(q);break;case"doctor":await JB(q);break;case"eval":await WB(q);break;case"eval-providers":await BB(q);break;default:D(`Unknown command: "${q.command}"`),console.error('Run "asm --help" for usage.'),process.exit(2)}}function u6($){let q=$.slice(2);if(q.length===0)return!1;let Z=["list","search","inspect","uninstall","audit","config","install","export","import","init","stats","link","index","bundle","publish","outdated","update","doctor","eval","eval-providers"],Q=q[0];if(Z.includes(Q))return!0;if(Q==="--help"||Q==="-h")return!0;if(Q==="--version"||Q==="-v")return!0;if(Q.startsWith("-")||Q.length>0)return!0;return!1}if(u6(process.argv))await g6(process.argv);else if(!(typeof globalThis.Bun<"u")){let{spawn:q}=await import("child_process"),Z=q("bun",[process.argv[1],...process.argv.slice(2)],{stdio:"inherit"});Z.on("error",()=>{console.error(`The interactive TUI requires Bun (https://bun.sh).
|
|
763
793
|
Install it with: curl -fsSL https://bun.sh/install | bash
|
|
764
794
|
|
|
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-
|
|
795
|
+
`+"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-76faq0t9.js");
|