agent-skill-manager 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/data/skill-index/Affitor_affiliate-skills.json +4089 -167
- package/data/skill-index/Eronred_aso-skills.json +2251 -31
- package/data/skill-index/GPTomics_bioSkills.json +33126 -640
- package/data/skill-index/Galaxy-Dawn_claude-scholar.json +3084 -765
- package/data/skill-index/Imbad0202_academic-research-skills.json +315 -19
- package/data/skill-index/K-Dense-AI_claude-scientific-skills.json +10060 -144
- package/data/skill-index/Leonxlnx_taste-skill.json +1150 -10
- package/data/skill-index/Master-cai_Research-Paper-Writing-Skills.json +76 -2
- package/data/skill-index/MiniMax-AI_skills.json +1730 -28
- package/data/skill-index/Paramchoudhary_ResumeSkills.json +10421 -0
- package/data/skill-index/affaan-m_everything-claude-code.json +35901 -2483
- package/data/skill-index/alirezarezvani_claude-skills.json +40310 -1896
- package/data/skill-index/anthropics_skills.json +1352 -20
- package/data/skill-index/antonbabenko_terraform-skill.json +146 -0
- package/data/skill-index/bytedance_deer-flow.json +1657 -29
- package/data/skill-index/coreyhaines31_marketingskills.json +3266 -54
- package/data/skill-index/github_awesome-copilot.json +36002 -902
- package/data/skill-index/google_skills.json +1790 -0
- package/data/skill-index/heygen-com_hyperframes.json +1346 -17
- package/data/skill-index/himself65_finance-skills.json +1866 -38
- package/data/skill-index/kemiljk_fluid-design.json +76 -2
- package/data/skill-index/kepano_obsidian-skills.json +376 -6
- package/data/skill-index/luongnv89_skills.json +2425 -857
- package/data/skill-index/mattpocock_skills.json +1809 -118
- package/data/skill-index/nextlevelbuilder_ui-ux-pro-max-skill.json +538 -20
- package/data/skill-index/obra_superpowers.json +1051 -15
- package/data/skill-index/sickn33_antigravity-awesome-skills.json +346070 -13548
- package/data/skill-index/slavingia_skills.json +751 -11
- package/data/skill-index-resources.json +28 -1
- package/dist/agent-skill-manager.js +217 -217
- package/dist/{chunk-CLIZUJVB.js → chunk-5ADANJQ6.js} +1 -1
- package/dist/{src-RNJS76U3.js → src-SVL3X6OZ.js} +1 -1
- package/package.json +1 -1
- package/data/bundles/eu-project-ops.json +0 -25
|
@@ -1,165 +1,165 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __asmCreateRequire } from 'node:module'; const require = __asmCreateRequire(import.meta.url);
|
|
3
|
-
import{a as
|
|
4
|
-
`)}};
|
|
5
|
-
`)?
|
|
3
|
+
import{a as Re,b as yt,c as ko,d as So}from"./chunk-PVEAYTE2.js";import{C as wo,D as vo,E as Y,F as Ri,G as $o,I as xo,J as Eo,K as Co,L as Oi,M as Ao,a as re,b as ue,c as ro,d as ss,g as ee,h as oo,i as Ai,j as ao,k as lo,l as Pi,m as co,n as u,o as uo,p as fo,q as po,r as Ni,s as Ii,t as Li,u as mo,v as ho,w as is,x as go,y as yo,z as bo}from"./chunk-5ADANJQ6.js";import{a as eo,b as I,c as to,d as ht,e as so,f as gt,g as io,j as ce,k as B,l as no}from"./chunk-GOI5LV72.js";import{a as ts,b as C,d as Zr}from"./chunk-7BMOBFGJ.js";var q=C(W=>{"use strict";var Ui=Symbol.for("yaml.alias"),Bo=Symbol.for("yaml.document"),us=Symbol.for("yaml.map"),Uo=Symbol.for("yaml.pair"),Vi=Symbol.for("yaml.scalar"),fs=Symbol.for("yaml.seq"),ye=Symbol.for("yaml.node.type"),Jf=e=>!!e&&typeof e=="object"&&e[ye]===Ui,Hf=e=>!!e&&typeof e=="object"&&e[ye]===Bo,Gf=e=>!!e&&typeof e=="object"&&e[ye]===us,Yf=e=>!!e&&typeof e=="object"&&e[ye]===Uo,Vo=e=>!!e&&typeof e=="object"&&e[ye]===Vi,Wf=e=>!!e&&typeof e=="object"&&e[ye]===fs;function Ko(e){if(e&&typeof e=="object")switch(e[ye]){case us:case fs:return!0}return!1}function zf(e){if(e&&typeof e=="object")switch(e[ye]){case Ui:case us:case Vi:case fs:return!0}return!1}var Qf=e=>(Vo(e)||Ko(e))&&!!e.anchor;W.ALIAS=Ui;W.DOC=Bo;W.MAP=us;W.NODE_TYPE=ye;W.PAIR=Uo;W.SCALAR=Vi;W.SEQ=fs;W.hasAnchor=Qf;W.isAlias=Jf;W.isCollection=Ko;W.isDocument=Hf;W.isMap=Gf;W.isNode=zf;W.isPair=Yf;W.isScalar=Vo;W.isSeq=Wf});var bt=C(Ki=>{"use strict";var J=q(),te=Symbol("break visit"),Jo=Symbol("skip children"),pe=Symbol("remove node");function ds(e,t){let s=Ho(t);J.isDocument(e)?Ze(null,e.contents,s,Object.freeze([e]))===pe&&(e.contents=null):Ze(null,e,s,Object.freeze([]))}ds.BREAK=te;ds.SKIP=Jo;ds.REMOVE=pe;function Ze(e,t,s,i){let n=Go(e,t,s,i);if(J.isNode(n)||J.isPair(n))return Yo(e,i,n),Ze(e,n,s,i);if(typeof n!="symbol"){if(J.isCollection(t)){i=Object.freeze(i.concat(t));for(let r=0;r<t.items.length;++r){let o=Ze(r,t.items[r],s,i);if(typeof o=="number")r=o-1;else{if(o===te)return te;o===pe&&(t.items.splice(r,1),r-=1)}}}else if(J.isPair(t)){i=Object.freeze(i.concat(t));let r=Ze("key",t.key,s,i);if(r===te)return te;r===pe&&(t.key=null);let o=Ze("value",t.value,s,i);if(o===te)return te;o===pe&&(t.value=null)}}return n}async function ps(e,t){let s=Ho(t);J.isDocument(e)?await et(null,e.contents,s,Object.freeze([e]))===pe&&(e.contents=null):await et(null,e,s,Object.freeze([]))}ps.BREAK=te;ps.SKIP=Jo;ps.REMOVE=pe;async function et(e,t,s,i){let n=await Go(e,t,s,i);if(J.isNode(n)||J.isPair(n))return Yo(e,i,n),et(e,n,s,i);if(typeof n!="symbol"){if(J.isCollection(t)){i=Object.freeze(i.concat(t));for(let r=0;r<t.items.length;++r){let o=await et(r,t.items[r],s,i);if(typeof o=="number")r=o-1;else{if(o===te)return te;o===pe&&(t.items.splice(r,1),r-=1)}}}else if(J.isPair(t)){i=Object.freeze(i.concat(t));let r=await et("key",t.key,s,i);if(r===te)return te;r===pe&&(t.key=null);let o=await et("value",t.value,s,i);if(o===te)return te;o===pe&&(t.value=null)}}return n}function Ho(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 Go(e,t,s,i){if(typeof s=="function")return s(e,t,i);if(J.isMap(t))return s.Map?.(e,t,i);if(J.isSeq(t))return s.Seq?.(e,t,i);if(J.isPair(t))return s.Pair?.(e,t,i);if(J.isScalar(t))return s.Scalar?.(e,t,i);if(J.isAlias(t))return s.Alias?.(e,t,i)}function Yo(e,t,s){let i=t[t.length-1];if(J.isCollection(i))i.items[e]=s;else if(J.isPair(i))e==="key"?i.key=s:i.value=s;else if(J.isDocument(i))i.contents=s;else{let n=J.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}Ki.visit=ds;Ki.visitAsync=ps});var Ji=C(zo=>{"use strict";var Wo=q(),Xf=bt(),Zf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ed=e=>e.replace(/[!,[\]{}]/g,t=>Zf[t]),wt=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+ed(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&&Wo.isNode(t.contents)){let r={};Xf.visit(t.contents,(o,a)=>{Wo.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
|
+
`)}};wt.defaultYaml={explicit:!1,version:"1.2"};wt.defaultTags={"!!":"tag:yaml.org,2002:"};zo.Directives=wt});var ms=C(vt=>{"use strict";var Qo=q(),td=bt();function sd(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 Xo(e){let t=new Set;return td.visit(e,{Value(s,i){i.anchor&&t.add(i.anchor)}}),t}function Zo(e,t){for(let s=1;;++s){let i=`${e}${s}`;if(!t.has(i))return i}}function id(e,t){let s=[],i=new Map,n=null;return{onAnchor:r=>{s.push(r),n??(n=Xo(e));let o=Zo(t,n);return n.add(o),o},setAnchors:()=>{for(let r of s){let o=i.get(r);if(typeof o=="object"&&o.anchor&&(Qo.isScalar(o.node)||Qo.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}}vt.anchorIsValid=sd;vt.anchorNames=Xo;vt.createNodeAnchors=id;vt.findNewAnchor=Zo});var Hi=C(ea=>{"use strict";function kt(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=kt(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=kt(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=kt(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=kt(e,i,n,r);o===void 0?delete i[n]:o!==r&&(i[n]=o)}return e.call(t,s,i)}ea.applyReviver=kt});var ke=C(sa=>{"use strict";var nd=q();function ta(e,t,s){if(Array.isArray(e))return e.map((i,n)=>ta(i,String(n),s));if(e&&typeof e.toJSON=="function"){if(!s||!nd.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}sa.toJS=ta});var hs=C(na=>{"use strict";var rd=Hi(),ia=q(),od=ke(),Gi=class{constructor(t){Object.defineProperty(this,ia.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(!ia.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=od.toJS(this,"",o);if(typeof n=="function")for(let{count:l,res:c}of o.anchors.values())n(c,l);return typeof r=="function"?rd.applyReviver(r,{"":a},"",a):a}};na.NodeBase=Gi});var St=C(ra=>{"use strict";var ad=ms(),ld=bt(),tt=q(),cd=hs(),ud=ke(),Yi=class extends cd.NodeBase{constructor(t){super(tt.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=[],ld.visit(t,{Node:(r,o)=>{(tt.isAlias(o)||tt.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||(ud.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=gs(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(ad.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 gs(e,t,s){if(tt.isAlias(t)){let i=t.resolve(e),n=s&&i&&s.get(i);return n?n.count*n.aliasCount:0}else if(tt.isCollection(t)){let i=0;for(let n of t.items){let r=gs(e,n,s);r>i&&(i=r)}return i}else if(tt.isPair(t)){let i=gs(e,t.key,s),n=gs(e,t.value,s);return Math.max(i,n)}return 1}ra.Alias=Yi});var V=C(Wi=>{"use strict";var fd=q(),dd=hs(),pd=ke(),md=e=>!e||typeof e!="function"&&typeof e!="object",Se=class extends dd.NodeBase{constructor(t){super(fd.SCALAR),this.value=t}toJSON(t,s){return s?.keep?this.value:pd.toJS(this.value,t,s)}toString(){return String(this.value)}};Se.BLOCK_FOLDED="BLOCK_FOLDED";Se.BLOCK_LITERAL="BLOCK_LITERAL";Se.PLAIN="PLAIN";Se.QUOTE_DOUBLE="QUOTE_DOUBLE";Se.QUOTE_SINGLE="QUOTE_SINGLE";Wi.Scalar=Se;Wi.isScalarValue=md});var $t=C(aa=>{"use strict";var hd=St(),Fe=q(),oa=V(),gd="tag:yaml.org,2002:";function yd(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 bd(e,t,s){if(Fe.isDocument(e)&&(e=e.contents),Fe.isNode(e))return e;if(Fe.isPair(e)){let f=s.schema[Fe.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 hd.Alias(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t=gd+t.slice(2));let c=yd(e,t,o.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let f=new oa.Scalar(e);return l&&(l.node=f),f}c=e instanceof Map?o[Fe.MAP]:Symbol.iterator in Object(e)?o[Fe.SEQ]:o[Fe.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 oa.Scalar(e);return t?d.tag=t:c.default||(d.tag=c.tag),l&&(l.node=d),d}aa.createNode=bd});var bs=C(ys=>{"use strict";var wd=$t(),me=q(),vd=hs();function zi(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 wd.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 la=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Qi=class extends vd.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=>me.isNode(i)||me.isPair(i)?i.clone(t):i),this.range&&(s.range=this.range.slice()),s}addIn(t,s){if(la(t))this.add(s);else{let[i,...n]=t,r=this.get(i,!0);if(me.isCollection(r))r.addIn(n,s);else if(r===void 0&&this.schema)this.set(i,zi(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(me.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&&me.isScalar(r)?r.value:r:me.isCollection(r)?r.getIn(n,s):void 0}hasAllNullValues(t){return this.items.every(s=>{if(!me.isPair(s))return!1;let i=s.value;return i==null||t&&me.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 me.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(me.isCollection(r))r.setIn(n,s);else if(r===void 0&&this.schema)this.set(i,zi(this.schema,n,s));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};ys.Collection=Qi;ys.collectionFromPath=zi;ys.isEmptyPath=la});var xt=C(ws=>{"use strict";var kd=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Xi(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Sd=(e,t,s)=>e.endsWith(`
|
|
5
|
+
`)?Xi(s,t):s.includes(`
|
|
6
6
|
`)?`
|
|
7
|
-
`+
|
|
8
|
-
`)s===
|
|
9
|
-
`&&
|
|
10
|
-
`&&
|
|
11
|
-
${t}${e.slice(0,k)}`:(s===
|
|
12
|
-
${t}${e.slice(
|
|
13
|
-
`);i=t,n=t+1,r=e[n]}return i}
|
|
14
|
-
`){if(r-o>i)return!0;if(o=r+1,n-o<=i)return!1}return!0}function
|
|
7
|
+
`+Xi(s,t):(e.endsWith(" ")?"":" ")+s;ws.indentComment=Xi;ws.lineComment=Sd;ws.stringifyComment=kd});var ua=C(Et=>{"use strict";var $d="flow",Zi="block",vs="quoted";function xd(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===Zi&&(h=ca(e,h,t.length),h!==-1&&(f=h+l));for(let w;w=e[h+=1];){if(s===vs&&w==="\\"){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(w===`
|
|
8
|
+
`)s===Zi&&(h=ca(e,h,t.length)),f=h+t.length+l,p=void 0;else{if(w===" "&&m&&m!==" "&&m!==`
|
|
9
|
+
`&&m!==" "){let S=e[h+1];S&&S!==" "&&S!==`
|
|
10
|
+
`&&S!==" "&&(p=h)}if(h>=f)if(p)c.push(p),f=p+l,p=void 0;else if(s===vs){for(;m===" "||m===" ";)m=w,w=e[h+=1],y=!0;let S=h>b+1?h-2:g-1;if(d[S])return e;c.push(S),d[S]=!0,f=S+l,p=void 0}else y=!0}m=w}if(y&&a&&a(),c.length===0)return e;o&&o();let v=e.slice(0,c[0]);for(let w=0;w<c.length;++w){let S=c[w],k=c[w+1]||e.length;S===0?v=`
|
|
11
|
+
${t}${e.slice(0,k)}`:(s===vs&&d[S]&&(v+=`${e[S]}\\`),v+=`
|
|
12
|
+
${t}${e.slice(S+1,k)}`)}return v}function ca(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}Et.FOLD_BLOCK=Zi;Et.FOLD_FLOW=$d;Et.FOLD_QUOTED=vs;Et.foldFlowLines=xd});var At=C(fa=>{"use strict";var fe=V(),$e=ua(),Ss=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),$s=e=>/^(%|---|\.\.\.)/m.test(e);function Ed(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 Ct(e,t){let s=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return s;let{implicitKey:i}=t,n=t.options.doubleQuotedMinMultiLineLength,r=t.indent||($s(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
15
|
|
|
16
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
|
|
18
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return
|
|
19
|
-
${s}`)+"'";return t.implicitKey?i
|
|
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:$e.foldFlowLines(o,r,$e.FOLD_QUOTED,Ss(t,!1))}function en(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
18
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Ct(e,t);let s=t.indent||($s(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${s}`)+"'";return t.implicitKey?i:$e.foldFlowLines(i,s,$e.FOLD_FLOW,Ss(t,!1))}function st(e,t){let{singleQuote:s}=t.options,i;if(s===!1)i=Ct;else{let n=e.includes('"'),r=e.includes("'");n&&!r?i=en:r&&!n?i=Ct:i=s?en:Ct}return i(e,t)}var tn;try{tn=new RegExp(`(^|(?<!
|
|
20
20
|
))
|
|
21
21
|
+(?!
|
|
22
|
-
|$)`,"g")}catch{
|
|
22
|
+
|$)`,"g")}catch{tn=/\n+(?!\n|$)/g}function ks({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 st(s,i);let c=i.indent||(i.forceBlockIndent||$s(s)?" ":""),d=o==="literal"?!0:o==="folded"||t===fe.Scalar.BLOCK_FOLDED?!1:t===fe.Scalar.BLOCK_LITERAL?!0:!Ed(s,l,c.length);if(!s)return d?`|
|
|
23
23
|
`:`>
|
|
24
24
|
`;let f,p;for(p=s.length;p>0;--p){let k=s[p-1];if(k!==`
|
|
25
|
-
`&&k!==" "&&k!==" ")break}let
|
|
26
|
-
`);
|
|
27
|
-
`&&(
|
|
28
|
-
`)b=
|
|
29
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),
|
|
30
|
-
${c}${
|
|
31
|
-
${c}${
|
|
32
|
-
`)||d&&/[[\]{},]/.test(r))return
|
|
33
|
-
`)?
|
|
34
|
-
`))return
|
|
35
|
-
${l}`);if(o){let p=
|
|
36
|
-
${t.indent}${a}`:a}
|
|
37
|
-
${a}:`):(
|
|
38
|
-
`:"",
|
|
39
|
-
${
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
`):
|
|
43
|
-
${s.indent}`}else if(!
|
|
44
|
-
`),
|
|
25
|
+
`&&k!==" "&&k!==" ")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(tn,`$&${c}`));let h=!1,g,b=-1;for(g=0;g<s.length;++g){let k=s[g];if(k===" ")h=!0;else if(k===`
|
|
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 S=(h?c?"2":"1":"")+f;if(e&&(S+=" "+a(e.replace(/ ?[\r\n]+/g," ")),n&&n()),!d){let k=s.replace(/\n+/g,`
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),P=!1,x=Ss(i,!0);o!=="folded"&&t!==fe.Scalar.BLOCK_FOLDED&&(x.onOverflow=()=>{P=!0});let $=$e.foldFlowLines(`${v}${k}${m}`,c,$e.FOLD_BLOCK,x);if(!P)return`>${S}
|
|
30
|
+
${c}${$}`}return s=s.replace(/\n+/g,`$&${c}`),`|${S}
|
|
31
|
+
${c}${v}${s}${m}`}function Cd(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 st(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||d||!r.includes(`
|
|
33
|
+
`)?st(r,t):ks(e,t,s,i);if(!a&&!d&&n!==fe.Scalar.PLAIN&&r.includes(`
|
|
34
|
+
`))return ks(e,t,s,i);if($s(r)){if(l==="")return t.forceBlockIndent=!0,ks(e,t,s,i);if(a&&l===c)return st(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 st(r,t)}return a?f:$e.foldFlowLines(f,l,$e.FOLD_FLOW,Ss(t,!1))}function Ad(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!==fe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=fe.Scalar.QUOTE_DOUBLE);let l=d=>{switch(d){case fe.Scalar.BLOCK_FOLDED:case fe.Scalar.BLOCK_LITERAL:return n||r?st(o.value,t):ks(o,t,s,i);case fe.Scalar.QUOTE_DOUBLE:return Ct(o.value,t);case fe.Scalar.QUOTE_SINGLE:return en(o.value,t);case fe.Scalar.PLAIN:return Cd(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}fa.stringifyString=Ad});var Pt=C(sn=>{"use strict";var Pd=ms(),xe=q(),Nd=xt(),Id=At();function Ld(e,t){let s=Object.assign({blockQuote:!0,commentString:Nd.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 Rd(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(xe.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 Od(e,t,{anchors:s,doc:i}){if(!i.directives)return"";let n=[],r=(xe.isScalar(e)||xe.isCollection(e))&&e.anchor;r&&Pd.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 Td(e,t,s,i){if(xe.isPair(e))return e.toString(t,s,i);if(xe.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=xe.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>n=l});n??(n=Rd(t.doc.schema.tags,r));let o=Od(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):xe.isScalar(r)?Id.stringifyString(r,t,s,i):r.toString(t,s,i);return o?xe.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
36
|
+
${t.indent}${a}`:a}sn.createStringifyContext=Ld;sn.stringify=Td});var ha=C(ma=>{"use strict";var be=q(),da=V(),pa=Pt(),Nt=xt();function Md({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=be.isNode(e)&&e.comment||null;if(f){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(be.isCollection(e)||!be.isNode(e)&&typeof e=="object"){let x="With simple keys, collection cannot be used as a key value";throw new Error(x)}}let m=!f&&(!e||p&&t==null&&!s.inFlow||be.isCollection(e)||(be.isScalar(e)?e.type===da.Scalar.BLOCK_FOLDED||e.type===da.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=pa.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+=Nt.lineComment(g,s.indent,c(p)):h&&n&&n(),g;y&&(p=null),m?(p&&(g+=Nt.lineComment(g,s.indent,c(p))),g=`? ${g}
|
|
37
|
+
${a}:`):(g=`${g}:`,p&&(g+=Nt.lineComment(g,s.indent,c(p))));let b,v,w;be.isNode(t)?(b=!!t.spaceBefore,v=t.commentBefore,w=t.comment):(b=!1,v=null,w=null,t&&typeof t=="object"&&(t=o.createNode(t))),s.implicitKey=!1,!m&&!p&&be.isScalar(t)&&(s.indentAtStart=g.length+1),h=!1,!d&&l.length>=2&&!s.inFlow&&!m&&be.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(s.indent=s.indent.substring(2));let S=!1,k=pa.stringify(t,s,()=>S=!0,()=>h=!0),P=" ";if(p||b||v){if(P=b?`
|
|
38
|
+
`:"",v){let x=c(v);P+=`
|
|
39
|
+
${Nt.indentComment(x,s.indent)}`}k===""&&!s.inFlow?P===`
|
|
40
|
+
`&&w&&(P=`
|
|
41
|
+
|
|
42
|
+
`):P+=`
|
|
43
|
+
${s.indent}`}else if(!m&&be.isCollection(t)){let x=k[0],$=k.indexOf(`
|
|
44
|
+
`),T=$!==-1,L=s.inFlow??t.flow??t.items.length===0;if(T||!L){let F=!1;if(T&&(x==="&"||x==="!")){let D=k.indexOf(" ");x==="&"&&D!==-1&&D<$&&k[D+1]==="!"&&(D=k.indexOf(" ",D+1)),(D===-1||$<D)&&(F=!0)}F||(P=`
|
|
45
45
|
${s.indent}`)}}else(k===""||k[0]===`
|
|
46
|
-
`)&&(
|
|
47
|
-
${l}${
|
|
48
|
-
`}}return e?(
|
|
49
|
-
`+
|
|
50
|
-
`)),
|
|
51
|
-
${r}${n}${
|
|
52
|
-
`;return`${
|
|
53
|
-
${n}${
|
|
54
|
-
`:" ")}return
|
|
46
|
+
`)&&(P="");return g+=P+k,s.inFlow?S&&i&&i():w&&!S?g+=Nt.lineComment(g,s.indent,c(w)):h&&n&&n(),g}ma.stringifyPair=Md});var rn=C(nn=>{"use strict";var ga=ts("process");function Dd(e,...t){e==="debug"&&console.log(...t)}function _d(e,t){(e==="debug"||e==="warn")&&(typeof ga.emitWarning=="function"?ga.emitWarning(t):console.warn(t))}nn.debug=Dd;nn.warn=_d});var As=C(Cs=>{"use strict";var It=q(),ya=V(),xs="<<",Es={identify:e=>e===xs||typeof e=="symbol"&&e.description===xs,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ya.Scalar(Symbol(xs)),{addToJSMap:ba}),stringify:()=>xs},qd=(e,t)=>(Es.identify(t)||It.isScalar(t)&&(!t.type||t.type===ya.Scalar.PLAIN)&&Es.identify(t.value))&&e?.doc.schema.tags.some(s=>s.tag===Es.tag&&s.default);function ba(e,t,s){if(s=e&&It.isAlias(s)?s.resolve(e.doc):s,It.isSeq(s))for(let i of s.items)on(e,t,i);else if(Array.isArray(s))for(let i of s)on(e,t,i);else on(e,t,s)}function on(e,t,s){let i=e&&It.isAlias(s)?s.resolve(e.doc):s;if(!It.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}Cs.addMergeToJSMap=ba;Cs.isMergeKey=qd;Cs.merge=Es});var ln=C(ka=>{"use strict";var Fd=rn(),wa=As(),jd=Pt(),va=q(),an=ke();function Bd(e,t,{key:s,value:i}){if(va.isNode(s)&&s.addToJSMap)s.addToJSMap(e,t,i);else if(wa.isMergeKey(e,s))wa.addMergeToJSMap(e,t,i);else{let n=an.toJS(s,"",e);if(t instanceof Map)t.set(n,an.toJS(i,n,e));else if(t instanceof Set)t.add(n);else{let r=Ud(s,n,e),o=an.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 Ud(e,t,s){if(t===null)return"";if(typeof t!="object")return String(t);if(va.isNode(e)&&s?.doc){let i=jd.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)+'..."'),Fd.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)}ka.addPairToJSMap=Bd});var Ee=C(cn=>{"use strict";var Sa=$t(),Vd=ha(),Kd=ln(),Ps=q();function Jd(e,t,s){let i=Sa.createNode(e,void 0,s),n=Sa.createNode(t,void 0,s);return new Ns(i,n)}var Ns=class e{constructor(t,s=null){Object.defineProperty(this,Ps.NODE_TYPE,{value:Ps.PAIR}),this.key=t,this.value=s}clone(t){let{key:s,value:i}=this;return Ps.isNode(s)&&(s=s.clone(t)),Ps.isNode(i)&&(i=i.clone(t)),new e(s,i)}toJSON(t,s){let i=s?.mapAsMap?new Map:{};return Kd.addPairToJSMap(s,i,this)}toString(t,s,i){return t?.doc?Vd.stringifyPair(this,t,s,i):JSON.stringify(this)}};cn.Pair=Ns;cn.createPair=Jd});var un=C(xa=>{"use strict";var je=q(),$a=Pt(),Is=xt();function Hd(e,t,s){return(t.inFlow??e.flow?Yd:Gd)(e,t,s)}function Gd({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(je.isNode(h))!f&&h.spaceBefore&&p.push(""),Ls(s,p,h.commentBefore,f),h.comment&&(g=h.comment);else if(je.isPair(h)){let v=je.isNode(h.key)?h.key:null;v&&(!f&&v.spaceBefore&&p.push(""),Ls(s,p,v.commentBefore,f))}f=!1;let b=$a.stringify(h,d,()=>g=null,()=>f=!0);g&&(b+=Is.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
|
+
`+Is.indentComment(c(e),l),a&&a()):f&&o&&o(),m}function Yd({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(je.isNode(h))h.spaceBefore&&f.push(""),Ls(t,f,h.commentBefore,!1),h.comment&&(g=h.comment);else if(je.isPair(h)){let v=je.isNode(h.key)?h.key:null;v&&(v.spaceBefore&&f.push(""),Ls(t,f,v.commentBefore,!1),v.comment&&(c=!0));let w=je.isNode(h.value)?h.value:null;w?(w.comment&&(g=w.comment),w.commentBefore&&(c=!0)):h.value==null&&v?.comment&&(g=v.comment)}g&&(c=!0);let b=$a.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,w)=>v+w.length+2,2)+(b.length+2)>t.options.lineWidth)),c&&(b+=",")),g&&(b+=Is.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 Ls({indent:e,options:{commentString:t}},s,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let r=Is.indentComment(t(i),e);s.push(r.trimStart())}}xa.stringifyCollection=Hd});var Ae=C(dn=>{"use strict";var Wd=un(),zd=ln(),Qd=bs(),Ce=q(),Rs=Ee(),Xd=V();function Lt(e,t){let s=Ce.isScalar(t)?t.value:t;for(let i of e)if(Ce.isPair(i)&&(i.key===t||i.key===s||Ce.isScalar(i.key)&&i.key.value===s))return i}var fn=class extends Qd.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ce.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(Rs.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;Ce.isPair(t)?i=t:!t||typeof t!="object"||!("key"in t)?i=new Rs.Pair(t,t?.value):i=new Rs.Pair(t.key,t.value);let n=Lt(this.items,i.key),r=this.schema?.sortMapEntries;if(n){if(!s)throw new Error(`Key ${i.key} already set`);Ce.isScalar(n.value)&&Xd.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=Lt(this.items,t);return s?this.items.splice(this.items.indexOf(s),1).length>0:!1}get(t,s){let n=Lt(this.items,t)?.value;return(!s&&Ce.isScalar(n)?n.value:n)??void 0}has(t){return!!Lt(this.items,t)}set(t,s){this.add(new Rs.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)zd.addPairToJSMap(s,n,r);return n}toString(t,s,i){if(!t)return JSON.stringify(this);for(let n of this.items)if(!Ce.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})),Wd.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:i,onComment:s})}};dn.YAMLMap=fn;dn.findPair=Lt});var it=C(Ca=>{"use strict";var Zd=q(),Ea=Ae(),ep={collection:"map",default:!0,nodeClass:Ea.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)=>Ea.YAMLMap.from(e,t,s)};Ca.map=ep});var Pe=C(Aa=>{"use strict";var tp=$t(),sp=un(),ip=bs(),Ts=q(),np=V(),rp=ke(),pn=class extends ip.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Ts.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let s=Os(t);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(t,s){let i=Os(t);if(typeof i!="number")return;let n=this.items[i];return!s&&Ts.isScalar(n)?n.value:n}has(t){let s=Os(t);return typeof s=="number"&&s<this.items.length}set(t,s){let i=Os(t);if(typeof i!="number")throw new Error(`Expected a valid index, not ${t}.`);let n=this.items[i];Ts.isScalar(n)&&np.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(rp.toJS(r,String(n++),s));return i}toString(t,s,i){return t?sp.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(tp.createNode(a,void 0,i))}}return r}};function Os(e){let t=Ts.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Aa.YAMLSeq=pn});var nt=C(Na=>{"use strict";var op=q(),Pa=Pe(),ap={collection:"seq",default:!0,nodeClass:Pa.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return op.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,s)=>Pa.YAMLSeq.from(e,t,s)};Na.seq=ap});var Rt=C(Ia=>{"use strict";var lp=At(),cp={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),lp.stringifyString(e,t,s,i)}};Ia.string=cp});var Ms=C(Oa=>{"use strict";var La=V(),Ra={identify:e=>e==null,createNode:()=>new La.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new La.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Ra.test.test(e)?e:t.options.nullStr};Oa.nullTag=Ra});var mn=C(Ma=>{"use strict";var up=V(),Ta={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new up.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},s){if(e&&Ta.test.test(e)){let i=e[0]==="t"||e[0]==="T";if(t===i)return e}return t?s.options.trueStr:s.options.falseStr}};Ma.boolTag=Ta});var rt=C(Da=>{"use strict";function fp({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}Da.stringifyNumber=fp});var gn=C(Ds=>{"use strict";var dp=V(),hn=rt(),pp={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:hn.stringifyNumber},mp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():hn.stringifyNumber(e)}},hp={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 dp.Scalar(parseFloat(e)),s=e.indexOf(".");return s!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-s-1),t},stringify:hn.stringifyNumber};Ds.float=hp;Ds.floatExp=mp;Ds.floatNaN=pp});var bn=C(qs=>{"use strict";var _a=rt(),_s=e=>typeof e=="bigint"||Number.isInteger(e),yn=(e,t,s,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),s);function qa(e,t,s){let{value:i}=e;return _s(i)&&i>=0?s+i.toString(t):_a.stringifyNumber(e)}var gp={identify:e=>_s(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,s)=>yn(e,2,8,s),stringify:e=>qa(e,8,"0o")},yp={identify:_s,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,s)=>yn(e,0,10,s),stringify:_a.stringifyNumber},bp={identify:e=>_s(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,s)=>yn(e,2,16,s),stringify:e=>qa(e,16,"0x")};qs.int=yp;qs.intHex=bp;qs.intOct=gp});var ja=C(Fa=>{"use strict";var wp=it(),vp=Ms(),kp=nt(),Sp=Rt(),$p=mn(),wn=gn(),vn=bn(),xp=[wp.map,kp.seq,Sp.string,vp.nullTag,$p.boolTag,vn.intOct,vn.int,vn.intHex,wn.floatNaN,wn.floatExp,wn.float];Fa.schema=xp});var Va=C(Ua=>{"use strict";var Ep=V(),Cp=it(),Ap=nt();function Ba(e){return typeof e=="bigint"||Number.isInteger(e)}var Fs=({value:e})=>JSON.stringify(e),Pp=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Fs},{identify:e=>e==null,createNode:()=>new Ep.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Fs},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Fs},{identify:Ba,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})=>Ba(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:Fs}],Np={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Ip=[Cp.map,Ap.seq].concat(Pp,Np);Ua.schema=Ip});var Sn=C(Ka=>{"use strict";var Ot=ts("buffer"),kn=V(),Lp=At(),Rp={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Ot.Buffer=="function")return Ot.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 Ot.Buffer=="function")a=o instanceof Ot.Buffer?o.toString("base64"):Ot.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=kn.Scalar.BLOCK_LITERAL),t!==kn.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===kn.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return Lp.stringifyString({comment:e,type:t,value:a},i,n,r)}};Ka.binary=Rp});var Us=C(Bs=>{"use strict";var js=q(),$n=Ee(),Op=V(),Tp=Pe();function Ja(e,t){if(js.isSeq(e))for(let s=0;s<e.items.length;++s){let i=e.items[s];if(!js.isPair(i)){if(js.isMap(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");let n=i.items[0]||new $n.Pair(new Op.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore}
|
|
55
55
|
${n.key.commentBefore}`:i.commentBefore),i.comment){let r=n.value??n.key;r.comment=r.comment?`${i.comment}
|
|
56
|
-
${r.comment}`:i.comment}i=n}e.items[s]=_s.isPair(i)?i:new wn.Pair(i)}}else t("Expected a sequence for this tag");return e}function ja(e,t,s){let{replacer:i}=s,n=new Np.YAMLSeq(e);n.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof i=="function"&&(o=i.call(t,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;n.items.push(wn.createPair(a,l,s))}return n}var Ip={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Fa,createNode:ja};qs.createPairs=ja;qs.pairs=Ip;qs.resolvePairs=Fa});var Sn=A(kn=>{"use strict";var Ba=D(),vn=be(),Rt=xe(),Lp=Ce(),Ua=Fs(),je=class e extends Lp.YAMLSeq{constructor(){super(),this.add=Rt.YAMLMap.prototype.add.bind(this),this.delete=Rt.YAMLMap.prototype.delete.bind(this),this.get=Rt.YAMLMap.prototype.get.bind(this),this.has=Rt.YAMLMap.prototype.has.bind(this),this.set=Rt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,s){if(!s)return super.toJSON(t);let i=new Map;s?.onCreate&&s.onCreate(i);for(let n of this.items){let r,o;if(Ba.isPair(n)?(r=vn.toJS(n.key,"",s),o=vn.toJS(n.value,r,s)):r=vn.toJS(n,"",s),i.has(r))throw new Error("Ordered maps must not include duplicate keys");i.set(r,o)}return i}static from(t,s,i){let n=Ua.createPairs(t,s,i),r=new this;return r.items=n.items,r}};je.tag="tag:yaml.org,2002:omap";var Rp={collection:"seq",identify:e=>e instanceof Map,nodeClass:je,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let s=Ua.resolvePairs(e,t),i=[];for(let{key:n}of s.items)Ba.isScalar(n)&&(i.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new je,s)},createNode:(e,t,s)=>je.from(e,t,s)};kn.YAMLOMap=je;kn.omap=Rp});var Ya=A($n=>{"use strict";var Va=F();function Ka({value:e,source:t},s){return t&&(e?Ja:Ha).test.test(t)?t:e?s.options.trueStr:s.options.falseStr}var Ja={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Va.Scalar(!0),stringify:Ka},Ha={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Va.Scalar(!1),stringify:Ka};$n.falseTag=Ha;$n.trueTag=Ja});var Ga=A(js=>{"use strict";var Op=F(),xn=it(),Tp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:xn.stringifyNumber},Mp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():xn.stringifyNumber(e)}},Dp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Op.Scalar(parseFloat(e.replace(/_/g,""))),s=e.indexOf(".");if(s!==-1){let i=e.substring(s+1).replace(/_/g,"");i[i.length-1]==="0"&&(t.minFractionDigits=i.length)}return t},stringify:xn.stringifyNumber};js.float=Dp;js.floatExp=Mp;js.floatNaN=Tp});var za=A(Tt=>{"use strict";var Wa=it(),Ot=e=>typeof e=="bigint"||Number.isInteger(e);function Bs(e,t,s,{intAsBigInt:i}){let n=e[0];if((n==="-"||n==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(s){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return n==="-"?BigInt(-1)*o:o}let r=parseInt(e,s);return n==="-"?-1*r:r}function Cn(e,t,s){let{value:i}=e;if(Ot(i)){let n=i.toString(t);return i<0?"-"+s+n.substr(1):s+n}return Wa.stringifyNumber(e)}var _p={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,s)=>Bs(e,2,2,s),stringify:e=>Cn(e,2,"0b")},qp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,s)=>Bs(e,1,8,s),stringify:e=>Cn(e,8,"0")},Fp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,s)=>Bs(e,0,10,s),stringify:Wa.stringifyNumber},jp={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,s)=>Bs(e,2,16,s),stringify:e=>Cn(e,16,"0x")};Tt.int=Fp;Tt.intBin=_p;Tt.intHex=jp;Tt.intOct=qp});var An=A(En=>{"use strict";var Ks=D(),Us=Se(),Vs=xe(),Be=class e extends Vs.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let s;Ks.isPair(t)?s=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?s=new Us.Pair(t.key,null):s=new Us.Pair(t,null),Vs.findPair(this.items,s.key)||this.items.push(s)}get(t,s){let i=Vs.findPair(this.items,t);return!s&&Ks.isPair(i)?Ks.isScalar(i.key)?i.key.value:i.key:i}set(t,s){if(typeof s!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof s}`);let i=Vs.findPair(this.items,t);i&&!s?this.items.splice(this.items.indexOf(i),1):!i&&s&&this.items.push(new Us.Pair(t))}toJSON(t,s){return super.toJSON(t,s,Set)}toString(t,s,i){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),s,i);throw new Error("Set items must all have null values")}static from(t,s,i){let{replacer:n}=i,r=new this(t);if(s&&Symbol.iterator in Object(s))for(let o of s)typeof n=="function"&&(o=n.call(s,o,o)),r.items.push(Us.createPair(o,null,i));return r}};Be.tag="tag:yaml.org,2002:set";var Bp={collection:"map",identify:e=>e instanceof Set,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,s)=>Be.from(e,t,s),resolve(e,t){if(Ks.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Be,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};En.YAMLSet=Be;En.set=Bp});var Nn=A(Js=>{"use strict";var Up=it();function Pn(e,t){let s=e[0],i=s==="-"||s==="+"?e.substring(1):e,n=o=>t?BigInt(o):Number(o),r=i.replace(/_/g,"").split(":").reduce((o,a)=>o*n(60)+n(a),n(0));return s==="-"?n(-1)*r:r}function Qa(e){let{value:t}=e,s=o=>o;if(typeof t=="bigint")s=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Up.stringifyNumber(e);let i="";t<0&&(i="-",t*=s(-1));let n=s(60),r=[t%n];return t<60?r.unshift(0):(t=(t-r[0])/n,r.unshift(t%n),t>=60&&(t=(t-r[0])/n,r.unshift(t))),i+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Vp={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:s})=>Pn(e,s),stringify:Qa},Kp={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Pn(e,!1),stringify:Qa},Xa={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Xa.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,i,n,r,o,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(s,i-1,n,r||0,o||0,a||0,l),d=t[8];if(d&&d!=="Z"){let f=Pn(d,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Js.floatTime=Kp;Js.intTime=Vp;Js.timestamp=Xa});var tl=A(el=>{"use strict";var Jp=tt(),Hp=Rs(),Yp=st(),Gp=It(),Wp=bn(),Za=Ya(),In=Ga(),Hs=za(),zp=xs(),Qp=Sn(),Xp=Fs(),Zp=An(),Ln=Nn(),em=[Jp.map,Yp.seq,Gp.string,Hp.nullTag,Za.trueTag,Za.falseTag,Hs.intBin,Hs.intOct,Hs.int,Hs.intHex,In.floatNaN,In.floatExp,In.float,Wp.binary,zp.merge,Qp.omap,Xp.pairs,Zp.set,Ln.intTime,Ln.floatTime,Ln.timestamp];el.schema=em});var fl=A(Tn=>{"use strict";var rl=tt(),tm=Rs(),ol=st(),sm=It(),im=un(),Rn=dn(),On=mn(),nm=Ta(),rm=_a(),al=bn(),Mt=xs(),ll=Sn(),cl=Fs(),sl=tl(),ul=An(),Ys=Nn(),il=new Map([["core",nm.schema],["failsafe",[rl.map,ol.seq,sm.string]],["json",rm.schema],["yaml11",sl.schema],["yaml-1.1",sl.schema]]),nl={binary:al.binary,bool:im.boolTag,float:Rn.float,floatExp:Rn.floatExp,floatNaN:Rn.floatNaN,floatTime:Ys.floatTime,int:On.int,intHex:On.intHex,intOct:On.intOct,intTime:Ys.intTime,map:rl.map,merge:Mt.merge,null:tm.nullTag,omap:ll.omap,pairs:cl.pairs,seq:ol.seq,set:ul.set,timestamp:Ys.timestamp},om={"tag:yaml.org,2002:binary":al.binary,"tag:yaml.org,2002:merge":Mt.merge,"tag:yaml.org,2002:omap":ll.omap,"tag:yaml.org,2002:pairs":cl.pairs,"tag:yaml.org,2002:set":ul.set,"tag:yaml.org,2002:timestamp":Ys.timestamp};function am(e,t,s){let i=il.get(t);if(i&&!e)return s&&!i.includes(Mt.merge)?i.concat(Mt.merge):i.slice();let n=i;if(!n)if(Array.isArray(e))n=[];else{let r=Array.from(il.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)n=n.concat(r);else typeof e=="function"&&(n=e(n.slice()));return s&&(n=n.concat(Mt.merge)),n.reduce((r,o)=>{let a=typeof o=="string"?nl[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(nl).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}Tn.coreKnownTags=om;Tn.getTags=am});var _n=A(dl=>{"use strict";var Mn=D(),lm=tt(),cm=st(),um=It(),Gs=fl(),fm=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Dn=class e{constructor({compat:t,customTags:s,merge:i,resolveKnownTags:n,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?Gs.getTags(t,"compat"):t?Gs.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=n?Gs.coreKnownTags:{},this.tags=Gs.getTags(s,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,Mn.MAP,{value:lm.map}),Object.defineProperty(this,Mn.SCALAR,{value:um.string}),Object.defineProperty(this,Mn.SEQ,{value:cm.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?fm:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};dl.Schema=Dn});var ml=A(pl=>{"use strict";var dm=D(),qn=Et(),Dt=St();function pm(e,t){let s=[],i=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(s.push(l),i=!0):e.directives.docStart&&(i=!0)}i&&s.push("---");let n=qn.createStringifyContext(e,t),{commentString:r}=n.options;if(e.commentBefore){s.length!==1&&s.unshift("");let l=r(e.commentBefore);s.unshift(Dt.indentComment(l,""))}let o=!1,a=null;if(e.contents){if(dm.isNode(e.contents)){if(e.contents.spaceBefore&&i&&s.push(""),e.contents.commentBefore){let d=r(e.contents.commentBefore);s.push(Dt.indentComment(d,""))}n.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>o=!0,c=qn.stringify(e.contents,n,()=>a=null,l);a&&(c+=Dt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${c}`:s.push(c)}else s.push(qn.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let l=r(e.comment);l.includes(`
|
|
57
|
-
`)?(s.push("..."),s.push(
|
|
56
|
+
${r.comment}`:i.comment}i=n}e.items[s]=js.isPair(i)?i:new $n.Pair(i)}}else t("Expected a sequence for this tag");return e}function Ha(e,t,s){let{replacer:i}=s,n=new Tp.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($n.createPair(a,l,s))}return n}var Mp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ja,createNode:Ha};Bs.createPairs=Ha;Bs.pairs=Mp;Bs.resolvePairs=Ja});var Cn=C(En=>{"use strict";var Ga=q(),xn=ke(),Tt=Ae(),Dp=Pe(),Ya=Us(),Be=class e extends Dp.YAMLSeq{constructor(){super(),this.add=Tt.YAMLMap.prototype.add.bind(this),this.delete=Tt.YAMLMap.prototype.delete.bind(this),this.get=Tt.YAMLMap.prototype.get.bind(this),this.has=Tt.YAMLMap.prototype.has.bind(this),this.set=Tt.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(Ga.isPair(n)?(r=xn.toJS(n.key,"",s),o=xn.toJS(n.value,r,s)):r=xn.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=Ya.createPairs(t,s,i),r=new this;return r.items=n.items,r}};Be.tag="tag:yaml.org,2002:omap";var _p={collection:"seq",identify:e=>e instanceof Map,nodeClass:Be,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let s=Ya.resolvePairs(e,t),i=[];for(let{key:n}of s.items)Ga.isScalar(n)&&(i.includes(n.value)?t(`Ordered maps must not include duplicate keys: ${n.value}`):i.push(n.value));return Object.assign(new Be,s)},createNode:(e,t,s)=>Be.from(e,t,s)};En.YAMLOMap=Be;En.omap=_p});var Za=C(An=>{"use strict";var Wa=V();function za({value:e,source:t},s){return t&&(e?Qa:Xa).test.test(t)?t:e?s.options.trueStr:s.options.falseStr}var Qa={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 Wa.Scalar(!0),stringify:za},Xa={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 Wa.Scalar(!1),stringify:za};An.falseTag=Xa;An.trueTag=Qa});var el=C(Vs=>{"use strict";var qp=V(),Pn=rt(),Fp={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:Pn.stringifyNumber},jp={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():Pn.stringifyNumber(e)}},Bp={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 qp.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:Pn.stringifyNumber};Vs.float=Bp;Vs.floatExp=jp;Vs.floatNaN=Fp});var sl=C(Dt=>{"use strict";var tl=rt(),Mt=e=>typeof e=="bigint"||Number.isInteger(e);function Ks(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 Nn(e,t,s){let{value:i}=e;if(Mt(i)){let n=i.toString(t);return i<0?"-"+s+n.substr(1):s+n}return tl.stringifyNumber(e)}var Up={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,s)=>Ks(e,2,2,s),stringify:e=>Nn(e,2,"0b")},Vp={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,s)=>Ks(e,1,8,s),stringify:e=>Nn(e,8,"0")},Kp={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,s)=>Ks(e,0,10,s),stringify:tl.stringifyNumber},Jp={identify:Mt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,s)=>Ks(e,2,16,s),stringify:e=>Nn(e,16,"0x")};Dt.int=Kp;Dt.intBin=Up;Dt.intHex=Jp;Dt.intOct=Vp});var Ln=C(In=>{"use strict";var Gs=q(),Js=Ee(),Hs=Ae(),Ue=class e extends Hs.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let s;Gs.isPair(t)?s=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?s=new Js.Pair(t.key,null):s=new Js.Pair(t,null),Hs.findPair(this.items,s.key)||this.items.push(s)}get(t,s){let i=Hs.findPair(this.items,t);return!s&&Gs.isPair(i)?Gs.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=Hs.findPair(this.items,t);i&&!s?this.items.splice(this.items.indexOf(i),1):!i&&s&&this.items.push(new Js.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(Js.createPair(o,null,i));return r}};Ue.tag="tag:yaml.org,2002:set";var Hp={collection:"map",identify:e=>e instanceof Set,nodeClass:Ue,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,s)=>Ue.from(e,t,s),resolve(e,t){if(Gs.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ue,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};In.YAMLSet=Ue;In.set=Hp});var On=C(Ys=>{"use strict";var Gp=rt();function Rn(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 il(e){let{value:t}=e,s=o=>o;if(typeof t=="bigint")s=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Gp.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 Yp={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})=>Rn(e,s),stringify:il},Wp={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=>Rn(e,!1),stringify:il},nl={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(nl.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=Rn(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$/,"")??""};Ys.floatTime=Wp;Ys.intTime=Yp;Ys.timestamp=nl});var al=C(ol=>{"use strict";var zp=it(),Qp=Ms(),Xp=nt(),Zp=Rt(),em=Sn(),rl=Za(),Tn=el(),Ws=sl(),tm=As(),sm=Cn(),im=Us(),nm=Ln(),Mn=On(),rm=[zp.map,Xp.seq,Zp.string,Qp.nullTag,rl.trueTag,rl.falseTag,Ws.intBin,Ws.intOct,Ws.int,Ws.intHex,Tn.floatNaN,Tn.floatExp,Tn.float,em.binary,tm.merge,sm.omap,im.pairs,nm.set,Mn.intTime,Mn.floatTime,Mn.timestamp];ol.schema=rm});var yl=C(qn=>{"use strict";var fl=it(),om=Ms(),dl=nt(),am=Rt(),lm=mn(),Dn=gn(),_n=bn(),cm=ja(),um=Va(),pl=Sn(),_t=As(),ml=Cn(),hl=Us(),ll=al(),gl=Ln(),zs=On(),cl=new Map([["core",cm.schema],["failsafe",[fl.map,dl.seq,am.string]],["json",um.schema],["yaml11",ll.schema],["yaml-1.1",ll.schema]]),ul={binary:pl.binary,bool:lm.boolTag,float:Dn.float,floatExp:Dn.floatExp,floatNaN:Dn.floatNaN,floatTime:zs.floatTime,int:_n.int,intHex:_n.intHex,intOct:_n.intOct,intTime:zs.intTime,map:fl.map,merge:_t.merge,null:om.nullTag,omap:ml.omap,pairs:hl.pairs,seq:dl.seq,set:gl.set,timestamp:zs.timestamp},fm={"tag:yaml.org,2002:binary":pl.binary,"tag:yaml.org,2002:merge":_t.merge,"tag:yaml.org,2002:omap":ml.omap,"tag:yaml.org,2002:pairs":hl.pairs,"tag:yaml.org,2002:set":gl.set,"tag:yaml.org,2002:timestamp":zs.timestamp};function dm(e,t,s){let i=cl.get(t);if(i&&!e)return s&&!i.includes(_t.merge)?i.concat(_t.merge):i.slice();let n=i;if(!n)if(Array.isArray(e))n=[];else{let r=Array.from(cl.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(_t.merge)),n.reduce((r,o)=>{let a=typeof o=="string"?ul[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(ul).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},[])}qn.coreKnownTags=fm;qn.getTags=dm});var Bn=C(bl=>{"use strict";var Fn=q(),pm=it(),mm=nt(),hm=Rt(),Qs=yl(),gm=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,jn=class e{constructor({compat:t,customTags:s,merge:i,resolveKnownTags:n,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?Qs.getTags(t,"compat"):t?Qs.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=n?Qs.coreKnownTags:{},this.tags=Qs.getTags(s,this.name,i),this.toStringOptions=a??null,Object.defineProperty(this,Fn.MAP,{value:pm.map}),Object.defineProperty(this,Fn.SCALAR,{value:hm.string}),Object.defineProperty(this,Fn.SEQ,{value:mm.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?gm:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};bl.Schema=jn});var vl=C(wl=>{"use strict";var ym=q(),Un=Pt(),qt=xt();function bm(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=Un.createStringifyContext(e,t),{commentString:r}=n.options;if(e.commentBefore){s.length!==1&&s.unshift("");let l=r(e.commentBefore);s.unshift(qt.indentComment(l,""))}let o=!1,a=null;if(e.contents){if(ym.isNode(e.contents)){if(e.contents.spaceBefore&&i&&s.push(""),e.contents.commentBefore){let d=r(e.contents.commentBefore);s.push(qt.indentComment(d,""))}n.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>o=!0,c=Un.stringify(e.contents,n,()=>a=null,l);a&&(c+=qt.lineComment(c,"",r(a))),(c[0]==="|"||c[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${c}`:s.push(c)}else s.push(Un.stringify(e.contents,n));if(e.directives?.docEnd)if(e.comment){let l=r(e.comment);l.includes(`
|
|
57
|
+
`)?(s.push("..."),s.push(qt.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(qt.indentComment(r(l),"")))}return s.join(`
|
|
58
58
|
`)+`
|
|
59
|
-
`}
|
|
59
|
+
`}wl.stringifyDocument=bm});var Ft=C(kl=>{"use strict";var wm=St(),ot=bs(),ae=q(),vm=Ee(),km=ke(),Sm=Bn(),$m=vl(),Vn=ms(),xm=Hi(),Em=$t(),Kn=Ji(),Jn=class e{constructor(t,s,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ae.NODE_TYPE,{value:ae.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 Kn.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,{[ae.NODE_TYPE]:{value:ae.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=ae.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){at(this.contents)&&this.contents.add(t)}addIn(t,s){at(this.contents)&&this.contents.addIn(t,s)}createAlias(t,s){if(!t.anchor){let i=Vn.anchorNames(this);t.anchor=!s||i.has(s)?Vn.findNewAnchor(s||"a",i):s}return new wm.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}=Vn.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:m},h=Em.createNode(t,d,y);return a&&ae.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 vm.Pair(n,r)}delete(t){return at(this.contents)?this.contents.delete(t):!1}deleteIn(t){return ot.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):at(this.contents)?this.contents.deleteIn(t):!1}get(t,s){return ae.isCollection(this.contents)?this.contents.get(t,s):void 0}getIn(t,s){return ot.isEmptyPath(t)?!s&&ae.isScalar(this.contents)?this.contents.value:this.contents:ae.isCollection(this.contents)?this.contents.getIn(t,s):void 0}has(t){return ae.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return ot.isEmptyPath(t)?this.contents!==void 0:ae.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,s){this.contents==null?this.contents=ot.collectionFromPath(this.schema,[t],s):at(this.contents)&&this.contents.set(t,s)}setIn(t,s){ot.isEmptyPath(t)?this.contents=s:this.contents==null?this.contents=ot.collectionFromPath(this.schema,Array.from(t),s):at(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 Kn.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 Kn.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 Sm.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=km.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"?xm.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 $m.stringifyDocument(this,t)}};function at(e){if(ae.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}kl.Document=Jn});var Ut=C(Bt=>{"use strict";var jt=class extends Error{constructor(t,s,i,n){super(),this.name=t,this.code=i,this.message=n,this.pos=s}},Hn=class extends jt{constructor(t,s,i){super("YAMLParseError",t,s,i)}},Gn=class extends jt{constructor(t,s,i){super("YAMLWarning",t,s,i)}},Cm=(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
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
61
|
|
|
62
62
|
${o}
|
|
63
63
|
${c}
|
|
64
|
-
`}};
|
|
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(
|
|
66
|
-
`+
|
|
67
|
-
|
|
68
|
-
`+
|
|
69
|
-
`+
|
|
70
|
-
`+
|
|
71
|
-
`+
|
|
72
|
-
`.repeat(Math.max(1,o.length-1)):"",
|
|
73
|
-
`;for(let
|
|
74
|
-
`):
|
|
75
|
-
`:!
|
|
64
|
+
`}};Bt.YAMLError=jt;Bt.YAMLParseError=Hn;Bt.YAMLWarning=Gn;Bt.prettifyError=Cm});var Vt=C(Sl=>{"use strict";function Am(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,w=null,S=null,k=null;for(let $ of e)switch(y&&($.type!=="space"&&$.type!=="newline"&&$.type!=="comma"&&r($.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),h&&(c&&$.type!=="comment"&&$.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),$.type){case"space":!t&&(s!=="doc-start"||i?.type!=="flow-collection")&&$.source.includes(" ")&&(h=$),d=!0;break;case"comment":{d||r($,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let T=$.source.substring(1)||" ";f?f+=p+T:f=T,p="",c=!1;break}case"newline":c?f?f+=$.source:(!S||s!=="seq-item-ind")&&(l=!0):p+=$.source,c=!0,m=!0,(g||b)&&(v=$),d=!0;break;case"anchor":g&&r($,"MULTIPLE_ANCHORS","A node can have at most one anchor"),$.source.endsWith(":")&&r($.offset+$.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=$,k??(k=$.offset),c=!1,d=!1,y=!0;break;case"tag":{b&&r($,"MULTIPLE_TAGS","A node can have at most one tag"),b=$,k??(k=$.offset),c=!1,d=!1,y=!0;break}case s:(g||b)&&r($,"BAD_PROP_ORDER",`Anchors and tags must be after the ${$.source} indicator`),S&&r($,"UNEXPECTED_TOKEN",`Unexpected ${$.source} in ${t??"collection"}`),S=$,c=s==="seq-item-ind"||s==="explicit-key-ind",d=!1;break;case"comma":if(t){w&&r($,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),w=$,c=!1,d=!1;break}default:r($,"UNEXPECTED_TOKEN",`Unexpected ${$.type} token`),c=!1,d=!1}let P=e[e.length-1],x=P?P.offset+P.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:w,found:S,spaceBefore:l,comment:f,hasNewline:m,anchor:g,tag:b,newlineAfterProp:v,end:x,start:k??x}}Sl.resolveProps=Am});var Xs=C($l=>{"use strict";function Yn(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(Yn(t.key)||Yn(t.value))return!0}return!1;default:return!0}}$l.containsNewline=Yn});var Wn=C(xl=>{"use strict";var Pm=Xs();function Nm(e,t,s){if(t?.type==="flow-collection"){let i=t.end[0];i.indent===e&&(i.source==="]"||i.source==="}")&&Pm.containsNewline(t)&&s(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}xl.flowIndentCheck=Nm});var zn=C(Cl=>{"use strict";var El=q();function Im(e,t,s){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let n=typeof i=="function"?i:(r,o)=>r===o||El.isScalar(r)&&El.isScalar(o)&&r.value===o.value;return t.some(r=>n(r.key,s))}Cl.mapIncludes=Im});var Rl=C(Ll=>{"use strict";var Al=Ee(),Lm=Ae(),Pl=Vt(),Rm=Xs(),Nl=Wn(),Om=zn(),Il="All mapping items must start at the same column";function Tm({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=r?.nodeClass??Lm.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=Pl.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",Il)),!h.anchor&&!h.tag&&!m){c=h.end,h.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Rm.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",Il);s.atKey=!0;let b=h.end,v=p?e(s,p,h,n):t(s,b,f,null,h,n);s.schema.compat&&Nl.flowIndentCheck(i.indent,p,n),s.atKey=!1,Om.mapIncludes(s,a.items,v)&&n(b,"DUPLICATE_KEY","Map keys must be unique");let w=Pl.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=w.end,w.found){g&&(y?.type==="block-map"&&!w.hasNewline&&n(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&h.start<w.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 S=y?e(s,y,w,n):t(s,l,m,null,w,n);s.schema.compat&&Nl.flowIndentCheck(i.indent,y,n),l=S.range[2];let k=new Al.Pair(v,S);s.options.keepSourceTokens&&(k.srcToken=d),a.items.push(k)}else{g&&n(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),w.comment&&(v.comment?v.comment+=`
|
|
67
|
+
`+w.comment:v.comment=w.comment);let S=new Al.Pair(v);s.options.keepSourceTokens&&(S.srcToken=d),a.items.push(S)}}return c&&c<l&&n(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,l,c??l],a}Ll.resolveBlockMap=Tm});var Tl=C(Ol=>{"use strict";var Mm=Pe(),Dm=Vt(),_m=Wn();function qm({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=r?.nodeClass??Mm.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=Dm.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&&_m.flowIndentCheck(i.indent,f,n),l=m.range[2],a.items.push(m)}return a.range=[i.offset,l,c??l],a}Ol.resolveBlockSeq=qm});var lt=C(Ml=>{"use strict";function Fm(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}}Ml.resolveEnd=Fm});var Fl=C(ql=>{"use strict";var jm=q(),Bm=Ee(),Dl=Ae(),Um=Pe(),Vm=lt(),_l=Vt(),Km=Xs(),Jm=zn(),Qn="Block collections are not allowed within flow collections",Xn=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Hm({composeNode:e,composeEmptyNode:t},s,i,n,r){let o=i.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?Dl.YAMLMap:Um.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:w,sep:S,value:k}=b,P=_l.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:w??S?.[0],offset:f,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!S&&!k){g===0&&P.comma?n(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<i.items.length-1&&n(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),P.comment&&(c.comment?c.comment+=`
|
|
68
|
+
`+P.comment:c.comment=P.comment),f=P.end;continue}!o&&s.options.strict&&Km.containsNewline(w)&&n(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)P.comma&&n(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(P.comma||n(P.start,"MISSING_CHAR",`Missing , between ${a} items`),P.comment){let x="";e:for(let $ of v)switch($.type){case"comma":case"space":break;case"comment":x=$.source.substring(1);break e;default:break e}if(x){let $=c.items[c.items.length-1];jm.isPair($)&&($=$.value??$.key),$.comment?$.comment+=`
|
|
69
|
+
`+x:$.comment=x,P.comment=P.comment.substring(x.length+1)}}if(!o&&!S&&!P.found){let x=k?e(s,k,P,n):t(s,P.end,S,null,P,n);c.items.push(x),f=x.range[2],Xn(k)&&n(x.range,"BLOCK_IN_FLOW",Qn)}else{s.atKey=!0;let x=P.end,$=w?e(s,w,P,n):t(s,x,v,null,P,n);Xn(w)&&n($.range,"BLOCK_IN_FLOW",Qn),s.atKey=!1;let T=_l.resolveProps(S??[],{flow:a,indicator:"map-value-ind",next:k,offset:$.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(T.found){if(!o&&!P.found&&s.options.strict){if(S)for(let D of S){if(D===T.found)break;if(D.type==="newline"){n(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<T.found.offset-1024&&n(T.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source?.[0]===":"?n(k,"MISSING_CHAR",`Missing space after : in ${a}`):n(T.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let L=k?e(s,k,T,n):T.found?t(s,T.end,S,null,T,n):null;L?Xn(k)&&n(L.range,"BLOCK_IN_FLOW",Qn):T.comment&&($.comment?$.comment+=`
|
|
70
|
+
`+T.comment:$.comment=T.comment);let F=new Bm.Pair($,L);if(s.options.keepSourceTokens&&(F.srcToken=b),o){let D=c;Jm.mapIncludes(s,D.items,$)&&n(x,"DUPLICATE_KEY","Map keys must be unique"),D.items.push(F)}else{let D=new Dl.YAMLMap(s.schema);D.flow=!0,D.items.push(F);let N=(L??$).range;D.range=[$.range[0],N[1],N[2]],c.items.push(D)}f=L?L.range[2]:T.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=Vm.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}ql.resolveFlowCollection=Hm});var Bl=C(jl=>{"use strict";var Gm=q(),Ym=V(),Wm=Ae(),zm=Pe(),Qm=Rl(),Xm=Tl(),Zm=Fl();function Zn(e,t,s,i,n,r){let o=s.type==="block-map"?Qm.resolveBlockMap(e,t,s,i,r):s.type==="block-seq"?Xm.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 eh(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===Wm.YAMLMap.tagName&&a==="map"||o===zm.YAMLSeq.tagName&&a==="seq")return Zn(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),Zn(e,t,s,n,o)}let c=Zn(e,t,s,n,o,l),d=l.resolve?.(c,p=>n(r,"TAG_RESOLVE_FAILED",p),t.options)??c,f=Gm.isNode(d)?d:new Ym.Scalar(d);return f.range=c.range,f.tag=o,l?.format&&(f.format=l.format),f}jl.composeCollection=eh});var tr=C(Ul=>{"use strict";var er=V();function th(e,t,s){let i=t.offset,n=sh(t,e.options.strict,s);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let r=n.mode===">"?er.Scalar.BLOCK_FOLDED:er.Scalar.BLOCK_LITERAL,o=t.source?ih(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 S=`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",S),g=""}r===er.Scalar.BLOCK_LITERAL?(f+=p+g.slice(l)+b,p=`
|
|
74
|
+
`):g.length>l||b[0]===" "?(p===" "?p=`
|
|
75
|
+
`:!m&&p===`
|
|
76
76
|
`&&(p=`
|
|
77
77
|
|
|
78
|
-
`),f+=p+
|
|
79
|
-
`,
|
|
78
|
+
`),f+=p+g.slice(l)+b,p=`
|
|
79
|
+
`,m=!0):b===""?p===`
|
|
80
80
|
`?f+=`
|
|
81
81
|
`:p=`
|
|
82
|
-
`:(f+=p+b,p=" ",
|
|
83
|
-
`+o[
|
|
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
84
|
`&&(f+=`
|
|
85
85
|
`);break;default:f+=`
|
|
86
|
-
`}let
|
|
86
|
+
`}let y=i+n.length+t.source.length;return{value:f,type:r,comment:n.comment,range:[i,y,y]}}function sh({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 ih(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}Ul.resolveBlockScalar=th});var ir=C(Kl=>{"use strict";var sr=V(),nh=lt();function rh(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=sr.Scalar.PLAIN,l=oh(r,c);break;case"single-quoted-scalar":a=sr.Scalar.QUOTE_SINGLE,l=ah(r,c);break;case"double-quoted-scalar":a=sr.Scalar.QUOTE_DOUBLE,l=lh(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=nh.resolveEnd(o,d,t,s);return{value:l,type:a,comment:f.comment,range:[i,d,f.offset]}}function oh(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}`),Vl(e)}function ah(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Vl(e.slice(1,-1)).replace(/''/g,"'")}function Vl(e){let t,s;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
87
87
|
`,"sy"),s=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
88
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
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
|
|
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 lh(e,t){let s="";for(let i=1;i<e.length-1;++i){let n=e[i];if(!(n==="\r"&&e[i+1]===`
|
|
91
91
|
`))if(n===`
|
|
92
|
-
`){let{fold:r,offset:o}=
|
|
92
|
+
`){let{fold:r,offset:o}=ch(e,i);s+=r,i=o}else if(n==="\\"){let r=e[++i],o=uh[r];if(o)s+=o;else if(r===`
|
|
93
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+=
|
|
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+=fh(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
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
|
|
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 ch(e,t){let s="",i=e[t+1];for(;(i===" "||i===" "||i===`
|
|
97
97
|
`||i==="\r")&&!(i==="\r"&&e[t+2]!==`
|
|
98
98
|
`);)i===`
|
|
99
99
|
`&&(s+=`
|
|
100
|
-
`),t+=1,i=e[t+1];return s||(s=" "),{fold:s,offset:t}}var
|
|
101
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
100
|
+
`),t+=1,i=e[t+1];return s||(s=" "),{fold:s,offset:t}}var uh={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 fh(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)}Kl.resolveFlowScalar=rh});var Gl=C(Hl=>{"use strict";var Ve=q(),Jl=V(),dh=tr(),ph=ir();function mh(e,t,s,i){let{value:n,type:r,comment:o,range:a}=t.type==="block-scalar"?dh.resolveBlockScalar(e,t,i):ph.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[Ve.SCALAR]:l?c=hh(e.schema,n,l,s,i):t.type==="scalar"?c=gh(e,n,t,i):c=e.schema[Ve.SCALAR];let d;try{let f=c.resolve(n,p=>i(s??t,"TAG_RESOLVE_FAILED",p),e.options);d=Ve.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 hh(e,t,s,i,n){if(s==="!")return e[Ve.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[Ve.SCALAR])}function gh({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[Ve.SCALAR];if(s.compat){let a=s.compat.find(l=>l.default&&l.test?.test(i))??s[Ve.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}Hl.composeScalar=mh});var Wl=C(Yl=>{"use strict";function yh(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}Yl.emptyScalarPosition=yh});var Xl=C(rr=>{"use strict";var bh=St(),wh=q(),vh=Bl(),zl=Gl(),kh=lt(),Sh=Wl(),$h={composeNode:Ql,composeEmptyNode:nr};function Ql(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=xh(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=zl.composeScalar(e,t,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=vh.composeCollection($h,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=nr(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&&(!wh.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 nr(e,t,s,i,{spaceBefore:n,comment:r,anchor:o,tag:a,end:l},c){let d={type:"scalar",offset:Sh.emptyScalarPosition(t,s,i),indent:-1,source:""},f=zl.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 xh({options:e},{offset:t,source:s,end:i},n){let r=new bh.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=kh.resolveEnd(i,o,e.strict,n);return r.range=[t,o,a.offset],a.comment&&(r.comment=a.comment),r}rr.composeEmptyNode=nr;rr.composeNode=Ql});var tc=C(ec=>{"use strict";var Eh=Ft(),Zl=Xl(),Ch=lt(),Ah=Vt();function Ph(e,t,{offset:s,start:i,value:n,end:r},o){let a=Object.assign({_directives:t},e),l=new Eh.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},d=Ah.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?Zl.composeNode(c,n,d,o):Zl.composeEmptyNode(c,d.end,i,null,d,o);let f=l.contents.range[2],p=Ch.resolveEnd(r,f,!1,o);return p.comment&&(l.comment=p.comment),l.range=[s,f,p.offset],l}ec.composeDoc=Ph});var ar=C(nc=>{"use strict";var Nh=ts("process"),Ih=Ji(),Lh=Ft(),Kt=Ut(),sc=q(),Rh=tc(),Oh=lt();function Jt(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 ic(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?`
|
|
102
102
|
|
|
103
103
|
`:`
|
|
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
|
|
105
|
-
${i}`:i;else if(n||t.directives.docStart||!r)t.commentBefore=i;else if(
|
|
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 or=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(s,i,n,r)=>{let o=Jt(s);r?this.warnings.push(new Kt.YAMLWarning(o,i,n)):this.errors.push(new Kt.YAMLParseError(o,i,n))},this.directives=new Ih.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,s){let{comment:i,afterEmptyLine:n}=ic(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(sc.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];sc.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i}
|
|
106
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:
|
|
108
|
-
${s.comment}`:s.comment}this.doc.range[2]=s.offset;break}default:this.errors.push(new
|
|
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:ic(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(Nh.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(s,i,n)=>{let r=Jt(t);r[0]+=s,this.onError(r,"BAD_DIRECTIVE",i,n)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let s=Rh.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 Kt.YAMLParseError(Jt(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 Kt.YAMLParseError(Jt(t),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let s=Oh.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 Kt.YAMLParseError(Jt(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 Lh.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}}};nc.Composer=or});var ac=C(Zs=>{"use strict";var Th=tr(),Mh=ir(),Dh=Ut(),rc=At();function _h(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 Dh.YAMLParseError([a,a+1],r,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Mh.resolveFlowScalar(e,t,i);case"block-scalar":return Th.resolveBlockScalar({options:{strict:t}},e,i)}}return null}function qh(e,t){let{implicitKey:s=!1,indent:i,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=t,a=rc.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
109
|
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
110
110
|
`),d=a.substring(0,c),f=a.substring(c+1)+`
|
|
111
|
-
`,p=[{type:"block-scalar-header",offset:r,indent:i,source:d}];return
|
|
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
|
|
111
|
+
`,p=[{type:"block-scalar-header",offset:r,indent:i,source:d}];return oc(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 Fh(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=rc.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">":jh(e,l);break;case'"':lr(e,l,"double-quoted-scalar");break;case"'":lr(e,l,"single-quoted-scalar");break;default:lr(e,l,"scalar")}}function jh(e,t){let s=t.indexOf(`
|
|
113
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}];
|
|
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
|
|
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})}}}
|
|
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}];oc(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 oc(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 lr(e,t,s){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=s,e.source=t;break;case"block-scalar":{let i=e.props.slice(1),n=t.length;e.props[0].type==="block-scalar-header"&&(n-=e.props[0].source.length);for(let r of i)r.offset+=n;delete e.props,Object.assign(e,{type:s,source:t,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
116
|
+
`};delete e.items,Object.assign(e,{type:s,source:t,end:[n]});break}default:{let i="indent"in e?e.indent:-1,n="end"in e&&Array.isArray(e.end)?e.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(e))r!=="type"&&r!=="offset"&&delete e[r];Object.assign(e,{type:s,indent:i,source:t,end:n})}}}Zs.createScalarToken=qh;Zs.resolveAsScalar=_h;Zs.setScalarValue=Fh});var cc=C(lc=>{"use strict";var Bh=e=>"type"in e?ti(e):ei(e);function ti(e){switch(e.type){case"block-scalar":{let t="";for(let s of e.props)t+=ti(s);return t+e.source}case"block-map":case"block-seq":{let t="";for(let s of e.items)t+=ei(s);return t}case"flow-collection":{let t=e.start.source;for(let s of e.items)t+=ei(s);for(let s of e.end)t+=s.source;return t}case"document":{let t=ei(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 ei({start:e,key:t,sep:s,value:i}){let n="";for(let r of e)n+=r.source;if(t&&(n+=ti(t)),s)for(let r of s)n+=r.source;return i&&(n+=ti(i)),n}lc.stringify=Bh});var pc=C(dc=>{"use strict";var cr=Symbol("break visit"),Uh=Symbol("skip children"),uc=Symbol("remove item");function Ke(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),fc(Object.freeze([]),e,t)}Ke.BREAK=cr;Ke.SKIP=Uh;Ke.REMOVE=uc;Ke.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};Ke.parentCollection=(e,t)=>{let s=Ke.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 fc(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=fc(Object.freeze(e.concat([[n,o]])),r.items[o],s);if(typeof a=="number")o=a-1;else{if(a===cr)return cr;a===uc&&(r.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(t,e))}}return typeof i=="function"?i(t,e):i}dc.visit=Ke});var si=C(se=>{"use strict";var ur=ac(),Vh=cc(),Kh=pc(),fr="\uFEFF",dr="",pr="",mr="",Jh=e=>!!e&&"items"in e,Hh=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function Gh(e){switch(e){case fr:return"<BOM>";case dr:return"<DOC>";case pr:return"<FLOW_END>";case mr:return"<SCALAR>";default:return JSON.stringify(e)}}function Yh(e){switch(e){case fr:return"byte-order-mark";case dr:return"doc-mode";case pr:return"flow-error-end";case mr:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
117
117
|
`:case`\r
|
|
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}
|
|
119
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
120
|
-
\r `),
|
|
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}se.createScalarToken=ur.createScalarToken;se.resolveAsScalar=ur.resolveAsScalar;se.setScalarValue=ur.setScalarValue;se.stringify=Vh.stringify;se.visit=Kh.visit;se.BOM=fr;se.DOCUMENT=dr;se.FLOW_END=pr;se.SCALAR=mr;se.isCollection=Jh;se.isScalar=Hh;se.prettyToken=Gh;se.tokenType=Yh});var yr=C(hc=>{"use strict";var Ht=si();function de(e){switch(e){case void 0:case" ":case`
|
|
119
|
+
`:case"\r":case" ":return!0;default:return!1}}var mc=new Set("0123456789ABCDEFabcdef"),Wh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ii=new Set(",[]{}"),zh=new Set(` ,[]{}
|
|
120
|
+
\r `),hr=e=>!e||zh.has(e),gr=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
121
|
`?!0:s==="\r"?this.buffer[t+1]===`
|
|
122
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
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==="...")&&
|
|
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]===
|
|
124
|
+
`||i>=this.indentNext||!s&&!this.atEnd?t+i:-1}if(s==="-"||s==="."){let i=this.buffer.substr(t,3);if((i==="---"||i==="...")&&de(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]===Ht.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 Ht.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==="...")&&de(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&&!de(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===":")&&de(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(hr),"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("..."))&&de(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield Ht.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(hr),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||de(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
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=>
|
|
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=>de(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
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
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
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
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
|
|
132
|
+
`&&r>=this.pos&&r+1+s>a)t=r;else break}while(!0);return yield Ht.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(de(r)||t&&ii.has(r))break;s=i}else if(de(n)){let r=this.buffer[i+1];if(n==="\r"&&(r===`
|
|
133
133
|
`?(i+=1,n=`
|
|
134
|
-
`,r=this.buffer[i+1]):s=i),r==="#"||t&&
|
|
135
|
-
`){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(t&&
|
|
134
|
+
`,r=this.buffer[i+1]):s=i),r==="#"||t&&ii.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&&ii.has(n))break;s=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield Ht.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(hr))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let t=this.flowLevel>0,s=this.charAt(1);if(de(s)||t&&ii.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(;!de(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(Wh.has(s))s=this.buffer[++t];else if(s==="%"&&mc.has(this.buffer[t+1])&&mc.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
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)}};
|
|
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)}};hc.Lexer=gr});var wr=C(gc=>{"use strict";var br=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}}}};gc.LineCounter=br});var kr=C(kc=>{"use strict";var Qh=ts("process"),yc=si(),Xh=yr();function Ne(e,t){for(let s=0;s<e.length;++s)if(e[s].type===t)return!0;return!1}function bc(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 vc(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 ni(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 ct(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 wc(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!Ne(t.start,"explicit-key-ind")&&!Ne(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,vc(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 vr=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 Xh.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,Qh.env.LOG_TOKENS&&console.log("|",yc.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let s=yc.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"&&wc(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&&bc(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":{bc(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=ni(this.peek(2)),i=ct(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
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(
|
|
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(Ne(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(vc(s.key)&&!Ne(s.sep,"newline")){let o=ct(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(Ne(s.start,"newline"))Object.assign(s,{key:null,sep:[this.sourceToken]});else{let o=ct(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]}):Ne(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&&!Ne(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||Ne(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=ni(i),r=ct(n);wc(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
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=
|
|
142
|
-
`).length})}catch{}}}catch{continue}}}return await s(e,""),t}var
|
|
143
|
-
`;n.write(f),a=d}return l(),new Promise(c=>{let d="",f=null;function p(){r.removeListener("data",
|
|
144
|
-
`){i.searchActive=!1,l();return}if(
|
|
145
|
-
`:
|
|
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=ni(t),i=ct(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=ni(t),i=ct(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())}}};kc.Parser=vr});var Cc=C(Yt=>{"use strict";var Sc=ar(),Zh=Ft(),Gt=Ut(),eg=rn(),tg=q(),sg=wr(),$c=kr();function xc(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new sg.LineCounter||null,prettyErrors:t}}function ig(e,t={}){let{lineCounter:s,prettyErrors:i}=xc(t),n=new $c.Parser(s?.addNewLine),r=new Sc.Composer(t),o=Array.from(r.compose(n.parse(e)));if(i&&s)for(let a of o)a.errors.forEach(Gt.prettifyError(e,s)),a.warnings.forEach(Gt.prettifyError(e,s));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Ec(e,t={}){let{lineCounter:s,prettyErrors:i}=xc(t),n=new $c.Parser(s?.addNewLine),r=new Sc.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 Gt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&s&&(o.errors.forEach(Gt.prettifyError(e,s)),o.warnings.forEach(Gt.prettifyError(e,s))),o}function ng(e,t,s){let i;typeof t=="function"?i=t:s===void 0&&t&&typeof t=="object"&&(s=t);let n=Ec(e,s);if(!n)return null;if(n.warnings.forEach(r=>eg.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 rg(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 tg.isDocument(e)&&!i?e.toString(s):new Zh.Document(e,i,s).toString(s)}Yt.parse=ng;Yt.parseAllDocuments=ig;Yt.parseDocument=Ec;Yt.stringify=rg});var $r=C(j=>{"use strict";var og=ar(),ag=Ft(),lg=Bn(),Sr=Ut(),cg=St(),Ie=q(),ug=Ee(),fg=V(),dg=Ae(),pg=Pe(),mg=si(),hg=yr(),gg=wr(),yg=kr(),ri=Cc(),Ac=bt();j.Composer=og.Composer;j.Document=ag.Document;j.Schema=lg.Schema;j.YAMLError=Sr.YAMLError;j.YAMLParseError=Sr.YAMLParseError;j.YAMLWarning=Sr.YAMLWarning;j.Alias=cg.Alias;j.isAlias=Ie.isAlias;j.isCollection=Ie.isCollection;j.isDocument=Ie.isDocument;j.isMap=Ie.isMap;j.isNode=Ie.isNode;j.isPair=Ie.isPair;j.isScalar=Ie.isScalar;j.isSeq=Ie.isSeq;j.Pair=ug.Pair;j.Scalar=fg.Scalar;j.YAMLMap=dg.YAMLMap;j.YAMLSeq=pg.YAMLSeq;j.CST=mg;j.Lexer=hg.Lexer;j.LineCounter=gg.LineCounter;j.Parser=yg.Parser;j.parse=ri.parse;j.parseAllDocuments=ri.parseAllDocuments;j.parseDocument=ri.parseDocument;j.stringify=ri.stringify;j.visit=Ac.visit;j.visitAsync=Ac.visitAsync});import{execFile as Pf}from"child_process";import{promisify as Nf}from"util";import{mkdtemp as Po,readdir as If,readFile as Fi,rm as os,cp as Lf,access as _i,stat as Ro,lstat as Rf,symlink as Of,mkdir as Tf}from"fs/promises";import{join as ge,resolve as qi,relative as Mf,basename as Df}from"path";import{homedir as No}from"os";import{tmpdir as Io}from"os";import{readdir as kf,readFile as Sf,stat as $f}from"fs/promises";import{join as xf}from"path";var Ef=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"]),Cf=512*1024;async function ns(e){let t=[];async function s(i,n){let r;try{r=await kf(i)}catch{return}for(let o of r){if(o===".git"||o==="node_modules")continue;let a=xf(i,o),l=n?`${n}/${o}`:o;try{let c=await $f(a);if(c.isDirectory())await s(a,l);else if(c.isFile()){let d=o.includes(".")?`.${o.split(".").pop().toLowerCase()}`:"";if(Ef.has(d)||c.size>Cf)continue;try{let f=await Sf(a,"utf-8");t.push({relPath:l,content:f,lineCount:f.split(`
|
|
142
|
+
`).length})}catch{}}}catch{continue}}}return await s(e,""),t}var Mi=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 Af(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),w=m.label.length;if(m.hint){let S=s-b-w-2;if(S>10){let k=Ti(m.hint,S);i.push(`${g}${v} ${u.dim(k)}`)}else{let k=Ti(m.label,s-b);i.push(`${g}${u.bold(k)}`)}}else{let S=Ti(m.label,s-b);i.push(`${g}${u.bold(S)}`)}}}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 Ti(e,t){return t<=0?"":e.length<=t?e:t<=3?e.slice(0,t):e.slice(0,t-3)+"..."}async function Qe(e){let{items:t}=e,s=e.pageSize??Math.min(t.length+1,15),i=new Mi(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=Af(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),w=d.slice(3);d="",y(v),w&&h(w);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 w=g.slice(b);if(w.length>=3&&w[1]==="[")y(w.slice(0,3)),b+=2;else if(w.length>=2){d=w,f=setTimeout(()=>{let S=d;d="",y("\x1B");for(let k=1;k<S.length;k++)y(S[k])},50);return}else{d="\x1B",f=setTimeout(()=>{d="",y("\x1B")},50);return}}else y(v)}}r.on("data",h)})}var Oe=Nf(Pf),_f=/^[a-zA-Z0-9_-]+$/,qf=/^[a-zA-Z0-9._-]+$/,Ff=/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/,Lo=128,jf=/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\/tree\/(.+))?\/?$/;function ji(e){return e.startsWith("/")||e.startsWith("./")||e.startsWith(".\\")||e.startsWith("../")||e.startsWith("..\\")||e.startsWith("~/")||e.startsWith("~\\")||e==="~"||e==="."||e===".."||/^[a-zA-Z]:[/\\]/.test(e)}async function Oo(e){if(!e.includes("/")&&!e.includes("\\"))return!1;try{return(await Ro(qi(e))).isDirectory()}catch{return!1}}function Bf(e){let t;e==="~"?t=No():e.startsWith("~/")||e.startsWith("~\\")?t=qi(No(),e.slice(2)):t=qi(e);let s=Df(t);return I(`install: parsed local source -> path=${t}`),{owner:"local",repo:s,ref:null,subpath:null,cloneUrl:"",sshCloneUrl:"",isLocal:!0,localPath:t}}function Te(e){if(ji(e))return Bf(e);let t=jf.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}"
|
|
146
146
|
Supported formats:
|
|
147
147
|
github:owner/repo[#ref]
|
|
148
148
|
github:owner/repo#ref:path
|
|
149
149
|
https://github.com/owner/repo
|
|
150
150
|
https://github.com/owner/repo/tree/branch/path/to/skill
|
|
151
151
|
/path/to/local/skill
|
|
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(!
|
|
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
|
|
154
|
-
HTTPS: ${
|
|
155
|
-
SSH: ${
|
|
156
|
-
`);for(let o=0;o<r.length;o++)for(let{category:a,pattern:l}of
|
|
157
|
-
Use --force to overwrite.`)}catch(s){if(s.message?.includes("--force"))throw s;
|
|
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
|
|
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(!_f.test(l))throw new Error(`Invalid source: owner contains invalid characters: "${l}". Allowed: [a-zA-Z0-9_-]`);if(!qf.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 I(`install: parsed source -> owner=${l} repo=${c} ref=${r} subpath=${o}`),d}async function as(e){if(e.subpath!==null||!e.ref||!e.ref.includes("/"))return e;try{let{stdout:t}=await Oe("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 I(`install: resolved ref="${r}" subpath="${o}"`),{...e,ref:r,subpath:o||null}}}}catch(t){I(`install: ls-remote failed, treating entire ref as branch: ${t}`)}return e}function Me(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>Lo)throw new Error(`Invalid skill name: exceeds maximum length of ${Lo} characters`);if(!Ff.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 Uf(e){let t=e.split(/[/\\]/).filter(Boolean),s=t.length>0?t[t.length-1]:e;return Me(s)}function To(e){let t=new Map;for(let s of e){let i=Uf(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 De(){try{await Oe("git",["--version"]),I("install: git available")}catch{throw new Error("git is required for installing skills. Install git from https://git-scm.com")}}function Vf(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 rs(e){return e.killed?"Clone timed out after 60 seconds":`Clone failed: ${e.stderr||e.message}`}async function Di(e,t,s){if(t!==null&&/^[0-9a-f]{40}$/i.test(t))return await Oe("git",["clone","--no-checkout",e,s],{timeout:6e4}),await Oe("git",["checkout",t],{cwd:s,timeout:3e4}),s;let n=["clone","--depth","1"];return t&&n.push("--branch",t),n.push(e,s),await Oe("git",n,{timeout:6e4}),s}async function _e(e,t="auto"){I(`install: cloning ${e.owner}/${e.repo}${e.ref?` (ref: ${e.ref})`:""} (transport: ${t})`);let s=await Po(ge(Io(),"asm-install-"));if(t==="ssh"||t==="https"){let i=t==="ssh"?e.sshCloneUrl:e.cloneUrl;try{return await Di(i,e.ref,s)}catch(n){throw await oe(s),new Error(rs(n))}}try{return await Di(e.cloneUrl,e.ref,s)}catch(i){if(!Vf(i))throw await oe(s),new Error(rs(i));I("install: HTTPS clone failed with auth error, retrying with SSH..."),await oe(s);let n=await Po(ge(Io(),"asm-install-"));try{return await Di(e.sshCloneUrl,e.ref,n)}catch(r){throw await oe(n),new Error(`Clone failed with both transports:
|
|
154
|
+
HTTPS: ${rs(i)}
|
|
155
|
+
SSH: ${rs(r)}`)}}}async function qe(e){let t=ge(e,"SKILL.md"),s;try{s=await Fi(t,"utf-8")}catch{throw new Error("Not a valid skill: SKILL.md not found in repository root")}let i=re(s),n=e.split(/[/\\]/).pop()||"unknown",r=i.name||n,o=ue(i);return I(`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 ls(e,t=5){let s=[];async function i(n,r,o){let a;try{a=await If(n)}catch{return}for(let l of a){if(l===".git"||l==="node_modules")continue;let c=ge(n,l);try{if(!(await Ro(c)).isDirectory())continue}catch{continue}let d=r?`${r}/${l}`:l,f=o+1,p=ge(c,"SKILL.md");try{let m=await Fi(p,"utf-8"),y=re(m);s.push({relPath:d,name:y.name||l,version:ue(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:ro(y),tokenCount:ss(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 Kf=[{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 Mo(e){let t=[],s=await ns(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 Kf)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 cs(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 _i(e.targetDir),await os(e.targetDir,{recursive:!0,force:!0})}catch{}let s=e.sourceDir;try{await Lf(s,e.targetDir,{recursive:!0})}catch(a){throw new Error(`Failed to install: ${a.message}`)}let i=ge(e.targetDir,".git");try{await os(i,{recursive:!0,force:!0})}catch{}I(`install: copied files to ${e.targetDir}`);let n=ge(e.targetDir,"SKILL.md");try{await _i(n)}catch{throw new Error("Installation verification failed: SKILL.md not found at target")}let r=await Fi(n,"utf-8"),o=re(r);return{success:!0,path:e.targetDir,name:o.name||e.skillName,version:ue(o),provider:e.providerLabel,source:t}}async function Do(e,t){let s=await cs(e);for(let i of t){if(i.name===e.providerName)continue;let n=e.scope==="project"?i.project:i.global,r=ce(n),o=ge(r,e.skillName);await Tf(r,{recursive:!0});try{if((await Rf(o)).isSymbolicLink())await os(o);else{I(`install: skipping ${o} \u2014 existing non-symlink directory`);continue}}catch{}let a=Mf(r,e.targetDir);await Of(a,o,"dir"),I(`install: symlinked ${o} -> ${a}`)}return s.provider=`All (${t.map(i=>i.label).join(", ")})`,s}async function oe(e){try{await os(e,{recursive:!0,force:!0})}catch{}}async function _o(){try{await Oe("npx",["--version"]),I("install: npx available")}catch{throw new Error("npx is required for Vercel method installation. Install Node.js from https://nodejs.org")}}async function qo(e,t){let s=["--yes","skills","add",e];t&&s.push("--skill",t),I(`install: running npx ${s.join(" ")}`);try{let i=await Oe("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 Fo(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 Xe(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 Qe({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 Bi(e,t,s,i,n,r,o="global"){let a=o==="project"?n.project:n.global,l=ce(a),c=ge(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 jo(e,t){try{if(await _i(e),I(`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;I(`install: target ${e} \u2014 no conflict`)}}var Nc=Zr($r(),1);import{readFile as bg}from"fs/promises";import{join as wg}from"path";var Pc=500;function vg(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 kg(e){let t=e.split(`
|
|
159
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
|
|
160
|
+
`);return null}function Sg(e){let t=kg(e);if(t===null)return null;try{return(0,Nc.parse)(t),null}catch(s){return s.message||"invalid YAML"}}async function Ic(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=wg(e.path,"SKILL.md"),n=await bg(i,"utf-8");vg(n)||t.push({category:"empty-body",message:"SKILL.md contains only frontmatter with no body content"});let r=Sg(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>Pc&&t.push({category:"high-file-count",message:`Skill has ${s} files (threshold: ${Pc})`}),t}import{join as Ig}from"path";import{homedir as Lg}from"os";import{readFile as $g,writeFile as xg,mkdir as Eg}from"fs/promises";import{dirname as Cg}from"path";async function Ag(e){try{let t=await $g(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 Pg(e,t,s){let i={fetched_at:new Date().toISOString(),ttl_seconds:s,data:t};try{await Eg(Cg(e),{recursive:!0}),await xg(e,JSON.stringify(i,null,2),"utf-8"),I(`http: wrote cache -> ${e}`)}catch(n){I(`http: failed to write cache: ${n}`)}}function Ng(e){let t=new Date(e.fetched_at).getTime();return(Date.now()-t)/1e3<e.ttl_seconds}async function Lc(e,t,s={}){let i=s.ttl??3600,n=s.noCache??!1,r=await Ag(t);if(r&&!n&&Ng(r))return I(`http: cache hit (fresh) -> ${t}`),r.data;try{I(`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 Pg(t,a,i),a}catch(o){return I(`http: fetch failed: ${o}`),r?(I(`http: using stale cache as fallback -> ${t}`),r.data):null}}var Rg=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,Og=/^[a-zA-Z0-9_-]+$/,Tc=/^https:\/\/github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/,Tg=/^[0-9a-f]{40}$/,Mg=/^\d+\.\d+\.\d+(-[a-zA-Z0-9.]+)?(\+[a-zA-Z0-9.]+)?$/,Dg=/^[a-z0-9-]+$/,_g=/^sha256:[0-9a-f]{64}$/,Rc=["pass","warning","dangerous"];function oi(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:Rg,maxLength:128},{field:"author",pattern:Og,maxLength:39},{field:"description",maxLength:256},{field:"repository",pattern:Tc},{field:"commit",pattern:Tg},{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"||!Rc.includes(r))&&t.push({field:"security_verdict",message:`"security_verdict" must be one of: ${Rc.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"||!Mg.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`}),Dg.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"||!_g.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 qg(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 Fg(e,t,s=2){let i=[];for(let n of t){if(e===n)continue;let r=qg(e,n);r<=s&&i.push({existingName:n,distance:r})}return i.sort((n,r)=>n.distance-r.distance)}var xr=process.env.ASM_REGISTRY_URL??"https://raw.githubusercontent.com/luongnv89/asm-registry/main/index.json",jg=process.env.ASM_REGISTRY_CACHE??Ig(Lg(),".config","agent-skill-manager","registry-cache.json"),Bg=3600;function Er(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 Cr(e){return Er(e)?e.includes("/"):!1}async function Ar(e){let t=await Lc(xr,jg,{ttl:Bg,noCache:e?.noCache});if(!t)return null;if(typeof t!="object"||!Array.isArray(t.manifests)||typeof t.generated_at!="string")return I("registry: fetched index has invalid structure \u2014 discarding"),null;let s=[];for(let i of t.manifests){let n=oi(i);if(n.length>0){I(`registry: dropping invalid manifest entry (${i?.name??"unknown"}): ${n.map(r=>r.message).join(", ")}`);continue}if(!Tc.test(i.repository)){I(`registry: dropping manifest with unexpected repository URL: ${i.repository}`);continue}s.push(i)}return{generated_at:t.generated_at,manifests:s}}function Ug(e,t){return t.manifests.filter(s=>s.name.toLowerCase()===e.toLowerCase())}function Vg(e,t,s){return s.manifests.find(i=>i.author.toLowerCase()===e.toLowerCase()&&i.name.toLowerCase()===t.toLowerCase())??null}function Oc(e,t,s=5){return Fg(e,t.manifests.map(n=>n.name),3).slice(0,s).map(n=>n.existingName)}async function Mc(e,t){let s=await Ar(t);if(!s)return I("registry: failed to fetch index \u2014 skipping registry resolution"),{resolved:null,multipleMatches:[],suggestions:[]};if(Cr(e)){let[r,o]=e.split("/"),a=Vg(r,o,s);if(a)return{resolved:{manifest:a,source:"registry"},multipleMatches:[],suggestions:[]};let l=Oc(o,s);return{resolved:null,multipleMatches:[],suggestions:l}}let i=Ug(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=Oc(e,s);return{resolved:null,multipleMatches:[],suggestions:n}}function Dc(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 Kg,access as qc,mkdir as Jg,cp as _c,rm as Hg,symlink as Gg}from"fs/promises";import{join as Fc,basename as Yg}from"path";function Wg(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 jc(e){let t;try{t=await Kg(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=Wg(s);if(!i.valid)throw new Error(`Invalid manifest:
|
|
161
161
|
${i.errors.join(`
|
|
162
|
-
`)}`);return s}async function
|
|
162
|
+
`)}`);return s}async function zg(e){try{return await qc(e),!0}catch{return!1}}function Qg(e,t){return e.providers.find(s=>s.name===t&&s.enabled)}function Xg(e,t,s,i){let n=Qg(e,t);if(!n)return null;let r=s==="global"?n.global:n.project,o=ce(r),a=Yg(i);return!a||a==="."||a===".."?null:Fc(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 Bc(e,t,s){let i=s?.config??await B(),n=s?.installedSkills??await ee(i,"both"),r=[];for(let c of e.skills){if(t.scopeFilter!=="both"&&c.scope!==t.scopeFilter){I(`import: skipping "${c.name}" \u2014 scope "${c.scope}" filtered out`);continue}let d=Xg(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 zg(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 Jg(Fc(d,".."),{recursive:!0}),f&&await Hg(d,{recursive:!0,force:!0}),c.isSymlink&&c.symlinkTarget)try{await qc(c.symlinkTarget),await Gg(c.symlinkTarget,d),I(`import: symlinked "${c.name}" -> ${c.symlinkTarget} at ${d}`)}catch{await _c(p.realPath,d,{recursive:!0}),I(`import: symlink target unreachable, copied "${c.name}" from ${p.realPath} to ${d}`)}else await _c(p.realPath,d,{recursive:!0}),I(`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 ey,writeFile as ty,access as sy}from"fs/promises";import{join as iy}from"path";function ny(e){return`---
|
|
163
163
|
name: ${e}
|
|
164
164
|
description: ""
|
|
165
165
|
license: ""
|
|
@@ -180,62 +180,62 @@ as instructions for when and how to use this skill.
|
|
|
180
180
|
## Instructions
|
|
181
181
|
|
|
182
182
|
- Step-by-step instructions for the agent
|
|
183
|
-
`}async function
|
|
184
|
-
`)}import{access as
|
|
185
|
-
`,"utf-8"),
|
|
183
|
+
`}async function Uc(e,t){await ey(t,{recursive:!0});let s=iy(t,"SKILL.md"),i=ny(e);await ty(s,i,"utf-8")}async function Vc(e){try{return await sy(e),!0}catch{return!1}}import{readdir as ry,stat as oy}from"fs/promises";import{join as ay}from"path";async function ly(e){let t=0;try{let i=(await ry(e,{recursive:!0})).map(async r=>{try{let o=await oy(ay(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 ly(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 cy(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 Pr(e,t,s=20){let i=Math.round(e/t*s),n=s-i;return u.green("#".repeat(i))+u.dim("-".repeat(n))}var Kc={claude:"Claude Code",codex:"Codex",openclaw:"OpenClaw",agents:"Agents"};function Hc(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(cy(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])=>(Kc[l]||l).length));for(let[l,c]of s){let d=Kc[l]||l,f=fo(l,d.padEnd(n)),p=String(c).padStart(4);t.push(` ${f} ${p} ${Pr(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} ${Pr(e.byScope.global,r)}`),t.push(` ${"project".padEnd(n)} ${a} ${Pr(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 uy,lstat as Nr,mkdir as fy,readdir as dy,readFile as Gc,rm as py,symlink as my}from"fs/promises";import{join as ai}from"path";async function Ir(e){let t;try{t=await Nr(e)}catch{throw new Error(`Path does not exist: ${e}`)}if(!t.isDirectory())throw new Error(`Path is not a directory: ${e}`);let s=ai(e,"SKILL.md"),i;try{i=await Gc(s,"utf-8")}catch{throw new Error(`No SKILL.md found in ${e}`)}let n=re(i);if(!n.name)throw new Error(`Invalid SKILL.md in ${e}: missing "name" in frontmatter`);return{name:n.name,version:ue(n)}}async function Yc(e,t,s,i){let n=ai(t,s),r=!1;try{await uy(n),r=!0}catch{}if(r){if(!i)throw new Error(`Target already exists: ${n}. Use --force to overwrite.`);await py(n,{recursive:!0,force:!0})}await fy(t,{recursive:!0}),await my(e,n,"dir")}async function Lr(e){let t;try{t=await Nr(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 dy(e),i=[];for(let n of s){if(n.startsWith(".")||n==="node_modules")continue;let r=ai(e,n);try{if(!(await Nr(r)).isDirectory())continue}catch{continue}let o=ai(r,"SKILL.md");try{let a=await Gc(o,"utf-8"),l=re(a);l.name&&i.push({absPath:r,dirName:n,name:l.name,version:ue(l)})}catch{}}return i.sort((n,r)=>n.name.localeCompare(r.name)),i}import{readFile as hy,writeFile as gy,readdir as Wc,access as zc,mkdir as yy,rm as by}from"fs/promises";import{join as He,resolve as Qc,dirname as wy}from"path";import{homedir as vy}from"os";import{fileURLToPath as ky}from"url";var Sy=ky(import.meta.url),$y=wy(Sy),Je=He(vy(),".config","agent-skill-manager","bundles"),li=Qc($y,"..","data","bundles");function xy(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 Xc(e,t,s,i,n){return{version:1,name:e,description:t,author:s,createdAt:new Date().toISOString(),skills:i,tags:n}}async function Zc(e,t){let s=t??await Re(),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 Ey(){await yy(Je,{recursive:!0})}function Rr(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 Or(e){await Ey();let t=`${Rr(e.name)}.json`,s=He(Je,t);return await gy(s,JSON.stringify(e,null,2)+`
|
|
185
|
+
`,"utf-8"),I(`bundle: saved to ${s}`),s}async function Wt(e){let t;try{t=await hy(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=xy(s);if(!i.valid)throw new Error(`Invalid bundle:
|
|
186
186
|
${i.errors.join(`
|
|
187
|
-
`)}`);return s}async function
|
|
188
|
-
`);for(let a=0;a<o.length;a++){let l=o[a],c=l.trim();for(let d of
|
|
189
|
-
`)}function
|
|
190
|
-
About to publish "${
|
|
187
|
+
`)}`);return s}async function zt(e){if(e.includes("/")||e.includes("\\")||e.endsWith(".json")){let i=Qc(e);return Wt(i)}let t=`${Rr(e)}.json`,s=He(Je,t);try{return await Wt(s)}catch(i){if(i?.message?.includes("Bundle file not found")){let n=He(li,t);try{return await Wt(n)}catch(r){throw r?.message?.includes("Bundle file not found")?new Error(`Bundle file not found: ${s}`):r}}throw i}}async function eu(){let e=[];try{await zc(li)}catch{return e}let t;try{t=await Wc(li)}catch{return e}for(let s of t){if(!s.endsWith(".json"))continue;let i=He(li,s);try{let n=await Wt(i);e.push(n)}catch{I(`bundle: skipping invalid predefined file ${i}`)}}return e.sort((s,i)=>s.name.localeCompare(i.name)),e}async function tu(){let e=[];try{await zc(Je)}catch{return e}let t;try{t=await Wc(Je)}catch{return e}for(let s of t){if(!s.endsWith(".json"))continue;let i=He(Je,s);try{let n=await Wt(i);e.push(n)}catch{I(`bundle: skipping invalid file ${i}`)}}return e.sort((s,i)=>s.name.localeCompare(i.name)),e}async function su(e){let t=`${Rr(e)}.json`,s=He(Je,t);try{return await by(s),I(`bundle: removed ${s}`),!0}catch(i){if(i?.code==="ENOENT")return!1;throw i}}import{readFile as My,realpath as Dy}from"fs/promises";import{join as _y,resolve as qy,relative as Fy}from"path";var ru=[{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 Cy(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`}I(`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",I(`security-audit: source analysis failed -> ${s.fetchError}`)}return s}function Ay(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 ru)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 Py(e){let t=new Map;for(let r of e)for(let o of r.matches)for(let a of ru)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 Ny(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 Le(e,t,s,i){I(`security-audit: scanning ${e}`);let n=await ns(e),r=n.reduce((f,p)=>f+p.lineCount,0),o=null;s&&i&&(o=await Cy(s,i));let a=Ay(n),l=Py(a),{verdict:c,reason:d}=Ny(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,Ge=56,Iy={"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"},iu={critical:0,warning:1,info:2};function Ly(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 Ry(e){switch(e){case"safe":return R.green;case"caution":return R.cyan;case"warning":return R.yellow;case"dangerous":return R.red}}function ut(e){switch(e){case"critical":return R.red("!!");case"warning":return R.yellow(" !");case"info":return R.dim(" i")}}function Tr(e,t){return e.length>t?e.slice(0,t-3)+"...":e}function ci(e){return e.toLocaleString("en-US")}function ou(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function nu(e){return ou(e).length}function Oy(e){let t=new Map;for(let s of e){let i=`${s.file}:${s.line}`,n=t.get(i);(!n||iu[s.severity]<iu[n.severity])&&t.set(i,s)}return Array.from(t.values())}function Ty(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 ui(e){let t=[],s=Ly(e.verdict),i=ou(s),n=` ${R.bold(e.skillName)}`,r=` ${e.skillName}`,o=Ge-4,a=Math.max(1,o-r.length-i.length);if(t.push(""),t.push(R.dim(" +-- ")+R.bold("Security Audit")+R.dim(" "+"-".repeat(Ge-19)+"+")),t.push(R.dim(" |")+n+" ".repeat(a)+s+R.dim("|")),t.push(R.dim(" |")+R.dim(` ${ci(e.totalFiles)} files | ${ci(e.totalLines)} lines`)+" ".repeat(Math.max(1,o-` ${ci(e.totalFiles)} files | ${ci(e.totalLines)} lines`.length))+R.dim("|")),t.push(R.dim(" +"+"-".repeat(Ge-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=Ry(e.verdict),p=e.verdict==="dangerous"||e.verdict==="warning"?ut("critical"):e.verdict==="caution"?ut("warning"):ut("info");t.push(` ${p} ${f(e.verdictReason)}`);let m=0,y=0,h=0;for(let w of e.codeScans)for(let S of w.matches)S.severity==="critical"?m++:S.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(w=>w.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(Ge-2)));for(let f of e.codeScans){let p=Oy(f.matches),m=p.filter(L=>L.severity==="critical").length,y=p.filter(L=>L.severity==="warning").length,h=p.filter(L=>L.severity==="info").length,g=m>0?ut("critical"):y>0?ut("warning"):ut("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=Iy[f.category],w=v?R.dim(`PERM: ${v}`):"",S=` ${g} ${R.bold(f.category)} (${b.join(", ")})`;if(w){let L=nu(S),F=nu(w),D=Math.max(2,Ge-L-F);t.push(S+" ".repeat(D)+w)}else t.push(S);let k=Ty(p),P=Math.min(24,Math.max(...k.map(L=>L.file.length))),x=0,$=3;for(let L of k){if(x>=$)break;let F=Tr(L.file,24),D=R.dim(F.padEnd(P));if(L.entries.length===1){let N=L.entries[0],A=Tr(N.match,50);t.push(` ${D} :${N.line} ${R.dim("--")} ${N.severity==="critical"?A:R.dim(A)}`),x++}else if(L.entries.length<=3){let N=L.entries.map(_=>`:${_.line}`).join(", "),A=Tr(L.entries[0].match,40);t.push(` ${D} ${N} ${R.dim("--")} ${R.dim(A)}`),x++}else{let A=L.entries.slice(0,3).map(O=>`:${O.line}`).join(", "),_=L.entries.length-3;t.push(` ${D} ${A} ${R.dim(`(+${_} more)`)}`),x++}}let T=k.length-Math.min(k.length,$);if(T>0){let L=p.length-k.slice(0,$).reduce((F,D)=>F+D.entries.length,0);L>0&&t.push(` ${R.dim(`... ${L} more in ${T} file${T>1?"s":""}`)}`)}t.push("")}}t.push(R.dim(" "+"=".repeat(Ge-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,Ge-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 Mr(e){return JSON.stringify(e,null,2)}async function H(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 fi(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 jy(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/</g,"<").replace(/>/g,">").replace(/\|/g,"\\|")}function Dr(e){return jy(fi(e))}var Ye="luongnv89/asm-registry";async function By(e){let t=_y(e,"SKILL.md"),s;try{s=await My(t,"utf-8")}catch{throw new Error(`No SKILL.md found in ${e}. Run "asm init" to create one.`)}let i=re(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=ue(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 Uy(e){let{exitCode:t}=await H(["git","rev-parse","--git-dir"],{cwd:e});if(t!==0)throw new Error(`${e} is not inside a git repository.`)}async function Vy(e){let{stdout:t,exitCode:s}=await H(["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 Ky(e){let{stdout:t,exitCode:s}=await H(["git","rev-parse","--show-toplevel"],{cwd:e});if(s!==0)throw new Error("Failed to determine git repository root.");return t.trim()}async function Jy(e){let{stdout:t,exitCode:s}=await H(["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 Hy(){let{exitCode:e}=await H(["gh","--version"]);if(e!==0)return{available:!1,authenticated:!1,login:null};let{exitCode:t}=await H(["gh","auth","status"]);if(t!==0)return{available:!0,authenticated:!1,login:null};let{stdout:s,exitCode:i}=await H(["gh","api","user","--jq",".login"]);return{available:!0,authenticated:!0,login:i===0?s.trim():null}}function Gy(e){switch(e){case"safe":case"caution":return"pass";case"warning":return"warning";case"dangerous":return"dangerous"}}function au(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 Yy(e){let t=au({metadata:e.metadata,author:e.metadata.creator||"unknown",commit:e.commit,repository:e.repository,securityVerdict:e.registryVerdict}),s=oi(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 lu(e){let t=qy(e.path);I(`publish: starting for ${t}`),await Uy(t);let s=await By(t);I(`publish: parsed metadata for "${s.name}"`);let n=await(e._auditFn??Le)(t,s.name),r=Gy(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 Vy(t),a=await Jy(t),l=await Ky(t),c=await Dy(t),d=Fy(l,c),f=d&&d!=="."?d:void 0,m=await(e._checkGhCliFn??Hy)();if(!m.available||!m.authenticated){let U=m.available?"gh CLI not authenticated":"gh CLI not found";return Yy({metadata:s,commit:o,repository:a,registryVerdict:r,securityReport:n,fallbackReason:U})}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=au({metadata:s,author:y,commit:o,repository:a,skillPath:f,securityVerdict:r}),g=oi(h);if(g.length>0)return{success:!1,manifest:h,prUrl:null,error:`Manifest validation failed: ${g.map(U=>`${U.field}: ${U.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 U=fi(s.name),ze=fi(y);process.stderr.write(`
|
|
190
|
+
About to publish "${U}" by ${ze} to ${Ye}.
|
|
191
191
|
Security verdict: ${r}
|
|
192
192
|
|
|
193
|
-
Proceed? [y/N] `);let
|
|
194
|
-
`)&&(process.stdin.removeListener("data",
|
|
195
|
-
`,
|
|
196
|
-
`),{stdout:
|
|
193
|
+
Proceed? [y/N] `);let ne=await new Promise(le=>{let ve="",es=mt=>{ve+=mt.toString(),ve.includes(`
|
|
194
|
+
`)&&(process.stdin.removeListener("data",es),process.stdin.pause(),le(ve.trim()))};process.stdin.resume(),process.stdin.on("data",es)});if(ne.toLowerCase()!=="y"&&ne.toLowerCase()!=="yes")return{success:!1,manifest:h,prUrl:null,error:"Publish aborted by user.",securityVerdict:r,securityReport:n}}I(`publish: forking ${Ye}`),await H(["gh","repo","fork",Ye,"--clone=false"]);let b=`publish/${y}/${s.name}`,v=`manifests/${y}/${s.name}.json`,w=JSON.stringify(h,null,2)+`
|
|
195
|
+
`,S=Buffer.from(w,"utf-8").toString("base64"),{stdout:k,exitCode:P}=await H(["gh","api",`repos/${y}/asm-registry/git/refs/heads/main`,"--jq",".object.sha"]);if(P!==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 x=k.trim(),{exitCode:$}=await H(["gh","api",`repos/${y}/asm-registry/git/refs`,"-X","POST","-f",`ref=refs/heads/${b}`,"-f",`sha=${x}`]);$!==0&&await H(["gh","api",`repos/${y}/asm-registry/git/refs/heads/${b}`,"-X","PATCH","-f",`sha=${x}`,"-f","force=true"]);let{stderr:T,exitCode:L}=await H(["gh","api",`repos/${y}/asm-registry/contents/${v}`,"-X","PUT","-f",`message=Publish ${y}/${s.name}`,"-f",`content=${S}`,"-f",`branch=${b}`]);if(L!==0){let{stdout:U,exitCode:ze}=await H(["gh","api",`repos/${y}/asm-registry/contents/${v}?ref=${b}`,"-q",".sha"]),ne=U.trim();if(ze===0&&ne){let{exitCode:le}=await H(["gh","api",`repos/${y}/asm-registry/contents/${v}`,"-X","PUT","-f",`message=Update ${y}/${s.name}`,"-f",`content=${S}`,"-f",`branch=${b}`,"-f",`sha=${ne}`]);if(le!==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. ${T}`,securityVerdict:r,securityReport:n}}let F=Dr(s.name),D=Dr(s.description),N=Dr(s.license),A=`Publish ${y}/${fi(s.name)}`,_=[`## Skill: ${F}`,"",`**Author:** ${y}`,`**Version:** ${s.version}`,`**Description:** ${D}`,`**License:** ${N}`,`**Repository:** ${a}`,`**Commit:** \`${o}\``,`**Security verdict:** ${r}`,"","---","","*This PR was generated by `asm publish`.*"].join(`
|
|
196
|
+
`),{stdout:O,stderr:M,exitCode:ie}=await H(["gh","pr","create","--repo",Ye,"--head",`${y}:${b}`,"--title",A,"--body",_]),K=null;if(ie===0)K=O.trim();else{let U=M.match(/https:\/\/github\.com\/[^\s]+\/pull\/\d+/);U&&(K=U[0])}return K?{success:!0,manifest:h,prUrl:K,error:null,securityVerdict:r,securityReport:n}:{success:!1,manifest:h,prUrl:null,error:`Failed to create PR against ${Ye}. ${M}`,securityVerdict:r,securityReport:n}}function cu(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
197
|
`).map(i=>` ${i}`).join(`
|
|
198
198
|
`)].join(`
|
|
199
|
-
`):""}import{execFile as
|
|
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
|
|
201
|
-
`)}function
|
|
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
|
|
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
|
|
204
|
-
`)}function
|
|
199
|
+
`):""}import{execFile as Wy}from"child_process";import{promisify as zy}from"util";import{rm as di,rename as uu,cp as fu,access as Qy,mkdir as Xy}from"fs/promises";import{join as pi}from"path";import{homedir as du}from"os";var _r=zy(Wy);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 eb(e,t){try{let s=["ls-remote",e];t?s.push(t):s.push("HEAD");let{stdout:i}=await _r("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 I(`updater: git ls-remote failed for ${e}: ${s}`),null}}function qr(e){return e.sourceType?e.sourceType:e.source.startsWith("local:")?"local":"github"}function pu(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 tb(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 Fr(e){let t=e?.readLockFn??Re,s=e?.fetchRegistryIndexFn??Ar,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])=>qr(l)==="registry"||l.registryName)&&(r=await s());let a=await Zy(n,5,async([l,c])=>{let d=qr(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:he(c.commitHash),latestCommit:he(h.commit),source:c.source,sourceType:d,status:g?"outdated":"up-to-date"}}}let f=pu(c.source);if(!f)return{name:l,installedCommit:he(c.commitHash),latestCommit:"unknown",source:c.source,sourceType:d,status:"error",error:"Cannot determine remote URL"};let p=await eb(f,c.ref);if(!p)return{name:l,installedCommit:he(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:he(c.commitHash),latestCommit:he(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 sb(e,t,s,i){if(qr(t)==="local")return{name:e,status:"skipped",reason:"Local skill (not updatable)"};let r=pu(t.source);if(!r)return{name:e,status:"failed",reason:"Cannot determine remote URL"};let o=pi(du(),".config","agent-skill-manager",".tmp",`${e}-${Date.now()}`);try{let a=pi(du(),".config","agent-skill-manager",".tmp");await Xy(a,{recursive:!0}),I(`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 _r("git",l,{timeout:6e4})}catch(k){return{name:e,status:"failed",reason:`Clone failed: ${k.stderr||k.message}`}}let c=null;try{let{stdout:k}=await _r("git",["rev-parse","HEAD"],{cwd:o,timeout:5e3});c=k.trim()}catch{return{name:e,status:"failed",reason:"Could not read new commit"}}if(c===t.commitHash)return{name:e,status:"skipped",reason:"Already up to date"};I(`updater: running security audit on ${e}`);let d="safe";try{let k=i?.auditFn??Le,P=tb(t.source);if(d=(await k(o,e,P?.owner,P?.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};I(`updater: security audit ${d} for ${e} \u2014 proceeding (--yes)`)}}catch(k){return I(`updater: security audit failed for ${e}: ${k.message}`),{name:e,status:"failed",reason:`Security audit failed \u2014 skipping update: ${k.message}`}}let f=i?.loadConfigFn??B,p=i?.resolveProviderPathFn??ce,y=(await f()).providers.find(k=>k.name===t.provider),h=y?y.global:`~/.${t.provider}/skills`,g=p(h),b=pi(g,e),v=pi(o,".git");try{await di(v,{recursive:!0,force:!0})}catch{}try{await Qy(b)}catch{let k=i?.writeLockEntryFn??yt;return await fu(o,b,{recursive:!0}),await k(e,{...t,commitHash:c,installedAt:new Date().toISOString()}),{name:e,status:"updated",oldCommit:he(t.commitHash),newCommit:he(c),securityVerdict:d}}let w=`${b}.bak-${Date.now()}`;try{await uu(b,w),await fu(o,b,{recursive:!0}),await di(w,{recursive:!0,force:!0})}catch(k){try{await di(b,{recursive:!0,force:!0}),await uu(w,b)}catch{}return{name:e,status:"failed",reason:`Atomic swap failed: ${k.message}`}}return await(i?.writeLockEntryFn??yt)(e,{...t,commitHash:c,installedAt:new Date().toISOString()}),{name:e,status:"updated",oldCommit:he(t.commitHash),newCommit:he(c),securityVerdict:d}}finally{try{await di(o,{recursive:!0,force:!0})}catch{}}}async function mu(e,t,s){let i=s?.readLockFn??Re,n=s?.checkOutdatedFn??Fr,r=s?.updateSkillFn??sb,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())?I(`updater: skill "${p}" is already up to date`):(I(`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 he(e){return!e||e==="unknown"?"unknown":e.slice(0,7)}function hu(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 gu(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 yu(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 hb}from"child_process";import{promisify as gb}from"util";import{access as bu,readFile as vu,readdir as yb,writeFile as bb,rm as wb,stat as ku}from"fs/promises";import{join as jr}from"path";import{homedir as vb}from"os";import{constants as wu}from"fs";import{access as ib,realpath as nb,stat as rb}from"fs/promises";import{constants as ob}from"fs";import{delimiter as ab,resolve as lb,sep as cb}from"path";var ub="asm";function fb(e){if(!e)return[];let t=new Set,s=[];for(let i of e.split(ab)){let n=i.trim();if(!n)continue;let r=n.endsWith(cb)?n.slice(0,-1):n;t.has(r)||(t.add(r),s.push(r))}return s}async function db(e){try{if(!(await rb(e)).isFile())return!1}catch{return!1}try{return await ib(e,ob.X_OK),!0}catch{return!1}}async function pb(e){try{return await nb(e)}catch{return e}}async function mb(e=process.env.PATH){let t=new Set,s=[];for(let i of fb(e)){let n=lb(i,ub);if(!await db(n))continue;let r=await pb(n);t.has(r)||(t.add(r),s.push({path:n,realPath:r}))}return s}async function mi(e=process.env.PATH){let t=await mb(e);if(t.length===0)return{resolved:null,shadowed:[]};let[s,...i]=t;return{resolved:s,shadowed:i}}var ft=gb(hb);async function kb(e){let t=e?.execFn??ft;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 Sb(e){let t=e?.execFn??ft;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 $b(e){let t=e?.execFn??ft;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 xb(e){let t=e?.execFn??ft;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 Eb(e){let t=e?.execFn??ft;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 Cb(e){try{let t=jr(e,".asm-doctor-write-test");return await bb(t,"test","utf-8"),await wb(t),{writable:!0,exists:!0}}catch{}try{return await bu(e,wu.W_OK),{writable:!0,exists:!0}}catch{}try{return await bu(e,wu.F_OK),{writable:!1,exists:!0}}catch{return{writable:!0,exists:!1}}}async function Ab(e){let t=e.providers.filter(r=>r.enabled),s=0,i=0;for(let r of t){let o=ce(r.global);i++,(await Cb(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 Pb(){let e=ht();try{let t=await vu(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 Nb(){let e=so();try{let t=await vu(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 Ib(){try{let e=await fetch(xr,{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 Lb(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=ce(l.global),d=jr(c,o);try{(await ku(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 Rb(e,t){let s=new Set(Object.keys(t.skills)),i=[];for(let n of e.providers.filter(r=>r.enabled)){let r=ce(n.global);try{let o=await yb(r);for(let a of o)try{(await ku(jr(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 Ob(e){let t=e?.execFn??ft;try{let{stdout:s}=await t("df",["-Pk",vb()],{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 Tb(){try{let e=await mi();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 Su(){let e=await B(),t=await Re(),i=(await Promise.allSettled([kb(),Sb(),$b(),xb(),Eb(),Ab(e),Pb(),Nb(),Ib(),Lb(e,t),Rb(e,t),Ob(),Tb()])).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 Mb={pass:"\u2705",warn:"\u26A0\uFE0F ",fail:"\u274C"};function $u(e){let t=["Checking your environment...",""];for(let s of e.checks){let n=` ${Mb[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 xu(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 Ur,writeFile as Db,stat as dt,copyFile as _b,readdir as Nu}from"fs/promises";import{join as pt,resolve as Kr,basename as we,isAbsolute as Jr}from"path";var Vr="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`).",Eu=["name","description","version","license","author","creator","compatibility","allowed-tools","effort","tags","metadata"],Cu=["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"],qb=["confirm","confirmation","error","errors","fail","failure","caution","warning","prerequisite","prerequisites","requires","requirements","rollback","dry-run","dry run","safety","validate","validation","check","backup"],Fb=["acceptance criteria","expected output","expected result","edge case","edge cases","test","tests","testing","verify","verification","assert","example input","example output","given","then"],jb=["reference","references","see","template","templates","script","scripts","helper","helpers","link"],Bb=["when to use","quick start","overview","instructions","steps","workflow","phases","progressive"];function Iu(e){let t=e.split(`
|
|
205
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
206
|
`),n=t.slice(s+1).join(`
|
|
207
207
|
`);return{rawFrontmatter:i,body:n}}return{rawFrontmatter:t.slice(1).join(`
|
|
208
|
-
`),body:""}}function
|
|
209
|
-
`).length:0}function Br(e){return e?e.split(/\s+/).map(t=>t.trim()).filter(Boolean).length:0}function qb(e,t=1){return(e.match(/^#{1,6}\s+\S/gm)||[]).length>=t}function di(e,t){let s=e.toLowerCase();return t.filter(i=>s.includes(i))}function Fb(e){return/```[\s\S]+?```/m.test(e)}function jb(e){return/^\s*[-*]\s+\S/m.test(e)||/^\s*\d+\.\s+\S/m.test(e)}function Bb(e,t,s){let i=[],n=[],r=0;s!==null?(r+=2,i.push("Has YAML frontmatter block.")):(i.push("SKILL.md has no YAML frontmatter."),n.push("Add a YAML frontmatter block delimited by `---` with at least `name` and `description` fields."));let o=!!(e.name&&e.name.trim()),a=!!(e.description&&e.description.trim());o?r+=1.5:(i.push("Missing required field: name."),n.push("Add `name:` to frontmatter (use the skill directory name).")),a?r+=1.5:(i.push("Missing required field: description."),n.push("Add a one-line `description:` to frontmatter."));let l=ae(e);l&&l!=="0.0.0"?r+=1:(i.push("Missing or default version."),n.push("Set `metadata.version` (or top-level `version`) using semver (e.g. 0.1.0).")),!!(e.creator||e["metadata.creator"])?r+=1:(i.push("Missing `creator`."),n.push("Add a `creator` field so users know who authored and maintains the skill.")),!!e.license?r+=1:(i.push("Missing `license`."),n.push("Add a `license` field (e.g. `license: MIT`)."));let p=t.trim().length>=20,h=qb(t,1);return p?(r+=1,i.push("Body has meaningful content.")):(i.push("Body content is too short (<20 chars of instructions)."),n.push("Flesh out the markdown body with at least one paragraph of instructions for the agent.")),h?(r+=1,i.push("Body uses markdown headings.")):(i.push("Body has no markdown headings."),n.push("Add section headings (e.g. `## When to Use`, `## Instructions`) so the agent can navigate the skill quickly.")),{id:"structure",name:"Structure & completeness",score:Math.round(r),max:10,findings:i,suggestions:n}}function Ub(e,t){let s=[],i=[],n=0,r=(e.description||"").trim();if(!r)return s.push("No description."),i.push("Write a one-sentence description that says specifically what the skill does and when to use it."),{id:"description",name:"Description quality",score:0,max:10,findings:s,suggestions:i};let o=Br(r);s.push(`Description is ${o} words.`),o>=8&&o<=40?n+=4:o>=5&&o<8?(n+=2,i.push("Lengthen the description slightly so it names both the action and the trigger (aim for 8\u201320 words).")):o>=41&&o<=60?(n+=2,i.push("Trim the description \u2014 aim for under 40 words. Move the long version to the markdown body.")):o>60?(n+=0,i.push("Description is too long. Keep it under 40 words; put detail in the body.")):(n+=0,i.push("Description is too short. Aim for 8\u201320 words."));let a=r.split(/\s+/)[0]?.toLowerCase().replace(/[^\w-]/g,"");return!!(a&&(vu.includes(a)||vu.includes(a.replace(/s$/,""))))?(n+=3,s.push("Starts with an action verb.")):(s.push(`Does not start with a recognized action verb (got "${a??""}").`),i.push('Start the description with an imperative action verb (e.g. "Generate...", "Analyze...", "Review...").')),/\buse when\b|\btrigger\b|\bwhen\b|\bfor\b/i.test(r)||/\b(before|after|during)\b/i.test(r)?(n+=3,s.push("Mentions a trigger or use-case signal.")):(s.push("No explicit trigger / use-case phrase."),i.push('Name the trigger in the description \u2014 e.g. "Use when...", "for reviewing...", "before publishing...".')),{id:"description",name:"Description quality",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Vb(e,t){let s=[],i=[],n=0,r=di(t,_b);r.length>=2?(n+=3,s.push(`Progressive disclosure cues present: ${r.slice(0,3).join(", ")}.`)):r.length===1?(n+=1,i.push('Add clearer section labels \u2014 e.g. "## When to Use" and "## Instructions" \u2014 to support progressive disclosure.')):i.push('Structure the body with "## When to Use" and "## Instructions" sections so the agent reads only what it needs.'),jb(t)?(n+=2,s.push("Uses lists or numbered steps.")):(s.push("No lists or steps detected."),i.push("Use bulleted or numbered steps to narrow the agent's degrees of freedom."));let o=Fb(t),a=/\bexample\b/i.test(t);o&&a?(n+=2,s.push("Includes example code block.")):o||a?(n+=1,i.push('Back up examples with fenced code blocks labelled under "## Example" so the agent sees concrete input/output.')):i.push('Add an "## Example" section with a fenced code block showing the desired output.');let l=(t.match(/^\s*[-*0-9.]*\s*(Do|Use|Run|Call|Check|Validate|Return|Emit|Write|Read|Ask|Confirm|Avoid|Never|Always)\b/gim)||[]).length;l>=3?(n+=2,s.push(`Uses imperative voice (${l} cues).`)):l>=1?(n+=1,i.push("Favor imperative voice (Do / Use / Avoid / Never) to narrow the agent's choices.")):i.push('Rewrite instructions in the imperative mood \u2014 e.g. "Run `git status` first" instead of "you might want to run".');let c=Br(t);return c>=80&&c<=3e3?(n+=1,s.push(`Body length within healthy range (${c} words).`)):c<80?(s.push(`Body is very short (${c} words).`),i.push("Expand the instructions; an underspecified skill gives the agent too much freedom.")):(s.push(`Body is very long (${c} words).`),i.push("Split large content into referenced files; keep SKILL.md focused under ~3000 words.")),{id:"prompt-engineering",name:"Prompt engineering",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Kb(e,t){let s=[],i=[],n=0,r=Br(t);s.push(`Body is ${r} words.`),r>=120&&r<=1500?n+=4:r>=60&&r<120?(n+=2,i.push("Expand instructions slightly \u2014 too little context can push the agent to improvise.")):r>1500&&r<=3e3?(n+=2,i.push("Consider moving large sections into referenced files (e.g. `references/*.md`) and linking them instead of inlining.")):r>3e3&&(n+=0,i.push("Body is over 3000 words \u2014 split long content into referenced files or templates."));let o=di(t,Db);o.length>=2?(n+=3,s.push(`References external files or links (${o.slice(0,3).join(", ")}).`)):o.length===1?(n+=1,i.push('Link out to supporting files (e.g. "see `references/examples.md`") instead of inlining them.')):i.push('Offload verbose content to referenced files and link to them ("see `./templates/x.md`").');let l=(t.match(/```[\s\S]+?```/g)||[]).filter(c=>xu(c)>60);return l.length===0?(n+=2,s.push("No oversized code blocks.")):(s.push(`${l.length} code block(s) longer than 60 lines.`),i.push("Move large code blocks into referenced template files; link to them from SKILL.md.")),/\btoken\b|\bbudget\b|\bcontext window\b/i.test(t)&&(n+=1,s.push("Mentions tokens/budget/context window.")),{id:"context-efficiency",name:"Context efficiency",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Jb(e,t){let s=[],i=[],n=0,r=di(t,Tb);r.length>=4?(n+=4,s.push(`Covers multiple safety cues (${r.slice(0,4).join(", ")}).`)):r.length>=2?(n+=2,s.push(`Mentions a few safety cues: ${r.join(", ")}.`),i.push("Add explicit error-handling and confirmation steps so the agent knows how to recover from failures.")):r.length===1?(n+=1,i.push('Expand the safety section \u2014 include prerequisites, validation steps, and what to do "on error".')):i.push("Describe prerequisites, confirmation prompts, and error-handling steps to reduce blast radius.");let o=/\b(rm\s|delete|remove|drop|force|overwrite|destructive)\b/i.test(t),a=/\bconfirm\b|\bdry-?run\b|\bare you sure\b|\bbackup\b/i.test(t);return o&&a?(n+=3,s.push("Destructive actions paired with confirmation/dry-run.")):o?(s.push("References destructive actions without explicit confirmation/dry-run."),i.push("Pair any destructive command with an explicit confirmation prompt, dry-run flag, or backup step.")):n+=1.5,/\bprerequisit/i.test(t)||/\brequire/i.test(t)||/\bdepend/i.test(t)?(n+=3,s.push("Declares prerequisites or requirements.")):(s.push("No prerequisites / requirements section."),i.push('Add a "## Prerequisites" block listing required tools, credentials, and environment state.')),{id:"safety",name:"Safety & guardrails",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Hb(e,t){let s=[],i=[],n=0,r=di(t,Mb);return r.length>=4?(n+=5,s.push(`Many testability cues present (${r.slice(0,4).join(", ")}).`)):r.length>=2?(n+=3,s.push(`Some testability cues: ${r.join(", ")}.`),i.push('Add an "## Acceptance Criteria" block listing verifiable outputs or checklist items.')):r.length===1?(n+=1,i.push('Add concrete "expected output" examples so the agent can self-check.')):i.push('Add a "## Acceptance Criteria" section with testable statements (e.g. "produces a JSON report with overall_score").'),/expected\s+(output|result|response)/i.test(t)?(n+=3,s.push("Describes expected output/result.")):i.push('Include an "Expected output" example so reviewers and the agent can verify correctness.'),/\bedge case|gotcha|pitfall|limitation/i.test(t)?(n+=2,s.push("Mentions edge cases or limitations.")):i.push('Add a short "Edge cases" list to describe inputs the skill should reject or handle carefully.'),{id:"testability",name:"Testability",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Yb(e,t){let s=[],i=[],n=0,r=(e.name||"").trim();if(r){let l=/^[a-z][a-z0-9-]*$/.test(r),c=r.length<=40;l&&c?(n+=4,s.push(`name "${r}" follows kebab-case convention.`)):(l||(s.push(`name "${r}" is not lowercase kebab-case.`),i.push(`Rename to lowercase kebab-case (e.g. "${r.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}").`)),c||s.push(`name is ${r.length} chars; keep it <= 40.`))}else i.push("Add a kebab-case `name` (e.g. `my-skill`).");let o=t.match(/^#{1,6}\s+(.+)$/gm)||[];return o.length>0&&(o.filter(d=>/^#{1,6}\s+([A-Z][a-z]+|Use|How|When|Workflow|Instructions|Examples|Steps|Acceptance)/.test(d)).length/o.length>=.5?(n+=3,s.push("Most headings use action/imperative labels.")):(n+=1,i.push("Rename body headings to action-oriented labels (e.g. `## Instructions`, `## When to Use`)."))),/(?:\s\s|\bTODO\b|\bFIXME\b|\?{2,})/.test(e.description||"")?i.push("Clean up description \u2014 remove TODOs, FIXMEs, double spaces, or trailing punctuation."):(n+=2,s.push("Description looks clean (no TODO/FIXME/stray noise).")),{id:"naming",name:"Naming & conventions",score:Math.min(10,Math.round(n)),max:10,findings:s,suggestions:i}}function Wt(e){let{content:t,skillPath:s,skillMdPath:i}=e,n=ie(t),{rawFrontmatter:r,body:o}=$u(t),a=[Bb(n,o,r),Ub(n,o),Vb(n,o),Kb(n,o),Jb(n,o),Hb(n,o),Yb(n,o)];if(n.name&&ge(s)===n.name){let g=a.find(m=>m.id==="naming");g.score<g.max&&(g.score=Math.min(g.max,g.score+1),g.findings.push("Directory name matches frontmatter `name`."))}let l=a.reduce((g,m)=>g+m.score,0),c=a.reduce((g,m)=>g+m.max,0),d=Math.round(l/c*100),f="F";d>=90?f="A":d>=80?f="B":d>=65?f="C":d>=50&&(f="D");let p=[],h=[...a].sort((g,m)=>g.score/g.max-m.score/m.max);for(let g of h){for(let m of g.suggestions){if(p.length>=3)break;p.includes(m)||p.push(m)}if(p.length>=3)break}return{skillPath:s,skillMdPath:i,evaluatedAt:new Date().toISOString(),categories:a,overallScore:d,grade:f,topSuggestions:p,frontmatter:n}}async function Cu(e){let t=jr(e)?e:Fr(e),s;try{s=await ut(t)}catch{throw new Error(`Skill path does not exist: ${t}`)}let i,n;if(s.isFile())return i=t,n=await qr(i,"utf-8"),Wt({content:n,skillPath:ge(t)==="SKILL.md"?ge(t):t,skillMdPath:i});if(!s.isDirectory())throw new Error(`Skill path is not a directory or file: ${t}`);i=ft(t,"SKILL.md");try{n=await qr(i,"utf-8")}catch{throw new Error(`SKILL.md not found in ${t}. Run "asm init" to create one.`)}return Wt({content:n,skillPath:t,skillMdPath:i})}function Gb(e){return e<=20?"low":e<=80?"medium":e<=250?"high":"max"}function Wb(e){let t=e.split(`
|
|
210
|
-
`),s=[],i=[],n=0;for(;n<t.length;){let c=t[n];if(!c.trim()){n++;continue}let f=c.match(/^([A-Za-z_][\w-]*):\s*(.*)$/);if(!f)return{newFrontmatter:e,changed:!1};let p=f[1],
|
|
211
|
-
`)})}else s.push({key:p,text:c}),n++}let r=c=>{let d=
|
|
212
|
-
`),changed:a}}function
|
|
208
|
+
`),body:""}}function Lu(e){return e?e.split(`
|
|
209
|
+
`).length:0}function Hr(e){return e?e.split(/\s+/).map(t=>t.trim()).filter(Boolean).length:0}function Ub(e,t=1){return(e.match(/^#{1,6}\s+\S/gm)||[]).length>=t}function hi(e,t){let s=e.toLowerCase();return t.filter(i=>s.includes(i))}function Vb(e){return/```[\s\S]+?```/m.test(e)}function Kb(e){return/^\s*[-*]\s+\S/m.test(e)||/^\s*\d+\.\s+\S/m.test(e)}function Jb(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=ue(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.author||e["metadata.author"]||e.creator||e["metadata.creator"])?o+=1:(n.push("Missing `author`."),r.push("Add an `author` 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=Ub(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(Vr))}return{id:"structure",name:"Structure & completeness",score:Math.round(o),max:10,findings:n,suggestions:r}}function Hb(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=Hr(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&&(Cu.includes(a)||Cu.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 Gb(e,t){let s=[],i=[],n=0,r=hi(t,Bb);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.'),Kb(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=Vb(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=Hr(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 Yb(e,t){let s=[],i=[],n=0,r=Hr(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=hi(t,jb);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=>Lu(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 Wb(e,t){let s=[],i=[],n=0,r=hi(t,qb);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 zb(e,t){let s=[],i=[],n=0,r=hi(t,Fb);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 Qb(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 Qt(e){let{content:t,skillPath:s,skillMdPath:i,rootEntries:n}=e,r=re(t),{rawFrontmatter:o,body:a}=Iu(t),l=[Jb(r,a,o,n),Hb(r,a),Gb(r,a),Yb(r,a),Wb(r,a),zb(r,a),Qb(r,a)];if(r.name&&we(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(Vr)&&m.push(Vr);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 Ru(e){let t=Jr(e)?e:Kr(e),s;try{s=await dt(t)}catch{throw new Error(`Skill path does not exist: ${t}`)}let i,n;if(s.isFile())return i=t,n=await Ur(i,"utf-8"),Qt({content:n,skillPath:we(t)==="SKILL.md"?we(t):t,skillMdPath:i});if(!s.isDirectory())throw new Error(`Skill path is not a directory or file: ${t}`);i=pt(t,"SKILL.md");try{n=await Ur(i,"utf-8")}catch{throw new Error(`SKILL.md not found in ${t}. Run "asm init" to create one.`)}let r;try{r=await Nu(t)}catch{r=void 0}return Qt({content:n,skillPath:t,skillMdPath:i,rootEntries:r})}function Xb(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=Eu.indexOf(c);return d===-1?Eu.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 ew(e,t={}){let s=[],i=[],n=e.replace(/\r\n/g,`
|
|
213
213
|
`);n!==e&&s.push({id:"normalise-line-endings",description:"Convert CRLF line endings to LF."});let r=n.split(`
|
|
214
|
-
`),o=r.map(
|
|
215
|
-
`);let{rawFrontmatter:a,body:l}
|
|
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}=Iu(n),c=re(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=Br(d,"version","0.1.0"),s.push({id:"add-missing-version",description:"Add `version: 0.1.0`."})),!!!(c.author||c["metadata.author"]||c.creator||c["metadata.creator"])){let g=t.gitAuthor?.trim();g?(d=Br(d,"author",g),s.push({id:"add-missing-author",description:`Add \`author: ${g}\` from git config.`})):i.push({id:"add-missing-author",description:"Missing `author` \u2014 no git user.name found to fill in safely."})}if(!c.effort){let g=Xb(Lu(l));d=Br(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
216
|
${d.replace(/^\n+|\n+$/g,"")}
|
|
217
217
|
---
|
|
218
218
|
|
|
219
|
-
${
|
|
220
|
-
`)||(
|
|
219
|
+
${y}`;return h.endsWith(`
|
|
220
|
+
`)||(h+=`
|
|
221
221
|
`),e.replace(/\r\n/g,`
|
|
222
|
-
`),{newContent:
|
|
222
|
+
`),{newContent:h,applied:s,skipped:i}}function Br(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(`
|
|
223
223
|
`)?"":`
|
|
224
224
|
`;return`${e}${r}${t}: ${n}
|
|
225
|
-
`}function
|
|
225
|
+
`}function tw(e,t,s="SKILL.md"){if(e===t)return"";let i=e.split(`
|
|
226
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(
|
|
228
|
-
`)}async function
|
|
229
|
-
`)}function
|
|
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 Ou(e,t){let s=Jr(e)?e:Kr(e),i,n=await dt(s).catch(()=>null);if(!n)throw new Error(`Skill path does not exist: ${s}`);if(n.isFile())i=s;else if(n.isDirectory())i=pt(s,"SKILL.md");else throw new Error(`Skill path is not a directory or file: ${s}`);let r;try{r=await Ur(i,"utf-8")}catch{throw new Error(`SKILL.md not found at ${i}.`)}let o=ew(r,{gitAuthor:t.gitAuthor}),a=tw(r,o.newContent),l=null;return!t.dryRun&&o.newContent!==r&&(l=`${i}.bak`,await _b(i,l),await Db(i,o.newContent,"utf-8")),{report:Qt({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 Tu(){try{let{stdout:e,exitCode:t}=await H(["git","config","--global","--get","user.name"]);if(t!==0)return null;let s=e.trim();return s||null}catch{return null}}function sw(e,t,s=20){let i=Math.round(e/t*s);return"\u2588".repeat(i)+"\u2591".repeat(Math.max(0,s-i))}function gi(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} ${sw(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=iw(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 iw(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 Mu(e){return JSON.stringify(e,null,2)}function Du(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
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
|
|
232
|
-
`)}function
|
|
231
|
+
`)}async function nw(e){let t;try{t=await Nu(e)}catch{return[]}let s=[];for(let i of t){if(i.startsWith(".")||i==="node_modules"||i==="dist"||i==="build")continue;let n=pt(e,i),r;try{r=await dt(n)}catch{continue}if(!r.isDirectory())continue;let o=pt(n,"SKILL.md");try{(await dt(o)).isFile()&&s.push(n)}catch{}}return s.sort((i,n)=>we(i).localeCompare(we(n))),s}async function Au(e){let t=pt(e,"SKILL.md");try{if((await dt(t)).isFile())return{kind:"single",skillDirs:[e]}}catch{}let s=await nw(e);return s.length>0?{kind:"collection",skillDirs:s}:{kind:"none",skillDirs:[]}}function Gr(e){return e?!!(e.startsWith("github:")||/^https?:\/\/github\.com\//i.test(e)):!1}function Pu(e){return{skillPath:e,skillMdPath:pt(e,"SKILL.md"),label:we(e)}}async function _u(e,t={}){if(!e)throw new Error("resolveEvalInput: input must be a non-empty string");if(Gr(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 Au(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(Pu),isCollection:o.kind==="collection",cleanup:r.cleanup,provenance:{input:e,remote:!0,sourceRef:r.sourceRef,commitSha:r.commitSha,tempPath:r.rootDir}}}let s=Jr(e)?e:Kr(e),i;try{i=await dt(s)}catch{throw new Error(`Skill path does not exist: ${s}`)}if(i.isFile())return{targets:[{skillPath:we(s)==="SKILL.md"?we(s):s,skillMdPath:s,label:we(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 Au(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(Pu),isCollection:n.kind==="collection",cleanup:async()=>{},provenance:{input:e,remote:!1,sourceRef:null}}}function qu(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 Fu(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 ju(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 Bu(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?yi(t.report,null):null}))}}function yi(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 rw=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;function ow(e){if(typeof e!="string")return null;let t=rw.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 aw(e,t){let s=ow(e);if(!s)throw new Error(`invalid semver: ${t} "${e}"`);return s}var Yr=new Map;function Wr(e){if(!e||typeof e.id!="string"||e.id.length===0)throw new Error("register: provider.id is required");if(aw(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=Yr.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),Yr.set(e.id,t)}function bi(){let e=[];for(let t of Yr.values())for(let s of t)e.push(s);return e}import{stat as lw}from"fs/promises";var Uu="quality",Vu="1.0.0",Ku=1;function cw(e){return e.topSuggestions.map(t=>({severity:"info",message:t}))}function uw(e){return e.categories.map(t=>({id:t.id,name:t.name,score:t.score,max:t.max}))}var Ju={id:Uu,version:Vu,schemaVersion:Ku,description:"Static linter for SKILL.md structure, description, and safety.",async applicable(e){try{return(await lw(e.skillMdPath)).isFile()?{ok:!0}:{ok:!1,reason:`${e.skillMdPath} is not a file`}}catch{return{ok:!1,reason:`SKILL.md not found at ${e.skillMdPath}`}}},async run(e,t){let s=await Ru(e.skillPath);return{providerId:Uu,providerVersion:Vu,schemaVersion:Ku,score:s.overallScore,passed:s.grade!=="F",categories:uw(s),findings:cw(s),raw:s,startedAt:"",durationMs:0}}};var zu=Zr($r(),1);import{readFile as fw,stat as dw}from"fs/promises";import{basename as pw}from"path";var Hu="skill-best-practice",Gu="1.1.0",Yu=1,mw=new Set(["name","description","license","allowed-tools","metadata","compatibility","effort"]),Wu=new Set(["low","medium","high","xhigh","max"]),zr=250,hw=/^\d+\.\d+\.\d+$/;function gw(e){if(!e.startsWith("---"))return null;let t=e.split(`
|
|
233
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
|
|
235
|
-
`)&&!d.includes("\r")&&!d.includes("<")&&!d.includes(">")&&d.length<=1024;
|
|
236
|
-
`);return console.log=s,console.info=s,()=>{console.log=e,console.info=t}}function
|
|
237
|
-
---`,3);return s===-1?"":t.slice(s+4)}async function
|
|
238
|
-
`,"utf-8"),
|
|
234
|
+
`)}function wi(e){return{severity:e.severity,message:e.message,code:e.id,categoryId:"validation"}}function G(e,t,s,i,n,r){e.push({id:t,label:s,passed:i,severity:n,message:r})}function vi(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 yw(e){let t=await fw(e.skillMdPath,"utf-8"),s=[],i=gw(t);if(i===null){G(s,"missing-frontmatter","Frontmatter exists",!1,"error","SKILL.md must start with a YAML frontmatter block.");let x=vi(e,s,null);return{score:0,passed:!1,findings:s.map(wi),raw:x}}G(s,"frontmatter-present","Frontmatter exists",!0,"error","SKILL.md contains a YAML frontmatter block.");let n;try{n=(0,zu.parse)(i)}catch(x){G(s,"invalid-yaml","Frontmatter parses as YAML",!1,"error",`Invalid YAML in frontmatter: ${x?.message??String(x)}`);let $=vi(e,s,null);return{score:0,passed:!1,findings:s.map(wi),raw:$}}if(!n||typeof n!="object"||Array.isArray(n)){G(s,"frontmatter-not-object","Frontmatter is a mapping",!1,"error","Frontmatter must parse to a YAML object.");let x=vi(e,s,null);return{score:0,passed:!1,findings:s.map(wi),raw:x}}let r=n;G(s,"frontmatter-object","Frontmatter is a mapping",!0,"error","Frontmatter parses to a YAML object.");let o=Object.keys(r).filter(x=>!mw.has(x));G(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(G(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 x=/^[a-z0-9-]+$/.test(l)&&!l.startsWith("-")&&!l.endsWith("-")&&!l.includes("--")&&l.length<=64;G(s,"name-kebab-case","Name follows skill-best-practice naming rules",x,"error",x?"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(G(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 x=!d.includes(`
|
|
235
|
+
`)&&!d.includes("\r")&&!d.includes("<")&&!d.includes(">")&&d.length<=1024;G(s,"description-shape","Description follows skill-best-practice formatting rules",x,"error",x?"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 $=d.length<=zr;G(s,"description-runtime-budget","Description fits the runtime context budget",$,"warning",$?`Description is ${d.length} chars (target \u2264 ${zr}).`:`Description is ${d.length} chars; target \u2264 ${zr}. The /skills listing truncates tail-first, often chopping the negative-trigger clause.`)}let f=r.effort;G(s,"effort-enum","Effort uses the supported enum",f===void 0||typeof f=="string"&&Wu.has(f.trim()),"error",f===void 0||typeof f=="string"&&Wu.has(f.trim())?"Effort is omitted or uses a supported value.":"Effort must be one of: low, medium, high, xhigh, max.");let p=r.compatibility;if(p!==void 0){let x=typeof p=="string"&&p.length<=500;G(s,"compatibility-shape","Compatibility is a short string",x,"error",x?"Compatibility is a valid short string.":"Compatibility must be a string no longer than 500 characters.")}let m=r.metadata&&typeof r.metadata=="object"&&!Array.isArray(r.metadata)?r.metadata:null,y=m?.version,h=typeof y=="string"||typeof y=="number"?String(y).trim():"",g=h.length>0;if(G(s,"metadata-version-present","metadata.version is present",g,"error",g?"Frontmatter declares `metadata.version`.":"Frontmatter must declare `metadata.version` (start new skills at 1.0.0)."),g){let x=hw.test(h);G(s,"metadata-version-semver","metadata.version follows MAJOR.MINOR.PATCH",x,"error",x?"`metadata.version` follows semantic versioning.":`\`metadata.version\` must follow semantic versioning (e.g. 1.0.0); got "${h}".`)}let b=m?.author,v=typeof b=="string"&&b.trim().length>0;if(G(s,"metadata-author-present","metadata.author is present",v,"warning",v?"Frontmatter declares `metadata.author`.":"Add `metadata.author` (recommended for published skills) so users know who maintains the skill."),l.length>0){let x=pw(e.skillPath),$=x===l;G(s,"name-matches-directory","Name matches the parent directory",$,"error",$?"Frontmatter `name` matches the skill directory.":`Frontmatter \`name\` ("${l}") must match the parent directory ("${x}").`)}let w=/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);G(s,"negative-trigger-clause","Description includes a negative-trigger clause",w,"warning",w?"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 S=vi(e,s,r),k=S.checkCount===0?100:Math.round(S.passedChecks/S.checkCount*100),P=s.filter(x=>!x.passed).map(wi);return{score:k,passed:P.every(x=>x.severity!=="error"),findings:P,raw:S}}var Qu={id:Hu,version:Gu,schemaVersion:Yu,description:"Deterministic SKILL.md best-practice validation (rules aligned with the skill-creator standard, v1.7.1).",async applicable(e){try{return(await dw(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 yw(e);return{providerId:Hu,providerVersion:Gu,schemaVersion:Yu,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 Xu(){Wr(Ju),Wr(Qu)}var Zu=!1;function ki(){Zu||(Xu(),Zu=!0)}function Si(){return ki(),bi()}function ef(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function tf(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 $i(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: ${ef(p)}`;return tf(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 tf(r,i,d,ef(c),"provider-threw")}finally{a&&clearTimeout(a)}}function bw(e){return e>=90?"A":e>=80?"B":e>=65?"C":e>=50?"D":"F"}function sf(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 nf(e,t){return{providerId:e.providerId,providerVersion:e.providerVersion,schemaVersion:e.schemaVersion,passed:e.passed,overallScore:e.score,grade:bw(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 Xt(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 X={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 We(){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 rf(e){return{timestamp:new Date().toISOString(),asm_version:Co,duration_ms:Math.round(performance.now()-e)}}function z(e,t,s){let i={version:1,command:e,status:"ok",data:t,meta:rf(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:rf(i)},o=process.stdout.isTTY?2:0;return JSON.stringify(r,null,o)}import{writeFile as Lw,mkdir as Rw,unlink as Ow,readFile as Tw,readdir as Mw}from"fs/promises";import{join as Zt}from"path";import{readdir as ww,readFile as vw}from"fs/promises";import{join as kw}from"path";function Qr(e){let t=new Set,s=e.toLowerCase().split(/[\s\-_.,;:()[\]{}"']+/);for(let i of s)i.length>=2&&t.add(i);return t}var Sw=10,$w=5,xw=3,Ew=1;function Cw(e,t){let s=Qr(e),i=Qr(t.name),n=Qr(t.description),r=0;for(let o of s)i.has(o)&&(r+=Sw),n.has(o)&&(r+=xw),t.name.toLowerCase().includes(o)&&(r+=$w),t.description.toLowerCase().includes(o)&&(r+=Ew);return r}async function of(e){let t=new Map,s;try{s=await ww(e)}catch{return t}for(let i of s){if(!i.endsWith(".json"))continue;let n=kw(e,i);try{let r=await vw(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 xi(){let e=await of(io()),t=await of(gt()),s=new Map(e);for(let[i,n]of t)s.set(i,n);return Array.from(s.values())}var Aw=["license","creator","version"];function af(e){return Aw.includes(e)}function lf(e,t){return e[t]||""}function Pw(e,t){if(t.has){for(let s of t.has)if(af(s)&&!lf(e,s))return!1}if(t.missing){for(let s of t.missing)if(af(s)&&lf(e,s))return!1}return!0}function cf(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 Ei(e,t=20,s){let i=await xi(),n=[],r=!e&&s;for(let o of i)for(let a of o.skills){if(s&&!Pw(a,s))continue;let l=r?1:Cw(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 uf(){return(await xi()).reduce((t,s)=>t+s.skillCount,0)}var Nw=[{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 ff(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"),Iw(t).trim().length<20&&s.push("SKILL.md body too short (less than 20 chars of instructions)");for(let{label:n,pattern:r}of Nw)r.test(t)&&s.push(`malicious pattern detected: ${n}`);return{verified:s.length===0,reasons:s}}function Iw(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 Dw(){let e=gt();return await Rw(e,{recursive:!0}),e}async function df(e){await De();let t;try{t=Te(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."};I(`ingester: cloning ${t.owner}/${t.repo}`);let s=null;try{s=await _e(t),I(`ingester: discovering skills in ${s}`);let i=await ls(s);I(`ingester: found ${i.length} skills`);let n=[];for(let l of i){let c=Zt(s,l.relPath,"SKILL.md"),d="";try{d=await Tw(c,"utf-8")}catch{I(`ingester: could not read SKILL.md at ${c}`)}let f=ff(l,d);f.verified||I(`ingester: ${l.name} not verified: ${f.reasons.join(", ")}`);let p=typeof l.tokenCount=="number"?l.tokenCount:d?ss(d):void 0,m,y;if(d){let h;try{h=await Mw(Zt(s,l.relPath))}catch{h=void 0}try{let g=Qt({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){I(`ingester: eval failed for ${l.name}: ${g}`)}try{let g={skillPath:Zt(s,l.relPath),skillMdPath:c},v=(await Promise.all(Xt(Si()).map(async w=>(await w.applicable(g,{})).ok?$i(w,g):null))).filter(w=>w!==null).map(w=>nf(w,l.version||void 0));v.length>0&&(y=Object.fromEntries(v.filter(w=>w.providerId).map(w=>[w.providerId,w])))}catch(g){I(`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 Dw(),a=Zt(o,`${t.owner}_${t.repo}.json`);return await Lw(a,JSON.stringify(r,null,2)+`
|
|
238
|
+
`,"utf-8"),I(`ingester: wrote index to ${a}`),{success:!0,repoIndex:r}}catch(i){return{success:!1,repoIndex:null,error:i.message}}finally{s&&await oe(s)}}async function pf(){return(await xi()).map(t=>({owner:t.owner,repo:t.repo,skillCount:t.skillCount,updatedAt:t.updatedAt})).sort((t,s)=>s.skillCount-t.skillCount)}async function mf(e,t){let s=gt(),i=Zt(s,`${e}_${t}.json`);try{return await Ow(i),!0}catch{return!1}}import{join as gf}from"path";function _w(e){switch(e){case"dangerous":return 3;case"warning":return 2;case"caution":return 1;default:return 0}}function Xr(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+_w(s.verdict),0)}}function qw(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:(E(`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:(E(`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:(E(`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))&&(E(`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))&&(E(`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:(E(`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:(E(`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("-")?(E(`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 E(e){console.error(u.red(`Error: ${e}`))}function Fw(){console.log(`${u.blueBold("agent-skill-manager")} (${u.bold("asm")}) ${Oi}
|
|
239
239
|
|
|
240
240
|
Interactive TUI and CLI for managing installed skills for AI coding agents.
|
|
241
241
|
|
|
@@ -280,11 +280,11 @@ ${u.bold("Global Options:")}
|
|
|
280
280
|
--sort <field> Sort by: name, version, or location (default: name)
|
|
281
281
|
--flat Show one row per tool instance (list, search)
|
|
282
282
|
-y, --yes Skip confirmation prompts
|
|
283
|
-
-V, --verbose Show debug output`)}function
|
|
283
|
+
-V, --verbose Show debug output`)}function jw(){console.log(`${u.bold("Usage:")} asm list [options]
|
|
284
284
|
|
|
285
285
|
List all discovered skills. By default, skills installed across multiple
|
|
286
286
|
tools are grouped into a single row with tool badges. When more than
|
|
287
|
-
${
|
|
287
|
+
${Ii} skills are present, a compact summary is
|
|
288
288
|
automatically prepended above the table.
|
|
289
289
|
|
|
290
290
|
${u.bold("Options:")}
|
|
@@ -314,7 +314,7 @@ ${u.bold("Examples:")}
|
|
|
314
314
|
asm list -s project ${u.dim("Only project-scoped skills")}
|
|
315
315
|
asm list --sort version ${u.dim("Sort by version")}
|
|
316
316
|
asm list --json ${u.dim("Output as JSON")}
|
|
317
|
-
asm list --machine ${u.dim("Machine-readable v1 envelope output")}`)}function
|
|
317
|
+
asm list --machine ${u.dim("Machine-readable v1 envelope output")}`)}function Bw(){console.log(`${u.bold("Usage:")} asm search <query> [options]
|
|
318
318
|
|
|
319
319
|
Search both installed skills and the skill index. Results show installation
|
|
320
320
|
status and include copy-paste install commands for available skills.
|
|
@@ -337,7 +337,7 @@ ${u.bold("Examples:")}
|
|
|
337
337
|
asm search "test" --installed ${u.dim("Search installed skills only")}
|
|
338
338
|
asm search "test" --available ${u.dim("Search available skills only")}
|
|
339
339
|
asm search openspec --json ${u.dim("Output matches as JSON")}
|
|
340
|
-
asm search openspec --machine ${u.dim("Machine-readable v1 envelope output")}`)}function
|
|
340
|
+
asm search openspec --machine ${u.dim("Machine-readable v1 envelope output")}`)}function Uw(){console.log(`${u.bold("Usage:")} asm inspect <skill-name> [options]
|
|
341
341
|
|
|
342
342
|
Show detailed information for a skill. The <skill-name> is the directory name.
|
|
343
343
|
Shows version, description, file count, and all provider installations.
|
|
@@ -351,7 +351,7 @@ ${u.bold("Options:")}
|
|
|
351
351
|
${u.bold("Examples:")}
|
|
352
352
|
asm inspect code-review ${u.dim("Show details for code-review")}
|
|
353
353
|
asm inspect code-review --json ${u.dim("Output as JSON")}
|
|
354
|
-
asm inspect code-review -s global ${u.dim("Global installations only")}`)}function
|
|
354
|
+
asm inspect code-review -s global ${u.dim("Global installations only")}`)}function Vw(){console.log(`${u.bold("Usage:")} asm uninstall <skill-name> [options]
|
|
355
355
|
|
|
356
356
|
Remove a skill and its associated rule files. Shows a removal plan
|
|
357
357
|
before proceeding and asks for confirmation.
|
|
@@ -365,7 +365,7 @@ ${u.bold("Options:")}
|
|
|
365
365
|
${u.bold("Examples:")}
|
|
366
366
|
asm uninstall code-review ${u.dim("Remove with confirmation")}
|
|
367
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
|
|
368
|
+
asm uninstall code-review -s project ${u.dim("Remove project copy only")}`)}function Kw(){console.log(`${u.bold("Usage:")} asm audit [subcommand] [options]
|
|
369
369
|
|
|
370
370
|
Detect duplicate skills or run security audits on installed/remote skills.
|
|
371
371
|
|
|
@@ -391,7 +391,7 @@ ${u.bold("Examples:")}
|
|
|
391
391
|
asm audit security code-review --json ${u.dim("Output audit as JSON")}
|
|
392
392
|
asm audit security code-review --machine ${u.dim("Machine-readable v1 envelope output")}
|
|
393
393
|
asm audit security https://github.com/user/skills/tree/main/skills/agent-config
|
|
394
|
-
${u.dim("Audit a skill from a subfolder URL")}`)}function
|
|
394
|
+
${u.dim("Audit a skill from a subfolder URL")}`)}function Jw(){console.log(`${u.bold("Usage:")} asm publish [path] [options]
|
|
395
395
|
|
|
396
396
|
Validate a skill, run a security audit, generate a registry manifest,
|
|
397
397
|
and open a PR against the asm-registry.
|
|
@@ -414,7 +414,7 @@ ${u.bold("Examples:")}
|
|
|
414
414
|
asm publish --dry-run ${u.dim("Preview manifest without side effects")}
|
|
415
415
|
asm publish --force ${u.dim("Override warning-level security findings")}
|
|
416
416
|
asm publish --json ${u.dim("Output as JSON")}
|
|
417
|
-
asm publish --machine ${u.dim("Machine-readable v1 envelope output")}`)}function
|
|
417
|
+
asm publish --machine ${u.dim("Machine-readable v1 envelope output")}`)}function Hw(){console.log(`${u.bold("Usage:")} asm outdated [options]
|
|
418
418
|
|
|
419
419
|
Show which installed skills have newer versions available.
|
|
420
420
|
|
|
@@ -427,7 +427,7 @@ ${u.bold("Options:")}
|
|
|
427
427
|
${u.bold("Examples:")}
|
|
428
428
|
asm outdated ${u.dim("Show outdated skills")}
|
|
429
429
|
asm outdated --json ${u.dim("Output as JSON")}
|
|
430
|
-
asm outdated --machine ${u.dim("Machine-readable output")}`)}function
|
|
430
|
+
asm outdated --machine ${u.dim("Machine-readable output")}`)}function Gw(){console.log(`${u.bold("Usage:")} asm update [name...] [options]
|
|
431
431
|
|
|
432
432
|
Update outdated skills to their latest version with security re-audit.
|
|
433
433
|
|
|
@@ -445,7 +445,7 @@ ${u.bold("Examples:")}
|
|
|
445
445
|
asm update ${u.dim("Update all outdated skills")}
|
|
446
446
|
asm update code-review ${u.dim("Update a specific skill")}
|
|
447
447
|
asm update --yes ${u.dim("Skip confirmation prompts")}
|
|
448
|
-
asm update --json ${u.dim("Output as JSON")}`)}function
|
|
448
|
+
asm update --json ${u.dim("Output as JSON")}`)}function Yw(){console.log(`${u.bold("Usage:")} asm config <subcommand>
|
|
449
449
|
|
|
450
450
|
Manage configuration. Config is stored at ~/.config/agent-skill-manager/.
|
|
451
451
|
|
|
@@ -461,19 +461,19 @@ ${u.bold("Options:")}
|
|
|
461
461
|
${u.bold("Examples:")}
|
|
462
462
|
asm config show ${u.dim("View current config")}
|
|
463
463
|
asm config edit ${u.dim("Edit in $EDITOR")}
|
|
464
|
-
asm config reset -y ${u.dim("Reset without confirmation")}`)}async function
|
|
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(
|
|
466
|
-
`))}}async function
|
|
467
|
-
`)),e.flags.flat?console.log(
|
|
468
|
-
${u.bold("Proceed with removal?")} [y/N] `);let a=await
|
|
469
|
-
Done.`))}function
|
|
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
|
|
471
|
-
Auto-removing duplicates...`));for(let o of r.duplicateGroups){let a
|
|
472
|
-
Done.`))}}async function
|
|
473
|
-
Usage: asm audit security <name|github:owner/repo> [--all]`),process.exit(2))}async function
|
|
474
|
-
`);let o=[];for(let a of r){console.error(` Scanning ${u.bold(a.name)}...`);let l=await
|
|
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
|
|
476
|
-
`);let a=await
|
|
464
|
+
asm config reset -y ${u.dim("Reset without confirmation")}`)}async function yf(e){for(let t of e)t.warnings=await Ic(t)}async function Ww(e){if(e.flags.help){jw();return}let t=performance.now(),s=await B(),i=await ee(s,e.flags.scope);e.flags.provider&&e.command==="list"&&(i=i.filter(r=>r.provider===e.flags.provider)),await yf(i);let n=Ai(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(z("list",r,t));return}if(e.flags.json)console.log(Y(n));else if(e.flags.flat){let r=Ni(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(Li(n));else if(e.flags.groupBy){let{skills:r,hint:o}=is(n,e.flags.limit);console.log(ho(r,e.flags.groupBy)),o&&console.log(o)}else if(e.flags.compact){let{skills:r,hint:o}=is(n,e.flags.limit);console.log(mo(r)),o&&console.log(o)}else{let r=[];n.length>Ii&&(r.push(Li(n,{showHint:!1})),r.push(""));let{skills:o,hint:a}=is(n,e.flags.limit);r.push(go(o)),a&&r.push(a),console.log(r.join(`
|
|
466
|
+
`))}}async function zw(e){if(e.flags.help){Bw();return}let t=e.flags.machine?We():void 0,s=performance.now(),i=e.subcommand;i||(e.flags.machine&&(t?.(),console.log(Z("search",X.INVALID_ARGUMENT,"Missing required argument: <query>",s)),process.exit(2)),E("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 B(),f=await ee(d,e.flags.scope);e.flags.provider&&(f=f.filter(m=>m.provider===e.flags.provider));let p=oo(f,i);o=Ai(p,e.flags.sort)}let a=[];if(r&&(a=await Ei(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(z("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(Y([...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(Ni(o)):console.log(yo(o,i))),c){l&&console.error("");let d=bo(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 Qw(e){if(e.flags.help){Uw();return}let t=e.subcommand;t||(E("Missing required argument: <skill-name>"),console.error('Run "asm inspect --help" for usage.'),process.exit(2));let s=await B(),n=(await ee(s,e.flags.scope)).filter(r=>r.dirName===t);n.length===0&&(E(`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 yf(n),e.flags.json?console.log(Y(n.length===1?n[0]:n)):console.log(await wo(n))}async function Xw(e){if(e.flags.help){Vw();return}let t=e.subcommand;t||(E("Missing required argument: <skill-name>"),console.error('Run "asm uninstall --help" for usage.'),process.exit(2));let s=await B(),i=await ee(s,e.flags.scope),n=lo(t,i,s),r=await co(n);r.length===0&&(E(`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")} ${po(a)}`);if(!e.flags.yes){process.stdin.isTTY||(E("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 Q();a.toLowerCase()!=="y"&&a.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let o=await Pi(n);for(let a of o)console.error(a);try{await ko(t)}catch{}console.error(u.green(`
|
|
469
|
+
Done.`))}function Q(){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 Zw(e){if(e.flags.help){Kw();return}let t=performance.now(),s=e.subcommand??"duplicates";if(s==="security"){await ev(e,t);return}s!=="duplicates"&&(E(`Unknown audit subcommand: "${s}". Use: duplicates, security`),process.exit(2));let i=await B(),n=await ee(i,"both"),r=Ri(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(z("audit duplicates",o,t));return}if(e.flags.json){console.log(Eo(r));return}if(console.log(xo(r)),e.flags.yes&&r.duplicateGroups.length>0){console.error(u.bold(`
|
|
471
|
+
Auto-removing duplicates...`));for(let o of r.duplicateGroups){let a=$o(o.instances),l=a[0].path;for(let c=1;c<a.length;c++){let d=a[c],f=ao(d,i),p=await Pi(f,l);for(let m of p)console.error(m)}}console.error(u.green(`
|
|
472
|
+
Done.`))}}async function ev(e,t){let s=e.positional[0];e.flags.all?await tv(e,t):s?s.startsWith("github:")||s.startsWith("https://github.com/")?await sv(e,s,t):await iv(e,s,t):(e.flags.machine&&(console.log(Z("audit security",X.INVALID_ARGUMENT,"Missing target. Provide a skill name, GitHub source, or use --all.",t)),process.exit(2)),E(`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 tv(e,t){let s=await B(),i=await ee(s,e.flags.scope);if(i.length===0){e.flags.machine?console.log(z("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 Le(a.realPath,a.name);o.push(l)}if(e.flags.machine)console.log(z("audit security",Xr(o),t));else if(e.flags.json)console.log(JSON.stringify(o,null,2));else{for(let l of o)console.log(ui(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 sv(e,t,s){let i=null;try{let n=Te(t);if(n.isLocal)throw new Error("Local paths are not supported for remote security audits. Use: asm audit security <installed-skill-name>");await De(),n=await as(n),console.error(`Cloning ${t} for audit...`),i=await _e(n,e.flags.transport);let{join:r}=await import("path"),o=n.subpath?r(i,n.subpath):i,{name:a}=await qe(o),l=await Le(o,a,n.owner,n.repo);e.flags.machine?console.log(z("audit security",Xr([l]),s)):e.flags.json?console.log(Mr(l)):console.log(ui(l))}catch(n){e.flags.machine&&(console.log(Z("audit security",X.AUDIT_FAILED,n.message,s)),process.exit(1)),E(n.message),process.exit(1)}finally{i&&await oe(i)}}async function iv(e,t,s){let i=await B(),r=(await ee(i,e.flags.scope)).filter(l=>l.dirName===t);r.length===0&&(e.flags.machine&&(console.log(Z("audit security",X.SKILL_NOT_FOUND,`Skill "${t}" not found.`,s)),process.exit(1)),E(`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 Le(o.realPath,o.name);e.flags.machine?console.log(z("audit security",Xr([a]),s)):e.flags.json?console.log(Mr(a)):console.log(ui(a))}async function nv(e){if(e.flags.help){Yw();return}let t=e.subcommand;switch(t||(E("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 B();console.log(Y(s));break}case"path":{console.log(ht());break}case"reset":{if(!e.flags.yes){process.stdin.isTTY||(E("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 Q();i.toLowerCase()!=="y"&&i.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let s=to();await no(s),console.error(u.green("Config reset to defaults."));break}case"edit":{let s=process.env.VISUAL||process.env.EDITOR||"vi",[i,n]=Ao(s),r=ht();await B();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:E(`Unknown config subcommand: "${t}". Use: show, path, reset, or edit.`),process.exit(2)}}function rv(){console.log(`${u.bold("Usage:")} asm install <source> [options]
|
|
477
477
|
|
|
478
478
|
Install a skill from a GitHub repository, the curated registry, or a local path.
|
|
479
479
|
|
|
@@ -545,27 +545,27 @@ ${u.bold("Subfolder URL:")}
|
|
|
545
545
|
${u.bold("Vercel skills CLI:")}
|
|
546
546
|
asm install github:user/skills --method vercel --skill my-skill
|
|
547
547
|
asm install https://github.com/user/skills -m vercel --skill my-skill -y
|
|
548
|
-
${u.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function
|
|
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:")} ${
|
|
550
|
-
${u.bold("Security warnings:")}`);let p=new Map;for(let
|
|
551
|
-
${
|
|
552
|
-
${u.cyan(`[Step ${a}/${o}]`)} ${u.bold(d)}`),c=()=>{n?
|
|
553
|
-
${u.cyan("\u25CF")} Resolving "${u.bold(i)}" from registry...`);let{resolved:
|
|
554
|
-
${u.yellow("\u26A0")} Multiple skills found for "${u.bold(i)}":`);let
|
|
555
|
-
Select a skill [1-${
|
|
556
|
-
Did you mean: ${
|
|
557
|
-
`);for(let
|
|
548
|
+
${u.dim("Delegates to npx skills add for Vercel tracking, then registers in asm")}`)}async function ov(e,t,s,i,n,r,o,a,l="global"){let c=await qe(i),d=await Mo(i),f=i===s?null:i.split(/[/\\]/).pop(),p=n||f||t.repo,m=Me(p),y=a.find(P=>P.name.toLowerCase()===c.name.toLowerCase()&&P.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=Bi(t,s,i,m,o,e.flags.force||g,l),v=d.some(P=>["Shell commands","Code execution","Credentials"].includes(P.category)),w=d.some(P=>["External URLs"].includes(P.category)),S=v?"high":w?"medium":"safe",k=v?u.red("[!] High Risk"):w?u.yellow("[~] Medium Risk"):u.green("[ok] Safe");return{metadata:c,skillName:m,warnings:d,installStatus:h,riskLevel:S,riskLabel:k,plan:b}}function av(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:")} ${uo(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 lv(e,t){return t?await Do(e,t):await cs(e)}async function cv(e){if(e.flags.help){rv();return}let t=e.flags.machine?We():void 0,s=performance.now(),i=e.subcommand;i||(E("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?oe(n).finally(()=>process.exit(1)):process.exit(1)};process.on("SIGINT",c),process.on("SIGTERM",c);try{if(!ji(i)&&await Oo(i)&&(i=`./${i}`),Er(i)){console.info(`
|
|
553
|
+
${u.cyan("\u25CF")} Resolving "${u.bold(i)}" from registry...`);let{resolved:N,multipleMatches:A,suggestions:_}=await Mc(i,{noCache:e.flags.noCache});if(N){r="registry";let O=N.manifest,M=O.repository.replace("https://github.com/","");i=O.skill_path?`github:${M}#${O.commit}:${O.skill_path}`:`github:${M}#${O.commit}`,console.info(` ${u.green("\u2713")} Resolved: ${u.bold(`${O.author}/${O.name}`)} @ ${O.commit.slice(0,7)}`)}else if(A.length>0){console.info(`
|
|
554
|
+
${u.yellow("\u26A0")} Multiple skills found for "${u.bold(i)}":`);let O=A.slice(0,5);for(let ne=0;ne<O.length;ne++){let le=O[ne];console.info(` ${u.cyan(`${ne+1}.`)} ${u.bold(`${le.author}/${le.name}`)} \u2014 ${le.description}`)}process.stdin.isTTY||(E(`Ambiguous skill name "${i}". Use a scoped name: asm install author/name`),process.exit(2));let M=`
|
|
555
|
+
Select a skill [1-${O.length}]: `;process.stderr.write(M);let ie=await new Promise(ne=>{let le="",ve=!1,es=setTimeout(()=>{ve||(ve=!0,process.stdin.removeListener("data",mt),ne(le.trim()))},3e4);function mt(vf){le=vf.toString().trim(),ve||(ve=!0,clearTimeout(es),process.stdin.removeListener("data",mt),ne(le))}process.stdin.setEncoding("utf-8"),process.stdin.on("data",mt)}),K=parseInt(ie,10);(isNaN(K)||K<1||K>O.length)&&(E("Invalid selection. Aborting."),process.exit(2));let U=O[K-1];r="registry";let ze=U.repository.replace("https://github.com/","");i=U.skill_path?`github:${ze}#${U.commit}:${U.skill_path}`:`github:${ze}#${U.commit}`,console.info(` ${u.green("\u2713")} Selected: ${u.bold(`${U.author}/${U.name}`)} @ ${U.commit.slice(0,7)}`)}else Cr(i)?(E(`Skill "${i}" not found in the registry.`),_.length>0&&console.error(`
|
|
556
|
+
Did you mean: ${_.map(O=>u.cyan(O)).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=Te(i),f=!!d.isLocal;if(f){let N=d.localPath;console.info(` ${u.dim(`local: ${N}`)}`);let{stat:A}=await import("fs/promises");try{if(!(await A(N)).isDirectory())throw new Error(`Path is not a directory: ${N}`)}catch(_){throw _.code==="ENOENT"?new Error(`Path does not exist: ${N}`):_}}else await De(),d=await as(d),console.info(` ${u.dim(i)}`);if(e.flags.method==="vercel"){console.info(l("Installing via Vercel skills CLI")),await _o();let N=Fo(d),A=e.flags.path||null;console.info(` ${u.dim(`npx skills add ${N}${A?` --skill ${A}`:""}`)}`);let{stdout:_,stderr:O}=await qo(N,A);_.trim()&&console.info(` ${u.dim(_.trim())}`),O.trim()&&console.error(` ${u.dim(O.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 B(),{provider:m,allProviders:y}=await Xe(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 N=[{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 A=await Qe({items:N});if(A.length===0)throw new Error("No scope selected. Aborting.");h=A[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 N=e.flags.transport,A=N==="ssh"?d.sshCloneUrl:N==="https"?d.cloneUrl:`${d.cloneUrl} ${u.dim("(auto)")}`;console.info(` ${A}${d.ref?` ${u.dim(`(ref: ${d.ref})`)}`:""}${d.subpath?` ${u.dim(`(path: ${d.subpath})`)}`:""}`),n=await _e(d,N)}let g=f?d.localPath:n;console.info(l("Scanning for skills"));let{join:b}=await import("path"),v=[],w=e.flags.path||d.subpath,S=[],k=!1,P=g,x="";if(w){let N=b(g,w),A=!1;try{await qe(N),A=!0}catch{if(!e.flags.all)throw new Error(`No SKILL.md found at path "${w}" in the repository.`);let{stat:_}=await import("fs/promises");try{if(!(await _(N)).isDirectory())throw new Error(`No SKILL.md found at path "${w}" in the repository.`)}catch(O){throw O&&O.code==="ENOENT"?new Error(`No SKILL.md found at path "${w}" in the repository.`):O}k=!0,P=N,x=w}A&&(console.info(` Found skill at ${u.bold(w)}`),S=[{skillDir:N,nameOverride:e.flags.name}])}else{let N=!1;try{await qe(g),N=!0}catch{}if(N){let A=await qe(g);console.info(` Found: ${u.bold(A.name)} v${A.version}`),S=[{skillDir:g,nameOverride:e.flags.name}]}else k=!0}if(k){console.info(x?` No SKILL.md at ${u.bold(x)}. Scanning subdirectories...`:" No SKILL.md at root. Scanning subdirectories...");let N=await ls(P),A=x?N.map(M=>({...M,relPath:`${x}/${M.relPath}`})):N;if(A.length===0)throw new Error(x?`No skills found under path "${x}". Skills must have a SKILL.md file.`:"No skills found in this repository. Skills must have a SKILL.md file.");console.info(` Found ${u.bold(String(A.length))} skill(s):
|
|
557
|
+
`);for(let M=0;M<A.length;M++){let ie=u.cyan(` ${String(M+1).padStart(String(A.length).length)})`);console.info(`${ie} ${u.bold(A[M].name)} ${u.dim(`v${A[M].version}`)} ${u.dim(`(${A[M].relPath})`)}`),A[M].description&&console.info(` ${u.dim(A[M].description)}`)}console.info(l("Selecting skills")),a--;let _;if(e.flags.all&&(e.flags.yes||!process.stdin.isTTY))_=A.map(M=>M.relPath),console.info(` Selected all ${u.bold(String(_.length))} skills`);else if(process.stdin.isTTY)if(A.length===1)_=[A[0].relPath],console.info(` Auto-selected: ${u.bold(A[0].name)} ${u.dim(`v${A[0].version}`)}`);else{let M=A.map(K=>({label:K.name,hint:`v${K.version}${K.description?" "+K.description:""}`,checked:!!e.flags.all}));console.info("");let ie=await Qe({items:M});if(ie.length===0)throw new Error("No skills selected. Aborting.");_=ie.map(K=>A[K].relPath),console.info(` Selected ${u.bold(String(_.length))} skill(s)`)}else{E(`Repository contains ${A.length} skills. Use --path <subdir> to pick one or --all to install all.
|
|
558
558
|
Available skills:
|
|
559
|
-
${
|
|
560
|
-
`)}`),process.exit(2);return}let
|
|
561
|
-
`),
|
|
562
|
-
${
|
|
563
|
-
Choose one path per skill name or install with --path.`);throw
|
|
564
|
-
${u.red("[!]")} ${u.bold(`Install ${
|
|
565
|
-
${u.bold(`Install ${
|
|
566
|
-
${u.yellow(`${
|
|
567
|
-
Done! Installed "${
|
|
568
|
-
${u.green(`Done! Installed ${
|
|
559
|
+
${A.map(M=>` --path ${M.relPath}`).join(`
|
|
560
|
+
`)}`),process.exit(2);return}let O=To(_);if(O.length>0){let M=O.map(K=>` - ${K.name}: ${K.paths.map(U=>`"${U}"`).join(", ")}`).join(`
|
|
561
|
+
`),ie=new Error(`Duplicate skill names detected in selection:
|
|
562
|
+
${M}
|
|
563
|
+
Choose one path per skill name or install with --path.`);throw ie.duplicates=O,ie}S=_.map(M=>({skillDir:b(g,M),nameOverride:_.length===1?e.flags.name:null})),a++}console.info(l("Inspecting skills"));let $=await ee(p,"both"),T=[],L=S.length>1;for(let N=0;N<S.length;N++){let{skillDir:A,nameOverride:_}=S[N],O=await ov(e,d,g,A,_,p,m,$,h);T.push(O),av(O,i,m,y,L,L?{index:N+1,total:S.length}:void 0)}if(L){console.info(""),console.info(` ${u.bold("Install settings:")}`),console.info(` ${u.bold("Source:")} ${i}`),console.info(y?` ${u.bold("Tool:")} All (${y.map(M=>M.label).join(", ")})`:` ${u.bold("Tool:")} ${m.label} (${m.name})`),console.info(` ${u.bold("Scope:")} ${h==="project"?"Project":"Global"}`);let N=T.filter(M=>M.riskLevel==="high").length,A=T.filter(M=>M.riskLevel==="medium").length,_=T.filter(M=>M.riskLevel==="safe").length,O=[];_>0&&O.push(u.green(`${_} Safe`)),A>0&&O.push(u.yellow(`${A} Medium Risk`)),N>0&&O.push(u.red(`${N} High Risk`)),console.info(` ${u.bold("Risk:")} ${O.join(", ")}`)}if(console.info(l("Installing")),!e.flags.yes){let N=T.some(M=>M.riskLevel==="high");process.stdin.isTTY||(E("Cannot prompt for confirmation in non-interactive mode. Use --yes to skip."),process.exit(2));let A=L?`${T.length} skills`:`"${T[0].metadata.name}"`,_=N?`
|
|
564
|
+
${u.red("[!]")} ${u.bold(`Install ${A}? Some have high-risk patterns.`)} [y/N] `:`
|
|
565
|
+
${u.bold(`Install ${A}?`)} [Y/n] `;process.stderr.write(_);let O=await Q();N?O.toLowerCase()!=="y"&&O.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0)):(O.toLowerCase()==="n"||O.toLowerCase()==="no")&&(console.error("Aborted."),process.exit(0))}let F=n?await So(n):null,D=[];for(let N=0;N<T.length;N++){let A=T[N],_=L?u.dim(`[${N+1}/${T.length}]`)+" ":" ";try{console.info(`${_}Installing ${u.bold(A.metadata.name)}...`);let O=await lv(A.plan,y);v.push(O),console.info(`${_}${u.green("\u2713")} ${A.metadata.name} installed to ${u.dim(A.plan.targetDir)}`);try{let M=f?`local:${d.localPath}`:`github:${d.owner}/${d.repo}`,ie=f?"local":r==="registry"?"registry":"github";await yt(O.name,{source:M,commitHash:F||"unknown",ref:d.ref||"main",installedAt:new Date().toISOString(),provider:A.plan.providerName,sourceType:ie,...r==="registry"?{registryName:O.name}:{}})}catch{}}catch(O){D.push({name:A.metadata.name,error:O.message}),console.error(`${_}${u.red("\u2717")} ${u.bold(A.metadata.name)} \u2014 ${u.red(O.message)}`)}}if(process.removeListener("SIGINT",c),process.removeListener("SIGTERM",c),D.length>0){console.error(`
|
|
566
|
+
${u.yellow(`${D.length} skill(s) failed to install:`)}`);for(let N of D)console.error(` ${u.red("\u2717")} ${N.name}: ${N.error}`)}if(e.flags.machine){t?.();let N=v.map(A=>({name:A.name,path:A.path,version:A.version,provider:A.provider,source:A.source,resolution_source:r}));console.log(z("install",N.length===1?N[0]:N,s))}else if(e.flags.json){let N=v.map(A=>({...A,resolutionSource:r}));console.log(JSON.stringify(N.length===1?N[0]:N,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",X.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 E(d.message);process.exit(1)}finally{n&&await oe(n),t?.()}}function uv(){console.log(`${u.bold("Usage:")} asm export [options]
|
|
569
569
|
|
|
570
570
|
Export skill inventory as a portable JSON manifest. Useful for backup,
|
|
571
571
|
sharing, or scripting.
|
|
@@ -578,7 +578,7 @@ ${u.bold("Options:")}
|
|
|
578
578
|
${u.bold("Examples:")}
|
|
579
579
|
asm export ${u.dim("Export all skills")}
|
|
580
580
|
asm export -s global ${u.dim("Export global skills only")}
|
|
581
|
-
asm export > skills.json ${u.dim("Save to file")}`)}async function
|
|
581
|
+
asm export > skills.json ${u.dim("Save to file")}`)}async function fv(e){if(e.flags.help){uv();return}let t=await B(),s=await ee(t,e.flags.scope),i=Dc(s);console.log(JSON.stringify(i,null,2))}function dv(){console.log(`${u.bold("Usage:")} asm import <file> [options]
|
|
582
582
|
|
|
583
583
|
Import skills from a previously exported JSON manifest. Recreates skill
|
|
584
584
|
installations based on the manifest metadata.
|
|
@@ -600,9 +600,9 @@ ${u.bold("Examples:")}
|
|
|
600
600
|
asm import skills.json --force ${u.dim("Overwrite existing skills")}
|
|
601
601
|
asm import skills.json -s global ${u.dim("Import only global skills")}
|
|
602
602
|
asm export > backup.json ${u.dim("Export first, then import later")}
|
|
603
|
-
asm import backup.json ${u.dim("Restore from backup")}`)}async function
|
|
604
|
-
${u.bold("Proceed?")} [y/N] `);let l=await
|
|
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
|
|
603
|
+
asm import backup.json ${u.dim("Restore from backup")}`)}async function pv(e){if(e.flags.help){dv();return}let t=e.subcommand;t||(E("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 jc(i)}catch(l){E(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 Q();l.toLowerCase()!=="y"&&l.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let a=await Bc(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 mv(){console.log(`${u.bold("Usage:")} asm init <name> [options]
|
|
606
606
|
|
|
607
607
|
Scaffold a new skill directory with a SKILL.md template. Creates a
|
|
608
608
|
ready-to-edit skill in the target tool's skill folder.
|
|
@@ -617,8 +617,8 @@ ${u.bold("Options:")}
|
|
|
617
617
|
${u.bold("Examples:")}
|
|
618
618
|
asm init my-skill ${u.dim("Scaffold (interactive tool)")}
|
|
619
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
|
|
621
|
-
${u.bold("Overwrite?")} [y/N] `);let n=await
|
|
620
|
+
asm init my-skill --path ./skills ${u.dim("Scaffold in custom directory")}`)}async function hv(e){if(e.flags.help){mv();return}let t=e.subcommand;t||(E("Missing required argument: <name>"),console.error('Run "asm init --help" for usage.'),process.exit(2));let s=Me(t),i;if(e.flags.path){let{resolve:n}=await import("path");i=n(e.flags.path)}else{let n=await B(),{provider:r}=await Xe(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 Vc(i)&&!e.flags.force){process.stdin.isTTY||(E(`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 Q();n.toLowerCase()!=="y"&&n.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}await Uc(s,i),console.error(u.green(`Done! Created skill "${s}" at ${i}`))}function gv(){console.log(`${u.bold("Usage:")} asm stats [options]
|
|
622
622
|
|
|
623
623
|
Show aggregate skill metrics with provider distribution charts,
|
|
624
624
|
scope breakdown, disk usage, and duplicate summary.
|
|
@@ -632,7 +632,7 @@ ${u.bold("Options:")}
|
|
|
632
632
|
${u.bold("Examples:")}
|
|
633
633
|
asm stats ${u.dim("Show full dashboard")}
|
|
634
634
|
asm stats -s global ${u.dim("Global skills only")}
|
|
635
|
-
asm stats --json ${u.dim("Output raw data as JSON")}`)}async function
|
|
635
|
+
asm stats --json ${u.dim("Output raw data as JSON")}`)}async function yv(e){if(e.flags.help){gv();return}let t=await B(),s=await ee(t,e.flags.scope);if(s.length===0){console.log("No skills found.");return}let i=Ri(s),n=await Jc(s,i);if(e.flags.json)if(e.flags.verbose)console.log(Y(n));else{let{perSkillDiskBytes:r,...o}=n;console.log(Y(o))}else console.log(Hc(n))}function bv(){console.log(`${u.bold("Usage:")} asm doctor [options]
|
|
636
636
|
|
|
637
637
|
Run environment health checks and diagnostics. Validates all
|
|
638
638
|
prerequisites for using asm \u2014 git, GitHub CLI, Node.js, config,
|
|
@@ -647,7 +647,7 @@ ${u.bold("Options:")}
|
|
|
647
647
|
${u.bold("Examples:")}
|
|
648
648
|
asm doctor ${u.dim("Run all health checks")}
|
|
649
649
|
asm doctor --json ${u.dim("Output as JSON")}
|
|
650
|
-
asm doctor --machine ${u.dim("Machine-readable v1 envelope output")}`)}async function
|
|
650
|
+
asm doctor --machine ${u.dim("Machine-readable v1 envelope output")}`)}async function wv(e){if(e.flags.help){bv();return}let t=performance.now(),s=await Su();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(z("doctor",i,t))}else e.flags.json?console.log(xu(s)):console.log($u(s));s.failures>0&&process.exit(1)}function vv(){console.log(`${u.bold("Usage:")} asm eval <target> [options]
|
|
651
651
|
|
|
652
652
|
Evaluate a skill's SKILL.md against best practices and produce a scored quality
|
|
653
653
|
report with recommendations. Zero configuration \u2014 just point it at a skill
|
|
@@ -683,8 +683,8 @@ ${u.bold("Examples:")}
|
|
|
683
683
|
asm eval ./my-skill --fix ${u.dim("Auto-fix deterministic issues")}
|
|
684
684
|
asm eval ./my-skill --fix --dry-run ${u.dim("Preview fixes as diff")}
|
|
685
685
|
asm eval ./my-skill --machine ${u.dim("Machine-readable v1 envelope")}
|
|
686
|
-
asm eval-providers list ${u.dim("List registered eval providers")}`)}function
|
|
687
|
-
`))}function
|
|
686
|
+
asm eval-providers list ${u.dim("List registered eval providers")}`)}function kv(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 Sv(e,t,s){await De();let i=Te(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 as(i);let n=await _e(i,t),r=i.subpath?gf(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 oe(n)},sourceRef:a,commitSha:o}}async function hf(e){ki();try{let t={skillPath:e.skillPath,skillMdPath:e.skillMdPath},s=(await Promise.all(Xt(Si()).map(async r=>(await r.applicable(t,{})).ok?$i(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 kv(i),{report:{...i.raw,providers:Xt(s.map(sf))},error:null}}catch(t){return{report:null,error:t?.message??String(t)}}}async function $v(e){if(e.flags.help){vv();return}let t=e.flags.machine?We():void 0,s=performance.now(),i=e.subcommand;if(i||(e.flags.machine&&(t?.(),console.log(Z("eval",X.INVALID_ARGUMENT,"Missing required argument: <skill-path>",s)),process.exit(2)),E("Missing required argument: <skill-path>"),console.error('Run "asm eval --help" for usage.'),process.exit(2)),e.flags.fix){if(Gr(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",X.INVALID_ARGUMENT,r,s)),process.exit(2)),E(r),process.exit(2)}try{let r=await Tu(),o=await Ou(i,{dryRun:e.flags.dryRun,gitAuthor:r});if(e.flags.machine){t?.(),console.log(z("eval",yi(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(gi(o.report)),console.log(""),console.log(Du(o));return}catch(r){e.flags.machine&&(t?.(),console.log(Z("eval",X.SKILL_NOT_FOUND,r?.message??String(r),s)),process.exit(1)),E(r?.message??String(r)),process.exit(1)}return}let n=null;try{n=await _u(i,{fetchRemote:r=>Sv(r,e.flags.transport,e.flags.keep)})}catch(r){e.flags.machine&&(t?.(),console.log(Z("eval",X.SKILL_NOT_FOUND,r?.message??String(r),s)),process.exit(1)),E(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 hf(c);if(!d)throw new Error(f??"eval failed");if(e.flags.machine){t?.();let p=yi(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(z("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(Mu(d));return}console.log(gi(d)),n.provenance.remote&&xv(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 Fu(n.targets,r,async c=>{let{report:d,error:f}=await hf(c);return{label:c.label,skillPath:c.skillPath,report:d,error:f}}),a=qu(o),l={provenance:n.provenance,aggregate:a,results:o};if(e.flags.machine){t?.(),console.log(z("eval",Bu(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(gi(c.report)):(console.log(`Skill evaluation: ${c.skillPath}`),console.log(` ${u.red("error:")} ${c.error??"unknown failure"}`)),console.log("");console.log(ju(l)),n.provenance.remote&&e.flags.verbose}catch(r){e.flags.machine&&(t?.(),console.log(Z("eval",X.SKILL_NOT_FOUND,r?.message??String(r),s)),process.exit(1)),E(r?.message??String(r)),process.exit(1)}finally{if(n)try{await n.cleanup()}catch{}}}function xv(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 Ev(){console.log(`${u.bold("Usage:")} asm eval-providers <subcommand> [options]
|
|
688
688
|
|
|
689
689
|
Manage evaluation providers registered with the ${u.bold("asm eval")} framework.
|
|
690
690
|
Providers implement the ${u.bold("EvalProvider")} contract (see src/eval/types.ts) and
|
|
@@ -700,7 +700,7 @@ ${u.bold("Options:")}
|
|
|
700
700
|
|
|
701
701
|
${u.bold("Examples:")}
|
|
702
702
|
asm eval-providers list ${u.dim("Show registered providers")}
|
|
703
|
-
asm eval-providers list --json ${u.dim("Machine-readable listing")}`)}async function
|
|
703
|
+
asm eval-providers list --json ${u.dim("Machine-readable listing")}`)}async function Cv(e){if(e.flags.help){Ev();return}let t=e.subcommand;switch(t||(E("Missing subcommand. Use: list"),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2)),t){case"list":{ki();let s=bi();if(e.flags.json){console.log(Y(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:E(`Unknown eval-providers subcommand: "${t}". Use: list`),console.error('Run "asm eval-providers --help" for usage.'),process.exit(2)}}function Av(){console.log(`${u.bold("Usage:")} asm link <path> [<path2> ...] [options]
|
|
704
704
|
|
|
705
705
|
Symlink a local skill directory into an agent's skill folder. Useful
|
|
706
706
|
for local development \u2014 changes to the source are reflected immediately.
|
|
@@ -724,13 +724,13 @@ ${u.bold("Examples:")}
|
|
|
724
724
|
asm link ./my-skill -p claude ${u.dim("Link to Claude Code")}
|
|
725
725
|
asm link ./my-skill --name alias ${u.dim("Link with custom name")}
|
|
726
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
|
|
728
|
-
${u.bold("Overwrite?")} [y/N] `);let n=await
|
|
729
|
-
${
|
|
730
|
-
Done! Linked ${
|
|
731
|
-
${u.bold(`Link ${a.length} skill(s)?`)} [Y/n] `);let
|
|
732
|
-
${p.length} linked, ${
|
|
733
|
-
Done! Linked ${p.length} skill(s) successfully.`)),
|
|
727
|
+
asm link ./skill1 ./skill2 ./skill3 -p claude ${u.dim("Link multiple skills at once")}`)}async function Pv(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 Q();return n.toLowerCase()!=="y"&&n.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0)),!0}async function Ci(e,t,s,i){let{join:n}=await import("path"),r=n(t,s),o=await Pv(r,i);return await Yc(e,t,s,o),{name:s,symlinkPath:r,targetPath:e}}async function Nv(e){if(e.flags.help){Av();return}let t=[];if(e.subcommand&&t.push(e.subcommand),t.push(...e.positional),t.length===0&&(E("Missing required argument: <path>"),console.error('Run "asm link --help" for usage.'),process.exit(2)),t.length>1){e.flags.name&&(E("--name cannot be used when linking multiple paths. Link each skill individually to use --name."),process.exit(2));let y=await B(),{provider:h}=await Xe(y,e.flags.provider,!!process.stdin.isTTY),{resolveProviderPath:g}=await import("./config-55HAAFSH.js"),b=g(y.providers.find(P=>P.name===h.name).global),{resolve:v,basename:w}=await import("path"),S=[],k=[];for(let P of t){let x=v(P),$=!1;try{await Ir(x),$=!0}catch{}if($){let T=w(x);try{let L=await Ci(x,b,T,!!e.flags.force);S.push(L),e.flags.json||console.error(u.green(` Linked "${L.name}" -> ${L.targetPath}`))}catch(L){let F=L instanceof Error?L.message:String(L);k.push({name:T,error:F}),e.flags.json||console.error(u.red(` Failed to link "${T}": ${F}`))}}else{let T=[];try{T=await Lr(x)}catch(L){let F=L instanceof Error?L.message:String(L);k.push({name:P,error:F}),e.flags.json||console.error(u.red(` Failed to process "${P}": ${F}`));continue}if(T.length===0){let L=`No SKILL.md found in ${x} or its immediate subdirectories.`;k.push({name:P,error:L}),e.flags.json||console.error(u.red(` ${L}`));continue}for(let L of T)try{let F=await Ci(L.absPath,b,L.dirName,!!e.flags.force);S.push(F),e.flags.json||console.error(u.green(` Linked "${F.name}" -> ${F.targetPath}`))}catch(F){let D=F instanceof Error?F.message:String(F);k.push({name:L.name,error:D}),e.flags.json||console.error(u.red(` Failed to link "${L.name}": ${D}`))}}}e.flags.json?console.log(Y({success:k.length===0,linked:S,failures:k})):k.length>0?console.error(u.yellow(`
|
|
729
|
+
${S.length} linked, ${k.length} failed.`)):console.error(u.green(`
|
|
730
|
+
Done! Linked ${S.length} skill(s) successfully.`)),k.length>0&&process.exit(1);return}let s=t[0],{resolve:i,basename:n}=await import("path"),r=i(s),o=!1;try{await Ir(r),o=!0}catch{}let a=[];o||(a=await Lr(r),a.length===0&&(E(`No SKILL.md found in ${r} or its immediate subdirectories.`),process.exit(1)),e.flags.name&&a.length>1&&(E(`--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 B(),{provider:c}=await Xe(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?Me(e.flags.name):n(r),h;try{h=await Ci(r,f,y,!!e.flags.force)}catch(g){let b=g instanceof Error?g.message:String(g);e.flags.json?console.log(Y({success:!1,error:b})):E(b),process.exit(2)}e.flags.json?console.log(Y({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 Q();(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?Me(e.flags.name):y.dirName;try{let g=await Ci(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(Y({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 Iv(){console.log(`${u.bold("Usage:")} asm index <subcommand> [options]
|
|
734
734
|
|
|
735
735
|
Manage the skill index for searching available skills from indexed repos.
|
|
736
736
|
|
|
@@ -754,10 +754,10 @@ ${u.bold("Examples:")}
|
|
|
754
754
|
asm index search marketing --has license ${u.dim("Only with license")}
|
|
755
755
|
asm index search "" --missing creator ${u.dim("Skills missing creator")}
|
|
756
756
|
asm index list ${u.dim("List indexed repos")}
|
|
757
|
-
asm index remove obra/superpowers ${u.dim("Remove from index")}`)}async function
|
|
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
|
|
759
|
-
`)}}break}case"list":{let s=await
|
|
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||(
|
|
757
|
+
asm index remove obra/superpowers ${u.dim("Remove from index")}`)}async function Lv(e){if(e.flags.help){Iv();return}let t=e.subcommand;switch(t||(E("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||(E("Missing required argument: <repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2)),console.error(u.blueBold(`Ingesting ${s}...`));let i=await df(s);i.success||(E(`Failed to ingest: ${i.error}`),process.exit(1)),i.repoIndex&&(e.flags.json?console.log(Y({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&&(E("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 Ei(s||"",20,i):await Ei(s);if(r.length===0){e.flags.json?console.log(Y([])):(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(Y(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 vo(o.skill.description,80))console.error(` ${c}`);let l=cf(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 pf();if(s.length===0){e.flags.json?console.log(Y([])):(console.info("No repositories indexed."),console.error(u.dim("Add repos with: asm index ingest <repo>")));return}let i=await uf();if(e.flags.json)console.log(Y(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||(E("Missing required argument: <owner/repo>"),console.error('Run "asm index --help" for usage.'),process.exit(2));let[i,n]=s.split("/");if((!i||!n)&&(E("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 Q();o.toLowerCase()!=="y"&&o.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}await mf(i,n)?console.error(u.green(`Removed ${i}/${n} from index`)):(E(`Repository not found in index: ${i}/${n}`),process.exit(1));break}default:E(`Unknown subcommand: "${t}"`),console.error('Run "asm index --help" for usage.'),process.exit(2)}}function Rv(){console.log(`${u.bold("Usage:")} asm bundle <subcommand> [options]
|
|
761
761
|
|
|
762
762
|
Create, install, and manage curated skill bundles. A bundle is a reusable
|
|
763
763
|
recipe of skills for a particular workflow, domain, or project setup.
|
|
@@ -793,14 +793,14 @@ ${u.bold("Examples:")}
|
|
|
793
793
|
asm bundle modify my-workflow --add github:u/r ${u.dim("Add a skill to bundle")}
|
|
794
794
|
asm bundle modify my-workflow --remove skill ${u.dim("Remove a skill from bundle")}
|
|
795
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
|
|
797
|
-
`));let
|
|
798
|
-
${u.bold("Description")} (optional, press Enter to skip): `);let
|
|
799
|
-
${u.bold("Install all skills from this bundle?")} [y/N] `);let f=await
|
|
800
|
-
Installing ${u.bold(f.name)}...`);try{(f.installUrl.startsWith("github:")||f.installUrl.startsWith("https://github.com/"))&&await
|
|
796
|
+
asm bundle export my-workflow out.json ${u.dim("Export bundle to file")}`)}async function Ov(e){if(e.flags.help){Rv();return}let t=e.subcommand;switch(t||(E("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||(E("Missing required argument: <name>"),console.error("Usage: asm bundle create <name>"),process.exit(2));let i=await B(),n=await ee(i,e.flags.scope);n.length===0&&(E("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 Qe({items:h});g.length===0&&(E("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=>Zc(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 Q();h.trim()&&(f=h.trim()),process.stderr.write(`${u.bold("Author")} (optional, press Enter to skip): `);let g=await Q();g.trim()&&(p=g.trim())}let m=Xc(s,f,p,d),y=await Or(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||(E("Missing required argument: <name|file>"),console.error("Usage: asm bundle install <name|file>"),process.exit(2));let i;try{i=await zt(s)}catch(f){E(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 Q();f.toLowerCase()!=="y"&&f.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let n=[],r=await B(),{provider:o}=await Xe(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 De();let m=Te(f.installUrl),y=!!m.isLocal,h=null;try{let g,b;y?(g=m.localPath,b=m.localPath):(h=await _e(m,e.flags.transport),g=h,b=m.subpath?gf(h,m.subpath):h);let v=await qe(b),w=Me(f.name||v.name||m.repo),S=Bi(m,g,b,w,o,e.flags.force,a);try{await jo(S.targetDir,S.force)}catch(k){if(k.message?.includes("--force")){n.push({name:f.name,status:"skipped",reason:"Already installed. Use --force to overwrite."}),console.error(` ${u.dim("---")} ${f.name} skipped (already installed)`);continue}throw k}await cs(S),n.push({name:f.name,status:"installed"}),console.error(` ${u.green("+++")} ${f.name} installed`)}finally{h&&await oe(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 eu();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
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
|
|
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||(
|
|
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||(
|
|
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:
|
|
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(
|
|
802
|
+
${u.dim("Install a bundle with: asm bundle install <name>")}`)}return}let i=await tu();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||(E("Missing required argument: <name|file>"),console.error("Usage: asm bundle show <name|file>"),process.exit(2));let i;try{i=await zt(s)}catch(n){E(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||(E("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 Q();n.toLowerCase()!=="y"&&n.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}let i;try{i=await su(s)}catch(n){E(n.message),process.exit(1)}i?console.error(u.green(`Bundle "${s}" removed.`)):(E(`Bundle "${s}" not found.`),process.exit(1));break}case"modify":{let s=e.positional[0];s||(E("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 zt(s)}catch(f){E(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 Q();f.trim()&&(i.description=f.trim(),n=!0),process.stderr.write(`${u.bold("New author")} (Enter to keep current): `);let p=await Q();p.trim()&&(i.author=p.trim(),n=!0),process.stderr.write(`${u.bold("New tags (comma-separated)")} (Enter to keep current): `);let m=await Q();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&&(E("Bundle must contain at least one skill after modification."),process.exit(1));let d=await Or(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||(E("Missing required argument: <name>"),console.error("Usage: asm bundle export <name> [output-file]"),process.exit(2));let i;try{i=await zt(s)}catch(l){E(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 Q();c.toLowerCase()!=="y"&&c.toLowerCase()!=="yes"&&(console.error("Aborted."),process.exit(0))}else e.flags.yes||(E(`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:E(`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 Tv(e){if(e.flags.help){Jw();return}let t=e.flags.machine?We():void 0,s=performance.now(),i=e.subcommand||".";try{let n=await lu({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",X.PUBLISH_FAILED,n.error||"Publish failed",s,{manifest:n.manifest,security_verdict:n.securityVerdict,fallback:n.fallback??!1})),process.exit(1)),console.log(z("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||(E(n.error||"Publish failed."),process.exit(1)),n.fallback){console.log(u.yellow("Manifest generated (gh CLI unavailable):")),console.log(cu(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",X.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)),E(n.message),process.exit(1)}}async function Mv(e){if(e.flags.help){Hw();return}let t=e.flags.machine?We():void 0,s=performance.now();try{let i=await Fr();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(z("outdated",r,s));return}if(e.flags.json){console.log(gu(i));return}let n=!e.flags.noColor&&process.stdout.isTTY!==!1;console.log(hu(i,n)),i.outdatedCount>0&&(process.exitCode=1)}catch(i){e.flags.machine&&(t?.(),console.log(Z("outdated",X.UNKNOWN_ERROR,i.message,s)),process.exit(1)),E(i.message),process.exit(1)}}async function Dv(e){if(e.flags.help){Gw();return}let t=e.flags.machine?We():void 0,s=performance.now(),i=[];e.subcommand&&i.push(e.subcommand),i.push(...e.positional);try{let n=await mu(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(z("update",o,s));return}if(e.flags.json){console.log(yu(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",X.UNKNOWN_ERROR,n.message,s)),process.exit(1)),E(n.message),process.exit(1)}}async function bf(e){let t=qw(e);if(t.flags.json&&t.flags.machine&&(E("--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&&eo(!0),t.flags.version){console.log(`asm ${Oi}`);let s=await mi();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){Fw();return}if(t.command)switch(t.command){case"list":await Ww(t);break;case"search":await zw(t);break;case"inspect":await Qw(t);break;case"uninstall":await Xw(t);break;case"audit":await Zw(t);break;case"install":await cv(t);break;case"config":await nv(t);break;case"export":await fv(t);break;case"import":await pv(t);break;case"init":await hv(t);break;case"stats":await yv(t);break;case"link":await Nv(t);break;case"index":await Lv(t);break;case"bundle":await Ov(t);break;case"publish":await Tv(t);break;case"outdated":await Mv(t);break;case"update":await Dv(t);break;case"doctor":await wv(t);break;case"eval":await $v(t);break;case"eval-providers":await Cv(t);break;default:E(`Unknown command: "${t.command}"`),console.error('Run "asm --help" for usage.'),process.exit(2)}}function wf(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(wf(process.argv))await bf(process.argv);else{let{main:e}=await import("./src-SVL3X6OZ.js");await e().catch(t=>{console.error("Fatal error:",t),process.exit(1)})}
|