agent-skill-manager 2.3.0 → 2.5.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 +25 -37
- package/data/bundles/content-writing.json +30 -0
- package/data/bundles/devops.json +30 -0
- package/data/bundles/frontend-dev.json +35 -0
- package/data/bundles/ios-release.json +30 -0
- package/data/skill-index/antonbabenko_terraform-skill.json +146 -0
- package/data/skill-index/google_skills.json +1790 -0
- package/data/skill-index/luongnv89_asm.json +73 -0
- package/data/skill-index-resources.json +28 -1
- package/dist/agent-skill-manager.js +442 -431
- package/dist/chunk-7BMOBFGJ.js +2 -0
- package/dist/chunk-GOI5LV72.js +3 -0
- package/dist/chunk-PVEAYTE2.js +3 -0
- package/dist/chunk-QY4LTOTR.js +19 -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-YK2KIAU7.js +108 -0
- package/package.json +55 -21
- package/scripts/postinstall.cjs +3 -7
- package/dist/chunk-76faq0t9.js +0 -93
- package/dist/chunk-83zxj8cj.js +0 -3
- package/dist/chunk-chw0sgjp.js +0 -3
- package/dist/chunk-dtg819nd.js +0 -19
- 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 yo,d as bo}from"./chunk-PVEAYTE2.js";import{C as ho,D as go,E as J,F as Ii,G as wo,I as vo,J as ko,K as So,L as Li,M as $o,a as ie,b as ae,c as to,d as es,g as Q,h as so,i as Ci,j as io,k as no,l as Ei,m as ro,n as u,o as oo,p as ao,q as lo,r as Ai,s as Pi,t as Ni,u as co,v as uo,w as ts,x as fo,y as po,z as mo}from"./chunk-QY4LTOTR.js";import{a as zr,b as N,c as Qr,d as pt,e as Xr,f as mt,g as Zr,j as oe,k as q,l as eo}from"./chunk-GOI5LV72.js";import{a as Zt,b as A,d as Wr}from"./chunk-7BMOBFGJ.js";var D=A(H=>{"use strict";var qi=Symbol.for("yaml.alias"),Do=Symbol.for("yaml.document"),ls=Symbol.for("yaml.map"),_o=Symbol.for("yaml.pair"),Fi=Symbol.for("yaml.scalar"),cs=Symbol.for("yaml.seq"),me=Symbol.for("yaml.node.type"),Uf=e=>!!e&&typeof e=="object"&&e[me]===qi,Vf=e=>!!e&&typeof e=="object"&&e[me]===Do,Kf=e=>!!e&&typeof e=="object"&&e[me]===ls,Jf=e=>!!e&&typeof e=="object"&&e[me]===_o,qo=e=>!!e&&typeof e=="object"&&e[me]===Fi,Hf=e=>!!e&&typeof e=="object"&&e[me]===cs;function Fo(e){if(e&&typeof e=="object")switch(e[me]){case ls:case cs:return!0}return!1}function Yf(e){if(e&&typeof e=="object")switch(e[me]){case qi:case ls:case Fi:case cs:return!0}return!1}var Gf=e=>(qo(e)||Fo(e))&&!!e.anchor;H.ALIAS=qi;H.DOC=Do;H.MAP=ls;H.NODE_TYPE=me;H.PAIR=_o;H.SCALAR=Fi;H.SEQ=cs;H.hasAnchor=Gf;H.isAlias=Uf;H.isCollection=Fo;H.isDocument=Vf;H.isMap=Kf;H.isNode=Yf;H.isPair=Jf;H.isScalar=qo;H.isSeq=Hf});var gt=A(ji=>{"use strict";var B=D(),X=Symbol("break visit"),jo=Symbol("skip children"),ue=Symbol("remove node");function us(e,t){let s=Bo(t);B.isDocument(e)?Qe(null,e.contents,s,Object.freeze([e]))===ue&&(e.contents=null):Qe(null,e,s,Object.freeze([]))}us.BREAK=X;us.SKIP=jo;us.REMOVE=ue;function Qe(e,t,s,i){let n=Uo(e,t,s,i);if(B.isNode(n)||B.isPair(n))return Vo(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 fs(e,t){let s=Bo(t);B.isDocument(e)?await Xe(null,e.contents,s,Object.freeze([e]))===ue&&(e.contents=null):await Xe(null,e,s,Object.freeze([]))}fs.BREAK=X;fs.SKIP=jo;fs.REMOVE=ue;async function Xe(e,t,s,i){let n=await Uo(e,t,s,i);if(B.isNode(n)||B.isPair(n))return Vo(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 Bo(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 Uo(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 Vo(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=us;ji.visitAsync=fs});var Bi=A(Jo=>{"use strict";var Ko=D(),Wf=gt(),zf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Qf=e=>e.replace(/[!,[\]{}]/g,t=>zf[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+Qf(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&&Ko.isNode(t.contents)){let r={};Wf.visit(t.contents,(o,a)=>{Ko.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:"};Jo.Directives=yt});var ds=A(bt=>{"use strict";var Ho=D(),Xf=gt();function Zf(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 Yo(e){let t=new Set;return Xf.visit(e,{Value(s,i){i.anchor&&t.add(i.anchor)}}),t}function Go(e,t){for(let s=1;;++s){let i=`${e}${s}`;if(!t.has(i))return i}}function ed(e,t){let s=[],i=new Map,n=null;return{onAnchor:r=>{s.push(r),n??(n=Yo(e));let o=Go(t,n);return n.add(o),o},setAnchors:()=>{for(let r of s){let o=i.get(r);if(typeof o=="object"&&o.anchor&&(Ho.isScalar(o.node)||Ho.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=Zf;bt.anchorNames=Yo;bt.createNodeAnchors=ed;bt.findNewAnchor=Go});var Ui=A(Wo=>{"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)}Wo.applyReviver=wt});var be=A(Qo=>{"use strict";var td=D();function zo(e,t,s){if(Array.isArray(e))return e.map((i,n)=>zo(i,String(n),s));if(e&&typeof e.toJSON=="function"){if(!s||!td.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}Qo.toJS=zo});var ps=A(Zo=>{"use strict";var sd=Ui(),Xo=D(),id=be(),Vi=class{constructor(t){Object.defineProperty(this,Xo.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(!Xo.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=id.toJS(this,"",o);if(typeof n=="function")for(let{count:l,res:c}of o.anchors.values())n(c,l);return typeof r=="function"?sd.applyReviver(r,{"":a},"",a):a}};Zo.NodeBase=Vi});var vt=A(ea=>{"use strict";var nd=ds(),rd=gt(),Ze=D(),od=ps(),ad=be(),Ki=class extends od.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=[],rd.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||(ad.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=ms(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(nd.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 ms(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=ms(e,n,s);r>i&&(i=r)}return i}else if(Ze.isPair(t)){let i=ms(e,t.key,s),n=ms(e,t.value,s);return Math.max(i,n)}return 1}ea.Alias=Ki});var F=A(Ji=>{"use strict";var ld=D(),cd=ps(),ud=be(),fd=e=>!e||typeof e!="function"&&typeof e!="object",we=class extends cd.NodeBase{constructor(t){super(ld.SCALAR),this.value=t}toJSON(t,s){return s?.keep?this.value:ud.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=fd});var kt=A(sa=>{"use strict";var dd=vt(),qe=D(),ta=F(),pd="tag:yaml.org,2002:";function md(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 hd(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 dd.Alias(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t=pd+t.slice(2));let c=md(e,t,o.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new ta.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 ta.Scalar(e);return t?d.tag=t:c.default||(d.tag=c.tag),l&&(l.node=d),d}sa.createNode=hd});var gs=A(hs=>{"use strict";var gd=kt(),fe=D(),yd=ps();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 gd.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 ia=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Yi=class extends yd.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(ia(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}`)}}};hs.Collection=Yi;hs.collectionFromPath=Hi;hs.isEmptyPath=ia});var St=A(ys=>{"use strict";var bd=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Gi(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var wd=(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;ys.indentComment=Gi;ys.lineComment=wd;ys.stringifyComment=bd});var ra=A($t=>{"use strict";var vd="flow",Wi="block",bs="quoted";function kd(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,m,y=!1,h=-1,g=-1,b=-1;s===Wi&&(h=na(e,h,t.length),h!==-1&&(f=h+l));for(let k;k=e[h+=1];){if(s===bs&&k==="\\"){switch(g=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}b=h}if(k===`
|
|
8
|
+
`)s===Wi&&(h=na(e,h,t.length)),f=h+t.length+l,p=void 0;else{if(k===" "&&m&&m!==" "&&m!==`
|
|
9
|
+
`&&m!==" "){let x=e[h+1];x&&x!==" "&&x!==`
|
|
10
|
+
`&&x!==" "&&(p=h)}if(h>=f)if(p)c.push(p),f=p+l,p=void 0;else if(s===bs){for(;m===" "||m===" ";)m=k,k=e[h+=1],y=!0;let x=h>b+1?h-2:g-1;if(d[x])return e;c.push(x),d[x]=!0,f=x+l,p=void 0}else y=!0}m=k}if(y&&a&&a(),c.length===0)return e;o&&o();let v=e.slice(0,c[0]);for(let k=0;k<c.length;++k){let x=c[k],S=c[k+1]||e.length;x===0?v=`
|
|
11
|
+
${t}${e.slice(0,S)}`:(s===bs&&d[x]&&(v+=`${e[x]}\\`),v+=`
|
|
12
|
+
${t}${e.slice(x+1,S)}`)}return v}function na(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=vd;$t.FOLD_QUOTED=bs;$t.foldFlowLines=kd});var Ct=A(oa=>{"use strict";var le=F(),ve=ra(),vs=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),ks=e=>/^(%|---|\.\.\.)/m.test(e);function Sd(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||(ks(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,vs(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||(ks(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${s}`)+"'";return t.implicitKey?i:ve.foldFlowLines(i,s,ve.FOLD_FLOW,vs(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 ws({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||ks(s)?" ":""),d=o==="literal"?!0:o==="folded"||t===le.Scalar.BLOCK_FOLDED?!1:t===le.Scalar.BLOCK_LITERAL?!0:!Sd(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}$.items[Z]=Rq.isPair(Q)?Q:new k1.Pair(Q)}else q("Expected a sequence for this tag");return $}function H9($,q,Z){let{replacer:Q}=Z,X=new eQ.YAMLSeq($);X.tag="tag:yaml.org,2002:pairs";let z=0;if(q&&Symbol.iterator in Object(q))for(let J of q){if(typeof Q==="function")J=Q.call(q,String(z++),J);let Y,G;if(Array.isArray(J))if(J.length===2)Y=J[0],G=J[1];else throw TypeError(`Expected [key, value] tuple: ${J}`);else if(J&&J instanceof Object){let U=Object.keys(J);if(U.length===1)Y=U[0],G=J[Y];else throw TypeError(`Expected tuple with one key, not ${U.length} keys`)}else Y=J;X.items.push(k1.createPair(Y,G,Z))}return X}var $X={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:V9,createNode:H9};qX.createPairs=H9;qX.pairs=$X;qX.resolvePairs=V9});var h1=N((YX)=>{var B9=k(),v1=L0(),j$=M0(),zX=R0(),K9=jq();class k0 extends zX.YAMLSeq{constructor(){super();this.add=j$.YAMLMap.prototype.add.bind(this),this.delete=j$.YAMLMap.prototype.delete.bind(this),this.get=j$.YAMLMap.prototype.get.bind(this),this.has=j$.YAMLMap.prototype.has.bind(this),this.set=j$.YAMLMap.prototype.set.bind(this),this.tag=k0.tag}toJSON($,q){if(!q)return super.toJSON($);let Z=new Map;if(q?.onCreate)q.onCreate(Z);for(let Q of this.items){let X,z;if(B9.isPair(Q))X=v1.toJS(Q.key,"",q),z=v1.toJS(Q.value,X,q);else X=v1.toJS(Q,"",q);if(Z.has(X))throw Error("Ordered maps must not include duplicate keys");Z.set(X,z)}return Z}static from($,q,Z){let Q=K9.createPairs($,q,Z),X=new this;return X.items=Q.items,X}}k0.tag="tag:yaml.org,2002:omap";var JX={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:k0,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,q){let Z=K9.resolvePairs($,q),Q=[];for(let{key:X}of Z.items)if(B9.isScalar(X))if(Q.includes(X.value))q(`Ordered maps must not include duplicate keys: ${X.value}`);else Q.push(X.value);return Object.assign(new k0,Z)},createNode:($,q,Z)=>k0.from($,q,Z)};YX.YAMLOMap=k0;YX.omap=JX});var A9=N((WX)=>{var _9=u();function O9({value:$,source:q},Z){if(q&&($?L9:F9).test.test(q))return q;return $?Z.options.trueStr:Z.options.falseStr}var L9={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new _9.Scalar(!0),stringify:O9},F9={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new _9.Scalar(!1),stringify:O9};WX.falseTag=F9;WX.trueTag=L9});var I9=N((LX)=>{var BX=u(),g1=q$(),KX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:g1.stringifyNumber},_X={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let q=Number($.value);return isFinite(q)?q.toExponential():g1.stringifyNumber($)}},OX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let q=new BX.Scalar(parseFloat($.replace(/_/g,""))),Z=$.indexOf(".");if(Z!==-1){let Q=$.substring(Z+1).replace(/_/g,"");if(Q[Q.length-1]==="0")q.minFractionDigits=Q.length}return q},stringify:g1.stringifyNumber};LX.float=OX;LX.floatExp=_X;LX.floatNaN=KX});var M9=N((wX)=>{var T9=q$(),w$=($)=>typeof $==="bigint"||Number.isInteger($);function wq($,q,Z,{intAsBigInt:Q}){let X=$[0];if(X==="-"||X==="+")q+=1;if($=$.substring(q).replace(/_/g,""),Q){switch(Z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let J=BigInt($);return X==="-"?BigInt(-1)*J:J}let z=parseInt($,Z);return X==="-"?-1*z:z}function u1($,q,Z){let{value:Q}=$;if(w$(Q)){let X=Q.toString(q);return Q<0?"-"+Z+X.substr(1):Z+X}return T9.stringifyNumber($)}var TX={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,q,Z)=>wq($,2,2,Z),stringify:($)=>u1($,2,"0b")},MX={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,q,Z)=>wq($,1,8,Z),stringify:($)=>u1($,8,"0")},RX={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,q,Z)=>wq($,0,10,Z),stringify:T9.stringifyNumber},jX={identify:w$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,q,Z)=>wq($,2,16,Z),stringify:($)=>u1($,16,"0x")};wX.int=RX;wX.intBin=TX;wX.intHex=jX;wX.intOct=MX});var m1=N((SX)=>{var Pq=k(),Nq=I0(),Dq=M0();class v0 extends Dq.YAMLMap{constructor($){super($);this.tag=v0.tag}add($){let q;if(Pq.isPair($))q=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)q=new Nq.Pair($.key,null);else q=new Nq.Pair($,null);if(!Dq.findPair(this.items,q.key))this.items.push(q)}get($,q){let Z=Dq.findPair(this.items,$);return!q&&Pq.isPair(Z)?Pq.isScalar(Z.key)?Z.key.value:Z.key:Z}set($,q){if(typeof q!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof q}`);let Z=Dq.findPair(this.items,$);if(Z&&!q)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&q)this.items.push(new Nq.Pair($))}toJSON($,q){return super.toJSON($,q,Set)}toString($,q,Z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),q,Z);else throw Error("Set items must all have null values")}static from($,q,Z){let{replacer:Q}=Z,X=new this($);if(q&&Symbol.iterator in Object(q))for(let z of q){if(typeof Q==="function")z=Q.call(q,z,z);X.items.push(Nq.createPair(z,null,Z))}return X}}v0.tag="tag:yaml.org,2002:set";var EX={collection:"map",identify:($)=>$ instanceof Set,nodeClass:v0,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,q,Z)=>v0.from($,q,Z),resolve($,q){if(Pq.isMap($))if($.hasAllNullValues(!0))return Object.assign(new v0,$);else q("Set items must all have null values");else q("Expected a mapping for this tag");return $}};SX.YAMLSet=v0;SX.set=EX});var d1=N((vX)=>{var fX=q$();function p1($,q){let Z=$[0],Q=Z==="-"||Z==="+"?$.substring(1):$,X=(J)=>q?BigInt(J):Number(J),z=Q.replace(/_/g,"").split(":").reduce((J,Y)=>J*X(60)+X(Y),X(0));return Z==="-"?X(-1)*z:z}function R9($){let{value:q}=$,Z=(J)=>J;if(typeof q==="bigint")Z=(J)=>BigInt(J);else if(isNaN(q)||!isFinite(q))return fX.stringifyNumber($);let Q="";if(q<0)Q="-",q*=Z(-1);let X=Z(60),z=[q%X];if(q<60)z.unshift(0);else if(q=(q-z[0])/X,z.unshift(q%X),q>=60)q=(q-z[0])/X,z.unshift(q);return Q+z.map((J)=>String(J).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var yX={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,q,{intAsBigInt:Z})=>p1($,Z),stringify:R9},kX={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>p1($,!1),stringify:R9},j9={identify:($)=>$ instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve($){let q=$.match(j9.test);if(!q)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,Q,X,z,J,Y]=q.map(Number),G=q[7]?Number((q[7]+"00").substr(1,3)):0,U=Date.UTC(Z,Q-1,X,z||0,J||0,Y||0,G),H=q[8];if(H&&H!=="Z"){let V=p1(H,!1);if(Math.abs(V)<30)V*=60;U-=60000*V}return new Date(U)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};vX.floatTime=kX;vX.intTime=yX;vX.timestamp=j9});var N9=N((tX)=>{var mX=e0(),pX=Iq(),dX=$$(),cX=M$(),lX=y1(),w9=A9(),c1=I9(),Cq=M9(),nX=Hq(),aX=h1(),iX=jq(),oX=m1(),l1=d1(),sX=[mX.map,dX.seq,cX.string,pX.nullTag,w9.trueTag,w9.falseTag,Cq.intBin,Cq.intOct,Cq.int,Cq.intHex,c1.floatNaN,c1.floatExp,c1.float,lX.binary,nX.merge,aX.omap,iX.pairs,oX.set,l1.intTime,l1.floatTime,l1.timestamp];tX.schema=sX});var k9=N((Jz)=>{var E9=e0(),eX=Iq(),S9=$$(),$z=M$(),qz=D1(),n1=C1(),a1=S1(),Zz=G9(),Qz=W9(),b9=y1(),N$=Hq(),x9=h1(),f9=jq(),D9=N9(),y9=m1(),Eq=d1(),P9=new Map([["core",Zz.schema],["failsafe",[E9.map,S9.seq,$z.string]],["json",Qz.schema],["yaml11",D9.schema],["yaml-1.1",D9.schema]]),C9={binary:b9.binary,bool:qz.boolTag,float:n1.float,floatExp:n1.floatExp,floatNaN:n1.floatNaN,floatTime:Eq.floatTime,int:a1.int,intHex:a1.intHex,intOct:a1.intOct,intTime:Eq.intTime,map:E9.map,merge:N$.merge,null:eX.nullTag,omap:x9.omap,pairs:f9.pairs,seq:S9.seq,set:y9.set,timestamp:Eq.timestamp},Xz={"tag:yaml.org,2002:binary":b9.binary,"tag:yaml.org,2002:merge":N$.merge,"tag:yaml.org,2002:omap":x9.omap,"tag:yaml.org,2002:pairs":f9.pairs,"tag:yaml.org,2002:set":y9.set,"tag:yaml.org,2002:timestamp":Eq.timestamp};function zz($,q,Z){let Q=P9.get(q);if(Q&&!$)return Z&&!Q.includes(N$.merge)?Q.concat(N$.merge):Q.slice();let X=Q;if(!X)if(Array.isArray($))X=[];else{let z=Array.from(P9.keys()).filter((J)=>J!=="yaml11").map((J)=>JSON.stringify(J)).join(", ");throw Error(`Unknown schema "${q}"; use one of ${z} or define customTags array`)}if(Array.isArray($))for(let z of $)X=X.concat(z);else if(typeof $==="function")X=$(X.slice());if(Z)X=X.concat(N$.merge);return X.reduce((z,J)=>{let Y=typeof J==="string"?C9[J]:J;if(!Y){let G=JSON.stringify(J),U=Object.keys(C9).map((H)=>JSON.stringify(H)).join(", ");throw Error(`Unknown custom tag ${G}; use one of ${U}`)}if(!z.includes(Y))z.push(Y);return z},[])}Jz.coreKnownTags=Xz;Jz.getTags=zz});var s1=N((Bz)=>{var i1=k(),Uz=e0(),Wz=$$(),Vz=M$(),Sq=k9(),Hz=($,q)=>$.key<q.key?-1:$.key>q.key?1:0;class o1{constructor({compat:$,customTags:q,merge:Z,resolveKnownTags:Q,schema:X,sortMapEntries:z,toStringDefaults:J}){this.compat=Array.isArray($)?Sq.getTags($,"compat"):$?Sq.getTags(null,$):null,this.name=typeof X==="string"&&X||"core",this.knownTags=Q?Sq.coreKnownTags:{},this.tags=Sq.getTags(q,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,i1.MAP,{value:Uz.map}),Object.defineProperty(this,i1.SCALAR,{value:Vz.string}),Object.defineProperty(this,i1.SEQ,{value:Wz.seq}),this.sortMapEntries=typeof z==="function"?z:z===!0?Hz:null}clone(){let $=Object.create(o1.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}Bz.Schema=o1});var v9=N((Lz)=>{var _z=k(),t1=F$(),D$=_$();function Oz($,q){let Z=[],Q=q.directives===!0;if(q.directives!==!1&&$.directives){let G=$.directives.toString($);if(G)Z.push(G),Q=!0;else if($.directives.docStart)Q=!0}if(Q)Z.push("---");let X=t1.createStringifyContext($,q),{commentString:z}=X.options;if($.commentBefore){if(Z.length!==1)Z.unshift("");let G=z($.commentBefore);Z.unshift(D$.indentComment(G,""))}let J=!1,Y=null;if($.contents){if(_z.isNode($.contents)){if($.contents.spaceBefore&&Q)Z.push("");if($.contents.commentBefore){let H=z($.contents.commentBefore);Z.push(D$.indentComment(H,""))}X.forceBlockIndent=!!$.comment,Y=$.contents.comment}let G=Y?void 0:()=>J=!0,U=t1.stringify($.contents,X,()=>Y=null,G);if(Y)U+=D$.lineComment(U,"",z(Y));if((U[0]==="|"||U[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${U}`;else Z.push(U)}else Z.push(t1.stringify($.contents,X));if($.directives?.docEnd)if($.comment){let G=z($.comment);if(G.includes(`
|
|
56
|
-
`)
|
|
24
|
+
`;let f,p;for(p=s.length;p>0;--p){let S=s[p-1];if(S!==`
|
|
25
|
+
`&&S!==" "&&S!==" ")break}let m=s.substring(p),y=m.indexOf(`
|
|
26
|
+
`);y===-1?f="-":s===m||y!==m.length-1?(f="+",r&&r()):f="",m&&(s=s.slice(0,-m.length),m[m.length-1]===`
|
|
27
|
+
`&&(m=m.slice(0,-1)),m=m.replace(Qi,`$&${c}`));let h=!1,g,b=-1;for(g=0;g<s.length;++g){let S=s[g];if(S===" ")h=!0;else if(S===`
|
|
28
|
+
`)b=g;else break}let v=s.substring(0,b<g?b+1:g);v&&(s=s.substring(v.length),v=v.replace(/\n+/g,`$&${c}`));let x=(h?c?"2":"1":"")+f;if(e&&(x+=" "+a(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!d){let S=s.replace(/\n+/g,`
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),E=!1,O=vs(i,!0);o!=="folded"&&t!==le.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{E=!0});let P=ve.foldFlowLines(`${v}${S}${m}`,c,ve.FOLD_BLOCK,O);if(!E)return`>${x}
|
|
30
|
+
${c}${P}`}return s=s.replace(/\n+/g,`$&${c}`),`|${x}
|
|
31
|
+
${c}${v}${s}${m}`}function $d(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):ws(e,t,s,i);if(!a&&!d&&n!==le.Scalar.PLAIN&&r.includes(`
|
|
34
|
+
`))return ws(e,t,s,i);if(ks(r)){if(l==="")return t.forceBlockIndent=!0,ws(e,t,s,i);if(a&&l===c)return et(r,t)}let f=r.replace(/\n+/g,`$&
|
|
35
|
+
${l}`);if(o){let p=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(f),{compat:m,tags:y}=t.doc.schema;if(y.some(p)||m?.some(p))return et(r,t)}return a?f:ve.foldFlowLines(f,l,ve.FOLD_FLOW,vs(t,!1))}function xd(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):ws(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 $d(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}oa.stringifyString=xd});var Et=A(Xi=>{"use strict";var Cd=ds(),ke=D(),Ed=St(),Ad=Ct();function Pd(e,t){let s=Object.assign({blockQuote:!0,commentString:Ed.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 Nd(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 Id(e,t,{anchors:s,doc:i}){if(!i.directives)return"";let n=[],r=(ke.isScalar(e)||ke.isCollection(e))&&e.anchor;r&&Cd.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 Ld(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=Nd(t.doc.schema.tags,r));let o=Id(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)?Ad.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=Pd;Xi.stringify=Ld});var ua=A(ca=>{"use strict";var he=D(),aa=F(),la=Et(),At=St();function Rd({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 m=!f&&(!e||p&&t==null&&!s.inFlow||he.isCollection(e)||(he.isScalar(e)?e.type===aa.Scalar.BLOCK_FOLDED||e.type===aa.Scalar.BLOCK_LITERAL:typeof e=="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!m&&(f||!r),indent:a+l});let y=!1,h=!1,g=la.stringify(e,s,()=>y=!0,()=>h=!0);if(!m&&!s.inFlow&&g.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(s.inFlow){if(r||t==null)return y&&i&&i(),g===""?"?":m?`? ${g}`:g}else if(r&&!f||t==null&&m)return g=`? ${g}`,p&&!y?g+=At.lineComment(g,s.indent,c(p)):h&&n&&n(),g;y&&(p=null),m?(p&&(g+=At.lineComment(g,s.indent,c(p))),g=`? ${g}
|
|
37
|
+
${a}:`):(g=`${g}:`,p&&(g+=At.lineComment(g,s.indent,c(p))));let b,v,k;he.isNode(t)?(b=!!t.spaceBefore,v=t.commentBefore,k=t.comment):(b=!1,v=null,k=null,t&&typeof t=="object"&&(t=o.createNode(t))),s.implicitKey=!1,!m&&!p&&he.isScalar(t)&&(s.indentAtStart=g.length+1),h=!1,!d&&l.length>=2&&!s.inFlow&&!m&&he.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(s.indent=s.indent.substring(2));let x=!1,S=la.stringify(t,s,()=>x=!0,()=>h=!0),E=" ";if(p||b||v){if(E=b?`
|
|
38
|
+
`:"",v){let O=c(v);E+=`
|
|
39
|
+
${At.indentComment(O,s.indent)}`}S===""&&!s.inFlow?E===`
|
|
40
|
+
`&&k&&(E=`
|
|
41
|
+
|
|
42
|
+
`):E+=`
|
|
43
|
+
${s.indent}`}else if(!m&&he.isCollection(t)){let O=S[0],P=S.indexOf(`
|
|
44
|
+
`),M=P!==-1,w=s.inFlow??t.flow??t.items.length===0;if(M||!w){let $=!1;if(M&&(O==="&"||O==="!")){let I=S.indexOf(" ");O==="&"&&I!==-1&&I<P&&S[I+1]==="!"&&(I=S.indexOf(" ",I+1)),(I===-1||P<I)&&($=!0)}$||(E=`
|
|
45
|
+
${s.indent}`)}}else(S===""||S[0]===`
|
|
46
|
+
`)&&(E="");return g+=E+S,s.inFlow?x&&i&&i():k&&!x?g+=At.lineComment(g,s.indent,c(k)):h&&n&&n(),g}ca.stringifyPair=Rd});var en=A(Zi=>{"use strict";var fa=Zt("process");function Od(e,...t){e==="debug"&&console.log(...t)}function Td(e,t){(e==="debug"||e==="warn")&&(typeof fa.emitWarning=="function"?fa.emitWarning(t):console.warn(t))}Zi.debug=Od;Zi.warn=Td});var Cs=A(xs=>{"use strict";var Pt=D(),da=F(),Ss="<<",$s={identify:e=>e===Ss||typeof e=="symbol"&&e.description===Ss,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new da.Scalar(Symbol(Ss)),{addToJSMap:pa}),stringify:()=>Ss},Md=(e,t)=>($s.identify(t)||Pt.isScalar(t)&&(!t.type||t.type===da.Scalar.PLAIN)&&$s.identify(t.value))&&e?.doc.schema.tags.some(s=>s.tag===$s.tag&&s.default);function pa(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}xs.addMergeToJSMap=pa;xs.isMergeKey=Md;xs.merge=$s});var nn=A(ga=>{"use strict";var Dd=en(),ma=Cs(),_d=Et(),ha=D(),sn=be();function qd(e,t,{key:s,value:i}){if(ha.isNode(s)&&s.addToJSMap)s.addToJSMap(e,t,i);else if(ma.isMergeKey(e,s))ma.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=Fd(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 Fd(e,t,s){if(t===null)return"";if(typeof t!="object")return String(t);if(ha.isNode(e)&&s?.doc){let i=_d.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)+'..."'),Dd.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)}ga.addPairToJSMap=qd});var Se=A(rn=>{"use strict";var ya=kt(),jd=ua(),Bd=nn(),Es=D();function Ud(e,t,s){let i=ya.createNode(e,void 0,s),n=ya.createNode(t,void 0,s);return new As(i,n)}var As=class e{constructor(t,s=null){Object.defineProperty(this,Es.NODE_TYPE,{value:Es.PAIR}),this.key=t,this.value=s}clone(t){let{key:s,value:i}=this;return Es.isNode(s)&&(s=s.clone(t)),Es.isNode(i)&&(i=i.clone(t)),new e(s,i)}toJSON(t,s){let i=s?.mapAsMap?new Map:{};return Bd.addPairToJSMap(s,i,this)}toString(t,s,i){return t?.doc?jd.stringifyPair(this,t,s,i):JSON.stringify(this)}};rn.Pair=As;rn.createPair=Ud});var on=A(wa=>{"use strict";var Fe=D(),ba=Et(),Ps=St();function Vd(e,t,s){return(t.inFlow??e.flow?Jd:Kd)(e,t,s)}function Kd({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 y=0;y<t.length;++y){let h=t[y],g=null;if(Fe.isNode(h))!f&&h.spaceBefore&&p.push(""),Ns(s,p,h.commentBefore,f),h.comment&&(g=h.comment);else if(Fe.isPair(h)){let v=Fe.isNode(h.key)?h.key:null;v&&(!f&&v.spaceBefore&&p.push(""),Ns(s,p,v.commentBefore,f))}f=!1;let b=ba.stringify(h,d,()=>g=null,()=>f=!0);g&&(b+=Ps.lineComment(b,r,c(g))),f&&g&&(f=!1),p.push(i+b)}let m;if(p.length===0)m=n.start+n.end;else{m=p[0];for(let y=1;y<p.length;++y){let h=p[y];m+=h?`
|
|
47
|
+
${l}${h}`:`
|
|
48
|
+
`}}return e?(m+=`
|
|
49
|
+
`+Ps.indentComment(c(e),l),a&&a()):f&&o&&o(),m}function Jd({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 y=0;y<e.length;++y){let h=e[y],g=null;if(Fe.isNode(h))h.spaceBefore&&f.push(""),Ns(t,f,h.commentBefore,!1),h.comment&&(g=h.comment);else if(Fe.isPair(h)){let v=Fe.isNode(h.key)?h.key:null;v&&(v.spaceBefore&&f.push(""),Ns(t,f,v.commentBefore,!1),v.comment&&(c=!0));let k=Fe.isNode(h.value)?h.value:null;k?(k.comment&&(g=k.comment),k.commentBefore&&(c=!0)):h.value==null&&v?.comment&&(g=v.comment)}g&&(c=!0);let b=ba.stringify(h,l,()=>g=null);c||(c=f.length>d||b.includes(`
|
|
50
|
+
`)),y<e.length-1?b+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=f.reduce((v,k)=>v+k.length+2,2)+(b.length+2)>t.options.lineWidth)),c&&(b+=",")),g&&(b+=Ps.lineComment(b,i,a(g))),f.push(b),d=f.length}let{start:p,end:m}=s;if(f.length===0)return p+m;if(!c){let y=f.reduce((h,g)=>h+g.length+2,2);c=t.options.lineWidth>0&&y>t.options.lineWidth}if(c){let y=p;for(let h of f)y+=h?`
|
|
51
|
+
${r}${n}${h}`:`
|
|
52
|
+
`;return`${y}
|
|
53
|
+
${n}${m}`}else return`${p}${o}${f.join(" ")}${o}${m}`}function Ns({indent:e,options:{commentString:t}},s,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let r=Ps.indentComment(t(i),e);s.push(r.trimStart())}}wa.stringifyCollection=Vd});var xe=A(ln=>{"use strict";var Hd=on(),Yd=nn(),Gd=gs(),$e=D(),Is=Se(),Wd=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 Gd.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(Is.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 Is.Pair(t,t?.value):i=new Is.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)&&Wd.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 Is.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)Yd.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})),Hd.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:s})}};ln.YAMLMap=an;ln.findPair=Nt});var tt=A(ka=>{"use strict";var zd=D(),va=xe(),Qd={collection:"map",default:!0,nodeClass:va.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return zd.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,s)=>va.YAMLMap.from(e,t,s)};ka.map=Qd});var Ce=A(Sa=>{"use strict";var Xd=kt(),Zd=on(),ep=gs(),Rs=D(),tp=F(),sp=be(),cn=class extends ep.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Rs.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let s=Ls(t);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(t,s){let i=Ls(t);if(typeof i!="number")return;let n=this.items[i];return!s&&Rs.isScalar(n)?n.value:n}has(t){let s=Ls(t);return typeof s=="number"&&s<this.items.length}set(t,s){let i=Ls(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[i];Rs.isScalar(n)&&tp.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(sp.toJS(r,String(n++),s));return i}toString(t,s,i){return t?Zd.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(Xd.createNode(a,void 0,i))}}return r}};function Ls(e){let t=Rs.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Sa.YAMLSeq=cn});var st=A(xa=>{"use strict";var ip=D(),$a=Ce(),np={collection:"seq",default:!0,nodeClass:$a.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return ip.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,s)=>$a.YAMLSeq.from(e,t,s)};xa.seq=np});var It=A(Ca=>{"use strict";var rp=Ct(),op={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),rp.stringifyString(e,t,s,i)}};Ca.string=op});var Os=A(Pa=>{"use strict";var Ea=F(),Aa={identify:e=>e==null,createNode:()=>new Ea.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ea.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Aa.test.test(e)?e:t.options.nullStr};Pa.nullTag=Aa});var un=A(Ia=>{"use strict";var ap=F(),Na={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new ap.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},s){if(e&&Na.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?s.options.trueStr:s.options.falseStr}};Ia.boolTag=Na});var it=A(La=>{"use strict";function lp({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}La.stringifyNumber=lp});var dn=A(Ts=>{"use strict";var cp=F(),fn=it(),up={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},fp={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)}},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 cp.Scalar(parseFloat(e)),s=e.indexOf(".");return s!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-s-1),t},stringify:fn.stringifyNumber};Ts.float=dp;Ts.floatExp=fp;Ts.floatNaN=up});var mn=A(Ds=>{"use strict";var Ra=it(),Ms=e=>typeof e=="bigint"||Number.isInteger(e),pn=(e,t,s,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),s);function Oa(e,t,s){let{value:i}=e;return Ms(i)&&i>=0?s+i.toString(t):Ra.stringifyNumber(e)}var pp={identify:e=>Ms(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=>Oa(e,8,"0o")},mp={identify:Ms,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,s)=>pn(e,0,10,s),stringify:Ra.stringifyNumber},hp={identify:e=>Ms(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=>Oa(e,16,"0x")};Ds.int=mp;Ds.intHex=hp;Ds.intOct=pp});var Ma=A(Ta=>{"use strict";var gp=tt(),yp=Os(),bp=st(),wp=It(),vp=un(),hn=dn(),gn=mn(),kp=[gp.map,bp.seq,wp.string,yp.nullTag,vp.boolTag,gn.intOct,gn.int,gn.intHex,hn.floatNaN,hn.floatExp,hn.float];Ta.schema=kp});var qa=A(_a=>{"use strict";var Sp=F(),$p=tt(),xp=st();function Da(e){return typeof e=="bigint"||Number.isInteger(e)}var _s=({value:e})=>JSON.stringify(e),Cp=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:_s},{identify:e=>e==null,createNode:()=>new Sp.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:_s},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:_s},{identify:Da,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})=>Da(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:_s}],Ep={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Ap=[$p.map,xp.seq].concat(Cp,Ep);_a.schema=Ap});var bn=A(Fa=>{"use strict";var Lt=Zt("buffer"),yn=F(),Pp=Ct(),Np={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 Pp.stringifyString({comment:e,type:t,value:a},i,n,r)}};Fa.binary=Np});var js=A(Fs=>{"use strict";var qs=D(),wn=Se(),Ip=F(),Lp=Ce();function ja(e,t){if(qs.isSeq(e))for(let s=0;s<e.items.length;++s){let i=e.items[s];if(!qs.isPair(i)){if(qs.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let n=i.items[0]||new wn.Pair(new Ip.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]=qs.isPair(i)?i:new wn.Pair(i)}}else t("Expected a sequence for this tag");return e}function Ba(e,t,s){let{replacer:i}=s,n=new Lp.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 Rp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ja,createNode:Ba};Fs.createPairs=Ba;Fs.pairs=Rp;Fs.resolvePairs=ja});var Sn=A(kn=>{"use strict";var Ua=D(),vn=be(),Rt=xe(),Op=Ce(),Va=js(),je=class e extends Op.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(Ua.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=Va.createPairs(t,s,i),r=new this;return r.items=n.items,r}};je.tag="tag:yaml.org,2002:omap";var Tp={collection:"seq",identify:e=>e instanceof Map,nodeClass:je,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let s=Va.resolvePairs(e,t),i=[];for(let{key:n}of s.items)Ua.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=Tp});var Ga=A($n=>{"use strict";var Ka=F();function Ja({value:e,source:t},s){return t&&(e?Ha:Ya).test.test(t)?t:e?s.options.trueStr:s.options.falseStr}var Ha={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 Ka.Scalar(!0),stringify:Ja},Ya={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 Ka.Scalar(!1),stringify:Ja};$n.falseTag=Ya;$n.trueTag=Ha});var Wa=A(Bs=>{"use strict";var Mp=F(),xn=it(),Dp={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},_p={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)}},qp={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 Mp.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};Bs.float=qp;Bs.floatExp=_p;Bs.floatNaN=Dp});var Qa=A(Tt=>{"use strict";var za=it(),Ot=e=>typeof e=="bigint"||Number.isInteger(e);function Us(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 za.stringifyNumber(e)}var Fp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,s)=>Us(e,2,2,s),stringify:e=>Cn(e,2,"0b")},jp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,s)=>Us(e,1,8,s),stringify:e=>Cn(e,8,"0")},Bp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,s)=>Us(e,0,10,s),stringify:za.stringifyNumber},Up={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,s)=>Us(e,2,16,s),stringify:e=>Cn(e,16,"0x")};Tt.int=Bp;Tt.intBin=Fp;Tt.intHex=Up;Tt.intOct=jp});var An=A(En=>{"use strict";var Js=D(),Vs=Se(),Ks=xe(),Be=class e extends Ks.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let s;Js.isPair(t)?s=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?s=new Vs.Pair(t.key,null):s=new Vs.Pair(t,null),Ks.findPair(this.items,s.key)||this.items.push(s)}get(t,s){let i=Ks.findPair(this.items,t);return!s&&Js.isPair(i)?Js.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=Ks.findPair(this.items,t);i&&!s?this.items.splice(this.items.indexOf(i),1):!i&&s&&this.items.push(new Vs.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(Vs.createPair(o,null,i));return r}};Be.tag="tag:yaml.org,2002:set";var Vp={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(Js.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=Vp});var Nn=A(Hs=>{"use strict";var Kp=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 Xa(e){let{value:t}=e,s=o=>o;if(typeof t=="bigint")s=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Kp.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 Jp={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:Xa},Hp={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:Xa},Za={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(Za.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$/,"")??""};Hs.floatTime=Hp;Hs.intTime=Jp;Hs.timestamp=Za});var sl=A(tl=>{"use strict";var Yp=tt(),Gp=Os(),Wp=st(),zp=It(),Qp=bn(),el=Ga(),In=Wa(),Ys=Qa(),Xp=Cs(),Zp=Sn(),em=js(),tm=An(),Ln=Nn(),sm=[Yp.map,Wp.seq,zp.string,Gp.nullTag,el.trueTag,el.falseTag,Ys.intBin,Ys.intOct,Ys.int,Ys.intHex,In.floatNaN,In.floatExp,In.float,Qp.binary,Xp.merge,Zp.omap,em.pairs,tm.set,Ln.intTime,Ln.floatTime,Ln.timestamp];tl.schema=sm});var dl=A(Tn=>{"use strict";var ol=tt(),im=Os(),al=st(),nm=It(),rm=un(),Rn=dn(),On=mn(),om=Ma(),am=qa(),ll=bn(),Mt=Cs(),cl=Sn(),ul=js(),il=sl(),fl=An(),Gs=Nn(),nl=new Map([["core",om.schema],["failsafe",[ol.map,al.seq,nm.string]],["json",am.schema],["yaml11",il.schema],["yaml-1.1",il.schema]]),rl={binary:ll.binary,bool:rm.boolTag,float:Rn.float,floatExp:Rn.floatExp,floatNaN:Rn.floatNaN,floatTime:Gs.floatTime,int:On.int,intHex:On.intHex,intOct:On.intOct,intTime:Gs.intTime,map:ol.map,merge:Mt.merge,null:im.nullTag,omap:cl.omap,pairs:ul.pairs,seq:al.seq,set:fl.set,timestamp:Gs.timestamp},lm={"tag:yaml.org,2002:binary":ll.binary,"tag:yaml.org,2002:merge":Mt.merge,"tag:yaml.org,2002:omap":cl.omap,"tag:yaml.org,2002:pairs":ul.pairs,"tag:yaml.org,2002:set":fl.set,"tag:yaml.org,2002:timestamp":Gs.timestamp};function cm(e,t,s){let i=nl.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(nl.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"?rl[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(rl).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=lm;Tn.getTags=cm});var _n=A(pl=>{"use strict";var Mn=D(),um=tt(),fm=st(),dm=It(),Ws=dl(),pm=(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)?Ws.getTags(t,"compat"):t?Ws.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=n?Ws.coreKnownTags:{},this.tags=Ws.getTags(s,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,Mn.MAP,{value:um.map}),Object.defineProperty(this,Mn.SCALAR,{value:dm.string}),Object.defineProperty(this,Mn.SEQ,{value:fm.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?pm:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};pl.Schema=Dn});var hl=A(ml=>{"use strict";var mm=D(),qn=Et(),Dt=St();function hm(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(mm.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
|
+
`}ml.stringifyDocument=hm});var _t=A(gl=>{"use strict";var gm=vt(),nt=gs(),re=D(),ym=Se(),bm=be(),wm=_n(),vm=hl(),Fn=ds(),km=Ui(),Sm=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 gm.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 g=v=>typeof v=="number"||v instanceof String||v instanceof Number,b=s.filter(g).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:m}=Fn.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:m},h=Sm.createNode(t,d,y);return a&&re.isCollection(h)&&(h.flow=!0),p(),h}createPair(t,s,i={}){let n=this.createNode(t,null,i),r=this.createNode(s,null,i);return new ym.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 wm.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=bm.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"?km.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 vm.stringifyDocument(this,t)}};function rt(e){if(re.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}gl.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)}},$m=(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=$m});var Bt=A(yl=>{"use strict";function xm(e,{flow:t,indicator:s,next:i,offset:n,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,d=a,f="",p="",m=!1,y=!1,h=null,g=null,b=null,v=null,k=null,x=null,S=null;for(let P of e)switch(y&&(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"),y=!1),h&&(c&&P.type!=="comment"&&P.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),P.type){case"space":!t&&(s!=="doc-start"||i?.type!=="flow-collection")&&P.source.includes(" ")&&(h=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,m=!0,(g||b)&&(v=P),d=!0;break;case"anchor":g&&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),g=P,S??(S=P.offset),c=!1,d=!1,y=!0;break;case"tag":{b&&r(P,"MULTIPLE_TAGS","A node can have at most one tag"),b=P,S??(S=P.offset),c=!1,d=!1,y=!0;break}case s:(g||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){k&&r(P,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),k=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 y&&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"),h&&(c&&h.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:k,found:x,spaceBefore:l,comment:f,hasNewline:m,anchor:g,tag:b,newlineAfterProp:v,end:O,start:S??O}}yl.resolveProps=xm});var zs=A(bl=>{"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}}bl.containsNewline=Kn});var Jn=A(wl=>{"use strict";var Cm=zs();function Em(e,t,s){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&Cm.containsNewline(t)&&s(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}wl.flowIndentCheck=Em});var Hn=A(kl=>{"use strict";var vl=D();function Am(e,t,s){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let n=typeof i=="function"?i:(r,o)=>r===o||vl.isScalar(r)&&vl.isScalar(o)&&r.value===o.value;return t.some(r=>n(r.key,s))}kl.mapIncludes=Am});var Al=A(El=>{"use strict";var Sl=Se(),Pm=xe(),$l=Bt(),Nm=zs(),xl=Jn(),Im=Hn(),Cl="All mapping items must start at the same column";function Lm({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=r?.nodeClass??Pm.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:m,value:y}=d,h=$l.resolveProps(f,{indicator:"explicit-key-ind",next:p??m?.[0],offset:l,onError:n,parentIndent:i.indent,startOnNewline:!0}),g=!h.found;if(g){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",Cl)),!h.anchor&&!h.tag&&!m){c=h.end,h.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Nm.containsNewline(p))&&n(p??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==i.indent&&n(l,"BAD_INDENT",Cl);s.atKey=!0;let b=h.end,v=p?e(s,p,h,n):t(s,b,f,null,h,n);s.schema.compat&&xl.flowIndentCheck(i.indent,p,n),s.atKey=!1,Im.mapIncludes(s,a.items,v)&&n(b,"DUPLICATE_KEY","Map keys must be unique");let k=$l.resolveProps(m??[],{indicator:"map-value-ind",next:y,offset:v.range[2],onError:n,parentIndent:i.indent,startOnNewline:!p||p.type==="block-scalar"});if(l=k.end,k.found){g&&(y?.type==="block-map"&&!k.hasNewline&&n(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&h.start<k.found.offset-1024&&n(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=y?e(s,y,k,n):t(s,l,m,null,k,n);s.schema.compat&&xl.flowIndentCheck(i.indent,y,n),l=x.range[2];let S=new Sl.Pair(v,x);s.options.keepSourceTokens&&(S.srcToken=d),a.items.push(S)}else{g&&n(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),k.comment&&(v.comment?v.comment+=`
|
|
67
|
+
`+k.comment:v.comment=k.comment);let x=new Sl.Pair(v);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}El.resolveBlockMap=Lm});var Nl=A(Pl=>{"use strict";var Rm=Ce(),Om=Bt(),Tm=Jn();function Mm({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=r?.nodeClass??Rm.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=Om.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 m=f?e(s,f,p,n):t(s,p.end,d,null,p,n);s.schema.compat&&Tm.flowIndentCheck(i.indent,f,n),l=m.range[2],a.items.push(m)}return a.range=[i.offset,l,c??l],a}Pl.resolveBlockSeq=Mm});var ot=A(Il=>{"use strict";function Dm(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}}Il.resolveEnd=Dm});var Tl=A(Ol=>{"use strict";var _m=D(),qm=Se(),Ll=xe(),Fm=Ce(),jm=ot(),Rl=Bt(),Bm=zs(),Um=Hn(),Yn="Block collections are not allowed within flow collections",Gn=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Vm({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=i.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?Ll.YAMLMap:Fm.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 g=0;g<i.items.length;++g){let b=i.items[g],{start:v,key:k,sep:x,value:S}=b,E=Rl.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:k??x?.[0],offset:f,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!x&&!S){g===0&&E.comma?n(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<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&&Bm.containsNewline(k)&&n(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===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 v)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];_m.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=S?e(s,S,E,n):t(s,E.end,x,null,E,n);c.items.push(O),f=O.range[2],Gn(S)&&n(O.range,"BLOCK_IN_FLOW",Yn)}else{s.atKey=!0;let O=E.end,P=k?e(s,k,E,n):t(s,O,v,null,E,n);Gn(k)&&n(P.range,"BLOCK_IN_FLOW",Yn),s.atKey=!1;let M=Rl.resolveProps(x??[],{flow:a,indicator:"map-value-ind",next:S,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 S&&("source"in S&&S.source?.[0]===":"?n(S,"MISSING_CHAR",`Missing space after : in ${a}`):n(M.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let w=S?e(s,S,M,n):M.found?t(s,M.end,x,null,M,n):null;w?Gn(S)&&n(w.range,"BLOCK_IN_FLOW",Yn):M.comment&&(P.comment?P.comment+=`
|
|
70
|
+
`+M.comment:P.comment=M.comment);let $=new qm.Pair(P,w);if(s.options.keepSourceTokens&&($.srcToken=b),o){let I=c;Um.mapIncludes(s,I.items,P)&&n(O,"DUPLICATE_KEY","Map keys must be unique"),I.items.push($)}else{let I=new Ll.YAMLMap(s.schema);I.flow=!0,I.items.push($);let L=(w??P).range;I.range=[P.range[0],L[1],L[2]],c.items.push(I)}f=w?w.range[2]:M.end}}let p=o?"}":"]",[m,...y]=i.end,h=f;if(m?.source===p)h=m.offset+m.source.length;else{let g=a[0].toUpperCase()+a.substring(1),b=d?`${g} must end with a ${p}`:`${g} in block collection must be sufficiently indented and end with a ${p}`;n(f,d?"MISSING_CHAR":"BAD_INDENT",b),m&&m.source.length!==1&&y.unshift(m)}if(y.length>0){let g=jm.resolveEnd(y,h,s.options.strict,n);g.comment&&(c.comment?c.comment+=`
|
|
71
|
+
`+g.comment:c.comment=g.comment),c.range=[i.offset,h,g.offset]}else c.range=[i.offset,h,h];return c}Ol.resolveFlowCollection=Vm});var Dl=A(Ml=>{"use strict";var Km=D(),Jm=F(),Hm=xe(),Ym=Ce(),Gm=Al(),Wm=Nl(),zm=Tl();function Wn(e,t,s,i,n,r){let o=s.type==="block-map"?Gm.resolveBlockMap(e,t,s,i,r):s.type==="block-seq"?Wm.resolveBlockSeq(e,t,s,i,r):zm.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 Qm(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:m}=i,y=p&&r?p.offset>r.offset?p:r:p??r;y&&(!m||m.offset<y.offset)&&n(y,"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===Hm.YAMLMap.tagName&&a==="map"||o===Ym.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=Km.isNode(d)?d:new Jm.Scalar(d);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}Ml.composeCollection=Qm});var Qn=A(_l=>{"use strict";var zn=F();function Xm(e,t,s){let i=t.offset,n=Zm(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?eh(t.source):[],a=o.length;for(let h=o.length-1;h>=0;--h){let g=o[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=n.chomp==="+"&&o.length>0?`
|
|
72
|
+
`.repeat(Math.max(1,o.length-1)):"",g=i+n.length;return t.source&&(g+=t.source.length),{value:h,type:r,comment:n.comment,range:[i,g,g]}}let l=t.indent+n.indent,c=t.offset+n.length,d=0;for(let h=0;h<a;++h){let[g,b]=o[h];if(b===""||b==="\r")n.indent===0&&g.length>l&&(l=g.length);else{g.length<l&&s(c+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(l=g.length),d=h,l===0&&!e.atRoot&&s(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=g.length+b.length+1}for(let h=o.length-1;h>=a;--h)o[h][0].length>l&&(a=h+1);let f="",p="",m=!1;for(let h=0;h<d;++h)f+=o[h][0].slice(l)+`
|
|
73
|
+
`;for(let h=d;h<a;++h){let[g,b]=o[h];c+=g.length+b.length+1;let v=b[b.length-1]==="\r";if(v&&(b=b.slice(0,-1)),b&&g.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-(v?2:1),"BAD_INDENT",x),g=""}r===zn.Scalar.BLOCK_LITERAL?(f+=p+g.slice(l)+b,p=`
|
|
74
|
+
`):g.length>l||b[0]===" "?(p===" "?p=`
|
|
75
|
+
`:!m&&p===`
|
|
76
|
+
`&&(p=`
|
|
77
|
+
|
|
78
|
+
`),f+=p+g.slice(l)+b,p=`
|
|
79
|
+
`,m=!0):b===""?p===`
|
|
80
|
+
`?f+=`
|
|
81
|
+
`:p=`
|
|
82
|
+
`:(f+=p+b,p=" ",m=!1)}switch(n.chomp){case"-":break;case"+":for(let h=a;h<o.length;++h)f+=`
|
|
83
|
+
`+o[h][0].slice(l);f[f.length-1]!==`
|
|
84
|
+
`&&(f+=`
|
|
85
|
+
`);break;default:f+=`
|
|
86
|
+
`}let y=i+n.length+t.source.length;return{value:f,type:r,comment:n.comment,range:[i,y,y]}}function Zm({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 m=n[p];if(!a&&(m==="-"||m==="+"))a=m;else{let y=Number(m);!o&&y?o=y: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 m=t[p];switch(m.type){case"space":c=!0;case"newline":f+=m.source.length;break;case"comment":s&&!c&&i(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=m.source.length,d=m.source.substring(1);break;case"error":i(m,"UNEXPECTED_TOKEN",m.message),f+=m.source.length;break;default:{let y=`Unexpected token in block scalar header: ${m.type}`;i(m,"UNEXPECTED_TOKEN",y);let h=m.source;h&&typeof h=="string"&&(f+=h.length)}}}return{mode:r,indent:o,chomp:a,comment:d,length:f}}function eh(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}_l.resolveBlockScalar=Xm});var Zn=A(Fl=>{"use strict";var Xn=F(),th=ot();function sh(e,t,s){let{offset:i,type:n,source:r,end:o}=e,a,l,c=(p,m,y)=>s(i+p,m,y);switch(n){case"scalar":a=Xn.Scalar.PLAIN,l=ih(r,c);break;case"single-quoted-scalar":a=Xn.Scalar.QUOTE_SINGLE,l=nh(r,c);break;case"double-quoted-scalar":a=Xn.Scalar.QUOTE_DOUBLE,l=rh(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=th.resolveEnd(o,d,t,s);return{value:l,type:a,comment:f.comment,range:[i,d,f.offset]}}function ih(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}`),ql(e)}function nh(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),ql(e.slice(1,-1)).replace(/''/g,"'")}function ql(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 rh(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}=oh(e,i);s+=r,i=o}else if(n==="\\"){let r=e[++i],o=ah[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+=lh(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 oh(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 ah={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 lh(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)}Fl.resolveFlowScalar=sh});var Ul=A(Bl=>{"use strict";var Ue=D(),jl=F(),ch=Qn(),uh=Zn();function fh(e,t,s,i){let{value:n,type:r,comment:o,range:a}=t.type==="block-scalar"?ch.resolveBlockScalar(e,t,i):uh.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=dh(e.schema,n,l,s,i):t.type==="scalar"?c=ph(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 jl.Scalar(f)}catch(f){let p=f instanceof Error?f.message:String(f);i(s??t,"TAG_RESOLVE_FAILED",p),d=new jl.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 dh(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 ph({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}Bl.composeScalar=fh});var Kl=A(Vl=>{"use strict";function mh(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}Vl.emptyScalarPosition=mh});var Yl=A(tr=>{"use strict";var hh=vt(),gh=D(),yh=Dl(),Jl=Ul(),bh=ot(),wh=Kl(),vh={composeNode:Hl,composeEmptyNode:er};function Hl(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=kh(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=Jl.composeScalar(e,t,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=yh.composeCollection(vh,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&&(!gh.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:wh.emptyScalarPosition(t,s,i),indent:-1,source:""},f=Jl.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 kh({options:e},{offset:t,source:s,end:i},n){let r=new hh.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=bh.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=Hl});var zl=A(Wl=>{"use strict";var Sh=_t(),Gl=Yl(),$h=ot(),xh=Bt();function Ch(e,t,{offset:s,start:i,value:n,end:r},o){let a=Object.assign({_directives:t},e),l=new Sh.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=xh.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?Gl.composeNode(c,n,d,o):Gl.composeEmptyNode(c,d.end,i,null,d,o);let f=l.contents.range[2],p=$h.resolveEnd(r,f,!1,o);return p.comment&&(l.comment=p.comment),l.range=[s,f,p.offset],l}Wl.composeDoc=Ch});var ir=A(Zl=>{"use strict";var Eh=Zt("process"),Ah=Bi(),Ph=_t(),Ut=jt(),Ql=D(),Nh=zl(),Ih=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 Xl(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 Ah.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,s){let{comment:i,afterEmptyLine:n}=Xl(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(Ql.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];Ql.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:Xl(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(Eh.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=Nh.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=Ih.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 Ph.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}}};Zl.Composer=sr});var sc=A(Qs=>{"use strict";var Lh=Qn(),Rh=Zn(),Oh=jt(),ec=Ct();function Th(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 Oh.YAMLParseError([a,a+1],r,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Rh.resolveFlowScalar(e,t,i);case"block-scalar":return Lh.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function Mh(e,t){let{implicitKey:s=!1,indent:i,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=t,a=ec.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 tc(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 Dh(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=ec.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">":_h(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 _h(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}];tc(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 tc(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})}}}Qs.createScalarToken=Mh;Qs.resolveAsScalar=Th;Qs.setScalarValue=Dh});var nc=A(ic=>{"use strict";var qh=e=>"type"in e?Zs(e):Xs(e);function Zs(e){switch(e.type){case"block-scalar":{let t="";for(let s of e.props)t+=Zs(s);return t+e.source}case"block-map":case"block-seq":{let t="";for(let s of e.items)t+=Xs(s);return t}case"flow-collection":{let t=e.start.source;for(let s of e.items)t+=Xs(s);for(let s of e.end)t+=s.source;return t}case"document":{let t=Xs(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 Xs({start:e,key:t,sep:s,value:i}){let n="";for(let r of e)n+=r.source;if(t&&(n+=Zs(t)),s)for(let r of s)n+=r.source;return i&&(n+=Zs(i)),n}ic.stringify=qh});var lc=A(ac=>{"use strict";var rr=Symbol("break visit"),Fh=Symbol("skip children"),rc=Symbol("remove item");function Ve(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),oc(Object.freeze([]),e,t)}Ve.BREAK=rr;Ve.SKIP=Fh;Ve.REMOVE=rc;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 oc(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=oc(Object.freeze(e.concat([[n,o]])),r.items[o],s);if(typeof a=="number")o=a-1;else{if(a===rr)return rr;a===rc&&(r.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}ac.visit=Ve});var ei=A(Z=>{"use strict";var or=sc(),jh=nc(),Bh=lc(),ar="\uFEFF",lr="",cr="",ur="",Uh=e=>!!e&&"items"in e,Vh=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Kh(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 Jh(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=jh.stringify;Z.visit=Bh.visit;Z.BOM=ar;Z.DOCUMENT=lr;Z.FLOW_END=cr;Z.SCALAR=ur;Z.isCollection=Uh;Z.isScalar=Vh;Z.prettyToken=Kh;Z.tokenType=Jh});var pr=A(uc=>{"use strict";var Kt=ei();function ce(e){switch(e){case void 0:case" ":case`
|
|
119
|
+
`:case"\r":case" ":return!0;default:return!1}}var cc=new Set("0123456789ABCDEFabcdef"),Hh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ti=new Set(",[]{}"),Yh=new Set(` ,[]{}
|
|
120
|
+
\r `),fr=e=>!e||Yh.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&&ti.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&&ti.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&&ti.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&&ti.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(Hh.has(s))s=this.buffer[++t];else if(s==="%"&&cc.has(this.buffer[t+1])&&cc.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)}};uc.Lexer=dr});var hr=A(fc=>{"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}}}};fc.LineCounter=mr});var yr=A(gc=>{"use strict";var Gh=Zt("process"),dc=ei(),Wh=pr();function Ee(e,t){for(let s=0;s<e.length;++s)if(e[s].type===t)return!0;return!1}function pc(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 hc(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 si(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 mc(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,hc(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 Wh.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,Gh.env.LOG_TOKENS&&console.log("|",dc.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let s=dc.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"&&mc(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&&pc(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":{pc(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=si(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(hc(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=si(i),r=at(n);mc(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=si(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=si(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())}}};gc.Parser=gr});var kc=A(Ht=>{"use strict";var yc=ir(),zh=_t(),Jt=jt(),Qh=en(),Xh=D(),Zh=hr(),bc=yr();function wc(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Zh.LineCounter||null,prettyErrors:t}}function eg(e,t={}){let{lineCounter:s,prettyErrors:i}=wc(t),n=new bc.Parser(s?.addNewLine),r=new yc.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 vc(e,t={}){let{lineCounter:s,prettyErrors:i}=wc(t),n=new bc.Parser(s?.addNewLine),r=new yc.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 tg(e,t,s){let i;typeof t=="function"?i=t:s===void 0&&t&&typeof t=="object"&&(s=t);let n=vc(e,s);if(!n)return null;if(n.warnings.forEach(r=>Qh.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 sg(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 Xh.isDocument(e)&&!i?e.toString(s):new zh.Document(e,i,s).toString(s)}Ht.parse=tg;Ht.parseAllDocuments=eg;Ht.parseDocument=vc;Ht.stringify=sg});var wr=A(_=>{"use strict";var ig=ir(),ng=_t(),rg=_n(),br=jt(),og=vt(),Ae=D(),ag=Se(),lg=F(),cg=xe(),ug=Ce(),fg=ei(),dg=pr(),pg=hr(),mg=yr(),ii=kc(),Sc=gt();_.Composer=ig.Composer;_.Document=ng.Document;_.Schema=rg.Schema;_.YAMLError=br.YAMLError;_.YAMLParseError=br.YAMLParseError;_.YAMLWarning=br.YAMLWarning;_.Alias=og.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=ag.Pair;_.Scalar=lg.Scalar;_.YAMLMap=cg.YAMLMap;_.YAMLSeq=ug.YAMLSeq;_.CST=fg;_.Lexer=dg.Lexer;_.LineCounter=pg.LineCounter;_.Parser=mg.Parser;_.parse=ii.parse;_.parseAllDocuments=ii.parseAllDocuments;_.parseDocument=ii.parseDocument;_.stringify=ii.stringify;_.visit=Sc.visit;_.visitAsync=Sc.visitAsync});import{execFile as $f}from"child_process";import{promisify as xf}from"util";import{mkdtemp as xo,readdir as Cf,readFile as Di,rm as ns,cp as Ef,access as Mi,stat as Af,lstat as Pf,symlink as Nf,mkdir as If}from"fs/promises";import{join as pe,resolve as Co,relative as Lf,basename as Rf}from"path";import{homedir as Eo}from"os";import{tmpdir as Ao}from"os";import{readdir as gf,readFile as yf,stat as bf}from"fs/promises";import{join as wf}from"path";var vf=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"]),kf=512*1024;async function ss(e){let t=[];async function s(i,n){let r;try{r=await gf(i)}catch{return}for(let o of r){if(o===".git"||o==="node_modules")continue;let a=wf(i,o),l=n?`${n}/${o}`:o;try{let c=await bf(a);if(c.isDirectory())await s(a,l);else if(c.isFile()){let d=o.includes(".")?`.${o.split(".").pop().toLowerCase()}`:"";if(vf.has(d)||c.size>kf)continue;try{let f=await yf(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 Sf(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,y=p.length>0&&p.every(g=>e.selected[g])?u.green("[*]"):"[ ]",h=e.filter!==""?`Select All Matching (${e.filteredMap.length})`:"Select All / Deselect All";i.push(`${f} ${y} ${u.bold(h)}`)}else{let p=e.filteredMap[c-1],m=t[p],h=e.selected[p]?u.green("[*]"):"[ ]",g=`${f} ${h} `,b=7,v=u.bold(m.label),k=m.label.length;if(m.hint){let x=s-b-k-2;if(x>10){let S=Ri(m.hint,x);i.push(`${g}${v} ${u.dim(S)}`)}else{let S=Ri(m.label,s-b);i.push(`${g}${u.bold(S)}`)}}else{let x=Ri(m.label,s-b);i.push(`${g}${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=Sf(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",h),typeof r.setRawMode=="function"&&r.setRawMode(!1),r.pause(),n.write("\x1B[?25h"),f&&clearTimeout(f)}function m(g){p(),c(g)}function y(g){if(i.searchActive){if(g==="\x1B"){i.searchActive=!1,i.filter="",i.applyFilter(t),l();return}if(g==="\r"||g===`
|
|
144
|
+
`){i.searchActive=!1,l();return}if(g==="\x7F"||g==="\b"){i.filter.length>0?(i.filter=i.filter.slice(0,-1),i.applyFilter(t)):i.searchActive=!1,l();return}if(g===""){p(),process.kill(process.pid,"SIGINT");return}if(g==="\x1B[A"){i.moveUp(),l();return}if(g==="\x1B[B"){i.moveDown(),l();return}if(g===" "){i.toggleCurrent(),l();return}if(g.length===1&&g>=" "&&g<="~"){i.filter+=g,i.applyFilter(t),l();return}return}switch(g){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
|
+
`:m(i.getSelectedIndices());break;case"\x1B":i.filter!==""?(i.filter="",i.applyFilter(t),l()):m([]);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 h(g){if(d.length>0){if(d+=g,f&&clearTimeout(f),d.length>=3&&d[1]==="["){let v=d.slice(0,3),k=d.slice(3);d="",y(v),k&&h(k);return}let b=d;d="",y("\x1B");for(let v=1;v<b.length;v++)y(b[v]);return}for(let b=0;b<g.length;b++){let v=g[b];if(v==="\x1B"){let k=g.slice(b);if(k.length>=3&&k[1]==="[")y(k.slice(0,3)),b+=2;else if(k.length>=2){d=k,f=setTimeout(()=>{let x=d;d="",y("\x1B");for(let S=1;S<x.length;S++)y(x[S])},50);return}else{d="\x1B",f=setTimeout(()=>{d="",y("\x1B")},50);return}}else y(v)}}r.on("data",h)})}var Re=xf($f),Of=/^[a-zA-Z0-9_-]+$/,Tf=/^[a-zA-Z0-9._-]+$/,Mf=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,Po=128,Df=/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\/tree\/(.+))?\/?$/;function _f(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 qf(e){let t;e==="~"?t=Eo():e.startsWith("~/")||e.startsWith("~\\")?t=Co(Eo(),e.slice(2)):t=Co(e);let s=Rf(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(_f(e))return qf(e);let t=Df.exec(e);if(t){let[,f,p,m]=t,y=p.endsWith(".git")?p.slice(0,-4):p;e=`github:${f}/${y}${m?`#${m}`:""}`}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(!Of.test(l))throw new Error(`Invalid source: owner contains invalid characters: "${l}". Allowed: [a-zA-Z0-9_-]`);if(!Tf.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 rs(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>Po)throw new Error(`Invalid skill name: exceeds maximum length of ${Po} characters`);if(!Mf.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 Ff(e){let t=e.split(/[/\\]/).filter(Boolean),s=t.length>0?t[t.length-1]:e;return Te(s)}function No(e){let t=new Map;for(let s of e){let i=Ff(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 jf(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 is(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 xo(pe(Ao(),"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(is(n))}}try{return await Ti(e.cloneUrl,e.ref,s)}catch(i){if(!jf(i))throw await ne(s),new Error(is(i));N("install: HTTPS clone failed with auth error, retrying with SSH..."),await ne(s);let n=await xo(pe(Ao(),"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: ${is(i)}
|
|
155
|
+
SSH: ${is(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 os(e,t=5){let s=[];async function i(n,r,o){let a;try{a=await Cf(n)}catch{return}for(let l of a){if(l===".git"||l==="node_modules")continue;let c=pe(n,l);try{if(!(await Af(c)).isDirectory())continue}catch{continue}let d=r?`${r}/${l}`:l,f=o+1,p=pe(c,"SKILL.md");try{let m=await Di(p,"utf-8"),y=ie(m);s.push({relPath:d,name:y.name||l,version:ae(y),description:(y.description||"").replace(/\s*\n\s*/g," ").trim(),effort:y.effort||y["metadata.effort"]||void 0,license:(y.license||"").trim(),creator:(y["metadata.creator"]||"").trim(),compatibility:(y.compatibility||"").trim(),allowedTools:to(y),tokenCount:es(m)})}catch{f<t&&await i(c,d,f)}}}return await i(e,"",0),s.sort((n,r)=>n.name.localeCompare(r.name)),s}var Bf=[{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 Io(e){let t=[],s=await ss(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 Bf)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 as(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 ns(e.targetDir,{recursive:!0,force:!0})}catch{}let s=e.sourceDir;try{await Ef(s,e.targetDir,{recursive:!0})}catch(a){throw new Error(`Failed to install: ${a.message}`)}let i=pe(e.targetDir,".git");try{await ns(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 Lo(e,t){let s=await as(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 If(r,{recursive:!0});try{if((await Pf(o)).isSymbolicLink())await ns(o);else{N(`install: skipping ${o} \u2014 existing non-symlink directory`);continue}}catch{}let a=Lf(r,e.targetDir);await Nf(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 ns(e,{recursive:!0,force:!0})}catch{}}async function Ro(){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 Oo(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 To(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(m=>m.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(y=>y.name==="agents")||i[0],allProviders:i}}if(t){let m=e.providers.find(y=>y.name===t);if(!m){let y=e.providers.map(h=>h.name).join(", ");throw new Error(`Unknown provider: "${t}". Valid providers: ${y}, all`)}if(!m.enabled)throw new Error(`Provider "${t}" is disabled. Enable it in your config or choose another provider.`);return{provider:m,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 m=i.map(y=>y.name).join(", ");throw new Error(`--tool (or --provider) is required in non-interactive mode. Available: ${m}, all`)}let n=e.preferences.selectedTools,o=n&&n.length>0?new Set(n):null,a=e.providers.map(m=>({label:`${m.label} (${m.name})`,hint:m.global,checked:o?o.has(m.name):m.name==="agents"})),l=await We({items:a});if(l.length===0)throw new Error("No tools selected. Aborting.");let c=l.map(m=>e.providers[m]),d=c.map(m=>m.name),{saveSelectedTools:f}=await import("./config-55HAAFSH.js");return await f(d),c.length===1?{provider:c[0],allProviders:null}:{provider:c.find(m=>m.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 Mo(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 xc=Wr(wr(),1);import{readFile as hg}from"fs/promises";import{join as gg}from"path";var $c=500;function yg(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 bg(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 wg(e){let t=bg(e);if(t===null)return null;try{return(0,xc.parse)(t),null}catch(s){return s.message||"invalid YAML"}}async function Cc(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=gg(e.path,"SKILL.md"),n=await hg(i,"utf-8");yg(n)||t.push({category:"empty-body",message:"SKILL.md contains only frontmatter with no body content"});let r=wg(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>$c&&t.push({category:"high-file-count",message:`Skill has ${s} files (threshold: ${$c})`}),t}import{join as Ag}from"path";import{homedir as Pg}from"os";import{readFile as vg,writeFile as kg,mkdir as Sg}from"fs/promises";import{dirname as $g}from"path";async function xg(e){try{let t=await vg(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 Cg(e,t,s){let i={fetched_at:new Date().toISOString(),ttl_seconds:s,data:t};try{await Sg($g(e),{recursive:!0}),await kg(e,JSON.stringify(i,null,2),"utf-8"),N(`http: wrote cache -> ${e}`)}catch(n){N(`http: failed to write cache: ${n}`)}}function Eg(e){let t=new Date(e.fetched_at).getTime();return(Date.now()-t)/1e3<e.ttl_seconds}async function Ec(e,t,s={}){let i=s.ttl??3600,n=s.noCache??!1,r=await xg(t);if(r&&!n&&Eg(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 Cg(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 Ng=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,Ig=/^[a-zA-Z0-9_-]+$/,Nc=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/,Lg=/^[0-9a-f]{40}$/,Rg=/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/,Og=/^[a-z0-9-]+$/,Tg=/^sha256:[0-9a-f]{64}$/,Ac=["pass","warning","dangerous"];function ni(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:Ng,maxLength:128},{field:"author",pattern:Ig,maxLength:39},{field:"description",maxLength:256},{field:"repository",pattern:Nc},{field:"commit",pattern:Lg},{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"||!Ac.includes(r))&&t.push({field:"security_verdict",message:`"security_verdict" must be one of: ${Ac.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"||!Rg.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`}),Og.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"||!Tg.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 Mg(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 Dg(e,t,s=2){let i=[];for(let n of t){if(e===n)continue;let r=Mg(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",_g=process.env.ASM_REGISTRY_CACHE??Ag(Pg(),".config","agent-skill-manager","registry-cache.json"),qg=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 Ec(vr,_g,{ttl:qg,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=ni(i);if(n.length>0){N(`registry: dropping invalid manifest entry (${i?.name??"unknown"}): ${n.map(r=>r.message).join(", ")}`);continue}if(!Nc.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 Fg(e,t){return t.manifests.filter(s=>s.name.toLowerCase()===e.toLowerCase())}function jg(e,t,s){return s.manifests.find(i=>i.author.toLowerCase()===e.toLowerCase()&&i.name.toLowerCase()===t.toLowerCase())??null}function Pc(e,t,s=5){return Dg(e,t.manifests.map(n=>n.name),3).slice(0,s).map(n=>n.existingName)}async function Ic(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=jg(r,o,s);if(a)return{resolved:{manifest:a,source:"registry"},multipleMatches:[],suggestions:[]};let l=Pc(o,s);return{resolved:null,multipleMatches:[],suggestions:l}}let i=Fg(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=Pc(e,s);return{resolved:null,multipleMatches:[],suggestions:n}}function Lc(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 Bg,access as Oc,mkdir as Ug,cp as Rc,rm as Vg,symlink as Kg}from"fs/promises";import{join as Tc,basename as Jg}from"path";function Hg(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 Mc(e){let t;try{t=await Bg(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=Hg(s);if(!i.valid)throw new Error(`Invalid manifest:
|
|
161
|
+
${i.errors.join(`
|
|
162
|
+
`)}`);return s}async function Yg(e){try{return await Oc(e),!0}catch{return!1}}function Gg(e,t){return e.providers.find(s=>s.name===t&&s.enabled)}function Wg(e,t,s,i){let n=Gg(e,t);if(!n)return null;let r=s==="global"?n.global:n.project,o=oe(r),a=Jg(i);return!a||a==="."||a===".."?null:Tc(o,a)}function zg(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 Dc(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=Wg(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 Yg(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=zg(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 Ug(Tc(d,".."),{recursive:!0}),f&&await Vg(d,{recursive:!0,force:!0}),c.isSymlink&&c.symlinkTarget)try{await Oc(c.symlinkTarget),await Kg(c.symlinkTarget,d),N(`import: symlinked "${c.name}" -> ${c.symlinkTarget} at ${d}`)}catch{await Rc(p.realPath,d,{recursive:!0}),N(`import: symlink target unreachable, copied "${c.name}" from ${p.realPath} to ${d}`)}else await Rc(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(m){r.push({skillName:c.name,provider:c.provider,scope:c.scope,status:"failed",reason:`Copy failed: ${m.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 Qg,writeFile as Xg,access as Zg}from"fs/promises";import{join as ey}from"path";function ty(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,70 +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 _c(e,t){await Qg(t,{recursive:!0});let s=ey(t,"SKILL.md"),i=ty(e);await Xg(s,i,"utf-8")}async function qc(e){try{return await Zg(e),!0}catch{return!1}}import{readdir as sy,stat as iy}from"fs/promises";import{join as ny}from"path";async function ry(e){let t=0;try{let i=(await sy(e,{recursive:!0})).map(async r=>{try{let o=await iy(ny(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 jc(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 ry(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 oy(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 Fc={claude:"Claude Code",codex:"Codex",openclaw:"OpenClaw",agents:"Agents"};function Bc(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(oy(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])=>(Fc[l]||l).length));for(let[l,c]of s){let d=Fc[l]||l,f=ao(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 ay,lstat as Cr,mkdir as ly,readdir as cy,readFile as Uc,rm as uy,symlink as fy}from"fs/promises";import{join as ri}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=ri(e,"SKILL.md"),i;try{i=await Uc(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 Vc(e,t,s,i){let n=ri(t,s),r=!1;try{await ay(n),r=!0}catch{}if(r){if(!i)throw new Error(`Target already exists: ${n}. Use --force to overwrite.`);await uy(n,{recursive:!0,force:!0})}await ly(t,{recursive:!0}),await fy(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 cy(e),i=[];for(let n of s){if(n.startsWith(".")||n==="node_modules")continue;let r=ri(e,n);try{if(!(await Cr(r)).isDirectory())continue}catch{continue}let o=ri(r,"SKILL.md");try{let a=await Uc(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 dy,writeFile as py,readdir as Kc,access as Jc,mkdir as my,rm as hy}from"fs/promises";import{join as Je,resolve as Hc,dirname as gy}from"path";import{homedir as yy}from"os";import{fileURLToPath as by}from"url";var wy=by(import.meta.url),vy=gy(wy),Ke=Je(yy(),".config","agent-skill-manager","bundles"),oi=Hc(vy,"..","data","bundles");function ky(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 Yc(e,t,s,i,n){return{version:1,name:e,description:t,author:s,createdAt:new Date().toISOString(),skills:i,tags:n}}async function Gc(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 Sy(){await my(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 Sy();let t=`${Pr(e.name)}.json`,s=Je(Ke,t);return await py(s,JSON.stringify(e,null,2)+`
|
|
185
|
+
`,"utf-8"),N(`bundle: saved to ${s}`),s}async function Yt(e){let t;try{t=await dy(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=ky(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=Hc(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(oi,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 Wc(){let e=[];try{await Jc(oi)}catch{return e}let t;try{t=await Kc(oi)}catch{return e}for(let s of t){if(!s.endsWith(".json"))continue;let i=Je(oi,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 zc(){let e=[];try{await Jc(Ke)}catch{return e}let t;try{t=await Kc(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 Qc(e){let t=`${Pr(e)}.json`,s=Je(Ke,t);try{return await hy(s),N(`bundle: removed ${s}`),!0}catch(i){if(i?.code==="ENOENT")return!1;throw i}}import{readFile as Ry,realpath as Oy}from"fs/promises";import{join as Ty,resolve as My,relative as Dy}from"path";var eu=[{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 $y(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 xy(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 eu)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 Cy(e){let t=new Map;for(let r of e)for(let o of r.matches)for(let a of eu)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 Ey(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 ss(e),r=n.reduce((f,p)=>f+p.lineCount,0),o=null;s&&i&&(o=await $y(s,i));let a=xy(n),l=Cy(a),{verdict:c,reason:d}=Ey(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,Ay={"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"},Xc={critical:0,warning:1,info:2};function Py(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 Ny(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 ai(e){return e.toLocaleString("en-US")}function tu(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function Zc(e){return tu(e).length}function Iy(e){let t=new Map;for(let s of e){let i=`${s.file}:${s.line}`,n=t.get(i);(!n||Xc[s.severity]<Xc[n.severity])&&t.set(i,s)}return Array.from(t.values())}function Ly(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 li(e){let t=[],s=Py(e.verdict),i=tu(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(` ${ai(e.totalFiles)} files | ${ai(e.totalLines)} lines`)+" ".repeat(Math.max(1,o-` ${ai(e.totalFiles)} files | ${ai(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 m=f.publicRepos,y=m<3?R.yellow(`${m} repos`):m<10?R.cyan(`${m} repos`):R.green(`${m} repos`);p.push(y)}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=Ny(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 m=0,y=0,h=0;for(let k of e.codeScans)for(let x of k.matches)x.severity==="critical"?m++:x.severity==="warning"?y++:h++;let g=[];m>0&&g.push(R.red(`${m} critical`)),y>0&&g.push(R.yellow(`${y} warning`)),h>0&&g.push(R.dim(`${h} info`));let b=e.permissions.map(k=>k.type),v=b.length>0?R.dim(`Perms: ${b.join(", ")}`):"";t.push(` ${g.join(R.dim(" | "))} ${v}`)}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=Iy(f.matches),m=p.filter(w=>w.severity==="critical").length,y=p.filter(w=>w.severity==="warning").length,h=p.filter(w=>w.severity==="info").length,g=m>0?lt("critical"):y>0?lt("warning"):lt("info"),b=[];m>0&&b.push(R.red(`${m} critical`)),y>0&&b.push(R.yellow(`${y} warning`)),h>0&&b.push(R.dim(`${h} info`));let v=Ay[f.category],k=v?R.dim(`PERM: ${v}`):"",x=` ${g} ${R.bold(f.category)} (${b.join(", ")})`;if(k){let w=Zc(x),$=Zc(k),I=Math.max(2,He-w-$);t.push(x+" ".repeat(I)+k)}else t.push(x);let S=Ly(p),E=Math.min(24,Math.max(...S.map(w=>w.file.length))),O=0,P=3;for(let w of S){if(O>=P)break;let $=Ir(w.file,24),I=R.dim($.padEnd(E));if(w.entries.length===1){let L=w.entries[0],T=Ir(L.match,50);t.push(` ${I} :${L.line} ${R.dim("--")} ${L.severity==="critical"?T:R.dim(T)}`),O++}else if(w.entries.length<=3){let L=w.entries.map(K=>`:${K.line}`).join(", "),T=Ir(w.entries[0].match,40);t.push(` ${I} ${L} ${R.dim("--")} ${R.dim(T)}`),O++}else{let T=w.entries.slice(0,3).map(U=>`:${U.line}`).join(", "),K=w.entries.length-3;t.push(` ${I} ${T} ${R.dim(`(+${K} more)`)}`),O++}}let M=S.length-Math.min(S.length,P);if(M>0){let w=p.length-S.slice(0,P).reduce(($,I)=>$+I.entries.length,0);w>0&&t.push(` ${R.dim(`... ${w} 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 ci(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 _y(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/</g,"<").replace(/>/g,">").replace(/\|/g,"\\|")}function Rr(e){return _y(ci(e))}var Ye="luongnv89/asm-registry";async function qy(e){let t=Ty(e,"SKILL.md"),s;try{s=await Ry(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 Fy(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 jy(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 By(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 Uy(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 Vy(){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 Ky(e){switch(e){case"safe":case"caution":return"pass";case"warning":return"warning";case"dangerous":return"dangerous"}}function su(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 Jy(e){let t=su({metadata:e.metadata,author:e.metadata.creator||"unknown",commit:e.commit,repository:e.repository,securityVerdict:e.registryVerdict}),s=ni(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 iu(e){let t=My(e.path);N(`publish: starting for ${t}`),await Fy(t);let s=await qy(t);N(`publish: parsed metadata for "${s.name}"`);let n=await(e._auditFn??Pe)(t,s.name),r=Ky(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 jy(t),a=await Uy(t),l=await By(t),c=await Oy(t),d=Dy(l,c),f=d&&d!=="."?d:void 0,m=await(e._checkGhCliFn??Vy)();if(!m.available||!m.authenticated){let j=m.available?"gh CLI not authenticated":"gh CLI not found";return Jy({metadata:s,commit:o,repository:a,registryVerdict:r,securityReport:n,fallbackReason:j})}if(!m.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 y=m.login,h=su({metadata:s,author:y,commit:o,repository:a,skillPath:f,securityVerdict:r}),g=ni(h);if(g.length>0)return{success:!1,manifest:h,prUrl:null,error:`Manifest validation failed: ${g.map(j=>`${j.field}: ${j.message}`).join("; ")}`,securityVerdict:r,securityReport:n};if(e.dryRun)return{success:!0,manifest:h,prUrl:null,error:null,securityVerdict:r,securityReport:n};if(!e.yes){if(!process.stdin.isTTY)return{success:!1,manifest:h,prUrl:null,error:"Cannot prompt for confirmation in non-interactive mode. Use --yes to skip.",securityVerdict:r,securityReport:n};let j=ci(s.name),ye=ci(y);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="",Gr=hf=>{dt+=hf.toString(),dt.includes(`
|
|
194
|
+
`)&&(process.stdin.removeListener("data",Gr),process.stdin.pause(),Ie(dt.trim()))};process.stdin.resume(),process.stdin.on("data",Gr)});if(Ne.toLowerCase()!=="y"&&Ne.toLowerCase()!=="yes")return{success:!1,manifest:h,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/${y}/${s.name}`,v=`manifests/${y}/${s.name}.json`,k=JSON.stringify(h,null,2)+`
|
|
195
|
+
`,x=Buffer.from(k,"utf-8").toString("base64"),{stdout:S,exitCode:E}=await V(["gh","api",`repos/${y}/asm-registry/git/refs/heads/main`,"--jq",".object.sha"]);if(E!==0)return{success:!1,manifest:h,prUrl:null,error:`Failed to read fork's main branch. Ensure the fork exists at ${y}/asm-registry.`,securityVerdict:r,securityReport:n};let O=S.trim(),{exitCode:P}=await V(["gh","api",`repos/${y}/asm-registry/git/refs`,"-X","POST","-f",`ref=refs/heads/${b}`,"-f",`sha=${O}`]);P!==0&&await V(["gh","api",`repos/${y}/asm-registry/git/refs/heads/${b}`,"-X","PATCH","-f",`sha=${O}`,"-f","force=true"]);let{stderr:M,exitCode:w}=await V(["gh","api",`repos/${y}/asm-registry/contents/${v}`,"-X","PUT","-f",`message=Publish ${y}/${s.name}`,"-f",`content=${x}`,"-f",`branch=${b}`]);if(w!==0){let{stdout:j,exitCode:ye}=await V(["gh","api",`repos/${y}/asm-registry/contents/${v}?ref=${b}`,"-q",".sha"]),Ne=j.trim();if(ye===0&&Ne){let{exitCode:Ie}=await V(["gh","api",`repos/${y}/asm-registry/contents/${v}`,"-X","PUT","-f",`message=Update ${y}/${s.name}`,"-f",`content=${x}`,"-f",`branch=${b}`,"-f",`sha=${Ne}`]);if(Ie!==0)return{success:!1,manifest:h,prUrl:null,error:"Failed to write manifest to registry fork.",securityVerdict:r,securityReport:n}}else return{success:!1,manifest:h,prUrl:null,error:`Failed to write manifest to registry fork. ${M}`,securityVerdict:r,securityReport:n}}let $=Rr(s.name),I=Rr(s.description),L=Rr(s.license),T=`Publish ${y}/${ci(s.name)}`,K=[`## Skill: ${$}`,"",`**Author:** ${y}`,`**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:Xt}=await V(["gh","pr","create","--repo",Ye,"--head",`${y}:${b}`,"--title",T,"--body",K]),se=null;if(Xt===0)se=U.trim();else{let j=ee.match(/https:\/\/github\.com\/[^\s]+\/pull\/\d+/);j&&(se=j[0])}return se?{success:!0,manifest:h,prUrl:se,error:null,securityVerdict:r,securityReport:n}:{success:!1,manifest:h,prUrl:null,error:`Failed to create PR against ${Ye}. ${ee}`,securityVerdict:r,securityReport:n}}function nu(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 a4($){if(!$)return 0;return $.split(/\s+/).map((q)=>q.trim()).filter(Boolean).length}function xV($,q=1){return($.match(/^#{1,6}\s+\S/gm)||[]).length>=q}function iq($,q){let Z=$.toLowerCase();return q.filter((Q)=>Z.includes(Q))}function fV($){return/```[\s\S]+?```/m.test($)}function yV($){return/^\s*[-*]\s+\S/m.test($)||/^\s*\d+\.\s+\S/m.test($)}function kV($,q,Z){let Q=[],X=[],z=0;if(Z!==null)z+=2,Q.push("Has YAML frontmatter block.");else Q.push("SKILL.md has no YAML frontmatter."),X.push("Add a YAML frontmatter block delimited by `---` with at least `name` and `description` fields.");let J=Boolean($.name&&$.name.trim()),Y=Boolean($.description&&$.description.trim());if(J)z+=1.5;else Q.push("Missing required field: name."),X.push("Add `name:` to frontmatter (use the skill directory name).");if(Y)z+=1.5;else Q.push("Missing required field: description."),X.push("Add a one-line `description:` to frontmatter.");let G=J0($);if(G&&G!=="0.0.0")z+=1;else Q.push("Missing or default version."),X.push("Set `metadata.version` (or top-level `version`) using semver (e.g. 0.1.0).");if(Boolean($.creator||$["metadata.creator"]))z+=1;else Q.push("Missing `creator`."),X.push("Add a `creator` field so users know who authored and maintains the skill.");if(Boolean($.license))z+=1;else Q.push("Missing `license`."),X.push("Add a `license` field (e.g. `license: MIT`).");let B=q.trim().length>=20,_=xV(q,1);if(B)z+=1,Q.push("Body has meaningful content.");else Q.push("Body content is too short (<20 chars of instructions)."),X.push("Flesh out the markdown body with at least one paragraph of instructions for the agent.");if(_)z+=1,Q.push("Body uses markdown headings.");else Q.push("Body has no markdown headings."),X.push("Add section headings (e.g. `## When to Use`, `## Instructions`) so the agent can navigate the skill quickly.");return{id:"structure",name:"Structure & completeness",score:Math.round(z),max:10,findings:Q,suggestions:X}}function vV($,q){let Z=[],Q=[],X=0,z=($.description||"").trim();if(!z)return Z.push("No description."),Q.push("Write a one-sentence description that says specifically what the skill does and when to use it."),{id:"description",name:"Description quality",score:0,max:10,findings:Z,suggestions:Q};let J=a4(z);if(Z.push(`Description is ${J} words.`),J>=8&&J<=40)X+=4;else if(J>=5&&J<8)X+=2,Q.push("Lengthen the description slightly so it names both the action and the trigger (aim for 8–20 words).");else if(J>=41&&J<=60)X+=2,Q.push("Trim the description — aim for under 40 words. Move the long version to the markdown body.");else if(J>60)X+=0,Q.push("Description is too long. Keep it under 40 words; put detail in the body.");else X+=0,Q.push("Description is too short. Aim for 8–20 words.");let Y=z.split(/\s+/)[0]?.toLowerCase().replace(/[^\w-]/g,"");if(Boolean(Y&&(N8.includes(Y)||N8.includes(Y.replace(/s$/,"")))))X+=3,Z.push("Starts with an action verb.");else Z.push(`Does not start with a recognized action verb (got "${Y??""}").`),Q.push('Start the description with an imperative action verb (e.g. "Generate...", "Analyze...", "Review...").');if(/\buse when\b|\btrigger\b|\bwhen\b|\bfor\b/i.test(z)||/\b(before|after|during)\b/i.test(z))X+=3,Z.push("Mentions a trigger or use-case signal.");else Z.push("No explicit trigger / use-case phrase."),Q.push('Name the trigger in the description — e.g. "Use when...", "for reviewing...", "before publishing...".');return{id:"description",name:"Description quality",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function hV($,q){let Z=[],Q=[],X=0,z=iq(q,bV);if(z.length>=2)X+=3,Z.push(`Progressive disclosure cues present: ${z.slice(0,3).join(", ")}.`);else if(z.length===1)X+=1,Q.push('Add clearer section labels — e.g. "## When to Use" and "## Instructions" — to support progressive disclosure.');else Q.push('Structure the body with "## When to Use" and "## Instructions" sections so the agent reads only what it needs.');if(yV(q))X+=2,Z.push("Uses lists or numbered steps.");else Z.push("No lists or steps detected."),Q.push("Use bulleted or numbered steps to narrow the agent's degrees of freedom.");let J=fV(q),Y=/\bexample\b/i.test(q);if(J&&Y)X+=2,Z.push("Includes example code block.");else if(J||Y)X+=1,Q.push('Back up examples with fenced code blocks labelled under "## Example" so the agent sees concrete input/output.');else Q.push('Add an "## Example" section with a fenced code block showing the desired output.');let G=(q.match(/^\s*[-*0-9.]*\s*(Do|Use|Run|Call|Check|Validate|Return|Emit|Write|Read|Ask|Confirm|Avoid|Never|Always)\b/gim)||[]).length;if(G>=3)X+=2,Z.push(`Uses imperative voice (${G} cues).`);else if(G>=1)X+=1,Q.push("Favor imperative voice (Do / Use / Avoid / Never) to narrow the agent's choices.");else Q.push('Rewrite instructions in the imperative mood — e.g. "Run `git status` first" instead of "you might want to run".');let U=a4(q);if(U>=80&&U<=3000)X+=1,Z.push(`Body length within healthy range (${U} words).`);else if(U<80)Z.push(`Body is very short (${U} words).`),Q.push("Expand the instructions; an underspecified skill gives the agent too much freedom.");else Z.push(`Body is very long (${U} words).`),Q.push("Split large content into referenced files; keep SKILL.md focused under ~3000 words.");return{id:"prompt-engineering",name:"Prompt engineering",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function gV($,q){let Z=[],Q=[],X=0,z=a4(q);if(Z.push(`Body is ${z} words.`),z>=120&&z<=1500)X+=4;else if(z>=60&&z<120)X+=2,Q.push("Expand instructions slightly — too little context can push the agent to improvise.");else if(z>1500&&z<=3000)X+=2,Q.push("Consider moving large sections into referenced files (e.g. `references/*.md`) and linking them instead of inlining.");else if(z>3000)X+=0,Q.push("Body is over 3000 words — split long content into referenced files or templates.");let J=iq(q,SV);if(J.length>=2)X+=3,Z.push(`References external files or links (${J.slice(0,3).join(", ")}).`);else if(J.length===1)X+=1,Q.push('Link out to supporting files (e.g. "see `references/examples.md`") instead of inlining them.');else Q.push('Offload verbose content to referenced files and link to them ("see `./templates/x.md`").');let G=(q.match(/```[\s\S]+?```/g)||[]).filter((U)=>E8(U)>60);if(G.length===0)X+=2,Z.push("No oversized code blocks.");else Z.push(`${G.length} code block(s) longer than 60 lines.`),Q.push("Move large code blocks into referenced template files; link to them from SKILL.md.");if(/\btoken\b|\bbudget\b|\bcontext window\b/i.test(q))X+=1,Z.push("Mentions tokens/budget/context window.");return{id:"context-efficiency",name:"Context efficiency",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function uV($,q){let Z=[],Q=[],X=0,z=iq(q,CV);if(z.length>=4)X+=4,Z.push(`Covers multiple safety cues (${z.slice(0,4).join(", ")}).`);else if(z.length>=2)X+=2,Z.push(`Mentions a few safety cues: ${z.join(", ")}.`),Q.push("Add explicit error-handling and confirmation steps so the agent knows how to recover from failures.");else if(z.length===1)X+=1,Q.push('Expand the safety section — include prerequisites, validation steps, and what to do "on error".');else Q.push("Describe prerequisites, confirmation prompts, and error-handling steps to reduce blast radius.");let J=/\b(rm\s|delete|remove|drop|force|overwrite|destructive)\b/i.test(q),Y=/\bconfirm\b|\bdry-?run\b|\bare you sure\b|\bbackup\b/i.test(q);if(J&&Y)X+=3,Z.push("Destructive actions paired with confirmation/dry-run.");else if(J)Z.push("References destructive actions without explicit confirmation/dry-run."),Q.push("Pair any destructive command with an explicit confirmation prompt, dry-run flag, or backup step.");else X+=1.5;if(/\bprerequisit/i.test(q)||/\brequire/i.test(q)||/\bdepend/i.test(q))X+=3,Z.push("Declares prerequisites or requirements.");else Z.push("No prerequisites / requirements section."),Q.push('Add a "## Prerequisites" block listing required tools, credentials, and environment state.');return{id:"safety",name:"Safety & guardrails",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function mV($,q){let Z=[],Q=[],X=0,z=iq(q,EV);if(z.length>=4)X+=5,Z.push(`Many testability cues present (${z.slice(0,4).join(", ")}).`);else if(z.length>=2)X+=3,Z.push(`Some testability cues: ${z.join(", ")}.`),Q.push('Add an "## Acceptance Criteria" block listing verifiable outputs or checklist items.');else if(z.length===1)X+=1,Q.push('Add concrete "expected output" examples so the agent can self-check.');else Q.push('Add a "## Acceptance Criteria" section with testable statements (e.g. "produces a JSON report with overall_score").');if(/expected\s+(output|result|response)/i.test(q))X+=3,Z.push("Describes expected output/result.");else Q.push('Include an "Expected output" example so reviewers and the agent can verify correctness.');if(/\bedge case|gotcha|pitfall|limitation/i.test(q))X+=2,Z.push("Mentions edge cases or limitations.");else Q.push('Add a short "Edge cases" list to describe inputs the skill should reject or handle carefully.');return{id:"testability",name:"Testability",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function pV($,q){let Z=[],Q=[],X=0,z=($.name||"").trim();if(z){let G=/^[a-z][a-z0-9-]*$/.test(z),U=z.length<=40;if(G&&U)X+=4,Z.push(`name "${z}" follows kebab-case convention.`);else{if(!G)Z.push(`name "${z}" is not lowercase kebab-case.`),Q.push(`Rename to lowercase kebab-case (e.g. "${z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}").`);if(!U)Z.push(`name is ${z.length} chars; keep it <= 40.`)}}else Q.push("Add a kebab-case `name` (e.g. `my-skill`).");let J=q.match(/^#{1,6}\s+(.+)$/gm)||[];if(J.length>0)if(J.filter((H)=>/^#{1,6}\s+([A-Z][a-z]+|Use|How|When|Workflow|Instructions|Examples|Steps|Acceptance)/.test(H)).length/J.length>=0.5)X+=3,Z.push("Most headings use action/imperative labels.");else X+=1,Q.push("Rename body headings to action-oriented labels (e.g. `## Instructions`, `## When to Use`).");if(!/(?:\s\s|\bTODO\b|\bFIXME\b|\?{2,})/.test($.description||""))X+=2,Z.push("Description looks clean (no TODO/FIXME/stray noise).");else Q.push("Clean up description — remove TODOs, FIXMEs, double spaces, or trailing punctuation.");return{id:"naming",name:"Naming & conventions",score:Math.min(10,Math.round(X)),max:10,findings:Z,suggestions:Q}}function g$($){let{content:q,skillPath:Z,skillMdPath:Q}=$,X=$0(q),{rawFrontmatter:z,body:J}=C8(q),Y=[kV(X,J,z),vV(X,J),hV(X,J),gV(X,J),uV(X,J),mV(X,J),pV(X,J)];if(X.name&&O0(Z)===X.name){let O=Y.find((K)=>K.id==="naming");if(O.score<O.max)O.score=Math.min(O.max,O.score+1),O.findings.push("Directory name matches frontmatter `name`.")}let G=Y.reduce((O,K)=>O+K.score,0),U=Y.reduce((O,K)=>O+K.max,0),H=Math.round(G/U*100),V="F";if(H>=90)V="A";else if(H>=80)V="B";else if(H>=65)V="C";else if(H>=50)V="D";let B=[],_=[...Y].sort((O,K)=>O.score/O.max-K.score/K.max);for(let O of _){for(let K of O.suggestions){if(B.length>=3)break;if(!B.includes(K))B.push(K)}if(B.length>=3)break}return{skillPath:Z,skillMdPath:Q,evaluatedAt:new Date().toISOString(),categories:Y,overallScore:H,grade:V,topSuggestions:B,frontmatter:X}}async function S8($){let q=n4($)?$:l4($),Z;try{Z=await G$(q)}catch{throw Error(`Skill path does not exist: ${q}`)}let Q,X;if(Z.isFile())return Q=q,X=await c4(Q,"utf-8"),g$({content:X,skillPath:O0(q)==="SKILL.md"?O0(q):q,skillMdPath:Q});if(!Z.isDirectory())throw Error(`Skill path is not a directory or file: ${q}`);Q=U$(q,"SKILL.md");try{X=await c4(Q,"utf-8")}catch{throw Error(`SKILL.md not found in ${q}. Run "asm init" to create one.`)}return g$({content:X,skillPath:q,skillMdPath:Q})}function dV($){if($<=20)return"low";if($<=80)return"medium";if($<=250)return"high";return"max"}function cV($){let q=$.split(`
|
|
209
|
-
`),
|
|
210
|
-
`)})}else
|
|
211
|
-
`),changed:
|
|
212
|
-
`);
|
|
213
|
-
`),
|
|
214
|
-
`);let{rawFrontmatter:
|
|
215
|
-
${
|
|
199
|
+
`):""}import{execFile as Hy}from"child_process";import{promisify as Yy}from"util";import{rm as ui,rename as ru,cp as ou,access as Gy,mkdir as Wy}from"fs/promises";import{join as fi}from"path";import{homedir as au}from"os";var Or=Yy(Hy);async function zy(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 Qy(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 lu(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 Xy(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 zy(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 y=c.registryName||l,h=r.manifests.find(g=>g.name.toLowerCase()===y.toLowerCase());if(h){let g=h.commit!==c.commitHash;return{name:l,installedCommit:de(c.commitHash),latestCommit:de(h.commit),source:c.source,sourceType:d,status:g?"outdated":"up-to-date"}}}let f=lu(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 Qy(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 m=p!==c.commitHash;return{name:l,installedCommit:de(c.commitHash),latestCommit:de(p),source:c.source,sourceType:d,status:m?"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 Zy(e,t,s,i){if(Tr(t)==="local")return{name:e,status:"skipped",reason:"Local skill (not updatable)"};let r=lu(t.source);if(!r)return{name:e,status:"failed",reason:"Cannot determine remote URL"};let o=fi(au(),".config","agent-skill-manager",".tmp",`${e}-${Date.now()}`);try{let a=fi(au(),".config","agent-skill-manager",".tmp");await Wy(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(S){return{name:e,status:"failed",reason:`Clone failed: ${S.stderr||S.message}`}}let c=null;try{let{stdout:S}=await Or("git",["rev-parse","HEAD"],{cwd:o,timeout:5e3});c=S.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 S=i?.auditFn??Pe,E=Xy(t.source);if(d=(await S(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(S){return N(`updater: security audit failed for ${e}: ${S.message}`),{name:e,status:"failed",reason:`Security audit failed \u2014 skipping update: ${S.message}`}}let f=i?.loadConfigFn??q,p=i?.resolveProviderPathFn??oe,y=(await f()).providers.find(S=>S.name===t.provider),h=y?y.global:`~/.${t.provider}/skills`,g=p(h),b=fi(g,e),v=fi(o,".git");try{await ui(v,{recursive:!0,force:!0})}catch{}try{await Gy(b)}catch{let S=i?.writeLockEntryFn??ht;return await ou(o,b,{recursive:!0}),await S(e,{...t,commitHash:c,installedAt:new Date().toISOString()}),{name:e,status:"updated",oldCommit:de(t.commitHash),newCommit:de(c),securityVerdict:d}}let k=`${b}.bak-${Date.now()}`;try{await ru(b,k),await ou(o,b,{recursive:!0}),await ui(k,{recursive:!0,force:!0})}catch(S){try{await ui(b,{recursive:!0,force:!0}),await ru(k,b)}catch{}return{name:e,status:"failed",reason:`Atomic swap failed: ${S.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 ui(o,{recursive:!0,force:!0})}catch{}}}async function cu(e,t,s){let i=s?.readLockFn??Le,n=s?.checkOutdatedFn??Mr,r=s?.updateSkillFn??Zy,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(m=>m.name.toLowerCase()===p.toLowerCase())||(a.entries.find(y=>y.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 m=await r(f.name,p,t);d.push(m)}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 uu(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),m=f.installedCommit.padEnd(14),y,h;switch(f.status){case"outdated":y=i(f.latestCommit.padEnd(14)),h=f.sourceType;break;case"up-to-date":y=n(f.latestCommit.padEnd(14)),h=o("(up to date)");break;case"untracked":y=r("untracked".padEnd(14)),h=r("untracked");break;case"error":y=o("error".padEnd(14)),h=o(f.error||"error");break}c.push(`${p}${m}${y}${h}`)}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 fu(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 du(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 db}from"child_process";import{promisify as pb}from"util";import{access as pu,readFile as hu,readdir as mb,writeFile as hb,rm as gb,stat as gu}from"fs/promises";import{join as Dr}from"path";import{homedir as yb}from"os";import{constants as mu}from"fs";import{access as eb,realpath as tb,stat as sb}from"fs/promises";import{constants as ib}from"fs";import{delimiter as nb,resolve as rb,sep as ob}from"path";var ab="asm";function lb(e){if(!e)return[];let t=new Set,s=[];for(let i of e.split(nb)){let n=i.trim();if(!n)continue;let r=n.endsWith(ob)?n.slice(0,-1):n;t.has(r)||(t.add(r),s.push(r))}return s}async function cb(e){try{if(!(await sb(e)).isFile())return!1}catch{return!1}try{return await eb(e,ib.X_OK),!0}catch{return!1}}async function ub(e){try{return await tb(e)}catch{return e}}async function fb(e=process.env.PATH){let t=new Set,s=[];for(let i of lb(e)){let n=rb(i,ab);if(!await cb(n))continue;let r=await ub(n);t.has(r)||(t.add(r),s.push({path:n,realPath:r}))}return s}async function di(e=process.env.PATH){let t=await fb(e);if(t.length===0)return{resolved:null,shadowed:[]};let[s,...i]=t;return{resolved:s,shadowed:i}}var ct=pb(db);async function bb(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 wb(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 vb(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 kb(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 Sb(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 $b(e){try{let t=Dr(e,".asm-doctor-write-test");return await hb(t,"test","utf-8"),await gb(t),{writable:!0,exists:!0}}catch{}try{return await pu(e,mu.W_OK),{writable:!0,exists:!0}}catch{}try{return await pu(e,mu.F_OK),{writable:!1,exists:!0}}catch{return{writable:!0,exists:!1}}}async function xb(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 $b(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 Cb(){let e=pt();try{let t=await hu(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 Eb(){let e=Xr();try{let t=await hu(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 Ab(){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 Pb(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 gu(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 Nb(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 mb(r);for(let a of o)try{(await gu(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 Ib(e){let t=e?.execFn??ct;try{let{stdout:s}=await t("df",["-Pk",yb()],{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 Lb(){try{let e=await di();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 yu(){let e=await q(),t=await Le(),i=(await Promise.allSettled([bb(),wb(),vb(),kb(),Sb(),xb(e),Cb(),Eb(),Ab(),Pb(e,t),Nb(e,t),Ib(),Lb()])).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 Rb={pass:"\u2705",warn:"\u26A0\uFE0F ",fail:"\u274C"};function bu(e){let t=["Checking your environment...",""];for(let s of e.checks){let n=` ${Rb[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 wu(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 Ob,stat as ut,copyFile as Tb,readdir as xu}from"fs/promises";import{join as ft,resolve as jr,basename as ge,isAbsolute as Br}from"path";var Fr="Relocate `README.md` out of the skill root so SKILL.md remains the sole top-level document (e.g., move it to `docs/README.md`).",vu=["name","description","version","license","creator","compatibility","allowed-tools","effort","tags","metadata"],ku=["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"],Mb=["confirm","confirmation","error","errors","fail","failure","caution","warning","prerequisite","prerequisites","requires","requirements","rollback","dry-run","dry run","safety","validate","validation","check","backup"],Db=["acceptance criteria","expected output","expected result","edge case","edge cases","test","tests","testing","verify","verification","assert","example input","example output","given","then"],_b=["reference","references","see","template","templates","script","scripts","helper","helpers","link"],qb=["when to use","quick start","overview","instructions","steps","workflow","phases","progressive"];function Cu(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 Eu(e){return e?e.split(`
|
|
209
|
+
`).length:0}function Ur(e){return e?e.split(/\s+/).map(t=>t.trim()).filter(Boolean).length:0}function Fb(e,t=1){return(e.match(/^#{1,6}\s+\S/gm)||[]).length>=t}function pi(e,t){let s=e.toLowerCase();return t.filter(i=>s.includes(i))}function jb(e){return/```[\s\S]+?```/m.test(e)}function Bb(e){return/^\s*[-*]\s+\S/m.test(e)||/^\s*\d+\.\s+\S/m.test(e)}function Ub(e,t,s,i){let n=[],r=[],o=0;s!==null?(o+=2,n.push("Has YAML frontmatter block.")):(n.push("SKILL.md has no YAML frontmatter."),r.push("Add a YAML frontmatter block delimited by `---` with at least `name` and `description` fields."));let a=!!(e.name&&e.name.trim()),l=!!(e.description&&e.description.trim());a?o+=1.5:(n.push("Missing required field: name."),r.push("Add `name:` to frontmatter (use the skill directory name).")),l?o+=1.5:(n.push("Missing required field: description."),r.push("Add a one-line `description:` to frontmatter."));let c=ae(e);c&&c!=="0.0.0"?o+=1:(n.push("Missing or default version."),r.push("Set `metadata.version` (or top-level `version`) using semver (e.g. 0.1.0).")),!!(e.creator||e["metadata.creator"])?o+=1:(n.push("Missing `creator`."),r.push("Add a `creator` field so users know who authored and maintains the skill.")),!!e.license?o+=1:(n.push("Missing `license`."),r.push("Add a `license` field (e.g. `license: MIT`)."));let m=t.trim().length>=20,y=Fb(t,1);if(m?(o+=1,n.push("Body has meaningful content.")):(n.push("Body content is too short (<20 chars of instructions)."),r.push("Flesh out the markdown body with at least one paragraph of instructions for the agent.")),y?(o+=1,n.push("Body uses markdown headings.")):(n.push("Body has no markdown headings."),r.push("Add section headings (e.g. `## When to Use`, `## Instructions`) so the agent can navigate the skill quickly.")),i){let h=i.find(g=>g.toLowerCase()==="readme.md");h&&(n.push(`\`${h}\` found at skill root; move it to a subdirectory (e.g., \`docs/README.md\`).`),r.push(Fr))}return{id:"structure",name:"Structure & completeness",score:Math.round(o),max:10,findings:n,suggestions:r}}function Vb(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=Ur(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&&(ku.includes(a)||ku.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 Kb(e,t){let s=[],i=[],n=0,r=pi(t,qb);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.'),Bb(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=jb(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=Ur(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 Jb(e,t){let s=[],i=[],n=0,r=Ur(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=pi(t,_b);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=>Eu(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 Hb(e,t){let s=[],i=[],n=0,r=pi(t,Mb);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 Yb(e,t){let s=[],i=[],n=0,r=pi(t,Db);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 Gb(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,rootEntries:n}=e,r=ie(t),{rawFrontmatter:o,body:a}=Cu(t),l=[Ub(r,a,o,n),Vb(r,a),Kb(r,a),Jb(r,a),Hb(r,a),Yb(r,a),Gb(r,a)];if(r.name&&ge(s)===r.name){let g=l.find(b=>b.id==="naming");g.score<g.max&&(g.score=Math.min(g.max,g.score+1),g.findings.push("Directory name matches frontmatter `name`."))}let c=l.reduce((g,b)=>g+b.score,0),d=l.reduce((g,b)=>g+b.max,0),f=Math.round(c/d*100),p="F";f>=90?p="A":f>=80?p="B":f>=65?p="C":f>=50&&(p="D");let m=[];l.find(g=>g.id==="structure")?.suggestions.includes(Fr)&&m.push(Fr);let h=[...l].sort((g,b)=>g.score/g.max-b.score/b.max);for(let g of h){for(let b of g.suggestions){if(m.length>=3)break;m.includes(b)||m.push(b)}if(m.length>=3)break}return{skillPath:s,skillMdPath:i,evaluatedAt:new Date().toISOString(),categories:l,overallScore:f,grade:p,topSuggestions:m,frontmatter:r}}async function Au(e){let t=Br(e)?e:jr(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.`)}let r;try{r=await xu(t)}catch{r=void 0}return Wt({content:n,skillPath:t,skillMdPath:i,rootEntries:r})}function Wb(e){return e<=20?"low":e<=80?"medium":e<=250?"high":"max"}function zb(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],m=f[2];if(m===""||m===">"||m==="|"){let y=[c];for(n++;n<t.length;){let h=t[n];if(h.trim()===""){y.push(h),n++;continue}if(/^\s+/.test(h))y.push(h),n++;else break}i.push({key:p,text:y.join(`
|
|
211
|
+
`)})}else s.push({key:p,text:c}),n++}let r=c=>{let d=vu.indexOf(c);return d===-1?vu.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 Qb(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(g=>g.replace(/[ \t]+$/g,""));o.some((g,b)=>g!==r[b])&&s.push({id:"strip-trailing-whitespace",description:"Strip trailing whitespace from lines."}),n=o.join(`
|
|
215
|
+
`);let{rawFrontmatter:a,body:l}=Cu(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 g=t.gitAuthor?.trim();g?(d=_r(d,"creator",g),s.push({id:"add-missing-creator",description:`Add \`creator: ${g}\` 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 g=Wb(Eu(l));d=_r(d,"effort",g),s.push({id:"infer-missing-effort",description:`Infer \`effort: ${g}\` from body size.`})}c.description||i.push({id:"missing-description",description:"Missing `description` \u2014 content-level fix, left to the author."});let m=zb(d);m.changed&&(s.push({id:"reorder-frontmatter",description:"Reorder frontmatter fields to canonical order."}),d=m.newFrontmatter);let y=l.replace(/^\n+/,""),h=`---
|
|
216
|
+
${d.replace(/^\n+|\n+$/g,"")}
|
|
216
217
|
---
|
|
217
218
|
|
|
218
|
-
${
|
|
219
|
-
`)
|
|
220
|
-
|
|
221
|
-
`)
|
|
219
|
+
${y}`;return h.endsWith(`
|
|
220
|
+
`)||(h+=`
|
|
221
|
+
`),e.replace(/\r\n/g,`
|
|
222
|
+
`),{newContent:h,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
|
-
`)}async function
|
|
231
|
-
`)}function
|
|
232
|
-
`);if(
|
|
233
|
-
`)}function
|
|
234
|
-
`)&&!
|
|
235
|
-
`);return console.log=
|
|
236
|
-
---`,3);
|
|
237
|
-
`,"utf-8"),
|
|
224
|
+
`;return`${e}${r}${t}: ${n}
|
|
225
|
+
`}function Xb(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(y=>` ${y}`),m=i.slice(i.length-a,Math.min(i.length,i.length-a+3)).map(y=>` ${y}`);r.push(...p);for(let y of l)r.push(`-${y}`);for(let y of c)r.push(`+${y}`);return r.push(...m),r.join(`
|
|
228
|
+
`)}async function Pu(e,t){let s=Br(e)?e:jr(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=Qb(r,{gitAuthor:t.gitAuthor}),a=Xb(r,o.newContent),l=null;return!t.dryRun&&o.newContent!==r&&(l=`${i}.bak`,await Tb(i,l),await Ob(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 Nu(){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 Zb(e,t,s=20){let i=Math.round(e/t*s);return"\u2588".repeat(i)+"\u2591".repeat(Math.max(0,s-i))}function mi(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} ${Zb(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=ew(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 ew(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 Iu(e){return JSON.stringify(e,null,2)}function Lu(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 tw(e){let t;try{t=await xu(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 Su(e){let t=ft(e,"SKILL.md");try{if((await ut(t)).isFile())return{kind:"single",skillDirs:[e]}}catch{}let s=await tw(e);return s.length>0?{kind:"collection",skillDirs:s}:{kind:"none",skillDirs:[]}}function Vr(e){return e?!!(e.startsWith("github:")||/^https?:\/\/github\.com\//i.test(e)):!1}function $u(e){return{skillPath:e,skillMdPath:ft(e,"SKILL.md"),label:ge(e)}}async function Ru(e,t={}){if(!e)throw new Error("resolveEvalInput: input must be a non-empty string");if(Vr(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 Su(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($u),isCollection:o.kind==="collection",cleanup:r.cleanup,provenance:{input:e,remote:!0,sourceRef:r.sourceRef,commitSha:r.commitSha,tempPath:r.rootDir}}}let s=Br(e)?e:jr(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 Su(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($u),isCollection:n.kind==="collection",cleanup:async()=>{},provenance:{input:e,remote:!1,sourceRef:null}}}function Ou(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 Tu(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 Mu(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 Du(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?hi(t.report,null):null}))}}function hi(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 sw=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function iw(e){if(typeof e!="string")return null;let t=sw.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 nw(e,t){let s=iw(e);if(!s)throw new Error(`invalid semver: ${t} "${e}"`);return s}var Kr=new Map;function Jr(e){if(!e||typeof e.id!="string"||e.id.length===0)throw new Error("register: provider.id is required");if(nw(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=Kr.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),Kr.set(e.id,t)}function gi(){let e=[];for(let t of Kr.values())for(let s of t)e.push(s);return e}import{stat as rw}from"fs/promises";var _u="quality",qu="1.0.0",Fu=1;function ow(e){return e.topSuggestions.map(t=>({severity:"info",message:t}))}function aw(e){return e.categories.map(t=>({id:t.id,name:t.name,score:t.score,max:t.max}))}var ju={id:_u,version:qu,schemaVersion:Fu,description:"Static linter for SKILL.md structure, description, and safety.",async applicable(e){try{return(await rw(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 Au(e.skillPath);return{providerId:_u,providerVersion:qu,schemaVersion:Fu,score:s.overallScore,passed:s.grade!=="F",categories:aw(s),findings:ow(s),raw:s,startedAt:"",durationMs:0}}};var Ju=Wr(wr(),1);import{readFile as lw,stat as cw}from"fs/promises";var Bu="skill-best-practice",Uu="1.0.0",Vu=1,uw=new Set(["name","description","license","allowed-tools","metadata","compatibility","effort"]),Ku=new Set(["low","medium","high","max"]);function fw(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 yi(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 bi(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 dw(e){let t=await lw(e.skillMdPath,"utf-8"),s=[],i=fw(t);if(i===null){te(s,"missing-frontmatter","Frontmatter exists",!1,"error","SKILL.md must start with a YAML frontmatter block.");let b=bi(e,s,null);return{score:0,passed:!1,findings:s.map(yi),raw:b}}te(s,"frontmatter-present","Frontmatter exists",!0,"error","SKILL.md contains a YAML frontmatter block.");let n;try{n=(0,Ju.parse)(i)}catch(b){te(s,"invalid-yaml","Frontmatter parses as YAML",!1,"error",`Invalid YAML in frontmatter: ${b?.message??String(b)}`);let v=bi(e,s,null);return{score:0,passed:!1,findings:s.map(yi),raw:v}}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=bi(e,s,null);return{score:0,passed:!1,findings:s.map(yi),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=>!uw.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"&&Ku.has(f.trim()),"error",f===void 0||typeof f=="string"&&Ku.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 m=/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",m,"warning",m?"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 y=bi(e,s,r),h=y.checkCount===0?100:Math.round(y.passedChecks/y.checkCount*100),g=s.filter(b=>!b.passed).map(yi);return{score:h,passed:g.every(b=>b.severity!=="error"),findings:g,raw:y}}var Hu={id:Bu,version:Uu,schemaVersion:Vu,description:"Deterministic SKILL.md best-practice validation (rules ported from Anthropic's skill-creator skill).",async applicable(e){try{return(await cw(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 dw(e);return{providerId:Bu,providerVersion:Uu,schemaVersion:Vu,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 Yu(){Jr(ju),Jr(Hu)}var Gu=!1;function wi(){Gu||(Yu(),Gu=!0)}function vi(){return wi(),gi()}function Wu(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function zu(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 ki(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,m=p instanceof Error&&p.message==="timeout"?`provider timed out after ${s.timeoutMs}ms`:`provider aborted: ${Wu(p)}`;return zu(r,i,d,m,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 zu(r,i,d,Wu(c),"provider-threw")}finally{a&&clearTimeout(a)}}function pw(e){return e>=90?"A":e>=80?"B":e>=65?"C":e>=50?"D":"F"}function Qu(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 Xu(e,t){return{providerId:e.providerId,providerVersion:e.providerVersion,schemaVersion:e.schemaVersion,passed:e.passed,overallScore:e.score,grade:pw(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 Zu(e){return{timestamp:new Date().toISOString(),asm_version:So,duration_ms:Math.round(performance.now()-e)}}function Y(e,t,s){let i={version:1,command:e,status:"ok",data:t,meta:Zu(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:Zu(i)},o=process.stdout.isTTY?2:0;return JSON.stringify(r,null,o)}import{writeFile as Ew,mkdir as Aw,unlink as Pw,readFile as Nw,readdir as Iw}from"fs/promises";import{join as Qt}from"path";import{readdir as mw,readFile as hw}from"fs/promises";import{join as gw}from"path";function Hr(e){let t=new Set,s=e.toLowerCase().split(/[\s\-_.,;:()[\]{}"']+/);for(let i of s)i.length>=2&&t.add(i);return t}var yw=10,bw=5,ww=3,vw=1;function kw(e,t){let s=Hr(e),i=Hr(t.name),n=Hr(t.description),r=0;for(let o of s)i.has(o)&&(r+=yw),n.has(o)&&(r+=ww),t.name.toLowerCase().includes(o)&&(r+=bw),t.description.toLowerCase().includes(o)&&(r+=vw);return r}async function ef(e){let t=new Map,s;try{s=await mw(e)}catch{return t}for(let i of s){if(!i.endsWith(".json"))continue;let n=gw(e,i);try{let r=await hw(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 Si(){let e=await ef(Zr()),t=await ef(mt()),s=new Map(e);for(let[i,n]of t)s.set(i,n);return Array.from(s.values())}var Sw=["license","creator","version"];function tf(e){return Sw.includes(e)}function sf(e,t){return e[t]||""}function $w(e,t){if(t.has){for(let s of t.has)if(tf(s)&&!sf(e,s))return!1}if(t.missing){for(let s of t.missing)if(tf(s)&&sf(e,s))return!1}return!0}function nf(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 $i(e,t=20,s){let i=await Si(),n=[],r=!e&&s;for(let o of i)for(let a of o.skills){if(s&&!$w(a,s))continue;let l=r?1:kw(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 rf(){return(await Si()).reduce((t,s)=>t+s.skillCount,0)}var xw=[{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 of(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"),Cw(t).trim().length<20&&s.push("SKILL.md body too short (less than 20 chars of instructions)");for(let{label:n,pattern:r}of xw)r.test(t)&&s.push(`malicious pattern detected: ${n}`);return{verified:s.length===0,reasons:s}}function Cw(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 Lw(){let e=mt();return await Aw(e,{recursive:!0}),e}async function af(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 os(s);N(`ingester: found ${i.length} skills`);let n=[];for(let l of i){let c=Qt(s,l.relPath,"SKILL.md"),d="";try{d=await Nw(c,"utf-8")}catch{N(`ingester: could not read SKILL.md at ${c}`)}let f=of(l,d);f.verified||N(`ingester: ${l.name} not verified: ${f.reasons.join(", ")}`);let p=typeof l.tokenCount=="number"?l.tokenCount:d?es(d):void 0,m,y;if(d){let h;try{h=await Iw(Qt(s,l.relPath))}catch{h=void 0}try{let g=Wt({content:d,skillPath:l.relPath||l.name,skillMdPath:c,rootEntries:h});m={overallScore:g.overallScore,grade:g.grade,categories:g.categories.map(b=>({id:b.id,name:b.name,score:b.score,max:b.max})),evaluatedAt:g.evaluatedAt,evaluatedVersion:l.version||void 0}}catch(g){N(`ingester: eval failed for ${l.name}: ${g}`)}try{let g={skillPath:Qt(s,l.relPath),skillMdPath:c},v=(await Promise.all(zt(vi()).map(async k=>(await k.applicable(g,{})).ok?ki(k,g):null))).filter(k=>k!==null).map(k=>Xu(k,l.version||void 0));v.length>0&&(y=Object.fromEntries(v.filter(k=>k.providerId).map(k=>[k.providerId,k])))}catch(g){N(`ingester: provider eval failed for ${l.name}: ${g}`)}}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:m,evalSummaries:y})}let r={repoUrl:t.cloneUrl,owner:t.owner,repo:t.repo,updatedAt:new Date().toISOString(),skillCount:n.length,skills:n},o=await Lw(),a=Qt(o,`${t.owner}_${t.repo}.json`);return await Ew(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 lf(){return(await Si()).map(t=>({owner:t.owner,repo:t.repo,skillCount:t.skillCount,updatedAt:t.updatedAt})).sort((t,s)=>s.skillCount-t.skillCount)}async function cf(e,t){let s=mt(),i=Qt(s,`${e}_${t}.json`);try{return await Pw(i),!0}catch{return!1}}import{join as ff}from"path";function Rw(e){switch(e){case"dangerous":return 3;case"warning":return 2;case"caution":return 1;default:return 0}}function Yr(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+Rw(s.verdict),0)}}function Ow(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 Tw(){console.log(`${u.blueBold("agent-skill-manager")} (${u.bold("asm")}) ${Li}
|
|
238
239
|
|
|
239
240
|
Interactive TUI and CLI for managing installed skills for AI coding agents.
|
|
240
241
|
|
|
241
|
-
${
|
|
242
|
+
${u.bold("Usage:")}
|
|
242
243
|
asm Launch interactive TUI
|
|
243
244
|
asm <command> [options] Run a CLI command
|
|
244
245
|
|
|
245
|
-
${
|
|
246
|
+
${u.bold("Commands:")}
|
|
246
247
|
list List all discovered skills
|
|
247
248
|
search <query> Search skills by name/description/tool
|
|
248
249
|
inspect <skill-name> Show detailed info for a skill
|
|
@@ -259,7 +260,7 @@ ${W.bold("Commands:")}
|
|
|
259
260
|
update [name...] Update outdated skills with security re-audit
|
|
260
261
|
publish [path] Validate, audit, and submit a skill to the registry
|
|
261
262
|
eval <skill-path> Evaluate a skill against best practices and score it
|
|
262
|
-
eval-providers list List registered eval providers (id, version, schema,
|
|
263
|
+
eval-providers list List registered eval providers (id, version, schema, \u2026)
|
|
263
264
|
bundle Manage skill bundles (create, install, list, show, remove)
|
|
264
265
|
index Manage skill index (ingest, search, list)
|
|
265
266
|
doctor Run environment health checks and diagnostics
|
|
@@ -268,7 +269,7 @@ ${W.bold("Commands:")}
|
|
|
268
269
|
config reset Reset config to defaults
|
|
269
270
|
config edit Open config in $EDITOR
|
|
270
271
|
|
|
271
|
-
${
|
|
272
|
+
${u.bold("Global Options:")}
|
|
272
273
|
-h, --help Show help for any command
|
|
273
274
|
-v, --version Print version and exit
|
|
274
275
|
--json Output as JSON (list, search, inspect)
|
|
@@ -279,14 +280,14 @@ ${W.bold("Global Options:")}
|
|
|
279
280
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
280
281
|
--flat Show one row per tool instance (list, search)
|
|
281
282
|
-y, --yes Skip confirmation prompts
|
|
282
|
-
-V, --verbose Show debug output`)}function
|
|
283
|
+
-V, --verbose Show debug output`)}function Mw(){console.log(`${u.bold("Usage:")} asm list [options]
|
|
283
284
|
|
|
284
285
|
List all discovered skills. By default, skills installed across multiple
|
|
285
286
|
tools are grouped into a single row with tool badges. When more than
|
|
286
|
-
${
|
|
287
|
+
${Pi} skills are present, a compact summary is
|
|
287
288
|
automatically prepended above the table.
|
|
288
289
|
|
|
289
|
-
${
|
|
290
|
+
${u.bold("Options:")}
|
|
290
291
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
291
292
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
292
293
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
@@ -300,25 +301,25 @@ ${W.bold("Options:")}
|
|
|
300
301
|
--no-color Disable ANSI colors
|
|
301
302
|
-V, --verbose Show debug output
|
|
302
303
|
|
|
303
|
-
${
|
|
304
|
-
asm list ${
|
|
305
|
-
asm list --flat ${
|
|
306
|
-
asm list --compact ${
|
|
307
|
-
asm list --summary ${
|
|
308
|
-
asm list --group-by tool ${
|
|
309
|
-
asm list --group-by scope ${
|
|
310
|
-
asm list --group-by effort ${
|
|
311
|
-
asm list --limit 20 ${
|
|
312
|
-
asm list -p claude ${
|
|
313
|
-
asm list -s project ${
|
|
314
|
-
asm list --sort version ${
|
|
315
|
-
asm list --json ${
|
|
316
|
-
asm list --machine ${
|
|
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 Dw(){console.log(`${u.bold("Usage:")} asm search <query> [options]
|
|
317
318
|
|
|
318
319
|
Search both installed skills and the skill index. Results show installation
|
|
319
320
|
status and include copy-paste install commands for available skills.
|
|
320
321
|
|
|
321
|
-
${
|
|
322
|
+
${u.bold("Options:")}
|
|
322
323
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
323
324
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
324
325
|
-p, --tool <p> Filter by tool (claude, codex, openclaw, agents)
|
|
@@ -330,49 +331,49 @@ ${W.bold("Options:")}
|
|
|
330
331
|
--no-color Disable ANSI colors
|
|
331
332
|
-V, --verbose Show debug output
|
|
332
333
|
|
|
333
|
-
${
|
|
334
|
-
asm search code ${
|
|
335
|
-
asm search review -p claude ${
|
|
336
|
-
asm search "test" --installed ${
|
|
337
|
-
asm search "test" --available ${
|
|
338
|
-
asm search openspec --json ${
|
|
339
|
-
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 _w(){console.log(`${u.bold("Usage:")} asm inspect <skill-name> [options]
|
|
340
341
|
|
|
341
342
|
Show detailed information for a skill. The <skill-name> is the directory name.
|
|
342
343
|
Shows version, description, file count, and all provider installations.
|
|
343
344
|
|
|
344
|
-
${
|
|
345
|
+
${u.bold("Options:")}
|
|
345
346
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
346
347
|
--json Output as JSON object
|
|
347
348
|
--no-color Disable ANSI colors
|
|
348
349
|
-V, --verbose Show debug output
|
|
349
350
|
|
|
350
|
-
${
|
|
351
|
-
asm inspect code-review ${
|
|
352
|
-
asm inspect code-review --json ${
|
|
353
|
-
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 qw(){console.log(`${u.bold("Usage:")} asm uninstall <skill-name> [options]
|
|
354
355
|
|
|
355
356
|
Remove a skill and its associated rule files. Shows a removal plan
|
|
356
357
|
before proceeding and asks for confirmation.
|
|
357
358
|
|
|
358
|
-
${
|
|
359
|
+
${u.bold("Options:")}
|
|
359
360
|
-y, --yes Skip confirmation prompt
|
|
360
361
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
361
362
|
--no-color Disable ANSI colors
|
|
362
363
|
-V, --verbose Show debug output
|
|
363
364
|
|
|
364
|
-
${
|
|
365
|
-
asm uninstall code-review ${
|
|
366
|
-
asm uninstall code-review -y ${
|
|
367
|
-
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 Fw(){console.log(`${u.bold("Usage:")} asm audit [subcommand] [options]
|
|
368
369
|
|
|
369
370
|
Detect duplicate skills or run security audits on installed/remote skills.
|
|
370
371
|
|
|
371
|
-
${
|
|
372
|
+
${u.bold("Subcommands:")}
|
|
372
373
|
duplicates Find duplicate skills (default)
|
|
373
374
|
security <name|source> Run security audit on an installed skill or GitHub source
|
|
374
375
|
|
|
375
|
-
${
|
|
376
|
+
${u.bold("Options:")}
|
|
376
377
|
--json Output as JSON
|
|
377
378
|
--machine Output in stable machine-readable v1 envelope format
|
|
378
379
|
-y, --yes Auto-remove duplicates, keeping one instance per group
|
|
@@ -380,25 +381,25 @@ ${W.bold("Options:")}
|
|
|
380
381
|
--no-color Disable ANSI colors
|
|
381
382
|
-V, --verbose Show debug output
|
|
382
383
|
|
|
383
|
-
${
|
|
384
|
-
asm audit ${
|
|
385
|
-
asm audit -y ${
|
|
386
|
-
asm audit --json ${
|
|
387
|
-
asm audit security code-review ${
|
|
388
|
-
asm audit security github:user/repo ${
|
|
389
|
-
asm audit security --all ${
|
|
390
|
-
asm audit security code-review --json ${
|
|
391
|
-
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")}
|
|
392
393
|
asm audit security https://github.com/user/skills/tree/main/skills/agent-config
|
|
393
|
-
${
|
|
394
|
+
${u.dim("Audit a skill from a subfolder URL")}`)}function jw(){console.log(`${u.bold("Usage:")} asm publish [path] [options]
|
|
394
395
|
|
|
395
396
|
Validate a skill, run a security audit, generate a registry manifest,
|
|
396
397
|
and open a PR against the asm-registry.
|
|
397
398
|
|
|
398
|
-
${
|
|
399
|
+
${u.bold("Arguments:")}
|
|
399
400
|
path Path to skill directory (default: current directory)
|
|
400
401
|
|
|
401
|
-
${
|
|
402
|
+
${u.bold("Options:")}
|
|
402
403
|
--dry-run Print generated manifest without opening a PR
|
|
403
404
|
--force Override 'warning' security verdict (blocks 'dangerous')
|
|
404
405
|
-y, --yes Skip confirmation prompts
|
|
@@ -407,76 +408,76 @@ ${W.bold("Options:")}
|
|
|
407
408
|
--no-color Disable ANSI colors
|
|
408
409
|
-V, --verbose Show debug output
|
|
409
410
|
|
|
410
|
-
${
|
|
411
|
-
asm publish ${
|
|
412
|
-
asm publish ./my-skill ${
|
|
413
|
-
asm publish --dry-run ${
|
|
414
|
-
asm publish --force ${
|
|
415
|
-
asm publish --json ${
|
|
416
|
-
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 Bw(){console.log(`${u.bold("Usage:")} asm outdated [options]
|
|
417
418
|
|
|
418
419
|
Show which installed skills have newer versions available.
|
|
419
420
|
|
|
420
|
-
${
|
|
421
|
+
${u.bold("Options:")}
|
|
421
422
|
--json Output as JSON
|
|
422
423
|
--machine Output in stable machine-readable format
|
|
423
424
|
--no-color Disable ANSI colors
|
|
424
425
|
-V, --verbose Show debug output
|
|
425
426
|
|
|
426
|
-
${
|
|
427
|
-
asm outdated ${
|
|
428
|
-
asm outdated --json ${
|
|
429
|
-
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 Uw(){console.log(`${u.bold("Usage:")} asm update [name...] [options]
|
|
430
431
|
|
|
431
432
|
Update outdated skills to their latest version with security re-audit.
|
|
432
433
|
|
|
433
|
-
${
|
|
434
|
+
${u.bold("Arguments:")}
|
|
434
435
|
name Specific skill(s) to update (default: all outdated)
|
|
435
436
|
|
|
436
|
-
${
|
|
437
|
+
${u.bold("Options:")}
|
|
437
438
|
-y, --yes Skip confirmation prompts
|
|
438
439
|
--json Output as JSON
|
|
439
440
|
--machine Output in stable machine-readable format
|
|
440
441
|
--no-color Disable ANSI colors
|
|
441
442
|
-V, --verbose Show debug output
|
|
442
443
|
|
|
443
|
-
${
|
|
444
|
-
asm update ${
|
|
445
|
-
asm update code-review ${
|
|
446
|
-
asm update --yes ${
|
|
447
|
-
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 Vw(){console.log(`${u.bold("Usage:")} asm config <subcommand>
|
|
448
449
|
|
|
449
450
|
Manage configuration. Config is stored at ~/.config/agent-skill-manager/.
|
|
450
451
|
|
|
451
|
-
${
|
|
452
|
+
${u.bold("Subcommands:")}
|
|
452
453
|
show Print current config as JSON
|
|
453
454
|
path Print config file path
|
|
454
455
|
reset Reset config to defaults (with confirmation)
|
|
455
456
|
edit Open config in $EDITOR
|
|
456
457
|
|
|
457
|
-
${
|
|
458
|
+
${u.bold("Options:")}
|
|
458
459
|
-V, --verbose Show debug output
|
|
459
460
|
|
|
460
|
-
${
|
|
461
|
-
asm config show ${
|
|
462
|
-
asm config edit ${
|
|
463
|
-
asm config reset -y ${
|
|
464
|
-
${
|
|
465
|
-
`))}}async function
|
|
466
|
-
`))
|
|
467
|
-
${
|
|
468
|
-
Done.`))}function
|
|
469
|
-
`)
|
|
470
|
-
Auto-removing duplicates...`));for(let
|
|
471
|
-
Done.`))}}async function
|
|
472
|
-
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2)
|
|
473
|
-
`);let
|
|
474
|
-
Summary:`)),
|
|
475
|
-
`);let
|
|
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 df(e){for(let t of e)t.warnings=await Cc(t)}async function Kw(e){if(e.flags.help){Mw();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 df(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}=ts(n,e.flags.limit);console.log(uo(r,e.flags.groupBy)),o&&console.log(o)}else if(e.flags.compact){let{skills:r,hint:o}=ts(n,e.flags.limit);console.log(co(r)),o&&console.log(o)}else{let r=[];n.length>Pi&&(r.push(Ni(n,{showHint:!1})),r.push(""));let{skills:o,hint:a}=ts(n,e.flags.limit);r.push(fo(o)),a&&r.push(a),console.log(r.join(`
|
|
466
|
+
`))}}async function Jw(e){if(e.flags.help){Dw();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(m=>m.provider===e.flags.provider));let p=so(f,i);o=Ci(p,e.flags.sort)}let a=[];if(r&&(a=await $i(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(po(o,i))),c){l&&console.error("");let d=mo(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 Hw(e){if(e.flags.help){_w();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 df(n),e.flags.json?console.log(J(n.length===1?n[0]:n)):console.log(await ho(n))}async function Yw(e){if(e.flags.help){qw();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=no(t,i,s),r=await ro(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")} ${lo(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 yo(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 Gw(e){if(e.flags.help){Fw();return}let t=performance.now(),s=e.subcommand??"duplicates";if(s==="security"){await Ww(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(ko(r));return}if(console.log(vo(r)),e.flags.yes&&r.duplicateGroups.length>0){console.error(u.bold(`
|
|
471
|
+
Auto-removing duplicates...`));for(let o of r.duplicateGroups){let a=wo(o.instances),l=a[0].path;for(let c=1;c<a.length;c++){let d=a[c],f=io(d,i),p=await Ei(f,l);for(let m of p)console.error(m)}}console.error(u.green(`
|
|
472
|
+
Done.`))}}async function Ww(e,t){let s=e.positional[0];e.flags.all?await zw(e,t):s?s.startsWith("github:")||s.startsWith("https://github.com/")?await Qw(e,s,t):await Xw(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 zw(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",Yr(o),t));else if(e.flags.json)console.log(JSON.stringify(o,null,2));else{for(let l of o)console.log(li(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 Qw(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 rs(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",Yr([l]),s)):e.flags.json?console.log(Lr(l)):console.log(li(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 Xw(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",Yr([a]),s)):e.flags.json?console.log(Lr(a)):console.log(li(a))}async function Zw(e){if(e.flags.help){Vw();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=Qr();await eo(s),console.error(u.green("Config reset to defaults."));break}case"edit":{let s=process.env.VISUAL||process.env.EDITOR||"vi",[i,n]=$o(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 ev(){console.log(`${u.bold("Usage:")} asm install <source> [options]
|
|
476
477
|
|
|
477
478
|
Install a skill from a GitHub repository, the curated registry, or a local path.
|
|
478
479
|
|
|
479
|
-
${
|
|
480
|
+
${u.bold("Source Format:")}
|
|
480
481
|
code-review Install by name from the curated registry
|
|
481
482
|
author/code-review Install a scoped name (author/name) from registry
|
|
482
483
|
github:owner/repo Install from default branch
|
|
@@ -489,7 +490,7 @@ ${W.bold("Source Format:")}
|
|
|
489
490
|
./relative/path/to/skill Install from a local folder (relative path)
|
|
490
491
|
~/path/to/skill Install from a local folder (home-relative path)
|
|
491
492
|
|
|
492
|
-
${
|
|
493
|
+
${u.bold("Options:")}
|
|
493
494
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents, all)
|
|
494
495
|
Use "all" to install to all tools (shared + symlinks)
|
|
495
496
|
-s, --scope <scope> Installation scope: global or project (default: prompt)
|
|
@@ -511,82 +512,82 @@ ${W.bold("Options:")}
|
|
|
511
512
|
--no-color Disable ANSI colors
|
|
512
513
|
-V, --verbose Show debug output
|
|
513
514
|
|
|
514
|
-
${
|
|
515
|
-
asm install code-review ${
|
|
516
|
-
asm install luongnv89/code-review ${
|
|
517
|
-
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)")}
|
|
518
519
|
|
|
519
|
-
${
|
|
520
|
-
asm install ./my-skill ${
|
|
521
|
-
asm install /home/user/skills/my-skill ${
|
|
522
|
-
asm install ~/skills/my-skill ${
|
|
523
|
-
asm install ../other-project/skill ${
|
|
524
|
-
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)")}
|
|
525
526
|
|
|
526
|
-
${
|
|
527
|
+
${u.bold("Single-skill repo:")}
|
|
527
528
|
asm install github:user/my-skill
|
|
528
529
|
asm install github:user/my-skill#v1.0.0 -p claude
|
|
529
530
|
asm install https://github.com/user/my-skill
|
|
530
|
-
asm install github:user/my-skill -p all ${
|
|
531
|
-
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)")}
|
|
532
533
|
|
|
533
|
-
${
|
|
534
|
+
${u.bold("Multi-skill repo:")}
|
|
534
535
|
asm install github:user/skills --path skills/code-review
|
|
535
536
|
asm install github:user/skills --all -p claude -y
|
|
536
|
-
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)")}
|
|
537
538
|
asm install https://github.com/user/skills --all
|
|
538
|
-
asm install github:user/skills ${
|
|
539
|
+
asm install github:user/skills ${u.dim("(interactive picker)")}
|
|
539
540
|
|
|
540
|
-
${
|
|
541
|
+
${u.bold("Subfolder URL:")}
|
|
541
542
|
asm install https://github.com/user/skills/tree/main/skills/agent-config
|
|
542
543
|
asm install github:user/skills#main:skills/agent-config
|
|
543
544
|
|
|
544
|
-
${
|
|
545
|
+
${u.bold("Vercel skills CLI:")}
|
|
545
546
|
asm install github:user/skills --method vercel --skill my-skill
|
|
546
547
|
asm install https://github.com/user/skills -m vercel --skill my-skill -y
|
|
547
|
-
${
|
|
548
|
-
${
|
|
549
|
-
${
|
|
550
|
-
${
|
|
551
|
-
${
|
|
552
|
-
${
|
|
553
|
-
${
|
|
554
|
-
Select a skill [1-${
|
|
555
|
-
Did you mean: ${
|
|
556
|
-
`);for(let
|
|
548
|
+
${u.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function tv(e,t,s,i,n,r,o,a,l="global"){let c=await _e(i),d=await Io(i),f=i===s?null:i.split(/[/\\]/).pop(),p=n||f||t.repo,m=Te(p),y=a.find(E=>E.name.toLowerCase()===c.name.toLowerCase()&&E.provider===o.name),h,g=!!y;y?y.version===c.version?h=e.flags.force?"REINSTALL":`UPDATE: ${y.version} (same version)`:h=`UPDATE: ${y.version} \u2192 ${c.version}`:h="NEW";let b=_i(t,s,i,m,o,e.flags.force||g,l),v=d.some(E=>["Shell commands","Code execution","Credentials"].includes(E.category)),k=d.some(E=>["External URLs"].includes(E.category)),x=v?"high":k?"medium":"safe",S=v?u.red("[!] High Risk"):k?u.yellow("[~] Medium Risk"):u.green("[ok] Safe");return{metadata:c,skillName:m,warnings:d,installStatus:h,riskLevel:x,riskLabel:S,plan:b}}function sv(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:")} ${oo(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 m of a){let y=p.get(m.category)||[];y.push(m),p.set(m.category,y)}for(let[m,y]of p){let g=["Shell commands","Code execution","Credentials"].includes(m)?u.red(`[${m}]`):u.yellow(`[${m}]`);console.info(`
|
|
551
|
+
${g} ${u.dim(`(${y.length} match${y.length>1?"es":""})`)}`);for(let b of y.slice(0,5))console.info(` ${u.dim(`${b.file}:${b.line}`)} -- ${b.match}`);y.length>5&&console.info(u.dim(` ... and ${y.length-5} more`))}}}}async function iv(e,t){return t?await Lo(e,t):await as(e)}async function nv(e){if(e.flags.help){ev();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:w,multipleMatches:$,suggestions:I}=await Ic(i,{noCache:e.flags.noCache});if(w){r="registry";let L=w.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($.length>0){console.info(`
|
|
554
|
+
${u.yellow("\u26A0")} Multiple skills found for "${u.bold(i)}":`);let L=$.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 Xt=ee.repository.replace("https://github.com/","");i=ee.skill_path?`github:${Xt}#${ee.commit}:${ee.skill_path}`:`github:${Xt}#${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 w=d.localPath;console.info(` ${u.dim(`local: ${w}`)}`);let{stat:$}=await import("fs/promises");try{if(!(await $(w)).isDirectory())throw new Error(`Path is not a directory: ${w}`)}catch(I){throw I.code==="ENOENT"?new Error(`Path does not exist: ${w}`):I}}else await Me(),d=await rs(d),console.info(` ${u.dim(i)}`);if(e.flags.method==="vercel"){console.info(l("Installing via Vercel skills CLI")),await Ro();let w=To(d),$=e.flags.path||null;console.info(` ${u.dim(`npx skills add ${w}${$?` --skill ${$}`:""}`)}`);let{stdout:I,stderr:L}=await Oo(w,$);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:m,allProviders:y}=await ze(p,e.flags.provider,!!process.stdin.isTTY);console.info(l("Selecting scope"));let h;if(e.flags.scope==="global"||e.flags.scope==="project")h=e.flags.scope,console.info(` ${u.dim(`scope: ${h}`)}${h==="global"?` (${m.global})`:` (${m.project})`}`);else if(!process.stdin.isTTY||e.flags.yes)h="global",console.info(` ${u.dim("scope: global (default)")} (${m.global})`);else{let w=[{label:`Global (${m.global})`,hint:"Available in all projects",checked:!0},{label:`Project (${m.project})`,hint:"Available only in this project",checked:!1}];console.info("");let $=await We({items:w});if($.length===0)throw new Error("No scope selected. Aborting.");h=$[0]===0?"global":"project",console.info(` Selected: ${u.bold(h)} ${u.dim(`(${h==="global"?m.global:m.project})`)}`)}if(f)console.info(l("Reading local source")),console.info(` ${u.dim(d.localPath)}`),n=null;else{console.info(l("Cloning repository"));let w=e.flags.transport,$=w==="ssh"?d.sshCloneUrl:w==="https"?d.cloneUrl:`${d.cloneUrl} ${u.dim("(auto)")}`;console.info(` ${$}${d.ref?` ${u.dim(`(ref: ${d.ref})`)}`:""}${d.subpath?` ${u.dim(`(path: ${d.subpath})`)}`:""}`),n=await De(d,w)}let g=f?d.localPath:n;console.info(l("Scanning for skills"));let{join:b}=await import("path"),v=[],k=e.flags.path||d.subpath,x=[];if(k){let w=b(g,k);try{await _e(w)}catch{throw new Error(`No SKILL.md found at path "${k}" in the repository.`)}console.info(` Found skill at ${u.bold(k)}`),x=[{skillDir:w,nameOverride:e.flags.name}]}else{let w=!1;try{await _e(g),w=!0}catch{}if(w){let $=await _e(g);console.info(` Found: ${u.bold($.name)} v${$.version}`),x=[{skillDir:g,nameOverride:e.flags.name}]}else{console.info(" No SKILL.md at root. Scanning subdirectories...");let $=await os(g);if($.length===0)throw new Error("No skills found in this repository. Skills must have a SKILL.md file.");console.info(` Found ${u.bold(String($.length))} skill(s):
|
|
557
|
+
`);for(let T=0;T<$.length;T++){let K=u.cyan(` ${String(T+1).padStart(String($.length).length)})`);console.info(`${K} ${u.bold($[T].name)} ${u.dim(`v${$[T].version}`)} ${u.dim(`(${$[T].relPath})`)}`),$[T].description&&console.info(` ${u.dim($[T].description)}`)}console.info(l("Selecting skills")),a--;let I;if(e.flags.all&&(e.flags.yes||!process.stdin.isTTY))I=$.map(T=>T.relPath),console.info(` Selected all ${u.bold(String(I.length))} skills`);else if(process.stdin.isTTY)if($.length===1)I=[$[0].relPath],console.info(` Auto-selected: ${u.bold($[0].name)} ${u.dim(`v${$[0].version}`)}`);else{let T=$.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=>$[U].relPath),console.info(` Selected ${u.bold(String(I.length))} skill(s)`)}else{C(`Repository contains ${$.length} skills. Use --path <subdir> to pick one or --all to install all.
|
|
557
558
|
Available skills:
|
|
558
|
-
${
|
|
559
|
-
`)}`),process.exit(2);return}let
|
|
560
|
-
`),
|
|
561
|
-
${
|
|
562
|
-
Choose one path per skill name or install with --path.`);throw
|
|
563
|
-
${
|
|
564
|
-
${
|
|
565
|
-
${
|
|
566
|
-
Done! Installed "${
|
|
567
|
-
${
|
|
559
|
+
${$.map(T=>` --path ${T.relPath}`).join(`
|
|
560
|
+
`)}`),process.exit(2);return}let L=No(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(g,T),nameOverride:I.length===1?e.flags.name:null})),a++}}console.info(l("Inspecting skills"));let S=await Q(p,"both"),E=[],O=x.length>1;for(let w=0;w<x.length;w++){let{skillDir:$,nameOverride:I}=x[w],L=await tv(e,d,g,$,I,p,m,S,h);E.push(L),sv(L,i,m,y,O,O?{index:w+1,total:x.length}:void 0)}if(O){console.info(""),console.info(` ${u.bold("Install settings:")}`),console.info(` ${u.bold("Source:")} ${i}`),console.info(y?` ${u.bold("Tool:")} All (${y.map(T=>T.label).join(", ")})`:` ${u.bold("Tool:")} ${m.label} (${m.name})`),console.info(` ${u.bold("Scope:")} ${h==="project"?"Project":"Global"}`);let w=E.filter(T=>T.riskLevel==="high").length,$=E.filter(T=>T.riskLevel==="medium").length,I=E.filter(T=>T.riskLevel==="safe").length,L=[];I>0&&L.push(u.green(`${I} Safe`)),$>0&&L.push(u.yellow(`${$} Medium Risk`)),w>0&&L.push(u.red(`${w} High Risk`)),console.info(` ${u.bold("Risk:")} ${L.join(", ")}`)}if(console.info(l("Installing")),!e.flags.yes){let w=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 $=O?`${E.length} skills`:`"${E[0].metadata.name}"`,I=w?`
|
|
564
|
+
${u.red("[!]")} ${u.bold(`Install ${$}? Some have high-risk patterns.`)} [y/N] `:`
|
|
565
|
+
${u.bold(`Install ${$}?`)} [Y/n] `;process.stderr.write(I);let L=await G();w?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 bo(n):null,M=[];for(let w=0;w<E.length;w++){let $=E[w],I=O?u.dim(`[${w+1}/${E.length}]`)+" ":" ";try{console.info(`${I}Installing ${u.bold($.metadata.name)}...`);let L=await iv($.plan,y);v.push(L),console.info(`${I}${u.green("\u2713")} ${$.metadata.name} installed to ${u.dim($.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:$.plan.providerName,sourceType:K,...r==="registry"?{registryName:L.name}:{}})}catch{}}catch(L){M.push({name:$.metadata.name,error:L.message}),console.error(`${I}${u.red("\u2717")} ${u.bold($.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 w of M)console.error(` ${u.red("\u2717")} ${w.name}: ${w.error}`)}if(e.flags.machine){t?.();let w=v.map($=>({name:$.name,path:$.path,version:$.version,provider:$.provider,source:$.source,resolution_source:r}));console.log(Y("install",w.length===1?w[0]:w,s))}else if(e.flags.json){let w=v.map($=>({...$,resolutionSource:r}));console.log(JSON.stringify(w.length===1?w[0]:w,null,2))}else v.length===1?console.error(u.green(`
|
|
567
|
+
Done! Installed "${v[0].name}" to ${v[0].path}`)):v.length>0&&console.error(`
|
|
568
|
+
${u.green(`Done! Installed ${v.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 rv(){console.log(`${u.bold("Usage:")} asm export [options]
|
|
568
569
|
|
|
569
570
|
Export skill inventory as a portable JSON manifest. Useful for backup,
|
|
570
571
|
sharing, or scripting.
|
|
571
572
|
|
|
572
|
-
${
|
|
573
|
+
${u.bold("Options:")}
|
|
573
574
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
574
575
|
--no-color Disable ANSI colors
|
|
575
576
|
-V, --verbose Show debug output
|
|
576
577
|
|
|
577
|
-
${
|
|
578
|
-
asm export ${
|
|
579
|
-
asm export -s global ${
|
|
580
|
-
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 ov(e){if(e.flags.help){rv();return}let t=await q(),s=await Q(t,e.flags.scope),i=Lc(s);console.log(JSON.stringify(i,null,2))}function av(){console.log(`${u.bold("Usage:")} asm import <file> [options]
|
|
581
582
|
|
|
582
583
|
Import skills from a previously exported JSON manifest. Recreates skill
|
|
583
584
|
installations based on the manifest metadata.
|
|
584
585
|
|
|
585
586
|
Skills that already exist at the target location are skipped unless --force
|
|
586
587
|
is used. Skills whose source files cannot be found locally are reported as
|
|
587
|
-
failed
|
|
588
|
+
failed \u2014 install them first with "asm install".
|
|
588
589
|
|
|
589
|
-
${
|
|
590
|
+
${u.bold("Options:")}
|
|
590
591
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
591
592
|
-f, --force Overwrite existing skills
|
|
592
593
|
-y, --yes Skip confirmation prompt
|
|
@@ -594,62 +595,62 @@ ${W.bold("Options:")}
|
|
|
594
595
|
--no-color Disable ANSI colors
|
|
595
596
|
-V, --verbose Show debug output
|
|
596
597
|
|
|
597
|
-
${
|
|
598
|
-
asm import skills.json ${
|
|
599
|
-
asm import skills.json --force ${
|
|
600
|
-
asm import skills.json -s global ${
|
|
601
|
-
asm export > backup.json ${
|
|
602
|
-
asm import backup.json ${
|
|
603
|
-
${
|
|
604
|
-
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 lv(e){if(e.flags.help){av();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 Mc(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 Dc(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 cv(){console.log(`${u.bold("Usage:")} asm init <name> [options]
|
|
605
606
|
|
|
606
607
|
Scaffold a new skill directory with a SKILL.md template. Creates a
|
|
607
608
|
ready-to-edit skill in the target tool's skill folder.
|
|
608
609
|
|
|
609
|
-
${
|
|
610
|
+
${u.bold("Options:")}
|
|
610
611
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
611
612
|
--path <dir> Scaffold in specified directory instead of provider path
|
|
612
613
|
-f, --force Overwrite if skill already exists
|
|
613
614
|
--no-color Disable ANSI colors
|
|
614
615
|
-V, --verbose Show debug output
|
|
615
616
|
|
|
616
|
-
${
|
|
617
|
-
asm init my-skill ${
|
|
618
|
-
asm init my-skill -p claude ${
|
|
619
|
-
asm init my-skill --path ./skills ${
|
|
620
|
-
${
|
|
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 uv(e){if(e.flags.help){cv();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 qc(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 _c(s,i),console.error(u.green(`Done! Created skill "${s}" at ${i}`))}function fv(){console.log(`${u.bold("Usage:")} asm stats [options]
|
|
621
622
|
|
|
622
623
|
Show aggregate skill metrics with provider distribution charts,
|
|
623
624
|
scope breakdown, disk usage, and duplicate summary.
|
|
624
625
|
|
|
625
|
-
${
|
|
626
|
+
${u.bold("Options:")}
|
|
626
627
|
--json Output as JSON
|
|
627
628
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
628
629
|
--no-color Disable ANSI colors
|
|
629
630
|
-V, --verbose Show debug output
|
|
630
631
|
|
|
631
|
-
${
|
|
632
|
-
asm stats ${
|
|
633
|
-
asm stats -s global ${
|
|
634
|
-
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 dv(e){if(e.flags.help){fv();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 jc(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(Bc(n))}function pv(){console.log(`${u.bold("Usage:")} asm doctor [options]
|
|
635
636
|
|
|
636
637
|
Run environment health checks and diagnostics. Validates all
|
|
637
|
-
prerequisites for using asm
|
|
638
|
+
prerequisites for using asm \u2014 git, GitHub CLI, Node.js, config,
|
|
638
639
|
lock file, registry, installed skills, and disk space.
|
|
639
640
|
|
|
640
|
-
${
|
|
641
|
+
${u.bold("Options:")}
|
|
641
642
|
--json Output as JSON
|
|
642
643
|
--machine Output in stable machine-readable v1 envelope format
|
|
643
644
|
--no-color Disable ANSI colors
|
|
644
645
|
-V, --verbose Show debug output
|
|
645
646
|
|
|
646
|
-
${
|
|
647
|
-
asm doctor ${
|
|
648
|
-
asm doctor --json ${
|
|
649
|
-
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 mv(e){if(e.flags.help){pv();return}let t=performance.now(),s=await yu();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(wu(s)):console.log(bu(s));s.failures>0&&process.exit(1)}function hv(){console.log(`${u.bold("Usage:")} asm eval <target> [options]
|
|
650
651
|
|
|
651
652
|
Evaluate a skill's SKILL.md against best practices and produce a scored quality
|
|
652
|
-
report with recommendations. Zero configuration
|
|
653
|
+
report with recommendations. Zero configuration \u2014 just point it at a skill
|
|
653
654
|
directory. Categories: structure, description quality, prompt engineering,
|
|
654
655
|
context efficiency, safety, testability, and naming conventions.
|
|
655
656
|
|
|
@@ -657,11 +658,11 @@ Accepts a local path, a GitHub shorthand, or a GitHub URL. When the target is a
|
|
|
657
658
|
collection (no SKILL.md at the root but each immediate child has one), every
|
|
658
659
|
child skill is evaluated and an aggregate summary is printed.
|
|
659
660
|
|
|
660
|
-
${
|
|
661
|
+
${u.bold("Arguments:")}
|
|
661
662
|
target Local path, github:owner/repo[#ref][:subpath], or
|
|
662
663
|
https://github.com/owner/repo[/tree/<ref>/<sub>]
|
|
663
664
|
|
|
664
|
-
${
|
|
665
|
+
${u.bold("Options:")}
|
|
665
666
|
--fix Apply deterministic auto-fixes to SKILL.md (creates .bak)
|
|
666
667
|
--dry-run With --fix, preview the diff without writing
|
|
667
668
|
--json Output report as JSON
|
|
@@ -672,37 +673,37 @@ ${W.bold("Options:")}
|
|
|
672
673
|
--no-color Disable ANSI colors
|
|
673
674
|
-V, --verbose Show debug output
|
|
674
675
|
|
|
675
|
-
${
|
|
676
|
-
asm eval ./my-skill ${
|
|
677
|
-
asm eval ./skills/ ${
|
|
678
|
-
asm eval github:mattpocock/skills:grill-me ${
|
|
679
|
-
asm eval github:mattpocock/skills ${
|
|
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")}
|
|
680
681
|
asm eval https://github.com/mattpocock/skills/tree/main/grill-me
|
|
681
|
-
asm eval ./my-skill --json ${
|
|
682
|
-
asm eval ./my-skill --fix ${
|
|
683
|
-
asm eval ./my-skill --fix --dry-run ${
|
|
684
|
-
asm eval ./my-skill --machine ${
|
|
685
|
-
asm eval-providers list ${
|
|
686
|
-
`))}function
|
|
687
|
-
|
|
688
|
-
Manage evaluation providers registered with the ${
|
|
689
|
-
Providers implement the ${
|
|
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 gv(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 yv(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 rs(i);let n=await De(i,t),r=i.subpath?ff(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}),m=p.trim();/^[0-9a-f]{40}$/i.test(m)&&(o=m)}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 uf(e){wi();try{let t={skillPath:e.skillPath,skillMdPath:e.skillMdPath},s=(await Promise.all(zt(vi()).map(async r=>(await r.applicable(t,{})).ok?ki(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 gv(i),{report:{...i.raw,providers:zt(s.map(Qu))},error:null}}catch(t){return{report:null,error:t?.message??String(t)}}}async function bv(e){if(e.flags.help){hv();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(Vr(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 Nu(),o=await Pu(i,{dryRun:e.flags.dryRun,gitAuthor:r});if(e.flags.machine){t?.(),console.log(Y("eval",hi(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(mi(o.report)),console.log(""),console.log(Lu(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 Ru(i,{fetchRemote:r=>yv(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 uf(c);if(!d)throw new Error(f??"eval failed");if(e.flags.machine){t?.();let p=hi(d,null),m=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",m,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(Iu(d));return}console.log(mi(d)),n.provenance.remote&&wv(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 Tu(n.targets,r,async c=>{let{report:d,error:f}=await uf(c);return{label:c.label,skillPath:c.skillPath,report:d,error:f}}),a=Ou(o),l={provenance:n.provenance,aggregate:a,results:o};if(e.flags.machine){t?.(),console.log(Y("eval",Du(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(mi(c.report)):(console.log(`Skill evaluation: ${c.skillPath}`),console.log(` ${u.red("error:")} ${c.error??"unknown failure"}`)),console.log("");console.log(Mu(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 wv(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 vv(){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
|
|
690
691
|
are resolved by id and semver range.
|
|
691
692
|
|
|
692
|
-
${
|
|
693
|
+
${u.bold("Subcommands:")}
|
|
693
694
|
list List every registered (id, version) provider
|
|
694
695
|
|
|
695
|
-
${
|
|
696
|
+
${u.bold("Options:")}
|
|
696
697
|
--json Output as JSON (list)
|
|
697
698
|
--no-color Disable ANSI colors
|
|
698
699
|
-V, --verbose Show debug output
|
|
699
700
|
|
|
700
|
-
${
|
|
701
|
-
asm eval-providers list ${
|
|
702
|
-
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 kv(e){if(e.flags.help){vv();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":{wi();let s=gi();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 Sv(){console.log(`${u.bold("Usage:")} asm link <path> [<path2> ...] [options]
|
|
703
704
|
|
|
704
705
|
Symlink a local skill directory into an agent's skill folder. Useful
|
|
705
|
-
for local development
|
|
706
|
+
for local development \u2014 changes to the source are reflected immediately.
|
|
706
707
|
|
|
707
708
|
If <path> contains a SKILL.md at its root, it is linked as a single skill.
|
|
708
709
|
If <path> has no root SKILL.md but contains subdirectories with SKILL.md
|
|
@@ -710,7 +711,7 @@ files, all discovered skills are linked in a single invocation.
|
|
|
710
711
|
|
|
711
712
|
Multiple paths can be provided to link several skills at once.
|
|
712
713
|
|
|
713
|
-
${
|
|
714
|
+
${u.bold("Options:")}
|
|
714
715
|
-p, --tool <name> Target tool (claude, codex, openclaw, agents)
|
|
715
716
|
--name <name> Override symlink name (single skill only)
|
|
716
717
|
-f, --force Overwrite if target already exists
|
|
@@ -718,28 +719,28 @@ ${W.bold("Options:")}
|
|
|
718
719
|
--no-color Disable ANSI colors
|
|
719
720
|
-V, --verbose Show debug output
|
|
720
721
|
|
|
721
|
-
${
|
|
722
|
-
asm link ./my-skill ${
|
|
723
|
-
asm link ./my-skill -p claude ${
|
|
724
|
-
asm link ./my-skill --name alias ${
|
|
725
|
-
asm link ./my-skills-folder ${
|
|
726
|
-
asm link ./skill1 ./skill2 ./skill3 -p claude ${
|
|
727
|
-
${
|
|
728
|
-
${
|
|
729
|
-
Done! Linked ${
|
|
730
|
-
${
|
|
731
|
-
${
|
|
732
|
-
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 $v(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 $v(r,i);return await Vc(e,t,s,o),{name:s,symlinkPath:r,targetPath:e}}async function xv(e){if(e.flags.help){Sv();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 y=await q(),{provider:h}=await ze(y,e.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:g}=await import("./config-55HAAFSH.js"),b=g(y.providers.find(E=>E.name===h.name).global),{resolve:v,basename:k}=await import("path"),x=[],S=[];for(let E of t){let O=v(E),P=!1;try{await Er(O),P=!0}catch{}if(P){let M=k(O);try{let w=await xi(O,b,M,!!e.flags.force);x.push(w),e.flags.json||console.error(u.green(` Linked "${w.name}" -> ${w.targetPath}`))}catch(w){let $=w instanceof Error?w.message:String(w);S.push({name:M,error:$}),e.flags.json||console.error(u.red(` Failed to link "${M}": ${$}`))}}else{let M=[];try{M=await Ar(O)}catch(w){let $=w instanceof Error?w.message:String(w);S.push({name:E,error:$}),e.flags.json||console.error(u.red(` Failed to process "${E}": ${$}`));continue}if(M.length===0){let w=`No SKILL.md found in ${O} or its immediate subdirectories.`;S.push({name:E,error:w}),e.flags.json||console.error(u.red(` ${w}`));continue}for(let w of M)try{let $=await xi(w.absPath,b,w.dirName,!!e.flags.force);x.push($),e.flags.json||console.error(u.green(` Linked "${$.name}" -> ${$.targetPath}`))}catch($){let I=$ instanceof Error?$.message:String($);S.push({name:w.name,error:I}),e.flags.json||console.error(u.red(` Failed to link "${w.name}": ${I}`))}}}e.flags.json?console.log(J({success:S.length===0,linked:x,failures:S})):S.length>0?console.error(u.yellow(`
|
|
729
|
+
${x.length} linked, ${S.length} failed.`)):console.error(u.green(`
|
|
730
|
+
Done! Linked ${x.length} skill(s) successfully.`)),S.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(y=>y.name===c.name).global);if(o){let y=e.flags.name?Te(e.flags.name):n(r),h;try{h=await xi(r,f,y,!!e.flags.force)}catch(g){let b=g instanceof Error?g.message:String(g);e.flags.json?console.log(J({success:!1,error:b})):C(b),process.exit(2)}e.flags.json?console.log(J({success:!0,...h})):(console.error(u.green(`Done! Linked "${h.name}" -> ${h.targetPath}`)),console.error(` Symlink: ${h.symlinkPath}`),console.error(u.dim(` If you move or delete the source, run "asm uninstall ${h.name}" to clean up.`)));return}console.error(`Found ${u.bold(String(a.length))} skill(s) in ${r}:`);for(let y of a)console.error(` ${u.bold(y.name)} ${u.dim(`v${y.version}`)} ${u.dim(`(${y.dirName}/)`)}`);if(process.stdin.isTTY&&!e.flags.force){process.stderr.write(`
|
|
731
|
+
${u.bold(`Link ${a.length} skill(s)?`)} [Y/n] `);let y=await G();(y.toLowerCase()==="n"||y.toLowerCase()==="no")&&(console.error("Aborted."),process.exit(0))}let p=[],m=[];for(let y of a){let h=e.flags.name&&a.length===1?Te(e.flags.name):y.dirName;try{let g=await xi(y.absPath,f,h,!!e.flags.force);p.push(g),e.flags.json||console.error(u.green(` Linked "${g.name}" -> ${g.targetPath}`))}catch(g){let b=g instanceof Error?g.message:String(g);m.push({name:y.name,error:b}),e.flags.json||console.error(u.red(` Failed to link "${y.name}": ${b}`))}}e.flags.json?console.log(J({success:m.length===0,linked:p,failures:m})):m.length>0?console.error(u.yellow(`
|
|
732
|
+
${p.length} linked, ${m.length} failed.`)):console.error(u.green(`
|
|
733
|
+
Done! Linked ${p.length} skill(s) successfully.`)),m.length>0&&process.exit(1)}function Cv(){console.log(`${u.bold("Usage:")} asm index <subcommand> [options]
|
|
733
734
|
|
|
734
735
|
Manage the skill index for searching available skills from indexed repos.
|
|
735
736
|
|
|
736
|
-
${
|
|
737
|
+
${u.bold("Subcommands:")}
|
|
737
738
|
ingest <repo> Ingest a skill repository into the index
|
|
738
739
|
search <query> Search indexed skills by name or description
|
|
739
740
|
list List all indexed repositories
|
|
740
741
|
remove <owner/repo> Remove a repo from the index
|
|
741
742
|
|
|
742
|
-
${
|
|
743
|
+
${u.bold("Options:")}
|
|
743
744
|
--json Output as JSON
|
|
744
745
|
--has <field> Only show skills that have <field> (license, creator, version)
|
|
745
746
|
--missing <field> Only show skills missing <field> (license, creator, version)
|
|
@@ -747,49 +748,59 @@ ${W.bold("Options:")}
|
|
|
747
748
|
--no-color Disable ANSI colors
|
|
748
749
|
-V, --verbose Show debug output
|
|
749
750
|
|
|
750
|
-
${
|
|
751
|
-
asm index ingest github:obra/superpowers ${
|
|
752
|
-
asm index search code review ${
|
|
753
|
-
asm index search marketing --has license ${
|
|
754
|
-
asm index search "" --missing creator ${
|
|
755
|
-
asm index list ${
|
|
756
|
-
asm index remove obra/superpowers ${
|
|
757
|
-
`));for(let
|
|
758
|
-
`)}}break}case"list":{let
|
|
759
|
-
`));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 Ev(e){if(e.flags.help){Cv();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 af(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 $i(s||"",20,i):await $i(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 go(o.skill.description,80))console.error(` ${c}`);let l=nf(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 lf();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 rf();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 cf(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 Av(){console.log(`${u.bold("Usage:")} asm bundle <subcommand> [options]
|
|
760
761
|
|
|
761
762
|
Create, install, and manage curated skill bundles. A bundle is a reusable
|
|
762
763
|
recipe of skills for a particular workflow, domain, or project setup.
|
|
763
764
|
|
|
764
|
-
${
|
|
765
|
+
${u.bold("Subcommands:")}
|
|
765
766
|
create <name> Create a new bundle from installed skills
|
|
766
|
-
install <name|file> Install all skills from a bundle
|
|
767
|
+
install <name|file> Install all skills from a bundle (supports pre-defined names)
|
|
767
768
|
list List all saved bundles
|
|
769
|
+
list --predefined List pre-defined bundles shipped with ASM
|
|
768
770
|
show <name|file> Show bundle details
|
|
769
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
|
|
770
774
|
|
|
771
|
-
${
|
|
775
|
+
${u.bold("Options:")}
|
|
772
776
|
-s, --scope <s> Filter: global, project, or both (default: both)
|
|
773
777
|
-y, --yes Skip confirmation prompts
|
|
774
778
|
--json Output as JSON
|
|
779
|
+
--predefined Show pre-defined bundles shipped with ASM (for list)
|
|
775
780
|
--no-color Disable ANSI colors
|
|
776
781
|
-V, --verbose Show debug output
|
|
777
782
|
|
|
778
|
-
${
|
|
779
|
-
asm bundle create my-workflow ${
|
|
780
|
-
asm bundle install my-workflow ${
|
|
781
|
-
asm bundle install
|
|
782
|
-
asm bundle
|
|
783
|
-
asm bundle list
|
|
784
|
-
asm bundle
|
|
785
|
-
asm bundle
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
${
|
|
792
|
-
`))
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
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 Pv(e){if(e.flags.help){Av();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(h=>{let g=h.name.toLowerCase();return r.has(g)?!1:(r.add(g),!0)}),a=o;if(process.stdin.isTTY&&!e.flags.yes){let h=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 g=await We({items:h});g.length===0&&(C("No skills selected. Bundle not created."),process.exit(1)),a=g.map(b=>o[b])}let{readLock:l}=await import("./lock-SOHBB4N3.js"),c=await l(),d=await Promise.all(a.map(h=>Gc(h,c))),f=`Bundle of ${d.length} skills`,p="unknown";try{let{execSync:h}=await import("child_process"),g=h("git config user.name",{encoding:"utf-8"}).trim();g&&(p=g)}catch{}if(process.stdin.isTTY&&!e.flags.yes){process.stderr.write(`
|
|
798
|
+
${u.bold("Description")} (optional, press Enter to skip): `);let h=await G();h.trim()&&(f=h.trim()),process.stderr.write(`${u.bold("Author")} (optional, press Enter to skip): `);let g=await G();g.trim()&&(p=g.trim())}let m=Yc(s,f,p,d),y=await Nr(m);e.flags.json?console.log(JSON.stringify(m,null,2)):(console.error(u.green(`Bundle "${s}" created with ${d.length} skill(s).`)),console.error(` Saved to: ${u.dim(y)}`));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 m=Oe(f.installUrl),y=!!m.isLocal,h=null;try{let g,b;y?(g=m.localPath,b=m.localPath):(h=await De(m,e.flags.transport),g=h,b=m.subpath?ff(h,m.subpath):h);let v=await _e(b),k=Te(f.name||v.name||m.repo),x=_i(m,g,b,k,o,e.flags.force,a);try{await Mo(x.targetDir,x.force)}catch(S){if(S.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 S}await as(x),n.push({name:f.name,status:"installed"}),console.error(` ${u.green("+++")} ${f.name} installed`)}finally{h&&await ne(h)}}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 Wc();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 zc();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 Qc(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(y=>y.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 m=await G();m.trim()&&(i.tags=m.split(",").map(y=>y.trim()).filter(y=>y.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 Nv(e){if(e.flags.help){jw();return}let t=e.flags.machine?Ge():void 0,s=performance.now(),i=e.subcommand||".";try{let n=await iu({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(nu(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 Iv(e){if(e.flags.help){Bw();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(fu(i));return}let n=!e.flags.noColor&&process.stdout.isTTY!==!1;console.log(uu(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 Lv(e){if(e.flags.help){Uw();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 cu(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(du(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 pf(e){let t=Ow(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&&zr(!0),t.flags.version){console.log(`asm ${Li}`);let s=await di();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){Tw();return}if(t.command)switch(t.command){case"list":await Kw(t);break;case"search":await Jw(t);break;case"inspect":await Hw(t);break;case"uninstall":await Yw(t);break;case"audit":await Gw(t);break;case"install":await nv(t);break;case"config":await Zw(t);break;case"export":await ov(t);break;case"import":await lv(t);break;case"init":await uv(t);break;case"stats":await dv(t);break;case"link":await xv(t);break;case"index":await Ev(t);break;case"bundle":await Pv(t);break;case"publish":await Nv(t);break;case"outdated":await Iv(t);break;case"update":await Lv(t);break;case"doctor":await mv(t);break;case"eval":await bv(t);break;case"eval-providers":await kv(t);break;default:C(`Unknown command: "${t.command}"`),console.error('Run "asm --help" for usage.'),process.exit(2)}}function mf(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(mf(process.argv))await pf(process.argv);else{let{main:e}=await import("./src-YK2KIAU7.js");await e().catch(t=>{console.error("Fatal error:",t),process.exit(1)})}
|