agent-skill-manager 2.2.0 → 2.4.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 +34 -37
- package/data/bundles/content-writing.json +30 -0
- package/data/bundles/devops.json +30 -0
- package/data/bundles/eu-project-ops.json +25 -0
- package/data/bundles/frontend-dev.json +35 -0
- package/data/bundles/ios-release.json +30 -0
- package/data/skill-index/luongnv89_asm.json +73 -0
- package/data/skill-index-resources.json +10 -1
- package/dist/agent-skill-manager.js +458 -417
- package/dist/chunk-7BMOBFGJ.js +2 -0
- package/dist/chunk-CLIZUJVB.js +19 -0
- package/dist/chunk-GOI5LV72.js +3 -0
- package/dist/chunk-PVEAYTE2.js +3 -0
- package/dist/config-55HAAFSH.js +2 -0
- package/dist/devtools-W557IAG7.js +8 -0
- package/dist/lock-SOHBB4N3.js +2 -0
- package/dist/src-RNJS76U3.js +108 -0
- package/package.json +55 -21
- package/scripts/postinstall.cjs +3 -7
- package/dist/chunk-796ss41d.js +0 -15
- package/dist/chunk-d61nf7gg.js +0 -3
- package/dist/chunk-vgzgtfy6.js +0 -3
- package/dist/chunk-y89teqgt.js +0 -93
- package/dist/highlights-eq9cgrbb.scm +0 -604
- package/dist/highlights-ghv9g403.scm +0 -205
- package/dist/highlights-hk7bwhj4.scm +0 -284
- package/dist/highlights-r812a2qc.scm +0 -150
- package/dist/highlights-x6tmsnaa.scm +0 -115
- package/dist/injections-73j83es3.scm +0 -27
- package/dist/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
- package/dist/tree-sitter-markdown-411r6y9b.wasm +0 -0
- package/dist/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
- package/dist/tree-sitter-typescript-zxjzwt75.wasm +0 -0
- package/dist/tree-sitter-zig-e78zbjpm.wasm +0 -0
|
@@ -1,165 +1,166 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
`)?
|
|
2
|
+
import { createRequire as __asmCreateRequire } from 'node:module'; const require = __asmCreateRequire(import.meta.url);
|
|
3
|
+
import{a as Le,b as ht,c as go,d as yo}from"./chunk-PVEAYTE2.js";import{C as mo,D as ho,E as J,F as Ii,G as bo,I as wo,J as vo,K as ko,L as Li,M as So,a as ie,b as ae,c as eo,d as Zt,g as Q,h as to,i as Ci,j as so,k as io,l as Ei,m as no,n as u,o as ro,p as oo,q as ao,r as Ai,s as Pi,t as Ni,u as lo,v as co,w as es,x as uo,y as fo,z as po}from"./chunk-CLIZUJVB.js";import{a as Wr,b as N,c as zr,d as pt,e as Qr,f as mt,g as Xr,j as oe,k as q,l as Zr}from"./chunk-GOI5LV72.js";import{a as Xt,b as A,d as Gr}from"./chunk-7BMOBFGJ.js";var D=A(H=>{"use strict";var qi=Symbol.for("yaml.alias"),Mo=Symbol.for("yaml.document"),as=Symbol.for("yaml.map"),Do=Symbol.for("yaml.pair"),Fi=Symbol.for("yaml.scalar"),ls=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),jf=e=>!!e&&typeof e=="object"&&e[me]===qi,Bf=e=>!!e&&typeof e=="object"&&e[me]===Mo,Uf=e=>!!e&&typeof e=="object"&&e[me]===as,Vf=e=>!!e&&typeof e=="object"&&e[me]===Do,_o=e=>!!e&&typeof e=="object"&&e[me]===Fi,Kf=e=>!!e&&typeof e=="object"&&e[me]===ls;function qo(e){if(e&&typeof e=="object")switch(e[me]){case as:case ls:return!0}return!1}function Jf(e){if(e&&typeof e=="object")switch(e[me]){case qi:case as:case Fi:case ls:return!0}return!1}var Hf=e=>(_o(e)||qo(e))&&!!e.anchor;H.ALIAS=qi;H.DOC=Mo;H.MAP=as;H.NODE_TYPE=me;H.PAIR=Do;H.SCALAR=Fi;H.SEQ=ls;H.hasAnchor=Hf;H.isAlias=jf;H.isCollection=qo;H.isDocument=Bf;H.isMap=Uf;H.isNode=Jf;H.isPair=Vf;H.isScalar=_o;H.isSeq=Kf});var gt=A(ji=>{"use strict";var B=D(),X=Symbol("break visit"),Fo=Symbol("skip children"),ue=Symbol("remove node");function cs(e,t){let s=jo(t);B.isDocument(e)?Qe(null,e.contents,s,Object.freeze([e]))===ue&&(e.contents=null):Qe(null,e,s,Object.freeze([]))}cs.BREAK=X;cs.SKIP=Fo;cs.REMOVE=ue;function Qe(e,t,s,i){let n=Bo(e,t,s,i);if(B.isNode(n)||B.isPair(n))return Uo(e,i,n),Qe(e,n,s,i);if(typeof n!="symbol"){if(B.isCollection(t)){i=Object.freeze(i.concat(t));for(let r=0;r<t.items.length;++r){let o=Qe(r,t.items[r],s,i);if(typeof o=="number")r=o-1;else{if(o===X)return X;o===ue&&(t.items.splice(r,1),r-=1)}}}else if(B.isPair(t)){i=Object.freeze(i.concat(t));let r=Qe("key",t.key,s,i);if(r===X)return X;r===ue&&(t.key=null);let o=Qe("value",t.value,s,i);if(o===X)return X;o===ue&&(t.value=null)}}return n}async function us(e,t){let s=jo(t);B.isDocument(e)?await Xe(null,e.contents,s,Object.freeze([e]))===ue&&(e.contents=null):await Xe(null,e,s,Object.freeze([]))}us.BREAK=X;us.SKIP=Fo;us.REMOVE=ue;async function Xe(e,t,s,i){let n=await Bo(e,t,s,i);if(B.isNode(n)||B.isPair(n))return Uo(e,i,n),Xe(e,n,s,i);if(typeof n!="symbol"){if(B.isCollection(t)){i=Object.freeze(i.concat(t));for(let r=0;r<t.items.length;++r){let o=await Xe(r,t.items[r],s,i);if(typeof o=="number")r=o-1;else{if(o===X)return X;o===ue&&(t.items.splice(r,1),r-=1)}}}else if(B.isPair(t)){i=Object.freeze(i.concat(t));let r=await Xe("key",t.key,s,i);if(r===X)return X;r===ue&&(t.key=null);let o=await Xe("value",t.value,s,i);if(o===X)return X;o===ue&&(t.value=null)}}return n}function jo(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Bo(e,t,s,i){if(typeof s=="function")return s(e,t,i);if(B.isMap(t))return s.Map?.(e,t,i);if(B.isSeq(t))return s.Seq?.(e,t,i);if(B.isPair(t))return s.Pair?.(e,t,i);if(B.isScalar(t))return s.Scalar?.(e,t,i);if(B.isAlias(t))return s.Alias?.(e,t,i)}function Uo(e,t,s){let i=t[t.length-1];if(B.isCollection(i))i.items[e]=s;else if(B.isPair(i))e==="key"?i.key=s:i.value=s;else if(B.isDocument(i))i.contents=s;else{let n=B.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}ji.visit=cs;ji.visitAsync=us});var Bi=A(Ko=>{"use strict";var Vo=D(),Yf=gt(),Gf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Wf=e=>e.replace(/[!,[\]{}]/g,t=>Gf[t]),yt=class e{constructor(t,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,s)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,s){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let i=t.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(s(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,o]=i;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return s(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return s(6,`Unsupported YAML version ${r}`,o),!1}}default:return s(0,`Unknown directive ${n}`,!0),!1}}tagName(t,s){if(t==="!")return"!";if(t[0]!=="!")return s(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(s(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&s("Verbatim tags must end with a >"),o)}let[,i,n]=t.match(/^(.*!)([^!]*)$/s);n||s(`The ${t} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(n)}catch(o){return s(String(o)),null}return i==="!"?t:(s(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[s,i]of Object.entries(this.tags))if(t.startsWith(i))return s+Wf(t.substring(i.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(t&&i.length>0&&Vo.isNode(t.contents)){let r={};Yf.visit(t.contents,(o,a)=>{Vo.isNode(a)&&a.tag&&(r[a.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,o]of i)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||n.some(a=>a.startsWith(o)))&&s.push(`%TAG ${r} ${o}`);return s.join(`
|
|
4
|
+
`)}};yt.defaultYaml={explicit:!1,version:"1.2"};yt.defaultTags={"!!":"tag:yaml.org,2002:"};Ko.Directives=yt});var fs=A(bt=>{"use strict";var Jo=D(),zf=gt();function Qf(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let s=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(s)}return!0}function Ho(e){let t=new Set;return zf.visit(e,{Value(s,i){i.anchor&&t.add(i.anchor)}}),t}function Yo(e,t){for(let s=1;;++s){let i=`${e}${s}`;if(!t.has(i))return i}}function Xf(e,t){let s=[],i=new Map,n=null;return{onAnchor:r=>{s.push(r),n??(n=Ho(e));let o=Yo(t,n);return n.add(o),o},setAnchors:()=>{for(let r of s){let o=i.get(r);if(typeof o=="object"&&o.anchor&&(Jo.isScalar(o.node)||Jo.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:i}}bt.anchorIsValid=Qf;bt.anchorNames=Ho;bt.createNodeAnchors=Xf;bt.findNewAnchor=Yo});var Ui=A(Go=>{"use strict";function wt(e,t,s,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let o=i[n],a=wt(e,i,String(n),o);a===void 0?delete i[n]:a!==o&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),o=wt(e,i,n,r);o===void 0?i.delete(n):o!==r&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let r=wt(e,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let o=wt(e,i,n,r);o===void 0?delete i[n]:o!==r&&(i[n]=o)}return e.call(t,s,i)}Go.applyReviver=wt});var be=A(zo=>{"use strict";var Zf=D();function Wo(e,t,s){if(Array.isArray(e))return e.map((i,n)=>Wo(i,String(n),s));if(e&&typeof e.toJSON=="function"){if(!s||!Zf.hasAnchor(e))return e.toJSON(t,s);let i={aliasCount:0,count:1,res:void 0};s.anchors.set(e,i),s.onCreate=r=>{i.res=r,delete s.onCreate};let n=e.toJSON(t,s);return s.onCreate&&s.onCreate(n),n}return typeof e=="bigint"&&!s?.keep?Number(e):e}zo.toJS=Wo});var ds=A(Xo=>{"use strict";var ed=Ui(),Qo=D(),td=be(),Vi=class{constructor(t){Object.defineProperty(this,Qo.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:s,maxAliasCount:i,onAnchor:n,reviver:r}={}){if(!Qo.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=td.toJS(this,"",o);if(typeof n=="function")for(let{count:l,res:c}of o.anchors.values())n(c,l);return typeof r=="function"?ed.applyReviver(r,{"":a},"",a):a}};Xo.NodeBase=Vi});var vt=A(Zo=>{"use strict";var sd=fs(),id=gt(),Ze=D(),nd=ds(),rd=be(),Ki=class extends nd.NodeBase{constructor(t){super(Ze.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,s){let i;s?.aliasResolveCache?i=s.aliasResolveCache:(i=[],id.visit(t,{Node:(r,o)=>{(Ze.isAlias(o)||Ze.hasAnchor(o))&&i.push(o)}}),s&&(s.aliasResolveCache=i));let n;for(let r of i){if(r===this)break;r.anchor===this.source&&(n=r)}return n}toJSON(t,s){if(!s)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:r}=s,o=this.resolve(n,s);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=i.get(o);if(a||(rd.toJS(o,null,s),a=i.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ps(n,o,i)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(t,s,i){let n=`*${this.source}`;if(t){if(sd.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${n} `}return n}};function ps(e,t,s){if(Ze.isAlias(t)){let i=t.resolve(e),n=s&&i&&s.get(i);return n?n.count*n.aliasCount:0}else if(Ze.isCollection(t)){let i=0;for(let n of t.items){let r=ps(e,n,s);r>i&&(i=r)}return i}else if(Ze.isPair(t)){let i=ps(e,t.key,s),n=ps(e,t.value,s);return Math.max(i,n)}return 1}Zo.Alias=Ki});var F=A(Ji=>{"use strict";var od=D(),ad=ds(),ld=be(),cd=e=>!e||typeof e!="function"&&typeof e!="object",we=class extends ad.NodeBase{constructor(t){super(od.SCALAR),this.value=t}toJSON(t,s){return s?.keep?this.value:ld.toJS(this.value,t,s)}toString(){return String(this.value)}};we.BLOCK_FOLDED="BLOCK_FOLDED";we.BLOCK_LITERAL="BLOCK_LITERAL";we.PLAIN="PLAIN";we.QUOTE_DOUBLE="QUOTE_DOUBLE";we.QUOTE_SINGLE="QUOTE_SINGLE";Ji.Scalar=we;Ji.isScalarValue=cd});var kt=A(ta=>{"use strict";var ud=vt(),qe=D(),ea=F(),fd="tag:yaml.org,2002:";function dd(e,t,s){if(t){let i=s.filter(r=>r.tag===t),n=i.find(r=>!r.format)??i[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return s.find(i=>i.identify?.(e)&&!i.format)}function pd(e,t,s){if(qe.isDocument(e)&&(e=e.contents),qe.isNode(e))return e;if(qe.isPair(e)){let f=s.schema[qe.MAP].createNode?.(s.schema,null,s);return f.items.push(e),f}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:r,schema:o,sourceObjects:a}=s,l;if(i&&e&&typeof e=="object"){if(l=a.get(e),l)return l.anchor??(l.anchor=n(e)),new ud.Alias(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t=fd+t.slice(2));let c=dd(e,t,o.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new ea.Scalar(e);return l&&(l.node=f),f}c=e instanceof Map?o[qe.MAP]:Symbol.iterator in Object(e)?o[qe.SEQ]:o[qe.MAP]}r&&(r(c),delete s.onTagObj);let d=c?.createNode?c.createNode(s.schema,e,s):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(s.schema,e,s):new ea.Scalar(e);return t?d.tag=t:c.default||(d.tag=c.tag),l&&(l.node=d),d}ta.createNode=pd});var hs=A(ms=>{"use strict";var md=kt(),fe=D(),hd=ds();function Hi(e,t,s){let i=s;for(let n=t.length-1;n>=0;--n){let r=t[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=i,i=o}else i=new Map([[r,i]])}return md.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var sa=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Yi=class extends hd.NodeBase{constructor(t,s){super(t),Object.defineProperty(this,"schema",{value:s,configurable:!0,enumerable:!1,writable:!0})}clone(t){let s=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(s.schema=t),s.items=s.items.map(i=>fe.isNode(i)||fe.isPair(i)?i.clone(t):i),this.range&&(s.range=this.range.slice()),s}addIn(t,s){if(sa(t))this.add(s);else{let[i,...n]=t,r=this.get(i,!0);if(fe.isCollection(r))r.addIn(n,s);else if(r===void 0&&this.schema)this.set(i,Hi(this.schema,n,s));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(t){let[s,...i]=t;if(i.length===0)return this.delete(s);let n=this.get(s,!0);if(fe.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}getIn(t,s){let[i,...n]=t,r=this.get(i,!0);return n.length===0?!s&&fe.isScalar(r)?r.value:r:fe.isCollection(r)?r.getIn(n,s):void 0}hasAllNullValues(t){return this.items.every(s=>{if(!fe.isPair(s))return!1;let i=s.value;return i==null||t&&fe.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(t){let[s,...i]=t;if(i.length===0)return this.has(s);let n=this.get(s,!0);return fe.isCollection(n)?n.hasIn(i):!1}setIn(t,s){let[i,...n]=t;if(n.length===0)this.set(i,s);else{let r=this.get(i,!0);if(fe.isCollection(r))r.setIn(n,s);else if(r===void 0&&this.schema)this.set(i,Hi(this.schema,n,s));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};ms.Collection=Yi;ms.collectionFromPath=Hi;ms.isEmptyPath=sa});var St=A(gs=>{"use strict";var gd=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Gi(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var yd=(e,t,s)=>e.endsWith(`
|
|
5
|
+
`)?Gi(s,t):s.includes(`
|
|
5
6
|
`)?`
|
|
6
|
-
`+
|
|
7
|
-
`)
|
|
8
|
-
`&&
|
|
9
|
-
`&&
|
|
10
|
-
${
|
|
11
|
-
${
|
|
12
|
-
`);
|
|
13
|
-
`){if(
|
|
14
|
-
|
|
15
|
-
`;
|
|
16
|
-
`,
|
|
17
|
-
`)||/[ \t]\n|\n[ \t]/.test(
|
|
18
|
-
${
|
|
7
|
+
`+Gi(s,t):(e.endsWith(" ")?"":" ")+s;gs.indentComment=Gi;gs.lineComment=yd;gs.stringifyComment=gd});var na=A($t=>{"use strict";var bd="flow",Wi="block",ys="quoted";function wd(e,t,s="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!n||n<0)return e;n<r&&(r=0);let l=Math.max(1+r,1+n-t.length);if(e.length<=l)return e;let c=[],d={},f=n-t.length;typeof i=="number"&&(i>n-Math.max(2,r)?c.push(0):f=n-i);let p,h,g=!1,m=-1,y=-1,b=-1;s===Wi&&(m=ia(e,m,t.length),m!==-1&&(f=m+l));for(let $;$=e[m+=1];){if(s===ys&&$==="\\"){switch(y=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}b=m}if($===`
|
|
8
|
+
`)s===Wi&&(m=ia(e,m,t.length)),f=m+t.length+l,p=void 0;else{if($===" "&&h&&h!==" "&&h!==`
|
|
9
|
+
`&&h!==" "){let x=e[m+1];x&&x!==" "&&x!==`
|
|
10
|
+
`&&x!==" "&&(p=m)}if(m>=f)if(p)c.push(p),f=p+l,p=void 0;else if(s===ys){for(;h===" "||h===" ";)h=$,$=e[m+=1],g=!0;let x=m>b+1?m-2:y-1;if(d[x])return e;c.push(x),d[x]=!0,f=x+l,p=void 0}else g=!0}h=$}if(g&&a&&a(),c.length===0)return e;o&&o();let w=e.slice(0,c[0]);for(let $=0;$<c.length;++$){let x=c[$],k=c[$+1]||e.length;x===0?w=`
|
|
11
|
+
${t}${e.slice(0,k)}`:(s===ys&&d[x]&&(w+=`${e[x]}\\`),w+=`
|
|
12
|
+
${t}${e.slice(x+1,k)}`)}return w}function ia(e,t,s){let i=t,n=t+1,r=e[n];for(;r===" "||r===" ";)if(t<n+s)r=e[++t];else{do r=e[++t];while(r&&r!==`
|
|
13
|
+
`);i=t,n=t+1,r=e[n]}return i}$t.FOLD_BLOCK=Wi;$t.FOLD_FLOW=bd;$t.FOLD_QUOTED=ys;$t.foldFlowLines=wd});var Ct=A(ra=>{"use strict";var le=F(),ve=na(),ws=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),vs=e=>/^(%|---|\.\.\.)/m.test(e);function vd(e,t,s){if(!t||t<0)return!1;let i=t-s,n=e.length;if(n<=i)return!1;for(let r=0,o=0;r<n;++r)if(e[r]===`
|
|
14
|
+
`){if(r-o>i)return!0;if(o=r+1,n-o<=i)return!1}return!0}function xt(e,t){let s=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return s;let{implicitKey:i}=t,n=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(vs(e)?" ":""),o="",a=0;for(let l=0,c=s[l];c;c=s[++l])if(c===" "&&s[l+1]==="\\"&&s[l+2]==="n"&&(o+=s.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(s[l+1]){case"u":{o+=s.slice(a,l);let d=s.substr(l+2,4);switch(d){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:d.substr(0,2)==="00"?o+="\\x"+d.substr(2):o+=s.substr(l,6)}l+=5,a=l+1}break;case"n":if(i||s[l+2]==='"'||s.length<n)l+=1;else{for(o+=s.slice(a,l)+`
|
|
15
|
+
|
|
16
|
+
`;s[l+2]==="\\"&&s[l+3]==="n"&&s[l+4]!=='"';)o+=`
|
|
17
|
+
`,l+=2;o+=r,s[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+s.slice(a):s,i?o:ve.foldFlowLines(o,r,ve.FOLD_QUOTED,ws(t,!1))}function zi(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
18
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return xt(e,t);let s=t.indent||(vs(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${s}`)+"'";return t.implicitKey?i:ve.foldFlowLines(i,s,ve.FOLD_FLOW,ws(t,!1))}function et(e,t){let{singleQuote:s}=t.options,i;if(s===!1)i=xt;else{let n=e.includes('"'),r=e.includes("'");n&&!r?i=zi:r&&!n?i=xt:i=s?zi:xt}return i(e,t)}var Qi;try{Qi=new RegExp(`(^|(?<!
|
|
19
20
|
))
|
|
20
21
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{
|
|
22
|
+
|$)`,"g")}catch{Qi=/\n+(?!\n|$)/g}function bs({comment:e,type:t,value:s},i,n,r){let{blockQuote:o,commentString:a,lineWidth:l}=i.options;if(!o||/\n[\t ]+$/.test(s))return et(s,i);let c=i.indent||(i.forceBlockIndent||vs(s)?" ":""),d=o==="literal"?!0:o==="folded"||t===le.Scalar.BLOCK_FOLDED?!1:t===le.Scalar.BLOCK_LITERAL?!0:!vd(s,l,c.length);if(!s)return d?`|
|
|
22
23
|
`:`>
|
|
23
|
-
`;let
|
|
24
|
-
`&&
|
|
25
|
-
`);
|
|
26
|
-
|
|
27
|
-
`)
|
|
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
|
-
`:"",
|
|
38
|
-
${
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`
|
|
42
|
-
${
|
|
43
|
-
`),
|
|
44
|
-
${
|
|
45
|
-
`)
|
|
46
|
-
${
|
|
47
|
-
`}}
|
|
48
|
-
`+
|
|
49
|
-
`)),
|
|
50
|
-
${
|
|
51
|
-
`;return`${
|
|
52
|
-
${
|
|
53
|
-
`:" ")}return
|
|
54
|
-
${
|
|
55
|
-
${z.comment}`:Q.comment}Q=X}q.items[Z]=O$.isPair(Q)?Q:new j2.Pair(Q)}else $("Expected a sequence for this tag");return q}function r4(q,$,Z){let{replacer:Q}=Z,X=new EQ.YAMLSeq(q);X.tag="tag:yaml.org,2002:pairs";let z=0;if($&&Symbol.iterator in Object($))for(let J of $){if(typeof Q==="function")J=Q.call($,String(z++),J);let G,Y;if(Array.isArray(J))if(J.length===2)G=J[0],Y=J[1];else throw TypeError(`Expected [key, value] tuple: ${J}`);else if(J&&J instanceof Object){let H=Object.keys(J);if(H.length===1)G=H[0],Y=J[G];else throw TypeError(`Expected tuple with one key, not ${H.length} keys`)}else G=J;X.items.push(j2.createPair(G,Y,Z))}return X}var SQ={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:t4,createNode:r4};bQ.createPairs=r4;bQ.pairs=SQ;bQ.resolvePairs=t4});var D2=N((hQ)=>{var e4=k(),R2=_0(),Aq=A0(),kQ=T0(),q1=F$();class S0 extends kQ.YAMLSeq{constructor(){super();this.add=Aq.YAMLMap.prototype.add.bind(this),this.delete=Aq.YAMLMap.prototype.delete.bind(this),this.get=Aq.YAMLMap.prototype.get.bind(this),this.has=Aq.YAMLMap.prototype.has.bind(this),this.set=Aq.YAMLMap.prototype.set.bind(this),this.tag=S0.tag}toJSON(q,$){if(!$)return super.toJSON(q);let Z=new Map;if($?.onCreate)$.onCreate(Z);for(let Q of this.items){let X,z;if(e4.isPair(Q))X=R2.toJS(Q.key,"",$),z=R2.toJS(Q.value,X,$);else X=R2.toJS(Q,"",$);if(Z.has(X))throw Error("Ordered maps must not include duplicate keys");Z.set(X,z)}return Z}static from(q,$,Z){let Q=q1.createPairs(q,$,Z),X=new this;return X.items=Q.items,X}}S0.tag="tag:yaml.org,2002:omap";var vQ={collection:"seq",identify:(q)=>q instanceof Map,nodeClass:S0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(q,$){let Z=q1.resolvePairs(q,$),Q=[];for(let{key:X}of Z.items)if(e4.isScalar(X))if(Q.includes(X.value))$(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new S0,Z)},createNode:(q,$,Z)=>S0.from(q,$,Z)};hQ.YAMLOMap=S0;hQ.omap=vQ});var z1=N((mQ)=>{var $1=u();function Z1({value:q,source:$},Z){if($&&(q?Q1:X1).test.test($))return $;return q?Z.options.trueStr:Z.options.falseStr}var Q1={identify:(q)=>q===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new $1.Scalar(!0),stringify:Z1},X1={identify:(q)=>q===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new $1.Scalar(!1),stringify:Z1};mQ.falseTag=X1;mQ.trueTag=Q1});var J1=N((oQ)=>{var cQ=u(),N2=e0(),lQ={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(q)=>q.slice(-3).toLowerCase()==="nan"?NaN:q[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:N2.stringifyNumber},nQ={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(q)=>parseFloat(q.replace(/_/g,"")),stringify(q){let $=Number(q.value);return isFinite($)?$.toExponential():N2.stringifyNumber(q)}},aQ={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(q){let $=new cQ.Scalar(parseFloat(q.replace(/_/g,""))),Z=q.indexOf(".");if(Z!==-1){let Q=q.substring(Z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")$.minFractionDigits=Q.length}return $},stringify:N2.stringifyNumber};oQ.float=aQ;oQ.floatExp=nQ;oQ.floatNaN=lQ});var Y1=N((ZX)=>{var G1=e0(),Tq=(q)=>typeof q==="bigint"||Number.isInteger(q);function I$(q,$,Z,{intAsBigInt:Q}){let X=q[0];if(X==="-"||X==="+")$+=1;if(q=q.substring($).replace(/_/g,""),Q){switch(Z){case 2:q=`0b${q}`;break;case 8:q=`0o${q}`;break;case 16:q=`0x${q}`;break}let J=BigInt(q);return X==="-"?BigInt(-1)*J:J}let z=parseInt(q,Z);return X==="-"?-1*z:z}function w2(q,$,Z){let{value:Q}=q;if(Tq(Q)){let X=Q.toString($);return Q<0?"-"+Z+X.substr(1):Z+X}return G1.stringifyNumber(q)}var rQ={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(q,$,Z)=>I$(q,2,2,Z),stringify:(q)=>w2(q,2,"0b")},eQ={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(q,$,Z)=>I$(q,1,8,Z),stringify:(q)=>w2(q,8,"0")},qX={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(q,$,Z)=>I$(q,0,10,Z),stringify:G1.stringifyNumber},$X={identify:Tq,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(q,$,Z)=>I$(q,2,16,Z),stringify:(q)=>w2(q,16,"0x")};ZX.int=qX;ZX.intBin=rQ;ZX.intHex=$X;ZX.intOct=eQ});var P2=N((YX)=>{var M$=k(),A$=F0(),T$=A0();class b0 extends T$.YAMLMap{constructor(q){super(q);this.tag=b0.tag}add(q){let $;if(M$.isPair(q))$=q;else if(q&&typeof q==="object"&&"key"in q&&"value"in q&&q.value===null)$=new A$.Pair(q.key,null);else $=new A$.Pair(q,null);if(!T$.findPair(this.items,$.key))this.items.push($)}get(q,$){let Z=T$.findPair(this.items,q);return!$&&M$.isPair(Z)?M$.isScalar(Z.key)?Z.key.value:Z.key:Z}set(q,$){if(typeof $!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof $}`);let Z=T$.findPair(this.items,q);if(Z&&!$)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&$)this.items.push(new A$.Pair(q))}toJSON(q,$){return super.toJSON(q,$,Set)}toString(q,$,Z){if(!q)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},q,{allNullValues:!0}),$,Z);else throw Error("Set items must all have null values")}static from(q,$,Z){let{replacer:Q}=Z,X=new this(q);if($&&Symbol.iterator in Object($))for(let z of $){if(typeof Q==="function")z=Q.call($,z,z);X.items.push(A$.createPair(z,null,Z))}return X}}b0.tag="tag:yaml.org,2002:set";var GX={collection:"map",identify:(q)=>q instanceof Set,nodeClass:b0,default:!1,tag:"tag:yaml.org,2002:set",createNode:(q,$,Z)=>b0.from(q,$,Z),resolve(q,$){if(M$.isMap(q))if(q.hasAllNullValues(!0))return Object.assign(new b0,q);else $("Set items must all have null values");else $("Expected a mapping for this tag");return q}};YX.YAMLSet=b0;YX.set=GX});var E2=N((KX)=>{var WX=e0();function C2(q,$){let Z=q[0],Q=Z==="-"||Z==="+"?q.substring(1):q,X=(J)=>$?BigInt(J):Number(J),z=Q.replace(/_/g,"").split(":").reduce((J,G)=>J*X(60)+X(G),X(0));return Z==="-"?X(-1)*z:z}function U1(q){let{value:$}=q,Z=(J)=>J;if(typeof $==="bigint")Z=(J)=>BigInt(J);else if(isNaN($)||!isFinite($))return WX.stringifyNumber(q);let Q="";if($<0)Q="-",$*=Z(-1);let X=Z(60),z=[$%X];if($<60)z.unshift(0);else if($=($-z[0])/X,z.unshift($%X),$>=60)$=($-z[0])/X,z.unshift($);return Q+z.map((J)=>String(J).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var VX={identify:(q)=>typeof q==="bigint"||Number.isInteger(q),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(q,$,{intAsBigInt:Z})=>C2(q,Z),stringify:U1},BX={identify:(q)=>typeof q==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(q)=>C2(q,!1),stringify:U1},H1={identify:(q)=>q instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(q){let $=q.match(H1.test);if(!$)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,Q,X,z,J,G]=$.map(Number),Y=$[7]?Number(($[7]+"00").substr(1,3)):0,H=Date.UTC(Z,Q-1,X,z||0,J||0,G||0,Y),V=$[8];if(V&&V!=="Z"){let W=C2(V,!1);if(Math.abs(W)<30)W*=60;H-=60000*W}return new Date(H)},stringify:({value:q})=>q?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};KX.floatTime=BX;KX.intTime=VX;KX.timestamp=H1});var V1=N((PX)=>{var FX=t0(),IX=K$(),AX=r0(),TX=Fq(),MX=M2(),W1=z1(),S2=J1(),j$=Y1(),jX=J$(),RX=D2(),DX=F$(),NX=P2(),b2=E2(),wX=[FX.map,AX.seq,TX.string,IX.nullTag,W1.trueTag,W1.falseTag,j$.intBin,j$.intOct,j$.int,j$.intHex,S2.floatNaN,S2.floatExp,S2.float,MX.binary,jX.merge,RX.omap,DX.pairs,NX.set,b2.intTime,b2.floatTime,b2.timestamp];PX.schema=wX});var M1=N((vX)=>{var L1=t0(),EX=K$(),O1=r0(),SX=Fq(),bX=K2(),x2=L2(),y2=F2(),xX=o4(),yX=s4(),F1=M2(),Mq=J$(),I1=D2(),A1=F$(),B1=V1(),T1=P2(),R$=E2(),K1=new Map([["core",xX.schema],["failsafe",[L1.map,O1.seq,SX.string]],["json",yX.schema],["yaml11",B1.schema],["yaml-1.1",B1.schema]]),_1={binary:F1.binary,bool:bX.boolTag,float:x2.float,floatExp:x2.floatExp,floatNaN:x2.floatNaN,floatTime:R$.floatTime,int:y2.int,intHex:y2.intHex,intOct:y2.intOct,intTime:R$.intTime,map:L1.map,merge:Mq.merge,null:EX.nullTag,omap:I1.omap,pairs:A1.pairs,seq:O1.seq,set:T1.set,timestamp:R$.timestamp},fX={"tag:yaml.org,2002:binary":F1.binary,"tag:yaml.org,2002:merge":Mq.merge,"tag:yaml.org,2002:omap":I1.omap,"tag:yaml.org,2002:pairs":A1.pairs,"tag:yaml.org,2002:set":T1.set,"tag:yaml.org,2002:timestamp":R$.timestamp};function kX(q,$,Z){let Q=K1.get($);if(Q&&!q)return Z&&!Q.includes(Mq.merge)?Q.concat(Mq.merge):Q.slice();let X=Q;if(!X)if(Array.isArray(q))X=[];else{let z=Array.from(K1.keys()).filter((J)=>J!=="yaml11").map((J)=>JSON.stringify(J)).join(", ");throw Error(`Unknown schema "${$}"; use one of ${z} or define customTags array`)}if(Array.isArray(q))for(let z of q)X=X.concat(z);else if(typeof q==="function")X=q(X.slice());if(Z)X=X.concat(Mq.merge);return X.reduce((z,J)=>{let G=typeof J==="string"?_1[J]:J;if(!G){let Y=JSON.stringify(J),H=Object.keys(_1).map((V)=>JSON.stringify(V)).join(", ");throw Error(`Unknown custom tag ${Y}; use one of ${H}`)}if(!z.includes(G))z.push(G);return z},[])}vX.coreKnownTags=fX;vX.getTags=kX});var v2=N((cX)=>{var f2=k(),uX=t0(),mX=r0(),pX=Fq(),D$=M1(),dX=(q,$)=>q.key<$.key?-1:q.key>$.key?1:0;class k2{constructor({compat:q,customTags:$,merge:Z,resolveKnownTags:Q,schema:X,sortMapEntries:z,toStringDefaults:J}){this.compat=Array.isArray(q)?D$.getTags(q,"compat"):q?D$.getTags(null,q):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?D$.coreKnownTags:{},this.tags=D$.getTags($,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,f2.MAP,{value:uX.map}),Object.defineProperty(this,f2.SCALAR,{value:pX.string}),Object.defineProperty(this,f2.SEQ,{value:mX.seq}),this.sortMapEntries=typeof z==="function"?z:z===!0?dX:null}clone(){let q=Object.create(k2.prototype,Object.getOwnPropertyDescriptors(this));return q.tags=this.tags.slice(),q}}cX.Schema=k2});var j1=N((oX)=>{var nX=k(),h2=Kq(),jq=Wq();function aX(q,$){let Z=[],Q=$.directives===!0;if($.directives!==!1&&q.directives){let Y=q.directives.toString(q);if(Y)Z.push(Y),Q=!0;else if(q.directives.docStart)Q=!0}if(Q)Z.push("---");let X=h2.createStringifyContext(q,$),{commentString:z}=X.options;if(q.commentBefore){if(Z.length!==1)Z.unshift("");let Y=z(q.commentBefore);Z.unshift(jq.indentComment(Y,""))}let J=!1,G=null;if(q.contents){if(nX.isNode(q.contents)){if(q.contents.spaceBefore&&Q)Z.push("");if(q.contents.commentBefore){let V=z(q.contents.commentBefore);Z.push(jq.indentComment(V,""))}X.forceBlockIndent=!!q.comment,G=q.contents.comment}let Y=G?void 0:()=>J=!0,H=h2.stringify(q.contents,X,()=>G=null,Y);if(G)H+=jq.lineComment(H,"",z(G));if((H[0]==="|"||H[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${H}`;else Z.push(H)}else Z.push(h2.stringify(q.contents,X));if(q.directives?.docEnd)if(q.comment){let Y=z(q.comment);if(Y.includes(`
|
|
56
|
-
`)
|
|
24
|
+
`;let f,p;for(p=s.length;p>0;--p){let k=s[p-1];if(k!==`
|
|
25
|
+
`&&k!==" "&&k!==" ")break}let h=s.substring(p),g=h.indexOf(`
|
|
26
|
+
`);g===-1?f="-":s===h||g!==h.length-1?(f="+",r&&r()):f="",h&&(s=s.slice(0,-h.length),h[h.length-1]===`
|
|
27
|
+
`&&(h=h.slice(0,-1)),h=h.replace(Qi,`$&${c}`));let m=!1,y,b=-1;for(y=0;y<s.length;++y){let k=s[y];if(k===" ")m=!0;else if(k===`
|
|
28
|
+
`)b=y;else break}let w=s.substring(0,b<y?b+1:y);w&&(s=s.substring(w.length),w=w.replace(/\n+/g,`$&${c}`));let x=(m?c?"2":"1":"")+f;if(e&&(x+=" "+a(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!d){let k=s.replace(/\n+/g,`
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),E=!1,O=ws(i,!0);o!=="folded"&&t!==le.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{E=!0});let P=ve.foldFlowLines(`${w}${k}${h}`,c,ve.FOLD_BLOCK,O);if(!E)return`>${x}
|
|
30
|
+
${c}${P}`}return s=s.replace(/\n+/g,`$&${c}`),`|${x}
|
|
31
|
+
${c}${w}${s}${h}`}function kd(e,t,s,i){let{type:n,value:r}=e,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:d}=t;if(a&&r.includes(`
|
|
32
|
+
`)||d&&/[[\]{},]/.test(r))return et(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||d||!r.includes(`
|
|
33
|
+
`)?et(r,t):bs(e,t,s,i);if(!a&&!d&&n!==le.Scalar.PLAIN&&r.includes(`
|
|
34
|
+
`))return bs(e,t,s,i);if(vs(r)){if(l==="")return t.forceBlockIndent=!0,bs(e,t,s,i);if(a&&l===c)return et(r,t)}let f=r.replace(/\n+/g,`$&
|
|
35
|
+
${l}`);if(o){let p=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:h,tags:g}=t.doc.schema;if(g.some(p)||h?.some(p))return et(r,t)}return a?f:ve.foldFlowLines(f,l,ve.FOLD_FLOW,ws(t,!1))}function Sd(e,t,s,i){let{implicitKey:n,inFlow:r}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==le.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=le.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case le.Scalar.BLOCK_FOLDED:case le.Scalar.BLOCK_LITERAL:return n||r?et(o.value,t):bs(o,t,s,i);case le.Scalar.QUOTE_DOUBLE:return xt(o.value,t);case le.Scalar.QUOTE_SINGLE:return zi(o.value,t);case le.Scalar.PLAIN:return kd(o,t,s,i);default:return null}},c=l(a);if(c===null){let{defaultKeyType:d,defaultStringType:f}=t.options,p=n&&d||f;if(c=l(p),c===null)throw new Error(`Unsupported default string type ${p}`)}return c}ra.stringifyString=Sd});var Et=A(Xi=>{"use strict";var $d=fs(),ke=D(),xd=St(),Cd=Ct();function Ed(e,t){let s=Object.assign({blockQuote:!0,commentString:xd.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},e.schema.toStringOptions,t),i;switch(s.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:s.flowCollectionPadding?" ":"",indent:"",indentStep:typeof s.indent=="number"?" ".repeat(s.indent):" ",inFlow:i,options:s}}function Ad(e,t){if(t.tag){let n=e.filter(r=>r.tag===t.tag);if(n.length>0)return n.find(r=>r.format===t.format)??n[0]}let s,i;if(ke.isScalar(t)){i=t.value;let n=e.filter(r=>r.identify?.(i));if(n.length>1){let r=n.filter(o=>o.test);r.length>0&&(n=r)}s=n.find(r=>r.format===t.format)??n.find(r=>!r.format)}else i=t,s=e.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!s){let n=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${n} value`)}return s}function Pd(e,t,{anchors:s,doc:i}){if(!i.directives)return"";let n=[],r=(ke.isScalar(e)||ke.isCollection(e))&&e.anchor;r&&$d.anchorIsValid(r)&&(s.add(r),n.push(`&${r}`));let o=e.tag??(t.default?null:t.tag);return o&&n.push(i.directives.tagString(o)),n.join(" ")}function Nd(e,t,s,i){if(ke.isPair(e))return e.toString(t,s,i);if(ke.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let n,r=ke.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>n=l});n??(n=Ad(t.doc.schema.tags,r));let o=Pd(r,n,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let a=typeof n.stringify=="function"?n.stringify(r,t,s,i):ke.isScalar(r)?Cd.stringifyString(r,t,s,i):r.toString(t,s,i);return o?ke.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
36
|
+
${t.indent}${a}`:a}Xi.createStringifyContext=Ed;Xi.stringify=Nd});var ca=A(la=>{"use strict";var he=D(),oa=F(),aa=Et(),At=St();function Id({key:e,value:t},s,i,n){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:d,simpleKeys:f}}=s,p=he.isNode(e)&&e.comment||null;if(f){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(he.isCollection(e)||!he.isNode(e)&&typeof e=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let h=!f&&(!e||p&&t==null&&!s.inFlow||he.isCollection(e)||(he.isScalar(e)?e.type===oa.Scalar.BLOCK_FOLDED||e.type===oa.Scalar.BLOCK_LITERAL:typeof e=="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!h&&(f||!r),indent:a+l});let g=!1,m=!1,y=aa.stringify(e,s,()=>g=!0,()=>m=!0);if(!h&&!s.inFlow&&y.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(s.inFlow){if(r||t==null)return g&&i&&i(),y===""?"?":h?`? ${y}`:y}else if(r&&!f||t==null&&h)return y=`? ${y}`,p&&!g?y+=At.lineComment(y,s.indent,c(p)):m&&n&&n(),y;g&&(p=null),h?(p&&(y+=At.lineComment(y,s.indent,c(p))),y=`? ${y}
|
|
37
|
+
${a}:`):(y=`${y}:`,p&&(y+=At.lineComment(y,s.indent,c(p))));let b,w,$;he.isNode(t)?(b=!!t.spaceBefore,w=t.commentBefore,$=t.comment):(b=!1,w=null,$=null,t&&typeof t=="object"&&(t=o.createNode(t))),s.implicitKey=!1,!h&&!p&&he.isScalar(t)&&(s.indentAtStart=y.length+1),m=!1,!d&&l.length>=2&&!s.inFlow&&!h&&he.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(s.indent=s.indent.substring(2));let x=!1,k=aa.stringify(t,s,()=>x=!0,()=>m=!0),E=" ";if(p||b||w){if(E=b?`
|
|
38
|
+
`:"",w){let O=c(w);E+=`
|
|
39
|
+
${At.indentComment(O,s.indent)}`}k===""&&!s.inFlow?E===`
|
|
40
|
+
`&&$&&(E=`
|
|
41
|
+
|
|
42
|
+
`):E+=`
|
|
43
|
+
${s.indent}`}else if(!h&&he.isCollection(t)){let O=k[0],P=k.indexOf(`
|
|
44
|
+
`),M=P!==-1,v=s.inFlow??t.flow??t.items.length===0;if(M||!v){let S=!1;if(M&&(O==="&"||O==="!")){let I=k.indexOf(" ");O==="&"&&I!==-1&&I<P&&k[I+1]==="!"&&(I=k.indexOf(" ",I+1)),(I===-1||P<I)&&(S=!0)}S||(E=`
|
|
45
|
+
${s.indent}`)}}else(k===""||k[0]===`
|
|
46
|
+
`)&&(E="");return y+=E+k,s.inFlow?x&&i&&i():$&&!x?y+=At.lineComment(y,s.indent,c($)):m&&n&&n(),y}la.stringifyPair=Id});var en=A(Zi=>{"use strict";var ua=Xt("process");function Ld(e,...t){e==="debug"&&console.log(...t)}function Rd(e,t){(e==="debug"||e==="warn")&&(typeof ua.emitWarning=="function"?ua.emitWarning(t):console.warn(t))}Zi.debug=Ld;Zi.warn=Rd});var xs=A($s=>{"use strict";var Pt=D(),fa=F(),ks="<<",Ss={identify:e=>e===ks||typeof e=="symbol"&&e.description===ks,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new fa.Scalar(Symbol(ks)),{addToJSMap:da}),stringify:()=>ks},Od=(e,t)=>(Ss.identify(t)||Pt.isScalar(t)&&(!t.type||t.type===fa.Scalar.PLAIN)&&Ss.identify(t.value))&&e?.doc.schema.tags.some(s=>s.tag===Ss.tag&&s.default);function da(e,t,s){if(s=e&&Pt.isAlias(s)?s.resolve(e.doc):s,Pt.isSeq(s))for(let i of s.items)tn(e,t,i);else if(Array.isArray(s))for(let i of s)tn(e,t,i);else tn(e,t,s)}function tn(e,t,s){let i=e&&Pt.isAlias(s)?s.resolve(e.doc):s;if(!Pt.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,e,Map);for(let[r,o]of n)t instanceof Map?t.has(r)||t.set(r,o):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}$s.addMergeToJSMap=da;$s.isMergeKey=Od;$s.merge=Ss});var nn=A(ha=>{"use strict";var Td=en(),pa=xs(),Md=Et(),ma=D(),sn=be();function Dd(e,t,{key:s,value:i}){if(ma.isNode(s)&&s.addToJSMap)s.addToJSMap(e,t,i);else if(pa.isMergeKey(e,s))pa.addMergeToJSMap(e,t,i);else{let n=sn.toJS(s,"",e);if(t instanceof Map)t.set(n,sn.toJS(i,n,e));else if(t instanceof Set)t.add(n);else{let r=_d(s,n,e),o=sn.toJS(i,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function _d(e,t,s){if(t===null)return"";if(typeof t!="object")return String(t);if(ma.isNode(e)&&s?.doc){let i=Md.createStringifyContext(s.doc,{});i.anchors=new Set;for(let r of s.anchors.keys())i.anchors.add(r.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=e.toString(i);if(!s.mapKeyWarned){let r=JSON.stringify(n);r.length>40&&(r=r.substring(0,36)+'..."'),Td.warn(s.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),s.mapKeyWarned=!0}return n}return JSON.stringify(t)}ha.addPairToJSMap=Dd});var Se=A(rn=>{"use strict";var ga=kt(),qd=ca(),Fd=nn(),Cs=D();function jd(e,t,s){let i=ga.createNode(e,void 0,s),n=ga.createNode(t,void 0,s);return new Es(i,n)}var Es=class e{constructor(t,s=null){Object.defineProperty(this,Cs.NODE_TYPE,{value:Cs.PAIR}),this.key=t,this.value=s}clone(t){let{key:s,value:i}=this;return Cs.isNode(s)&&(s=s.clone(t)),Cs.isNode(i)&&(i=i.clone(t)),new e(s,i)}toJSON(t,s){let i=s?.mapAsMap?new Map:{};return Fd.addPairToJSMap(s,i,this)}toString(t,s,i){return t?.doc?qd.stringifyPair(this,t,s,i):JSON.stringify(this)}};rn.Pair=Es;rn.createPair=jd});var on=A(ba=>{"use strict";var Fe=D(),ya=Et(),As=St();function Bd(e,t,s){return(t.inFlow??e.flow?Vd:Ud)(e,t,s)}function Ud({comment:e,items:t},s,{blockItemPrefix:i,flowChars:n,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=s,d=Object.assign({},s,{indent:r,type:null}),f=!1,p=[];for(let g=0;g<t.length;++g){let m=t[g],y=null;if(Fe.isNode(m))!f&&m.spaceBefore&&p.push(""),Ps(s,p,m.commentBefore,f),m.comment&&(y=m.comment);else if(Fe.isPair(m)){let w=Fe.isNode(m.key)?m.key:null;w&&(!f&&w.spaceBefore&&p.push(""),Ps(s,p,w.commentBefore,f))}f=!1;let b=ya.stringify(m,d,()=>y=null,()=>f=!0);y&&(b+=As.lineComment(b,r,c(y))),f&&y&&(f=!1),p.push(i+b)}let h;if(p.length===0)h=n.start+n.end;else{h=p[0];for(let g=1;g<p.length;++g){let m=p[g];h+=m?`
|
|
47
|
+
${l}${m}`:`
|
|
48
|
+
`}}return e?(h+=`
|
|
49
|
+
`+As.indentComment(c(e),l),a&&a()):f&&o&&o(),h}function Vd({items:e},t,{flowChars:s,itemIndent:i}){let{indent:n,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=t;i+=r;let l=Object.assign({},t,{indent:i,inFlow:!0,type:null}),c=!1,d=0,f=[];for(let g=0;g<e.length;++g){let m=e[g],y=null;if(Fe.isNode(m))m.spaceBefore&&f.push(""),Ps(t,f,m.commentBefore,!1),m.comment&&(y=m.comment);else if(Fe.isPair(m)){let w=Fe.isNode(m.key)?m.key:null;w&&(w.spaceBefore&&f.push(""),Ps(t,f,w.commentBefore,!1),w.comment&&(c=!0));let $=Fe.isNode(m.value)?m.value:null;$?($.comment&&(y=$.comment),$.commentBefore&&(c=!0)):m.value==null&&w?.comment&&(y=w.comment)}y&&(c=!0);let b=ya.stringify(m,l,()=>y=null);c||(c=f.length>d||b.includes(`
|
|
50
|
+
`)),g<e.length-1?b+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=f.reduce((w,$)=>w+$.length+2,2)+(b.length+2)>t.options.lineWidth)),c&&(b+=",")),y&&(b+=As.lineComment(b,i,a(y))),f.push(b),d=f.length}let{start:p,end:h}=s;if(f.length===0)return p+h;if(!c){let g=f.reduce((m,y)=>m+y.length+2,2);c=t.options.lineWidth>0&&g>t.options.lineWidth}if(c){let g=p;for(let m of f)g+=m?`
|
|
51
|
+
${r}${n}${m}`:`
|
|
52
|
+
`;return`${g}
|
|
53
|
+
${n}${h}`}else return`${p}${o}${f.join(" ")}${o}${h}`}function Ps({indent:e,options:{commentString:t}},s,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let r=As.indentComment(t(i),e);s.push(r.trimStart())}}ba.stringifyCollection=Bd});var xe=A(ln=>{"use strict";var Kd=on(),Jd=nn(),Hd=hs(),$e=D(),Ns=Se(),Yd=F();function Nt(e,t){let s=$e.isScalar(t)?t.value:t;for(let i of e)if($e.isPair(i)&&(i.key===t||i.key===s||$e.isScalar(i.key)&&i.key.value===s))return i}var an=class extends Hd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super($e.MAP,t),this.items=[]}static from(t,s,i){let{keepUndefined:n,replacer:r}=i,o=new this(t),a=(l,c)=>{if(typeof r=="function")c=r.call(s,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||n)&&o.items.push(Ns.createPair(l,c,i))};if(s instanceof Map)for(let[l,c]of s)a(l,c);else if(s&&typeof s=="object")for(let l of Object.keys(s))a(l,s[l]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,s){let i;$e.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new Ns.Pair(t,t?.value):i=new Ns.Pair(t.key,t.value);let n=Nt(this.items,i.key),r=this.schema?.sortMapEntries;if(n){if(!s)throw new Error(`Key ${i.key} already set`);$e.isScalar(n.value)&&Yd.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(r){let o=this.items.findIndex(a=>r(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(t){let s=Nt(this.items,t);return s?this.items.splice(this.items.indexOf(s),1).length>0:!1}get(t,s){let n=Nt(this.items,t)?.value;return(!s&&$e.isScalar(n)?n.value:n)??void 0}has(t){return!!Nt(this.items,t)}set(t,s){this.add(new Ns.Pair(t,s),!0)}toJSON(t,s,i){let n=i?new i:s?.mapAsMap?new Map:{};s?.onCreate&&s.onCreate(n);for(let r of this.items)Jd.addPairToJSMap(s,n,r);return n}toString(t,s,i){if(!t)return JSON.stringify(this);for(let n of this.items)if(!$e.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Kd.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:s})}};ln.YAMLMap=an;ln.findPair=Nt});var tt=A(va=>{"use strict";var Gd=D(),wa=xe(),Wd={collection:"map",default:!0,nodeClass:wa.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return Gd.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,s)=>wa.YAMLMap.from(e,t,s)};va.map=Wd});var Ce=A(ka=>{"use strict";var zd=kt(),Qd=on(),Xd=hs(),Ls=D(),Zd=F(),ep=be(),cn=class extends Xd.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Ls.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let s=Is(t);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(t,s){let i=Is(t);if(typeof i!="number")return;let n=this.items[i];return!s&&Ls.isScalar(n)?n.value:n}has(t){let s=Is(t);return typeof s=="number"&&s<this.items.length}set(t,s){let i=Is(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[i];Ls.isScalar(n)&&Zd.isScalarValue(s)?n.value=s:this.items[i]=s}toJSON(t,s){let i=[];s?.onCreate&&s.onCreate(i);let n=0;for(let r of this.items)i.push(ep.toJS(r,String(n++),s));return i}toString(t,s,i){return t?Qd.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:i,onComment:s}):JSON.stringify(this)}static from(t,s,i){let{replacer:n}=i,r=new this(t);if(s&&Symbol.iterator in Object(s)){let o=0;for(let a of s){if(typeof n=="function"){let l=s instanceof Set?a:String(o++);a=n.call(s,l,a)}r.items.push(zd.createNode(a,void 0,i))}}return r}};function Is(e){let t=Ls.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}ka.YAMLSeq=cn});var st=A($a=>{"use strict";var tp=D(),Sa=Ce(),sp={collection:"seq",default:!0,nodeClass:Sa.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return tp.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,s)=>Sa.YAMLSeq.from(e,t,s)};$a.seq=sp});var It=A(xa=>{"use strict";var ip=Ct(),np={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,s,i){return t=Object.assign({actualString:!0},t),ip.stringifyString(e,t,s,i)}};xa.string=np});var Rs=A(Aa=>{"use strict";var Ca=F(),Ea={identify:e=>e==null,createNode:()=>new Ca.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ca.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Ea.test.test(e)?e:t.options.nullStr};Aa.nullTag=Ea});var un=A(Na=>{"use strict";var rp=F(),Pa={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new rp.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},s){if(e&&Pa.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?s.options.trueStr:s.options.falseStr}};Na.boolTag=Pa});var it=A(Ia=>{"use strict";function op({format:e,minFractionDigits:t,tag:s,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let r=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!s||s==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=t-(r.length-o-1);for(;a-- >0;)r+="0"}return r}Ia.stringifyNumber=op});var dn=A(Os=>{"use strict";var ap=F(),fn=it(),lp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:fn.stringifyNumber},cp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():fn.stringifyNumber(e)}},up={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new ap.Scalar(parseFloat(e)),s=e.indexOf(".");return s!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-s-1),t},stringify:fn.stringifyNumber};Os.float=up;Os.floatExp=cp;Os.floatNaN=lp});var mn=A(Ms=>{"use strict";var La=it(),Ts=e=>typeof e=="bigint"||Number.isInteger(e),pn=(e,t,s,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),s);function Ra(e,t,s){let{value:i}=e;return Ts(i)&&i>=0?s+i.toString(t):La.stringifyNumber(e)}var fp={identify:e=>Ts(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,s)=>pn(e,2,8,s),stringify:e=>Ra(e,8,"0o")},dp={identify:Ts,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,s)=>pn(e,0,10,s),stringify:La.stringifyNumber},pp={identify:e=>Ts(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,s)=>pn(e,2,16,s),stringify:e=>Ra(e,16,"0x")};Ms.int=dp;Ms.intHex=pp;Ms.intOct=fp});var Ta=A(Oa=>{"use strict";var mp=tt(),hp=Rs(),gp=st(),yp=It(),bp=un(),hn=dn(),gn=mn(),wp=[mp.map,gp.seq,yp.string,hp.nullTag,bp.boolTag,gn.intOct,gn.int,gn.intHex,hn.floatNaN,hn.floatExp,hn.float];Oa.schema=wp});var _a=A(Da=>{"use strict";var vp=F(),kp=tt(),Sp=st();function Ma(e){return typeof e=="bigint"||Number.isInteger(e)}var Ds=({value:e})=>JSON.stringify(e),$p=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Ds},{identify:e=>e==null,createNode:()=>new vp.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ds},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Ds},{identify:Ma,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:s})=>s?BigInt(e):parseInt(e,10),stringify:({value:e})=>Ma(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Ds}],xp={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Cp=[kp.map,Sp.seq].concat($p,xp);Da.schema=Cp});var bn=A(qa=>{"use strict";var Lt=Xt("buffer"),yn=F(),Ep=Ct(),Ap={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Lt.Buffer=="function")return Lt.Buffer.from(e,"base64");if(typeof atob=="function"){let s=atob(e.replace(/[\n\r]/g,"")),i=new Uint8Array(s.length);for(let n=0;n<s.length;++n)i[n]=s.charCodeAt(n);return i}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:s},i,n,r){if(!s)return"";let o=s,a;if(typeof Lt.Buffer=="function")a=o instanceof Lt.Buffer?o.toString("base64"):Lt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=yn.Scalar.BLOCK_LITERAL),t!==yn.Scalar.QUOTE_DOUBLE){let l=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),c=Math.ceil(a.length/l),d=new Array(c);for(let f=0,p=0;f<c;++f,p+=l)d[f]=a.substr(p,l);a=d.join(t===yn.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return Ep.stringifyString({comment:e,type:t,value:a},i,n,r)}};qa.binary=Ap});var Fs=A(qs=>{"use strict";var _s=D(),wn=Se(),Pp=F(),Np=Ce();function Fa(e,t){if(_s.isSeq(e))for(let s=0;s<e.items.length;++s){let i=e.items[s];if(!_s.isPair(i)){if(_s.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let n=i.items[0]||new wn.Pair(new Pp.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
|
|
55
|
+
${n.key.commentBefore}`:i.commentBefore),i.comment){let r=n.value??n.key;r.comment=r.comment?`${i.comment}
|
|
56
|
+
${r.comment}`:i.comment}i=n}e.items[s]=_s.isPair(i)?i:new wn.Pair(i)}}else t("Expected a sequence for this tag");return e}function ja(e,t,s){let{replacer:i}=s,n=new Np.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof i=="function"&&(o=i.call(t,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;n.items.push(wn.createPair(a,l,s))}return n}var Ip={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Fa,createNode:ja};qs.createPairs=ja;qs.pairs=Ip;qs.resolvePairs=Fa});var Sn=A(kn=>{"use strict";var Ba=D(),vn=be(),Rt=xe(),Lp=Ce(),Ua=Fs(),je=class e extends Lp.YAMLSeq{constructor(){super(),this.add=Rt.YAMLMap.prototype.add.bind(this),this.delete=Rt.YAMLMap.prototype.delete.bind(this),this.get=Rt.YAMLMap.prototype.get.bind(this),this.has=Rt.YAMLMap.prototype.has.bind(this),this.set=Rt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,s){if(!s)return super.toJSON(t);let i=new Map;s?.onCreate&&s.onCreate(i);for(let n of this.items){let r,o;if(Ba.isPair(n)?(r=vn.toJS(n.key,"",s),o=vn.toJS(n.value,r,s)):r=vn.toJS(n,"",s),i.has(r))throw new Error("Ordered maps must not include duplicate keys");i.set(r,o)}return i}static from(t,s,i){let n=Ua.createPairs(t,s,i),r=new this;return r.items=n.items,r}};je.tag="tag:yaml.org,2002:omap";var Rp={collection:"seq",identify:e=>e instanceof Map,nodeClass:je,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let s=Ua.resolvePairs(e,t),i=[];for(let{key:n}of s.items)Ba.isScalar(n)&&(i.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new je,s)},createNode:(e,t,s)=>je.from(e,t,s)};kn.YAMLOMap=je;kn.omap=Rp});var Ya=A($n=>{"use strict";var Va=F();function Ka({value:e,source:t},s){return t&&(e?Ja:Ha).test.test(t)?t:e?s.options.trueStr:s.options.falseStr}var Ja={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Va.Scalar(!0),stringify:Ka},Ha={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Va.Scalar(!1),stringify:Ka};$n.falseTag=Ha;$n.trueTag=Ja});var Ga=A(js=>{"use strict";var Op=F(),xn=it(),Tp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xn.stringifyNumber},Mp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():xn.stringifyNumber(e)}},Dp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Op.Scalar(parseFloat(e.replace(/_/g,""))),s=e.indexOf(".");if(s!==-1){let i=e.substring(s+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:xn.stringifyNumber};js.float=Dp;js.floatExp=Mp;js.floatNaN=Tp});var za=A(Tt=>{"use strict";var Wa=it(),Ot=e=>typeof e=="bigint"||Number.isInteger(e);function Bs(e,t,s,{intAsBigInt:i}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(s){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let r=parseInt(e,s);return n==="-"?-1*r:r}function Cn(e,t,s){let{value:i}=e;if(Ot(i)){let n=i.toString(t);return i<0?"-"+s+n.substr(1):s+n}return Wa.stringifyNumber(e)}var _p={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,s)=>Bs(e,2,2,s),stringify:e=>Cn(e,2,"0b")},qp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,s)=>Bs(e,1,8,s),stringify:e=>Cn(e,8,"0")},Fp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,s)=>Bs(e,0,10,s),stringify:Wa.stringifyNumber},jp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,s)=>Bs(e,2,16,s),stringify:e=>Cn(e,16,"0x")};Tt.int=Fp;Tt.intBin=_p;Tt.intHex=jp;Tt.intOct=qp});var An=A(En=>{"use strict";var Ks=D(),Us=Se(),Vs=xe(),Be=class e extends Vs.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let s;Ks.isPair(t)?s=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?s=new Us.Pair(t.key,null):s=new Us.Pair(t,null),Vs.findPair(this.items,s.key)||this.items.push(s)}get(t,s){let i=Vs.findPair(this.items,t);return!s&&Ks.isPair(i)?Ks.isScalar(i.key)?i.key.value:i.key:i}set(t,s){if(typeof s!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof s}`);let i=Vs.findPair(this.items,t);i&&!s?this.items.splice(this.items.indexOf(i),1):!i&&s&&this.items.push(new Us.Pair(t))}toJSON(t,s){return super.toJSON(t,s,Set)}toString(t,s,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),s,i);throw new Error("Set items must all have null values")}static from(t,s,i){let{replacer:n}=i,r=new this(t);if(s&&Symbol.iterator in Object(s))for(let o of s)typeof n=="function"&&(o=n.call(s,o,o)),r.items.push(Us.createPair(o,null,i));return r}};Be.tag="tag:yaml.org,2002:set";var Bp={collection:"map",identify:e=>e instanceof Set,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,s)=>Be.from(e,t,s),resolve(e,t){if(Ks.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Be,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};En.YAMLSet=Be;En.set=Bp});var Nn=A(Js=>{"use strict";var Up=it();function Pn(e,t){let s=e[0],i=s==="-"||s==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),r=i.replace(/_/g,"").split(":").reduce((o,a)=>o*n(60)+n(a),n(0));return s==="-"?n(-1)*r:r}function Qa(e){let{value:t}=e,s=o=>o;if(typeof t=="bigint")s=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Up.stringifyNumber(e);let i="";t<0&&(i="-",t*=s(-1));let n=s(60),r=[t%n];return t<60?r.unshift(0):(t=(t-r[0])/n,r.unshift(t%n),t>=60&&(t=(t-r[0])/n,r.unshift(t))),i+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Vp={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:s})=>Pn(e,s),stringify:Qa},Kp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Pn(e,!1),stringify:Qa},Xa={identify:e=>e 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(e){let t=e.match(Xa.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,i,n,r,o,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(s,i-1,n,r||0,o||0,a||0,l),d=t[8];if(d&&d!=="Z"){let f=Pn(d,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Js.floatTime=Kp;Js.intTime=Vp;Js.timestamp=Xa});var tl=A(el=>{"use strict";var Jp=tt(),Hp=Rs(),Yp=st(),Gp=It(),Wp=bn(),Za=Ya(),In=Ga(),Hs=za(),zp=xs(),Qp=Sn(),Xp=Fs(),Zp=An(),Ln=Nn(),em=[Jp.map,Yp.seq,Gp.string,Hp.nullTag,Za.trueTag,Za.falseTag,Hs.intBin,Hs.intOct,Hs.int,Hs.intHex,In.floatNaN,In.floatExp,In.float,Wp.binary,zp.merge,Qp.omap,Xp.pairs,Zp.set,Ln.intTime,Ln.floatTime,Ln.timestamp];el.schema=em});var fl=A(Tn=>{"use strict";var rl=tt(),tm=Rs(),ol=st(),sm=It(),im=un(),Rn=dn(),On=mn(),nm=Ta(),rm=_a(),al=bn(),Mt=xs(),ll=Sn(),cl=Fs(),sl=tl(),ul=An(),Ys=Nn(),il=new Map([["core",nm.schema],["failsafe",[rl.map,ol.seq,sm.string]],["json",rm.schema],["yaml11",sl.schema],["yaml-1.1",sl.schema]]),nl={binary:al.binary,bool:im.boolTag,float:Rn.float,floatExp:Rn.floatExp,floatNaN:Rn.floatNaN,floatTime:Ys.floatTime,int:On.int,intHex:On.intHex,intOct:On.intOct,intTime:Ys.intTime,map:rl.map,merge:Mt.merge,null:tm.nullTag,omap:ll.omap,pairs:cl.pairs,seq:ol.seq,set:ul.set,timestamp:Ys.timestamp},om={"tag:yaml.org,2002:binary":al.binary,"tag:yaml.org,2002:merge":Mt.merge,"tag:yaml.org,2002:omap":ll.omap,"tag:yaml.org,2002:pairs":cl.pairs,"tag:yaml.org,2002:set":ul.set,"tag:yaml.org,2002:timestamp":Ys.timestamp};function am(e,t,s){let i=il.get(t);if(i&&!e)return s&&!i.includes(Mt.merge)?i.concat(Mt.merge):i.slice();let n=i;if(!n)if(Array.isArray(e))n=[];else{let r=Array.from(il.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)n=n.concat(r);else typeof e=="function"&&(n=e(n.slice()));return s&&(n=n.concat(Mt.merge)),n.reduce((r,o)=>{let a=typeof o=="string"?nl[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(nl).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Tn.coreKnownTags=om;Tn.getTags=am});var _n=A(dl=>{"use strict";var Mn=D(),lm=tt(),cm=st(),um=It(),Gs=fl(),fm=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Dn=class e{constructor({compat:t,customTags:s,merge:i,resolveKnownTags:n,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?Gs.getTags(t,"compat"):t?Gs.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=n?Gs.coreKnownTags:{},this.tags=Gs.getTags(s,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,Mn.MAP,{value:lm.map}),Object.defineProperty(this,Mn.SCALAR,{value:um.string}),Object.defineProperty(this,Mn.SEQ,{value:cm.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?fm:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};dl.Schema=Dn});var ml=A(pl=>{"use strict";var dm=D(),qn=Et(),Dt=St();function pm(e,t){let s=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(s.push(l),i=!0):e.directives.docStart&&(i=!0)}i&&s.push("---");let n=qn.createStringifyContext(e,t),{commentString:r}=n.options;if(e.commentBefore){s.length!==1&&s.unshift("");let l=r(e.commentBefore);s.unshift(Dt.indentComment(l,""))}let o=!1,a=null;if(e.contents){if(dm.isNode(e.contents)){if(e.contents.spaceBefore&&i&&s.push(""),e.contents.commentBefore){let d=r(e.contents.commentBefore);s.push(Dt.indentComment(d,""))}n.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>o=!0,c=qn.stringify(e.contents,n,()=>a=null,l);a&&(c+=Dt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${c}`:s.push(c)}else s.push(qn.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let l=r(e.comment);l.includes(`
|
|
57
|
+
`)?(s.push("..."),s.push(Dt.indentComment(l,""))):s.push(`... ${l}`)}else s.push("...");else{let l=e.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&s[s.length-1]!==""&&s.push(""),s.push(Dt.indentComment(r(l),"")))}return s.join(`
|
|
57
58
|
`)+`
|
|
58
|
-
`}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
${
|
|
62
|
-
${
|
|
63
|
-
`}};
|
|
64
|
-
`))return!0;if(
|
|
65
|
-
`+
|
|
66
|
-
|
|
67
|
-
`+
|
|
68
|
-
`+
|
|
69
|
-
`+
|
|
70
|
-
`+
|
|
71
|
-
`.repeat(Math.max(1,
|
|
72
|
-
`;for(let
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
`,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
`+
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`}let
|
|
86
|
-
`,"sy"),
|
|
87
|
-
`,"sy")}catch{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
`)
|
|
91
|
-
`){let{fold:
|
|
92
|
-
`)
|
|
93
|
-
`)
|
|
94
|
-
`&&!(
|
|
95
|
-
`)
|
|
96
|
-
`||
|
|
97
|
-
`)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
`,r:"\r",t:"
|
|
59
|
+
`}pl.stringifyDocument=pm});var _t=A(hl=>{"use strict";var mm=vt(),nt=hs(),re=D(),hm=Se(),gm=be(),ym=_n(),bm=ml(),Fn=fs(),wm=Ui(),vm=kt(),jn=Bi(),Bn=class e{constructor(t,s,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,re.NODE_TYPE,{value:re.DOC});let n=null;typeof s=="function"||Array.isArray(s)?n=s:i===void 0&&s&&(i=s,s=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=r;let{version:o}=r;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new jn.Directives({version:o}),this.setSchema(o,i),this.contents=t===void 0?null:this.createNode(t,n,i)}clone(){let t=Object.create(e.prototype,{[re.NODE_TYPE]:{value:re.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=re.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){rt(this.contents)&&this.contents.add(t)}addIn(t,s){rt(this.contents)&&this.contents.addIn(t,s)}createAlias(t,s){if(!t.anchor){let i=Fn.anchorNames(this);t.anchor=!s||i.has(s)?Fn.findNewAnchor(s||"a",i):s}return new mm.Alias(t.anchor)}createNode(t,s,i){let n;if(typeof s=="function")t=s.call({"":t},"",t),n=s;else if(Array.isArray(s)){let y=w=>typeof w=="number"||w instanceof String||w instanceof Number,b=s.filter(y).map(String);b.length>0&&(s=s.concat(b)),n=s}else i===void 0&&s&&(i=s,s=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:d}=i??{},{onAnchor:f,setAnchors:p,sourceObjects:h}=Fn.createNodeAnchors(this,o||"a"),g={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:h},m=vm.createNode(t,d,g);return a&&re.isCollection(m)&&(m.flow=!0),p(),m}createPair(t,s,i={}){let n=this.createNode(t,null,i),r=this.createNode(s,null,i);return new hm.Pair(n,r)}delete(t){return rt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return nt.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):rt(this.contents)?this.contents.deleteIn(t):!1}get(t,s){return re.isCollection(this.contents)?this.contents.get(t,s):void 0}getIn(t,s){return nt.isEmptyPath(t)?!s&&re.isScalar(this.contents)?this.contents.value:this.contents:re.isCollection(this.contents)?this.contents.getIn(t,s):void 0}has(t){return re.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return nt.isEmptyPath(t)?this.contents!==void 0:re.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,s){this.contents==null?this.contents=nt.collectionFromPath(this.schema,[t],s):rt(this.contents)&&this.contents.set(t,s)}setIn(t,s){nt.isEmptyPath(t)?this.contents=s:this.contents==null?this.contents=nt.collectionFromPath(this.schema,Array.from(t),s):rt(this.contents)&&this.contents.setIn(t,s)}setSchema(t,s={}){typeof t=="number"&&(t=String(t));let i;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new jn.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new jn.Directives({version:t}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(s.schema instanceof Object)this.schema=s.schema;else if(i)this.schema=new ym.Schema(Object.assign(i,s));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:s,mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=gm.toJS(this.contents,s??"",a);if(typeof r=="function")for(let{count:c,res:d}of a.anchors.values())r(d,c);return typeof o=="function"?wm.applyReviver(o,{"":l},"",l):l}toJSON(t,s){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:s})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let s=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${s}`)}return bm.stringifyDocument(this,t)}};function rt(e){if(re.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}hl.Document=Bn});var jt=A(Ft=>{"use strict";var qt=class extends Error{constructor(t,s,i,n){super(),this.name=t,this.code=i,this.message=n,this.pos=s}},Un=class extends qt{constructor(t,s,i){super("YAMLParseError",t,s,i)}},Vn=class extends qt{constructor(t,s,i){super("YAMLWarning",t,s,i)}},km=(e,t)=>s=>{if(s.pos[0]===-1)return;s.linePos=s.pos.map(a=>t.linePos(a));let{line:i,col:n}=s.linePos[0];s.message+=` at line ${i}, column ${n}`;let r=n-1,o=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(o.substring(0,r))){let a=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
60
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=s.linePos[1];l?.line===i&&l.col>n&&(a=Math.max(1,Math.min(l.col-n,80-r)));let c=" ".repeat(r)+"^".repeat(a);s.message+=`:
|
|
61
|
+
|
|
62
|
+
${o}
|
|
63
|
+
${c}
|
|
64
|
+
`}};Ft.YAMLError=qt;Ft.YAMLParseError=Un;Ft.YAMLWarning=Vn;Ft.prettifyError=km});var Bt=A(gl=>{"use strict";function Sm(e,{flow:t,indicator:s,next:i,offset:n,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,d=a,f="",p="",h=!1,g=!1,m=null,y=null,b=null,w=null,$=null,x=null,k=null;for(let P of e)switch(g&&(P.type!=="space"&&P.type!=="newline"&&P.type!=="comma"&&r(P.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),g=!1),m&&(c&&P.type!=="comment"&&P.type!=="newline"&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),P.type){case"space":!t&&(s!=="doc-start"||i?.type!=="flow-collection")&&P.source.includes(" ")&&(m=P),d=!0;break;case"comment":{d||r(P,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let M=P.source.substring(1)||" ";f?f+=p+M:f=M,p="",c=!1;break}case"newline":c?f?f+=P.source:(!x||s!=="seq-item-ind")&&(l=!0):p+=P.source,c=!0,h=!0,(y||b)&&(w=P),d=!0;break;case"anchor":y&&r(P,"MULTIPLE_ANCHORS","A node can have at most one anchor"),P.source.endsWith(":")&&r(P.offset+P.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=P,k??(k=P.offset),c=!1,d=!1,g=!0;break;case"tag":{b&&r(P,"MULTIPLE_TAGS","A node can have at most one tag"),b=P,k??(k=P.offset),c=!1,d=!1,g=!0;break}case s:(y||b)&&r(P,"BAD_PROP_ORDER",`Anchors and tags must be after the ${P.source} indicator`),x&&r(P,"UNEXPECTED_TOKEN",`Unexpected ${P.source} in ${t??"collection"}`),x=P,c=s==="seq-item-ind"||s==="explicit-key-ind",d=!1;break;case"comma":if(t){$&&r(P,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),$=P,c=!1,d=!1;break}default:r(P,"UNEXPECTED_TOKEN",`Unexpected ${P.type} token`),c=!1,d=!1}let E=e[e.length-1],O=E?E.offset+E.source.length:n;return g&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:$,found:x,spaceBefore:l,comment:f,hasNewline:h,anchor:y,tag:b,newlineAfterProp:w,end:O,start:k??O}}gl.resolveProps=Sm});var Ws=A(yl=>{"use strict";function Kn(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
65
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let s of t.start)if(s.type==="newline")return!0;if(t.sep){for(let s of t.sep)if(s.type==="newline")return!0}if(Kn(t.key)||Kn(t.value))return!0}return!1;default:return!0}}yl.containsNewline=Kn});var Jn=A(bl=>{"use strict";var $m=Ws();function xm(e,t,s){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&$m.containsNewline(t)&&s(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}bl.flowIndentCheck=xm});var Hn=A(vl=>{"use strict";var wl=D();function Cm(e,t,s){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let n=typeof i=="function"?i:(r,o)=>r===o||wl.isScalar(r)&&wl.isScalar(o)&&r.value===o.value;return t.some(r=>n(r.key,s))}vl.mapIncludes=Cm});var El=A(Cl=>{"use strict";var kl=Se(),Em=xe(),Sl=Bt(),Am=Ws(),$l=Jn(),Pm=Hn(),xl="All mapping items must start at the same column";function Nm({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=r?.nodeClass??Em.YAMLMap,a=new o(s.schema);s.atRoot&&(s.atRoot=!1);let l=i.offset,c=null;for(let d of i.items){let{start:f,key:p,sep:h,value:g}=d,m=Sl.resolveProps(f,{indicator:"explicit-key-ind",next:p??h?.[0],offset:l,onError:n,parentIndent:i.indent,startOnNewline:!0}),y=!m.found;if(y){if(p&&(p.type==="block-seq"?n(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==i.indent&&n(l,"BAD_INDENT",xl)),!m.anchor&&!m.tag&&!h){c=m.end,m.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||Am.containsNewline(p))&&n(p??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==i.indent&&n(l,"BAD_INDENT",xl);s.atKey=!0;let b=m.end,w=p?e(s,p,m,n):t(s,b,f,null,m,n);s.schema.compat&&$l.flowIndentCheck(i.indent,p,n),s.atKey=!1,Pm.mapIncludes(s,a.items,w)&&n(b,"DUPLICATE_KEY","Map keys must be unique");let $=Sl.resolveProps(h??[],{indicator:"map-value-ind",next:g,offset:w.range[2],onError:n,parentIndent:i.indent,startOnNewline:!p||p.type==="block-scalar"});if(l=$.end,$.found){y&&(g?.type==="block-map"&&!$.hasNewline&&n(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&m.start<$.found.offset-1024&&n(w.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=g?e(s,g,$,n):t(s,l,h,null,$,n);s.schema.compat&&$l.flowIndentCheck(i.indent,g,n),l=x.range[2];let k=new kl.Pair(w,x);s.options.keepSourceTokens&&(k.srcToken=d),a.items.push(k)}else{y&&n(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),$.comment&&(w.comment?w.comment+=`
|
|
67
|
+
`+$.comment:w.comment=$.comment);let x=new kl.Pair(w);s.options.keepSourceTokens&&(x.srcToken=d),a.items.push(x)}}return c&&c<l&&n(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,l,c??l],a}Cl.resolveBlockMap=Nm});var Pl=A(Al=>{"use strict";var Im=Ce(),Lm=Bt(),Rm=Jn();function Om({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=r?.nodeClass??Im.YAMLSeq,a=new o(s.schema);s.atRoot&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let l=i.offset,c=null;for(let{start:d,value:f}of i.items){let p=Lm.resolveProps(d,{indicator:"seq-item-ind",next:f,offset:l,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||f)f?.type==="block-seq"?n(p.end,"BAD_INDENT","All sequence items must start at the same column"):n(l,"MISSING_CHAR","Sequence item without - indicator");else{c=p.end,p.comment&&(a.comment=p.comment);continue}let h=f?e(s,f,p,n):t(s,p.end,d,null,p,n);s.schema.compat&&Rm.flowIndentCheck(i.indent,f,n),l=h.range[2],a.items.push(h)}return a.range=[i.offset,l,c??l],a}Al.resolveBlockSeq=Om});var ot=A(Nl=>{"use strict";function Tm(e,t,s,i){let n="";if(e){let r=!1,o="";for(let a of e){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{s&&!r&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=l.substring(1)||" ";n?n+=o+d:n=d,o="";break}case"newline":n&&(o+=l),r=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=l.length}}return{comment:n,offset:t}}Nl.resolveEnd=Tm});var Ol=A(Rl=>{"use strict";var Mm=D(),Dm=Se(),Il=xe(),_m=Ce(),qm=ot(),Ll=Bt(),Fm=Ws(),jm=Hn(),Yn="Block collections are not allowed within flow collections",Gn=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Bm({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=i.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?Il.YAMLMap:_m.YAMLSeq),c=new l(s.schema);c.flow=!0;let d=s.atRoot;d&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let f=i.offset+i.start.source.length;for(let y=0;y<i.items.length;++y){let b=i.items[y],{start:w,key:$,sep:x,value:k}=b,E=Ll.resolveProps(w,{flow:a,indicator:"explicit-key-ind",next:$??x?.[0],offset:f,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!x&&!k){y===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<i.items.length-1&&n(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),E.comment&&(c.comment?c.comment+=`
|
|
68
|
+
`+E.comment:c.comment=E.comment),f=E.end;continue}!o&&s.options.strict&&Fm.containsNewline($)&&n($,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)E.comma&&n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(E.comma||n(E.start,"MISSING_CHAR",`Missing , between ${a} items`),E.comment){let O="";e:for(let P of w)switch(P.type){case"comma":case"space":break;case"comment":O=P.source.substring(1);break e;default:break e}if(O){let P=c.items[c.items.length-1];Mm.isPair(P)&&(P=P.value??P.key),P.comment?P.comment+=`
|
|
69
|
+
`+O:P.comment=O,E.comment=E.comment.substring(O.length+1)}}if(!o&&!x&&!E.found){let O=k?e(s,k,E,n):t(s,E.end,x,null,E,n);c.items.push(O),f=O.range[2],Gn(k)&&n(O.range,"BLOCK_IN_FLOW",Yn)}else{s.atKey=!0;let O=E.end,P=$?e(s,$,E,n):t(s,O,w,null,E,n);Gn($)&&n(P.range,"BLOCK_IN_FLOW",Yn),s.atKey=!1;let M=Ll.resolveProps(x??[],{flow:a,indicator:"map-value-ind",next:k,offset:P.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(M.found){if(!o&&!E.found&&s.options.strict){if(x)for(let I of x){if(I===M.found)break;if(I.type==="newline"){n(I,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<M.found.offset-1024&&n(M.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source?.[0]===":"?n(k,"MISSING_CHAR",`Missing space after : in ${a}`):n(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let v=k?e(s,k,M,n):M.found?t(s,M.end,x,null,M,n):null;v?Gn(k)&&n(v.range,"BLOCK_IN_FLOW",Yn):M.comment&&(P.comment?P.comment+=`
|
|
70
|
+
`+M.comment:P.comment=M.comment);let S=new Dm.Pair(P,v);if(s.options.keepSourceTokens&&(S.srcToken=b),o){let I=c;jm.mapIncludes(s,I.items,P)&&n(O,"DUPLICATE_KEY","Map keys must be unique"),I.items.push(S)}else{let I=new Il.YAMLMap(s.schema);I.flow=!0,I.items.push(S);let L=(v??P).range;I.range=[P.range[0],L[1],L[2]],c.items.push(I)}f=v?v.range[2]:M.end}}let p=o?"}":"]",[h,...g]=i.end,m=f;if(h?.source===p)m=h.offset+h.source.length;else{let y=a[0].toUpperCase()+a.substring(1),b=d?`${y} must end with a ${p}`:`${y} in block collection must be sufficiently indented and end with a ${p}`;n(f,d?"MISSING_CHAR":"BAD_INDENT",b),h&&h.source.length!==1&&g.unshift(h)}if(g.length>0){let y=qm.resolveEnd(g,m,s.options.strict,n);y.comment&&(c.comment?c.comment+=`
|
|
71
|
+
`+y.comment:c.comment=y.comment),c.range=[i.offset,m,y.offset]}else c.range=[i.offset,m,m];return c}Rl.resolveFlowCollection=Bm});var Ml=A(Tl=>{"use strict";var Um=D(),Vm=F(),Km=xe(),Jm=Ce(),Hm=El(),Ym=Pl(),Gm=Ol();function Wn(e,t,s,i,n,r){let o=s.type==="block-map"?Hm.resolveBlockMap(e,t,s,i,r):s.type==="block-seq"?Ym.resolveBlockSeq(e,t,s,i,r):Gm.resolveFlowCollection(e,t,s,i,r),a=o.constructor;return n==="!"||n===a.tagName?(o.tag=a.tagName,o):(n&&(o.tag=n),o)}function Wm(e,t,s,i,n){let r=i.tag,o=r?t.directives.tagName(r.source,p=>n(r,"TAG_RESOLVE_FAILED",p)):null;if(s.type==="block-seq"){let{anchor:p,newlineAfterProp:h}=i,g=p&&r?p.offset>r.offset?p:r:p??r;g&&(!h||h.offset<g.offset)&&n(g,"MISSING_CHAR","Missing newline after block sequence props")}let a=s.type==="block-map"?"map":s.type==="block-seq"?"seq":s.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===Km.YAMLMap.tagName&&a==="map"||o===Jm.YAMLSeq.tagName&&a==="seq")return Wn(e,t,s,n,o);let l=t.schema.tags.find(p=>p.tag===o&&p.collection===a);if(!l){let p=t.schema.knownTags[o];if(p?.collection===a)t.schema.tags.push(Object.assign({},p,{default:!1})),l=p;else return p?n(r,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Wn(e,t,s,n,o)}let c=Wn(e,t,s,n,o,l),d=l.resolve?.(c,p=>n(r,"TAG_RESOLVE_FAILED",p),t.options)??c,f=Um.isNode(d)?d:new Vm.Scalar(d);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}Tl.composeCollection=Wm});var Qn=A(Dl=>{"use strict";var zn=F();function zm(e,t,s){let i=t.offset,n=Qm(t,e.options.strict,s);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let r=n.mode===">"?zn.Scalar.BLOCK_FOLDED:zn.Scalar.BLOCK_LITERAL,o=t.source?Xm(t.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let y=o[m][1];if(y===""||y==="\r")a=m;else break}if(a===0){let m=n.chomp==="+"&&o.length>0?`
|
|
72
|
+
`.repeat(Math.max(1,o.length-1)):"",y=i+n.length;return t.source&&(y+=t.source.length),{value:m,type:r,comment:n.comment,range:[i,y,y]}}let l=t.indent+n.indent,c=t.offset+n.length,d=0;for(let m=0;m<a;++m){let[y,b]=o[m];if(b===""||b==="\r")n.indent===0&&y.length>l&&(l=y.length);else{y.length<l&&s(c+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(l=y.length),d=m,l===0&&!e.atRoot&&s(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=y.length+b.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>l&&(a=m+1);let f="",p="",h=!1;for(let m=0;m<d;++m)f+=o[m][0].slice(l)+`
|
|
73
|
+
`;for(let m=d;m<a;++m){let[y,b]=o[m];c+=y.length+b.length+1;let w=b[b.length-1]==="\r";if(w&&(b=b.slice(0,-1)),b&&y.length<l){let x=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;s(c-b.length-(w?2:1),"BAD_INDENT",x),y=""}r===zn.Scalar.BLOCK_LITERAL?(f+=p+y.slice(l)+b,p=`
|
|
74
|
+
`):y.length>l||b[0]===" "?(p===" "?p=`
|
|
75
|
+
`:!h&&p===`
|
|
76
|
+
`&&(p=`
|
|
77
|
+
|
|
78
|
+
`),f+=p+y.slice(l)+b,p=`
|
|
79
|
+
`,h=!0):b===""?p===`
|
|
80
|
+
`?f+=`
|
|
81
|
+
`:p=`
|
|
82
|
+
`:(f+=p+b,p=" ",h=!1)}switch(n.chomp){case"-":break;case"+":for(let m=a;m<o.length;++m)f+=`
|
|
83
|
+
`+o[m][0].slice(l);f[f.length-1]!==`
|
|
84
|
+
`&&(f+=`
|
|
85
|
+
`);break;default:f+=`
|
|
86
|
+
`}let g=i+n.length+t.source.length;return{value:f,type:r,comment:n.comment,range:[i,g,g]}}function Qm({offset:e,props:t},s,i){if(t[0].type!=="block-scalar-header")return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=t[0],r=n[0],o=0,a="",l=-1;for(let p=1;p<n.length;++p){let h=n[p];if(!a&&(h==="-"||h==="+"))a=h;else{let g=Number(h);!o&&g?o=g:l===-1&&(l=e+p)}}l!==-1&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let c=!1,d="",f=n.length;for(let p=1;p<t.length;++p){let h=t[p];switch(h.type){case"space":c=!0;case"newline":f+=h.source.length;break;case"comment":s&&!c&&i(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=h.source.length,d=h.source.substring(1);break;case"error":i(h,"UNEXPECTED_TOKEN",h.message),f+=h.source.length;break;default:{let g=`Unexpected token in block scalar header: ${h.type}`;i(h,"UNEXPECTED_TOKEN",g);let m=h.source;m&&typeof m=="string"&&(f+=m.length)}}}return{mode:r,indent:o,chomp:a,comment:d,length:f}}function Xm(e){let t=e.split(/\n( *)/),s=t[0],i=s.match(/^( *)/),r=[i?.[1]?[i[1],s.slice(i[1].length)]:["",s]];for(let o=1;o<t.length;o+=2)r.push([t[o],t[o+1]]);return r}Dl.resolveBlockScalar=zm});var Zn=A(ql=>{"use strict";var Xn=F(),Zm=ot();function eh(e,t,s){let{offset:i,type:n,source:r,end:o}=e,a,l,c=(p,h,g)=>s(i+p,h,g);switch(n){case"scalar":a=Xn.Scalar.PLAIN,l=th(r,c);break;case"single-quoted-scalar":a=Xn.Scalar.QUOTE_SINGLE,l=sh(r,c);break;case"double-quoted-scalar":a=Xn.Scalar.QUOTE_DOUBLE,l=ih(r,c);break;default:return s(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}let d=i+r.length,f=Zm.resolveEnd(o,d,t,s);return{value:l,type:a,comment:f.comment,range:[i,d,f.offset]}}function th(e,t){let s="";switch(e[0]){case" ":s="a tab character";break;case",":s="flow indicator character ,";break;case"%":s="directive indicator character %";break;case"|":case">":{s=`block scalar indicator ${e[0]}`;break}case"@":case"`":{s=`reserved character ${e[0]}`;break}}return s&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${s}`),_l(e)}function sh(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),_l(e.slice(1,-1)).replace(/''/g,"'")}function _l(e){let t,s;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
87
|
+
`,"sy"),s=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
88
|
+
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,s=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let n=i[1],r=" ",o=t.lastIndex;for(s.lastIndex=o;i=s.exec(e);)i[1]===""?r===`
|
|
89
|
+
`?n+=r:r=`
|
|
90
|
+
`:(n+=r+i[1],r=" "),o=s.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(e),n+r+(i?.[1]??"")}function ih(e,t){let s="";for(let i=1;i<e.length-1;++i){let n=e[i];if(!(n==="\r"&&e[i+1]===`
|
|
91
|
+
`))if(n===`
|
|
92
|
+
`){let{fold:r,offset:o}=nh(e,i);s+=r,i=o}else if(n==="\\"){let r=e[++i],o=rh[r];if(o)s+=o;else if(r===`
|
|
93
|
+
`)for(r=e[i+1];r===" "||r===" ";)r=e[++i+1];else if(r==="\r"&&e[i+1]===`
|
|
94
|
+
`)for(r=e[++i+1];r===" "||r===" ";)r=e[++i+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];s+=oh(e,i+1,a,t),i+=a}else{let a=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),s+=a}}else if(n===" "||n===" "){let r=i,o=e[i+1];for(;o===" "||o===" ";)o=e[++i+1];o!==`
|
|
95
|
+
`&&!(o==="\r"&&e[i+2]===`
|
|
96
|
+
`)&&(s+=i>r?e.slice(r,i+1):n)}else s+=n}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),s}function nh(e,t){let s="",i=e[t+1];for(;(i===" "||i===" "||i===`
|
|
97
|
+
`||i==="\r")&&!(i==="\r"&&e[t+2]!==`
|
|
98
|
+
`);)i===`
|
|
99
|
+
`&&(s+=`
|
|
100
|
+
`),t+=1,i=e[t+1];return s||(s=" "),{fold:s,offset:t}}var rh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
101
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function oh(e,t,s,i){let n=e.substr(t,s),o=n.length===s&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;if(isNaN(o)){let a=e.substr(t-2,s+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}ql.resolveFlowScalar=eh});var Bl=A(jl=>{"use strict";var Ue=D(),Fl=F(),ah=Qn(),lh=Zn();function ch(e,t,s,i){let{value:n,type:r,comment:o,range:a}=t.type==="block-scalar"?ah.resolveBlockScalar(e,t,i):lh.resolveFlowScalar(t,e.options.strict,i),l=s?e.directives.tagName(s.source,f=>i(s,"TAG_RESOLVE_FAILED",f)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[Ue.SCALAR]:l?c=uh(e.schema,n,l,s,i):t.type==="scalar"?c=fh(e,n,t,i):c=e.schema[Ue.SCALAR];let d;try{let f=c.resolve(n,p=>i(s??t,"TAG_RESOLVE_FAILED",p),e.options);d=Ue.isScalar(f)?f:new Fl.Scalar(f)}catch(f){let p=f instanceof Error?f.message:String(f);i(s??t,"TAG_RESOLVE_FAILED",p),d=new Fl.Scalar(n)}return d.range=a,d.source=n,r&&(d.type=r),l&&(d.tag=l),c.format&&(d.format=c.format),o&&(d.comment=o),d}function uh(e,t,s,i,n){if(s==="!")return e[Ue.SCALAR];let r=[];for(let a of e.tags)if(!a.collection&&a.tag===s)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(t))return a;let o=e.knownTags[s];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,s!=="tag:yaml.org,2002:str"),e[Ue.SCALAR])}function fh({atKey:e,directives:t,schema:s},i,n,r){let o=s.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(i))||s[Ue.SCALAR];if(s.compat){let a=s.compat.find(l=>l.default&&l.test?.test(i))??s[Ue.SCALAR];if(o.tag!==a.tag){let l=t.tagString(o.tag),c=t.tagString(a.tag),d=`Value may be parsed as either ${l} or ${c}`;r(n,"TAG_RESOLVE_FAILED",d,!0)}}return o}jl.composeScalar=ch});var Vl=A(Ul=>{"use strict";function dh(e,t,s){if(t){s??(s=t.length);for(let i=s-1;i>=0;--i){let n=t[i];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++i];n?.type==="space";)e+=n.source.length,n=t[++i];break}}return e}Ul.emptyScalarPosition=dh});var Hl=A(tr=>{"use strict";var ph=vt(),mh=D(),hh=Ml(),Kl=Bl(),gh=ot(),yh=Vl(),bh={composeNode:Jl,composeEmptyNode:er};function Jl(e,t,s,i){let n=e.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=s,c,d=!0;switch(t.type){case"alias":c=wh(e,t,i),(a||l)&&i(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=Kl.composeScalar(e,t,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=hh.composeCollection(bh,e,t,s,i),a&&(c.anchor=a.source.substring(1))}catch(f){let p=f instanceof Error?f.message:String(f);i(t,"RESOURCE_EXHAUSTION",p)}break;default:{let f=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;i(t,"UNEXPECTED_TOKEN",f),d=!1}}return c??(c=er(e,t.offset,void 0,null,s,i)),a&&c.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&e.options.stringKeys&&(!mh.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&i(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?c.comment=o:c.commentBefore=o),e.options.keepSourceTokens&&d&&(c.srcToken=t),c}function er(e,t,s,i,{spaceBefore:n,comment:r,anchor:o,tag:a,end:l},c){let d={type:"scalar",offset:yh.emptyScalarPosition(t,s,i),indent:-1,source:""},f=Kl.composeScalar(e,d,a,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=l),f}function wh({options:e},{offset:t,source:s,end:i},n){let r=new ph.Alias(s.substring(1));r.source===""&&n(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&n(t+s.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+s.length,a=gh.resolveEnd(i,o,e.strict,n);return r.range=[t,o,a.offset],a.comment&&(r.comment=a.comment),r}tr.composeEmptyNode=er;tr.composeNode=Jl});var Wl=A(Gl=>{"use strict";var vh=_t(),Yl=Hl(),kh=ot(),Sh=Bt();function $h(e,t,{offset:s,start:i,value:n,end:r},o){let a=Object.assign({_directives:t},e),l=new vh.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=Sh.resolveProps(i,{indicator:"doc-start",next:n??r?.[0],offset:s,onError:o,parentIndent:0,startOnNewline:!0});d.found&&(l.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!d.hasNewline&&o(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=n?Yl.composeNode(c,n,d,o):Yl.composeEmptyNode(c,d.end,i,null,d,o);let f=l.contents.range[2],p=kh.resolveEnd(r,f,!1,o);return p.comment&&(l.comment=p.comment),l.range=[s,f,p.offset],l}Gl.composeDoc=$h});var ir=A(Xl=>{"use strict";var xh=Xt("process"),Ch=Bi(),Eh=_t(),Ut=jt(),zl=D(),Ah=Wl(),Ph=ot();function Vt(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:s}=e;return[t,t+(typeof s=="string"?s.length:1)]}function Ql(e){let t="",s=!1,i=!1;for(let n=0;n<e.length;++n){let r=e[n];switch(r[0]){case"#":t+=(t===""?"":i?`
|
|
101
102
|
|
|
102
103
|
`:`
|
|
103
|
-
`)+(
|
|
104
|
-
${
|
|
105
|
-
${
|
|
106
|
-
${
|
|
107
|
-
${
|
|
108
|
-
`}];switch(
|
|
109
|
-
`),
|
|
110
|
-
`,
|
|
111
|
-
`})
|
|
112
|
-
`),
|
|
113
|
-
`;if(
|
|
114
|
-
`});for(let
|
|
115
|
-
`};delete
|
|
104
|
+
`)+(r.substring(1)||" "),s=!0,i=!1;break;case"%":e[n+1]?.[0]!=="#"&&(n+=1),s=!1;break;default:s||(i=!0),s=!1}}return{comment:t,afterEmptyLine:i}}var sr=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(s,i,n,r)=>{let o=Vt(s);r?this.warnings.push(new Ut.YAMLWarning(o,i,n)):this.errors.push(new Ut.YAMLParseError(o,i,n))},this.directives=new Ch.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,s){let{comment:i,afterEmptyLine:n}=Ql(this.prelude);if(i){let r=t.contents;if(s)t.comment=t.comment?`${t.comment}
|
|
105
|
+
${i}`:i;else if(n||t.directives.docStart||!r)t.commentBefore=i;else if(zl.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];zl.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
|
|
106
|
+
${a}`:i}else{let o=r.commentBefore;r.commentBefore=o?`${i}
|
|
107
|
+
${o}`:i}}s?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ql(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,s=!1,i=-1){for(let n of t)yield*this.next(n);yield*this.end(s,i)}*next(t){switch(xh.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(s,i,n)=>{let r=Vt(t);r[0]+=s,this.onError(r,"BAD_DIRECTIVE",i,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let s=Ah.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!s.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(s,!1),this.doc&&(yield this.doc),this.doc=s,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let s=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,i=new Ut.YAMLParseError(Vt(t),"UNEXPECTED_TOKEN",s);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Ut.YAMLParseError(Vt(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let s=Ph.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),s.comment){let i=this.doc.comment;this.doc.comment=i?`${i}
|
|
108
|
+
${s.comment}`:s.comment}this.doc.range[2]=s.offset;break}default:this.errors.push(new Ut.YAMLParseError(Vt(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,s=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let i=Object.assign({_directives:this.directives},this.options),n=new Eh.Document(void 0,i);this.atDirectives&&this.onError(s,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,s,s],this.decorate(n,!1),yield n}}};Xl.Composer=sr});var tc=A(zs=>{"use strict";var Nh=Qn(),Ih=Zn(),Lh=jt(),Zl=Ct();function Rh(e,t=!0,s){if(e){let i=(n,r,o)=>{let a=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(s)s(a,r,o);else throw new Lh.YAMLParseError([a,a+1],r,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ih.resolveFlowScalar(e,t,i);case"block-scalar":return Nh.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function Oh(e,t){let{implicitKey:s=!1,indent:i,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=t,a=Zl.stringifyString({type:o,value:e},{implicitKey:s,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:i,source:`
|
|
109
|
+
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
110
|
+
`),d=a.substring(0,c),f=a.substring(c+1)+`
|
|
111
|
+
`,p=[{type:"block-scalar-header",offset:r,indent:i,source:d}];return ec(p,l)||p.push({type:"newline",offset:-1,indent:i,source:`
|
|
112
|
+
`}),{type:"block-scalar",offset:r,indent:i,props:p,source:f}}case'"':return{type:"double-quoted-scalar",offset:r,indent:i,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:i,source:a,end:l};default:return{type:"scalar",offset:r,indent:i,source:a,end:l}}}function Th(e,t,s={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:r=!1,type:o}=s,a="indent"in e?e.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=e.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Zl.stringifyString({type:o,value:t},{implicitKey:n||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Mh(e,l);break;case'"':nr(e,l,"double-quoted-scalar");break;case"'":nr(e,l,"single-quoted-scalar");break;default:nr(e,l,"scalar")}}function Mh(e,t){let s=t.indexOf(`
|
|
113
|
+
`),i=t.substring(0,s),n=t.substring(s+1)+`
|
|
114
|
+
`;if(e.type==="block-scalar"){let r=e.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=i,e.source=n}else{let{offset:r}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:i}];ec(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
115
|
+
`});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:n})}}function ec(e,t){if(t)for(let s of t)switch(s.type){case"space":case"comment":e.push(s);break;case"newline":return e.push(s),!0}return!1}function nr(e,t,s){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=s,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let r of i)r.offset+=n;delete e.props,Object.assign(e,{type:s,source:t,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
116
|
+
`};delete e.items,Object.assign(e,{type:s,source:t,end:[n]});break}default:{let i="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(e))r!=="type"&&r!=="offset"&&delete e[r];Object.assign(e,{type:s,indent:i,source:t,end:n})}}}zs.createScalarToken=Oh;zs.resolveAsScalar=Rh;zs.setScalarValue=Th});var ic=A(sc=>{"use strict";var Dh=e=>"type"in e?Xs(e):Qs(e);function Xs(e){switch(e.type){case"block-scalar":{let t="";for(let s of e.props)t+=Xs(s);return t+e.source}case"block-map":case"block-seq":{let t="";for(let s of e.items)t+=Qs(s);return t}case"flow-collection":{let t=e.start.source;for(let s of e.items)t+=Qs(s);for(let s of e.end)t+=s.source;return t}case"document":{let t=Qs(e);if(e.end)for(let s of e.end)t+=s.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let s of e.end)t+=s.source;return t}}}function Qs({start:e,key:t,sep:s,value:i}){let n="";for(let r of e)n+=r.source;if(t&&(n+=Xs(t)),s)for(let r of s)n+=r.source;return i&&(n+=Xs(i)),n}sc.stringify=Dh});var ac=A(oc=>{"use strict";var rr=Symbol("break visit"),_h=Symbol("skip children"),nc=Symbol("remove item");function Ve(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),rc(Object.freeze([]),e,t)}Ve.BREAK=rr;Ve.SKIP=_h;Ve.REMOVE=nc;Ve.itemAtPath=(e,t)=>{let s=e;for(let[i,n]of t){let r=s?.[i];if(r&&"items"in r)s=r.items[n];else return}return s};Ve.parentCollection=(e,t)=>{let s=Ve.itemAtPath(e,t.slice(0,-1)),i=t[t.length-1][0],n=s?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function rc(e,t,s){let i=s(t,e);if(typeof i=="symbol")return i;for(let n of["key","value"]){let r=t[n];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=rc(Object.freeze(e.concat([[n,o]])),r.items[o],s);if(typeof a=="number")o=a-1;else{if(a===rr)return rr;a===nc&&(r.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}oc.visit=Ve});var Zs=A(Z=>{"use strict";var or=tc(),qh=ic(),Fh=ac(),ar="\uFEFF",lr="",cr="",ur="",jh=e=>!!e&&"items"in e,Bh=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Uh(e){switch(e){case ar:return"<BOM>";case lr:return"<DOC>";case cr:return"<FLOW_END>";case ur:return"<SCALAR>";default:return JSON.stringify(e)}}function Vh(e){switch(e){case ar:return"byte-order-mark";case lr:return"doc-mode";case cr:return"flow-error-end";case ur:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
116
117
|
`: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"
|
|
119
|
-
\r `),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
`||!
|
|
123
|
-
`||
|
|
124
|
-
`,this.pos),this.lineEndPos=
|
|
125
|
-
`,this.pos);if(
|
|
126
|
-
`,
|
|
127
|
-
`:
|
|
128
|
-
`)break}default:break
|
|
129
|
-
`,
|
|
130
|
-
|
|
131
|
-
`&&
|
|
132
|
-
|
|
133
|
-
`,
|
|
134
|
-
`){let
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
`)+1;
|
|
138
|
-
|
|
139
|
-
`)+1;
|
|
140
|
-
|
|
141
|
-
`).length})}catch{}}}catch{continue}}}return await
|
|
142
|
-
`;
|
|
143
|
-
`){
|
|
144
|
-
`:
|
|
118
|
+
`: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(e[0]){case" ":case" ":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}Z.createScalarToken=or.createScalarToken;Z.resolveAsScalar=or.resolveAsScalar;Z.setScalarValue=or.setScalarValue;Z.stringify=qh.stringify;Z.visit=Fh.visit;Z.BOM=ar;Z.DOCUMENT=lr;Z.FLOW_END=cr;Z.SCALAR=ur;Z.isCollection=jh;Z.isScalar=Bh;Z.prettyToken=Uh;Z.tokenType=Vh});var pr=A(cc=>{"use strict";var Kt=Zs();function ce(e){switch(e){case void 0:case" ":case`
|
|
119
|
+
`:case"\r":case" ":return!0;default:return!1}}var lc=new Set("0123456789ABCDEFabcdef"),Kh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ei=new Set(",[]{}"),Jh=new Set(` ,[]{}
|
|
120
|
+
\r `),fr=e=>!e||Jh.has(e),dr=class{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(t,s=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!s;let i=this.next??"stream";for(;i&&(s||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let t=this.pos,s=this.buffer[t];for(;s===" "||s===" ";)s=this.buffer[++t];return!s||s==="#"||s===`
|
|
121
|
+
`?!0:s==="\r"?this.buffer[t+1]===`
|
|
122
|
+
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let s=this.buffer[t];if(this.indentNext>0){let i=0;for(;s===" ";)s=this.buffer[++i+t];if(s==="\r"){let n=this.buffer[i+t+1];if(n===`
|
|
123
|
+
`||!n&&!this.atEnd)return t+i+1}return s===`
|
|
124
|
+
`||i>=this.indentNext||!s&&!this.atEnd?t+i:-1}if(s==="-"||s==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&ce(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
125
|
+
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Kt.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let s=t.length,i=t.indexOf("#");for(;i!==-1;){let r=t[i-1];if(r===" "||r===" "){s=i-1;break}else i=t.indexOf("#",i+1)}for(;;){let r=t[s-1];if(r===" "||r===" ")s-=1;else break}let n=(yield*this.pushCount(s))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let s=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-s),yield*this.pushNewline(),"stream"}return yield Kt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let s=this.peek(3);if((s==="---"||s==="...")&&ce(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,s==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ce(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,s]=this.peek(2);if(!s&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&ce(s)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let s=yield*this.pushIndicators();switch(t[s]){case"#":yield*this.pushCount(t.length-s);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(fr),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return s+=yield*this.parseBlockScalarHeader(),s+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-s),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,s,i=-1;do t=yield*this.pushNewline(),t>0?(s=yield*this.pushSpaces(!1),this.indentValue=i=s):s=0,s+=yield*this.pushSpaces(!0);while(t+s>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&ce(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Kt.FLOW_END,yield*this.parseLineStart();let r=0;for(;n[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),n[r]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-r),"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(fr),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||ce(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),s=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;s!==-1&&this.buffer[s+1]==="'";)s=this.buffer.indexOf("'",s+2);else for(;s!==-1;){let r=0;for(;this.buffer[s-1-r]==="\\";)r+=1;if(r%2===0)break;s=this.buffer.indexOf('"',s+1)}let i=this.buffer.substring(0,s),n=i.indexOf(`
|
|
126
|
+
`,this.pos);if(n!==-1){for(;n!==-1;){let r=this.continueScalar(n+1);if(r===-1)break;n=i.indexOf(`
|
|
127
|
+
`,r)}n!==-1&&(s=n-(i[n-1]==="\r"?2:1))}if(s===-1){if(!this.atEnd)return this.setNext("quoted-scalar");s=this.buffer.length}return yield*this.pushToIndex(s+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let s=this.buffer[++t];if(s==="+")this.blockScalarKeep=!0;else if(s>"0"&&s<="9")this.blockScalarIndent=Number(s)-1;else if(s!=="-")break}return yield*this.pushUntil(s=>ce(s)||s==="#")}*parseBlockScalar(){let t=this.pos-1,s=0,i;e:for(let r=this.pos;i=this.buffer[r];++r)switch(i){case" ":s+=1;break;case`
|
|
128
|
+
`:t=r,s=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
129
|
+
`)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(s>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=s:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(t+1);if(r===-1)break;t=this.buffer.indexOf(`
|
|
130
|
+
`,r)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
|
|
131
|
+
`;)i=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)do{let r=t-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
132
|
+
`&&r>=this.pos&&r+1+s>a)t=r;else break}while(!0);return yield Kt.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,s=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let r=this.buffer[i+1];if(ce(r)||t&&ei.has(r))break;s=i}else if(ce(n)){let r=this.buffer[i+1];if(n==="\r"&&(r===`
|
|
133
|
+
`?(i+=1,n=`
|
|
134
|
+
`,r=this.buffer[i+1]):s=i),r==="#"||t&&ei.has(r))break;if(n===`
|
|
135
|
+
`){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(t&&ei.has(n))break;s=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Kt.SCALAR,yield*this.pushToIndex(s+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,s){let i=this.buffer.slice(this.pos,t);return i?(yield i,this.pos+=i.length,i.length):(s&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(fr))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let t=this.flowLevel>0,s=this.charAt(1);if(ce(s)||t&&ei.has(s))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,s=this.buffer[t];for(;!ce(s)&&s!==">";)s=this.buffer[++t];return yield*this.pushToIndex(s===">"?t+1:t,!1)}else{let t=this.pos+1,s=this.buffer[t];for(;s;)if(Kh.has(s))s=this.buffer[++t];else if(s==="%"&&lc.has(this.buffer[t+1])&&lc.has(this.buffer[t+2]))s=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
|
136
|
+
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
137
|
+
`?yield*this.pushCount(2):0}*pushSpaces(t){let s=this.pos-1,i;do i=this.buffer[++s];while(i===" "||t&&i===" ");let n=s-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=s),n}*pushUntil(t){let s=this.pos,i=this.buffer[s];for(;!t(i);)i=this.buffer[++s];return yield*this.pushToIndex(s,!1)}};cc.Lexer=dr});var hr=A(uc=>{"use strict";var mr=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let s=0,i=this.lineStarts.length;for(;s<i;){let r=s+i>>1;this.lineStarts[r]<t?s=r+1:i=r}if(this.lineStarts[s]===t)return{line:s+1,col:1};if(s===0)return{line:0,col:t};let n=this.lineStarts[s-1];return{line:s,col:t-n+1}}}};uc.LineCounter=mr});var yr=A(hc=>{"use strict";var Hh=Xt("process"),fc=Zs(),Yh=pr();function Ee(e,t){for(let s=0;s<e.length;++s)if(e[s].type===t)return!0;return!1}function dc(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function mc(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ti(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function at(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function pc(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ee(t.start,"explicit-key-ind")&&!Ee(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,mc(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}var gr=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Yh.Lexer,this.onNewLine=t}*parse(t,s=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(t,s))yield*this.next(i);s||(yield*this.end())}*next(t){if(this.source=t,Hh.env.LOG_TOKENS&&console.log("|",fc.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let s=fc.tokenType(t);if(s)if(s==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=s,yield*this.step(),s){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let i=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let s=t??this.stack.pop();if(!s)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield s;else{let i=this.peek(1);switch(s.type==="block-scalar"?s.indent="indent"in i?i.indent:0:s.type==="flow-collection"&&i.type==="document"&&(s.indent=0),s.type==="flow-collection"&&pc(s),i.type){case"document":i.value=s;break;case"block-scalar":i.props.push(s);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:s,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=s;else{Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:s}):n.value=s;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:s,sep:[]}):n.sep?n.value=s:Object.assign(n,{key:s,sep:[]});return}default:yield*this.pop(),yield*this.pop(s)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(s.type==="block-map"||s.type==="block-seq")){let n=s.items[s.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&dc(n.start)===-1&&(s.indent===0||n.start.every(r=>r.type!=="comment"||r.indent<s.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),s.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 t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{dc(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let s=this.startBlockValue(t);s?this.stack.push(s):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let s=ti(this.peek(2)),i=at(s),n;t.end?(n=t.end,n.push(this.sourceToken),delete t.end):n=[this.sourceToken];let r={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let s=this.source.indexOf(`
|
|
138
|
+
`)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
|
|
139
|
+
`,s)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let s=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,s.value){let i="end"in s.value?s.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)t.items.push({start:[this.sourceToken]});else if(s.sep)s.sep.push(this.sourceToken);else{if(this.atIndentedComment(s.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,s.start),n.push(this.sourceToken),t.items.pop();return}}s.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let i=!this.onKeyLine&&this.indent===t.indent,n=i&&(s.sep||s.explicitKey)&&this.type!=="seq-item-ind",r=[];if(n&&s.sep&&!s.value){let o=[];for(let a=0;a<s.sep.length;++a){let l=s.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=s.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||s.value?(r.push(this.sourceToken),t.items.push({start:r}),this.onKeyLine=!0):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"explicit-key-ind":!s.sep&&!s.explicitKey?(s.start.push(this.sourceToken),s.explicitKey=!0):n||s.value?(r.push(this.sourceToken),t.items.push({start:r,explicitKey:!0})):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(s.explicitKey)if(s.sep)if(s.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ee(s.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(mc(s.key)&&!Ee(s.sep,"newline")){let o=at(s.start),a=s.key,l=s.sep;l.push(this.sourceToken),delete s.key,delete s.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?s.sep=s.sep.concat(r,this.sourceToken):s.sep.push(this.sourceToken);else if(Ee(s.start,"newline"))Object.assign(s,{key:null,sep:[this.sourceToken]});else{let o=at(s.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else s.sep?s.value||n?t.items.push({start:r,key:null,sep:[this.sourceToken]}):Ee(s.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||s.value?(t.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):s.sep?this.stack.push(o):(Object.assign(s,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!s.explicitKey&&s.sep&&!Ee(s.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 i&&t.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let s=t.items[t.items.length-1];switch(this.type){case"newline":if(s.value){let i="end"in s.value?s.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(s.start,t.indent)){let n=t.items[t.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,s.start),n.push(this.sourceToken),t.items.pop();return}}s.start.push(this.sourceToken)}return;case"anchor":case"tag":if(s.value||this.indent<=t.indent)break;s.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;s.value||Ee(s.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return}if(this.indent>t.indent){let i=this.startBlockValue(t);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let s=t.items[t.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!s||s.sep?t.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return;case"map-value-ind":!s||s.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!s||s.value?t.items.push({start:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!s||s.value?t.items.push({start:[],key:n,sep:[]}):s.sep?this.stack.push(n):Object.assign(s,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let i=this.startBlockValue(t);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===t.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=ti(i),r=at(n);pc(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let s=this.source.indexOf(`
|
|
140
|
+
`)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
|
|
141
|
+
`,s)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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 s=ti(t),i=at(s);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let s=ti(t),i=at(s);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,s){return this.type!=="comment"||this.indent<=s?!1:t.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};hc.Parser=gr});var vc=A(Ht=>{"use strict";var gc=ir(),Gh=_t(),Jt=jt(),Wh=en(),zh=D(),Qh=hr(),yc=yr();function bc(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Qh.LineCounter||null,prettyErrors:t}}function Xh(e,t={}){let{lineCounter:s,prettyErrors:i}=bc(t),n=new yc.Parser(s?.addNewLine),r=new gc.Composer(t),o=Array.from(r.compose(n.parse(e)));if(i&&s)for(let a of o)a.errors.forEach(Jt.prettifyError(e,s)),a.warnings.forEach(Jt.prettifyError(e,s));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function wc(e,t={}){let{lineCounter:s,prettyErrors:i}=bc(t),n=new yc.Parser(s?.addNewLine),r=new gc.Composer(t),o=null;for(let a of r.compose(n.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Jt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&s&&(o.errors.forEach(Jt.prettifyError(e,s)),o.warnings.forEach(Jt.prettifyError(e,s))),o}function Zh(e,t,s){let i;typeof t=="function"?i=t:s===void 0&&t&&typeof t=="object"&&(s=t);let n=wc(e,s);if(!n)return null;if(n.warnings.forEach(r=>Wh.warn(n.options.logLevel,r)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},s))}function eg(e,t,s){let i=null;if(typeof t=="function"||Array.isArray(t)?i=t:s===void 0&&t&&(s=t),typeof s=="string"&&(s=s.length),typeof s=="number"){let n=Math.round(s);s=n<1?void 0:n>8?{indent:8}:{indent:n}}if(e===void 0){let{keepUndefined:n}=s??t??{};if(!n)return}return zh.isDocument(e)&&!i?e.toString(s):new Gh.Document(e,i,s).toString(s)}Ht.parse=Zh;Ht.parseAllDocuments=Xh;Ht.parseDocument=wc;Ht.stringify=eg});var wr=A(_=>{"use strict";var tg=ir(),sg=_t(),ig=_n(),br=jt(),ng=vt(),Ae=D(),rg=Se(),og=F(),ag=xe(),lg=Ce(),cg=Zs(),ug=pr(),fg=hr(),dg=yr(),si=vc(),kc=gt();_.Composer=tg.Composer;_.Document=sg.Document;_.Schema=ig.Schema;_.YAMLError=br.YAMLError;_.YAMLParseError=br.YAMLParseError;_.YAMLWarning=br.YAMLWarning;_.Alias=ng.Alias;_.isAlias=Ae.isAlias;_.isCollection=Ae.isCollection;_.isDocument=Ae.isDocument;_.isMap=Ae.isMap;_.isNode=Ae.isNode;_.isPair=Ae.isPair;_.isScalar=Ae.isScalar;_.isSeq=Ae.isSeq;_.Pair=rg.Pair;_.Scalar=og.Scalar;_.YAMLMap=ag.YAMLMap;_.YAMLSeq=lg.YAMLSeq;_.CST=cg;_.Lexer=ug.Lexer;_.LineCounter=fg.LineCounter;_.Parser=dg.Parser;_.parse=si.parse;_.parseAllDocuments=si.parseAllDocuments;_.parseDocument=si.parseDocument;_.stringify=si.stringify;_.visit=kc.visit;_.visitAsync=kc.visitAsync});import{execFile as kf}from"child_process";import{promisify as Sf}from"util";import{mkdtemp as $o,readdir as $f,readFile as Di,rm as is,cp as xf,access as Mi,stat as Cf,lstat as Ef,symlink as Af,mkdir as Pf}from"fs/promises";import{join as pe,resolve as xo,relative as Nf,basename as If}from"path";import{homedir as Co}from"os";import{tmpdir as Eo}from"os";import{readdir as mf,readFile as hf,stat as gf}from"fs/promises";import{join as yf}from"path";var bf=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"]),wf=512*1024;async function ts(e){let t=[];async function s(i,n){let r;try{r=await mf(i)}catch{return}for(let o of r){if(o===".git"||o==="node_modules")continue;let a=yf(i,o),l=n?`${n}/${o}`:o;try{let c=await gf(a);if(c.isDirectory())await s(a,l);else if(c.isFile()){let d=o.includes(".")?`.${o.split(".").pop().toLowerCase()}`:"";if(bf.has(d)||c.size>wf)continue;try{let f=await hf(a,"utf-8");t.push({relPath:l,content:f,lineCount:f.split(`
|
|
142
|
+
`).length})}catch{}}}catch{continue}}}return await s(e,""),t}var Oi=class{selected;cursor;scrollOffset;pageSize;itemCount;filter;searchActive;filteredMap;constructor(t,s){this.selected=t.map(i=>i.checked),this.cursor=1,this.scrollOffset=0,this.pageSize=s,this.itemCount=t.length,this.filter="",this.searchActive=!1,this.filteredMap=t.map((i,n)=>n)}get totalRows(){return this.filteredMap.length+1}applyFilter(t){if(this.filter==="")this.filteredMap=t.map((s,i)=>i);else{let s=this.filter.toLowerCase();this.filteredMap=[];for(let i=0;i<t.length;i++)(t[i].label.toLowerCase()+" "+(t[i].hint?.toLowerCase()??"")).includes(s)&&this.filteredMap.push(i)}this.cursor>=this.totalRows&&(this.cursor=Math.max(0,this.totalRows-1)),this.scrollOffset>0&&this.scrollOffset>=this.totalRows&&(this.scrollOffset=Math.max(0,this.totalRows-this.pageSize))}cursorToOriginalIndex(){return this.cursor===0?-1:this.filteredMap[this.cursor-1]??-1}toggleCurrent(){if(this.cursor===0)this.toggleAll();else{let t=this.cursorToOriginalIndex();t>=0&&(this.selected[t]=!this.selected[t])}}toggleAll(){let t=this.filteredMap,i=!t.every(n=>this.selected[n]);for(let n of t)this.selected[n]=i}moveUp(){this.cursor>0?this.cursor--:this.cursor=this.totalRows-1,this.adjustScroll()}moveDown(){this.cursor<this.totalRows-1?this.cursor++:this.cursor=0,this.adjustScroll()}getSelectedIndices(){let t=[];for(let s=0;s<this.selected.length;s++)this.selected[s]&&t.push(s);return t}getVisibleRange(){let t=this.scrollOffset,s=Math.min(this.scrollOffset+this.pageSize,this.totalRows);return{start:t,end:s}}adjustScroll(){this.cursor<this.scrollOffset?this.scrollOffset=this.cursor:this.cursor>=this.scrollOffset+this.pageSize&&(this.scrollOffset=this.cursor-this.pageSize+1)}};function vf(e,t,s){let i=[];if(e.searchActive||e.filter!==""){let c=u.cyan("/"),d=e.filter,f=e.searchActive?u.cyan("\u2588"):"";i.push(` ${c}${d}${f}`),e.filteredMap.length===0&&i.push(u.dim(" No matches found")),i.push("")}let{start:n,end:r}=e.getVisibleRange();n>0&&i.push(u.dim(` ... ${n} more above`));for(let c=n;c<r;c++){let f=c===e.cursor?u.cyan(">"):" ";if(c===0){let p=e.filteredMap,g=p.length>0&&p.every(y=>e.selected[y])?u.green("[*]"):"[ ]",m=e.filter!==""?`Select All Matching (${e.filteredMap.length})`:"Select All / Deselect All";i.push(`${f} ${g} ${u.bold(m)}`)}else{let p=e.filteredMap[c-1],h=t[p],m=e.selected[p]?u.green("[*]"):"[ ]",y=`${f} ${m} `,b=7,w=u.bold(h.label),$=h.label.length;if(h.hint){let x=s-b-$-2;if(x>10){let k=Ri(h.hint,x);i.push(`${y}${w} ${u.dim(k)}`)}else{let k=Ri(h.label,s-b);i.push(`${y}${u.bold(k)}`)}}else{let x=Ri(h.label,s-b);i.push(`${y}${u.bold(x)}`)}}}let o=e.totalRows-r;o>0&&i.push(u.dim(` ... ${o} more below`));let a=e.getSelectedIndices().length,l=e.filter!==""?` matching: ${e.filteredMap.length}/${e.itemCount}`:"";return i.push(""),e.searchActive?i.push(u.dim(` ${a} of ${e.itemCount} selected${l} | Type to filter Esc Clear Enter Done searching`)):i.push(u.dim(` ${a} of ${e.itemCount} selected${l} | \u2191/\u2193 Navigate Space Toggle a All / Search Enter Confirm Esc Cancel`)),i}function Ri(e,t){return t<=0?"":e.length<=t?e:t<=3?e.slice(0,t):e.slice(0,t-3)+"..."}async function We(e){let{items:t}=e,s=e.pageSize??Math.min(t.length+1,15),i=new Oi(t,s),n=process.stderr,r=process.stdin,o=n.columns||80;typeof r.setRawMode=="function"&&r.setRawMode(!0),r.resume(),r.setEncoding("utf-8"),n.write("\x1B[?25l");let a=0;function l(){let c=vf(i,t,o);a>0&&n.write(`\x1B[${a}F`);let d=Math.max(c.length,a),f="";for(let p=0;p<d;p++)f+=`\x1B[2K${p<c.length?c[p]:""}
|
|
143
|
+
`;n.write(f),a=d}return l(),new Promise(c=>{let d="",f=null;function p(){r.removeListener("data",m),typeof r.setRawMode=="function"&&r.setRawMode(!1),r.pause(),n.write("\x1B[?25h"),f&&clearTimeout(f)}function h(y){p(),c(y)}function g(y){if(i.searchActive){if(y==="\x1B"){i.searchActive=!1,i.filter="",i.applyFilter(t),l();return}if(y==="\r"||y===`
|
|
144
|
+
`){i.searchActive=!1,l();return}if(y==="\x7F"||y==="\b"){i.filter.length>0?(i.filter=i.filter.slice(0,-1),i.applyFilter(t)):i.searchActive=!1,l();return}if(y===""){p(),process.kill(process.pid,"SIGINT");return}if(y==="\x1B[A"){i.moveUp(),l();return}if(y==="\x1B[B"){i.moveDown(),l();return}if(y===" "){i.toggleCurrent(),l();return}if(y.length===1&&y>=" "&&y<="~"){i.filter+=y,i.applyFilter(t),l();return}return}switch(y){case"\x1B[A":case"k":i.moveUp(),l();break;case"\x1B[B":case"j":i.moveDown(),l();break;case" ":i.toggleCurrent(),l();break;case"a":i.toggleAll(),l();break;case"/":i.searchActive=!0,l();break;case"\r":case`
|
|
145
|
+
`:h(i.getSelectedIndices());break;case"\x1B":i.filter!==""?(i.filter="",i.applyFilter(t),l()):h([]);break;case"\x7F":case"\b":i.filter.length>0&&(i.filter=i.filter.slice(0,-1),i.applyFilter(t),l());break;case"":p(),process.kill(process.pid,"SIGINT");break}}function m(y){if(d.length>0){if(d+=y,f&&clearTimeout(f),d.length>=3&&d[1]==="["){let w=d.slice(0,3),$=d.slice(3);d="",g(w),$&&m($);return}let b=d;d="",g("\x1B");for(let w=1;w<b.length;w++)g(b[w]);return}for(let b=0;b<y.length;b++){let w=y[b];if(w==="\x1B"){let $=y.slice(b);if($.length>=3&&$[1]==="[")g($.slice(0,3)),b+=2;else if($.length>=2){d=$,f=setTimeout(()=>{let x=d;d="",g("\x1B");for(let k=1;k<x.length;k++)g(x[k])},50);return}else{d="\x1B",f=setTimeout(()=>{d="",g("\x1B")},50);return}}else g(w)}}r.on("data",m)})}var Re=Sf(kf),Lf=/^[a-zA-Z0-9_-]+$/,Rf=/^[a-zA-Z0-9._-]+$/,Of=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,Ao=128,Tf=/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\/tree\/(.+))?\/?$/;function Mf(e){return e.startsWith("/")||e.startsWith("./")||e.startsWith(".\\")||e.startsWith("../")||e.startsWith("..\\")||e.startsWith("~/")||e.startsWith("~\\")||e==="~"||e==="."||e===".."||/^[a-zA-Z]:[/\\]/.test(e)}function Df(e){let t;e==="~"?t=Co():e.startsWith("~/")||e.startsWith("~\\")?t=xo(Co(),e.slice(2)):t=xo(e);let s=If(t);return N(`install: parsed local source -> path=${t}`),{owner:"local",repo:s,ref:null,subpath:null,cloneUrl:"",sshCloneUrl:"",isLocal:!0,localPath:t}}function Oe(e){if(Mf(e))return Df(e);let t=Tf.exec(e);if(t){let[,f,p,h]=t,g=p.endsWith(".git")?p.slice(0,-4):p;e=`github:${f}/${g}${h?`#${h}`:""}`}if(!e.startsWith("github:"))throw new Error(`Invalid source format. Got: "${e}"
|
|
145
146
|
Supported formats:
|
|
146
147
|
github:owner/repo[#ref]
|
|
147
148
|
github:owner/repo#ref:path
|
|
148
149
|
https://github.com/owner/repo
|
|
149
150
|
https://github.com/owner/repo/tree/branch/path/to/skill
|
|
150
151
|
/path/to/local/skill
|
|
151
|
-
./relative/path/to/skill`);let
|
|
152
|
-
`)){let
|
|
153
|
-
HTTPS: ${
|
|
154
|
-
SSH: ${
|
|
155
|
-
`);for(let
|
|
156
|
-
Use --force to overwrite.`)}catch(
|
|
157
|
-
`),
|
|
158
|
-
`),
|
|
159
|
-
`);return null}function
|
|
160
|
-
${
|
|
161
|
-
`)}`);return
|
|
162
|
-
name: ${
|
|
152
|
+
./relative/path/to/skill`);let s=e.slice(7),i=s.indexOf("#"),n,r=null,o=null;if(i!==-1){n=s.slice(0,i);let f=s.slice(i+1);if(!f)throw new Error("Invalid source: ref cannot be empty after #");let p=f.indexOf(":");if(p!==-1){if(r=f.slice(0,p),!r)throw new Error("Invalid source: ref cannot be empty before :");o=f.slice(p+1)||null}else r=f}else{let f=s.indexOf(":");f!==-1?(n=s.slice(0,f),o=s.slice(f+1)||null):n=s}let a=n.indexOf("/");if(a===-1)throw new Error(`Invalid source: format must be github:owner/repo. Got: "${e}"`);let l=n.slice(0,a),c=n.slice(a+1);if(!l)throw new Error("Invalid source: owner cannot be empty");if(!c)throw new Error("Invalid source: repo cannot be empty");if(!Lf.test(l))throw new Error(`Invalid source: owner contains invalid characters: "${l}". Allowed: [a-zA-Z0-9_-]`);if(!Rf.test(c))throw new Error(`Invalid source: repo contains invalid characters: "${c}". Allowed: [a-zA-Z0-9._-]`);let d={owner:l,repo:c,ref:r,subpath:o,cloneUrl:`https://github.com/${l}/${c}.git`,sshCloneUrl:`git@github.com:${l}/${c}.git`};return N(`install: parsed source -> owner=${l} repo=${c} ref=${r} subpath=${o}`),d}async function ns(e){if(e.subpath!==null||!e.ref||!e.ref.includes("/"))return e;try{let{stdout:t}=await Re("git",["ls-remote","--heads","--tags",e.cloneUrl],{timeout:15e3}),s=new Set;for(let n of t.split(`
|
|
153
|
+
`)){let r=n.match(/\trefs\/(?:heads|tags)\/(.+)$/);r&&s.add(r[1])}let i=e.ref.split("/");for(let n=1;n<i.length;n++){let r=i.slice(0,n).join("/");if(s.has(r)){let o=i.slice(n).join("/");return N(`install: resolved ref="${r}" subpath="${o}"`),{...e,ref:r,subpath:o||null}}}}catch(t){N(`install: ls-remote failed, treating entire ref as branch: ${t}`)}return e}function Te(e){if(!e)throw new Error("Invalid skill name: name cannot be empty");if(e.includes("\0"))throw new Error("Invalid skill name: contains unsafe characters (null byte)");if(e.includes(".."))throw new Error("Invalid skill name: contains unsafe characters (..)");if(e.includes("/")||e.includes("\\"))throw new Error("Invalid skill name: contains unsafe characters (path separator)");if(e.startsWith("."))throw new Error("Invalid skill name: must not start with a dot");if(e.length>Ao)throw new Error(`Invalid skill name: exceeds maximum length of ${Ao} characters`);if(!Of.test(e))throw new Error(`Invalid skill name: "${e}" does not match allowed pattern [a-zA-Z0-9][a-zA-Z0-9._-]*`);return e}function _f(e){let t=e.split(/[/\\]/).filter(Boolean),s=t.length>0?t[t.length-1]:e;return Te(s)}function Po(e){let t=new Map;for(let s of e){let i=_f(s),n=t.get(i);n?n.push(s):t.set(i,[s])}return[...t.entries()].filter(([,s])=>s.length>1).map(([s,i])=>({name:s,paths:i}))}async function Me(){try{await Re("git",["--version"]),N("install: git available")}catch{throw new Error("git is required for installing skills. Install git from https://git-scm.com")}}function qf(e){if(e.killed)return!1;let t=(e.stderr||e.message||"").toLowerCase();return t.includes("authentication failed")||t.includes("could not read username")||t.includes("repository not found")||t.includes("returned error: 403")||t.includes("returned error: 401")||t.includes("terminal prompts disabled")||t.includes("permission denied")}function ss(e){return e.killed?"Clone timed out after 60 seconds":`Clone failed: ${e.stderr||e.message}`}async function Ti(e,t,s){if(t!==null&&/^[0-9a-f]{40}$/i.test(t))return await Re("git",["clone","--no-checkout",e,s],{timeout:6e4}),await Re("git",["checkout",t],{cwd:s,timeout:3e4}),s;let n=["clone","--depth","1"];return t&&n.push("--branch",t),n.push(e,s),await Re("git",n,{timeout:6e4}),s}async function De(e,t="auto"){N(`install: cloning ${e.owner}/${e.repo}${e.ref?` (ref: ${e.ref})`:""} (transport: ${t})`);let s=await $o(pe(Eo(),"asm-install-"));if(t==="ssh"||t==="https"){let i=t==="ssh"?e.sshCloneUrl:e.cloneUrl;try{return await Ti(i,e.ref,s)}catch(n){throw await ne(s),new Error(ss(n))}}try{return await Ti(e.cloneUrl,e.ref,s)}catch(i){if(!qf(i))throw await ne(s),new Error(ss(i));N("install: HTTPS clone failed with auth error, retrying with SSH..."),await ne(s);let n=await $o(pe(Eo(),"asm-install-"));try{return await Ti(e.sshCloneUrl,e.ref,n)}catch(r){throw await ne(n),new Error(`Clone failed with both transports:
|
|
154
|
+
HTTPS: ${ss(i)}
|
|
155
|
+
SSH: ${ss(r)}`)}}}async function _e(e){let t=pe(e,"SKILL.md"),s;try{s=await Di(t,"utf-8")}catch{throw new Error("Not a valid skill: SKILL.md not found in repository root")}let i=ie(s),n=e.split(/[/\\]/).pop()||"unknown",r=i.name||n,o=ae(i);return N(`install: validated skill "${r}" v${o}`),{name:r,version:o,description:(i.description||"").replace(/\s*\n\s*/g," ").trim(),effort:i.effort||i["metadata.effort"]||void 0}}async function rs(e,t=5){let s=[];async function i(n,r,o){let a;try{a=await $f(n)}catch{return}for(let l of a){if(l===".git"||l==="node_modules")continue;let c=pe(n,l);try{if(!(await Cf(c)).isDirectory())continue}catch{continue}let d=r?`${r}/${l}`:l,f=o+1,p=pe(c,"SKILL.md");try{let h=await Di(p,"utf-8"),g=ie(h);s.push({relPath:d,name:g.name||l,version:ae(g),description:(g.description||"").replace(/\s*\n\s*/g," ").trim(),effort:g.effort||g["metadata.effort"]||void 0,license:(g.license||"").trim(),creator:(g["metadata.creator"]||"").trim(),compatibility:(g.compatibility||"").trim(),allowedTools:eo(g),tokenCount:Zt(h)})}catch{f<t&&await i(c,d,f)}}}return await i(e,"",0),s.sort((n,r)=>n.name.localeCompare(r.name)),s}var Ff=[{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 No(e){let t=[],s=await ts(e);for(let{relPath:i,content:n}of s){let r=n.split(`
|
|
156
|
+
`);for(let o=0;o<r.length;o++)for(let{category:a,pattern:l}of Ff)if(l.test(r[o])){let c=r[o].trim();t.push({category:a,file:i,line:o+1,match:c.length>100?c.slice(0,100)+"\u2026":c})}}return t}async function os(e){let t=e.source.isLocal?`local:${e.source.localPath}`:`github:${e.source.owner}/${e.source.repo}${e.source.ref?`#${e.source.ref}`:""}${e.source.subpath?`:${e.source.subpath}`:""}`;if(e.force)try{await Mi(e.targetDir),await is(e.targetDir,{recursive:!0,force:!0})}catch{}let s=e.sourceDir;try{await xf(s,e.targetDir,{recursive:!0})}catch(a){throw new Error(`Failed to install: ${a.message}`)}let i=pe(e.targetDir,".git");try{await is(i,{recursive:!0,force:!0})}catch{}N(`install: copied files to ${e.targetDir}`);let n=pe(e.targetDir,"SKILL.md");try{await Mi(n)}catch{throw new Error("Installation verification failed: SKILL.md not found at target")}let r=await Di(n,"utf-8"),o=ie(r);return{success:!0,path:e.targetDir,name:o.name||e.skillName,version:ae(o),provider:e.providerLabel,source:t}}async function Io(e,t){let s=await os(e);for(let i of t){if(i.name===e.providerName)continue;let n=e.scope==="project"?i.project:i.global,r=oe(n),o=pe(r,e.skillName);await Pf(r,{recursive:!0});try{if((await Ef(o)).isSymbolicLink())await is(o);else{N(`install: skipping ${o} \u2014 existing non-symlink directory`);continue}}catch{}let a=Nf(r,e.targetDir);await Af(a,o,"dir"),N(`install: symlinked ${o} -> ${a}`)}return s.provider=`All (${t.map(i=>i.label).join(", ")})`,s}async function ne(e){try{await is(e,{recursive:!0,force:!0})}catch{}}async function Lo(){try{await Re("npx",["--version"]),N("install: npx available")}catch{throw new Error("npx is required for Vercel method installation. Install Node.js from https://nodejs.org")}}async function Ro(e,t){let s=["--yes","skills","add",e];t&&s.push("--skill",t),N(`install: running npx ${s.join(" ")}`);try{let i=await Re("npx",s,{timeout:12e4});return{stdout:i.stdout,stderr:i.stderr}}catch(i){let n=i.stderr||i.message||"";throw new Error(`npx skills add failed: ${n}`)}}function Oo(e){if(e.isLocal)return e.localPath;let t=`https://github.com/${e.owner}/${e.repo}`;return e.ref?`${t}/tree/${e.ref}${e.subpath?`/${e.subpath}`:""}`:t}async function ze(e,t,s){let i=e.providers.filter(h=>h.enabled);if(t==="all"){if(i.length===0)throw new Error("No providers are enabled. Enable a provider in your config.");return{provider:i.find(g=>g.name==="agents")||i[0],allProviders:i}}if(t){let h=e.providers.find(g=>g.name===t);if(!h){let g=e.providers.map(m=>m.name).join(", ");throw new Error(`Unknown provider: "${t}". Valid providers: ${g}, all`)}if(!h.enabled)throw new Error(`Provider "${t}" is disabled. Enable it in your config or choose another provider.`);return{provider:h,allProviders:null}}if(i.length===1)return{provider:i[0],allProviders:null};if(!s){if(i.length===0)throw new Error("No providers are enabled. Enable a provider in your config.");let h=i.map(g=>g.name).join(", ");throw new Error(`--tool (or --provider) is required in non-interactive mode. Available: ${h}, all`)}let n=e.preferences.selectedTools,o=n&&n.length>0?new Set(n):null,a=e.providers.map(h=>({label:`${h.label} (${h.name})`,hint:h.global,checked:o?o.has(h.name):h.name==="agents"})),l=await We({items:a});if(l.length===0)throw new Error("No tools selected. Aborting.");let c=l.map(h=>e.providers[h]),d=c.map(h=>h.name),{saveSelectedTools:f}=await import("./config-55HAAFSH.js");return await f(d),c.length===1?{provider:c[0],allProviders:null}:{provider:c.find(h=>h.name==="agents")||c[0],allProviders:c}}function _i(e,t,s,i,n,r,o="global"){let a=o==="project"?n.project:n.global,l=oe(a),c=pe(l,i);return{source:e,tempDir:t,sourceDir:s,targetDir:c,skillName:i,force:r,providerName:n.name,providerLabel:n.label,scope:o}}async function To(e,t){try{if(await Mi(e),N(`install: target ${e} \u2014 conflict (exists)${t?", force overwrite":""}`),!t)throw new Error(`Skill already exists at: ${e}
|
|
157
|
+
Use --force to overwrite.`)}catch(s){if(s.message?.includes("--force"))throw s;N(`install: target ${e} \u2014 no conflict`)}}var $c=Gr(wr(),1);import{readFile as pg}from"fs/promises";import{join as mg}from"path";var Sc=500;function hg(e){let t=e.split(`
|
|
158
|
+
`),s=!1,i=!1;for(let n of t){if(n.trim()==="---")if(s){i=!0;continue}else{s=!0;continue}if(i&&n.trim().length>0)return!0}return!1}function gg(e){let t=e.split(`
|
|
159
|
+
`),s=-1;for(let i=0;i<t.length;i++)if(t[i].trim()==="---")if(s===-1)s=i+1;else return t.slice(s,i).join(`
|
|
160
|
+
`);return null}function yg(e){let t=gg(e);if(t===null)return null;try{return(0,$c.parse)(t),null}catch(s){return s.message||"invalid YAML"}}async function xc(e){let t=[];(!e.description||e.description.trim()==="")&&t.push({category:"missing-description",message:"Skill has no description in SKILL.md frontmatter"}),(!e.version||e.version==="0.0.0")&&t.push({category:"missing-version",message:"Skill has no version (or default 0.0.0) in SKILL.md frontmatter"});try{let i=mg(e.path,"SKILL.md"),n=await pg(i,"utf-8");hg(n)||t.push({category:"empty-body",message:"SKILL.md contains only frontmatter with no body content"});let r=yg(n);r&&t.push({category:"invalid-yaml",message:`SKILL.md has invalid YAML frontmatter: ${r}`})}catch{}let s=e.fileCount;return s!==void 0&&s>Sc&&t.push({category:"high-file-count",message:`Skill has ${s} files (threshold: ${Sc})`}),t}import{join as Cg}from"path";import{homedir as Eg}from"os";import{readFile as bg,writeFile as wg,mkdir as vg}from"fs/promises";import{dirname as kg}from"path";async function Sg(e){try{let t=await bg(e,"utf-8"),s=JSON.parse(t);return!s.fetched_at||s.data===void 0||s.data===null?null:s}catch{return null}}async function $g(e,t,s){let i={fetched_at:new Date().toISOString(),ttl_seconds:s,data:t};try{await vg(kg(e),{recursive:!0}),await wg(e,JSON.stringify(i,null,2),"utf-8"),N(`http: wrote cache -> ${e}`)}catch(n){N(`http: failed to write cache: ${n}`)}}function xg(e){let t=new Date(e.fetched_at).getTime();return(Date.now()-t)/1e3<e.ttl_seconds}async function Cc(e,t,s={}){let i=s.ttl??3600,n=s.noCache??!1,r=await Sg(t);if(r&&!n&&xg(r))return N(`http: cache hit (fresh) -> ${t}`),r.data;try{N(`http: fetching -> ${e}`);let o=await fetch(e);if(!o.ok)throw new Error(`HTTP ${o.status}: ${o.statusText}`);let a=await o.json();return await $g(t,a,i),a}catch(o){return N(`http: fetch failed: ${o}`),r?(N(`http: using stale cache as fallback -> ${t}`),r.data):null}}var Ag=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,Pg=/^[a-zA-Z0-9_-]+$/,Pc=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/,Ng=/^[0-9a-f]{40}$/,Ig=/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/,Lg=/^[a-z0-9-]+$/,Rg=/^sha256:[0-9a-f]{64}$/,Ec=["pass","warning","dangerous"];function ii(e){let t=[];if(!e||typeof e!="object"||Array.isArray(e))return[{field:"(root)",message:"manifest must be a non-null object"}];let s=e,i=new Set(["name","author","description","repository","commit","skill_path","version","license","tags","security_verdict","published_at","checksum"]);for(let o of Object.keys(s))i.has(o)||t.push({field:o,message:`unknown property "${o}" is not allowed`});let n=[{field:"name",pattern:Ag,maxLength:128},{field:"author",pattern:Pg,maxLength:39},{field:"description",maxLength:256},{field:"repository",pattern:Pc},{field:"commit",pattern:Ng},{field:"published_at"}];for(let{field:o,pattern:a,maxLength:l}of n){let c=s[o];if(c==null){t.push({field:o,message:`required field "${o}" is missing`});continue}if(typeof c!="string"){t.push({field:o,message:`"${o}" must be a string`});continue}if(c.length===0){t.push({field:o,message:`"${o}" must not be empty`});continue}l&&c.length>l&&t.push({field:o,message:`"${o}" exceeds maximum length of ${l}`}),a&&!a.test(c)&&t.push({field:o,message:`"${o}" does not match required pattern`})}let r=s.security_verdict;if(r==null?t.push({field:"security_verdict",message:'required field "security_verdict" is missing'}):(typeof r!="string"||!Ec.includes(r))&&t.push({field:"security_verdict",message:`"security_verdict" must be one of: ${Ec.join(", ")}`}),typeof s.published_at=="string"&&s.published_at.length>0&&(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/.test(s.published_at)||t.push({field:"published_at",message:'"published_at" must be a valid ISO 8601 date-time'})),s.version!==void 0&&(typeof s.version!="string"||!Ig.test(s.version))&&t.push({field:"version",message:'"version" must be a valid semver string'}),s.license!==void 0&&(typeof s.license!="string"?t.push({field:"license",message:'"license" must be a string'}):s.license.length>64&&t.push({field:"license",message:'"license" exceeds maximum length of 64'})),s.tags!==void 0)if(!Array.isArray(s.tags))t.push({field:"tags",message:'"tags" must be an array'});else{s.tags.length>10&&t.push({field:"tags",message:'"tags" has more than 10 items'});let o=new Set;for(let a=0;a<s.tags.length;a++){let l=s.tags[a];if(typeof l!="string"){t.push({field:`tags[${a}]`,message:"tag must be a string"});continue}l.length>32&&t.push({field:`tags[${a}]`,message:`tag "${l}" exceeds maximum length of 32`}),Lg.test(l)||t.push({field:`tags[${a}]`,message:`tag "${l}" does not match pattern (lowercase alphanumeric and hyphens)`}),o.has(l)&&t.push({field:`tags[${a}]`,message:`duplicate tag "${l}"`}),o.add(l)}}return s.checksum!==void 0&&(typeof s.checksum!="string"||!Rg.test(s.checksum))&&t.push({field:"checksum",message:'"checksum" must match pattern sha256:<64-hex-chars>'}),s.skill_path!==void 0&&(typeof s.skill_path!="string"?t.push({field:"skill_path",message:'"skill_path" must be a string'}):s.skill_path.length===0?t.push({field:"skill_path",message:'"skill_path" must not be empty'}):s.skill_path.length>256?t.push({field:"skill_path",message:'"skill_path" exceeds maximum length of 256'}):/\.\.|^\//.test(s.skill_path)&&t.push({field:"skill_path",message:'"skill_path" must not contain ".." or start with "/"'})),t}function Og(e,t){let s=e.length,i=t.length;if(s===0)return i;if(i===0)return s;let n=new Array(i+1),r=new Array(i+1);for(let o=0;o<=i;o++)n[o]=o;for(let o=1;o<=s;o++){r[0]=o;for(let a=1;a<=i;a++){let l=e[o-1]===t[a-1]?0:1;r[a]=Math.min(n[a]+1,r[a-1]+1,n[a-1]+l)}[n,r]=[r,n]}return n[i]}function Tg(e,t,s=2){let i=[];for(let n of t){if(e===n)continue;let r=Og(e,n);r<=s&&i.push({existingName:n,distance:r})}return i.sort((n,r)=>n.distance-r.distance)}var vr=process.env.ASM_REGISTRY_URL??"https://raw.githubusercontent.com/luongnv89/asm-registry/main/index.json",Mg=process.env.ASM_REGISTRY_CACHE??Cg(Eg(),".config","agent-skill-manager","registry-cache.json"),Dg=3600;function kr(e){if(e.startsWith("github:")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("~/")||e==="~"||e==="."||e==="..")return!1;let t=(e.match(/\//g)||[]).length;if(t>1)return!1;if(t===1){let[s,i]=e.split("/");return/^[a-zA-Z0-9_-]+$/.test(s)&&/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(i)}return/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(e)}function Sr(e){return kr(e)?e.includes("/"):!1}async function $r(e){let t=await Cc(vr,Mg,{ttl:Dg,noCache:e?.noCache});if(!t)return null;if(typeof t!="object"||!Array.isArray(t.manifests)||typeof t.generated_at!="string")return N("registry: fetched index has invalid structure \u2014 discarding"),null;let s=[];for(let i of t.manifests){let n=ii(i);if(n.length>0){N(`registry: dropping invalid manifest entry (${i?.name??"unknown"}): ${n.map(r=>r.message).join(", ")}`);continue}if(!Pc.test(i.repository)){N(`registry: dropping manifest with unexpected repository URL: ${i.repository}`);continue}s.push(i)}return{generated_at:t.generated_at,manifests:s}}function _g(e,t){return t.manifests.filter(s=>s.name.toLowerCase()===e.toLowerCase())}function qg(e,t,s){return s.manifests.find(i=>i.author.toLowerCase()===e.toLowerCase()&&i.name.toLowerCase()===t.toLowerCase())??null}function Ac(e,t,s=5){return Tg(e,t.manifests.map(n=>n.name),3).slice(0,s).map(n=>n.existingName)}async function Nc(e,t){let s=await $r(t);if(!s)return N("registry: failed to fetch index \u2014 skipping registry resolution"),{resolved:null,multipleMatches:[],suggestions:[]};if(Sr(e)){let[r,o]=e.split("/"),a=qg(r,o,s);if(a)return{resolved:{manifest:a,source:"registry"},multipleMatches:[],suggestions:[]};let l=Ac(o,s);return{resolved:null,multipleMatches:[],suggestions:l}}let i=_g(e,s);if(i.length===1)return{resolved:{manifest:i[0],source:"registry"},multipleMatches:[],suggestions:[]};if(i.length>1)return{resolved:null,multipleMatches:i,suggestions:[]};let n=Ac(e,s);return{resolved:null,multipleMatches:[],suggestions:n}}function Ic(e){let t=e.filter(s=>s.provider!=="plugin").map(s=>({name:s.name,version:s.version,dirName:s.dirName,provider:s.provider,scope:s.scope,path:s.path,isSymlink:s.isSymlink,symlinkTarget:s.symlinkTarget,effort:s.effort}));return{version:1,exportedAt:new Date().toISOString(),skills:t}}import{readFile as Fg,access as Rc,mkdir as jg,cp as Lc,rm as Bg,symlink as Ug}from"fs/promises";import{join as Oc,basename as Vg}from"path";function Kg(e){let t=[];if(typeof e!="object"||e===null||Array.isArray(e))return{valid:!1,errors:["Manifest must be a JSON object."]};let s=e;if(s.version!==1&&t.push(`Unsupported manifest version: ${JSON.stringify(s.version)}. Expected 1.`),typeof s.exportedAt!="string"&&t.push("Missing or invalid 'exportedAt' field."),!Array.isArray(s.skills))return t.push("Missing or invalid 'skills' array."),{valid:!1,errors:t};for(let i=0;i<s.skills.length;i++){let n=s.skills[i];if(typeof n!="object"||n===null){t.push(`skills[${i}]: must be an object.`);continue}let r=n;(typeof r.name!="string"||!r.name)&&t.push(`skills[${i}]: missing or empty 'name'.`),(typeof r.dirName!="string"||!r.dirName)&&t.push(`skills[${i}]: missing or empty 'dirName'.`),(typeof r.provider!="string"||!r.provider)&&t.push(`skills[${i}]: missing or empty 'provider'.`),r.scope!=="global"&&r.scope!=="project"&&t.push(`skills[${i}]: invalid 'scope' "${String(r.scope)}". Must be "global" or "project".`)}return{valid:t.length===0,errors:t}}async function Tc(e){let t;try{t=await Fg(e,"utf-8")}catch(n){throw n?.code==="ENOENT"?new Error(`Manifest file not found: ${e}`):new Error(`Failed to read manifest file: ${n.message}`)}let s;try{s=JSON.parse(t)}catch{throw new Error("Manifest file is not valid JSON.")}let i=Kg(s);if(!i.valid)throw new Error(`Invalid manifest:
|
|
161
|
+
${i.errors.join(`
|
|
162
|
+
`)}`);return s}async function Jg(e){try{return await Rc(e),!0}catch{return!1}}function Hg(e,t){return e.providers.find(s=>s.name===t&&s.enabled)}function Yg(e,t,s,i){let n=Hg(e,t);if(!n)return null;let r=s==="global"?n.global:n.project,o=oe(r),a=Vg(i);return!a||a==="."||a===".."?null:Oc(o,a)}function Gg(e,t){let s=e.find(i=>i.dirName===t.dirName&&i.provider===t.provider);return s||e.find(i=>i.dirName===t.dirName)||null}async function Mc(e,t,s){let i=s?.config??await q(),n=s?.installedSkills??await Q(i,"both"),r=[];for(let c of e.skills){if(t.scopeFilter!=="both"&&c.scope!==t.scopeFilter){N(`import: skipping "${c.name}" \u2014 scope "${c.scope}" filtered out`);continue}let d=Yg(i,c.provider,c.scope,c.dirName);if(!d){r.push({skillName:c.name,provider:c.provider,scope:c.scope,status:"failed",reason:`Provider "${c.provider}" not found or not enabled.`});continue}let f=await Jg(d);if(f&&!t.force){r.push({skillName:c.name,provider:c.provider,scope:c.scope,status:"skipped",reason:"Already installed.",path:d});continue}if(t.dryRun){r.push({skillName:c.name,provider:c.provider,scope:c.scope,status:"dry-run",reason:f?"Would overwrite (--force).":"Would install.",path:d});continue}let p=Gg(n,c);if(!p){r.push({skillName:c.name,provider:c.provider,scope:c.scope,status:"failed",reason:"No installed source found. Install the skill first with: asm install <source>"});continue}try{if(await jg(Oc(d,".."),{recursive:!0}),f&&await Bg(d,{recursive:!0,force:!0}),c.isSymlink&&c.symlinkTarget)try{await Rc(c.symlinkTarget),await Ug(c.symlinkTarget,d),N(`import: symlinked "${c.name}" -> ${c.symlinkTarget} at ${d}`)}catch{await Lc(p.realPath,d,{recursive:!0}),N(`import: symlink target unreachable, copied "${c.name}" from ${p.realPath} to ${d}`)}else await Lc(p.realPath,d,{recursive:!0}),N(`import: copied "${c.name}" from ${p.realPath} to ${d}`);r.push({skillName:c.name,provider:c.provider,scope:c.scope,status:"installed",path:d})}catch(h){r.push({skillName:c.name,provider:c.provider,scope:c.scope,status:"failed",reason:`Copy failed: ${h.message}`})}}let o=r.filter(c=>c.status==="installed").length,a=r.filter(c=>c.status==="skipped").length,l=r.filter(c=>c.status==="failed").length;return{total:r.length,installed:o,skipped:a,failed:l,results:r}}import{mkdir as Wg,writeFile as zg,access as Qg}from"fs/promises";import{join as Xg}from"path";function Zg(e){return`---
|
|
163
|
+
name: ${e}
|
|
163
164
|
description: ""
|
|
164
165
|
license: ""
|
|
165
166
|
metadata:
|
|
@@ -167,7 +168,7 @@ metadata:
|
|
|
167
168
|
creator: ""
|
|
168
169
|
---
|
|
169
170
|
|
|
170
|
-
# ${
|
|
171
|
+
# ${e}
|
|
171
172
|
|
|
172
173
|
Describe what this skill does here. This content will be loaded by the AI agent
|
|
173
174
|
as instructions for when and how to use this skill.
|
|
@@ -179,66 +180,70 @@ as instructions for when and how to use this skill.
|
|
|
179
180
|
## Instructions
|
|
180
181
|
|
|
181
182
|
- Step-by-step instructions for the agent
|
|
182
|
-
`}async function
|
|
183
|
-
`)}import{access as
|
|
184
|
-
`,"utf-8"),
|
|
185
|
-
${
|
|
186
|
-
`)}`);return
|
|
187
|
-
`);for(let
|
|
188
|
-
`)}function
|
|
189
|
-
About to publish "${
|
|
190
|
-
Security verdict: ${
|
|
191
|
-
|
|
192
|
-
Proceed? [y/N] `);let
|
|
193
|
-
`)
|
|
194
|
-
`,
|
|
195
|
-
`),
|
|
196
|
-
`).map(
|
|
183
|
+
`}async function Dc(e,t){await Wg(t,{recursive:!0});let s=Xg(t,"SKILL.md"),i=Zg(e);await zg(s,i,"utf-8")}async function _c(e){try{return await Qg(e),!0}catch{return!1}}import{readdir as ey,stat as ty}from"fs/promises";import{join as sy}from"path";async function iy(e){let t=0;try{let i=(await ey(e,{recursive:!0})).map(async r=>{try{let o=await ty(sy(e,r));if(o.isFile())return o.size}catch{}return 0});t=(await Promise.all(i)).reduce((r,o)=>r+o,0)}catch{}return t}async function Fc(e,t){let s={},i={global:0,project:0},n={},r=e.map(async l=>{s[l.provider]=(s[l.provider]||0)+1,i[l.scope]++;let c=await iy(l.path);return n[l.path]=c,c}),a=(await Promise.all(r)).reduce((l,c)=>l+c,0);return{totalSkills:e.length,byProvider:s,byScope:i,totalDiskBytes:a,perSkillDiskBytes:n,duplicateGroups:t.duplicateGroups.length,duplicateInstances:t.totalDuplicateInstances}}function ny(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function xr(e,t,s=20){let i=Math.round(e/t*s),n=s-i;return u.green("#".repeat(i))+u.dim("-".repeat(n))}var qc={claude:"Claude Code",codex:"Codex",openclaw:"OpenClaw",agents:"Agents"};function jc(e){let t=[];t.push(""),t.push(u.blueBold(" Skill Statistics")),t.push(u.dim(" "+"-".repeat(20))),t.push(""),t.push(` ${u.bold("Total:")} ${u.cyan(String(e.totalSkills))} skills`),t.push(` ${u.bold("Disk:")} ${u.cyan(ny(e.totalDiskBytes))}`),t.push(""),t.push(u.bold(" By Tool"));let s=Object.entries(e.byProvider).sort((l,c)=>c[1]-l[1]),i=Math.max(...s.map(([,l])=>l)),n=Math.max(...s.map(([l])=>(qc[l]||l).length));for(let[l,c]of s){let d=qc[l]||l,f=oo(l,d.padEnd(n)),p=String(c).padStart(4);t.push(` ${f} ${p} ${xr(c,i)}`)}t.push(""),t.push(u.bold(" By Scope"));let r=Math.max(e.byScope.global,e.byScope.project),o=String(e.byScope.global).padStart(4),a=String(e.byScope.project).padStart(4);return t.push(` ${"global ".padEnd(n)} ${o} ${xr(e.byScope.global,r)}`),t.push(` ${"project".padEnd(n)} ${a} ${xr(e.byScope.project,r)}`),t.push(""),t.push(u.bold(" Duplicates")),e.duplicateGroups>0?(t.push(` ${u.yellow(`${e.duplicateGroups} group(s), ${e.duplicateInstances} total instance(s)`)}`),t.push(u.dim(` Run ${u.bold("asm audit")} to review`))):t.push(` ${u.green("None")}`),t.push(""),t.join(`
|
|
184
|
+
`)}import{access as ry,lstat as Cr,mkdir as oy,readdir as ay,readFile as Bc,rm as ly,symlink as cy}from"fs/promises";import{join as ni}from"path";async function Er(e){let t;try{t=await Cr(e)}catch{throw new Error(`Path does not exist: ${e}`)}if(!t.isDirectory())throw new Error(`Path is not a directory: ${e}`);let s=ni(e,"SKILL.md"),i;try{i=await Bc(s,"utf-8")}catch{throw new Error(`No SKILL.md found in ${e}`)}let n=ie(i);if(!n.name)throw new Error(`Invalid SKILL.md in ${e}: missing "name" in frontmatter`);return{name:n.name,version:ae(n)}}async function Uc(e,t,s,i){let n=ni(t,s),r=!1;try{await ry(n),r=!0}catch{}if(r){if(!i)throw new Error(`Target already exists: ${n}. Use --force to overwrite.`);await ly(n,{recursive:!0,force:!0})}await oy(t,{recursive:!0}),await cy(e,n,"dir")}async function Ar(e){let t;try{t=await Cr(e)}catch{throw new Error(`Path does not exist: ${e}`)}if(!t.isDirectory())throw new Error(`Path is not a directory: ${e}`);let s=await ay(e),i=[];for(let n of s){if(n.startsWith(".")||n==="node_modules")continue;let r=ni(e,n);try{if(!(await Cr(r)).isDirectory())continue}catch{continue}let o=ni(r,"SKILL.md");try{let a=await Bc(o,"utf-8"),l=ie(a);l.name&&i.push({absPath:r,dirName:n,name:l.name,version:ae(l)})}catch{}}return i.sort((n,r)=>n.name.localeCompare(r.name)),i}import{readFile as uy,writeFile as fy,readdir as Vc,access as Kc,mkdir as dy,rm as py}from"fs/promises";import{join as Je,resolve as Jc,dirname as my}from"path";import{homedir as hy}from"os";import{fileURLToPath as gy}from"url";var yy=gy(import.meta.url),by=my(yy),Ke=Je(hy(),".config","agent-skill-manager","bundles"),ri=Jc(by,"..","data","bundles");function wy(e){let t=[];if(typeof e!="object"||e===null||Array.isArray(e))return{valid:!1,errors:["Bundle must be a JSON object."]};let s=e;if(s.version!==1&&t.push(`Unsupported bundle version: ${JSON.stringify(s.version)}. Expected 1.`),(typeof s.name!="string"||!s.name)&&t.push("Missing or empty 'name' field."),(typeof s.description!="string"||!s.description)&&t.push("Missing or empty 'description' field."),(typeof s.author!="string"||!s.author)&&t.push("Missing or empty 'author' field."),typeof s.createdAt!="string"&&t.push("Missing or invalid 'createdAt' field."),!Array.isArray(s.skills))return t.push("Missing or invalid 'skills' array."),{valid:!1,errors:t};s.skills.length===0&&t.push("Bundle must contain at least one skill.");for(let i=0;i<s.skills.length;i++){let n=s.skills[i];if(typeof n!="object"||n===null){t.push(`skills[${i}]: must be an object.`);continue}let r=n;(typeof r.name!="string"||!r.name)&&t.push(`skills[${i}]: missing or empty 'name'.`),(typeof r.installUrl!="string"||!r.installUrl)&&t.push(`skills[${i}]: missing or empty 'installUrl'.`)}return s.tags!==void 0&&(Array.isArray(s.tags)?s.tags.some(i=>typeof i!="string")&&t.push("'tags' must contain only strings."):t.push("'tags' must be an array of strings if provided.")),{valid:t.length===0,errors:t}}function Hc(e,t,s,i,n){return{version:1,name:e,description:t,author:s,createdAt:new Date().toISOString(),skills:i,tags:n}}async function Yc(e,t){let s=t??await Le(),i=s.skills[e.name]||s.skills[e.dirName],n;return e.isSymlink&&e.symlinkTarget?n=e.symlinkTarget:i?.source?n=i.source:n=e.path,{name:e.name,installUrl:n,description:e.description||void 0,version:e.version||void 0}}async function vy(){await dy(Ke,{recursive:!0})}function Pr(e){let t=e.toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");if(t=t.replace(/^\.+|\.+$/g,""),!t||t==="."||t==="..")throw new Error("Invalid bundle name: results in an empty filename after sanitization.");return t}async function Nr(e){await vy();let t=`${Pr(e.name)}.json`,s=Je(Ke,t);return await fy(s,JSON.stringify(e,null,2)+`
|
|
185
|
+
`,"utf-8"),N(`bundle: saved to ${s}`),s}async function Yt(e){let t;try{t=await uy(e,"utf-8")}catch(n){throw n?.code==="ENOENT"?new Error(`Bundle file not found: ${e}`):new Error(`Failed to read bundle file: ${n.message}`)}let s;try{s=JSON.parse(t)}catch{throw new Error("Bundle file is not valid JSON.")}let i=wy(s);if(!i.valid)throw new Error(`Invalid bundle:
|
|
186
|
+
${i.errors.join(`
|
|
187
|
+
`)}`);return s}async function Gt(e){if(e.includes("/")||e.includes("\\")||e.endsWith(".json")){let i=Jc(e);return Yt(i)}let t=`${Pr(e)}.json`,s=Je(Ke,t);try{return await Yt(s)}catch(i){if(i?.message?.includes("Bundle file not found")){let n=Je(ri,t);try{return await Yt(n)}catch(r){throw r?.message?.includes("Bundle file not found")?new Error(`Bundle file not found: ${s}`):r}}throw i}}async function Gc(){let e=[];try{await Kc(ri)}catch{return e}let t;try{t=await Vc(ri)}catch{return e}for(let s of t){if(!s.endsWith(".json"))continue;let i=Je(ri,s);try{let n=await Yt(i);e.push(n)}catch{N(`bundle: skipping invalid predefined file ${i}`)}}return e.sort((s,i)=>s.name.localeCompare(i.name)),e}async function Wc(){let e=[];try{await Kc(Ke)}catch{return e}let t;try{t=await Vc(Ke)}catch{return e}for(let s of t){if(!s.endsWith(".json"))continue;let i=Je(Ke,s);try{let n=await Yt(i);e.push(n)}catch{N(`bundle: skipping invalid file ${i}`)}}return e.sort((s,i)=>s.name.localeCompare(i.name)),e}async function zc(e){let t=`${Pr(e)}.json`,s=Je(Ke,t);try{return await py(s),N(`bundle: removed ${s}`),!0}catch(i){if(i?.code==="ENOENT")return!1;throw i}}import{readFile as Iy,realpath as Ly}from"fs/promises";import{join as Ry,resolve as Oy,relative as Ty}from"path";var Zc=[{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 ky(e,t){let s={owner:e,repo:t,profileUrl:`https://github.com/${e}`,reposUrl:`https://github.com/${e}?tab=repositories`,isOrganization:null,publicRepos:null,accountAge:null,fetchError:null};try{let i=await fetch(`https://api.github.com/users/${e}`,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"agent-skill-manager"},signal:AbortSignal.timeout(1e4)});if(!i.ok)return s.fetchError=`GitHub API returned ${i.status}`,s;let n=await i.json();if(s.isOrganization=n.type==="Organization",s.publicRepos=typeof n.public_repos=="number"?n.public_repos:null,typeof n.created_at=="string"){let r=new Date(n.created_at),o=new Date,a=Math.floor((o.getTime()-r.getTime())/(365.25*24*60*60*1e3)),l=Math.floor((o.getTime()-r.getTime())%(365.25*24*60*60*1e3)/(30.44*24*60*60*1e3));s.accountAge=a>0?`${a}y ${l}m`:`${l}m`}N(`security-audit: source analysis for ${e} -> repos=${s.publicRepos}, org=${s.isOrganization}, age=${s.accountAge}`)}catch(i){s.fetchError=i.message||"Failed to fetch GitHub profile",N(`security-audit: source analysis failed -> ${s.fetchError}`)}return s}function Sy(e){let t=new Map;for(let{relPath:n,content:r}of e){let o=r.split(`
|
|
188
|
+
`);for(let a=0;a<o.length;a++){let l=o[a],c=l.trim();for(let d of Zc)if(d.pattern.test(l)){let f=d.category;t.has(f)||t.set(f,{description:d.description,matches:[]});let p=c.length>120?c.slice(0,120)+"...":c;t.get(f).matches.push({file:n,line:a+1,match:p,severity:d.severity})}}}let s=[];for(let[n,r]of t)s.push({category:n,description:r.description,matches:r.matches});let i={critical:0,warning:1,info:2};return s.sort((n,r)=>{let o=Math.min(...n.matches.map(l=>i[l.severity])),a=Math.min(...r.matches.map(l=>i[l.severity]));return o-a}),s}function $y(e){let t=new Map;for(let r of e)for(let o of r.matches)for(let a of Zc)if(a.permissionType&&a.category===r.category&&a.pattern.test(o.match)){let l=a.permissionType;t.has(l)||t.set(l,{evidence:[],categories:new Set});let c=t.get(l);c.evidence.push({file:o.file,line:o.line,match:o.match}),c.categories.add(r.category);break}let s={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."},i=[];for(let[r,o]of t)i.push({type:r,evidence:o.evidence,reason:s[r]});let n={shell:0,"code-execution":1,network:2,filesystem:3,environment:4};return i.sort((r,o)=>(n[r.type]??99)-(n[o.type]??99)),i}function xy(e,t,s){let i=0,n=0;for(let l of e)for(let c of l.matches)c.severity==="critical"&&i++,c.severity==="warning"&&n++;let r=t.some(l=>l.type==="shell"),o=t.some(l=>l.type==="code-execution"),a=t.some(l=>l.type==="network");return r&&a?{verdict:"dangerous",reason:"Skill has both shell execution and network access -- potential data exfiltration risk."}:o&&a?{verdict:"dangerous",reason:"Skill has dynamic code execution and network access -- potential remote code execution risk."}:i>=10?{verdict:"dangerous",reason:`${i} critical findings detected. High concentration of risky patterns.`}:r||o?{verdict:"warning",reason:r?"Skill executes shell commands. Review commands carefully before installing.":"Skill uses dynamic code execution. Review usage carefully."}:i>0?{verdict:"warning",reason:`${i} critical finding${i>1?"s":""} detected. Manual review recommended.`}:n>0?{verdict:"caution",reason:`${n} warning${n>1?"s":""} found. Generally acceptable but worth reviewing.`}:s&&s.publicRepos!==null&&s.publicRepos<3?{verdict:"caution",reason:"No code issues found, but the author has very few public repositories."}:{verdict:"safe",reason:"No suspicious patterns detected."}}async function Pe(e,t,s,i){N(`security-audit: scanning ${e}`);let n=await ts(e),r=n.reduce((f,p)=>f+p.lineCount,0),o=null;s&&i&&(o=await ky(s,i));let a=Sy(n),l=$y(a),{verdict:c,reason:d}=xy(a,l,o);return{scannedAt:new Date().toISOString(),skillName:t,skillPath:e,source:o,codeScans:a,permissions:l,totalFiles:n.length,totalLines:r,verdict:c,verdictReason:d}}var R=u,He=56,Cy={"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"},Qc={critical:0,warning:1,info:2};function Ey(e){switch(e){case"safe":return R.bgGreen(" SAFE ");case"caution":return R.bgCyan(" CAUTION ");case"warning":return R.bgYellow(" WARNING ");case"dangerous":return R.bgRed(" DANGEROUS ")}}function Ay(e){switch(e){case"safe":return R.green;case"caution":return R.cyan;case"warning":return R.yellow;case"dangerous":return R.red}}function lt(e){switch(e){case"critical":return R.red("!!");case"warning":return R.yellow(" !");case"info":return R.dim(" i")}}function Ir(e,t){return e.length>t?e.slice(0,t-3)+"...":e}function oi(e){return e.toLocaleString("en-US")}function eu(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function Xc(e){return eu(e).length}function Py(e){let t=new Map;for(let s of e){let i=`${s.file}:${s.line}`,n=t.get(i);(!n||Qc[s.severity]<Qc[n.severity])&&t.set(i,s)}return Array.from(t.values())}function Ny(e){let t=new Map;for(let s of e){let i=t.get(s.file);i||(i={file:s.file,entries:[]},t.set(s.file,i)),i.entries.push({line:s.line,match:s.match,severity:s.severity})}return Array.from(t.values())}function ai(e){let t=[],s=Ey(e.verdict),i=eu(s),n=` ${R.bold(e.skillName)}`,r=` ${e.skillName}`,o=He-4,a=Math.max(1,o-r.length-i.length);if(t.push(""),t.push(R.dim(" +-- ")+R.bold("Security Audit")+R.dim(" "+"-".repeat(He-19)+"+")),t.push(R.dim(" |")+n+" ".repeat(a)+s+R.dim("|")),t.push(R.dim(" |")+R.dim(` ${oi(e.totalFiles)} files | ${oi(e.totalLines)} lines`)+" ".repeat(Math.max(1,o-` ${oi(e.totalFiles)} files | ${oi(e.totalLines)} lines`.length))+R.dim("|")),t.push(R.dim(" +"+"-".repeat(He-2)+"+")),e.source){let f=e.source;if(f.fetchError)t.push(` ${R.yellow("!")} Could not fetch profile: ${f.fetchError}`);else{let p=[];if(p.push(`${f.owner} ${f.isOrganization?R.cyan("(org)"):R.dim("(user)")}`),f.publicRepos!==null){let h=f.publicRepos,g=h<3?R.yellow(`${h} repos`):h<10?R.cyan(`${h} repos`):R.green(`${h} repos`);p.push(g)}f.accountAge&&p.push(f.accountAge),t.push(` ${R.dim("Author:")} ${p.join(R.dim(" | "))}`)}}if(t.push(""),e.codeScans.length===0)t.push(` ${R.green("*")} ${R.green("No suspicious patterns detected.")}`);else{let f=Ay(e.verdict),p=e.verdict==="dangerous"||e.verdict==="warning"?lt("critical"):e.verdict==="caution"?lt("warning"):lt("info");t.push(` ${p} ${f(e.verdictReason)}`);let h=0,g=0,m=0;for(let $ of e.codeScans)for(let x of $.matches)x.severity==="critical"?h++:x.severity==="warning"?g++:m++;let y=[];h>0&&y.push(R.red(`${h} critical`)),g>0&&y.push(R.yellow(`${g} warning`)),m>0&&y.push(R.dim(`${m} info`));let b=e.permissions.map($=>$.type),w=b.length>0?R.dim(`Perms: ${b.join(", ")}`):"";t.push(` ${y.join(R.dim(" | "))} ${w}`)}if(t.push(""),e.codeScans.length>0){t.push(` ${R.bold("Findings")}`),t.push(R.dim(" "+"=".repeat(He-2)));for(let f of e.codeScans){let p=Py(f.matches),h=p.filter(v=>v.severity==="critical").length,g=p.filter(v=>v.severity==="warning").length,m=p.filter(v=>v.severity==="info").length,y=h>0?lt("critical"):g>0?lt("warning"):lt("info"),b=[];h>0&&b.push(R.red(`${h} critical`)),g>0&&b.push(R.yellow(`${g} warning`)),m>0&&b.push(R.dim(`${m} info`));let w=Cy[f.category],$=w?R.dim(`PERM: ${w}`):"",x=` ${y} ${R.bold(f.category)} (${b.join(", ")})`;if($){let v=Xc(x),S=Xc($),I=Math.max(2,He-v-S);t.push(x+" ".repeat(I)+$)}else t.push(x);let k=Ny(p),E=Math.min(24,Math.max(...k.map(v=>v.file.length))),O=0,P=3;for(let v of k){if(O>=P)break;let S=Ir(v.file,24),I=R.dim(S.padEnd(E));if(v.entries.length===1){let L=v.entries[0],T=Ir(L.match,50);t.push(` ${I} :${L.line} ${R.dim("--")} ${L.severity==="critical"?T:R.dim(T)}`),O++}else if(v.entries.length<=3){let L=v.entries.map(K=>`:${K.line}`).join(", "),T=Ir(v.entries[0].match,40);t.push(` ${I} ${L} ${R.dim("--")} ${R.dim(T)}`),O++}else{let T=v.entries.slice(0,3).map(U=>`:${U.line}`).join(", "),K=v.entries.length-3;t.push(` ${I} ${T} ${R.dim(`(+${K} more)`)}`),O++}}let M=k.length-Math.min(k.length,P);if(M>0){let v=p.length-k.slice(0,P).reduce((S,I)=>S+I.entries.length,0);v>0&&t.push(` ${R.dim(`... ${v} more in ${M} file${M>1?"s":""}`)}`)}t.push("")}}t.push(R.dim(" "+"=".repeat(He-2)));let l=new Date(e.scannedAt),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,"0")}-${String(l.getDate()).padStart(2,"0")} ${String(l.getHours()).padStart(2,"0")}:${String(l.getMinutes()).padStart(2,"0")}`,d=e.source&&!e.source.fetchError?`github.com/${e.source.owner}`:"";if(d){let f=Math.max(2,He-2-c.length-d.length);t.push(R.dim(` ${c}${" ".repeat(f)}${d}`))}else t.push(R.dim(` ${c}`));return t.push(""),t.join(`
|
|
189
|
+
`)}function Lr(e){return JSON.stringify(e,null,2)}async function V(e,t={}){if(e.length===0)throw new Error("runCommand requires a non-empty argv");let{spawn:s}=await import("child_process"),[i,...n]=e;return new Promise((r,o)=>{let a=s(i,n,{cwd:t.cwd,stdio:["ignore","pipe","pipe"]}),l="",c="",d=!1;a.stdout?.on("data",f=>{l+=f.toString()}),a.stderr?.on("data",f=>{c+=f.toString()}),a.on("error",f=>{if(d)return;if(d=!0,f.code==="ENOENT"){r({exitCode:127,stdout:l,stderr:f.message});return}o(f)}),a.on("close",f=>{d||(d=!0,r({exitCode:f??-1,stdout:l,stderr:c}))})})}function li(e){return e.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 My(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/</g,"<").replace(/>/g,">").replace(/\|/g,"\\|")}function Rr(e){return My(li(e))}var Ye="luongnv89/asm-registry";async function Dy(e){let t=Ry(e,"SKILL.md"),s;try{s=await Iy(t,"utf-8")}catch{throw new Error(`No SKILL.md found in ${e}. Run "asm init" to create one.`)}let i=ie(s);if(!i.name)throw new Error("SKILL.md is missing required field: name");if(!i.description)throw new Error("SKILL.md is missing required field: description");let n=ae(i),r=i.tags?i.tags.split(/[\s,]+/).map(o=>o.trim().toLowerCase()).filter(Boolean):[];return{name:i.name,description:i.description.replace(/\s*\n\s*/g," ").trim(),version:n,license:i.license||"MIT",creator:i.creator||"",tags:r}}async function _y(e){let{exitCode:t}=await V(["git","rev-parse","--git-dir"],{cwd:e});if(t!==0)throw new Error(`${e} is not inside a git repository.`)}async function qy(e){let{stdout:t,exitCode:s}=await V(["git","rev-parse","HEAD"],{cwd:e});if(s!==0)throw new Error("Failed to get HEAD commit. Is this a git repository?");return t.trim()}async function Fy(e){let{stdout:t,exitCode:s}=await V(["git","rev-parse","--show-toplevel"],{cwd:e});if(s!==0)throw new Error("Failed to determine git repository root.");return t.trim()}async function jy(e){let{stdout:t,exitCode:s}=await V(["git","remote","get-url","origin"],{cwd:e});if(s!==0)throw new Error("No remote origin found. Add one with: git remote add origin <url>");let i=t.trim(),n=i.match(/^git@github\.com:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+?)(?:\.git)?$/);return n?`https://github.com/${n[1]}/${n[2]}`:i.replace(/\.git$/,"")}async function By(){let{exitCode:e}=await V(["gh","--version"]);if(e!==0)return{available:!1,authenticated:!1,login:null};let{exitCode:t}=await V(["gh","auth","status"]);if(t!==0)return{available:!0,authenticated:!1,login:null};let{stdout:s,exitCode:i}=await V(["gh","api","user","--jq",".login"]);return{available:!0,authenticated:!0,login:i===0?s.trim():null}}function Uy(e){switch(e){case"safe":case"caution":return"pass";case"warning":return"warning";case"dangerous":return"dangerous"}}function tu(e){let t={name:e.metadata.name,author:e.author,description:e.metadata.description,repository:e.repository,commit:e.commit,security_verdict:e.securityVerdict,published_at:new Date().toISOString()};return e.skillPath&&(t.skill_path=e.skillPath),e.metadata.version&&e.metadata.version!=="0.0.0"&&/^\d+\.\d+\.\d+/.test(e.metadata.version)&&(t.version=e.metadata.version),e.metadata.license&&(t.license=e.metadata.license),e.metadata.tags&&e.metadata.tags.length>0&&(t.tags=e.metadata.tags.slice(0,10)),t}function Vy(e){let t=tu({metadata:e.metadata,author:e.metadata.creator||"unknown",commit:e.commit,repository:e.repository,securityVerdict:e.registryVerdict}),s=ii(t);return s.length>0?{success:!1,manifest:t,prUrl:null,error:`Manifest validation failed: ${s.map(i=>`${i.field}: ${i.message}`).join("; ")}`,securityVerdict:e.registryVerdict,securityReport:e.securityReport}:{success:!0,manifest:t,prUrl:null,error:null,securityVerdict:e.registryVerdict,securityReport:e.securityReport,fallback:!0,fallbackReason:e.fallbackReason}}async function su(e){let t=Oy(e.path);N(`publish: starting for ${t}`),await _y(t);let s=await Dy(t);N(`publish: parsed metadata for "${s.name}"`);let n=await(e._auditFn??Pe)(t,s.name),r=Uy(n.verdict);if(r==="dangerous")return{success:!1,manifest:null,prUrl:null,error:`Security audit verdict: dangerous. ${n.verdictReason}`,securityVerdict:r,securityReport:n};if(r==="warning"&&!e.force)return{success:!1,manifest:null,prUrl:null,error:"Security audit verdict: warning. Use --force to override warnings.",securityVerdict:r,securityReport:n};let o=await qy(t),a=await jy(t),l=await Fy(t),c=await Ly(t),d=Ty(l,c),f=d&&d!=="."?d:void 0,h=await(e._checkGhCliFn??By)();if(!h.available||!h.authenticated){let j=h.available?"gh CLI not authenticated":"gh CLI not found";return Vy({metadata:s,commit:o,repository:a,registryVerdict:r,securityReport:n,fallbackReason:j})}if(!h.login)throw new Error("Could not determine GitHub username. The gh CLI is authenticated but the API call failed. Check your network connection and try again.");let g=h.login,m=tu({metadata:s,author:g,commit:o,repository:a,skillPath:f,securityVerdict:r}),y=ii(m);if(y.length>0)return{success:!1,manifest:m,prUrl:null,error:`Manifest validation failed: ${y.map(j=>`${j.field}: ${j.message}`).join("; ")}`,securityVerdict:r,securityReport:n};if(e.dryRun)return{success:!0,manifest:m,prUrl:null,error:null,securityVerdict:r,securityReport:n};if(!e.yes){if(!process.stdin.isTTY)return{success:!1,manifest:m,prUrl:null,error:"Cannot prompt for confirmation in non-interactive mode. Use --yes to skip.",securityVerdict:r,securityReport:n};let j=li(s.name),ye=li(g);process.stderr.write(`
|
|
190
|
+
About to publish "${j}" by ${ye} to ${Ye}.
|
|
191
|
+
Security verdict: ${r}
|
|
192
|
+
|
|
193
|
+
Proceed? [y/N] `);let Ne=await new Promise(Ie=>{let dt="",Yr=pf=>{dt+=pf.toString(),dt.includes(`
|
|
194
|
+
`)&&(process.stdin.removeListener("data",Yr),process.stdin.pause(),Ie(dt.trim()))};process.stdin.resume(),process.stdin.on("data",Yr)});if(Ne.toLowerCase()!=="y"&&Ne.toLowerCase()!=="yes")return{success:!1,manifest:m,prUrl:null,error:"Publish aborted by user.",securityVerdict:r,securityReport:n}}N(`publish: forking ${Ye}`),await V(["gh","repo","fork",Ye,"--clone=false"]);let b=`publish/${g}/${s.name}`,w=`manifests/${g}/${s.name}.json`,$=JSON.stringify(m,null,2)+`
|
|
195
|
+
`,x=Buffer.from($,"utf-8").toString("base64"),{stdout:k,exitCode:E}=await V(["gh","api",`repos/${g}/asm-registry/git/refs/heads/main`,"--jq",".object.sha"]);if(E!==0)return{success:!1,manifest:m,prUrl:null,error:`Failed to read fork's main branch. Ensure the fork exists at ${g}/asm-registry.`,securityVerdict:r,securityReport:n};let O=k.trim(),{exitCode:P}=await V(["gh","api",`repos/${g}/asm-registry/git/refs`,"-X","POST","-f",`ref=refs/heads/${b}`,"-f",`sha=${O}`]);P!==0&&await V(["gh","api",`repos/${g}/asm-registry/git/refs/heads/${b}`,"-X","PATCH","-f",`sha=${O}`,"-f","force=true"]);let{stderr:M,exitCode:v}=await V(["gh","api",`repos/${g}/asm-registry/contents/${w}`,"-X","PUT","-f",`message=Publish ${g}/${s.name}`,"-f",`content=${x}`,"-f",`branch=${b}`]);if(v!==0){let{stdout:j,exitCode:ye}=await V(["gh","api",`repos/${g}/asm-registry/contents/${w}?ref=${b}`,"-q",".sha"]),Ne=j.trim();if(ye===0&&Ne){let{exitCode:Ie}=await V(["gh","api",`repos/${g}/asm-registry/contents/${w}`,"-X","PUT","-f",`message=Update ${g}/${s.name}`,"-f",`content=${x}`,"-f",`branch=${b}`,"-f",`sha=${Ne}`]);if(Ie!==0)return{success:!1,manifest:m,prUrl:null,error:"Failed to write manifest to registry fork.",securityVerdict:r,securityReport:n}}else return{success:!1,manifest:m,prUrl:null,error:`Failed to write manifest to registry fork. ${M}`,securityVerdict:r,securityReport:n}}let S=Rr(s.name),I=Rr(s.description),L=Rr(s.license),T=`Publish ${g}/${li(s.name)}`,K=[`## Skill: ${S}`,"",`**Author:** ${g}`,`**Version:** ${s.version}`,`**Description:** ${I}`,`**License:** ${L}`,`**Repository:** ${a}`,`**Commit:** \`${o}\``,`**Security verdict:** ${r}`,"","---","","*This PR was generated by `asm publish`.*"].join(`
|
|
196
|
+
`),{stdout:U,stderr:ee,exitCode:Qt}=await V(["gh","pr","create","--repo",Ye,"--head",`${g}:${b}`,"--title",T,"--body",K]),se=null;if(Qt===0)se=U.trim();else{let j=ee.match(/https:\/\/github\.com\/[^\s]+\/pull\/\d+/);j&&(se=j[0])}return se?{success:!0,manifest:m,prUrl:se,error:null,securityVerdict:r,securityReport:n}:{success:!1,manifest:m,prUrl:null,error:`Failed to create PR against ${Ye}. ${ee}`,securityVerdict:r,securityReport:n}}function iu(e){let t=e.manifest;return t?["",` gh CLI is unavailable (${e.fallbackReason}).`," To publish manually:","",` 1. Fork ${Ye} on GitHub`,` 2. Create branch: publish/${t.author}/${t.name}`,` 3. Add file: manifests/${t.author}/${t.name}.json`," 4. Paste the manifest below into that file",` 5. Open a PR against ${Ye}`,"",' Run "asm doctor" to fix your environment.',""," Generated manifest:",JSON.stringify(t,null,2).split(`
|
|
197
|
+
`).map(i=>` ${i}`).join(`
|
|
197
198
|
`)].join(`
|
|
198
|
-
`)}import{execFile as
|
|
199
|
-
`)[0];if(!
|
|
200
|
-
`)}function
|
|
201
|
-
`)[0],
|
|
202
|
-
`);if(
|
|
203
|
-
`)}function
|
|
204
|
-
`);if(
|
|
205
|
-
`),
|
|
206
|
-
`);return{rawFrontmatter:
|
|
207
|
-
`),body:""}}function
|
|
208
|
-
`).length}function y9(q){if(!q)return 0;return q.split(/\s+/).map(($)=>$.trim()).filter(Boolean).length}function UW(q,$=1){return(q.match(/^#{1,6}\s+\S/gm)||[]).length>=$}function p$(q,$){let Z=q.toLowerCase();return $.filter((Q)=>Z.includes(Q))}function HW(q){return/```[\s\S]+?```/m.test(q)}function WW(q){return/^\s*[-*]\s+\S/m.test(q)||/^\s*\d+\.\s+\S/m.test(q)}function VW(q,$,Z){let Q=[],X=[],z=0;if(Z!==null)z+=2,Q.push("Has YAML frontmatter block.");else Q.push("SKILL.md has no YAML frontmatter."),X.push("Add a YAML frontmatter block delimited by `---` with at least `name` and `description` fields.");let J=Boolean(q.name&&q.name.trim()),G=Boolean(q.description&&q.description.trim());if(J)z+=1.5;else Q.push("Missing required field: name."),X.push("Add `name:` to frontmatter (use the skill directory name).");if(G)z+=1.5;else Q.push("Missing required field: description."),X.push("Add a one-line `description:` to frontmatter.");let Y=z0(q);if(Y&&Y!=="0.0.0")z+=1;else Q.push("Missing or default version."),X.push("Set `metadata.version` (or top-level `version`) using semver (e.g. 0.1.0).");if(Boolean(q.creator||q["metadata.creator"]))z+=1;else Q.push("Missing `creator`."),X.push("Add a `creator` field so users know who authored and maintains the skill.");if(Boolean(q.license))z+=1;else Q.push("Missing `license`."),X.push("Add a `license` field (e.g. `license: MIT`).");let B=$.trim().length>=20,_=UW($,1);if(B)z+=1,Q.push("Body has meaningful content.");else Q.push("Body content is too short (<20 chars of instructions)."),X.push("Flesh out the markdown body with at least one paragraph of instructions for the agent.");if(_)z+=1,Q.push("Body uses markdown headings.");else Q.push("Body has no markdown headings."),X.push("Add section headings (e.g. `## When to Use`, `## Instructions`) so the agent can navigate the skill quickly.");return{id:"structure",name:"Structure & completeness",score:Math.round(z),max:10,findings:Q,suggestions:X}}function BW(q,$){let Z=[],Q=[],X=0,z=(q.description||"").trim();if(!z)return Z.push("No description."),Q.push("Write a one-sentence description that says specifically what the skill does and when to use it."),{id:"description",name:"Description quality",score:0,max:10,findings:Z,suggestions:Q};let J=y9(z);if(Z.push(`Description is ${J} words.`),J>=8&&J<=40)X+=4;else if(J>=5&&J<8)X+=2,Q.push("Lengthen the description slightly so it names both the action and the trigger (aim for 8–20 words).");else if(J>=41&&J<=60)X+=2,Q.push("Trim the description — aim for under 40 words. Move the long version to the markdown body.");else if(J>60)X+=0,Q.push("Description is too long. Keep it under 40 words; put detail in the body.");else X+=0,Q.push("Description is too short. Aim for 8–20 words.");let G=z.split(/\s+/)[0]?.toLowerCase().replace(/[^\w-]/g,"");if(Boolean(G&&(V8.includes(G)||V8.includes(G.replace(/s$/,"")))))X+=3,Z.push("Starts with an action verb.");else Z.push(`Does not start with a recognized action verb (got "${G??""}").`),Q.push('Start the description with an imperative action verb (e.g. "Generate...", "Analyze...", "Review...").');if(/\buse when\b|\btrigger\b|\bwhen\b|\bfor\b/i.test(z)||/\b(before|after|during)\b/i.test(z))X+=3,Z.push("Mentions a trigger or use-case signal.");else Z.push("No explicit trigger / use-case phrase."),Q.push('Name the trigger in the description — e.g. "Use when...", "for reviewing...", "before publishing...".');return{id:"description",name:"Description quality",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function KW(q,$){let Z=[],Q=[],X=0,z=p$($,YW);if(z.length>=2)X+=3,Z.push(`Progressive disclosure cues present: ${z.slice(0,3).join(", ")}.`);else if(z.length===1)X+=1,Q.push('Add clearer section labels — e.g. "## When to Use" and "## Instructions" — to support progressive disclosure.');else Q.push('Structure the body with "## When to Use" and "## Instructions" sections so the agent reads only what it needs.');if(WW($))X+=2,Z.push("Uses lists or numbered steps.");else Z.push("No lists or steps detected."),Q.push("Use bulleted or numbered steps to narrow the agent's degrees of freedom.");let J=HW($),G=/\bexample\b/i.test($);if(J&&G)X+=2,Z.push("Includes example code block.");else if(J||G)X+=1,Q.push('Back up examples with fenced code blocks labelled under "## Example" so the agent sees concrete input/output.');else Q.push('Add an "## Example" section with a fenced code block showing the desired output.');let Y=($.match(/^\s*[-*0-9.]*\s*(Do|Use|Run|Call|Check|Validate|Return|Emit|Write|Read|Ask|Confirm|Avoid|Never|Always)\b/gim)||[]).length;if(Y>=3)X+=2,Z.push(`Uses imperative voice (${Y} cues).`);else if(Y>=1)X+=1,Q.push("Favor imperative voice (Do / Use / Avoid / Never) to narrow the agent's choices.");else Q.push('Rewrite instructions in the imperative mood — e.g. "Run `git status` first" instead of "you might want to run".');let H=y9($);if(H>=80&&H<=3000)X+=1,Z.push(`Body length within healthy range (${H} words).`);else if(H<80)Z.push(`Body is very short (${H} words).`),Q.push("Expand the instructions; an underspecified skill gives the agent too much freedom.");else Z.push(`Body is very long (${H} words).`),Q.push("Split large content into referenced files; keep SKILL.md focused under ~3000 words.");return{id:"prompt-engineering",name:"Prompt engineering",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function _W(q,$){let Z=[],Q=[],X=0,z=y9($);if(Z.push(`Body is ${z} words.`),z>=120&&z<=1500)X+=4;else if(z>=60&&z<120)X+=2,Q.push("Expand instructions slightly — too little context can push the agent to improvise.");else if(z>1500&&z<=3000)X+=2,Q.push("Consider moving large sections into referenced files (e.g. `references/*.md`) and linking them instead of inlining.");else if(z>3000)X+=0,Q.push("Body is over 3000 words — split long content into referenced files or templates.");let J=p$($,GW);if(J.length>=2)X+=3,Z.push(`References external files or links (${J.slice(0,3).join(", ")}).`);else if(J.length===1)X+=1,Q.push('Link out to supporting files (e.g. "see `references/examples.md`") instead of inlining them.');else Q.push('Offload verbose content to referenced files and link to them ("see `./templates/x.md`").');let Y=($.match(/```[\s\S]+?```/g)||[]).filter((H)=>F8(H)>60);if(Y.length===0)X+=2,Z.push("No oversized code blocks.");else Z.push(`${Y.length} code block(s) longer than 60 lines.`),Q.push("Move large code blocks into referenced template files; link to them from SKILL.md.");if(/\btoken\b|\bbudget\b|\bcontext window\b/i.test($))X+=1,Z.push("Mentions tokens/budget/context window.");return{id:"context-efficiency",name:"Context efficiency",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function LW(q,$){let Z=[],Q=[],X=0,z=p$($,zW);if(z.length>=4)X+=4,Z.push(`Covers multiple safety cues (${z.slice(0,4).join(", ")}).`);else if(z.length>=2)X+=2,Z.push(`Mentions a few safety cues: ${z.join(", ")}.`),Q.push("Add explicit error-handling and confirmation steps so the agent knows how to recover from failures.");else if(z.length===1)X+=1,Q.push('Expand the safety section — include prerequisites, validation steps, and what to do "on error".');else Q.push("Describe prerequisites, confirmation prompts, and error-handling steps to reduce blast radius.");let J=/\b(rm\s|delete|remove|drop|force|overwrite|destructive)\b/i.test($),G=/\bconfirm\b|\bdry-?run\b|\bare you sure\b|\bbackup\b/i.test($);if(J&&G)X+=3,Z.push("Destructive actions paired with confirmation/dry-run.");else if(J)Z.push("References destructive actions without explicit confirmation/dry-run."),Q.push("Pair any destructive command with an explicit confirmation prompt, dry-run flag, or backup step.");else X+=1.5;if(/\bprerequisit/i.test($)||/\brequire/i.test($)||/\bdepend/i.test($))X+=3,Z.push("Declares prerequisites or requirements.");else Z.push("No prerequisites / requirements section."),Q.push('Add a "## Prerequisites" block listing required tools, credentials, and environment state.');return{id:"safety",name:"Safety & guardrails",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function OW(q,$){let Z=[],Q=[],X=0,z=p$($,JW);if(z.length>=4)X+=5,Z.push(`Many testability cues present (${z.slice(0,4).join(", ")}).`);else if(z.length>=2)X+=3,Z.push(`Some testability cues: ${z.join(", ")}.`),Q.push('Add an "## Acceptance Criteria" block listing verifiable outputs or checklist items.');else if(z.length===1)X+=1,Q.push('Add concrete "expected output" examples so the agent can self-check.');else Q.push('Add a "## Acceptance Criteria" section with testable statements (e.g. "produces a JSON report with overall_score").');if(/expected\s+(output|result|response)/i.test($))X+=3,Z.push("Describes expected output/result.");else Q.push('Include an "Expected output" example so reviewers and the agent can verify correctness.');if(/\bedge case|gotcha|pitfall|limitation/i.test($))X+=2,Z.push("Mentions edge cases or limitations.");else Q.push('Add a short "Edge cases" list to describe inputs the skill should reject or handle carefully.');return{id:"testability",name:"Testability",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function FW(q,$){let Z=[],Q=[],X=0,z=(q.name||"").trim();if(z){let Y=/^[a-z][a-z0-9-]*$/.test(z),H=z.length<=40;if(Y&&H)X+=4,Z.push(`name "${z}" follows kebab-case convention.`);else{if(!Y)Z.push(`name "${z}" is not lowercase kebab-case.`),Q.push(`Rename to lowercase kebab-case (e.g. "${z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}").`);if(!H)Z.push(`name is ${z.length} chars; keep it <= 40.`)}}else Q.push("Add a kebab-case `name` (e.g. `my-skill`).");let J=$.match(/^#{1,6}\s+(.+)$/gm)||[];if(J.length>0)if(J.filter((V)=>/^#{1,6}\s+([A-Z][a-z]+|Use|How|When|Workflow|Instructions|Examples|Steps|Acceptance)/.test(V)).length/J.length>=0.5)X+=3,Z.push("Most headings use action/imperative labels.");else X+=1,Q.push("Rename body headings to action-oriented labels (e.g. `## Instructions`, `## When to Use`).");if(!/(?:\s\s|\bTODO\b|\bFIXME\b|\?{2,})/.test(q.description||""))X+=2,Z.push("Description looks clean (no TODO/FIXME/stray noise).");else Q.push("Clean up description — remove TODOs, FIXMEs, double spaces, or trailing punctuation.");return{id:"naming",name:"Naming & conventions",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function yq(q){let{content:$,skillPath:Z,skillMdPath:Q}=q,X=s($),{rawFrontmatter:z,body:J}=O8($),G=[VW(X,J,z),BW(X,J),KW(X,J),_W(X,J),LW(X,J),OW(X,J),FW(X,J)];if(X.name&&x9(Z)===X.name){let L=G.find((K)=>K.id==="naming");if(L.score<L.max)L.score=Math.min(L.max,L.score+1),L.findings.push("Directory name matches frontmatter `name`.")}let Y=G.reduce((L,K)=>L+K.score,0),H=G.reduce((L,K)=>L+K.max,0),V=Math.round(Y/H*100),W="F";if(V>=90)W="A";else if(V>=80)W="B";else if(V>=65)W="C";else if(V>=50)W="D";let B=[],_=[...G].sort((L,K)=>L.score/L.max-K.score/K.max);for(let L of _){for(let K of L.suggestions){if(B.length>=3)break;if(!B.includes(K))B.push(K)}if(B.length>=3)break}return{skillPath:Z,skillMdPath:Q,evaluatedAt:new Date().toISOString(),categories:G,overallScore:V,grade:W,topSuggestions:B,frontmatter:X}}async function I8(q){let $=L8(q)?q:_8(q),Z;try{Z=await B8($)}catch{throw Error(`Skill path does not exist: ${$}`)}let Q,X;if(Z.isFile())return Q=$,X=await b9(Q,"utf-8"),yq({content:X,skillPath:x9($)==="SKILL.md"?x9($):$,skillMdPath:Q});if(!Z.isDirectory())throw Error(`Skill path is not a directory or file: ${$}`);Q=K8($,"SKILL.md");try{X=await b9(Q,"utf-8")}catch{throw Error(`SKILL.md not found in ${$}. Run "asm init" to create one.`)}return yq({content:X,skillPath:$,skillMdPath:Q})}function IW(q){if(q<=20)return"low";if(q<=80)return"medium";if(q<=250)return"high";return"max"}function AW(q){let $=q.split(`
|
|
209
|
-
`),
|
|
210
|
-
`)})}else
|
|
211
|
-
`),changed:
|
|
212
|
-
`);
|
|
213
|
-
`),
|
|
214
|
-
`);let{rawFrontmatter:
|
|
215
|
-
${
|
|
199
|
+
`):""}import{execFile as Ky}from"child_process";import{promisify as Jy}from"util";import{rm as ci,rename as nu,cp as ru,access as Hy,mkdir as Yy}from"fs/promises";import{join as ui}from"path";import{homedir as ou}from"os";var Or=Jy(Ky);async function Gy(e,t,s){let i=new Array(e.length),n=0;async function r(){for(;n<e.length;){let a=n++;i[a]=await s(e[a])}}let o=[];for(let a=0;a<Math.min(t,e.length);a++)o.push(r());return await Promise.all(o),i}async function Wy(e,t){try{let s=["ls-remote",e];t?s.push(t):s.push("HEAD");let{stdout:i}=await Or("git",s,{timeout:1e4}),n=i.split(`
|
|
200
|
+
`)[0];if(!n)return null;let r=n.split(/\s+/)[0];return r&&/^[0-9a-f]{40}$/.test(r)?r:null}catch(s){return N(`updater: git ls-remote failed for ${e}: ${s}`),null}}function Tr(e){return e.sourceType?e.sourceType:e.source.startsWith("local:")?"local":"github"}function au(e){if(e.startsWith("github:")){let t=e.slice(7),s=t.indexOf("#");return s!==-1&&(t=t.slice(0,s)),`https://github.com/${t}.git`}return e.startsWith("file://")?e:null}function zy(e){if(!e.startsWith("github:"))return null;let t=e.slice(7),s=t.indexOf("#");s!==-1&&(t=t.slice(0,s));let i=t.split("/");return i.length<2||!i[0]||!i[1]?null:{owner:i[0],repo:i[1]}}async function Mr(e){let t=e?.readLockFn??Le,s=e?.fetchRegistryIndexFn??$r,i=e?.lock??await t(),n=Object.entries(i.skills);if(n.length===0)return{entries:[],outdatedCount:0,upToDateCount:0,untrackedCount:0,errorCount:0};let r=null;n.some(([,l])=>Tr(l)==="registry"||l.registryName)&&(r=await s());let a=await Gy(n,5,async([l,c])=>{let d=Tr(c);if(!c.commitHash||c.commitHash==="unknown")return{name:l,installedCommit:c.commitHash||"unknown",latestCommit:"unknown",source:c.source,sourceType:d,status:"untracked"};if(d==="local")return{name:l,installedCommit:c.commitHash,latestCommit:c.commitHash,source:c.source,sourceType:d,status:"up-to-date"};if(d==="registry"&&r){let g=c.registryName||l,m=r.manifests.find(y=>y.name.toLowerCase()===g.toLowerCase());if(m){let y=m.commit!==c.commitHash;return{name:l,installedCommit:de(c.commitHash),latestCommit:de(m.commit),source:c.source,sourceType:d,status:y?"outdated":"up-to-date"}}}let f=au(c.source);if(!f)return{name:l,installedCommit:de(c.commitHash),latestCommit:"unknown",source:c.source,sourceType:d,status:"error",error:"Cannot determine remote URL"};let p=await Wy(f,c.ref);if(!p)return{name:l,installedCommit:de(c.commitHash),latestCommit:"unknown",source:c.source,sourceType:d,status:"error",error:"Failed to fetch remote commit"};let h=p!==c.commitHash;return{name:l,installedCommit:de(c.commitHash),latestCommit:de(p),source:c.source,sourceType:d,status:h?"outdated":"up-to-date"}});return{entries:a,outdatedCount:a.filter(l=>l.status==="outdated").length,upToDateCount:a.filter(l=>l.status==="up-to-date").length,untrackedCount:a.filter(l=>l.status==="untracked").length,errorCount:a.filter(l=>l.status==="error").length}}async function Qy(e,t,s,i){if(Tr(t)==="local")return{name:e,status:"skipped",reason:"Local skill (not updatable)"};let r=au(t.source);if(!r)return{name:e,status:"failed",reason:"Cannot determine remote URL"};let o=ui(ou(),".config","agent-skill-manager",".tmp",`${e}-${Date.now()}`);try{let a=ui(ou(),".config","agent-skill-manager",".tmp");await Yy(a,{recursive:!0}),N(`updater: cloning latest ${e} to ${o}`);let l=["clone","--depth","1"];t.ref&&t.ref!=="HEAD"&&l.push("--branch",t.ref),l.push(r,o);try{await Or("git",l,{timeout:6e4})}catch(k){return{name:e,status:"failed",reason:`Clone failed: ${k.stderr||k.message}`}}let c=null;try{let{stdout:k}=await Or("git",["rev-parse","HEAD"],{cwd:o,timeout:5e3});c=k.trim()}catch{return{name:e,status:"failed",reason:"Could not read new commit"}}if(c===t.commitHash)return{name:e,status:"skipped",reason:"Already up to date"};N(`updater: running security audit on ${e}`);let d="safe";try{let k=i?.auditFn??Pe,E=zy(t.source);if(d=(await k(o,e,E?.owner,E?.repo)).verdict,d==="dangerous")return{name:e,status:"skipped",reason:"Security audit: dangerous \u2014 update blocked",securityVerdict:d};if(d==="warning"||d==="caution"){if(!s)return{name:e,status:"skipped",reason:`Security audit: ${d} \u2014 use --yes to override`,securityVerdict:d};N(`updater: security audit ${d} for ${e} \u2014 proceeding (--yes)`)}}catch(k){return N(`updater: security audit failed for ${e}: ${k.message}`),{name:e,status:"failed",reason:`Security audit failed \u2014 skipping update: ${k.message}`}}let f=i?.loadConfigFn??q,p=i?.resolveProviderPathFn??oe,g=(await f()).providers.find(k=>k.name===t.provider),m=g?g.global:`~/.${t.provider}/skills`,y=p(m),b=ui(y,e),w=ui(o,".git");try{await ci(w,{recursive:!0,force:!0})}catch{}try{await Hy(b)}catch{let k=i?.writeLockEntryFn??ht;return await ru(o,b,{recursive:!0}),await k(e,{...t,commitHash:c,installedAt:new Date().toISOString()}),{name:e,status:"updated",oldCommit:de(t.commitHash),newCommit:de(c),securityVerdict:d}}let $=`${b}.bak-${Date.now()}`;try{await nu(b,$),await ru(o,b,{recursive:!0}),await ci($,{recursive:!0,force:!0})}catch(k){try{await ci(b,{recursive:!0,force:!0}),await nu($,b)}catch{}return{name:e,status:"failed",reason:`Atomic swap failed: ${k.message}`}}return await(i?.writeLockEntryFn??ht)(e,{...t,commitHash:c,installedAt:new Date().toISOString()}),{name:e,status:"updated",oldCommit:de(t.commitHash),newCommit:de(c),securityVerdict:d}}finally{try{await ci(o,{recursive:!0,force:!0})}catch{}}}async function lu(e,t,s){let i=s?.readLockFn??Le,n=s?.checkOutdatedFn??Mr,r=s?.updateSkillFn??Qy,o=await i(),a=await n({lock:o}),l=a.entries.filter(f=>f.status==="outdated"),c=[];if(e&&e.length>0){let f=new Set(e.map(p=>p.toLowerCase()));l=l.filter(p=>f.has(p.name.toLowerCase()));for(let p of e)l.find(h=>h.name.toLowerCase()===p.toLowerCase())||(a.entries.find(g=>g.name.toLowerCase()===p.toLowerCase())?N(`updater: skill "${p}" is already up to date`):(N(`updater: skill "${p}" not found in lock file`),c.push(p)))}if(l.length===0)return{results:[],updatedCount:0,skippedCount:0,failedCount:0,...c.length>0?{warnings:c}:{}};let d=[];for(let f of l){let p=o.skills[f.name];if(!p)continue;let h=await r(f.name,p,t);d.push(h)}return{results:d,updatedCount:d.filter(f=>f.status==="updated").length,skippedCount:d.filter(f=>f.status==="skipped").length,failedCount:d.filter(f=>f.status==="failed").length,...c.length>0?{warnings:c}:{}}}function de(e){return!e||e==="unknown"?"unknown":e.slice(0,7)}function cu(e,t){if(e.entries.length===0)return"No skills installed.";let s=f=>f,i=t?u.red:s,n=t?u.green:s,r=t?u.yellow:s,o=t?u.dim:s,a=`${"Skill".padEnd(22)}${"Installed".padEnd(14)}${"Latest".padEnd(14)}Source`,l="\u2500".repeat(60),c=[a,l];for(let f of e.entries){let p=f.name.padEnd(22),h=f.installedCommit.padEnd(14),g,m;switch(f.status){case"outdated":g=i(f.latestCommit.padEnd(14)),m=f.sourceType;break;case"up-to-date":g=n(f.latestCommit.padEnd(14)),m=o("(up to date)");break;case"untracked":g=r("untracked".padEnd(14)),m=r("untracked");break;case"error":g=o("error".padEnd(14)),m=o(f.error||"error");break}c.push(`${p}${h}${g}${m}`)}c.push("");let d=[];return e.outdatedCount>0&&d.push(i(`${e.outdatedCount} outdated`)),e.upToDateCount>0&&d.push(n(`${e.upToDateCount} up to date`)),e.untrackedCount>0&&d.push(r(`${e.untrackedCount} untracked`)),e.errorCount>0&&d.push(o(`${e.errorCount} error`)),c.push(d.join(", ")),c.join(`
|
|
201
|
+
`)}function uu(e){return JSON.stringify({skills:e.entries.map(t=>({name:t.name,installed:t.installedCommit,latest:t.latestCommit,source:t.sourceType,status:t.status,...t.error?{error:t.error}:{}})),summary:{outdated:e.outdatedCount,upToDate:e.upToDateCount,untracked:e.untrackedCount,errors:e.errorCount}},null,2)}function fu(e){return JSON.stringify({results:e.results.map(t=>({name:t.name,status:t.status,...t.reason?{reason:t.reason}:{},...t.oldCommit?{oldCommit:t.oldCommit}:{},...t.newCommit?{newCommit:t.newCommit}:{},...t.securityVerdict?{securityVerdict:t.securityVerdict}:{}})),summary:{updated:e.updatedCount,skipped:e.skippedCount,failed:e.failedCount}},null,2)}import{execFile as ub}from"child_process";import{promisify as fb}from"util";import{access as du,readFile as mu,readdir as db,writeFile as pb,rm as mb,stat as hu}from"fs/promises";import{join as Dr}from"path";import{homedir as hb}from"os";import{constants as pu}from"fs";import{access as Xy,realpath as Zy,stat as eb}from"fs/promises";import{constants as tb}from"fs";import{delimiter as sb,resolve as ib,sep as nb}from"path";var rb="asm";function ob(e){if(!e)return[];let t=new Set,s=[];for(let i of e.split(sb)){let n=i.trim();if(!n)continue;let r=n.endsWith(nb)?n.slice(0,-1):n;t.has(r)||(t.add(r),s.push(r))}return s}async function ab(e){try{if(!(await eb(e)).isFile())return!1}catch{return!1}try{return await Xy(e,tb.X_OK),!0}catch{return!1}}async function lb(e){try{return await Zy(e)}catch{return e}}async function cb(e=process.env.PATH){let t=new Set,s=[];for(let i of ob(e)){let n=ib(i,rb);if(!await ab(n))continue;let r=await lb(n);t.has(r)||(t.add(r),s.push({path:n,realPath:r}))}return s}async function fi(e=process.env.PATH){let t=await cb(e);if(t.length===0)return{resolved:null,shadowed:[]};let[s,...i]=t;return{resolved:s,shadowed:i}}var ct=fb(ub);async function gb(e){let t=e?.execFn??ct;try{let{stdout:s}=await t("git",["--version"],{timeout:5e3});return{name:"Git available",status:"pass",message:s.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 yb(e){let t=e?.execFn??ct;try{let{stdout:s}=await t("git",["--version"],{timeout:5e3}),i=s.match(/(\d+)\.(\d+)/);if(!i)return{name:"Git version",status:"warn",message:"Could not parse git version",fix:"Upgrade git: https://git-scm.com/downloads"};let n=parseInt(i[1],10),r=parseInt(i[2],10);return n>2||n===2&&r>=20?{name:"Git version",status:"pass",message:`${n}.${r} (>= 2.20)`}:{name:"Git version",status:"fail",message:`${n}.${r} (requires >= 2.20)`,fix:"Upgrade git: https://git-scm.com/downloads"}}catch{return{name:"Git version",status:"pass",message:"Skipped \u2014 git not available"}}}async function bb(e){let t=e?.execFn??ct;try{let{stdout:s}=await t("gh",["--version"],{timeout:5e3}),i=s.trim().split(`
|
|
202
|
+
`)[0],n=i.match(/(\d+\.\d+\.\d+)/);return{name:"GitHub CLI available",status:"pass",message:n?n[1]:i}}catch{return{name:"GitHub CLI available",status:"fail",message:"gh not found",fix:"Install GitHub CLI: https://cli.github.com"}}}async function wb(e){let t=e?.execFn??ct;try{let{stdout:s}=await t("gh",["auth","status"],{timeout:1e4}),i=s.match(/Logged in to .+ account (\S+)/);return{name:"GitHub CLI authenticated",status:"pass",message:i?i[1]:"authenticated"}}catch(s){let n=(s?.stderr??"").match(/Logged in to .+ account (\S+)/);return n?{name:"GitHub CLI authenticated",status:"pass",message:n[1]}:{name:"GitHub CLI authenticated",status:"fail",message:"Not authenticated",fix:"Run: gh auth login"}}}async function vb(e){let t=e?.execFn??ct;try{let{stdout:s}=await t("node",["--version"],{timeout:5e3}),i=s.trim().replace(/^v/,"");return parseInt(i.split(".")[0],10)>=18?{name:"Node.js version",status:"pass",message:i}:{name:"Node.js version",status:"fail",message:`${i} (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 kb(e){try{let t=Dr(e,".asm-doctor-write-test");return await pb(t,"test","utf-8"),await mb(t),{writable:!0,exists:!0}}catch{}try{return await du(e,pu.W_OK),{writable:!0,exists:!0}}catch{}try{return await du(e,pu.F_OK),{writable:!1,exists:!0}}catch{return{writable:!0,exists:!1}}}async function Sb(e){let t=e.providers.filter(r=>r.enabled),s=0,i=0;for(let r of t){let o=oe(r.global);i++,(await kb(o)).writable&&s++}if(s===i)return{name:"Agent directories writable",status:"pass",message:`${s}/${i} providers`};let n=i-s;return{name:"Agent directories writable",status:"warn",message:`${s}/${i} providers (${n} not writable)`,fix:"Fix permissions on agent skill directories"}}async function $b(){let e=pt();try{let t=await mu(e,"utf-8"),s=JSON.parse(t),i=[];return s.version===void 0&&i.push("version"),Array.isArray(s.providers)||i.push("providers"),i.length>0?{name:"Config file valid",status:"fail",message:`Missing required fields: ${i.join(", ")}`,fix:"Run: asm init"}:{name:"Config file valid",status:"pass",message:"OK"}}catch(t){return t?.code==="ENOENT"?{name:"Config file valid",status:"pass",message:"No config file (using defaults)"}:{name:"Config file valid",status:"fail",message:"Corrupted or unreadable config",fix:"Run: asm init, or delete corrupted config"}}}async function xb(){let e=Qr();try{let t=await mu(e,"utf-8"),s=JSON.parse(t);if(s.version!==1||typeof s.skills!="object")return{name:"Lock file integrity",status:"fail",message:"Invalid lock file schema",fix:"Run: asm install to regenerate"};let i=s.skills,n=Object.entries(i),r=["source","installedAt","provider"],o=[];for(let[a,l]of n){if(typeof l!="object"||l===null){o.push(a);continue}let c=l;for(let d of r)if(!c[d]){o.push(a);break}}return o.length>0?{name:"Lock file integrity",status:"warn",message:`${n.length} skills tracked, ${o.length} with missing fields`,fix:"Run: asm install to regenerate"}:{name:"Lock file integrity",status:"pass",message:`${n.length} skills tracked`}}catch(t){return t?.code==="ENOENT"?{name:"Lock file integrity",status:"pass",message:"No lock file (first-time user)"}:{name:"Lock file integrity",status:"fail",message:"Corrupted lock file",fix:"Run: asm install to regenerate"}}}async function Cb(){try{let e=await fetch(vr,{method:"HEAD",signal:AbortSignal.timeout(5e3)});return e.ok?{name:"Registry reachable",status:"pass",message:"OK"}:{name:"Registry reachable",status:"fail",message:`HTTP ${e.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 Eb(e,t){let s=Object.entries(t.skills);if(s.length===0)return{name:"Installed skills intact",status:"pass",message:"No skills in lock file"};let i=[];for(let[o,a]of s){let l=e.providers.find(f=>f.name===a.provider);if(!l){i.push(o);continue}let c=oe(l.global),d=Dr(c,o);try{(await hu(d)).isDirectory()||i.push(o)}catch{i.push(o)}}if(i.length===0)return{name:"Installed skills intact",status:"pass",message:`${s.length} skills verified`};let n=i[0],r=i.length>1?` (+${i.length-1} more)`:"";return{name:"Installed skills intact",status:"fail",message:`Missing: ${n}${r}`,fix:`Run: asm update ${n}`}}async function Ab(e,t){let s=new Set(Object.keys(t.skills)),i=[];for(let n of e.providers.filter(r=>r.enabled)){let r=oe(n.global);try{let o=await db(r);for(let a of o)try{(await hu(Dr(r,a))).isDirectory()&&!s.has(a)&&i.push(a)}catch{}}catch{}}return i.length===0?{name:"No orphaned skills",status:"pass",message:"OK"}:{name:"No orphaned skills",status:"warn",message:`${i.length} skill(s) without lock entries`,fix:"Run: asm list to review"}}async function Pb(e){let t=e?.execFn??ct;try{let{stdout:s}=await t("df",["-Pk",hb()],{timeout:5e3}),i=s.trim().split(`
|
|
203
|
+
`);if(i.length<2)return{name:"Disk space",status:"warn",message:"Could not parse df output"};let n=i[1].split(/\s+/),r=parseInt(n[3],10);if(isNaN(r))return{name:"Disk space",status:"warn",message:"Could not parse available space"};let o=r/1024,a=o/1024;return o>100?{name:"Disk space",status:"pass",message:`OK (${a>=1?`${a.toFixed(1)} GB free`:`${Math.round(o)} MB free`})`}:{name:"Disk space",status:"fail",message:`${Math.round(o)} 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 Nb(){try{let e=await fi();if(e.shadowed.length===0)return e.resolved?{name:"No PATH shadowing",status:"pass",message:`single install at ${e.resolved.path}`}:{name:"No PATH shadowing",status:"pass",message:"asm not yet on PATH"};let t=e.resolved,s=e.shadowed[0].path,i=e.shadowed.length>1?` (+${e.shadowed.length-1} more)`:"";return{name:"No PATH shadowing",status:"warn",message:`resolved ${t.path}, shadowed ${s}${i}`,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(e){return{name:"No PATH shadowing",status:"warn",message:`Could not scan PATH: ${e?.message??e}`}}}async function gu(){let e=await q(),t=await Le(),i=(await Promise.allSettled([gb(),yb(),bb(),wb(),vb(),Sb(e),$b(),xb(),Cb(),Eb(e,t),Ab(e,t),Pb(),Nb()])).map((a,l)=>a.status==="fulfilled"?a.value:{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"][l],status:"fail",message:`Check threw: ${a.reason}`}),n=i.filter(a=>a.status==="pass").length,r=i.filter(a=>a.status==="warn").length,o=i.filter(a=>a.status==="fail").length;return{checks:i,passed:n,warnings:r,failures:o}}var Ib={pass:"\u2705",warn:"\u26A0\uFE0F ",fail:"\u274C"};function yu(e){let t=["Checking your environment...",""];for(let s of e.checks){let n=` ${Ib[s.status]} ${s.name}${s.message?` (${s.message})`:""}`;if(t.push(n),s.fix&&s.status!=="pass"){let r;s.fix.startsWith("Run: ")?r=s.fix:/^[a-z/~]/.test(s.fix)?r=`Run: ${s.fix}`:r=`Fix: ${s.fix}`,t.push(` \u2192 ${r}`)}}return t.push(""),t.push(`${e.passed} passed, ${e.warnings} warning${e.warnings!==1?"s":""}, ${e.failures} error${e.failures!==1?"s":""}`),t.join(`
|
|
204
|
+
`)}function bu(e){return JSON.stringify({checks:e.checks.map(t=>({name:t.name,status:t.status,message:t.message,...t.fix?{fix:t.fix}:{}})),summary:{passed:e.passed,warnings:e.warnings,failures:e.failures}},null,2)}import{readFile as qr,writeFile as Lb,stat as ut,copyFile as Rb,readdir as Ob}from"fs/promises";import{join as ft,resolve as Fr,basename as ge,isAbsolute as jr}from"path";var wu=["name","description","version","license","creator","compatibility","allowed-tools","effort","tags","metadata"],vu=["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"],Tb=["confirm","confirmation","error","errors","fail","failure","caution","warning","prerequisite","prerequisites","requires","requirements","rollback","dry-run","dry run","safety","validate","validation","check","backup"],Mb=["acceptance criteria","expected output","expected result","edge case","edge cases","test","tests","testing","verify","verification","assert","example input","example output","given","then"],Db=["reference","references","see","template","templates","script","scripts","helper","helpers","link"],_b=["when to use","quick start","overview","instructions","steps","workflow","phases","progressive"];function $u(e){let t=e.split(`
|
|
205
|
+
`);if(t.length===0||t[0].trim()!=="---")return{rawFrontmatter:null,body:e};for(let s=1;s<t.length;s++)if(t[s].trim()==="---"){let i=t.slice(1,s).join(`
|
|
206
|
+
`),n=t.slice(s+1).join(`
|
|
207
|
+
`);return{rawFrontmatter:i,body:n}}return{rawFrontmatter:t.slice(1).join(`
|
|
208
|
+
`),body:""}}function xu(e){return e?e.split(`
|
|
209
|
+
`).length:0}function Br(e){return e?e.split(/\s+/).map(t=>t.trim()).filter(Boolean).length:0}function qb(e,t=1){return(e.match(/^#{1,6}\s+\S/gm)||[]).length>=t}function di(e,t){let s=e.toLowerCase();return t.filter(i=>s.includes(i))}function Fb(e){return/```[\s\S]+?```/m.test(e)}function jb(e){return/^\s*[-*]\s+\S/m.test(e)||/^\s*\d+\.\s+\S/m.test(e)}function Bb(e,t,s){let i=[],n=[],r=0;s!==null?(r+=2,i.push("Has YAML frontmatter block.")):(i.push("SKILL.md has no YAML frontmatter."),n.push("Add a YAML frontmatter block delimited by `---` with at least `name` and `description` fields."));let o=!!(e.name&&e.name.trim()),a=!!(e.description&&e.description.trim());o?r+=1.5:(i.push("Missing required field: name."),n.push("Add `name:` to frontmatter (use the skill directory name).")),a?r+=1.5:(i.push("Missing required field: description."),n.push("Add a one-line `description:` to frontmatter."));let l=ae(e);l&&l!=="0.0.0"?r+=1:(i.push("Missing or default version."),n.push("Set `metadata.version` (or top-level `version`) using semver (e.g. 0.1.0).")),!!(e.creator||e["metadata.creator"])?r+=1:(i.push("Missing `creator`."),n.push("Add a `creator` field so users know who authored and maintains the skill.")),!!e.license?r+=1:(i.push("Missing `license`."),n.push("Add a `license` field (e.g. `license: MIT`)."));let p=t.trim().length>=20,h=qb(t,1);return p?(r+=1,i.push("Body has meaningful content.")):(i.push("Body content is too short (<20 chars of instructions)."),n.push("Flesh out the markdown body with at least one paragraph of instructions for the agent.")),h?(r+=1,i.push("Body uses markdown headings.")):(i.push("Body has no markdown headings."),n.push("Add section headings (e.g. `## When to Use`, `## Instructions`) so the agent can navigate the skill quickly.")),{id:"structure",name:"Structure & completeness",score:Math.round(r),max:10,findings:i,suggestions:n}}function Ub(e,t){let s=[],i=[],n=0,r=(e.description||"").trim();if(!r)return s.push("No description."),i.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:s,suggestions:i};let o=Br(r);s.push(`Description is ${o} words.`),o>=8&&o<=40?n+=4:o>=5&&o<8?(n+=2,i.push("Lengthen the description slightly so it names both the action and the trigger (aim for 8\u201320 words).")):o>=41&&o<=60?(n+=2,i.push("Trim the description \u2014 aim for under 40 words. Move the long version to the markdown body.")):o>60?(n+=0,i.push("Description is too long. Keep it under 40 words; put detail in the body.")):(n+=0,i.push("Description is too short. Aim for 8\u201320 words."));let a=r.split(/\s+/)[0]?.toLowerCase().replace(/[^\w-]/g,"");return!!(a&&(vu.includes(a)||vu.includes(a.replace(/s$/,""))))?(n+=3,s.push("Starts with an action verb.")):(s.push(`Does not start with a recognized action verb (got "${a??""}").`),i.push('Start the description with an imperative action verb (e.g. "Generate...", "Analyze...", "Review...").')),/\buse when\b|\btrigger\b|\bwhen\b|\bfor\b/i.test(r)||/\b(before|after|during)\b/i.test(r)?(n+=3,s.push("Mentions a trigger or use-case signal.")):(s.push("No explicit trigger / use-case phrase."),i.push('Name the trigger in the description \u2014 e.g. "Use when...", "for reviewing...", "before publishing...".')),{id:"description",name:"Description quality",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Vb(e,t){let s=[],i=[],n=0,r=di(t,_b);r.length>=2?(n+=3,s.push(`Progressive disclosure cues present: ${r.slice(0,3).join(", ")}.`)):r.length===1?(n+=1,i.push('Add clearer section labels \u2014 e.g. "## When to Use" and "## Instructions" \u2014 to support progressive disclosure.')):i.push('Structure the body with "## When to Use" and "## Instructions" sections so the agent reads only what it needs.'),jb(t)?(n+=2,s.push("Uses lists or numbered steps.")):(s.push("No lists or steps detected."),i.push("Use bulleted or numbered steps to narrow the agent's degrees of freedom."));let o=Fb(t),a=/\bexample\b/i.test(t);o&&a?(n+=2,s.push("Includes example code block.")):o||a?(n+=1,i.push('Back up examples with fenced code blocks labelled under "## Example" so the agent sees concrete input/output.')):i.push('Add an "## Example" section with a fenced code block showing the desired output.');let l=(t.match(/^\s*[-*0-9.]*\s*(Do|Use|Run|Call|Check|Validate|Return|Emit|Write|Read|Ask|Confirm|Avoid|Never|Always)\b/gim)||[]).length;l>=3?(n+=2,s.push(`Uses imperative voice (${l} cues).`)):l>=1?(n+=1,i.push("Favor imperative voice (Do / Use / Avoid / Never) to narrow the agent's choices.")):i.push('Rewrite instructions in the imperative mood \u2014 e.g. "Run `git status` first" instead of "you might want to run".');let c=Br(t);return c>=80&&c<=3e3?(n+=1,s.push(`Body length within healthy range (${c} words).`)):c<80?(s.push(`Body is very short (${c} words).`),i.push("Expand the instructions; an underspecified skill gives the agent too much freedom.")):(s.push(`Body is very long (${c} words).`),i.push("Split large content into referenced files; keep SKILL.md focused under ~3000 words.")),{id:"prompt-engineering",name:"Prompt engineering",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Kb(e,t){let s=[],i=[],n=0,r=Br(t);s.push(`Body is ${r} words.`),r>=120&&r<=1500?n+=4:r>=60&&r<120?(n+=2,i.push("Expand instructions slightly \u2014 too little context can push the agent to improvise.")):r>1500&&r<=3e3?(n+=2,i.push("Consider moving large sections into referenced files (e.g. `references/*.md`) and linking them instead of inlining.")):r>3e3&&(n+=0,i.push("Body is over 3000 words \u2014 split long content into referenced files or templates."));let o=di(t,Db);o.length>=2?(n+=3,s.push(`References external files or links (${o.slice(0,3).join(", ")}).`)):o.length===1?(n+=1,i.push('Link out to supporting files (e.g. "see `references/examples.md`") instead of inlining them.')):i.push('Offload verbose content to referenced files and link to them ("see `./templates/x.md`").');let l=(t.match(/```[\s\S]+?```/g)||[]).filter(c=>xu(c)>60);return l.length===0?(n+=2,s.push("No oversized code blocks.")):(s.push(`${l.length} code block(s) longer than 60 lines.`),i.push("Move large code blocks into referenced template files; link to them from SKILL.md.")),/\btoken\b|\bbudget\b|\bcontext window\b/i.test(t)&&(n+=1,s.push("Mentions tokens/budget/context window.")),{id:"context-efficiency",name:"Context efficiency",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Jb(e,t){let s=[],i=[],n=0,r=di(t,Tb);r.length>=4?(n+=4,s.push(`Covers multiple safety cues (${r.slice(0,4).join(", ")}).`)):r.length>=2?(n+=2,s.push(`Mentions a few safety cues: ${r.join(", ")}.`),i.push("Add explicit error-handling and confirmation steps so the agent knows how to recover from failures.")):r.length===1?(n+=1,i.push('Expand the safety section \u2014 include prerequisites, validation steps, and what to do "on error".')):i.push("Describe prerequisites, confirmation prompts, and error-handling steps to reduce blast radius.");let o=/\b(rm\s|delete|remove|drop|force|overwrite|destructive)\b/i.test(t),a=/\bconfirm\b|\bdry-?run\b|\bare you sure\b|\bbackup\b/i.test(t);return o&&a?(n+=3,s.push("Destructive actions paired with confirmation/dry-run.")):o?(s.push("References destructive actions without explicit confirmation/dry-run."),i.push("Pair any destructive command with an explicit confirmation prompt, dry-run flag, or backup step.")):n+=1.5,/\bprerequisit/i.test(t)||/\brequire/i.test(t)||/\bdepend/i.test(t)?(n+=3,s.push("Declares prerequisites or requirements.")):(s.push("No prerequisites / requirements section."),i.push('Add a "## Prerequisites" block listing required tools, credentials, and environment state.')),{id:"safety",name:"Safety & guardrails",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Hb(e,t){let s=[],i=[],n=0,r=di(t,Mb);return r.length>=4?(n+=5,s.push(`Many testability cues present (${r.slice(0,4).join(", ")}).`)):r.length>=2?(n+=3,s.push(`Some testability cues: ${r.join(", ")}.`),i.push('Add an "## Acceptance Criteria" block listing verifiable outputs or checklist items.')):r.length===1?(n+=1,i.push('Add concrete "expected output" examples so the agent can self-check.')):i.push('Add a "## Acceptance Criteria" section with testable statements (e.g. "produces a JSON report with overall_score").'),/expected\s+(output|result|response)/i.test(t)?(n+=3,s.push("Describes expected output/result.")):i.push('Include an "Expected output" example so reviewers and the agent can verify correctness.'),/\bedge case|gotcha|pitfall|limitation/i.test(t)?(n+=2,s.push("Mentions edge cases or limitations.")):i.push('Add a short "Edge cases" list to describe inputs the skill should reject or handle carefully.'),{id:"testability",name:"Testability",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Yb(e,t){let s=[],i=[],n=0,r=(e.name||"").trim();if(r){let l=/^[a-z][a-z0-9-]*$/.test(r),c=r.length<=40;l&&c?(n+=4,s.push(`name "${r}" follows kebab-case convention.`)):(l||(s.push(`name "${r}" is not lowercase kebab-case.`),i.push(`Rename to lowercase kebab-case (e.g. "${r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}").`)),c||s.push(`name is ${r.length} chars; keep it <= 40.`))}else i.push("Add a kebab-case `name` (e.g. `my-skill`).");let o=t.match(/^#{1,6}\s+(.+)$/gm)||[];return o.length>0&&(o.filter(d=>/^#{1,6}\s+([A-Z][a-z]+|Use|How|When|Workflow|Instructions|Examples|Steps|Acceptance)/.test(d)).length/o.length>=.5?(n+=3,s.push("Most headings use action/imperative labels.")):(n+=1,i.push("Rename body headings to action-oriented labels (e.g. `## Instructions`, `## When to Use`)."))),/(?:\s\s|\bTODO\b|\bFIXME\b|\?{2,})/.test(e.description||"")?i.push("Clean up description \u2014 remove TODOs, FIXMEs, double spaces, or trailing punctuation."):(n+=2,s.push("Description looks clean (no TODO/FIXME/stray noise).")),{id:"naming",name:"Naming & conventions",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Wt(e){let{content:t,skillPath:s,skillMdPath:i}=e,n=ie(t),{rawFrontmatter:r,body:o}=$u(t),a=[Bb(n,o,r),Ub(n,o),Vb(n,o),Kb(n,o),Jb(n,o),Hb(n,o),Yb(n,o)];if(n.name&&ge(s)===n.name){let g=a.find(m=>m.id==="naming");g.score<g.max&&(g.score=Math.min(g.max,g.score+1),g.findings.push("Directory name matches frontmatter `name`."))}let l=a.reduce((g,m)=>g+m.score,0),c=a.reduce((g,m)=>g+m.max,0),d=Math.round(l/c*100),f="F";d>=90?f="A":d>=80?f="B":d>=65?f="C":d>=50&&(f="D");let p=[],h=[...a].sort((g,m)=>g.score/g.max-m.score/m.max);for(let g of h){for(let m of g.suggestions){if(p.length>=3)break;p.includes(m)||p.push(m)}if(p.length>=3)break}return{skillPath:s,skillMdPath:i,evaluatedAt:new Date().toISOString(),categories:a,overallScore:d,grade:f,topSuggestions:p,frontmatter:n}}async function Cu(e){let t=jr(e)?e:Fr(e),s;try{s=await ut(t)}catch{throw new Error(`Skill path does not exist: ${t}`)}let i,n;if(s.isFile())return i=t,n=await qr(i,"utf-8"),Wt({content:n,skillPath:ge(t)==="SKILL.md"?ge(t):t,skillMdPath:i});if(!s.isDirectory())throw new Error(`Skill path is not a directory or file: ${t}`);i=ft(t,"SKILL.md");try{n=await qr(i,"utf-8")}catch{throw new Error(`SKILL.md not found in ${t}. Run "asm init" to create one.`)}return Wt({content:n,skillPath:t,skillMdPath:i})}function Gb(e){return e<=20?"low":e<=80?"medium":e<=250?"high":"max"}function Wb(e){let t=e.split(`
|
|
210
|
+
`),s=[],i=[],n=0;for(;n<t.length;){let c=t[n];if(!c.trim()){n++;continue}let f=c.match(/^([A-Za-z_][\w-]*):\s*(.*)$/);if(!f)return{newFrontmatter:e,changed:!1};let p=f[1],h=f[2];if(h===""||h===">"||h==="|"){let g=[c];for(n++;n<t.length;){let m=t[n];if(m.trim()===""){g.push(m),n++;continue}if(/^\s+/.test(m))g.push(m),n++;else break}i.push({key:p,text:g.join(`
|
|
211
|
+
`)})}else s.push({key:p,text:c}),n++}let r=c=>{let d=wu.indexOf(c);return d===-1?wu.length+1:d},o=[...s].sort((c,d)=>{let f=r(c.key),p=r(d.key);return f!==p?f-p:s.indexOf(c)-s.indexOf(d)}),a=o.some((c,d)=>c!==s[d]);return{newFrontmatter:[...o.map(c=>c.text),...i.map(c=>c.text)].join(`
|
|
212
|
+
`),changed:a}}function zb(e,t={}){let s=[],i=[],n=e.replace(/\r\n/g,`
|
|
213
|
+
`);n!==e&&s.push({id:"normalise-line-endings",description:"Convert CRLF line endings to LF."});let r=n.split(`
|
|
214
|
+
`),o=r.map(y=>y.replace(/[ \t]+$/g,""));o.some((y,b)=>y!==r[b])&&s.push({id:"strip-trailing-whitespace",description:"Strip trailing whitespace from lines."}),n=o.join(`
|
|
215
|
+
`);let{rawFrontmatter:a,body:l}=$u(n),c=ie(n);if(a===null)return i.push({id:"missing-frontmatter",description:"SKILL.md has no frontmatter \u2014 not auto-fixable (requires author decisions)."}),{newContent:n,applied:s,skipped:i};let d=a;if(!!(c.version||c["metadata.version"])||(d=_r(d,"version","0.1.0"),s.push({id:"add-missing-version",description:"Add `version: 0.1.0`."})),!!!(c.creator||c["metadata.creator"])){let y=t.gitAuthor?.trim();y?(d=_r(d,"creator",y),s.push({id:"add-missing-creator",description:`Add \`creator: ${y}\` from git config.`})):i.push({id:"add-missing-creator",description:"Missing `creator` \u2014 no git user.name found to fill in safely."})}if(!c.effort){let y=Gb(xu(l));d=_r(d,"effort",y),s.push({id:"infer-missing-effort",description:`Infer \`effort: ${y}\` from body size.`})}c.description||i.push({id:"missing-description",description:"Missing `description` \u2014 content-level fix, left to the author."});let h=Wb(d);h.changed&&(s.push({id:"reorder-frontmatter",description:"Reorder frontmatter fields to canonical order."}),d=h.newFrontmatter);let g=l.replace(/^\n+/,""),m=`---
|
|
216
|
+
${d.replace(/^\n+|\n+$/g,"")}
|
|
216
217
|
---
|
|
217
218
|
|
|
218
|
-
${
|
|
219
|
-
`)
|
|
220
|
-
|
|
221
|
-
`)
|
|
219
|
+
${g}`;return m.endsWith(`
|
|
220
|
+
`)||(m+=`
|
|
221
|
+
`),e.replace(/\r\n/g,`
|
|
222
|
+
`),{newContent:m,applied:s,skipped:i}}function _r(e,t,s){if(new RegExp(`^${t}:\\s*`,"m").test(e))return e;let n=/[:#{}\[\],&*?|<>=!%@`"']/.test(s)?JSON.stringify(s):s,r=e.length===0||e.endsWith(`
|
|
222
223
|
`)?"":`
|
|
223
|
-
`;return`${
|
|
224
|
-
`}function
|
|
225
|
-
`),
|
|
226
|
-
`),
|
|
227
|
-
`)}async function
|
|
228
|
-
`)}function
|
|
229
|
-
`);if(
|
|
230
|
-
`)}
|
|
231
|
-
`)
|
|
232
|
-
|
|
233
|
-
|
|
224
|
+
`;return`${e}${r}${t}: ${n}
|
|
225
|
+
`}function Qb(e,t,s="SKILL.md"){if(e===t)return"";let i=e.split(`
|
|
226
|
+
`),n=t.split(`
|
|
227
|
+
`),r=[`--- a/${s}`,`+++ b/${s}`],o=0;for(;o<i.length&&o<n.length&&i[o]===n[o];)o++;let a=0;for(;a<i.length-o&&a<n.length-o&&i[i.length-1-a]===n[n.length-1-a];)a++;let l=i.slice(o,i.length-a),c=n.slice(o,n.length-a),d=o+1,f=o+1;r.push(`@@ -${d},${l.length} +${f},${c.length} @@`);let p=i.slice(Math.max(0,o-3),o).map(g=>` ${g}`),h=i.slice(i.length-a,Math.min(i.length,i.length-a+3)).map(g=>` ${g}`);r.push(...p);for(let g of l)r.push(`-${g}`);for(let g of c)r.push(`+${g}`);return r.push(...h),r.join(`
|
|
228
|
+
`)}async function Eu(e,t){let s=jr(e)?e:Fr(e),i,n=await ut(s).catch(()=>null);if(!n)throw new Error(`Skill path does not exist: ${s}`);if(n.isFile())i=s;else if(n.isDirectory())i=ft(s,"SKILL.md");else throw new Error(`Skill path is not a directory or file: ${s}`);let r;try{r=await qr(i,"utf-8")}catch{throw new Error(`SKILL.md not found at ${i}.`)}let o=zb(r,{gitAuthor:t.gitAuthor}),a=Qb(r,o.newContent),l=null;return!t.dryRun&&o.newContent!==r&&(l=`${i}.bak`,await Rb(i,l),await Lb(i,o.newContent,"utf-8")),{report:Wt({content:t.dryRun?r:o.newContent,skillPath:s,skillMdPath:i}),applied:o.applied,skipped:o.skipped,diff:a,dryRun:t.dryRun,backupPath:l,skillMdPath:i}}async function Au(){try{let{stdout:e,exitCode:t}=await V(["git","config","--global","--get","user.name"]);if(t!==0)return null;let s=e.trim();return s||null}catch{return null}}function Xb(e,t,s=20){let i=Math.round(e/t*s);return"\u2588".repeat(i)+"\u2591".repeat(Math.max(0,s-i))}function pi(e){let t=[];t.push(`Skill evaluation: ${e.skillPath}`),t.push(`SKILL.md: ${e.skillMdPath}`),t.push(""),t.push(`Overall score: ${e.overallScore}/100 (${e.grade})`);let s=(e.providers??[]).filter(i=>i.id!=="quality");for(let i of s){let n=i.passed?"pass":"fail",r=`${i.id}@${i.version}`;t.push(` ${r}: ${i.score}/100 ${n}`)}t.push(""),t.push("Categories:");for(let i of e.categories)t.push(` ${i.name.padEnd(28)} ${String(i.score).padStart(2)}/${i.max} ${Xb(i.score,i.max)}`);if(t.push(""),e.topSuggestions.length>0){t.push("Top suggestions:");for(let i of e.topSuggestions)t.push(` \u2022 ${i}`)}else t.push("No suggestions \u2014 skill looks great.");for(let i of s){let n=Zb(i.raw);if(n&&n.length>0){t.push(""),t.push(`${i.id}@${i.version} breakdown:`);for(let r of n){let o=r.passed?"\u221A":r.severity==="warning"?"\u26A0":"\xD7";t.push(` ${o} ${r.label}`),r.passed||t.push(` [${r.severity}] ${r.message}`)}continue}if(i.findings.length!==0){t.push(""),t.push(`${i.id}@${i.version} findings:`);for(let r of i.findings)t.push(` [${r.severity}] ${r.message}`)}}return t.join(`
|
|
229
|
+
`)}function Zb(e){if(!e||typeof e!="object")return null;let t=e.checks;if(!Array.isArray(t))return null;let s=[];for(let i of t){if(!i||typeof i!="object")return null;let n=i;if(typeof n.id!="string"||typeof n.label!="string"||typeof n.passed!="boolean"||typeof n.message!="string"||n.severity!=="error"&&n.severity!=="warning")return null;s.push({id:n.id,label:n.label,passed:n.passed,severity:n.severity,message:n.message})}return s}function Pu(e){return JSON.stringify(e,null,2)}function Nu(e){let t=[];if(e.applied.length===0&&e.skipped.length===0)return t.push("No fixes needed \u2014 SKILL.md is already clean."),t.join(`
|
|
230
|
+
`);if(e.applied.length>0){t.push(`${e.dryRun?"Would apply":"Applied"} ${e.applied.length} fix(es):`);for(let s of e.applied)t.push(` \u2022 ${s.description}`)}if(e.skipped.length>0){t.push(""),t.push(`Skipped ${e.skipped.length} issue(s) (not auto-fixable):`);for(let s of e.skipped)t.push(` \u2022 ${s.description}`)}return e.diff&&(t.push(""),t.push("Diff:"),t.push(e.diff)),!e.dryRun&&e.backupPath&&(t.push(""),t.push(`Backup: ${e.backupPath}`)),t.join(`
|
|
231
|
+
`)}async function ew(e){let t;try{t=await Ob(e)}catch{return[]}let s=[];for(let i of t){if(i.startsWith(".")||i==="node_modules"||i==="dist"||i==="build")continue;let n=ft(e,i),r;try{r=await ut(n)}catch{continue}if(!r.isDirectory())continue;let o=ft(n,"SKILL.md");try{(await ut(o)).isFile()&&s.push(n)}catch{}}return s.sort((i,n)=>ge(i).localeCompare(ge(n))),s}async function ku(e){let t=ft(e,"SKILL.md");try{if((await ut(t)).isFile())return{kind:"single",skillDirs:[e]}}catch{}let s=await ew(e);return s.length>0?{kind:"collection",skillDirs:s}:{kind:"none",skillDirs:[]}}function Ur(e){return e?!!(e.startsWith("github:")||/^https?:\/\/github\.com\//i.test(e)):!1}function Su(e){return{skillPath:e,skillMdPath:ft(e,"SKILL.md"),label:ge(e)}}async function Iu(e,t={}){if(!e)throw new Error("resolveEvalInput: input must be a non-empty string");if(Ur(e)){if(!t.fetchRemote)throw new Error(`Remote evaluation is not available in this context: "${e}"`);let r=await t.fetchRemote(e),o;try{o=await ku(r.rootDir)}catch(a){throw await r.cleanup().catch(()=>{}),a}if(o.kind==="none")throw await r.cleanup().catch(()=>{}),new Error(`No SKILL.md found at ${r.rootDir} (source: ${e}). The location is neither a single skill nor a skill collection.`);return{targets:o.skillDirs.map(Su),isCollection:o.kind==="collection",cleanup:r.cleanup,provenance:{input:e,remote:!0,sourceRef:r.sourceRef,commitSha:r.commitSha,tempPath:r.rootDir}}}let s=jr(e)?e:Fr(e),i;try{i=await ut(s)}catch{throw new Error(`Skill path does not exist: ${s}`)}if(i.isFile())return{targets:[{skillPath:ge(s)==="SKILL.md"?ge(s):s,skillMdPath:s,label:ge(s)}],isCollection:!1,cleanup:async()=>{},provenance:{input:e,remote:!1,sourceRef:null}};if(!i.isDirectory())throw new Error(`Skill path is not a directory or file: ${s}`);let n=await ku(s);if(n.kind==="none")throw new Error(`No SKILL.md found in ${s}. Pass a skill directory, a SKILL.md file, or a collection root with SKILL.md in its children.`);return{targets:n.skillDirs.map(Su),isCollection:n.kind==="collection",cleanup:async()=>{},provenance:{input:e,remote:!1,sourceRef:null}}}function Lu(e){let t=e.filter(d=>d.report!==null),s=e.length,i=s-t.length;if(t.length===0)return{total:s,succeeded:0,failed:i,meanScore:null,top:null,bottom:null};let n=t.map(d=>d.report.overallScore),r=n.reduce((d,f)=>d+f,0)/n.length,o=Math.round(r),a=[...t].sort((d,f)=>f.report.overallScore-d.report.overallScore),l=a[0],c=a[a.length-1];return{total:s,succeeded:t.length,failed:i,meanScore:o,top:{label:l.label,score:l.report.overallScore},bottom:{label:c.label,score:c.report.overallScore}}}async function Ru(e,t,s){let i=new Array(e.length),n=0,r=Math.max(1,Math.floor(t)),o=[],a=Math.min(r,e.length);for(let l=0;l<a;l++)o.push((async()=>{for(;;){let c=n++;if(c>=e.length)break;i[c]=await s(e[c],c)}})());return await Promise.all(o),i}function Ou(e,t=28){let s=[];return s.push(""),s.push("Batch summary:"),s.push(` Skills evaluated: ${e.aggregate.succeeded}/${e.aggregate.total}`+(e.aggregate.failed>0?` (${e.aggregate.failed} failed)`:"")),e.aggregate.meanScore!==null&&s.push(` Mean score: ${e.aggregate.meanScore}/100`),e.aggregate.top&&s.push(` Top: ${e.aggregate.top.label} (${e.aggregate.top.score}/100)`),e.aggregate.bottom&&e.aggregate.bottom.label!==e.aggregate.top?.label&&s.push(` Bottom: ${e.aggregate.bottom.label} (${e.aggregate.bottom.score}/100)`),e.provenance.remote&&(e.provenance.sourceRef&&s.push(` Source: ${e.provenance.sourceRef}`),e.provenance.commitSha&&s.push(` Commit: ${e.provenance.commitSha}`),e.provenance.tempPath&&s.push(` Fetched to: ${e.provenance.tempPath}`)),s.join(`
|
|
232
|
+
`)}function Tu(e){return{provenance:{input:e.provenance.input,remote:e.provenance.remote,source_ref:e.provenance.sourceRef??null,commit_sha:e.provenance.commitSha??null,temp_path:e.provenance.tempPath??null},aggregate:{total:e.aggregate.total,succeeded:e.aggregate.succeeded,failed:e.aggregate.failed,mean_score:e.aggregate.meanScore,top:e.aggregate.top,bottom:e.aggregate.bottom},results:e.results.map(t=>({label:t.label,skill_path:t.skillPath,error:t.error,report:t.report?mi(t.report,null):null}))}}function mi(e,t=null){return{skill_path:e.skillPath,skill_md_path:e.skillMdPath,overall_score:e.overallScore,grade:e.grade,categories:e.categories.map(s=>({id:s.id,name:s.name,score:s.score,max:s.max,findings:s.findings,suggestions:s.suggestions})),top_suggestions:e.topSuggestions,providers:e.providers?.map(s=>({id:s.id,version:s.version,schemaVersion:s.schemaVersion,score:s.score,passed:s.passed,categories:s.categories.map(i=>({id:i.id,name:i.name,score:i.score,max:i.max,findings:i.findings??[]})),findings:s.findings}))??[],fix:t?{dry_run:t.dryRun,applied:t.applied,skipped:t.skipped,backup_path:t.backupPath,diff:t.diff}:null}}var tw=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function sw(e){if(typeof e!="string")return null;let t=tw.exec(e.trim());if(!t)return null;let[,s,i,n,r]=t;return{major:Number(s),minor:Number(i),patch:Number(n),prerelease:r?r.split("."):[]}}function iw(e,t){let s=sw(e);if(!s)throw new Error(`invalid semver: ${t} "${e}"`);return s}var Vr=new Map;function Kr(e){if(!e||typeof e.id!="string"||e.id.length===0)throw new Error("register: provider.id is required");if(iw(e.version,`provider ${e.id} version`),typeof e.schemaVersion!="number"||!Number.isInteger(e.schemaVersion))throw new Error(`register: provider ${e.id} schemaVersion must be an integer`);let t=Vr.get(e.id)??[];if(t.some(s=>s.version===e.version))throw new Error(`register: provider ${e.id}@${e.version} already registered`);t.push(e),Vr.set(e.id,t)}function hi(){let e=[];for(let t of Vr.values())for(let s of t)e.push(s);return e}import{stat as nw}from"fs/promises";var Mu="quality",Du="1.0.0",_u=1;function rw(e){return e.topSuggestions.map(t=>({severity:"info",message:t}))}function ow(e){return e.categories.map(t=>({id:t.id,name:t.name,score:t.score,max:t.max}))}var qu={id:Mu,version:Du,schemaVersion:_u,description:"Static linter for SKILL.md structure, description, and safety.",async applicable(e){try{return(await nw(e.skillMdPath)).isFile()?{ok:!0}:{ok:!1,reason:`${e.skillMdPath} is not a file`}}catch{return{ok:!1,reason:`SKILL.md not found at ${e.skillMdPath}`}}},async run(e,t){let s=await Cu(e.skillPath);return{providerId:Mu,providerVersion:Du,schemaVersion:_u,score:s.overallScore,passed:s.grade!=="F",categories:ow(s),findings:rw(s),raw:s,startedAt:"",durationMs:0}}};var Vu=Gr(wr(),1);import{readFile as aw,stat as lw}from"fs/promises";var Fu="skill-best-practice",ju="1.0.0",Bu=1,cw=new Set(["name","description","license","allowed-tools","metadata","compatibility","effort"]),Uu=new Set(["low","medium","high","max"]);function uw(e){if(!e.startsWith("---"))return null;let t=e.split(`
|
|
233
|
+
`);if(t.length<3||t[0]?.trim()!=="---")return null;let s=t.findIndex((i,n)=>n>0&&i.trim()==="---");return s===-1?null:t.slice(1,s).join(`
|
|
234
|
+
`)}function gi(e){return{severity:e.severity,message:e.message,code:e.id,categoryId:"validation"}}function te(e,t,s,i,n,r){e.push({id:t,label:s,passed:i,severity:n,message:r})}function yi(e,t,s){return{skillPath:e.skillPath,skillMdPath:e.skillMdPath,validatedAt:new Date().toISOString(),checkCount:t.length,passedChecks:t.filter(i=>i.passed).length,checks:t,frontmatter:s}}async function fw(e){let t=await aw(e.skillMdPath,"utf-8"),s=[],i=uw(t);if(i===null){te(s,"missing-frontmatter","Frontmatter exists",!1,"error","SKILL.md must start with a YAML frontmatter block.");let b=yi(e,s,null);return{score:0,passed:!1,findings:s.map(gi),raw:b}}te(s,"frontmatter-present","Frontmatter exists",!0,"error","SKILL.md contains a YAML frontmatter block.");let n;try{n=(0,Vu.parse)(i)}catch(b){te(s,"invalid-yaml","Frontmatter parses as YAML",!1,"error",`Invalid YAML in frontmatter: ${b?.message??String(b)}`);let w=yi(e,s,null);return{score:0,passed:!1,findings:s.map(gi),raw:w}}if(!n||typeof n!="object"||Array.isArray(n)){te(s,"frontmatter-not-object","Frontmatter is a mapping",!1,"error","Frontmatter must parse to a YAML object.");let b=yi(e,s,null);return{score:0,passed:!1,findings:s.map(gi),raw:b}}let r=n;te(s,"frontmatter-object","Frontmatter is a mapping",!0,"error","Frontmatter parses to a YAML object.");let o=Object.keys(r).filter(b=>!cw.has(b));te(s,"allowed-keys","Allowed top-level keys only",o.length===0,"error",o.length===0?"Frontmatter uses only the allowed top-level keys.":`Unexpected frontmatter key(s): ${o.sort().join(", ")}.`);let a=r.name,l=typeof a=="string"?a.trim():"";if(te(s,"name-present","Name is present and non-empty",l.length>0,"error",l.length>0?"Frontmatter includes a non-empty `name`.":"Frontmatter must include a non-empty string `name`."),l.length>0){let b=/^[a-z0-9-]+$/.test(l)&&!l.startsWith("-")&&!l.endsWith("-")&&!l.includes("--")&&l.length<=64;te(s,"name-kebab-case","Name follows skill-best-practice naming rules",b,"error",b?"Name follows the skill-best-practice kebab-case naming rules.":"Name must be kebab-case, avoid consecutive/edge hyphens, and stay within 64 characters.")}let c=r.description,d=typeof c=="string"?c.trim():"";if(te(s,"description-present","Description is present and non-empty",d.length>0,"error",d.length>0?"Frontmatter includes a non-empty `description`.":"Frontmatter must include a non-empty string `description`."),d.length>0){let b=!d.includes(`
|
|
235
|
+
`)&&!d.includes("\r")&&!d.includes("<")&&!d.includes(">")&&d.length<=1024;te(s,"description-shape","Description follows skill-best-practice formatting rules",b,"error",b?"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 f=r.effort;te(s,"effort-enum","Effort uses the supported enum",f===void 0||typeof f=="string"&&Uu.has(f.trim()),"error",f===void 0||typeof f=="string"&&Uu.has(f.trim())?"Effort is omitted or uses a supported value.":"Effort must be one of: low, medium, high, max.");let p=r.compatibility;if(p!==void 0){let b=typeof p=="string"&&p.length<=500;te(s,"compatibility-shape","Compatibility is a short string",b,"error",b?"Compatibility is a valid short string.":"Compatibility must be a string no longer than 500 characters.")}let h=/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(d);te(s,"negative-trigger-clause","Description includes a negative-trigger clause",h,"warning",h?"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 g=yi(e,s,r),m=g.checkCount===0?100:Math.round(g.passedChecks/g.checkCount*100),y=s.filter(b=>!b.passed).map(gi);return{score:m,passed:y.every(b=>b.severity!=="error"),findings:y,raw:g}}var Ku={id:Fu,version:ju,schemaVersion:Bu,description:"Deterministic SKILL.md best-practice validation (rules ported from Anthropic's skill-creator skill).",async applicable(e){try{return(await lw(e.skillMdPath)).isFile()?{ok:!0}:{ok:!1,reason:`${e.skillMdPath} is not a file`}}catch{return{ok:!1,reason:`SKILL.md not found at ${e.skillMdPath}`}}},async run(e,t){let s=await fw(e);return{providerId:Fu,providerVersion:ju,schemaVersion:Bu,score:s.score,passed:s.passed,categories:[{id:"validation",name:"Deterministic validation",score:s.raw.passedChecks,max:s.raw.checkCount,findings:s.findings.length>0?s.findings:void 0}],findings:s.findings,raw:s.raw,startedAt:"",durationMs:0}}};function Ju(){Kr(qu),Kr(Ku)}var Hu=!1;function bi(){Hu||(Ju(),Hu=!0)}function wi(){return bi(),hi()}function Yu(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Gu(e,t,s,i,n){let r={severity:"error",message:i,code:n};return{providerId:e.id,providerVersion:e.version,schemaVersion:e.schemaVersion,score:0,passed:!1,categories:[],findings:[r],raw:void 0,startedAt:t,durationMs:s}}async function vi(e,t,s={}){let i=new Date().toISOString(),n=performance.now(),r={id:e.id,version:e.version,schemaVersion:e.schemaVersion},o=new AbortController;s.signal&&(s.signal.aborted?o.abort(s.signal.reason):s.signal.addEventListener("abort",()=>o.abort(s.signal?.reason)));let a=null;typeof s.timeoutMs=="number"&&s.timeoutMs>0&&(a=setTimeout(()=>o.abort(new Error("timeout")),s.timeoutMs));let l={...s,signal:o.signal};try{let c=await Promise.race([e.run(t,l).then(p=>({kind:"ok",value:p})),new Promise(p=>{if(o.signal.aborted){p({kind:"timeout"});return}o.signal.addEventListener("abort",()=>p({kind:"timeout"}))})]),d=Math.max(0,Math.round(performance.now()-n));if(c.kind==="timeout"){let p=o.signal.reason,h=p instanceof Error&&p.message==="timeout"?`provider timed out after ${s.timeoutMs}ms`:`provider aborted: ${Yu(p)}`;return Gu(r,i,d,h,p instanceof Error&&p.message==="timeout"?"timeout":"aborted")}let f=c.value;return{...f,providerId:r.id,providerVersion:r.version,schemaVersion:f.schemaVersion??r.schemaVersion,startedAt:i,durationMs:d}}catch(c){let d=Math.max(0,Math.round(performance.now()-n));return Gu(r,i,d,Yu(c),"provider-threw")}finally{a&&clearTimeout(a)}}function dw(e){return e>=90?"A":e>=80?"B":e>=65?"C":e>=50?"D":"F"}function Wu(e){return{id:e.providerId,version:e.providerVersion,schemaVersion:e.schemaVersion,score:e.score,passed:e.passed,categories:e.categories,findings:e.findings,raw:e.raw}}function zu(e,t){return{providerId:e.providerId,providerVersion:e.providerVersion,schemaVersion:e.schemaVersion,passed:e.passed,overallScore:e.score,grade:dw(e.score),categories:e.categories.map(s=>({id:s.id,name:s.name,score:s.score,max:s.max})),evaluatedAt:e.startedAt,evaluatedVersion:t}}function zt(e){return[...e].sort((t,s)=>t.id==="quality"&&s.id!=="quality"?-1:s.id==="quality"&&t.id!=="quality"?1:t.id.localeCompare(s.id))}var W={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 Ge(){let e=console.log,t=console.info,s=(...i)=>process.stderr.write(i.map(String).join(" ")+`
|
|
236
|
+
`);return console.log=s,console.info=s,()=>{console.log=e,console.info=t}}function Qu(e){return{timestamp:new Date().toISOString(),asm_version:ko,duration_ms:Math.round(performance.now()-e)}}function Y(e,t,s){let i={version:1,command:e,status:"ok",data:t,meta:Qu(s)},n=process.stdout.isTTY?2:0;return JSON.stringify(i,null,n)}function z(e,t,s,i,n){let r={version:1,command:e,status:"error",error:{code:t,message:s,...n!==void 0?{details:n}:{}},meta:Qu(i)},o=process.stdout.isTTY?2:0;return JSON.stringify(r,null,o)}import{writeFile as Cw,mkdir as Ew,unlink as Aw,readFile as Pw}from"fs/promises";import{join as $i}from"path";import{readdir as pw,readFile as mw}from"fs/promises";import{join as hw}from"path";function Jr(e){let t=new Set,s=e.toLowerCase().split(/[\s\-_.,;:()[\]{}"']+/);for(let i of s)i.length>=2&&t.add(i);return t}var gw=10,yw=5,bw=3,ww=1;function vw(e,t){let s=Jr(e),i=Jr(t.name),n=Jr(t.description),r=0;for(let o of s)i.has(o)&&(r+=gw),n.has(o)&&(r+=bw),t.name.toLowerCase().includes(o)&&(r+=yw),t.description.toLowerCase().includes(o)&&(r+=ww);return r}async function Xu(e){let t=new Map,s;try{s=await pw(e)}catch{return t}for(let i of s){if(!i.endsWith(".json"))continue;let n=hw(e,i);try{let r=await mw(n,"utf-8"),o=JSON.parse(r);for(let a of o.skills)"license"in a||(a.license=""),"creator"in a||(a.creator=""),"compatibility"in a||(a.compatibility=""),"allowedTools"in a||(a.allowedTools=[]),"verified"in a||(a.verified=!1);t.set(`${o.owner}/${o.repo}`,o)}catch{}}return t}async function ki(){let e=await Xu(Xr()),t=await Xu(mt()),s=new Map(e);for(let[i,n]of t)s.set(i,n);return Array.from(s.values())}var kw=["license","creator","version"];function Zu(e){return kw.includes(e)}function ef(e,t){return e[t]||""}function Sw(e,t){if(t.has){for(let s of t.has)if(Zu(s)&&!ef(e,s))return!1}if(t.missing){for(let s of t.missing)if(Zu(s)&&ef(e,s))return!1}return!0}function tf(e){let t=[];return e.license||t.push("license"),e.creator||t.push("creator"),(!e.version||e.version==="0.0.0")&&t.push("version"),t}async function Si(e,t=20,s){let i=await ki(),n=[],r=!e&&s;for(let o of i)for(let a of o.skills){if(s&&!Sw(a,s))continue;let l=r?1:vw(e,a);l>0&&n.push({skill:a,repo:{owner:o.owner,repo:o.repo},score:l})}return n.sort((o,a)=>a.score-o.score),n.slice(0,t)}async function sf(){return(await ki()).reduce((t,s)=>t+s.skillCount,0)}var $w=[{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 nf(e,t){let s=[];(!e.name||!e.name.trim())&&s.push("missing frontmatter field: name"),(!e.description||!e.description.trim())&&s.push("missing frontmatter field: description"),xw(t).trim().length<20&&s.push("SKILL.md body too short (less than 20 chars of instructions)");for(let{label:n,pattern:r}of $w)r.test(t)&&s.push(`malicious pattern detected: ${n}`);return{verified:s.length===0,reasons:s}}function xw(e){let t=e.trimStart();if(!t.startsWith("---"))return t;let s=t.indexOf(`
|
|
237
|
+
---`,3);return s===-1?"":t.slice(s+4)}async function Nw(){let e=mt();return await Ew(e,{recursive:!0}),e}async function rf(e){await Me();let t;try{t=Oe(e)}catch(i){return{success:!1,repoIndex:null,error:i.message}}if(t.isLocal)return{success:!1,repoIndex:null,error:"Local paths are not supported for indexing. Use a GitHub source instead."};N(`ingester: cloning ${t.owner}/${t.repo}`);let s=null;try{s=await De(t),N(`ingester: discovering skills in ${s}`);let i=await rs(s);N(`ingester: found ${i.length} skills`);let n=[];for(let l of i){let c=$i(s,l.relPath,"SKILL.md"),d="";try{d=await Pw(c,"utf-8")}catch{N(`ingester: could not read SKILL.md at ${c}`)}let f=nf(l,d);f.verified||N(`ingester: ${l.name} not verified: ${f.reasons.join(", ")}`);let p=typeof l.tokenCount=="number"?l.tokenCount:d?Zt(d):void 0,h,g;if(d){try{let m=Wt({content:d,skillPath:l.relPath||l.name,skillMdPath:c});h={overallScore:m.overallScore,grade:m.grade,categories:m.categories.map(y=>({id:y.id,name:y.name,score:y.score,max:y.max})),evaluatedAt:m.evaluatedAt,evaluatedVersion:l.version||void 0}}catch(m){N(`ingester: eval failed for ${l.name}: ${m}`)}try{let m={skillPath:$i(s,l.relPath),skillMdPath:c},b=(await Promise.all(zt(wi()).map(async w=>(await w.applicable(m,{})).ok?vi(w,m):null))).filter(w=>w!==null).map(w=>zu(w,l.version||void 0));b.length>0&&(g=Object.fromEntries(b.filter(w=>w.providerId).map(w=>[w.providerId,w])))}catch(m){N(`ingester: provider eval failed for ${l.name}: ${m}`)}}n.push({name:l.name,description:l.description,version:l.version,license:l.license,creator:l.creator,compatibility:l.compatibility,allowedTools:l.allowedTools,installUrl:`github:${t.owner}/${t.repo}${t.ref?`#${t.ref}`:""}${l.relPath?`:${l.relPath}`:""}`,relPath:l.relPath,verified:f.verified,tokenCount:p,evalSummary:h,evalSummaries:g})}let r={repoUrl:t.cloneUrl,owner:t.owner,repo:t.repo,updatedAt:new Date().toISOString(),skillCount:n.length,skills:n},o=await Nw(),a=$i(o,`${t.owner}_${t.repo}.json`);return await Cw(a,JSON.stringify(r,null,2)+`
|
|
238
|
+
`,"utf-8"),N(`ingester: wrote index to ${a}`),{success:!0,repoIndex:r}}catch(i){return{success:!1,repoIndex:null,error:i.message}}finally{s&&await ne(s)}}async function of(){return(await ki()).map(t=>({owner:t.owner,repo:t.repo,skillCount:t.skillCount,updatedAt:t.updatedAt})).sort((t,s)=>s.skillCount-t.skillCount)}async function af(e,t){let s=mt(),i=$i(s,`${e}_${t}.json`);try{return await Aw(i),!0}catch{return!1}}import{join as cf}from"path";function Iw(e){switch(e){case"dangerous":return 3;case"warning":return 2;case"caution":return 1;default:return 0}}function Hr(e){return{verdict:e.every(t=>t.verdict==="safe")?"safe":e.some(t=>t.verdict==="dangerous")?"dangerous":"warning",findings:e.map(t=>({skill:t.skillName,verdict:t.verdict,verdict_reason:t.verdictReason,total_files:t.totalFiles,total_lines:t.totalLines})),risk_score:e.reduce((t,s)=>t+Iw(s.verdict),0)}}function Lw(e){let t=e.slice(2),s={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,add:null,remove:null,description:null,author:null,tags:null,predefined:!1}},i=0;for(;i<t.length;){let n=t[i];if(n==="--help"||n==="-h")s.flags.help=!0;else if(n==="--version"||n==="-v")s.flags.version=!0;else if(n==="--json")s.flags.json=!0;else if(n==="--yes"||n==="-y")s.flags.yes=!0;else if(n==="--no-color")s.flags.noColor=!0;else if(n==="--scope"||n==="-s"){i++;let r=t[i];r==="global"||r==="project"||r==="both"?s.flags.scope=r:(C(`Invalid scope: "${r}". Must be global, project, or both.`),process.exit(2))}else if(n==="--sort"){i++;let r=t[i];r==="name"||r==="version"||r==="location"?s.flags.sort=r:(C(`Invalid sort: "${r}". Must be name, version, or location.`),process.exit(2))}else if(n==="--provider"||n==="-p"||n==="--tool")i++,s.flags.provider=t[i]||null;else if(n==="--name")i++,s.flags.name=t[i]||null;else if(n==="--force"||n==="-f")s.flags.force=!0;else if(n==="--path")i++,s.flags.path=t[i]||null;else if(n==="--all")s.flags.all=!0;else if(n==="--verbose"||n==="-V")s.flags.verbose=!0;else if(n==="--flat")s.flags.flat=!0;else if(n==="--compact")s.flags.compact=!0;else if(n==="--summary")s.flags.summary=!0;else if(n==="--group-by"){i++;let r=t[i];r==="tool"||r==="scope"||r==="effort"?s.flags.groupBy=r:(C(`Invalid --group-by: "${r}". Must be tool, scope, or effort.`),process.exit(2))}else if(n==="--limit"){i++;let r=t[i],o=Number(r);(!Number.isFinite(o)||o<0||!Number.isInteger(o))&&(C(`Invalid --limit: "${r}". Must be a non-negative integer (0 means no limit).`),process.exit(2)),s.flags.limit=o}else if(n==="--installed")s.flags.installed=!0;else if(n==="--available")s.flags.available=!0;else if(n==="--concurrency"){i++;let r=t[i],o=Number(r);(!Number.isFinite(o)||o<1||!Number.isInteger(o))&&(C(`Invalid --concurrency: "${r}". Must be a positive integer.`),process.exit(2)),s.flags.concurrency=o}else if(n==="--keep")s.flags.keep=!0;else if(n==="--transport"||n==="-t"){i++;let r=t[i];r==="https"||r==="ssh"||r==="auto"?s.flags.transport=r:(C(`Invalid transport: "${r}". Must be https, ssh, or auto.`),process.exit(2))}else if(n==="--method"||n==="-m"){i++;let r=t[i];r==="default"||r==="vercel"?s.flags.method=r:(C(`Invalid method: "${r}". Must be default or vercel.`),process.exit(2))}else n==="--skill"?(i++,s.flags.path=t[i]||null):n==="--dry-run"?s.flags.dryRun=!0:n==="--fix"?s.flags.fix=!0:n==="--machine"?s.flags.machine=!0:n==="--no-cache"?s.flags.noCache=!0:n==="--has"?(i++,t[i]&&s.flags.has.push(t[i])):n==="--missing"?(i++,t[i]&&s.flags.missing.push(t[i])):n==="--add"?(i++,s.flags.add=t[i]||null):n==="--remove"?(i++,s.flags.remove=t[i]||null):n==="--description"?(i++,s.flags.description=t[i]||null):n==="--author"?(i++,s.flags.author=t[i]||null):n==="--tags"?(i++,s.flags.tags=t[i]||null):n==="--predefined"?s.flags.predefined=!0:n.startsWith("-")?(C(`Unknown option: ${n}`),console.error('Run "asm --help" for usage.'),process.exit(2)):s.command?s.subcommand?s.positional.push(n):s.subcommand=n:s.command=n;i++}return s}function C(e){console.error(u.red(`Error: ${e}`))}function Rw(){console.log(`${u.blueBold("agent-skill-manager")} (${u.bold("asm")}) ${Li}
|
|
234
239
|
|
|
235
240
|
Interactive TUI and CLI for managing installed skills for AI coding agents.
|
|
236
241
|
|
|
237
|
-
${
|
|
242
|
+
${u.bold("Usage:")}
|
|
238
243
|
asm Launch interactive TUI
|
|
239
244
|
asm <command> [options] Run a CLI command
|
|
240
245
|
|
|
241
|
-
${
|
|
246
|
+
${u.bold("Commands:")}
|
|
242
247
|
list List all discovered skills
|
|
243
248
|
search <query> Search skills by name/description/tool
|
|
244
249
|
inspect <skill-name> Show detailed info for a skill
|
|
@@ -255,7 +260,7 @@ ${U.bold("Commands:")}
|
|
|
255
260
|
update [name...] Update outdated skills with security re-audit
|
|
256
261
|
publish [path] Validate, audit, and submit a skill to the registry
|
|
257
262
|
eval <skill-path> Evaluate a skill against best practices and score it
|
|
258
|
-
eval-providers list List registered eval providers (id, version, schema,
|
|
263
|
+
eval-providers list List registered eval providers (id, version, schema, \u2026)
|
|
259
264
|
bundle Manage skill bundles (create, install, list, show, remove)
|
|
260
265
|
index Manage skill index (ingest, search, list)
|
|
261
266
|
doctor Run environment health checks and diagnostics
|
|
@@ -264,7 +269,7 @@ ${U.bold("Commands:")}
|
|
|
264
269
|
config reset Reset config to defaults
|
|
265
270
|
config edit Open config in $EDITOR
|
|
266
271
|
|
|
267
|
-
${
|
|
272
|
+
${u.bold("Global Options:")}
|
|
268
273
|
-h, --help Show help for any command
|
|
269
274
|
-v, --version Print version and exit
|
|
270
275
|
--json Output as JSON (list, search, inspect)
|
|
@@ -275,34 +280,46 @@ ${U.bold("Global Options:")}
|
|
|
275
280
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
276
281
|
--flat Show one row per tool instance (list, search)
|
|
277
282
|
-y, --yes Skip confirmation prompts
|
|
278
|
-
-V, --verbose Show debug output`)}function
|
|
283
|
+
-V, --verbose Show debug output`)}function Ow(){console.log(`${u.bold("Usage:")} asm list [options]
|
|
279
284
|
|
|
280
285
|
List all discovered skills. By default, skills installed across multiple
|
|
281
|
-
tools are grouped into a single row with tool badges.
|
|
286
|
+
tools are grouped into a single row with tool badges. When more than
|
|
287
|
+
${Pi} skills are present, a compact summary is
|
|
288
|
+
automatically prepended above the table.
|
|
282
289
|
|
|
283
|
-
${
|
|
290
|
+
${u.bold("Options:")}
|
|
284
291
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
285
292
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
286
293
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
287
294
|
--flat Show one row per tool instance (ungrouped)
|
|
295
|
+
--compact One-line-per-skill dense view
|
|
296
|
+
--summary Print only the summary (counts by tool/scope/effort)
|
|
297
|
+
--group-by <axis> Group rows under headers (axis: tool | scope | effort)
|
|
298
|
+
--limit <N> Limit rendered rows (0 = no limit)
|
|
288
299
|
--json Output as JSON array
|
|
289
300
|
--machine Output in stable machine-readable v1 envelope format
|
|
290
301
|
--no-color Disable ANSI colors
|
|
291
302
|
-V, --verbose Show debug output
|
|
292
303
|
|
|
293
|
-
${
|
|
294
|
-
asm list ${
|
|
295
|
-
asm list --flat ${
|
|
296
|
-
asm list
|
|
297
|
-
asm list
|
|
298
|
-
asm list --
|
|
299
|
-
asm list --
|
|
300
|
-
asm list --
|
|
304
|
+
${u.bold("Examples:")}
|
|
305
|
+
asm list ${u.dim("List all skills (grouped)")}
|
|
306
|
+
asm list --flat ${u.dim("One row per tool instance")}
|
|
307
|
+
asm list --compact ${u.dim("One line per skill (dense)")}
|
|
308
|
+
asm list --summary ${u.dim("Counts by tool/scope/effort only")}
|
|
309
|
+
asm list --group-by tool ${u.dim("Group rows under tool headers")}
|
|
310
|
+
asm list --group-by scope ${u.dim("Group rows under scope headers")}
|
|
311
|
+
asm list --group-by effort ${u.dim("Group rows under effort headers")}
|
|
312
|
+
asm list --limit 20 ${u.dim("Show first 20 rows only")}
|
|
313
|
+
asm list -p claude ${u.dim("Only Claude Code skills")}
|
|
314
|
+
asm list -s project ${u.dim("Only project-scoped skills")}
|
|
315
|
+
asm list --sort version ${u.dim("Sort by version")}
|
|
316
|
+
asm list --json ${u.dim("Output as JSON")}
|
|
317
|
+
asm list --machine ${u.dim("Machine-readable v1 envelope output")}`)}function Tw(){console.log(`${u.bold("Usage:")} asm search <query> [options]
|
|
301
318
|
|
|
302
319
|
Search both installed skills and the skill index. Results show installation
|
|
303
320
|
status and include copy-paste install commands for available skills.
|
|
304
321
|
|
|
305
|
-
${
|
|
322
|
+
${u.bold("Options:")}
|
|
306
323
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
307
324
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
308
325
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
@@ -314,49 +331,49 @@ ${U.bold("Options:")}
|
|
|
314
331
|
--no-color Disable ANSI colors
|
|
315
332
|
-V, --verbose Show debug output
|
|
316
333
|
|
|
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 ${
|
|
334
|
+
${u.bold("Examples:")}
|
|
335
|
+
asm search code ${u.dim("Search installed and available skills")}
|
|
336
|
+
asm search review -p claude ${u.dim("Search within Claude Code only")}
|
|
337
|
+
asm search "test" --installed ${u.dim("Search installed skills only")}
|
|
338
|
+
asm search "test" --available ${u.dim("Search available skills only")}
|
|
339
|
+
asm search openspec --json ${u.dim("Output matches as JSON")}
|
|
340
|
+
asm search openspec --machine ${u.dim("Machine-readable v1 envelope output")}`)}function Mw(){console.log(`${u.bold("Usage:")} asm inspect <skill-name> [options]
|
|
324
341
|
|
|
325
342
|
Show detailed information for a skill. The <skill-name> is the directory name.
|
|
326
343
|
Shows version, description, file count, and all provider installations.
|
|
327
344
|
|
|
328
|
-
${
|
|
345
|
+
${u.bold("Options:")}
|
|
329
346
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
330
347
|
--json Output as JSON object
|
|
331
348
|
--no-color Disable ANSI colors
|
|
332
349
|
-V, --verbose Show debug output
|
|
333
350
|
|
|
334
|
-
${
|
|
335
|
-
asm inspect code-review ${
|
|
336
|
-
asm inspect code-review --json ${
|
|
337
|
-
asm inspect code-review -s global ${
|
|
351
|
+
${u.bold("Examples:")}
|
|
352
|
+
asm inspect code-review ${u.dim("Show details for code-review")}
|
|
353
|
+
asm inspect code-review --json ${u.dim("Output as JSON")}
|
|
354
|
+
asm inspect code-review -s global ${u.dim("Global installations only")}`)}function Dw(){console.log(`${u.bold("Usage:")} asm uninstall <skill-name> [options]
|
|
338
355
|
|
|
339
356
|
Remove a skill and its associated rule files. Shows a removal plan
|
|
340
357
|
before proceeding and asks for confirmation.
|
|
341
358
|
|
|
342
|
-
${
|
|
359
|
+
${u.bold("Options:")}
|
|
343
360
|
-y, --yes Skip confirmation prompt
|
|
344
361
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
345
362
|
--no-color Disable ANSI colors
|
|
346
363
|
-V, --verbose Show debug output
|
|
347
364
|
|
|
348
|
-
${
|
|
349
|
-
asm uninstall code-review ${
|
|
350
|
-
asm uninstall code-review -y ${
|
|
351
|
-
asm uninstall code-review -s project ${
|
|
365
|
+
${u.bold("Examples:")}
|
|
366
|
+
asm uninstall code-review ${u.dim("Remove with confirmation")}
|
|
367
|
+
asm uninstall code-review -y ${u.dim("Remove without confirmation")}
|
|
368
|
+
asm uninstall code-review -s project ${u.dim("Remove project copy only")}`)}function _w(){console.log(`${u.bold("Usage:")} asm audit [subcommand] [options]
|
|
352
369
|
|
|
353
370
|
Detect duplicate skills or run security audits on installed/remote skills.
|
|
354
371
|
|
|
355
|
-
${
|
|
372
|
+
${u.bold("Subcommands:")}
|
|
356
373
|
duplicates Find duplicate skills (default)
|
|
357
374
|
security <name|source> Run security audit on an installed skill or GitHub source
|
|
358
375
|
|
|
359
|
-
${
|
|
376
|
+
${u.bold("Options:")}
|
|
360
377
|
--json Output as JSON
|
|
361
378
|
--machine Output in stable machine-readable v1 envelope format
|
|
362
379
|
-y, --yes Auto-remove duplicates, keeping one instance per group
|
|
@@ -364,25 +381,25 @@ ${U.bold("Options:")}
|
|
|
364
381
|
--no-color Disable ANSI colors
|
|
365
382
|
-V, --verbose Show debug output
|
|
366
383
|
|
|
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 ${
|
|
384
|
+
${u.bold("Examples:")}
|
|
385
|
+
asm audit ${u.dim("Find duplicates")}
|
|
386
|
+
asm audit -y ${u.dim("Auto-remove duplicates")}
|
|
387
|
+
asm audit --json ${u.dim("Output as JSON")}
|
|
388
|
+
asm audit security code-review ${u.dim("Audit an installed skill")}
|
|
389
|
+
asm audit security github:user/repo ${u.dim("Audit a remote skill before installing")}
|
|
390
|
+
asm audit security --all ${u.dim("Audit all installed skills")}
|
|
391
|
+
asm audit security code-review --json ${u.dim("Output audit as JSON")}
|
|
392
|
+
asm audit security code-review --machine ${u.dim("Machine-readable v1 envelope output")}
|
|
376
393
|
asm audit security https://github.com/user/skills/tree/main/skills/agent-config
|
|
377
|
-
${
|
|
394
|
+
${u.dim("Audit a skill from a subfolder URL")}`)}function qw(){console.log(`${u.bold("Usage:")} asm publish [path] [options]
|
|
378
395
|
|
|
379
396
|
Validate a skill, run a security audit, generate a registry manifest,
|
|
380
397
|
and open a PR against the asm-registry.
|
|
381
398
|
|
|
382
|
-
${
|
|
399
|
+
${u.bold("Arguments:")}
|
|
383
400
|
path Path to skill directory (default: current directory)
|
|
384
401
|
|
|
385
|
-
${
|
|
402
|
+
${u.bold("Options:")}
|
|
386
403
|
--dry-run Print generated manifest without opening a PR
|
|
387
404
|
--force Override 'warning' security verdict (blocks 'dangerous')
|
|
388
405
|
-y, --yes Skip confirmation prompts
|
|
@@ -391,75 +408,76 @@ ${U.bold("Options:")}
|
|
|
391
408
|
--no-color Disable ANSI colors
|
|
392
409
|
-V, --verbose Show debug output
|
|
393
410
|
|
|
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 ${
|
|
411
|
+
${u.bold("Examples:")}
|
|
412
|
+
asm publish ${u.dim("Publish skill in current directory")}
|
|
413
|
+
asm publish ./my-skill ${u.dim("Publish skill at the given path")}
|
|
414
|
+
asm publish --dry-run ${u.dim("Preview manifest without side effects")}
|
|
415
|
+
asm publish --force ${u.dim("Override warning-level security findings")}
|
|
416
|
+
asm publish --json ${u.dim("Output as JSON")}
|
|
417
|
+
asm publish --machine ${u.dim("Machine-readable v1 envelope output")}`)}function Fw(){console.log(`${u.bold("Usage:")} asm outdated [options]
|
|
401
418
|
|
|
402
419
|
Show which installed skills have newer versions available.
|
|
403
420
|
|
|
404
|
-
${
|
|
421
|
+
${u.bold("Options:")}
|
|
405
422
|
--json Output as JSON
|
|
406
423
|
--machine Output in stable machine-readable format
|
|
407
424
|
--no-color Disable ANSI colors
|
|
408
425
|
-V, --verbose Show debug output
|
|
409
426
|
|
|
410
|
-
${
|
|
411
|
-
asm outdated ${
|
|
412
|
-
asm outdated --json ${
|
|
413
|
-
asm outdated --machine ${
|
|
427
|
+
${u.bold("Examples:")}
|
|
428
|
+
asm outdated ${u.dim("Show outdated skills")}
|
|
429
|
+
asm outdated --json ${u.dim("Output as JSON")}
|
|
430
|
+
asm outdated --machine ${u.dim("Machine-readable output")}`)}function jw(){console.log(`${u.bold("Usage:")} asm update [name...] [options]
|
|
414
431
|
|
|
415
432
|
Update outdated skills to their latest version with security re-audit.
|
|
416
433
|
|
|
417
|
-
${
|
|
434
|
+
${u.bold("Arguments:")}
|
|
418
435
|
name Specific skill(s) to update (default: all outdated)
|
|
419
436
|
|
|
420
|
-
${
|
|
437
|
+
${u.bold("Options:")}
|
|
421
438
|
-y, --yes Skip confirmation prompts
|
|
422
439
|
--json Output as JSON
|
|
423
440
|
--machine Output in stable machine-readable format
|
|
424
441
|
--no-color Disable ANSI colors
|
|
425
442
|
-V, --verbose Show debug output
|
|
426
443
|
|
|
427
|
-
${
|
|
428
|
-
asm update ${
|
|
429
|
-
asm update code-review ${
|
|
430
|
-
asm update --yes ${
|
|
431
|
-
asm update --json ${
|
|
444
|
+
${u.bold("Examples:")}
|
|
445
|
+
asm update ${u.dim("Update all outdated skills")}
|
|
446
|
+
asm update code-review ${u.dim("Update a specific skill")}
|
|
447
|
+
asm update --yes ${u.dim("Skip confirmation prompts")}
|
|
448
|
+
asm update --json ${u.dim("Output as JSON")}`)}function Bw(){console.log(`${u.bold("Usage:")} asm config <subcommand>
|
|
432
449
|
|
|
433
450
|
Manage configuration. Config is stored at ~/.config/agent-skill-manager/.
|
|
434
451
|
|
|
435
|
-
${
|
|
452
|
+
${u.bold("Subcommands:")}
|
|
436
453
|
show Print current config as JSON
|
|
437
454
|
path Print config file path
|
|
438
455
|
reset Reset config to defaults (with confirmation)
|
|
439
456
|
edit Open config in $EDITOR
|
|
440
457
|
|
|
441
|
-
${
|
|
458
|
+
${u.bold("Options:")}
|
|
442
459
|
-V, --verbose Show debug output
|
|
443
460
|
|
|
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
|
-
|
|
461
|
+
${u.bold("Examples:")}
|
|
462
|
+
asm config show ${u.dim("View current config")}
|
|
463
|
+
asm config edit ${u.dim("Edit in $EDITOR")}
|
|
464
|
+
asm config reset -y ${u.dim("Reset without confirmation")}`)}async function uf(e){for(let t of e)t.warnings=await xc(t)}async function Uw(e){if(e.flags.help){Ow();return}let t=performance.now(),s=await q(),i=await Q(s,e.flags.scope);e.flags.provider&&e.command==="list"&&(i=i.filter(r=>r.provider===e.flags.provider)),await uf(i);let n=Ci(i,e.flags.sort);if(e.flags.machine){let r=n.map(o=>({name:o.name,version:o.version,description:o.description,scope:o.scope,provider:o.provider,path:o.path}));console.log(Y("list",r,t));return}if(e.flags.json)console.log(J(n));else if(e.flags.flat){let r=Ai(n),o=n.filter(a=>a.warnings&&a.warnings.length>0);o.length>0&&(r+=`
|
|
465
|
+
${u.yellow(`${o.length} skill${o.length===1?"":"s"} with warnings -- use --json for details`)}`),console.log(r)}else if(e.flags.summary)console.log(Ni(n));else if(e.flags.groupBy){let{skills:r,hint:o}=es(n,e.flags.limit);console.log(co(r,e.flags.groupBy)),o&&console.log(o)}else if(e.flags.compact){let{skills:r,hint:o}=es(n,e.flags.limit);console.log(lo(r)),o&&console.log(o)}else{let r=[];n.length>Pi&&(r.push(Ni(n,{showHint:!1})),r.push(""));let{skills:o,hint:a}=es(n,e.flags.limit);r.push(uo(o)),a&&r.push(a),console.log(r.join(`
|
|
466
|
+
`))}}async function Vw(e){if(e.flags.help){Tw();return}let t=e.flags.machine?Ge():void 0,s=performance.now(),i=e.subcommand;i||(e.flags.machine&&(t?.(),console.log(z("search",W.INVALID_ARGUMENT,"Missing required argument: <query>",s)),process.exit(2)),C("Missing required argument: <query>"),console.error('Run "asm search --help" for usage.'),process.exit(2));let n=!e.flags.available,r=!e.flags.installed,o=[];if(n){let d=await q(),f=await Q(d,e.flags.scope);e.flags.provider&&(f=f.filter(h=>h.provider===e.flags.provider));let p=to(f,i);o=Ci(p,e.flags.sort)}let a=[];if(r&&(a=await Si(i),o.length>0)){let d=new Set(o.map(f=>f.name.toLowerCase()));a=a.filter(f=>!d.has(f.skill.name.toLowerCase()))}if(e.flags.machine){t?.();let d=o.map(p=>({name:p.name,description:p.description,source:"installed",url:null,match_count:1})),f=a.map(p=>({name:p.skill.name,description:p.skill.description,source:"index",url:p.skill.installUrl,match_count:1}));console.log(Y("search",[...d,...f],s));return}if(e.flags.json){let d=o.map(p=>({name:p.name,description:p.description,version:p.version,scope:p.scope,provider:p.provider,status:"installed"})),f=a.map(p=>({name:p.skill.name,description:p.skill.description,version:p.skill.version,repo:`${p.repo.owner}/${p.repo.repo}`,installCommand:`asm install ${p.skill.installUrl}`,status:"available"}));console.log(J([...d,...f]));return}let l=o.length>0,c=a.length>0;if(!l&&!c){console.error(`No skills matching "${i}".`),console.error(u.dim("Try ingesting more repos with: asm index ingest <repo>"));return}if(l&&(console.error(u.bold(`Installed skills matching "${i}":
|
|
467
|
+
`)),e.flags.flat?console.log(Ai(o)):console.log(fo(o,i))),c){l&&console.error("");let d=po(a.map(f=>({name:f.skill.name,version:f.skill.version,description:f.skill.description,verified:f.skill.verified,repoLabel:`${f.repo.owner}/${f.repo.repo}`,installUrl:f.skill.installUrl})),i);console.error(d)}}async function Kw(e){if(e.flags.help){Mw();return}let t=e.subcommand;t||(C("Missing required argument: <skill-name>"),console.error('Run "asm inspect --help" for usage.'),process.exit(2));let s=await q(),n=(await Q(s,e.flags.scope)).filter(r=>r.dirName===t);n.length===0&&(C(`Skill "${t}" not found.`),console.error(u.dim(`Try ${u.bold("asm list")} to see all skills or ${u.bold(`asm search "${t}"`)} to search.`)),process.exit(1)),await uf(n),e.flags.json?console.log(J(n.length===1?n[0]:n)):console.log(await mo(n))}async function Jw(e){if(e.flags.help){Dw();return}let t=e.subcommand;t||(C("Missing required argument: <skill-name>"),console.error('Run "asm uninstall --help" for usage.'),process.exit(2));let s=await q(),i=await Q(s,e.flags.scope),n=io(t,i,s),r=await no(n);r.length===0&&(C(`Skill "${t}" not found or nothing to remove.`),process.exit(1)),console.error(u.bold("Removal plan:"));for(let a of r)console.error(` ${u.red("\u2022")} ${ao(a)}`);if(!e.flags.yes){process.stdin.isTTY||(C("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2)),process.stderr.write(`
|
|
468
|
+
${u.bold("Proceed with removal?")} [y/N] `);let a=await G();a.toLowerCase()!=="y"&&a.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let o=await Ei(n);for(let a of o)console.error(a);try{await go(t)}catch{}console.error(u.green(`
|
|
469
|
+
Done.`))}function G(){return new Promise(e=>{let t="",s=!1;function i(){process.stdin.removeListener("data",r),process.stdin.removeListener("end",o),process.stdin.pause(),clearTimeout(a)}function n(l){s||(s=!0,i(),e(l))}function r(l){t+=l,t.includes(`
|
|
470
|
+
`)&&n(t.trim())}function o(){n(t.trim())}let a=setTimeout(()=>{n(t.trim())},3e4);process.stdin.setEncoding("utf-8"),process.stdin.on("data",r),process.stdin.on("end",o),process.stdin.resume()})}async function Hw(e){if(e.flags.help){_w();return}let t=performance.now(),s=e.subcommand??"duplicates";if(s==="security"){await Yw(e,t);return}s!=="duplicates"&&(C(`Unknown audit subcommand: "${s}". Use: duplicates, security`),process.exit(2));let i=await q(),n=await Q(i,"both"),r=Ii(n);if(e.flags.machine){let o={duplicate_groups:r.duplicateGroups.map(a=>({name:a.key,count:a.instances.length,instances:a.instances.map(l=>({path:l.path,scope:l.scope,provider:l.provider}))})),total_duplicates:r.duplicateGroups.length};console.log(Y("audit duplicates",o,t));return}if(e.flags.json){console.log(vo(r));return}if(console.log(wo(r)),e.flags.yes&&r.duplicateGroups.length>0){console.error(u.bold(`
|
|
471
|
+
Auto-removing duplicates...`));for(let o of r.duplicateGroups){let a=bo(o.instances),l=a[0].path;for(let c=1;c<a.length;c++){let d=a[c],f=so(d,i),p=await Ei(f,l);for(let h of p)console.error(h)}}console.error(u.green(`
|
|
472
|
+
Done.`))}}async function Yw(e,t){let s=e.positional[0];e.flags.all?await Gw(e,t):s?s.startsWith("github:")||s.startsWith("https://github.com/")?await Ww(e,s,t):await zw(e,s,t):(e.flags.machine&&(console.log(z("audit security",W.INVALID_ARGUMENT,"Missing target. Provide a skill name, GitHub source, or use --all.",t)),process.exit(2)),C(`Missing target. Provide a skill name, GitHub source, or use --all.
|
|
473
|
+
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2))}async function Gw(e,t){let s=await q(),i=await Q(s,e.flags.scope);if(i.length===0){e.flags.machine?console.log(Y("audit security",[],t)):e.flags.json?console.log("[]"):console.log("No skills found to audit.");return}let n=new Set,r=i.filter(a=>n.has(a.realPath)?!1:(n.add(a.realPath),!0));console.error(`Auditing ${r.length} skill${r.length>1?"s":""}...
|
|
474
|
+
`);let o=[];for(let a of r){console.error(` Scanning ${u.bold(a.name)}...`);let l=await Pe(a.realPath,a.name);o.push(l)}if(e.flags.machine)console.log(Y("audit security",Hr(o),t));else if(e.flags.json)console.log(JSON.stringify(o,null,2));else{for(let l of o)console.log(ai(l));let a={safe:0,caution:0,warning:0,dangerous:0};for(let l of o)a[l.verdict]++;console.log(u.bold(`
|
|
475
|
+
Summary:`)),a.dangerous>0&&console.log(` ${u.red(`${a.dangerous} dangerous`)}`),a.warning>0&&console.log(` ${u.yellow(`${a.warning} warning`)}`),a.caution>0&&console.log(` ${a.caution} caution`),a.safe>0&&console.log(` ${u.green(`${a.safe} safe`)}`),console.log("")}}async function Ww(e,t,s){let i=null;try{let n=Oe(t);if(n.isLocal)throw new Error("Local paths are not supported for remote security audits. Use: asm audit security <installed-skill-name>");await Me(),n=await ns(n),console.error(`Cloning ${t} for audit...`),i=await De(n,e.flags.transport);let{join:r}=await import("path"),o=n.subpath?r(i,n.subpath):i,{name:a}=await _e(o),l=await Pe(o,a,n.owner,n.repo);e.flags.machine?console.log(Y("audit security",Hr([l]),s)):e.flags.json?console.log(Lr(l)):console.log(ai(l))}catch(n){e.flags.machine&&(console.log(z("audit security",W.AUDIT_FAILED,n.message,s)),process.exit(1)),C(n.message),process.exit(1)}finally{i&&await ne(i)}}async function zw(e,t,s){let i=await q(),r=(await Q(i,e.flags.scope)).filter(l=>l.dirName===t);r.length===0&&(e.flags.machine&&(console.log(z("audit security",W.SKILL_NOT_FOUND,`Skill "${t}" not found.`,s)),process.exit(1)),C(`Skill "${t}" not found. Use "asm list" to see installed skills.`),process.exit(1));let o=r[0];console.error(`Auditing installed skill: ${u.bold(o.name)}...
|
|
476
|
+
`);let a=await Pe(o.realPath,o.name);e.flags.machine?console.log(Y("audit security",Hr([a]),s)):e.flags.json?console.log(Lr(a)):console.log(ai(a))}async function Qw(e){if(e.flags.help){Bw();return}let t=e.subcommand;switch(t||(C("Missing subcommand. Use: show, path, reset, or edit."),console.error('Run "asm config --help" for usage.'),process.exit(2)),t){case"show":{let s=await q();console.log(J(s));break}case"path":{console.log(pt());break}case"reset":{if(!e.flags.yes){process.stdin.isTTY||(C("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2)),process.stderr.write(`${u.bold("Reset config to defaults?")} [y/N] `);let i=await G();i.toLowerCase()!=="y"&&i.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let s=zr();await Zr(s),console.error(u.green("Config reset to defaults."));break}case"edit":{let s=process.env.VISUAL||process.env.EDITOR||"vi",[i,n]=So(s),r=pt();await q();let{spawn:o}=await import("child_process");await new Promise((a,l)=>{let c=o(i,[...n,r],{stdio:"inherit"});c.on("close",()=>a()),c.on("error",l)});break}default:C(`Unknown config subcommand: "${t}". Use: show, path, reset, or edit.`),process.exit(2)}}function Xw(){console.log(`${u.bold("Usage:")} asm install <source> [options]
|
|
459
477
|
|
|
460
478
|
Install a skill from a GitHub repository, the curated registry, or a local path.
|
|
461
479
|
|
|
462
|
-
${
|
|
480
|
+
${u.bold("Source Format:")}
|
|
463
481
|
code-review Install by name from the curated registry
|
|
464
482
|
author/code-review Install a scoped name (author/name) from registry
|
|
465
483
|
github:owner/repo Install from default branch
|
|
@@ -472,7 +490,7 @@ ${U.bold("Source Format:")}
|
|
|
472
490
|
./relative/path/to/skill Install from a local folder (relative path)
|
|
473
491
|
~/path/to/skill Install from a local folder (home-relative path)
|
|
474
492
|
|
|
475
|
-
${
|
|
493
|
+
${u.bold("Options:")}
|
|
476
494
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents, all)
|
|
477
495
|
Use "all" to install to all tools (shared + symlinks)
|
|
478
496
|
-s, --scope <scope> Installation scope: global or project (default: prompt)
|
|
@@ -494,82 +512,82 @@ ${U.bold("Options:")}
|
|
|
494
512
|
--no-color Disable ANSI colors
|
|
495
513
|
-V, --verbose Show debug output
|
|
496
514
|
|
|
497
|
-
${
|
|
498
|
-
asm install code-review ${
|
|
499
|
-
asm install luongnv89/code-review ${
|
|
500
|
-
asm install code-review --no-cache ${
|
|
515
|
+
${u.bold("Registry (bare name):")}
|
|
516
|
+
asm install code-review ${u.dim("(resolve from registry)")}
|
|
517
|
+
asm install luongnv89/code-review ${u.dim("(scoped name, no ambiguity)")}
|
|
518
|
+
asm install code-review --no-cache ${u.dim("(force fresh registry fetch)")}
|
|
501
519
|
|
|
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 ${
|
|
520
|
+
${u.bold("Local folder:")}
|
|
521
|
+
asm install ./my-skill ${u.dim("(relative path)")}
|
|
522
|
+
asm install /home/user/skills/my-skill ${u.dim("(absolute path)")}
|
|
523
|
+
asm install ~/skills/my-skill ${u.dim("(home-relative path)")}
|
|
524
|
+
asm install ../other-project/skill ${u.dim("(parent-relative path)")}
|
|
525
|
+
asm install ./skills-dir --all ${u.dim("(all skills in directory)")}
|
|
508
526
|
|
|
509
|
-
${
|
|
527
|
+
${u.bold("Single-skill repo:")}
|
|
510
528
|
asm install github:user/my-skill
|
|
511
529
|
asm install github:user/my-skill#v1.0.0 -p claude
|
|
512
530
|
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 ${
|
|
531
|
+
asm install github:user/my-skill -p all ${u.dim("(install to all tools)")}
|
|
532
|
+
asm install github:user/private-skill -t ssh ${u.dim("(clone via SSH)")}
|
|
515
533
|
|
|
516
|
-
${
|
|
534
|
+
${u.bold("Multi-skill repo:")}
|
|
517
535
|
asm install github:user/skills --path skills/code-review
|
|
518
536
|
asm install github:user/skills --all -p claude -y
|
|
519
|
-
asm install github:user/skills --all -p all -y ${
|
|
537
|
+
asm install github:user/skills --all -p all -y ${u.dim("(all skills, all tools)")}
|
|
520
538
|
asm install https://github.com/user/skills --all
|
|
521
|
-
asm install github:user/skills ${
|
|
539
|
+
asm install github:user/skills ${u.dim("(interactive picker)")}
|
|
522
540
|
|
|
523
|
-
${
|
|
541
|
+
${u.bold("Subfolder URL:")}
|
|
524
542
|
asm install https://github.com/user/skills/tree/main/skills/agent-config
|
|
525
543
|
asm install github:user/skills#main:skills/agent-config
|
|
526
544
|
|
|
527
|
-
${
|
|
545
|
+
${u.bold("Vercel skills CLI:")}
|
|
528
546
|
asm install github:user/skills --method vercel --skill my-skill
|
|
529
547
|
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-${
|
|
538
|
-
Did you mean: ${
|
|
539
|
-
`);for(let
|
|
548
|
+
${u.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function Zw(e,t,s,i,n,r,o,a,l="global"){let c=await _e(i),d=await No(i),f=i===s?null:i.split(/[/\\]/).pop(),p=n||f||t.repo,h=Te(p),g=a.find(E=>E.name.toLowerCase()===c.name.toLowerCase()&&E.provider===o.name),m,y=!!g;g?g.version===c.version?m=e.flags.force?"REINSTALL":`UPDATE: ${g.version} (same version)`:m=`UPDATE: ${g.version} \u2192 ${c.version}`:m="NEW";let b=_i(t,s,i,h,o,e.flags.force||y,l),w=d.some(E=>["Shell commands","Code execution","Credentials"].includes(E.category)),$=d.some(E=>["External URLs"].includes(E.category)),x=w?"high":$?"medium":"safe",k=w?u.red("[!] High Risk"):$?u.yellow("[~] Medium Risk"):u.green("[ok] Safe");return{metadata:c,skillName:h,warnings:d,installStatus:m,riskLevel:x,riskLabel:k,plan:b}}function ev(e,t,s,i,n,r){let{metadata:o,warnings:a,installStatus:l,riskLabel:c,plan:d}=e;if(n&&r){let f=u.dim(`[${r.index}/${r.total}]`),p=l==="NEW"?u.green(`[${l}]`):u.yellow(`[${l}]`);console.info(`${f} ${u.bold(o.name)} v${o.version} ${p} ${c}`)}else{let f=l==="NEW"?u.green(`[${l}]`):u.yellow(`[${l}]`);if(console.info(` ${u.bold(o.name)} v${o.version} ${f}`),console.info(`
|
|
549
|
+
${u.bold("Install preview:")}`),console.info(` ${u.bold("Name:")} ${o.name}`),console.info(` ${u.bold("Version:")} ${o.version}`),o.description&&console.info(` ${u.bold("Description:")} ${u.dim(o.description)}`),o.effort&&console.info(` ${u.bold("Effort:")} ${ro(o.effort)}`),console.info(` ${u.bold("Source:")} ${t}`),i?(console.info(` ${u.bold("Tool:")} All (${i.map(p=>p.label).join(", ")})`),console.info(` ${u.bold("Primary:")} ${s.label} (${s.name})`),console.info(` ${u.bold("Symlinks:")} ${i.filter(p=>p.name!==s.name).map(p=>p.label).join(", ")}`)):console.info(` ${u.bold("Tool:")} ${s.label} (${s.name})`),console.info(` ${u.bold("Scope:")} ${d.scope==="project"?"Project":"Global"}`),console.info(` ${u.bold("Target:")} ${d.targetDir}`),console.info(` ${u.bold("Status:")} ${f}`),console.info(` ${u.bold("Risk:")} ${c}`),a.length>0){console.info(`
|
|
550
|
+
${u.bold("Security warnings:")}`);let p=new Map;for(let h of a){let g=p.get(h.category)||[];g.push(h),p.set(h.category,g)}for(let[h,g]of p){let y=["Shell commands","Code execution","Credentials"].includes(h)?u.red(`[${h}]`):u.yellow(`[${h}]`);console.info(`
|
|
551
|
+
${y} ${u.dim(`(${g.length} match${g.length>1?"es":""})`)}`);for(let b of g.slice(0,5))console.info(` ${u.dim(`${b.file}:${b.line}`)} -- ${b.match}`);g.length>5&&console.info(u.dim(` ... and ${g.length-5} more`))}}}}async function tv(e,t){return t?await Io(e,t):await os(e)}async function sv(e){if(e.flags.help){Xw();return}let t=e.flags.machine?Ge():void 0,s=performance.now(),i=e.subcommand;i||(C("Missing required argument: <source>"),console.error('Run "asm install --help" for usage.'),process.exit(2));let n=null,r="github",o=8,a=0,l=d=>(a++,`
|
|
552
|
+
${u.cyan(`[Step ${a}/${o}]`)} ${u.bold(d)}`),c=()=>{n?ne(n).finally(()=>process.exit(1)):process.exit(1)};process.on("SIGINT",c),process.on("SIGTERM",c);try{if(kr(i)){console.info(`
|
|
553
|
+
${u.cyan("\u25CF")} Resolving "${u.bold(i)}" from registry...`);let{resolved:v,multipleMatches:S,suggestions:I}=await Nc(i,{noCache:e.flags.noCache});if(v){r="registry";let L=v.manifest,T=L.repository.replace("https://github.com/","");i=L.skill_path?`github:${T}#${L.commit}:${L.skill_path}`:`github:${T}#${L.commit}`,console.info(` ${u.green("\u2713")} Resolved: ${u.bold(`${L.author}/${L.name}`)} @ ${L.commit.slice(0,7)}`)}else if(S.length>0){console.info(`
|
|
554
|
+
${u.yellow("\u26A0")} Multiple skills found for "${u.bold(i)}":`);let L=S.slice(0,5);for(let se=0;se<L.length;se++){let j=L[se];console.info(` ${u.cyan(`${se+1}.`)} ${u.bold(`${j.author}/${j.name}`)} \u2014 ${j.description}`)}process.stdin.isTTY||(C(`Ambiguous skill name "${i}". Use a scoped name: asm install author/name`),process.exit(2));let T=`
|
|
555
|
+
Select a skill [1-${L.length}]: `;process.stderr.write(T);let K=await new Promise(se=>{let j="",ye=!1,Ne=setTimeout(()=>{ye||(ye=!0,process.stdin.removeListener("data",Ie),se(j.trim()))},3e4);function Ie(dt){j=dt.toString().trim(),ye||(ye=!0,clearTimeout(Ne),process.stdin.removeListener("data",Ie),se(j))}process.stdin.setEncoding("utf-8"),process.stdin.on("data",Ie)}),U=parseInt(K,10);(isNaN(U)||U<1||U>L.length)&&(C("Invalid selection. Aborting."),process.exit(2));let ee=L[U-1];r="registry";let Qt=ee.repository.replace("https://github.com/","");i=ee.skill_path?`github:${Qt}#${ee.commit}:${ee.skill_path}`:`github:${Qt}#${ee.commit}`,console.info(` ${u.green("\u2713")} Selected: ${u.bold(`${ee.author}/${ee.name}`)} @ ${ee.commit.slice(0,7)}`)}else Sr(i)?(C(`Skill "${i}" not found in the registry.`),I.length>0&&console.error(`
|
|
556
|
+
Did you mean: ${I.map(L=>u.cyan(L)).join(", ")}?`),process.exit(1)):(console.info(` ${u.dim("Not found in registry \u2014 trying existing sources...")}`),r="pre-indexed")}console.info(l("Parsing source"));let d=Oe(i),f=!!d.isLocal;if(f){let v=d.localPath;console.info(` ${u.dim(`local: ${v}`)}`);let{stat:S}=await import("fs/promises");try{if(!(await S(v)).isDirectory())throw new Error(`Path is not a directory: ${v}`)}catch(I){throw I.code==="ENOENT"?new Error(`Path does not exist: ${v}`):I}}else await Me(),d=await ns(d),console.info(` ${u.dim(i)}`);if(e.flags.method==="vercel"){console.info(l("Installing via Vercel skills CLI")),await Lo();let v=Oo(d),S=e.flags.path||null;console.info(` ${u.dim(`npx skills add ${v}${S?` --skill ${S}`:""}`)}`);let{stdout:I,stderr:L}=await Ro(v,S);I.trim()&&console.info(` ${u.dim(I.trim())}`),L.trim()&&console.error(` ${u.dim(L.trim())}`),console.info(` ${u.green("\u2713")} Vercel skills CLI install completed`),e.flags.force=!0,console.info(` ${u.dim("Continuing with asm install to register in local inventory...")}`)}console.info(l("Selecting provider"));let p=await q(),{provider:h,allProviders:g}=await ze(p,e.flags.provider,!!process.stdin.isTTY);console.info(l("Selecting scope"));let m;if(e.flags.scope==="global"||e.flags.scope==="project")m=e.flags.scope,console.info(` ${u.dim(`scope: ${m}`)}${m==="global"?` (${h.global})`:` (${h.project})`}`);else if(!process.stdin.isTTY||e.flags.yes)m="global",console.info(` ${u.dim("scope: global (default)")} (${h.global})`);else{let v=[{label:`Global (${h.global})`,hint:"Available in all projects",checked:!0},{label:`Project (${h.project})`,hint:"Available only in this project",checked:!1}];console.info("");let S=await We({items:v});if(S.length===0)throw new Error("No scope selected. Aborting.");m=S[0]===0?"global":"project",console.info(` Selected: ${u.bold(m)} ${u.dim(`(${m==="global"?h.global:h.project})`)}`)}if(f)console.info(l("Reading local source")),console.info(` ${u.dim(d.localPath)}`),n=null;else{console.info(l("Cloning repository"));let v=e.flags.transport,S=v==="ssh"?d.sshCloneUrl:v==="https"?d.cloneUrl:`${d.cloneUrl} ${u.dim("(auto)")}`;console.info(` ${S}${d.ref?` ${u.dim(`(ref: ${d.ref})`)}`:""}${d.subpath?` ${u.dim(`(path: ${d.subpath})`)}`:""}`),n=await De(d,v)}let y=f?d.localPath:n;console.info(l("Scanning for skills"));let{join:b}=await import("path"),w=[],$=e.flags.path||d.subpath,x=[];if($){let v=b(y,$);try{await _e(v)}catch{throw new Error(`No SKILL.md found at path "${$}" in the repository.`)}console.info(` Found skill at ${u.bold($)}`),x=[{skillDir:v,nameOverride:e.flags.name}]}else{let v=!1;try{await _e(y),v=!0}catch{}if(v){let S=await _e(y);console.info(` Found: ${u.bold(S.name)} v${S.version}`),x=[{skillDir:y,nameOverride:e.flags.name}]}else{console.info(" No SKILL.md at root. Scanning subdirectories...");let S=await rs(y);if(S.length===0)throw new Error("No skills found in this repository. Skills must have a SKILL.md file.");console.info(` Found ${u.bold(String(S.length))} skill(s):
|
|
557
|
+
`);for(let T=0;T<S.length;T++){let K=u.cyan(` ${String(T+1).padStart(String(S.length).length)})`);console.info(`${K} ${u.bold(S[T].name)} ${u.dim(`v${S[T].version}`)} ${u.dim(`(${S[T].relPath})`)}`),S[T].description&&console.info(` ${u.dim(S[T].description)}`)}console.info(l("Selecting skills")),a--;let I;if(e.flags.all&&(e.flags.yes||!process.stdin.isTTY))I=S.map(T=>T.relPath),console.info(` Selected all ${u.bold(String(I.length))} skills`);else if(process.stdin.isTTY)if(S.length===1)I=[S[0].relPath],console.info(` Auto-selected: ${u.bold(S[0].name)} ${u.dim(`v${S[0].version}`)}`);else{let T=S.map(U=>({label:U.name,hint:`v${U.version}${U.description?" "+U.description:""}`,checked:!!e.flags.all}));console.info("");let K=await We({items:T});if(K.length===0)throw new Error("No skills selected. Aborting.");I=K.map(U=>S[U].relPath),console.info(` Selected ${u.bold(String(I.length))} skill(s)`)}else{C(`Repository contains ${S.length} skills. Use --path <subdir> to pick one or --all to install all.
|
|
540
558
|
Available skills:
|
|
541
|
-
${
|
|
542
|
-
`)}`),process.exit(2);return}let
|
|
543
|
-
`),
|
|
544
|
-
${
|
|
545
|
-
Choose one path per skill name or install with --path.`);throw
|
|
546
|
-
${
|
|
547
|
-
${
|
|
548
|
-
${
|
|
549
|
-
Done! Installed "${
|
|
550
|
-
${
|
|
559
|
+
${S.map(T=>` --path ${T.relPath}`).join(`
|
|
560
|
+
`)}`),process.exit(2);return}let L=Po(I);if(L.length>0){let T=L.map(U=>` - ${U.name}: ${U.paths.map(ee=>`"${ee}"`).join(", ")}`).join(`
|
|
561
|
+
`),K=new Error(`Duplicate skill names detected in selection:
|
|
562
|
+
${T}
|
|
563
|
+
Choose one path per skill name or install with --path.`);throw K.duplicates=L,K}x=I.map(T=>({skillDir:b(y,T),nameOverride:I.length===1?e.flags.name:null})),a++}}console.info(l("Inspecting skills"));let k=await Q(p,"both"),E=[],O=x.length>1;for(let v=0;v<x.length;v++){let{skillDir:S,nameOverride:I}=x[v],L=await Zw(e,d,y,S,I,p,h,k,m);E.push(L),ev(L,i,h,g,O,O?{index:v+1,total:x.length}:void 0)}if(O){console.info(""),console.info(` ${u.bold("Install settings:")}`),console.info(` ${u.bold("Source:")} ${i}`),console.info(g?` ${u.bold("Tool:")} All (${g.map(T=>T.label).join(", ")})`:` ${u.bold("Tool:")} ${h.label} (${h.name})`),console.info(` ${u.bold("Scope:")} ${m==="project"?"Project":"Global"}`);let v=E.filter(T=>T.riskLevel==="high").length,S=E.filter(T=>T.riskLevel==="medium").length,I=E.filter(T=>T.riskLevel==="safe").length,L=[];I>0&&L.push(u.green(`${I} Safe`)),S>0&&L.push(u.yellow(`${S} Medium Risk`)),v>0&&L.push(u.red(`${v} High Risk`)),console.info(` ${u.bold("Risk:")} ${L.join(", ")}`)}if(console.info(l("Installing")),!e.flags.yes){let v=E.some(T=>T.riskLevel==="high");process.stdin.isTTY||(C("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2));let S=O?`${E.length} skills`:`"${E[0].metadata.name}"`,I=v?`
|
|
564
|
+
${u.red("[!]")} ${u.bold(`Install ${S}? Some have high-risk patterns.`)} [y/N] `:`
|
|
565
|
+
${u.bold(`Install ${S}?`)} [Y/n] `;process.stderr.write(I);let L=await G();v?L.toLowerCase()!=="y"&&L.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0)):(L.toLowerCase()==="n"||L.toLowerCase()==="no")&&(console.error("Aborted."),process.exit(0))}let P=n?await yo(n):null,M=[];for(let v=0;v<E.length;v++){let S=E[v],I=O?u.dim(`[${v+1}/${E.length}]`)+" ":" ";try{console.info(`${I}Installing ${u.bold(S.metadata.name)}...`);let L=await tv(S.plan,g);w.push(L),console.info(`${I}${u.green("\u2713")} ${S.metadata.name} installed to ${u.dim(S.plan.targetDir)}`);try{let T=f?`local:${d.localPath}`:`github:${d.owner}/${d.repo}`,K=f?"local":r==="registry"?"registry":"github";await ht(L.name,{source:T,commitHash:P||"unknown",ref:d.ref||"main",installedAt:new Date().toISOString(),provider:S.plan.providerName,sourceType:K,...r==="registry"?{registryName:L.name}:{}})}catch{}}catch(L){M.push({name:S.metadata.name,error:L.message}),console.error(`${I}${u.red("\u2717")} ${u.bold(S.metadata.name)} \u2014 ${u.red(L.message)}`)}}if(process.removeListener("SIGINT",c),process.removeListener("SIGTERM",c),M.length>0){console.error(`
|
|
566
|
+
${u.yellow(`${M.length} skill(s) failed to install:`)}`);for(let v of M)console.error(` ${u.red("\u2717")} ${v.name}: ${v.error}`)}if(e.flags.machine){t?.();let v=w.map(S=>({name:S.name,path:S.path,version:S.version,provider:S.provider,source:S.source,resolution_source:r}));console.log(Y("install",v.length===1?v[0]:v,s))}else if(e.flags.json){let v=w.map(S=>({...S,resolutionSource:r}));console.log(JSON.stringify(v.length===1?v[0]:v,null,2))}else w.length===1?console.error(u.green(`
|
|
567
|
+
Done! Installed "${w[0].name}" to ${w[0].path}`)):w.length>0&&console.error(`
|
|
568
|
+
${u.green(`Done! Installed ${w.length} skill(s) successfully.`)}`)}catch(d){if(process.removeListener("SIGINT",c),process.removeListener("SIGTERM",c),e.flags.machine)t?.(),console.log(z("install",W.INSTALL_FAILED,d.message,s,d?.duplicates?{duplicates:d.duplicates}:void 0));else if(e.flags.json){let f={success:!1,error:d.message};d?.duplicates&&(f.duplicates=d.duplicates),console.log(JSON.stringify(f,null,2))}else C(d.message);process.exit(1)}finally{n&&await ne(n),t?.()}}function iv(){console.log(`${u.bold("Usage:")} asm export [options]
|
|
551
569
|
|
|
552
570
|
Export skill inventory as a portable JSON manifest. Useful for backup,
|
|
553
571
|
sharing, or scripting.
|
|
554
572
|
|
|
555
|
-
${
|
|
573
|
+
${u.bold("Options:")}
|
|
556
574
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
557
575
|
--no-color Disable ANSI colors
|
|
558
576
|
-V, --verbose Show debug output
|
|
559
577
|
|
|
560
|
-
${
|
|
561
|
-
asm export ${
|
|
562
|
-
asm export -s global ${
|
|
563
|
-
asm export > skills.json ${
|
|
578
|
+
${u.bold("Examples:")}
|
|
579
|
+
asm export ${u.dim("Export all skills")}
|
|
580
|
+
asm export -s global ${u.dim("Export global skills only")}
|
|
581
|
+
asm export > skills.json ${u.dim("Save to file")}`)}async function nv(e){if(e.flags.help){iv();return}let t=await q(),s=await Q(t,e.flags.scope),i=Ic(s);console.log(JSON.stringify(i,null,2))}function rv(){console.log(`${u.bold("Usage:")} asm import <file> [options]
|
|
564
582
|
|
|
565
583
|
Import skills from a previously exported JSON manifest. Recreates skill
|
|
566
584
|
installations based on the manifest metadata.
|
|
567
585
|
|
|
568
586
|
Skills that already exist at the target location are skipped unless --force
|
|
569
587
|
is used. Skills whose source files cannot be found locally are reported as
|
|
570
|
-
failed
|
|
588
|
+
failed \u2014 install them first with "asm install".
|
|
571
589
|
|
|
572
|
-
${
|
|
590
|
+
${u.bold("Options:")}
|
|
573
591
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
574
592
|
-f, --force Overwrite existing skills
|
|
575
593
|
-y, --yes Skip confirmation prompt
|
|
@@ -577,102 +595,115 @@ ${U.bold("Options:")}
|
|
|
577
595
|
--no-color Disable ANSI colors
|
|
578
596
|
-V, --verbose Show debug output
|
|
579
597
|
|
|
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 ${
|
|
598
|
+
${u.bold("Examples:")}
|
|
599
|
+
asm import skills.json ${u.dim("Import from manifest")}
|
|
600
|
+
asm import skills.json --force ${u.dim("Overwrite existing skills")}
|
|
601
|
+
asm import skills.json -s global ${u.dim("Import only global skills")}
|
|
602
|
+
asm export > backup.json ${u.dim("Export first, then import later")}
|
|
603
|
+
asm import backup.json ${u.dim("Restore from backup")}`)}async function ov(e){if(e.flags.help){rv();return}let t=e.subcommand;t||(C("Missing required argument: <file>"),console.error('Run "asm import --help" for usage.'),process.exit(2));let{resolve:s}=await import("path"),i=s(t),n;try{n=await Tc(i)}catch(l){C(l.message),process.exit(1)}let r=n.skills.length;if(r===0){e.flags.json?console.log(JSON.stringify({total:0,installed:0,skipped:0,failed:0,results:[]},null,2)):console.log("Manifest contains no skills. Nothing to import.");return}let o=e.flags.scope==="both"?"all scopes":e.flags.scope;if(console.error(`${u.bold("Importing")} ${r} skill${r>1?"s":""} from ${u.dim(i)}`),console.error(` Scope filter: ${o}`),e.flags.force&&console.error(` ${u.yellow("Force mode: existing skills will be overwritten")}`),!e.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
604
|
+
${u.bold("Proceed?")} [y/N] `);let l=await G();l.toLowerCase()!=="y"&&l.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let a=await Mc(n,{force:e.flags.force,dryRun:!1,scopeFilter:e.flags.scope});if(e.flags.json){console.log(JSON.stringify(a,null,2));return}if(a.total===0){console.error(`
|
|
605
|
+
Nothing to import after scope filtering (--scope ${e.flags.scope}). All skills in the manifest were excluded.`);return}console.error("");for(let l of a.results){let c=l.status==="installed"?u.green("+++"):l.status==="skipped"?u.yellow("---"):l.status==="dry-run"?u.cyan("~~~"):u.red("!!!"),d=l.reason?` ${u.dim(l.reason)}`:"",f=l.path?` ${u.dim(l.path)}`:"";console.error(` ${c} ${l.skillName} (${l.provider}/${l.scope})${d}${f}`)}console.error(""),console.error(`${u.bold("Summary:")} ${a.total} total, ${u.green(String(a.installed))} installed, ${u.yellow(String(a.skipped))} skipped, ${u.red(String(a.failed))} failed`),a.failed>0&&(process.exitCode=1)}function av(){console.log(`${u.bold("Usage:")} asm init <name> [options]
|
|
588
606
|
|
|
589
607
|
Scaffold a new skill directory with a SKILL.md template. Creates a
|
|
590
608
|
ready-to-edit skill in the target tool's skill folder.
|
|
591
609
|
|
|
592
|
-
${
|
|
610
|
+
${u.bold("Options:")}
|
|
593
611
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
594
612
|
--path <dir> Scaffold in specified directory instead of provider path
|
|
595
613
|
-f, --force Overwrite if skill already exists
|
|
596
614
|
--no-color Disable ANSI colors
|
|
597
615
|
-V, --verbose Show debug output
|
|
598
616
|
|
|
599
|
-
${
|
|
600
|
-
asm init my-skill ${
|
|
601
|
-
asm init my-skill -p claude ${
|
|
602
|
-
asm init my-skill --path ./skills ${
|
|
603
|
-
${
|
|
617
|
+
${u.bold("Examples:")}
|
|
618
|
+
asm init my-skill ${u.dim("Scaffold (interactive tool)")}
|
|
619
|
+
asm init my-skill -p claude ${u.dim("Scaffold in Claude Code")}
|
|
620
|
+
asm init my-skill --path ./skills ${u.dim("Scaffold in custom directory")}`)}async function lv(e){if(e.flags.help){av();return}let t=e.subcommand;t||(C("Missing required argument: <name>"),console.error('Run "asm init --help" for usage.'),process.exit(2));let s=Te(t),i;if(e.flags.path){let{resolve:n}=await import("path");i=n(e.flags.path)}else{let n=await q(),{provider:r}=await ze(n,e.flags.provider,!!process.stdin.isTTY),{join:o}=await import("path"),{resolveProviderPath:a}=await import("./config-55HAAFSH.js"),l=a(n.providers.find(c=>c.name===r.name).global);i=o(l,s)}if(await _c(i)&&!e.flags.force){process.stdin.isTTY||(C(`Directory already exists: ${i}. Use --force to overwrite.`),process.exit(2)),process.stderr.write(`${u.yellow(`Directory already exists: ${i}`)}
|
|
621
|
+
${u.bold("Overwrite?")} [y/N] `);let n=await G();n.toLowerCase()!=="y"&&n.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}await Dc(s,i),console.error(u.green(`Done! Created skill "${s}" at ${i}`))}function cv(){console.log(`${u.bold("Usage:")} asm stats [options]
|
|
604
622
|
|
|
605
623
|
Show aggregate skill metrics with provider distribution charts,
|
|
606
624
|
scope breakdown, disk usage, and duplicate summary.
|
|
607
625
|
|
|
608
|
-
${
|
|
626
|
+
${u.bold("Options:")}
|
|
609
627
|
--json Output as JSON
|
|
610
628
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
611
629
|
--no-color Disable ANSI colors
|
|
612
630
|
-V, --verbose Show debug output
|
|
613
631
|
|
|
614
|
-
${
|
|
615
|
-
asm stats ${
|
|
616
|
-
asm stats -s global ${
|
|
617
|
-
asm stats --json ${
|
|
632
|
+
${u.bold("Examples:")}
|
|
633
|
+
asm stats ${u.dim("Show full dashboard")}
|
|
634
|
+
asm stats -s global ${u.dim("Global skills only")}
|
|
635
|
+
asm stats --json ${u.dim("Output raw data as JSON")}`)}async function uv(e){if(e.flags.help){cv();return}let t=await q(),s=await Q(t,e.flags.scope);if(s.length===0){console.log("No skills found.");return}let i=Ii(s),n=await Fc(s,i);if(e.flags.json)if(e.flags.verbose)console.log(J(n));else{let{perSkillDiskBytes:r,...o}=n;console.log(J(o))}else console.log(jc(n))}function fv(){console.log(`${u.bold("Usage:")} asm doctor [options]
|
|
618
636
|
|
|
619
637
|
Run environment health checks and diagnostics. Validates all
|
|
620
|
-
prerequisites for using asm
|
|
638
|
+
prerequisites for using asm \u2014 git, GitHub CLI, Node.js, config,
|
|
621
639
|
lock file, registry, installed skills, and disk space.
|
|
622
640
|
|
|
623
|
-
${
|
|
641
|
+
${u.bold("Options:")}
|
|
624
642
|
--json Output as JSON
|
|
625
643
|
--machine Output in stable machine-readable v1 envelope format
|
|
626
644
|
--no-color Disable ANSI colors
|
|
627
645
|
-V, --verbose Show debug output
|
|
628
646
|
|
|
629
|
-
${
|
|
630
|
-
asm doctor ${
|
|
631
|
-
asm doctor --json ${
|
|
632
|
-
asm doctor --machine ${
|
|
647
|
+
${u.bold("Examples:")}
|
|
648
|
+
asm doctor ${u.dim("Run all health checks")}
|
|
649
|
+
asm doctor --json ${u.dim("Output as JSON")}
|
|
650
|
+
asm doctor --machine ${u.dim("Machine-readable v1 envelope output")}`)}async function dv(e){if(e.flags.help){fv();return}let t=performance.now(),s=await gu();if(e.flags.machine){let i={checks:s.checks.map(n=>({name:n.name,status:n.status,message:n.message,...n.fix?{fix:n.fix}:{}})),passed:s.passed,warnings:s.warnings,failures:s.failures};console.log(Y("doctor",i,t))}else e.flags.json?console.log(bu(s)):console.log(yu(s));s.failures>0&&process.exit(1)}function pv(){console.log(`${u.bold("Usage:")} asm eval <target> [options]
|
|
633
651
|
|
|
634
652
|
Evaluate a skill's SKILL.md against best practices and produce a scored quality
|
|
635
|
-
report with recommendations. Zero configuration
|
|
653
|
+
report with recommendations. Zero configuration \u2014 just point it at a skill
|
|
636
654
|
directory. Categories: structure, description quality, prompt engineering,
|
|
637
655
|
context efficiency, safety, testability, and naming conventions.
|
|
638
656
|
|
|
639
|
-
|
|
640
|
-
|
|
657
|
+
Accepts a local path, a GitHub shorthand, or a GitHub URL. When the target is a
|
|
658
|
+
collection (no SKILL.md at the root but each immediate child has one), every
|
|
659
|
+
child skill is evaluated and an aggregate summary is printed.
|
|
641
660
|
|
|
642
|
-
${
|
|
661
|
+
${u.bold("Arguments:")}
|
|
662
|
+
target Local path, github:owner/repo[#ref][:subpath], or
|
|
663
|
+
https://github.com/owner/repo[/tree/<ref>/<sub>]
|
|
664
|
+
|
|
665
|
+
${u.bold("Options:")}
|
|
643
666
|
--fix Apply deterministic auto-fixes to SKILL.md (creates .bak)
|
|
644
667
|
--dry-run With --fix, preview the diff without writing
|
|
645
668
|
--json Output report as JSON
|
|
646
669
|
--machine Output in stable machine-readable v1 envelope format
|
|
670
|
+
--concurrency N Cap parallel per-skill evals in batch mode (default: 4)
|
|
671
|
+
--keep Preserve the temp dir used for remote clones
|
|
672
|
+
-t, --transport M Git transport (auto|https|ssh) for remote targets
|
|
647
673
|
--no-color Disable ANSI colors
|
|
648
674
|
-V, --verbose Show debug output
|
|
649
675
|
|
|
650
|
-
${
|
|
651
|
-
asm eval ./my-skill
|
|
652
|
-
asm eval ./
|
|
653
|
-
asm eval
|
|
654
|
-
asm eval
|
|
655
|
-
asm eval
|
|
656
|
-
asm eval
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
676
|
+
${u.bold("Examples:")}
|
|
677
|
+
asm eval ./my-skill ${u.dim("Score a single skill")}
|
|
678
|
+
asm eval ./skills/ ${u.dim("Batch-score every skill in the dir")}
|
|
679
|
+
asm eval github:mattpocock/skills:grill-me ${u.dim("Fetch a remote skill and score it")}
|
|
680
|
+
asm eval github:mattpocock/skills ${u.dim("Batch-score a remote collection")}
|
|
681
|
+
asm eval https://github.com/mattpocock/skills/tree/main/grill-me
|
|
682
|
+
asm eval ./my-skill --json ${u.dim("Output report as JSON")}
|
|
683
|
+
asm eval ./my-skill --fix ${u.dim("Auto-fix deterministic issues")}
|
|
684
|
+
asm eval ./my-skill --fix --dry-run ${u.dim("Preview fixes as diff")}
|
|
685
|
+
asm eval ./my-skill --machine ${u.dim("Machine-readable v1 envelope")}
|
|
686
|
+
asm eval-providers list ${u.dim("List registered eval providers")}`)}function mv(e){let t=e.findings.find(s=>s.severity==="error"&&(s.code==="provider-threw"||s.code==="timeout"||s.code==="aborted"));if(t)throw new Error(t.message)}async function hv(e,t,s){await Me();let i=Oe(e);if(i.isLocal)throw new Error(`fetchRemoteForEval received a local path: "${e}". This is a bug \u2014 local paths should use the non-remote branch.`);i=await ns(i);let n=await De(i,t),r=i.subpath?cf(n,i.subpath):n,o=null;try{let{execFile:c}=await import("child_process"),{promisify:d}=await import("util"),f=d(c),{stdout:p}=await f("git",["-C",n,"rev-parse","HEAD"],{timeout:5e3}),h=p.trim();/^[0-9a-f]{40}$/i.test(h)&&(o=h)}catch{}let a=`github:${i.owner}/${i.repo}${i.ref?`#${i.ref}`:""}${i.subpath?`:${i.subpath}`:""}`;return{rootDir:r,cleanup:async()=>{s||await ne(n)},sourceRef:a,commitSha:o}}async function lf(e){bi();try{let t={skillPath:e.skillPath,skillMdPath:e.skillMdPath},s=(await Promise.all(zt(wi()).map(async r=>(await r.applicable(t,{})).ok?vi(r,t):null))).filter(r=>r!==null),i=s.find(r=>r.providerId==="quality");if(!i)throw new Error("quality provider did not produce a result");return mv(i),{report:{...i.raw,providers:zt(s.map(Wu))},error:null}}catch(t){return{report:null,error:t?.message??String(t)}}}async function gv(e){if(e.flags.help){pv();return}let t=e.flags.machine?Ge():void 0,s=performance.now(),i=e.subcommand;if(i||(e.flags.machine&&(t?.(),console.log(z("eval",W.INVALID_ARGUMENT,"Missing required argument: <skill-path>",s)),process.exit(2)),C("Missing required argument: <skill-path>"),console.error('Run "asm eval --help" for usage.'),process.exit(2)),e.flags.fix){if(Ur(i)){let r="--fix is only supported for local skill paths. Clone the repo first or run `asm install` to materialise it locally.";e.flags.machine&&(t?.(),console.log(z("eval",W.INVALID_ARGUMENT,r,s)),process.exit(2)),C(r),process.exit(2)}try{let r=await Au(),o=await Eu(i,{dryRun:e.flags.dryRun,gitAuthor:r});if(e.flags.machine){t?.(),console.log(Y("eval",mi(o.report,o),s));return}if(e.flags.json){console.log(JSON.stringify({report:o.report,fix:{dryRun:o.dryRun,applied:o.applied,skipped:o.skipped,backupPath:o.backupPath,diff:o.diff}},null,2));return}console.log(pi(o.report)),console.log(""),console.log(Nu(o));return}catch(r){e.flags.machine&&(t?.(),console.log(z("eval",W.SKILL_NOT_FOUND,r?.message??String(r),s)),process.exit(1)),C(r?.message??String(r)),process.exit(1)}return}let n=null;try{n=await Iu(i,{fetchRemote:r=>hv(r,e.flags.transport,e.flags.keep)})}catch(r){e.flags.machine&&(t?.(),console.log(z("eval",W.SKILL_NOT_FOUND,r?.message??String(r),s)),process.exit(1)),C(r?.message??String(r)),process.exit(1)}try{if(!n.isCollection&&n.targets.length===1){let c=n.targets[0],{report:d,error:f}=await lf(c);if(!d)throw new Error(f??"eval failed");if(e.flags.machine){t?.();let p=mi(d,null),h=n.provenance.remote?{...p,provenance:{input:n.provenance.input,remote:!0,source_ref:n.provenance.sourceRef??null,commit_sha:n.provenance.commitSha??null,temp_path:n.provenance.tempPath??null}}:p;console.log(Y("eval",h,s));return}if(e.flags.json){n.provenance.remote?console.log(JSON.stringify({...d,provenance:{input:n.provenance.input,remote:!0,sourceRef:n.provenance.sourceRef??null,commitSha:n.provenance.commitSha??null,tempPath:n.provenance.tempPath??null}},null,2)):console.log(Pu(d));return}console.log(pi(d)),n.provenance.remote&&yv(n.provenance);return}let r=e.flags.concurrency||4;if(n.targets.length===0)throw new Error(`No skills to evaluate at "${i}" \u2014 the resolved location has no SKILL.md in itself or its immediate children.`);let o=await Ru(n.targets,r,async c=>{let{report:d,error:f}=await lf(c);return{label:c.label,skillPath:c.skillPath,report:d,error:f}}),a=Lu(o),l={provenance:n.provenance,aggregate:a,results:o};if(e.flags.machine){t?.(),console.log(Y("eval",Tu(l),s));return}if(e.flags.json){console.log(JSON.stringify({provenance:l.provenance,aggregate:l.aggregate,results:l.results.map(c=>({label:c.label,skillPath:c.skillPath,error:c.error,report:c.report}))},null,2));return}for(let c of l.results)c.report?console.log(pi(c.report)):(console.log(`Skill evaluation: ${c.skillPath}`),console.log(` ${u.red("error:")} ${c.error??"unknown failure"}`)),console.log("");console.log(Ou(l)),n.provenance.remote&&e.flags.verbose}catch(r){e.flags.machine&&(t?.(),console.log(z("eval",W.SKILL_NOT_FOUND,r?.message??String(r),s)),process.exit(1)),C(r?.message??String(r)),process.exit(1)}finally{if(n)try{await n.cleanup()}catch{}}}function yv(e){let t=[];t.push(""),t.push(u.dim("Fetched remote skill:")),e.sourceRef&&t.push(u.dim(` Source: ${e.sourceRef}`)),e.commitSha&&t.push(u.dim(` Commit: ${e.commitSha}`)),e.tempPath&&t.push(u.dim(` Temp: ${e.tempPath}`)),console.log(t.join(`
|
|
687
|
+
`))}function bv(){console.log(`${u.bold("Usage:")} asm eval-providers <subcommand> [options]
|
|
688
|
+
|
|
689
|
+
Manage evaluation providers registered with the ${u.bold("asm eval")} framework.
|
|
690
|
+
Providers implement the ${u.bold("EvalProvider")} contract (see src/eval/types.ts) and
|
|
660
691
|
are resolved by id and semver range.
|
|
661
692
|
|
|
662
|
-
${
|
|
693
|
+
${u.bold("Subcommands:")}
|
|
663
694
|
list List every registered (id, version) provider
|
|
664
695
|
|
|
665
|
-
${
|
|
696
|
+
${u.bold("Options:")}
|
|
666
697
|
--json Output as JSON (list)
|
|
667
698
|
--no-color Disable ANSI colors
|
|
668
699
|
-V, --verbose Show debug output
|
|
669
700
|
|
|
670
|
-
${
|
|
671
|
-
asm eval-providers list ${
|
|
672
|
-
asm eval-providers list --json ${
|
|
701
|
+
${u.bold("Examples:")}
|
|
702
|
+
asm eval-providers list ${u.dim("Show registered providers")}
|
|
703
|
+
asm eval-providers list --json ${u.dim("Machine-readable listing")}`)}async function wv(e){if(e.flags.help){bv();return}let t=e.subcommand;switch(t||(C("Missing subcommand. Use: list"),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2)),t){case"list":{bi();let s=hi();if(e.flags.json){console.log(J(s.map(a=>({id:a.id,version:a.version,schemaVersion:a.schemaVersion,description:a.description,requires:a.requires??[]}))));return}if(s.length===0){console.log("No eval providers registered.");return}let i=["id","version","schemaVersion","description","requires"],n=s.map(a=>[a.id,a.version,String(a.schemaVersion),a.description,a.requires&&a.requires.length>0?a.requires.join(","):"-"]),r=i.map((a,l)=>Math.max(a.length,...n.map(c=>c[l].length))),o=a=>a.map((l,c)=>l.padEnd(r[c])).join(" ");console.log(u.bold(o(i))),console.log(r.map(a=>"-".repeat(a)).join(" "));for(let a of n)console.log(o(a));return}default:C(`Unknown eval-providers subcommand: "${t}". Use: list`),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2)}}function vv(){console.log(`${u.bold("Usage:")} asm link <path> [<path2> ...] [options]
|
|
673
704
|
|
|
674
705
|
Symlink a local skill directory into an agent's skill folder. Useful
|
|
675
|
-
for local development
|
|
706
|
+
for local development \u2014 changes to the source are reflected immediately.
|
|
676
707
|
|
|
677
708
|
If <path> contains a SKILL.md at its root, it is linked as a single skill.
|
|
678
709
|
If <path> has no root SKILL.md but contains subdirectories with SKILL.md
|
|
@@ -680,7 +711,7 @@ files, all discovered skills are linked in a single invocation.
|
|
|
680
711
|
|
|
681
712
|
Multiple paths can be provided to link several skills at once.
|
|
682
713
|
|
|
683
|
-
${
|
|
714
|
+
${u.bold("Options:")}
|
|
684
715
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
685
716
|
--name <name> Override symlink name (single skill only)
|
|
686
717
|
-f, --force Overwrite if target already exists
|
|
@@ -688,28 +719,28 @@ ${U.bold("Options:")}
|
|
|
688
719
|
--no-color Disable ANSI colors
|
|
689
720
|
-V, --verbose Show debug output
|
|
690
721
|
|
|
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
|
-
${
|
|
702
|
-
Done! Linked ${
|
|
722
|
+
${u.bold("Examples:")}
|
|
723
|
+
asm link ./my-skill ${u.dim("Link (interactive tool)")}
|
|
724
|
+
asm link ./my-skill -p claude ${u.dim("Link to Claude Code")}
|
|
725
|
+
asm link ./my-skill --name alias ${u.dim("Link with custom name")}
|
|
726
|
+
asm link ./my-skills-folder ${u.dim("Link all skills in folder")}
|
|
727
|
+
asm link ./skill1 ./skill2 ./skill3 -p claude ${u.dim("Link multiple skills at once")}`)}async function kv(e,t){if(t)return!0;let{access:s}=await import("fs/promises"),i=!1;try{await s(e),i=!0}catch{}if(!i)return!1;if(!process.stdin.isTTY)throw new Error(`Target already exists: ${e}. Use --force to overwrite.`);process.stderr.write(`${u.yellow(`Target already exists: ${e}`)}
|
|
728
|
+
${u.bold("Overwrite?")} [y/N] `);let n=await G();return n.toLowerCase()!=="y"&&n.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0)),!0}async function xi(e,t,s,i){let{join:n}=await import("path"),r=n(t,s),o=await kv(r,i);return await Uc(e,t,s,o),{name:s,symlinkPath:r,targetPath:e}}async function Sv(e){if(e.flags.help){vv();return}let t=[];if(e.subcommand&&t.push(e.subcommand),t.push(...e.positional),t.length===0&&(C("Missing required argument: <path>"),console.error('Run "asm link --help" for usage.'),process.exit(2)),t.length>1){e.flags.name&&(C("--name cannot be used when linking multiple paths. Link each skill individually to use --name."),process.exit(2));let g=await q(),{provider:m}=await ze(g,e.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:y}=await import("./config-55HAAFSH.js"),b=y(g.providers.find(E=>E.name===m.name).global),{resolve:w,basename:$}=await import("path"),x=[],k=[];for(let E of t){let O=w(E),P=!1;try{await Er(O),P=!0}catch{}if(P){let M=$(O);try{let v=await xi(O,b,M,!!e.flags.force);x.push(v),e.flags.json||console.error(u.green(` Linked "${v.name}" -> ${v.targetPath}`))}catch(v){let S=v instanceof Error?v.message:String(v);k.push({name:M,error:S}),e.flags.json||console.error(u.red(` Failed to link "${M}": ${S}`))}}else{let M=[];try{M=await Ar(O)}catch(v){let S=v instanceof Error?v.message:String(v);k.push({name:E,error:S}),e.flags.json||console.error(u.red(` Failed to process "${E}": ${S}`));continue}if(M.length===0){let v=`No SKILL.md found in ${O} or its immediate subdirectories.`;k.push({name:E,error:v}),e.flags.json||console.error(u.red(` ${v}`));continue}for(let v of M)try{let S=await xi(v.absPath,b,v.dirName,!!e.flags.force);x.push(S),e.flags.json||console.error(u.green(` Linked "${S.name}" -> ${S.targetPath}`))}catch(S){let I=S instanceof Error?S.message:String(S);k.push({name:v.name,error:I}),e.flags.json||console.error(u.red(` Failed to link "${v.name}": ${I}`))}}}e.flags.json?console.log(J({success:k.length===0,linked:x,failures:k})):k.length>0?console.error(u.yellow(`
|
|
729
|
+
${x.length} linked, ${k.length} failed.`)):console.error(u.green(`
|
|
730
|
+
Done! Linked ${x.length} skill(s) successfully.`)),k.length>0&&process.exit(1);return}let s=t[0],{resolve:i,basename:n}=await import("path"),r=i(s),o=!1;try{await Er(r),o=!0}catch{}let a=[];o||(a=await Ar(r),a.length===0&&(C(`No SKILL.md found in ${r} or its immediate subdirectories.`),process.exit(1)),e.flags.name&&a.length>1&&(C(`--name cannot be used when linking multiple skills (found ${a.length} skills). Link each skill individually to use --name.`),process.exit(2)));let l=await q(),{provider:c}=await ze(l,e.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:d}=await import("./config-55HAAFSH.js"),f=d(l.providers.find(g=>g.name===c.name).global);if(o){let g=e.flags.name?Te(e.flags.name):n(r),m;try{m=await xi(r,f,g,!!e.flags.force)}catch(y){let b=y instanceof Error?y.message:String(y);e.flags.json?console.log(J({success:!1,error:b})):C(b),process.exit(2)}e.flags.json?console.log(J({success:!0,...m})):(console.error(u.green(`Done! Linked "${m.name}" -> ${m.targetPath}`)),console.error(` Symlink: ${m.symlinkPath}`),console.error(u.dim(` If you move or delete the source, run "asm uninstall ${m.name}" to clean up.`)));return}console.error(`Found ${u.bold(String(a.length))} skill(s) in ${r}:`);for(let g of a)console.error(` ${u.bold(g.name)} ${u.dim(`v${g.version}`)} ${u.dim(`(${g.dirName}/)`)}`);if(process.stdin.isTTY&&!e.flags.force){process.stderr.write(`
|
|
731
|
+
${u.bold(`Link ${a.length} skill(s)?`)} [Y/n] `);let g=await G();(g.toLowerCase()==="n"||g.toLowerCase()==="no")&&(console.error("Aborted."),process.exit(0))}let p=[],h=[];for(let g of a){let m=e.flags.name&&a.length===1?Te(e.flags.name):g.dirName;try{let y=await xi(g.absPath,f,m,!!e.flags.force);p.push(y),e.flags.json||console.error(u.green(` Linked "${y.name}" -> ${y.targetPath}`))}catch(y){let b=y instanceof Error?y.message:String(y);h.push({name:g.name,error:b}),e.flags.json||console.error(u.red(` Failed to link "${g.name}": ${b}`))}}e.flags.json?console.log(J({success:h.length===0,linked:p,failures:h})):h.length>0?console.error(u.yellow(`
|
|
732
|
+
${p.length} linked, ${h.length} failed.`)):console.error(u.green(`
|
|
733
|
+
Done! Linked ${p.length} skill(s) successfully.`)),h.length>0&&process.exit(1)}function $v(){console.log(`${u.bold("Usage:")} asm index <subcommand> [options]
|
|
703
734
|
|
|
704
735
|
Manage the skill index for searching available skills from indexed repos.
|
|
705
736
|
|
|
706
|
-
${
|
|
737
|
+
${u.bold("Subcommands:")}
|
|
707
738
|
ingest <repo> Ingest a skill repository into the index
|
|
708
739
|
search <query> Search indexed skills by name or description
|
|
709
740
|
list List all indexed repositories
|
|
710
741
|
remove <owner/repo> Remove a repo from the index
|
|
711
742
|
|
|
712
|
-
${
|
|
743
|
+
${u.bold("Options:")}
|
|
713
744
|
--json Output as JSON
|
|
714
745
|
--has <field> Only show skills that have <field> (license, creator, version)
|
|
715
746
|
--missing <field> Only show skills missing <field> (license, creator, version)
|
|
@@ -717,49 +748,59 @@ ${U.bold("Options:")}
|
|
|
717
748
|
--no-color Disable ANSI colors
|
|
718
749
|
-V, --verbose Show debug output
|
|
719
750
|
|
|
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
|
|
728
|
-
`)}}break}case"list":{let
|
|
729
|
-
`));for(let
|
|
751
|
+
${u.bold("Examples:")}
|
|
752
|
+
asm index ingest github:obra/superpowers ${u.dim("Index superpowers repo")}
|
|
753
|
+
asm index search code review ${u.dim("Search for skills")}
|
|
754
|
+
asm index search marketing --has license ${u.dim("Only with license")}
|
|
755
|
+
asm index search "" --missing creator ${u.dim("Skills missing creator")}
|
|
756
|
+
asm index list ${u.dim("List indexed repos")}
|
|
757
|
+
asm index remove obra/superpowers ${u.dim("Remove from index")}`)}async function xv(e){if(e.flags.help){$v();return}let t=e.subcommand;switch(t||(C("Missing subcommand. Use: ingest, search, list, or remove"),console.error('Run "asm index --help" for usage.'),process.exit(2)),t){case"ingest":{let s=e.positional[0];s||(C("Missing required argument: <repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2)),console.error(u.blueBold(`Ingesting ${s}...`));let i=await rf(s);i.success||(C(`Failed to ingest: ${i.error}`),process.exit(1)),i.repoIndex&&(e.flags.json?console.log(J({success:!0,owner:i.repoIndex.owner,repo:i.repoIndex.repo,skillCount:i.repoIndex.skillCount,updatedAt:i.repoIndex.updatedAt})):(console.error(u.green(`Successfully indexed ${i.repoIndex.owner}/${i.repoIndex.repo}`)),console.error(` Skills found: ${i.repoIndex.skillCount}`)));break}case"search":{let s=e.positional.join(" ");!s&&e.flags.has.length===0&&e.flags.missing.length===0&&(C("Missing required argument: <query>"),console.error('Run "asm index --help" for usage.'),process.exit(2));let i={};e.flags.has.length>0&&(i.has=e.flags.has),e.flags.missing.length>0&&(i.missing=e.flags.missing);let r=i.has||i.missing?await Si(s||"",20,i):await Si(s);if(r.length===0){e.flags.json?console.log(J([])):(console.info("No skills found matching your query."),console.error(u.dim("Try ingesting more repos with: asm index ingest <repo>")));return}if(e.flags.json)console.log(J(r.map(o=>({name:o.skill.name,description:o.skill.description,version:o.skill.version,license:o.skill.license||"",creator:o.skill.creator||"",compatibility:o.skill.compatibility||"",allowedTools:o.skill.allowedTools||[],verified:o.skill.verified===!0,installUrl:o.skill.installUrl,installCommand:`asm install ${o.skill.installUrl}`,repo:`${o.repo.owner}/${o.repo.repo}`}))));else{console.error(u.bold(`Found ${r.length} skills:
|
|
758
|
+
`));for(let o of r){let a=o.skill.verified?u.blue(" [verified]"):"";console.error(`${u.cyan(o.skill.name)} ${u.dim(`v${o.skill.version}`)}${a} ${u.dim(`[${o.repo.owner}/${o.repo.repo}]`)}`);for(let c of ho(o.skill.description,80))console.error(` ${c}`);let l=tf(o.skill);l.length>0&&console.error(` ${u.yellow(`\u26A0 Missing: ${l.join(", ")}`)}`),console.error(` ${u.green(`asm install ${o.skill.installUrl}`)}
|
|
759
|
+
`)}}break}case"list":{let s=await of();if(s.length===0){e.flags.json?console.log(J([])):(console.info("No repositories indexed."),console.error(u.dim("Add repos with: asm index ingest <repo>")));return}let i=await sf();if(e.flags.json)console.log(J(s));else{console.error(u.bold(`Indexed Repositories (${i} total skills):
|
|
760
|
+
`));for(let n of s)console.error(`${u.cyan(`${n.owner}/${n.repo}`)} - ${n.skillCount} skills ${u.dim(`(${new Date(n.updatedAt).toLocaleDateString()})`)}`)}break}case"remove":{let s=e.positional[0];s||(C("Missing required argument: <owner/repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2));let[i,n]=s.split("/");if((!i||!n)&&(C("Invalid format. Use: <owner/repo>"),process.exit(2)),!e.flags.yes&&process.stdin.isTTY){process.stderr.write(`${u.bold("Remove")} ${u.cyan(`${i}/${n}`)} ${u.bold("from index?")} [y/N] `);let o=await G();o.toLowerCase()!=="y"&&o.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}await af(i,n)?console.error(u.green(`Removed ${i}/${n} from index`)):(C(`Repository not found in index: ${i}/${n}`),process.exit(1));break}default:C(`Unknown subcommand: "${t}"`),console.error('Run "asm index --help" for usage.'),process.exit(2)}}function Cv(){console.log(`${u.bold("Usage:")} asm bundle <subcommand> [options]
|
|
730
761
|
|
|
731
762
|
Create, install, and manage curated skill bundles. A bundle is a reusable
|
|
732
763
|
recipe of skills for a particular workflow, domain, or project setup.
|
|
733
764
|
|
|
734
|
-
${
|
|
765
|
+
${u.bold("Subcommands:")}
|
|
735
766
|
create <name> Create a new bundle from installed skills
|
|
736
|
-
install <name|file> Install all skills from a bundle
|
|
767
|
+
install <name|file> Install all skills from a bundle (supports pre-defined names)
|
|
737
768
|
list List all saved bundles
|
|
769
|
+
list --predefined List pre-defined bundles shipped with ASM
|
|
738
770
|
show <name|file> Show bundle details
|
|
739
771
|
remove <name> Remove a saved bundle
|
|
772
|
+
modify <name> Add/remove skills or update bundle metadata
|
|
773
|
+
export <name> [file] Export a bundle to a JSON file
|
|
740
774
|
|
|
741
|
-
${
|
|
775
|
+
${u.bold("Options:")}
|
|
742
776
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
743
777
|
-y, --yes Skip confirmation prompts
|
|
744
778
|
--json Output as JSON
|
|
779
|
+
--predefined Show pre-defined bundles shipped with ASM (for list)
|
|
745
780
|
--no-color Disable ANSI colors
|
|
746
781
|
-V, --verbose Show debug output
|
|
747
782
|
|
|
748
|
-
${
|
|
749
|
-
asm bundle create my-workflow ${
|
|
750
|
-
asm bundle install my-workflow ${
|
|
751
|
-
asm bundle install
|
|
752
|
-
asm bundle
|
|
753
|
-
asm bundle list
|
|
754
|
-
asm bundle
|
|
755
|
-
asm bundle
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
${
|
|
762
|
-
`))
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
783
|
+
${u.bold("Examples:")}
|
|
784
|
+
asm bundle create my-workflow ${u.dim("Create from installed skills")}
|
|
785
|
+
asm bundle install my-workflow ${u.dim("Install a saved bundle")}
|
|
786
|
+
asm bundle install frontend-dev ${u.dim("Install a pre-defined bundle")}
|
|
787
|
+
asm bundle install ./bundle.json ${u.dim("Install from file")}
|
|
788
|
+
asm bundle list ${u.dim("Show all saved bundles")}
|
|
789
|
+
asm bundle list --predefined ${u.dim("List pre-defined bundles")}
|
|
790
|
+
asm bundle list --json ${u.dim("List bundles as JSON")}
|
|
791
|
+
asm bundle show my-workflow ${u.dim("Show bundle details")}
|
|
792
|
+
asm bundle remove my-workflow ${u.dim("Remove a saved bundle")}
|
|
793
|
+
asm bundle modify my-workflow --add github:u/r ${u.dim("Add a skill to bundle")}
|
|
794
|
+
asm bundle modify my-workflow --remove skill ${u.dim("Remove a skill from bundle")}
|
|
795
|
+
asm bundle export my-workflow ${u.dim("Export to ./my-workflow.json")}
|
|
796
|
+
asm bundle export my-workflow out.json ${u.dim("Export bundle to file")}`)}async function Ev(e){if(e.flags.help){Cv();return}let t=e.subcommand;switch(t||(C("Missing subcommand. Use: create, install, list, show, remove, modify, or export"),console.error('Run "asm bundle --help" for usage.'),process.exit(2)),t){case"create":{let s=e.positional[0];s||(C("Missing required argument: <name>"),console.error("Usage: asm bundle create <name>"),process.exit(2));let i=await q(),n=await Q(i,e.flags.scope);n.length===0&&(C("No skills found to include in the bundle."),process.exit(1));let r=new Set,o=n.filter(m=>{let y=m.name.toLowerCase();return r.has(y)?!1:(r.add(y),!0)}),a=o;if(process.stdin.isTTY&&!e.flags.yes){let m=o.map(b=>({label:`${b.name} v${b.version}`,hint:b.description?b.description.slice(0,60)+(b.description.length>60?"...":""):`(${b.provider}/${b.scope})`,checked:!0}));console.error(u.bold(`Select skills for bundle "${s}":
|
|
797
|
+
`));let y=await We({items:m});y.length===0&&(C("No skills selected. Bundle not created."),process.exit(1)),a=y.map(b=>o[b])}let{readLock:l}=await import("./lock-SOHBB4N3.js"),c=await l(),d=await Promise.all(a.map(m=>Yc(m,c))),f=`Bundle of ${d.length} skills`,p="unknown";try{let{execSync:m}=await import("child_process"),y=m("git config user.name",{encoding:"utf-8"}).trim();y&&(p=y)}catch{}if(process.stdin.isTTY&&!e.flags.yes){process.stderr.write(`
|
|
798
|
+
${u.bold("Description")} (optional, press Enter to skip): `);let m=await G();m.trim()&&(f=m.trim()),process.stderr.write(`${u.bold("Author")} (optional, press Enter to skip): `);let y=await G();y.trim()&&(p=y.trim())}let h=Hc(s,f,p,d),g=await Nr(h);e.flags.json?console.log(JSON.stringify(h,null,2)):(console.error(u.green(`Bundle "${s}" created with ${d.length} skill(s).`)),console.error(` Saved to: ${u.dim(g)}`));break}case"install":{let s=e.positional[0];s||(C("Missing required argument: <name|file>"),console.error("Usage: asm bundle install <name|file>"),process.exit(2));let i;try{i=await Gt(s)}catch(f){C(f.message),process.exit(1)}console.error(`${u.bold("Bundle:")} ${i.name} (${i.skills.length} skills)`),i.description&&console.error(` ${u.dim(i.description)}`),console.error("");for(let f of i.skills){let p=f.version?` v${f.version}`:"";console.error(` ${u.cyan(f.name)}${u.dim(p)} ${u.dim(`-> ${f.installUrl}`)}`)}if(!e.flags.yes&&process.stdin.isTTY){process.stderr.write(`
|
|
799
|
+
${u.bold("Install all skills from this bundle?")} [y/N] `);let f=await G();f.toLowerCase()!=="y"&&f.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let n=[],r=await q(),{provider:o}=await ze(r,e.flags.provider,!1),a=e.flags.scope==="global"||e.flags.scope==="project"?e.flags.scope:"global";for(let f of i.skills){console.error(`
|
|
800
|
+
Installing ${u.bold(f.name)}...`);try{(f.installUrl.startsWith("github:")||f.installUrl.startsWith("https://github.com/"))&&await Me();let h=Oe(f.installUrl),g=!!h.isLocal,m=null;try{let y,b;g?(y=h.localPath,b=h.localPath):(m=await De(h,e.flags.transport),y=m,b=h.subpath?cf(m,h.subpath):m);let w=await _e(b),$=Te(f.name||w.name||h.repo),x=_i(h,y,b,$,o,e.flags.force,a);try{await To(x.targetDir,x.force)}catch(k){if(k.message?.includes("--force")){n.push({name:f.name,status:"skipped",reason:"Already installed. Use --force to overwrite."}),console.error(` ${u.dim("---")} ${f.name} skipped (already installed)`);continue}throw k}await os(x),n.push({name:f.name,status:"installed"}),console.error(` ${u.green("+++")} ${f.name} installed`)}finally{m&&await ne(m)}}catch(p){n.push({name:f.name,status:"failed",reason:p.message}),console.error(` ${u.red("!!!")} ${f.name}: ${p.message}`)}}let l=n.filter(f=>f.status==="installed").length,c=n.filter(f=>f.status==="skipped").length,d=n.filter(f=>f.status==="failed").length;e.flags.json?console.log(JSON.stringify({bundleName:i.name,total:n.length,installed:l,skipped:c,failed:d,results:n},null,2)):(console.error(""),console.error(`${u.bold("Summary:")} ${n.length} total, ${u.green(String(l))} installed, `+(c>0?`${u.dim(String(c))} skipped, `:"")+`${u.red(String(d))} failed`)),d>0&&(process.exitCode=1);break}case"list":{if(!!e.flags.predefined){let n=await Gc();if(n.length===0){e.flags.json?console.log("[]"):console.log("No predefined bundles found.");return}if(e.flags.json)console.log(JSON.stringify(n,null,2));else{console.error(u.bold(`Pre-defined Bundles (${n.length}):
|
|
801
|
+
`));for(let r of n){let o=r.tags&&r.tags.length>0?` ${u.dim(`[${r.tags.join(", ")}]`)}`:"";console.error(` ${u.cyan(r.name)} ${u.dim(`(${r.skills.length} skills)`)}${o}`),r.description&&console.error(` ${u.dim(r.description)}`)}console.error(`
|
|
802
|
+
${u.dim("Install a bundle with: asm bundle install <name>")}`)}return}let i=await Wc();if(i.length===0){e.flags.json?console.log("[]"):(console.log("No bundles found."),console.error(u.dim("Create one with: asm bundle create <name>")),console.error(u.dim("List pre-defined bundles with: asm bundle list --predefined")));return}if(e.flags.json)console.log(JSON.stringify(i,null,2));else{console.error(u.bold(`Saved Bundles (${i.length}):
|
|
803
|
+
`));for(let n of i){let r=n.tags&&n.tags.length>0?` ${u.dim(`[${n.tags.join(", ")}]`)}`:"";console.error(` ${u.cyan(n.name)} ${u.dim(`(${n.skills.length} skills)`)}${r}`),n.description&&console.error(` ${u.dim(n.description)}`),n.author&&console.error(` ${u.dim(`by ${n.author}`)}`)}}break}case"show":{let s=e.positional[0];s||(C("Missing required argument: <name|file>"),console.error("Usage: asm bundle show <name|file>"),process.exit(2));let i;try{i=await Gt(s)}catch(n){C(n.message),process.exit(1)}if(e.flags.json)console.log(JSON.stringify(i,null,2));else{console.error(u.bold(`Bundle: ${i.name}`)),i.description&&console.error(` ${i.description}`),i.author&&console.error(` ${u.dim(`Author: ${i.author}`)}`),console.error(` ${u.dim(`Created: ${new Date(i.createdAt).toLocaleString()}`)}`),i.tags&&i.tags.length>0&&console.error(` ${u.dim(`Tags: ${i.tags.join(", ")}`)}`),console.error(`
|
|
804
|
+
${u.bold(`Skills (${i.skills.length})`)}:`);for(let n of i.skills){let r=n.version?` v${n.version}`:"";console.error(` ${u.cyan(n.name)}${u.dim(r)}`),n.description&&console.error(` ${u.dim(n.description)}`),console.error(` ${u.dim(`install: ${n.installUrl}`)}`)}}break}case"remove":{let s=e.positional[0];if(s||(C("Missing required argument: <name>"),console.error("Usage: asm bundle remove <name>"),process.exit(2)),!e.flags.yes&&process.stdin.isTTY){process.stderr.write(`${u.bold("Remove bundle")} ${u.cyan(s)}${u.bold("?")} [y/N] `);let n=await G();n.toLowerCase()!=="y"&&n.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let i;try{i=await zc(s)}catch(n){C(n.message),process.exit(1)}i?console.error(u.green(`Bundle "${s}" removed.`)):(C(`Bundle "${s}" not found.`),process.exit(1));break}case"modify":{let s=e.positional[0];s||(C("Missing required argument: <name>"),console.error("Usage: asm bundle modify <name> [--add <installUrl>] [--remove <skillName>] [--description <desc>] [--author <author>] [--tags <tag,...>]"),process.exit(2));let i;try{i=await Gt(s)}catch(f){C(f.message),process.exit(1)}let n=!1,r=e.flags.add;if(r){let f={name:r.split("/").pop()?.replace(/\.json$/,"")??r,installUrl:r};i.skills.push(f),n=!0,console.error(u.green(`Added skill from ${r}`))}let o=e.flags.remove;if(o){let f=i.skills.length;i.skills=i.skills.filter(p=>p.name.toLowerCase()!==o.toLowerCase()),i.skills.length<f?(n=!0,console.error(u.green(`Removed skill "${o}"`))):console.error(u.dim(`Skill "${o}" not found in bundle (no change)`))}let a=e.flags.description;a!==null&&(i.description=a,n=!0);let l=e.flags.author;l!==null&&(i.author=l,n=!0);let c=e.flags.tags;if(c!==null&&(i.tags=c.split(",").map(f=>f.trim()).filter(f=>f.length>0),n=!0),!n&&process.stdin.isTTY&&!e.flags.yes&&!r&&!o&&a===null&&l===null&&c===null){console.error(u.bold(`Modifying bundle "${i.name}"`)),console.error(` Current skills: ${i.skills.map(g=>g.name).join(", ")}`),console.error(` Description: ${i.description}`),console.error(` Author: ${i.author}`),console.error(` Tags: ${i.tags?.join(", ")??"(none)"}`),console.error(""),process.stderr.write(`${u.bold("New description")} (Enter to keep current): `);let f=await G();f.trim()&&(i.description=f.trim(),n=!0),process.stderr.write(`${u.bold("New author")} (Enter to keep current): `);let p=await G();p.trim()&&(i.author=p.trim(),n=!0),process.stderr.write(`${u.bold("New tags (comma-separated)")} (Enter to keep current): `);let h=await G();h.trim()&&(i.tags=h.split(",").map(g=>g.trim()).filter(g=>g.length>0),n=!0)}if(!n){console.error(u.dim("No changes made to bundle."));break}i.skills.length===0&&(C("Bundle must contain at least one skill after modification."),process.exit(1));let d=await Nr(i);e.flags.json?console.log(JSON.stringify(i,null,2)):(console.error(u.green(`Bundle "${i.name}" updated (${i.skills.length} skill(s)).`)),console.error(` Saved to: ${u.dim(d)}`));break}case"export":{let s=e.positional[0];s||(C("Missing required argument: <name>"),console.error("Usage: asm bundle export <name> [output-file]"),process.exit(2));let i;try{i=await Gt(s)}catch(l){C(l.message),process.exit(1)}let n=e.positional[1]??`./${s}.json`,{resolve:r}=await import("path"),o=r(n);if(!e.flags.force){let{access:l}=await import("fs/promises");try{if(await l(o),process.stdin.isTTY&&!e.flags.yes){process.stderr.write(`File ${u.bold(o)} already exists. Overwrite? [y/N] `);let c=await G();c.toLowerCase()!=="y"&&c.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}else e.flags.yes||(C(`File "${o}" already exists. Use --force to overwrite.`),process.exit(1))}catch{}}let{writeFile:a}=await import("fs/promises");await a(o,JSON.stringify(i,null,2)+`
|
|
805
|
+
`,"utf-8"),e.flags.json?console.log(JSON.stringify({exported:!0,path:o,bundle:i},null,2)):console.error(u.green(`Exported to ${o}`));break}default:C(`Unknown subcommand: "${t}". Use: create, install, list, show, remove, modify, or export`),console.error('Run "asm bundle --help" for usage.'),process.exit(2)}}async function Av(e){if(e.flags.help){qw();return}let t=e.flags.machine?Ge():void 0,s=performance.now(),i=e.subcommand||".";try{let n=await su({path:i,dryRun:e.flags.dryRun,force:e.flags.force,yes:e.flags.yes});if(e.flags.machine){t?.(),n.success||(console.log(z("publish",W.PUBLISH_FAILED,n.error||"Publish failed",s,{manifest:n.manifest,security_verdict:n.securityVerdict,fallback:n.fallback??!1})),process.exit(1)),console.log(Y("publish",{manifest:n.manifest,pr_url:n.prUrl,status:n.securityVerdict},s));return}if(e.flags.json){console.log(JSON.stringify({success:n.success,manifest:n.manifest,pr_url:n.prUrl,error:n.error,security_verdict:n.securityVerdict},null,2)),n.success||process.exit(1);return}if(n.success||(C(n.error||"Publish failed."),process.exit(1)),n.fallback){console.log(u.yellow("Manifest generated (gh CLI unavailable):")),console.log(iu(n));return}if(e.flags.dryRun){console.error(u.dim(`Dry run \u2014 no PR created.
|
|
806
|
+
`)),console.log(JSON.stringify(n.manifest,null,2));return}n.prUrl&&(console.error(u.green("Published successfully!")),console.error(""),console.error(` PR: ${n.prUrl}`),console.error(` Manifest: manifests/${n.manifest?.author}/${n.manifest?.name}.json`),console.error(` Security: ${n.securityVerdict}`),console.error(""),console.error(u.dim("The registry maintainers will review your submission.")))}catch(n){let r={success:!1,manifest:null,prUrl:null,error:n.message,securityVerdict:"pass",securityReport:{scannedAt:new Date().toISOString(),skillName:"",skillPath:"",source:null,codeScans:[],permissions:[],totalFiles:0,totalLines:0,verdict:"safe",verdictReason:""}};e.flags.machine&&(t?.(),console.log(z("publish",W.PUBLISH_FAILED,n.message,s)),process.exit(1)),e.flags.json&&(console.log(JSON.stringify({success:!1,manifest:null,pr_url:null,error:n.message,security_verdict:null},null,2)),process.exit(1)),C(n.message),process.exit(1)}}async function Pv(e){if(e.flags.help){Fw();return}let t=e.flags.machine?Ge():void 0,s=performance.now();try{let i=await Mr();if(e.flags.machine){t?.();let r=i.entries.map(o=>({name:o.name,installed_commit:o.installedCommit,latest_commit:o.latestCommit,source:o.sourceType,status:o.status}));console.log(Y("outdated",r,s));return}if(e.flags.json){console.log(uu(i));return}let n=!e.flags.noColor&&process.stdout.isTTY!==!1;console.log(cu(i,n)),i.outdatedCount>0&&(process.exitCode=1)}catch(i){e.flags.machine&&(t?.(),console.log(z("outdated",W.UNKNOWN_ERROR,i.message,s)),process.exit(1)),C(i.message),process.exit(1)}}async function Nv(e){if(e.flags.help){jw();return}let t=e.flags.machine?Ge():void 0,s=performance.now(),i=[];e.subcommand&&i.push(e.subcommand),i.push(...e.positional);try{let n=await lu(i.length>0?i:null,e.flags.yes);if(e.flags.machine){t?.();let o=n.results.map(a=>({name:a.name,status:a.status,reason:a.reason||null,old_commit:a.oldCommit||null,new_commit:a.newCommit||null,security_verdict:a.securityVerdict||null}));console.log(Y("update",o,s));return}if(e.flags.json){console.log(fu(n));return}if(n.results.length>0&&console.error(u.yellow("Note: project-scoped skill detection is not yet supported. All updates target the global skill path.")),n.warnings&&n.warnings.length>0)for(let o of n.warnings)console.error(u.yellow(`Warning: skill "${o}" not found in lock file \u2014 skipped`));if(n.results.length===0){console.log("All skills are up to date.");return}for(let o of n.results)switch(o.status){case"updated":console.log(`${u.green("\u2713")} ${o.name} ${u.dim(o.oldCommit||"")} \u2192 ${o.newCommit||""}`),o.securityVerdict==="warning"&&console.error(u.yellow(` \u26A0 Security audit returned warning for ${o.name} \u2014 updated because --yes was supplied`));break;case"skipped":console.log(`${u.yellow("\u25CB")} ${o.name} ${u.dim(o.reason||"skipped")}`);break;case"failed":console.log(`${u.red("\u2717")} ${o.name} ${u.dim(o.reason||"failed")}`);break}console.log("");let r=[];n.updatedCount>0&&r.push(u.green(`${n.updatedCount} updated`)),n.skippedCount>0&&r.push(u.yellow(`${n.skippedCount} skipped`)),n.failedCount>0&&r.push(u.red(`${n.failedCount} failed`)),console.log(r.join(", ")),n.failedCount>0&&(process.exitCode=1)}catch(n){e.flags.machine&&(t?.(),console.log(z("update",W.UNKNOWN_ERROR,n.message,s)),process.exit(1)),C(n.message),process.exit(1)}}async function ff(e){let t=Lw(e);if(t.flags.json&&t.flags.machine&&(C("--json and --machine are mutually exclusive. Use one or the other."),process.exit(2)),t.flags.machine&&(t.flags.yes=!0),t.flags.noColor&&(globalThis.__CLI_NO_COLOR=!0),t.flags.verbose&&Wr(!0),t.flags.version){console.log(`asm ${Li}`);let s=await fi();if(t.flags.verbose&&s.resolved&&(console.log(` path: ${s.resolved.path}`),s.resolved.realPath!==s.resolved.path&&console.log(` real: ${s.resolved.realPath}`)),s.shadowed.length>0&&s.resolved){console.error(""),console.error(u.yellow(`Warning: ${s.shadowed.length+1} \`asm\` binaries on PATH \u2014 you may be running a shadowed install.`)),console.error(` resolved: ${s.resolved.path}`);for(let i of s.shadowed)console.error(` shadowed: ${i.path}`);console.error(u.dim(" Pick one package manager (npm OR bun) and remove the other install.")),console.error(u.dim(" See: https://github.com/luongnv89/asm#troubleshooting"))}return}if(!t.command&&t.flags.help){Rw();return}if(t.command)switch(t.command){case"list":await Uw(t);break;case"search":await Vw(t);break;case"inspect":await Kw(t);break;case"uninstall":await Jw(t);break;case"audit":await Hw(t);break;case"install":await sv(t);break;case"config":await Qw(t);break;case"export":await nv(t);break;case"import":await ov(t);break;case"init":await lv(t);break;case"stats":await uv(t);break;case"link":await Sv(t);break;case"index":await xv(t);break;case"bundle":await Ev(t);break;case"publish":await Av(t);break;case"outdated":await Pv(t);break;case"update":await Nv(t);break;case"doctor":await dv(t);break;case"eval":await gv(t);break;case"eval-providers":await wv(t);break;default:C(`Unknown command: "${t.command}"`),console.error('Run "asm --help" for usage.'),process.exit(2)}}function df(e){let t=e.slice(2);if(t.length===0)return!1;let s=["list","search","inspect","uninstall","audit","config","install","export","import","init","stats","link","index","bundle","publish","outdated","update","doctor","eval","eval-providers"],i=t[0];return!!(s.includes(i)||i==="--help"||i==="-h"||i==="--version"||i==="-v"||i.startsWith("-")||i.length>0)}if(df(process.argv))await ff(process.argv);else{let{main:e}=await import("./src-RNJS76U3.js");await e().catch(t=>{console.error("Fatal error:",t),process.exit(1)})}
|