useakit 0.1.0-dev.0 → 0.1.0-dev.11
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 -0
- package/dist/index.mjs +23 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,6 +12,7 @@ npx useakit init
|
|
|
12
12
|
npm install -g useakit
|
|
13
13
|
a-kit add release # install a skill in this project
|
|
14
14
|
a-kit add release -g # or in your home folder, for every project
|
|
15
|
+
a-kit add acme/release # name the organization when more than one of yours has it
|
|
15
16
|
a-kit update # bring installed skills to their latest version
|
|
16
17
|
a-kit list # your skills, and where they're installed
|
|
17
18
|
```
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{parseArgs as e,styleText as t}from"node:util";import n,{stdin as r,stdout as i}from"node:process";import a,*as o from"node:readline";import{ReadStream as s}from"node:tty";import{existsSync as c}from"node:fs";import{dirname as l,join as u,relative as d,resolve as f}from"node:path";import{homedir as p}from"node:os";import{spawn as m}from"node:child_process";import{chmod as h,mkdir as g,readFile as _,rm as v,writeFile as y}from"node:fs/promises";import{createHash as b}from"node:crypto";var x=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);const S=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),ee=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,te=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,ne=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,
|
|
2
|
+
import{parseArgs as e,styleText as t}from"node:util";import n,{stdin as r,stdout as i}from"node:process";import a,*as o from"node:readline";import{ReadStream as s}from"node:tty";import{existsSync as c}from"node:fs";import{dirname as l,join as u,relative as d,resolve as f}from"node:path";import{homedir as p}from"node:os";import{spawn as m}from"node:child_process";import{chmod as h,mkdir as g,readFile as _,rm as v,writeFile as y}from"node:fs/promises";import{createHash as b}from"node:crypto";var x=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);const S=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),ee=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,te=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,ne=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,C=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,w=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,re=/\t{1,1000}/y,ie=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,T=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,ae=/\p{M}+/gu,oe={limit:1/0,ellipsis:``},se=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?se(i,oe,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[T,l],[ne,0],[C,o],[re,s],[ie,c],[w,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,E=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(ae,``)){let t=e.codePointAt(0)||0;if(E=ee(t)?2:te(t)?u:l,x+E>v&&(_=Math.min(_,Math.max(y,f)+h)),x+E>r){g=!0;break outer}h+=e.length,x+=E}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===w?S(e.slice(p,n.lastIndex)):n===ie?1:n.lastIndex-p,E=h*i,x+E>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+E>r){g=!0;break outer}x+=E,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},E={limit:1/0,ellipsis:``,ellipsisWidth:0},D=(e,t={})=>se(e,E,t).width,ce=`]8;;`,le=RegExp(`(?:\\[(?<code>\\d+)m|\\${ce}(?<uri>.*))`,`y`),ue=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},de=e=>`[${e}m`,fe=e=>`${ce}${e}`,pe=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:D(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=D(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ce,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},me=e=>{let t=e.split(` `),n=t.length;for(;n&&!D(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},he=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=D(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=D(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),pe(s,r,t),c=D(s.at(-1)??``)}else{if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){pe(s,r,t),c=D(s.at(-1)??``);continue}s.push(``),c=0}c+i>t&&n.wordWrap===!1?(pe(s,r,t),c=D(s.at(-1)??``)):(s[s.length-1]+=r,c+=i)}}n.trim!==!1&&(s=s.map(e=>me(e)));let l=s.join(`
|
|
3
3
|
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){le.lastIndex=e+1;let t=le.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
4
4
|
`){a&&(r+=fe(``));let e=i?ue(i):void 0;i&&e&&(r+=de(e))}else t===`
|
|
5
5
|
`&&(i&&ue(i)&&(r+=de(i)),a&&(r+=fe(a)))}return r},ge=/\r?\n/;function O(e,t,n){return String(e).normalize().split(ge).map(e=>he(e,t,n)).join(`
|
|
@@ -12,10 +12,10 @@ import{parseArgs as e,styleText as t}from"node:util";import n,{stdin as r,stdout
|
|
|
12
12
|
`).length-1;this.output.write(k.cursor.move(-999,e*-1))}render(){let e=O(this._render(this)??``,process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(k.cursor.hide);else{let t=ye(this._prevFrame,e),n=Te(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-n),i=Math.max(0,t.numLinesBefore-n),a=t.lines.find(e=>e>=r);if(a===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(k.cursor.move(0,a-i)),this.output.write(k.erase.lines(1));let t=e.split(`
|
|
13
13
|
`);this.output.write(t[a]),this._prevFrame=e,this.output.write(k.cursor.move(0,t.length-a-1));return}if(t.lines.length>1){if(r<i)a=r;else{let e=a-i;e>0&&this.output.write(k.cursor.move(0,e))}this.output.write(k.erase.down());let t=e.split(`
|
|
14
14
|
`).slice(a);this.output.write(t.join(`
|
|
15
|
-
`)),this._prevFrame=e;return}}this.output.write(k.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},Oe=class extends De{options;cursor=0;get _value(){return this.options[this.cursor]?.value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,t=this.value!==void 0&&this.value.length===e.length;this.value=t?[]:e.map(e=>e.value)}toggleInvert(){let e=this.value;if(!e)return;let t=this._enabledOptions.filter(t=>!e.includes(t.value));this.value=t.map(e=>e.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter(e=>e!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let t=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0);this.cursor=this.options[t]?.disabled?A(t,1,this.options):t,this.on(`key`,(e,t)=>{t.name===`a`&&this.toggleAll(),t.name===`i`&&this.toggleInvert()}),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=A(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=A(this.cursor,1,this.options);break;case`space`:this.toggleValue()}})}};let ke=class extends De{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){let e=this._selectedValue;this.value=e===void 0?void 0:e.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:t})=>t===e.initialValue),n=t===-1?0:t;this.cursor=this.options[n]?.disabled?A(n,1,this.options):n,this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=A(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=A(this.cursor,1,this.options)}this.changeValue()})}};function Ae(){return n.platform===`win32`?!!n.env.CI||!!n.env.WT_SESSION||!!n.env.TERMINUS_SUBLIME||n.env.ConEmuTask===`{cmd::Cmder}`||n.env.TERM_PROGRAM===`Terminus-Sublime`||n.env.TERM_PROGRAM===`vscode`||n.env.TERM===`xterm-256color`||n.env.TERM===`alacritty`||n.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:n.env.TERM!==`linux`}const P=Ae(),je=()=>process.env.CI===`true`,F=(e,t)=>P?e:t,Me=F(`◆`,`*`),Ne=F(`■`,`x`),Pe=F(`▲`,`x`),I=F(`◇`,`o`),Fe=F(`┌`,`T`),L=F(`│`,`|`),R=F(`└`,`—`),Ie=F(`●`,`>`),Le=F(`○`,` `),Re=F(`◻`,`[•]`),ze=F(`◼`,`[+]`),Be=F(`◻`,`[ ]`),Ve=F(`●`,`•`),He=F(`◆`,`*`),Ue=F(`▲`,`!`),We=F(`■`,`x`),Ge=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,Me);case`cancel`:return t(`red`,Ne);case`error`:return t(`yellow`,Pe);case`submit`:return t(`green`,I);case`validating`:return t(`dim`,Me)}},Ke=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,L);case`cancel`:return t(`red`,L);case`error`:return t(`yellow`,L);case`submit`:return t(`green`,L)}};function qe(e,n){let r=[`${n?`${t(`cyan`,L)} `:``}${e.join(` • `)}`];return n&&r.push(t(`cyan`,R)),r}const Je=(e,t,n,r,i,a=!1)=>{let o=t,s=0;if(a)for(let t=r-1;t>=n;t--){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}else for(let t=n;t<r;t++){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}return{lineCount:o,removals:s}},
|
|
16
|
-
`);_.push(a),v+=a.length}if(v>d){let t=0,n=0,r=v,i=e-y,a=d,o=()=>Je(_,r,0,i,a),s=()=>Je(_,r,i+1,_.length,a,!0);m?({lineCount:r,removals:t}=o(),r>a&&(h||--a,{lineCount:r,removals:n}=s())):(h||--a,{lineCount:r,removals:n}=s(),r>a&&(--a,{lineCount:r,removals:t}=o())),t>0&&(m=!0,_.splice(0,t)),n>0&&(h=!0,_.splice(_.length-n,n))}let x=[];m&&x.push(u);for(let e of _)for(let t of e)x.push(t);return h&&x.push(u),x},
|
|
15
|
+
`)),this._prevFrame=e;return}}this.output.write(k.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},Oe=class extends De{options;cursor=0;get _value(){return this.options[this.cursor]?.value}get _enabledOptions(){return this.options.filter(e=>e.disabled!==!0)}toggleAll(){let e=this._enabledOptions,t=this.value!==void 0&&this.value.length===e.length;this.value=t?[]:e.map(e=>e.value)}toggleInvert(){let e=this.value;if(!e)return;let t=this._enabledOptions.filter(t=>!e.includes(t.value));this.value=t.map(e=>e.value)}toggleValue(){this.value===void 0&&(this.value=[]);let e=this.value.includes(this._value);this.value=e?this.value.filter(e=>e!==this._value):[...this.value,this._value]}constructor(e){super(e,!1),this.options=e.options,this.value=[...e.initialValues??[]];let t=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0);this.cursor=this.options[t]?.disabled?A(t,1,this.options):t,this.on(`key`,(e,t)=>{t.name===`a`&&this.toggleAll(),t.name===`i`&&this.toggleInvert()}),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=A(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=A(this.cursor,1,this.options);break;case`space`:this.toggleValue()}})}};let ke=class extends De{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){let e=this._selectedValue;this.value=e===void 0?void 0:e.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:t})=>t===e.initialValue),n=t===-1?0:t;this.cursor=this.options[n]?.disabled?A(n,1,this.options):n,this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=A(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=A(this.cursor,1,this.options)}this.changeValue()})}};function Ae(){return n.platform===`win32`?!!n.env.CI||!!n.env.WT_SESSION||!!n.env.TERMINUS_SUBLIME||n.env.ConEmuTask===`{cmd::Cmder}`||n.env.TERM_PROGRAM===`Terminus-Sublime`||n.env.TERM_PROGRAM===`vscode`||n.env.TERM===`xterm-256color`||n.env.TERM===`alacritty`||n.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:n.env.TERM!==`linux`}const P=Ae(),je=()=>process.env.CI===`true`,F=(e,t)=>P?e:t,Me=F(`◆`,`*`),Ne=F(`■`,`x`),Pe=F(`▲`,`x`),I=F(`◇`,`o`),Fe=F(`┌`,`T`),L=F(`│`,`|`),R=F(`└`,`—`),Ie=F(`●`,`>`),Le=F(`○`,` `),Re=F(`◻`,`[•]`),ze=F(`◼`,`[+]`),Be=F(`◻`,`[ ]`),Ve=F(`●`,`•`),He=F(`◆`,`*`),Ue=F(`▲`,`!`),We=F(`■`,`x`),Ge=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,Me);case`cancel`:return t(`red`,Ne);case`error`:return t(`yellow`,Pe);case`submit`:return t(`green`,I);case`validating`:return t(`dim`,Me)}},Ke=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,L);case`cancel`:return t(`red`,L);case`error`:return t(`yellow`,L);case`submit`:return t(`green`,L)}};function qe(e,n){let r=[`${n?`${t(`cyan`,L)} `:``}${e.join(` • `)}`];return n&&r.push(t(`cyan`,R)),r}const Je=(e,t,n,r,i,a=!1)=>{let o=t,s=0;if(a)for(let t=r-1;t>=n;t--){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}else for(let t=n;t<r;t++){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}return{lineCount:o,removals:s}},Ye=({cursor:e,options:n,style:r,output:i=process.stdout,maxItems:a=1/0,columnPadding:o=0,rowPadding:s=4})=>{let c=we(i)-o,l=Te(i),u=t(`dim`,`...`),d=Math.max(l-s,0),f=Math.max(Math.min(a,d),5),p=0;e>=f-3&&(p=Math.max(Math.min(e-f+3,n.length-f),0));let m=f<n.length&&p>0,h=f<n.length&&p+f<n.length,g=Math.min(p+f,n.length),_=[],v=0;m&&v++,h&&v++;let y=p+ +!!m,b=g-+!!h;for(let t=y;t<b;t++){let i=n[t],a=O(i?r(i,t===e):``,c,{hard:!0,trim:!1}).split(`
|
|
16
|
+
`);_.push(a),v+=a.length}if(v>d){let t=0,n=0,r=v,i=e-y,a=d,o=()=>Je(_,r,0,i,a),s=()=>Je(_,r,i+1,_.length,a,!0);m?({lineCount:r,removals:t}=o(),r>a&&(h||--a,{lineCount:r,removals:n}=s())):(h||--a,{lineCount:r,removals:n}=s(),r>a&&(--a,{lineCount:r,removals:t}=o())),t>0&&(m=!0,_.splice(0,t)),n>0&&(h=!0,_.splice(_.length-n,n))}let x=[];m&&x.push(u);for(let e of _)for(let t of e)x.push(t);return h&&x.push(u),x},Xe=[`${t(`dim`,`↑/↓`)} to navigate`,`${t(`dim`,`Space:`)} select`,`${t(`dim`,`Enter:`)} confirm`],z=(e,t)=>e.split(`
|
|
17
17
|
`).map(e=>t(e)).join(`
|
|
18
|
-
`),
|
|
18
|
+
`),Ze=e=>{let n=(e,n)=>{let r=e.label??String(e.value);return n===`disabled`?`${t(`gray`,Be)} ${z(r,e=>t([`strikethrough`,`gray`],e))}${e.hint?` ${t(`dim`,`(${e.hint??`disabled`})`)}`:``}`:n===`active`?`${t(`cyan`,Re)} ${r}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`:n===`selected`?`${t(`green`,ze)} ${z(r,e=>t(`dim`,e))}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`:n===`cancelled`?`${z(r,e=>t([`strikethrough`,`dim`],e))}`:n===`active-selected`?`${t(`green`,ze)} ${r}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`:n===`submitted`?`${z(r,e=>t(`dim`,e))}`:`${t(`dim`,Be)} ${z(r,e=>t(`dim`,e))}`},r=e.required??!0,i=e.showInstructions??!0;return new Oe({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValues:e.initialValues,required:r,cursorAt:e.cursorAt,validate(e){if(r&&(e===void 0||e.length===0))return`Please select at least one option.
|
|
19
19
|
${t(`reset`,t(`dim`,`Press ${t([`gray`,`bgWhite`,`inverse`],` space `)} to select, ${t(`gray`,t(`bgWhite`,t(`inverse`,` enter `)))} to submit`))}`},render(){let r=e.withGuide??j.withGuide,a=N(e.output,e.message,r?`${Ke(this.state)} `:``,`${Ge(this.state)} `),o=`${r?`${t(`gray`,L)}
|
|
20
20
|
`:``}${a}
|
|
21
21
|
`,s=this.value??[],c=(e,t)=>{if(e.disabled)return n(e,`disabled`);let r=s.includes(e.value);return t&&r?n(e,`active-selected`):r?n(e,`selected`):n(e,t?`active`:`inactive`)};switch(this.state){case`submit`:{let i=this.options.filter(({value:e})=>s.includes(e)).map(e=>n(e,`submitted`)).join(t(`dim`,`, `))||t(`dim`,`none`);return`${o}${N(e.output,i,r?`${t(`gray`,L)} `:``)}`}case`cancel`:{let i=this.options.filter(({value:e})=>s.includes(e)).map(e=>n(e,`cancelled`)).join(t(`dim`,`, `));return i.trim()===``?`${o}${t(`gray`,L)}`:`${o}${N(e.output,i,r?`${t(`gray`,L)} `:``)}${r?`
|
|
@@ -23,42 +23,42 @@ ${t(`gray`,L)}`:``}`}case`error`:{let n=r?`${t(`yellow`,L)} `:``,i=this.error.s
|
|
|
23
23
|
`).map((e,n)=>n===0?`${r?`${t(`yellow`,R)} `:``}${t(`yellow`,e)}`:` ${e}`).join(`
|
|
24
24
|
`),a=o.split(`
|
|
25
25
|
`).length,s=i.split(`
|
|
26
|
-
`).length+1;return`${o}${n}${
|
|
26
|
+
`).length+1;return`${o}${n}${Ye({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:n.length,rowPadding:a+s,style:c}).join(`
|
|
27
27
|
${n}`)}
|
|
28
28
|
${i}
|
|
29
29
|
`}default:{let n=r?`${t(`cyan`,L)} `:``,a=o.split(`
|
|
30
|
-
`).length,s=i?qe(
|
|
31
|
-
`),u=s.length+1;return`${o}${n}${
|
|
30
|
+
`).length,s=i?qe(Xe,r):r?[t(`cyan`,R)]:[],l=s.join(`
|
|
31
|
+
`),u=s.length+1;return`${o}${n}${Ye({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:n.length,rowPadding:a+u,style:c}).join(`
|
|
32
32
|
${n}`)}
|
|
33
33
|
${l}
|
|
34
|
-
`}}}}).prompt()},
|
|
34
|
+
`}}}}).prompt()},B={message:(e=[],{symbol:n=t(`gray`,L),secondarySymbol:r=t(`gray`,L),output:i=process.stdout,spacing:a=1,withGuide:o}={})=>{let s=[],c=o??j.withGuide,l=c?r:``,u=c?`${n} `:``,d=c?`${r} `:``;for(let e=0;e<a;e++)s.push(l);let f=Array.isArray(e)?e:e.split(`
|
|
35
35
|
`);if(f.length>0){let[e,...t]=f;e.length>0?s.push(`${u}${e}`):s.push(c?n:``);for(let e of t)e.length>0?s.push(`${d}${e}`):s.push(c?r:``)}i.write(`${s.join(`
|
|
36
36
|
`)}
|
|
37
|
-
`)},info:(e,n)=>{
|
|
37
|
+
`)},info:(e,n)=>{B.message(e,{...n,symbol:t(`blue`,Ve)})},success:(e,n)=>{B.message(e,{...n,symbol:t(`green`,He)})},step:(e,n)=>{B.message(e,{...n,symbol:t(`green`,I)})},warn:(e,n)=>{B.message(e,{...n,symbol:t(`yellow`,Ue)})},warning:(e,t)=>{B.warn(e,t)},error:(e,n)=>{B.message(e,{...n,symbol:t(`red`,We)})}},Qe=(e=``,n)=>{let r=n?.output??process.stdout,i=n?.withGuide??j.withGuide?`${t(`gray`,R)} `:``;r.write(`${i}${t(`red`,e)}
|
|
38
38
|
|
|
39
|
-
`)},
|
|
40
|
-
`)},
|
|
39
|
+
`)},V=(e=``,n)=>{let r=n?.output??process.stdout,i=n?.withGuide??j.withGuide?`${t(`gray`,Fe)} `:``;r.write(`${i}${e}
|
|
40
|
+
`)},H=(e=``,n)=>{let r=n?.output??process.stdout,i=n?.withGuide??j.withGuide?`${t(`gray`,L)}
|
|
41
41
|
${t(`gray`,R)} `:``;r.write(`${i}${e}
|
|
42
42
|
|
|
43
|
-
`)}
|
|
43
|
+
`)},$e=e=>t(`magenta`,e),et=({indicator:e=`dots`,onCancel:n,output:r=process.stdout,cancelMessage:i,errorMessage:a,frames:o=P?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],delay:s=P?80:120,signal:c,...l}={})=>{let u=je(),d,f,p=!1,m=!1,h=``,g,_=performance.now(),v=we(r),y=l?.styleFrame??$e,b=e=>{let t=e>1?a??j.messages.error:i??j.messages.cancel;m=e===1,p&&(T(t,e),m&&typeof n==`function`&&n())},x=()=>b(2),S=()=>b(1),ee=()=>{process.on(`uncaughtExceptionMonitor`,x),process.on(`unhandledRejection`,x),process.on(`SIGINT`,S),process.on(`SIGTERM`,S),process.on(`exit`,b),c&&c.addEventListener(`abort`,S)},te=()=>{process.removeListener(`uncaughtExceptionMonitor`,x),process.removeListener(`unhandledRejection`,x),process.removeListener(`SIGINT`,S),process.removeListener(`SIGTERM`,S),process.removeListener(`exit`,b),c&&c.removeEventListener(`abort`,S)},ne=()=>{if(g===void 0)return;u&&r.write(`
|
|
44
44
|
`);let e=O(g,v,{hard:!0,trim:!1}).split(`
|
|
45
|
-
`);e.length>1&&r.write(k.cursor.up(e.length-1)),r.write(k.cursor.to(0)),r.write(k.erase.down())},
|
|
46
|
-
`);let i=0,a=0;ee(),f=setInterval(()=>{if(u&&h===g)return;ne(),g=h;let t=y(o[i]),n;if(u)n=`${t} ${h}...`;else if(e===`timer`)n=`${t} ${h} ${
|
|
45
|
+
`);e.length>1&&r.write(k.cursor.up(e.length-1)),r.write(k.cursor.to(0)),r.write(k.erase.down())},C=e=>e.replace(/\.+$/,``),w=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},re=l.withGuide??j.withGuide,ie=(n=``)=>{p=!0,d=Ce({output:r}),h=C(n),_=performance.now(),re&&r.write(`${t(`gray`,L)}
|
|
46
|
+
`);let i=0,a=0;ee(),f=setInterval(()=>{if(u&&h===g)return;ne(),g=h;let t=y(o[i]),n;if(u)n=`${t} ${h}...`;else if(e===`timer`)n=`${t} ${h} ${w(_)}`;else{let e=`.`.repeat(Math.floor(a)).slice(0,3);n=`${t} ${h}${e}`}let s=O(n,v,{hard:!0,trim:!1});r.write(s),i=i+1<o.length?i+1:0,a=a<4?a+.125:0},s)},T=(n=``,i=0,a=!1)=>{if(!p)return;p=!1,clearInterval(f),ne();let o=i===0?t(`green`,I):i===1?t(`red`,Ne):t(`red`,Pe);h=n??h,a||(e===`timer`?r.write(`${o} ${h} ${w(_)}
|
|
47
47
|
`):r.write(`${o} ${h}
|
|
48
|
-
`)),te(),d()};return{start:
|
|
48
|
+
`)),te(),d()};return{start:ie,stop:(e=``)=>T(e,0),message:(e=``)=>{h=C(e??h)},cancel:(e=``)=>T(e,1),error:(e=``)=>T(e,2),clear:()=>T(``,0,!0),get isCancelled(){return m}}},tt=[`${t(`dim`,`↑/↓`)} to navigate`,`${t(`dim`,`Enter:`)} confirm`],U=(e,t)=>e.includes(`
|
|
49
49
|
`)?e.split(`
|
|
50
50
|
`).map(e=>t(e)).join(`
|
|
51
|
-
`):t(e),
|
|
51
|
+
`):t(e),nt=e=>{let n=(e,n)=>{if(e===void 0)return``;let r=e.label??String(e.value);switch(n){case`disabled`:return`${t(`gray`,Le)} ${U(r,e=>t(`gray`,e))}${e.hint?` ${t(`dim`,`(${e.hint??`disabled`})`)}`:``}`;case`selected`:return`${U(r,e=>t(`dim`,e))}`;case`active`:return`${t(`green`,Ie)} ${r}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`;case`cancelled`:return`${U(r,e=>t([`strikethrough`,`dim`],e))}`;default:return`${t(`dim`,Le)} ${U(r,e=>t(`dim`,e))}`}},r=e.showInstructions??!0;return new ke({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let i=e.withGuide??j.withGuide,a=`${Ge(this.state)} `,o=`${Ke(this.state)} `,s=N(e.output,e.message,o,a),c=`${i?`${t(`gray`,L)}
|
|
52
52
|
`:``}${s}
|
|
53
53
|
`;switch(this.state){case`submit`:{let r=i?`${t(`gray`,L)} `:``;return`${c}${N(e.output,n(this.options[this.cursor],`selected`),r)}`}case`cancel`:{let r=i?`${t(`gray`,L)} `:``;return`${c}${N(e.output,n(this.options[this.cursor],`cancelled`),r)}${i?`
|
|
54
54
|
${t(`gray`,L)}`:``}`}default:{let a=i?`${t(`cyan`,L)} `:``,o=c.split(`
|
|
55
|
-
`).length,s=r?qe(
|
|
56
|
-
`),u=s.length+1;return`${c}${a}${
|
|
55
|
+
`).length,s=r?qe(tt,i):i?[t(`cyan`,R)]:[],l=s.join(`
|
|
56
|
+
`),u=s.length+1;return`${c}${a}${Ye({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:a.length,rowPadding:o+u,style:(e,t)=>n(e,e.disabled?`disabled`:t?`active`:`inactive`)}).join(`
|
|
57
57
|
${a}`)}
|
|
58
58
|
${l}
|
|
59
|
-
`}}}}).prompt()};`${t(`gray`,L)}`;var
|
|
60
|
-
`,{mode:384}),await h(n,384)}const
|
|
61
|
-
`)}async function
|
|
59
|
+
`}}}}).prompt()};`${t(`gray`,L)}`;var rt=`0.1.0`;const W=[{id:`claude-code`,name:`Claude Code`,projectDir:`.claude/skills`,globalDir:`.claude/skills`,marker:`.claude`},{id:`codex`,name:`Codex`,projectDir:`.agents/skills`,globalDir:`.agents/skills`,marker:`.codex`},{id:`cursor`,name:`Cursor`,projectDir:`.agents/skills`,globalDir:`.cursor/skills`,marker:`.cursor`},{id:`gemini-cli`,name:`Gemini CLI`,projectDir:`.agents/skills`,globalDir:`.gemini/skills`,marker:`.gemini`}],it=e=>e===`global`?p():process.cwd();function at(e=p()){return W.filter(t=>c(u(e,t.marker)))}function G(e){return W.find(t=>t.id===e)}function ot(e,t,n=it(t)){let r=e.map(e=>f(n,t===`global`?e.globalDir:e.projectDir));return[...new Set(r)]}const K=()=>!!(process.stdin.isTTY&&process.stdout.isTTY)&&!process.env.CI;function q(e){return Se(e)&&(Qe(`Cancelled.`),process.exit(130)),e}async function st(e,t){if(e.length>0)return e.map(e=>{let t=G(e);if(!t)throw Error(`Unknown agent "${e}". Use one of: ${W.map(e=>e.id).join(`, `)}.`);return t});let n=at(),r=n.length>0?n:[G(`claude-code`)];return!t||!K()?r:q(await Ze({message:`Which agents should get the skills?`,options:W.map(e=>({value:e.id,label:e.name,hint:n.includes(e)?`detected`:void 0})),initialValues:r.map(e=>e.id),required:!0})).map(e=>G(e))}async function ct(e,t){return e?`global`:!t||!K()?`project`:q(await nt({message:`Where should they go?`,options:[{value:`project`,label:`This project`,hint:process.cwd()},{value:`global`,label:`Everywhere`,hint:`your home folder`}],initialValue:`project`}))}async function lt(e,t,n){if(t.length>0){let r=[];for(let i of t){let t=ut(e,i);r.push(t.length===1?t[0]:await dt(t,n))}return r}if(!n||!K())throw Error("Name the skills to add, like `a-kit add my-skill`.");let r=q(await Ze({message:`Which skills?`,options:e.map(e=>({value:e.id,label:J(e),hint:e.description.length>60?`${e.description.slice(0,57)}…`:e.description})),required:!0}));return e.filter(e=>r.includes(e.id))}function ut(e,t){let n=t.lastIndexOf(`/`),r=t.slice(n+1),i=n===-1?null:t.slice(0,n).trim().toLowerCase(),a=e.filter(e=>e.name===r&&(i===null||e.organizationName.toLowerCase()===i));if(a.length===0)throw Error(i===null?`There's no skill named "${r}" in your agent kit. See them with \`a-kit list\`.`:`There's no skill named "${r}" in an organization called "${t.slice(0,n)}". See them with \`a-kit list\`.`);return a}async function dt(e,t){let n=e[0].name;if(!t||!K()){let t=e.map(e=>{let t=ft(e);return`\`a-kit add ${/\s/.test(t)?`"${t}"`:t}\``});throw Error(`More than one of your organizations has a skill named "${n}". Say which one: ${t.join(` or `)}.`)}let r=q(await nt({message:`More than one of your organizations has "${n}". Which one?`,options:e.map(e=>({value:e.id,label:ft(e)}))}));return e.find(e=>e.id===r)}const ft=e=>`${e.organizationName}/${e.name}`,J=e=>e.showOrganization?`${e.name} (${e.organizationName})`:e.name;var Y=class extends Error{status;code;constructor(e,t,n){super(n),this.status=e,this.code=t}};function X(e,t,n=fetch){async function r(r,i={}){let a;try{a=await n(`${e}${r}`,{...i,headers:{"User-Agent":`a-kit/${rt}`,...i.body?{"Content-Type":`application/json`}:{},...t?{Authorization:`Bearer ${t}`}:{},...i.headers}})}catch{throw new Y(0,`NETWORK`,`Couldn't reach ${e}.`)}if(!a.ok){let e=await a.json().catch(()=>null);throw a.status===401?new Y(401,`UNAUTHORIZED`,"You're not logged in. Run `a-kit login`."):new Y(a.status,e?.code??`HTTP_ERROR`,e?.message??`${i.method??`GET`} ${r} failed (${a.status})`)}return a}let i=async(e,t)=>await(await r(e,t)).json();return{me:()=>i(`/me`),logout:()=>r(`/auth/logout`,{method:`POST`}),startLogin:()=>i(`/auth/cli`,{method:`POST`}),pollLogin:e=>i(`/auth/cli/token`,{method:`POST`,body:JSON.stringify({deviceCode:e})}),listSkills:async()=>{let[e,t]=await Promise.all([i(`/skills`),i(`/orgs`)]),n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>({...e,organizationName:n.get(e.organizationId)??``,showOrganization:t.length>1}))},getSkill:e=>i(`/skills/${e}`),getBlob:async(e,t)=>new Uint8Array(await(await r(`/skills/${e}/blobs/${t}`)).arrayBuffer())}}function pt(e){let[t,n]=process.platform===`darwin`?[`open`,[e]]:process.platform===`win32`?[`cmd`,[`/c`,`start`,``,e.replace(/&/g,`^&`)]]:[`xdg-open`,[e]];try{let e=m(t,n,{stdio:`ignore`,detached:!0});e.on(`error`,()=>{}),e.unref()}catch{}}function Z(){return(process.env.AGENT_KIT_API_URL??`https://api-dev.agent-kit.fausanchez.com`??`http://localhost:8787`).replace(/\/+$/,``)}function mt(){return process.env.AGENT_KIT_CONFIG_DIR?process.env.AGENT_KIT_CONFIG_DIR:process.platform===`win32`&&process.env.APPDATA?u(process.env.APPDATA,`agent-kit`):u(process.env.XDG_CONFIG_HOME??u(p(),`.config`),`agent-kit`)}const ht=()=>u(mt(),`credentials.json`);async function gt(){try{return JSON.parse(await _(ht(),`utf8`))}catch{return{}}}async function _t(){return(await gt())[Z()]??null}async function vt(e){let t=await gt();e?t[Z()]=e:delete t[Z()];let n=ht();await g(l(n),{recursive:!0,mode:448}),await y(n,JSON.stringify(t,null,2)+`
|
|
60
|
+
`,{mode:384}),await h(n,384)}const yt=e=>new Promise(t=>setTimeout(t,e));async function bt(){let e=await X(Z()).startLogin();B.step(`Your code: ${e.userCode}\nApprove it in your browser: ${e.verificationUrl}`),pt(e.verificationUrl);let t=et();t.start(`Waiting for you to approve it`);let n=X(Z()),r=Date.now()+e.expiresIn*1e3;for(;Date.now()<r;){await yt(e.interval*1e3);let r;try{r=await n.pollLogin(e.deviceCode)}catch(e){if(e instanceof Y&&e.status===410)break;if(e instanceof Y&&e.code===`NETWORK`)continue;throw t.error(`Login failed`),e}if(r.status===`approved`){let n={token:r.token,user:r.user,webUrl:new URL(e.verificationUrl).origin};return await vt(n),t.stop(`Logged in as ${r.user.email}`),n}}throw t.error(`The code expired`),Error(`The login expired before it was approved. Run it again.`)}async function xt(){let e=await _t();if(!e)return null;try{let t=await X(Z(),e.token).me();return{...e,user:t}}catch(e){if(e instanceof Y&&e.status===401)return await vt(null),null;throw e}}async function St(){let e=await _t();if(!e)throw Error("You're not logged in. Run `a-kit login` first.");return{api:X(Z(),e.token),credentials:e}}const Ct={maxFiles:200,maxFileBytes:1048576,maxSkillBytes:10485760,maxPathLength:255},wt=/[\u0000-\u001f\u007f\\:]/;function Tt(e){if(e.trim()===``)return`The path is empty.`;if(e.length>Ct.maxPathLength)return`Paths can be at most ${Ct.maxPathLength} characters.`;if(e.startsWith(`/`))return`Use a relative path, without a leading /.`;if(wt.test(e))return`Paths can't contain \\, : or control characters.`;for(let t of e.split(`/`)){if(t===``)return`The path has an empty folder name (//).`;if(t===`.`||t===`..`)return`The path can't contain . or .. folders.`;if(t!==t.trim())return`Names can't start or end with a space.`}return null}const Et=e=>b(`sha256`).update(e).digest(`hex`);async function Dt(e,t,n){let r=await e.getSkill(t);if(!/^[a-z0-9-]+$/.test(r.name))throw Error(`"${r.name}" isn't a valid skill name.`);let i=[];for(let t of r.files){let n=Tt(t.path);if(n)throw Error(`${r.name}: ${t.path}: ${n}`);let a=await e.getBlob(r.id,t.sha256);if(Et(a)!==t.sha256)throw Error(`${r.name}: ${t.path} didn't download intact.`);i.push({path:t.path,bytes:a})}for(let e of n){let t=u(e,r.name);await v(t,{recursive:!0,force:!0});for(let e of i){let n=u(t,e.path);await g(l(n),{recursive:!0}),await y(n,e.bytes)}}return r}const Q=(e,t=process.cwd())=>e===`global`?u(mt(),`global.lock.json`):u(t,`agent-kit.lock.json`);async function $(e){try{return{version:1,skills:JSON.parse(await _(e,`utf8`)).skills??{}}}catch{return{version:1,skills:{}}}}async function Ot(e,t){let n=Object.fromEntries(Object.entries(t.skills).sort(([e],[t])=>e.localeCompare(t)));await g(l(e),{recursive:!0}),await y(e,JSON.stringify({...t,skills:n},null,2)+`
|
|
61
|
+
`)}async function kt(e,t,n,r){let i=t.find((e,n)=>t.some((t,r)=>r<n&&t.name===e.name));if(i)throw Error(`You picked more than one skill named "${i.name}"; they'd install to the same folder. Pick one.`);let a=ot(n,r),o=Q(r),s=await $(o),c=et();for(let r of t){c.start(`Installing ${r.name}`);try{let t=await Dt(e,r.id,a);s.skills[t.name]={id:t.id,version:t.version,agents:n.map(e=>e.id)},c.stop(`${t.name} v${t.version}`)}catch(e){throw c.error(`${r.name} failed`),await Ot(o,s),e}}return await Ot(o,s),{dirs:a,lockFile:o}}function At(e){let t=d(process.cwd(),e);return t&&!t.startsWith(`..`)?t:e}async function jt(e,t){V(`agent kit`);let{api:n}=await St(),r=!t.yes,{dirs:i}=await kt(n,await lt(await n.listSkills(),e,r),await st(t.agent,r),t.global?`global`:`project`);H(`Installed in ${i.map(At).join(`, `)}`)}async function Mt(e){V(`agent kit`);let t=await xt();t?B.success(`Logged in as ${t.user.email}`):t=await bt();let n=X(Z(),t.token),r=await n.listSkills();if(r.length===0){H(`You don't have skills yet. Create one at ${t.webUrl}/app/skills, then run \`a-kit add\`.`);return}let i=!e.yes;if(i&&!K())throw Error("`a-kit init` asks questions. Pass --yes to install every skill, or use `a-kit add <skill>`.");let a=await ct(e.global,i),o=await st(e.agent,i),s=i?q(await Ze({message:`Which skills?`,options:r.map(e=>({value:e.id,label:J(e)})),initialValues:r.map(e=>e.id),required:!0})):r.map(e=>e.id),{dirs:c}=await kt(n,r.filter(e=>s.includes(e.id)),o,a);H(`Installed in ${c.map(At).join(`, `)}`)}async function Nt(){let{api:e,credentials:t}=await St(),n=await e.listSkills();if(n.length===0){console.log(`You don't have skills yet. Create one at ${t.webUrl}/app/skills`);return}let r=await $(Q(`project`)),i=await $(Q(`global`)),a=Math.max(...n.map(e=>J(e).length));for(let e of n){let t=[Pt(`project`,r.skills[e.name]?.version,e.version),Pt(`global`,i.skills[e.name]?.version,e.version)].filter(Boolean);console.log(`${J(e).padEnd(a)} v${e.version}`+(t.length?` (${t.join(`, `)})`:``))}}function Pt(e,t,n){return t===void 0?null:t===n?`in ${e}`:`in ${e} at v${t}, run a-kit update${e===`global`?` -g`:``}`}async function Ft(){V(`agent kit`);let e=await bt();H(`Logged in as ${e.user.email}`)}async function It(){let e=await _t();e?(await X(Z(),e.token).logout().catch(()=>{}),await vt(null),console.log(`Logged out ${e.user.email}.`)):console.log(`You're not logged in.`)}async function Lt(){let e=await xt();e?console.log(e.user.email):(console.log("You're not logged in. Run `a-kit login`."),process.exitCode=1)}async function Rt(e){V(`agent kit`);let t=e.global?`global`:`project`,n=Q(t),r=await $(n),i=Object.entries(r.skills);if(i.length===0){H(e.global?"No skills installed everywhere yet. Add some with `a-kit add -g`.":"No skills installed in this project yet. Add some with `a-kit add`.");return}let{api:a}=await St(),o=0;for(let[e,s]of i){let i;try{i=await a.getSkill(s.id)}catch(t){if(t instanceof Y&&t.status===404){B.warn(`${e} isn't in your agent kit anymore; left it as it is.`);continue}throw t}if(i.version===s.version)continue;let c=ot(s.agents.map(e=>G(e)).filter(e=>e!==void 0),t);if(await Dt(a,s.id,c),i.name!==e){for(let t of c)await v(u(t,e),{recursive:!0,force:!0});delete r.skills[e]}r.skills[i.name]={...s,version:i.version},await Ot(n,r),B.success(`${i.name}: v${s.version} → v${i.version}`+(i.name===e?``:` (was ${e})`)),o++}H(o===0?`Everything is up to date.`:`Updated ${o} skill${o===1?``:`s`}.`)}const zt=`a-kit ${rt}: your agent kit skills, in your agents.
|
|
62
62
|
|
|
63
63
|
Usage
|
|
64
64
|
a-kit init Log in and pick skills to install
|
|
@@ -71,8 +71,8 @@ Usage
|
|
|
71
71
|
|
|
72
72
|
Options
|
|
73
73
|
-g, --global Install in your home folder instead of this project
|
|
74
|
-
-a, --agent <id> Install for this agent (repeatable): ${
|
|
74
|
+
-a, --agent <id> Install for this agent (repeatable): ${W.map(e=>e.id).join(`, `)}
|
|
75
75
|
-y, --yes Don't ask; use the defaults
|
|
76
76
|
-h, --help Show this help
|
|
77
77
|
-v, --version Show the version
|
|
78
|
-
`;async function
|
|
78
|
+
`;async function Bt(){let{values:t,positionals:n}=e({allowPositionals:!0,options:{global:{type:`boolean`,short:`g`,default:!1},agent:{type:`string`,short:`a`,multiple:!0,default:[]},yes:{type:`boolean`,short:`y`,default:!1},help:{type:`boolean`,short:`h`,default:!1},version:{type:`boolean`,short:`v`,default:!1}}});if(t.version)return console.log(rt);let[r,...i]=n;if(t.help||!r)return console.log(zt);let a={global:t.global,agent:t.agent.flatMap(e=>e.split(`,`)).filter(Boolean),yes:t.yes};switch(r){case`init`:return Mt(a);case`add`:case`install`:return jt(i,a);case`update`:return Rt(a);case`list`:case`ls`:return Nt();case`login`:return Ft();case`logout`:return It();case`whoami`:return Lt();default:throw Error(`Unknown command "${r}". Run \`a-kit --help\`.`)}}Bt().catch(e=>{B.error(e instanceof Error?e.message:String(e)),process.exitCode=1});export{};
|