useakit 0.1.0-dev.9 → 0.2.0-dev.15

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.
Files changed (3) hide show
  1. package/README.md +10 -0
  2. package/dist/index.mjs +105 -39
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -12,10 +12,20 @@ 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
  ```
18
19
 
19
20
  Skills go to `.claude/skills/` for Claude Code and `.agents/skills/` for Codex, Cursor and Gemini CLI. Pick agents with `-a`, like `-a claude-code,codex`. What was installed is kept in `agent-kit.lock.json`.
20
21
 
22
+ ## Reporting a session that went wrong
23
+
24
+ Installing skills also installs `report-session-issue`. Tell your agent "report this conversation" and it asks what went wrong, lists the project's private words, and runs `a-kit report`. The command:
25
+
26
+ - reads the session from Claude Code's or Codex's own log;
27
+ - scrubs it on your machine: secrets, emails, IPs, your user and machine names, paths to the repo and home, and the words the agent mapped; long tool outputs are cut to 2,000 characters (`--full-outputs` keeps them);
28
+ - links the agent kit skills installed here, and whether the agent loaded each;
29
+ - writes the scrubbed transcript to a file to check (`--dry-run` stops there), then sends it to your organization's Reports.
30
+
21
31
  Needs Node.js 20.12 or newer.
package/dist/index.mjs CHANGED
@@ -1,78 +1,144 @@
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,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
- `),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
- `){a&&(r+=fe(``));let e=i?ue(i):void 0;i&&e&&(r+=de(e))}else t===`
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(`
6
- `)}var k=(/* @__PURE__ */ x(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})))();function A(e,t,n){if(!n.some(e=>!e.disabled))return e;let r=e+t,i=Math.max(n.length-1,0),a=r<0?i:r>i?0:r;return n[a]?.disabled?A(a,t<0?-1:1,n):a}const j={actions:/* @__PURE__ */ new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:/* @__PURE__ */ new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0,accessible:void 0,date:{monthNames:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],messages:{required:`Please enter a valid date`,invalidMonth:`There are only 12 months in a year`,invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function _e(e){if(e!==void 0)return e;if(j.accessible!==void 0)return j.accessible;let t=process.env.ACCESSIBLE;return t!==void 0&&t!==``&&t!==`0`&&t!==`false`}function M(e,t){if(typeof e==`string`)return j.aliases.get(e)===t;for(let n of e)if(n!==void 0&&M(n,t))return!0;return!1}function ve(e,t){if(e===t)return;let n=e.split(`
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{basename as l,dirname as u,join as d,relative as f,resolve as p}from"node:path";import{homedir as m,hostname as h,tmpdir as g,userInfo as _}from"node:os";import{execFileSync as v,spawn as y}from"node:child_process";import{chmod as b,mkdir as x,open as S,readFile as C,readdir as ee,rm as w,stat as te,writeFile as T}from"node:fs/promises";import{createHash as ne}from"node:crypto";var re=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);const E=(()=>{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}})(),ie=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ae=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,oe=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,se=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,ce=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,le=/\t{1,1000}/y,ue=/[\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,de=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,fe=/\p{M}+/gu,pe={limit:1/0,ellipsis:``},me=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?me(i,pe,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[de,l],[oe,0],[se,o],[le,s],[ue,c],[ce,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,S=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(fe,``)){let t=e.codePointAt(0)||0;if(S=ie(t)?2:ae(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}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===ce?E(e.slice(p,n.lastIndex)):n===ue?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,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}},he={limit:1/0,ellipsis:``,ellipsisWidth:0},D=(e,t={})=>me(e,he,t).width,ge=`]8;;`,_e=RegExp(`(?:\\[(?<code>\\d+)m|\\${ge}(?<uri>.*))`,`y`),ve=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},ye=e=>`[${e}m`,be=e=>`${ge}${e}`,xe=(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(ge,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())},Se=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(``)},Ce=(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(``),xe(s,r,t),c=D(s.at(-1)??``)}else{if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){xe(s,r,t),c=D(s.at(-1)??``);continue}s.push(``),c=0}c+i>t&&n.wordWrap===!1?(xe(s,r,t),c=D(s.at(-1)??``)):(s[s.length-1]+=r,c+=i)}}n.trim!==!1&&(s=s.map(e=>Se(e)));let l=s.join(`
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===`›`){_e.lastIndex=e+1;let t=_e.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
+ `){a&&(r+=be(``));let e=i?ve(i):void 0;i&&e&&(r+=ye(e))}else t===`
5
+ `&&(i&&ve(i)&&(r+=ye(i)),a&&(r+=be(a)))}return r},we=/\r?\n/;function O(e,t,n){return String(e).normalize().split(we).map(e=>Ce(e,t,n)).join(`
6
+ `)}var k=(/* @__PURE__ */ re(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})))();function A(e,t,n){if(!n.some(e=>!e.disabled))return e;let r=e+t,i=Math.max(n.length-1,0),a=r<0?i:r>i?0:r;return n[a]?.disabled?A(a,t<0?-1:1,n):a}const j={actions:/* @__PURE__ */ new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:/* @__PURE__ */ new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0,accessible:void 0,date:{monthNames:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],messages:{required:`Please enter a valid date`,invalidMonth:`There are only 12 months in a year`,invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function Te(e){if(e!==void 0)return e;if(j.accessible!==void 0)return j.accessible;let t=process.env.ACCESSIBLE;return t!==void 0&&t!==``&&t!==`0`&&t!==`false`}function Ee(e,t){if(typeof e==`string`)return j.aliases.get(e)===t;for(let n of e)if(n!==void 0&&Ee(n,t))return!0;return!1}function De(e,t){if(e===t)return;let n=e.split(`
7
7
  `),r=t.split(`
8
- `),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}const ye=globalThis.process.platform.startsWith(`win`),be=Symbol(`clack:cancel`);function xe(e){return e===be}function N(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function Se({input:e=r,output:t=i,overwrite:n=!0,hideCursor:a=!0}={}){let c=o.createInterface({input:e,output:t,prompt:``,tabSize:1});o.emitKeypressEvents(e,c),e instanceof s&&e.isTTY&&e.setRawMode(!0);let l=(r,{name:i,sequence:s})=>{if(M([String(r),i,s],`cancel`)){a&&t.write(k.cursor.show),process.exit(0);return}if(!n)return;let c=i===`return`?0:-1,u=i===`return`?-1:0;o.moveCursor(t,c,u,()=>{o.clearLine(t,1,()=>{e.once(`keypress`,l)})})};return a&&t.write(k.cursor.hide),e.once(`keypress`,l),()=>{e.off(`keypress`,l),a&&t.write(k.cursor.show),e instanceof s&&e.isTTY&&!ye&&e.setRawMode(!1),c.terminal=!1,c.close()}}const Ce=e=>`columns`in e&&typeof e.columns==`number`?e.columns:80,we=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function P(e,t,n,r=n,a=n,o){return O(t,Ce(e??i)-n.length,{hard:!0,trim:!1}).split(`
8
+ `),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}const Oe=globalThis.process.platform.startsWith(`win`),ke=Symbol(`clack:cancel`);function Ae(e){return e===ke}function je(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function Me({input:e=r,output:t=i,overwrite:n=!0,hideCursor:a=!0}={}){let c=o.createInterface({input:e,output:t,prompt:``,tabSize:1});o.emitKeypressEvents(e,c),e instanceof s&&e.isTTY&&e.setRawMode(!0);let l=(r,{name:i,sequence:s})=>{if(Ee([String(r),i,s],`cancel`)){a&&t.write(k.cursor.show),process.exit(0);return}if(!n)return;let c=i===`return`?0:-1,u=i===`return`?-1:0;o.moveCursor(t,c,u,()=>{o.clearLine(t,1,()=>{e.once(`keypress`,l)})})};return a&&t.write(k.cursor.hide),e.once(`keypress`,l),()=>{e.off(`keypress`,l),a&&t.write(k.cursor.show),e instanceof s&&e.isTTY&&!Oe&&e.setRawMode(!1),c.terminal=!1,c.close()}}const Ne=e=>`columns`in e&&typeof e.columns==`number`?e.columns:80,Pe=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function M(e,t,n,r=n,a=n,o){return O(t,Ne(e??i)-n.length,{hard:!0,trim:!1}).split(`
9
9
  `).map((e,t,i)=>{let s=o?o(e,t):e;return t===0?`${r}${s}`:t===i.length-1?`${a}${s}`:`${n}${s}`}).join(`
10
- `)}function Te(e,t){if(`~standard`in e){let n=e[`~standard`].validate(t);return n instanceof Promise?n.then(e=>e.issues?.at(0)?.message):n.issues?.at(0)?.message}return e(t)}var Ee=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=/* @__PURE__ */ new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;get accessible(){return _e(this.opts.accessible)}constructor(e,t=!0){let{input:n=r,output:a=i,render:o,signal:s,...c}=e;this.opts=c,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=o.bind(this),this._track=t,this._abortSignal=s,this.input=n,this.output=a}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(be);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=a.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),N(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(k.cursor.show),this.output.off(`resize`,this.render),N(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(k.cursor.show),this.output.off(`resize`,this.render),N(this.input,!1),e(be)})})}_isActionKey(e,t){return e===` `}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}async onKeypress(e,t){if(this.state!==`validating`){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&j.aliases.has(t.name)&&this.emit(`cursor`,j.aliases.get(t.name)),j.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e,t),t?.name===`return`&&this._shouldSubmit(e,t)){if(this.opts.validate){let e=Te(this.opts.validate,this.value),t;e instanceof Promise?(this.state=`validating`,this.render(),t=await e):t=e,t&&(this.error=t instanceof Error?t.message:t,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}M([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
11
- `),N(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=O(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
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=ve(this._prevFrame,e),n=we(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(`
10
+ `)}function Fe(e,t){if(`~standard`in e){let n=e[`~standard`].validate(t);return n instanceof Promise?n.then(e=>e.issues?.at(0)?.message):n.issues?.at(0)?.message}return e(t)}var Ie=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=/* @__PURE__ */ new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;get accessible(){return Te(this.opts.accessible)}constructor(e,t=!0){let{input:n=r,output:a=i,render:o,signal:s,...c}=e;this.opts=c,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=o.bind(this),this._track=t,this._abortSignal=s,this.input=n,this.output=a}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(ke);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=a.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),je(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(k.cursor.show),this.output.off(`resize`,this.render),je(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(k.cursor.show),this.output.off(`resize`,this.render),je(this.input,!1),e(ke)})})}_isActionKey(e,t){return e===` `}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}async onKeypress(e,t){if(this.state!==`validating`){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&j.aliases.has(t.name)&&this.emit(`cursor`,j.aliases.get(t.name)),j.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e,t),t?.name===`return`&&this._shouldSubmit(e,t)){if(this.opts.validate){let e=Fe(this.opts.validate,this.value),t;e instanceof Promise?(this.state=`validating`,this.render(),t=await e):t=e,t&&(this.error=t instanceof Error?t.message:t,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}Ee([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
11
+ `),je(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=O(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
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=De(this._prevFrame,e),n=Pe(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}}},De=class extends Ee{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 Oe=class extends Ee{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 ke(){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 F=ke(),Ae=()=>process.env.CI===`true`,I=(e,t)=>F?e:t,je=I(`◆`,`*`),Me=I(`■`,`x`),Ne=I(`▲`,`x`),Pe=I(`◇`,`o`),Fe=I(`┌`,`T`),L=I(`│`,`|`),R=I(`└`,`—`),Ie=I(`●`,`>`),Le=I(`○`,` `),Re=I(`◻`,`[•]`),ze=I(`◼`,`[+]`),Be=I(`◻`,`[ ]`),Ve=I(`●`,`•`),He=I(`◆`,`*`),Ue=I(`▲`,`!`),We=I(`■`,`x`),Ge=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,je);case`cancel`:return t(`red`,Me);case`error`:return t(`yellow`,Ne);case`submit`:return t(`green`,Pe);case`validating`:return t(`dim`,je)}},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=Ce(i)-o,l=we(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(`
15
+ `)),this._prevFrame=e;return}}this.output.write(k.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},Le=class extends Ie{get cursor(){return+!this.value}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on(`userInput`,()=>{this.value=this._value}),this.on(`confirm`,e=>{this.output.write(k.cursor.move(0,-1)),this.value=e,this.state=`submit`,this.close()}),this.on(`cursor`,()=>{this.value=!this.value})}},Re=class extends Ie{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 ze=class extends Ie{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 Be(){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 Ve=Be(),He=()=>process.env.CI===`true`,N=(e,t)=>Ve?e:t,Ue=N(`◆`,`*`),We=N(`■`,`x`),Ge=N(`▲`,`x`),Ke=N(`◇`,`o`),qe=N(`┌`,`T`),P=N(`│`,`|`),F=N(`└`,`—`),Je=N(`●`,`>`),I=N(`○`,` `),Ye=N(`◻`,`[•]`),Xe=N(`◼`,`[+]`),Ze=N(`◻`,`[ ]`),Qe=N(`●`,`•`),$e=N(`◆`,`*`),et=N(`▲`,`!`),tt=N(`■`,`x`),nt=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,Ue);case`cancel`:return t(`red`,We);case`error`:return t(`yellow`,Ge);case`submit`:return t(`green`,Ke);case`validating`:return t(`dim`,Ue)}},rt=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,P);case`cancel`:return t(`red`,P);case`error`:return t(`yellow`,P);case`submit`:return t(`green`,P)}};function it(e,n){let r=[`${n?`${t(`cyan`,P)} `:``}${e.join(` • `)}`];return n&&r.push(t(`cyan`,F)),r}const at=(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}},ot=({cursor:e,options:n,style:r,output:i=process.stdout,maxItems:a=1/0,columnPadding:o=0,rowPadding:s=4})=>{let c=Ne(i)-o,l=Pe(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=()=>at(_,r,0,i,a),s=()=>at(_,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},st=e=>{let n=e.active??`Yes`,r=e.inactive??`No`;return new Le({active:n,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let i=e.withGuide??j.withGuide,a=`${nt(this.state)} `,o=i?`${t(`gray`,P)} `:``,s=M(e.output,e.message,o,a),c=`${i?`${t(`gray`,P)}
17
+ `:``}${s}
18
+ `,l=this.value?n:r;switch(this.state){case`submit`:return`${c}${i?`${t(`gray`,P)} `:``}${t(`dim`,l)}`;case`cancel`:return`${c}${i?`${t(`gray`,P)} `:``}${t([`strikethrough`,`dim`],l)}${i?`
19
+ ${t(`gray`,P)}`:``}`;default:{let a=i?`${t(`cyan`,P)} `:``,o=i?t(`cyan`,F):``;return`${c}${a}${this.value?`${t(`green`,Je)} ${n}`:`${t(`dim`,I)} ${t(`dim`,n)}`}${e.vertical?i?`
20
+ ${t(`cyan`,P)} `:`
21
+ `:` ${t(`dim`,`/`)} `}${this.value?`${t(`dim`,I)} ${t(`dim`,r)}`:`${t(`green`,Je)} ${r}`}
22
+ ${o}
23
+ `}}}}).prompt()},ct=[`${t(`dim`,`↑/↓`)} to navigate`,`${t(`dim`,`Space:`)} select`,`${t(`dim`,`Enter:`)} confirm`],L=(e,t)=>e.split(`
17
24
  `).map(e=>t(e)).join(`
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 De({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
- ${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=P(e.output,e.message,r?`${Ke(this.state)} `:``,`${Ge(this.state)} `),o=`${r?`${t(`gray`,L)}
25
+ `),lt=e=>{let n=(e,n)=>{let r=e.label??String(e.value);return n===`disabled`?`${t(`gray`,Ze)} ${L(r,e=>t([`strikethrough`,`gray`],e))}${e.hint?` ${t(`dim`,`(${e.hint??`disabled`})`)}`:``}`:n===`active`?`${t(`cyan`,Ye)} ${r}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`:n===`selected`?`${t(`green`,Xe)} ${L(r,e=>t(`dim`,e))}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`:n===`cancelled`?`${L(r,e=>t([`strikethrough`,`dim`],e))}`:n===`active-selected`?`${t(`green`,Xe)} ${r}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`:n===`submitted`?`${L(r,e=>t(`dim`,e))}`:`${t(`dim`,Ze)} ${L(r,e=>t(`dim`,e))}`},r=e.required??!0,i=e.showInstructions??!0;return new Re({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.
26
+ ${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=M(e.output,e.message,r?`${rt(this.state)} `:``,`${nt(this.state)} `),o=`${r?`${t(`gray`,P)}
20
27
  `:``}${a}
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}${P(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}${P(e.output,i,r?`${t(`gray`,L)} `:``)}${r?`
22
- ${t(`gray`,L)}`:``}`}case`error`:{let n=r?`${t(`yellow`,L)} `:``,i=this.error.split(`
23
- `).map((e,n)=>n===0?`${r?`${t(`yellow`,R)} `:``}${t(`yellow`,e)}`:` ${e}`).join(`
28
+ `,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}${M(e.output,i,r?`${t(`gray`,P)} `:``)}`}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`,P)}`:`${o}${M(e.output,i,r?`${t(`gray`,P)} `:``)}${r?`
29
+ ${t(`gray`,P)}`:``}`}case`error`:{let n=r?`${t(`yellow`,P)} `:``,i=this.error.split(`
30
+ `).map((e,n)=>n===0?`${r?`${t(`yellow`,F)} `:``}${t(`yellow`,e)}`:` ${e}`).join(`
24
31
  `),a=o.split(`
25
32
  `).length,s=i.split(`
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(`
33
+ `).length+1;return`${o}${n}${ot({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:n.length,rowPadding:a+s,style:c}).join(`
27
34
  ${n}`)}
28
35
  ${i}
29
- `}default:{let n=r?`${t(`cyan`,L)} `:``,a=o.split(`
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(`
36
+ `}default:{let n=r?`${t(`cyan`,P)} `:``,a=o.split(`
37
+ `).length,s=i?it(ct,r):r?[t(`cyan`,F)]:[],l=s.join(`
38
+ `),u=s.length+1;return`${o}${n}${ot({output:e.output,options:this.options,cursor:this.cursor,maxItems:e.maxItems,columnPadding:n.length,rowPadding:a+u,style:c}).join(`
32
39
  ${n}`)}
33
40
  ${l}
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(`
41
+ `}}}}).prompt()},R={message:(e=[],{symbol:n=t(`gray`,P),secondarySymbol:r=t(`gray`,P),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
42
  `);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
43
  `)}
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`,Pe)})},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)}
44
+ `)},info:(e,n)=>{R.message(e,{...n,symbol:t(`blue`,Qe)})},success:(e,n)=>{R.message(e,{...n,symbol:t(`green`,$e)})},step:(e,n)=>{R.message(e,{...n,symbol:t(`green`,Ke)})},warn:(e,n)=>{R.message(e,{...n,symbol:t(`yellow`,et)})},warning:(e,t)=>{R.warn(e,t)},error:(e,n)=>{R.message(e,{...n,symbol:t(`red`,tt)})}},ut=(e=``,n)=>{let r=n?.output??process.stdout,i=n?.withGuide??j.withGuide?`${t(`gray`,F)} `:``;r.write(`${i}${t(`red`,e)}
38
45
 
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
- ${t(`gray`,R)} `:``;r.write(`${i}${e}
46
+ `)},z=(e=``,n)=>{let r=n?.output??process.stdout,i=n?.withGuide??j.withGuide?`${t(`gray`,qe)} `:``;r.write(`${i}${e}
47
+ `)},B=(e=``,n)=>{let r=n?.output??process.stdout,i=n?.withGuide??j.withGuide?`${t(`gray`,P)}
48
+ ${t(`gray`,F)} `:``;r.write(`${i}${e}
42
49
 
43
- `)},$e=e=>t(`magenta`,e),et=({indicator:e=`dots`,onCancel:n,output:r=process.stdout,cancelMessage:i,errorMessage:a,frames:o=F?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],delay:s=F?80:120,signal:c,...l}={})=>{let u=Ae(),d,f,p=!1,m=!1,h=``,g,_=performance.now(),v=Ce(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(`
50
+ `)},dt=e=>t(`magenta`,e),ft=({indicator:e=`dots`,onCancel:n,output:r=process.stdout,cancelMessage:i,errorMessage:a,frames:o=Ve?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],delay:s=Ve?80:120,signal:c,...l}={})=>{let u=He(),d,f,p=!1,m=!1,h=``,g,_=performance.now(),v=Ne(r),y=l?.styleFrame??dt,b=e=>{let t=e>1?a??j.messages.error:i??j.messages.cancel;m=e===1,p&&(E(t,e),m&&typeof n==`function`&&n())},x=()=>b(2),S=()=>b(1),C=()=>{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)},ee=()=>{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)},w=()=>{if(g===void 0)return;u&&r.write(`
44
51
  `);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())},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=Se({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`,Pe):i===1?t(`red`,Me):t(`red`,Ne);h=n??h,a||(e===`timer`?r.write(`${o} ${h} ${w(_)}
52
+ `);e.length>1&&r.write(k.cursor.up(e.length-1)),r.write(k.cursor.to(0)),r.write(k.erase.down())},te=e=>e.replace(/\.+$/,``),T=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]`},ne=l.withGuide??j.withGuide,re=(n=``)=>{p=!0,d=Me({output:r}),h=te(n),_=performance.now(),ne&&r.write(`${t(`gray`,P)}
53
+ `);let i=0,a=0;C(),f=setInterval(()=>{if(u&&h===g)return;w(),g=h;let t=y(o[i]),n;if(u)n=`${t} ${h}...`;else if(e===`timer`)n=`${t} ${h} ${T(_)}`;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)},E=(n=``,i=0,a=!1)=>{if(!p)return;p=!1,clearInterval(f),w();let o=i===0?t(`green`,Ke):i===1?t(`red`,We):t(`red`,Ge);h=n??h,a||(e===`timer`?r.write(`${o} ${h} ${T(_)}
47
54
  `):r.write(`${o} ${h}
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(`
55
+ `)),ee(),d()};return{start:re,stop:(e=``)=>E(e,0),message:(e=``)=>{h=te(e??h)},cancel:(e=``)=>E(e,1),error:(e=``)=>E(e,2),clear:()=>E(``,0,!0),get isCancelled(){return m}}},pt=[`${t(`dim`,`↑/↓`)} to navigate`,`${t(`dim`,`Enter:`)} confirm`],V=(e,t)=>e.includes(`
49
56
  `)?e.split(`
50
57
  `).map(e=>t(e)).join(`
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 Oe({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=P(e.output,e.message,o,a),c=`${i?`${t(`gray`,L)}
58
+ `):t(e),mt=e=>{let n=(e,n)=>{if(e===void 0)return``;let r=e.label??String(e.value);switch(n){case`disabled`:return`${t(`gray`,I)} ${V(r,e=>t(`gray`,e))}${e.hint?` ${t(`dim`,`(${e.hint??`disabled`})`)}`:``}`;case`selected`:return`${V(r,e=>t(`dim`,e))}`;case`active`:return`${t(`green`,Je)} ${r}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`;case`cancelled`:return`${V(r,e=>t([`strikethrough`,`dim`],e))}`;default:return`${t(`dim`,I)} ${V(r,e=>t(`dim`,e))}`}},r=e.showInstructions??!0;return new ze({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let i=e.withGuide??j.withGuide,a=`${nt(this.state)} `,o=`${rt(this.state)} `,s=M(e.output,e.message,o,a),c=`${i?`${t(`gray`,P)}
52
59
  `:``}${s}
53
- `;switch(this.state){case`submit`:{let r=i?`${t(`gray`,L)} `:``;return`${c}${P(e.output,n(this.options[this.cursor],`selected`),r)}`}case`cancel`:{let r=i?`${t(`gray`,L)} `:``;return`${c}${P(e.output,n(this.options[this.cursor],`cancelled`),r)}${i?`
54
- ${t(`gray`,L)}`:``}`}default:{let a=i?`${t(`cyan`,L)} `:``,o=c.split(`
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(`
60
+ `;switch(this.state){case`submit`:{let r=i?`${t(`gray`,P)} `:``;return`${c}${M(e.output,n(this.options[this.cursor],`selected`),r)}`}case`cancel`:{let r=i?`${t(`gray`,P)} `:``;return`${c}${M(e.output,n(this.options[this.cursor],`cancelled`),r)}${i?`
61
+ ${t(`gray`,P)}`:``}`}default:{let a=i?`${t(`cyan`,P)} `:``,o=c.split(`
62
+ `).length,s=r?it(pt,i):i?[t(`cyan`,F)]:[],l=s.join(`
63
+ `),u=s.length+1;return`${c}${a}${ot({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
64
  ${a}`)}
58
65
  ${l}
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 xe(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)return t.map(t=>{let n=e.filter(e=>e.name===t);if(n.length===0)throw Error(`There's no skill named "${t}" in your agent kit. See them with \`a-kit list\`.`);if(n.length>1)throw Error(`More than one of your organizations has a skill named "${t}" (${n.map(e=>e.organizationName).join(`, `)}). Run \`a-kit add\` and pick it from the list.`);return n[0]});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))}const J=e=>e.organizationName?`${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`)]);if(t.length<2)return e;let n=new Map(t.map(e=>[e.id,e.name]));return e.map(e=>({...e,organizationName:n.get(e.organizationId)}))},getSkill:e=>i(`/skills/${e}`),getBlob:async(e,t)=>new Uint8Array(await(await r(`/skills/${e}/blobs/${t}`)).arrayBuffer())}}function ut(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 dt(){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 ft=()=>u(dt(),`credentials.json`);async function pt(){try{return JSON.parse(await _(ft(),`utf8`))}catch{return{}}}async function mt(){return(await pt())[Z()]??null}async function ht(e){let t=await pt();e?t[Z()]=e:delete t[Z()];let n=ft();await g(l(n),{recursive:!0,mode:448}),await y(n,JSON.stringify(t,null,2)+`
60
- `,{mode:384}),await h(n,384)}const gt=e=>new Promise(t=>setTimeout(t,e));async function _t(){let e=await X(Z()).startLogin();B.step(`Your code: ${e.userCode}\nApprove it in your browser: ${e.verificationUrl}`),ut(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 gt(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 ht(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 vt(){let e=await mt();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 ht(null),null;throw e}}async function yt(){let e=await mt();if(!e)throw Error("You're not logged in. Run `a-kit login` first.");return{api:X(Z(),e.token),credentials:e}}const bt={maxFiles:200,maxFileBytes:1048576,maxSkillBytes:10485760,maxPathLength:255},xt=/[\u0000-\u001f\u007f\\:]/;function St(e){if(e.trim()===``)return`The path is empty.`;if(e.length>bt.maxPathLength)return`Paths can be at most ${bt.maxPathLength} characters.`;if(e.startsWith(`/`))return`Use a relative path, without a leading /.`;if(xt.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 Ct=e=>b(`sha256`).update(e).digest(`hex`);async function wt(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=St(t.path);if(n)throw Error(`${r.name}: ${t.path}: ${n}`);let a=await e.getBlob(r.id,t.sha256);if(Ct(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(dt(),`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 Tt(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 Et(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 wt(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 Tt(o,s),e}}return await Tt(o,s),{dirs:a,lockFile:o}}function Dt(e){let t=d(process.cwd(),e);return t&&!t.startsWith(`..`)?t:e}async function Ot(e,t){V(`agent kit`);let{api:n}=await yt(),r=!t.yes,{dirs:i}=await Et(n,await lt(await n.listSkills(),e,r),await st(t.agent,r),t.global?`global`:`project`);H(`Installed in ${i.map(Dt).join(`, `)}`)}async function kt(e){V(`agent kit`);let t=await vt();t?B.success(`Logged in as ${t.user.email}`):t=await _t();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 Et(n,r.filter(e=>s.includes(e.id)),o,a);H(`Installed in ${c.map(Dt).join(`, `)}`)}async function At(){let{api:e,credentials:t}=await yt(),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=[jt(`project`,r.skills[e.name]?.version,e.version),jt(`global`,i.skills[e.name]?.version,e.version)].filter(Boolean);console.log(`${J(e).padEnd(a)} v${e.version}`+(t.length?` (${t.join(`, `)})`:``))}}function jt(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 Mt(){V(`agent kit`);let e=await _t();H(`Logged in as ${e.user.email}`)}async function Nt(){let e=await mt();e?(await X(Z(),e.token).logout().catch(()=>{}),await ht(null),console.log(`Logged out ${e.user.email}.`)):console.log(`You're not logged in.`)}async function Pt(){let e=await vt();e?console.log(e.user.email):(console.log("You're not logged in. Run `a-kit login`."),process.exitCode=1)}async function Ft(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 yt(),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 wt(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 Tt(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 It=`a-kit ${rt}: your agent kit skills, in your agents.
66
+ `}}}}).prompt()};`${t(`gray`,P)}`;var ht=`0.2.0`;const H=[{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`}],gt=e=>e===`global`?m():process.cwd();function _t(e=m()){return H.filter(t=>c(d(e,t.marker)))}function U(e){return H.find(t=>t.id===e)}function vt(e,t,n=gt(t)){let r=e.map(e=>p(n,t===`global`?e.globalDir:e.projectDir));return[...new Set(r)]}const W=()=>!!(process.stdin.isTTY&&process.stdout.isTTY)&&!process.env.CI;function G(e){return Ae(e)&&(ut(`Cancelled.`),process.exit(130)),e}async function yt(e,t){if(e.length>0)return e.map(e=>{let t=U(e);if(!t)throw Error(`Unknown agent "${e}". Use one of: ${H.map(e=>e.id).join(`, `)}.`);return t});let n=_t(),r=n.length>0?n:[U(`claude-code`)];return!t||!W()?r:G(await lt({message:`Which agents should get the skills?`,options:H.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=>U(e))}async function bt(e,t){return e?`global`:!t||!W()?`project`:G(await mt({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 xt(e,t,n){if(t.length>0){let r=[];for(let i of t){let t=St(e,i);r.push(t.length===1?t[0]:await Ct(t,n))}return r}if(!n||!W())throw Error("Name the skills to add, like `a-kit add my-skill`.");let r=G(await lt({message:`Which skills?`,options:e.map(e=>({value:e.id,label:K(e),hint:e.description.length>60?`${e.description.slice(0,57)}…`:e.description})),required:!0}));return e.filter(e=>r.includes(e.id))}function St(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 Ct(e,t){let n=e[0].name;if(!t||!W()){let t=e.map(e=>{let t=wt(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=G(await mt({message:`More than one of your organizations has "${n}". Which one?`,options:e.map(e=>({value:e.id,label:wt(e)}))}));return e.find(e=>e.id===r)}const wt=e=>`${e.organizationName}/${e.name}`,K=e=>e.showOrganization?`${e.name} (${e.organizationName})`:e.name;var q=class extends Error{status;code;constructor(e,t,n){super(n),this.status=e,this.code=t}};function J(e,t,n=fetch){async function r(r,i={}){let a;try{a=await n(`${e}${r}`,{...i,headers:{"User-Agent":`a-kit/${ht}`,...i.body?{"Content-Type":`application/json`}:{},...t?{Authorization:`Bearer ${t}`}:{},...i.headers}})}catch{throw new q(0,`NETWORK`,`Couldn't reach ${e}.`)}if(!a.ok){let e=await a.json().catch(()=>null);throw a.status===401?new q(401,`UNAUTHORIZED`,"You're not logged in. Run `a-kit login`."):new q(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}))},listOrganizations:()=>i(`/orgs`),getSkill:e=>i(`/skills/${e}`),createReport:(e,t)=>i(`/orgs/${e}/reports`,{method:`POST`,body:JSON.stringify(t)}),getBlob:async(e,t)=>new Uint8Array(await(await r(`/skills/${e}/blobs/${t}`)).arrayBuffer())}}function Tt(e){let[t,n]=process.platform===`darwin`?[`open`,[e]]:process.platform===`win32`?[`cmd`,[`/c`,`start`,``,e.replace(/&/g,`^&`)]]:[`xdg-open`,[e]];try{let e=y(t,n,{stdio:`ignore`,detached:!0});e.on(`error`,()=>{}),e.unref()}catch{}}function Y(){return(process.env.AGENT_KIT_API_URL??`https://api-dev.agent-kit.fausanchez.com`??`http://localhost:8787`).replace(/\/+$/,``)}function Et(){return process.env.AGENT_KIT_CONFIG_DIR?process.env.AGENT_KIT_CONFIG_DIR:process.platform===`win32`&&process.env.APPDATA?d(process.env.APPDATA,`agent-kit`):d(process.env.XDG_CONFIG_HOME??d(m(),`.config`),`agent-kit`)}const Dt=()=>d(Et(),`credentials.json`);async function Ot(){try{return JSON.parse(await C(Dt(),`utf8`))}catch{return{}}}async function kt(){return(await Ot())[Y()]??null}async function At(e){let t=await Ot();e?t[Y()]=e:delete t[Y()];let n=Dt();await x(u(n),{recursive:!0,mode:448}),await T(n,JSON.stringify(t,null,2)+`
67
+ `,{mode:384}),await b(n,384)}const jt=e=>new Promise(t=>setTimeout(t,e));async function Mt(){let e=await J(Y()).startLogin();R.step(`Your code: ${e.userCode}\nApprove it in your browser: ${e.verificationUrl}`),Tt(e.verificationUrl);let t=ft();t.start(`Waiting for you to approve it`);let n=J(Y()),r=Date.now()+e.expiresIn*1e3;for(;Date.now()<r;){await jt(e.interval*1e3);let r;try{r=await n.pollLogin(e.deviceCode)}catch(e){if(e instanceof q&&e.status===410)break;if(e instanceof q&&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 At(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 Nt(){let e=await kt();if(!e)return null;try{let t=await J(Y(),e.token).me();return{...e,user:t}}catch(e){if(e instanceof q&&e.status===401)return await At(null),null;throw e}}async function Pt(){let e=await kt();if(!e)throw Error("You're not logged in. Run `a-kit login` first.");return{api:J(Y(),e.token),credentials:e}}const Ft=`report-session-issue`,It=/skills\/([a-z0-9][a-z0-9-]*)\/SKILL\.md/g;function Lt(e,t){if(e===`Skill`){let e=t?.skill;return typeof e==`string`?[Rt(e)]:[]}return[...(typeof t==`string`?t:JSON.stringify(t??``)).matchAll(It)].map(e=>e[1])}const Rt=e=>e.slice(e.lastIndexOf(`:`)+1).replace(/^\//,``);function zt(e){let t=e.events.findIndex(e=>Bt(e));if(t===-1)return e;let n=t;for(let r=t;r>=0;r--){let t=e.events[r];if(t.type===`user`&&t.message.content.some(e=>e.type===`text`)){n=r;break}}let r=e.events.slice(0,n);return{...e,events:r,loaded:[...new Set(r.flatMap(Vt))]}}function Bt(e){return Vt(e).includes(Ft)}function Vt(e){return e.type===`system`?[]:e.message.content.flatMap(t=>t.type===`tool_use`?Lt(t.name,t.input):t.type===`text`&&e.type===`user`?[...t.text.matchAll(/<command-name>\/?([\w:-]+)<\/command-name>/g)].map(e=>Rt(e[1])):[])}const Ht=(e=`npx -y useakit@next`)=>`---
68
+ name: ${Ft}
69
+ description: Reports this conversation to agent kit because it went wrong, so it can become an eval. Use when the developer says the session went badly and asks to report it ("report this", "reportá esta conversación", "mandalo a agent kit"), or wants it turned into an eval.
70
+ ---
71
+
72
+ # Report this session
73
+
74
+ Sends this conversation (every message and tool call) to the developer's agent kit organization, scrubbed of what's private, so it can become an eval. The \`a-kit report\` command reads the session from the agent's own log, scrubs it on this machine and sends it. What only you can add is what went wrong and which words are private.
75
+
76
+ Only the conversation up to the developer's request to report it is sent; this part isn't.
77
+
78
+ 1. **What went wrong.** If the developer hasn't said, ask: what went wrong, and what they expected instead. Use their words; don't guess. Write a title of under 120 characters.
79
+
80
+ 2. **What's private.** \`a-kit report\` takes out secrets, emails, IPs, the user and machine names, and paths to the repo and the home folder on its own. You add the words that identify the project or its people, from what you saw in this conversation:
81
+ - company, client and product names, and the repo's name;
82
+ - domains and URLs of their services, and internal hostnames;
83
+ - people's names;
84
+ - business data, like amounts or ids of real records.
85
+
86
+ Map each one to a neutral stand-in that keeps the meaning, and save the map as JSON outside the repo:
87
+
88
+ \`\`\`json
89
+ {"Nigon SRL": "Acme Corp", "nigon.com.uy": "example.com", "Juan Pérez": "Alex Doe"}
90
+ \`\`\`
91
+
92
+ Words are found in any case. Words under four characters are only replaced as whole words.
93
+
94
+ 3. **Preview.** Run, with \`--agent codex\` instead in Codex:
95
+
96
+ \`\`\`sh
97
+ ${e} report --agent claude-code --session "\${CLAUDE_SESSION_ID}" \\
98
+ --title "…" --note "what went wrong" --expected "what they expected" \\
99
+ --map /tmp/a-kit-report-map.json --dry-run
100
+ \`\`\`
101
+
102
+ Without \`--session\`, it reads this folder's latest session. It prints the skills it links, what it took out, and the path of the scrubbed transcript. Search that file for the private words you know of (\`grep -i\`), and anything else that names the project. Add what's left to the map and preview again until nothing is.
103
+
104
+ 4. **Confirm.** Tell the developer in a few lines: the title, the skills it links, what was taken out, and that long tool outputs and written files are cut to 2,000 characters (\`--full-outputs\` keeps them whole). Ask before sending.
105
+
106
+ 5. **Send.** Run the same command with \`--yes\` instead of \`--dry-run\`, and give the developer the link it prints. If it says they're not logged in, they run \`${e} login\` first.
107
+ `;async function Ut(e){for(let t of e){let e=d(t,Ft);await x(e,{recursive:!0}),await T(d(e,`SKILL.md`),Ht())}}const Wt={maxFiles:200,maxFileBytes:1048576,maxSkillBytes:10485760,maxPathLength:255},Gt=/[\u0000-\u001f\u007f\\:]/;function Kt(e){if(e.trim()===``)return`The path is empty.`;if(e.length>Wt.maxPathLength)return`Paths can be at most ${Wt.maxPathLength} characters.`;if(e.startsWith(`/`))return`Use a relative path, without a leading /.`;if(Gt.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 qt=e=>ne(`sha256`).update(e).digest(`hex`);async function Jt(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=Kt(t.path);if(n)throw Error(`${r.name}: ${t.path}: ${n}`);let a=await e.getBlob(r.id,t.sha256);if(qt(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=d(e,r.name);await w(t,{recursive:!0,force:!0});for(let e of i){let n=d(t,e.path);await x(u(n),{recursive:!0}),await T(n,e.bytes)}}return r}const X=(e,t=process.cwd())=>e===`global`?d(Et(),`global.lock.json`):d(t,`agent-kit.lock.json`);async function Z(e){try{return{version:1,skills:JSON.parse(await C(e,`utf8`)).skills??{}}}catch{return{version:1,skills:{}}}}async function Yt(e,t){let n=Object.fromEntries(Object.entries(t.skills).sort(([e],[t])=>e.localeCompare(t)));await x(u(e),{recursive:!0}),await T(e,JSON.stringify({...t,skills:n},null,2)+`
108
+ `)}async function Xt(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=vt(n,r),o=X(r),s=await Z(o),c=ft();await Ut(a);for(let r of t){c.start(`Installing ${r.name}`);try{let t=await Jt(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 Yt(o,s),e}}return await Yt(o,s),{dirs:a,lockFile:o}}function Zt(e){let t=f(process.cwd(),e);return t&&!t.startsWith(`..`)?t:e}async function Qt(e,t){z(`agent kit`);let{api:n}=await Pt(),r=!t.yes,{dirs:i}=await Xt(n,await xt(await n.listSkills(),e,r),await yt(t.agent,r),t.global?`global`:`project`);B(`Installed in ${i.map(Zt).join(`, `)}`)}async function $t(e){z(`agent kit`);let t=await Nt();t?R.success(`Logged in as ${t.user.email}`):t=await Mt();let n=J(Y(),t.token),r=await n.listSkills();if(r.length===0){B(`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&&!W())throw Error("`a-kit init` asks questions. Pass --yes to install every skill, or use `a-kit add <skill>`.");let a=await bt(e.global,i),o=await yt(e.agent,i),s=i?G(await lt({message:`Which skills?`,options:r.map(e=>({value:e.id,label:K(e)})),initialValues:r.map(e=>e.id),required:!0})):r.map(e=>e.id),{dirs:c}=await Xt(n,r.filter(e=>s.includes(e.id)),o,a);B(`Installed in ${c.map(Zt).join(`, `)}`)}async function en(){let{api:e,credentials:t}=await Pt(),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 Z(X(`project`)),i=await Z(X(`global`)),a=Math.max(...n.map(e=>K(e).length));for(let e of n){let t=[tn(`project`,r.skills[e.name]?.version,e.version),tn(`global`,i.skills[e.name]?.version,e.version)].filter(Boolean);console.log(`${K(e).padEnd(a)} v${e.version}`+(t.length?` (${t.join(`, `)})`:``))}}function tn(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 nn(){z(`agent kit`);let e=await Mt();B(`Logged in as ${e.user.email}`)}async function rn(){let e=await kt();e?(await J(Y(),e.token).logout().catch(()=>{}),await At(null),console.log(`Logged out ${e.user.email}.`)):console.log(`You're not logged in.`)}async function an(){let e=await Nt();e?console.log(e.user.email):(console.log("You're not logged in. Run `a-kit login`."),process.exitCode=1)}const on={maxTitleLength:120,maxNoteLength:4e3,maxSkills:50,maxTranscriptBytes:8388608},sn=[{kind:`private-key`,pattern:/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,strict:!0},{kind:`anthropic-key`,pattern:/\bsk-ant-[A-Za-z0-9_-]{20,}/g,strict:!0},{kind:`openai-key`,pattern:/\bsk-(?:proj-|svcacct-)?[A-Za-z0-9_-]{32,}/g,strict:!0},{kind:`github-token`,pattern:/\b(?:gh[pousr]_[A-Za-z0-9]{36,}|github_pat_[A-Za-z0-9_]{40,})/g,strict:!0},{kind:`aws-key`,pattern:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,strict:!0},{kind:`slack-token`,pattern:/\bxox[abprs]-[A-Za-z0-9-]{10,}/g,strict:!0},{kind:`stripe-key`,pattern:/\b[rs]k_(?:live|test)_[A-Za-z0-9]{16,}/g,strict:!0},{kind:`google-key`,pattern:/\bAIza[0-9A-Za-z_-]{35}\b/g,strict:!0},{kind:`jwt`,pattern:/\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,strict:!0},{kind:`url-credentials`,pattern:/\b([a-z][a-z0-9+.-]*:\/\/)[^\s:/@]+:[^\s@/]+@/gi,keep:(e,t)=>`${t}<secret>@`,strict:!1},{kind:`bearer`,pattern:/\b(Bearer\s+)[A-Za-z0-9._~+/-]{20,}=*/g,keep:(e,t)=>`${t}<secret>`,strict:!1},{kind:`assignment`,pattern:/\b([A-Za-z0-9_]*(?:secret|token|password|passwd|api_?key|private_?key|access_?key)[A-Za-z0-9_]*["']?\s*[=:]\s*)(["']?)(?!<secret)[^\s"'`,;]{8,}\2/gi,keep:(e,t,n)=>`${t}${n}<secret>${n}`,strict:!1}],cn=/[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}\b/g,ln=/\b(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)\b/g,un=/* @__PURE__ */ new Set([`127.0.0.1`,`0.0.0.0`]),dn=/@(?:example\.(?:com|org|net)|anthropic\.com)$/i,fn=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function pn(e){let t={},n=(e,n=1)=>{t[e]=(t[e]??0)+n},r=e.paths.filter(e=>e.path.length>1).sort((e,t)=>t.path.length-e.path.length).map(e=>({...e,pattern:new RegExp(fn(e.path),`g`)})),i=e.replacements.filter(e=>e.find.trim().length>1).sort((e,t)=>t.find.length-e.find.length).map(e=>({...e,pattern:new RegExp(e.find.length<4?`(?<![\\p{L}\\p{N}_])${fn(e.find)}(?![\\p{L}\\p{N}_])`:fn(e.find),`giu`)}));function a(e){let t=e;for(let e of sn)t=t.replace(e.pattern,(t,...r)=>(n(`secret:${e.kind}`),e.keep?e.keep(t,...r):`<secret>`));for(let e of r)t=t.replace(e.pattern,()=>(n(`path:${e.as}`),e.as));for(let e of i)t=t.replace(e.pattern,()=>(n(`term:${e.find}`),e.replace));return t=t.replace(cn,e=>dn.test(e)?e:(n(`email`),`user@example.com`)),t=t.replace(ln,e=>un.has(e)?e:(n(`ip`),`192.0.2.1`)),t}function o(t){let r=e.maxToolText;return r===null||t.length<=r?t:(n(`cut`),`${t.slice(0,r)}\n… [${t.length-r} more characters left out by a-kit report]`)}function s(e){return typeof e==`string`?o(a(e)):Array.isArray(e)?e.map(s):typeof e==`object`&&e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,s(t)])):e}function c(e){return e.type===`text`?{...e,text:a(e.text)}:e.type===`tool_use`?{...e,input:s(e.input)}:{...e,content:o(a(e.content))}}function l(e){return e.map(e=>e.type===`system`?e:{...e,message:{content:e.message.content.map(c)}})}return{text:a,events:l,counts:t}}const mn=e=>e.map(e=>JSON.stringify(e)).join(`
109
+ `)+`
110
+ `;function hn(e){let t=[],n=null,r=null,i=null;for(let a of e.split(`
111
+ `)){if(!a.trim())continue;let e;try{e=JSON.parse(a)}catch{continue}if(e.type!==`user`&&e.type!==`assistant`||e.isSidechain||e.isMeta)continue;r=e.version??r,i=e.cwd??i,e.type===`assistant`&&e.message?.model&&(e.message.model.startsWith(`<`)||(n=e.message.model));let o=gn(e.message?.content);o.length>0&&t.push({type:e.type,message:{content:o}})}return{agent:`claude-code`,agentVersion:r,model:n,cwd:i,events:[{type:`system`,subtype:`init`,agent:`Claude Code`,agent_version:r,model:n},...t],loaded:[...new Set(t.flatMap(Vt))]}}function gn(e){if(typeof e==`string`)return e.trim()?[{type:`text`,text:e}]:[];if(!Array.isArray(e))return[];let t=[];for(let n of e)n.type===`text`&&typeof n.text==`string`&&n.text.trim()?t.push({type:`text`,text:n.text}):n.type===`tool_use`?t.push({type:`tool_use`,id:String(n.id??``),name:String(n.name??``),input:n.input??{}}):n.type===`tool_result`&&t.push({type:`tool_result`,tool_use_id:String(n.tool_use_id??``),content:_n(n.content),...n.is_error===!0?{is_error:!0}:{}});return t}function _n(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>e.type===`text`&&typeof e.text==`string`?e.text:e.type===`image`?`[image]`:``).filter(Boolean).join(`
112
+ `):``}const vn=[/^# AGENTS\.md instructions/,/^<(environment_context|user_instructions|permissions instructions|turn_aborted)>/];function yn(e){let t=[],n=null,r=null,i=null,a=(e,n)=>t.push({type:e,message:{content:[n]}});for(let t of e.split(`
113
+ `)){if(!t.trim())continue;let e;try{e=JSON.parse(t)}catch{continue}let o=e.payload??{};if(e.type===`session_meta`)r=Q(o.cli_version)??r,i=Q(o.cwd)??i;else if(e.type===`turn_context`)n=Q(o.model)??n,i=Q(o.cwd)??i;else if(e.type===`response_item`){if(o.type===`message`){let e=o.role;if(e!==`user`&&e!==`assistant`)continue;let t=xn(o.content);if(!t.trim()||e===`user`&&vn.some(e=>e.test(t.trim())))continue;a(e,{type:`text`,text:t})}else o.type===`function_call`||o.type===`custom_tool_call`?a(`assistant`,{type:`tool_use`,id:String(o.call_id??o.id??``),name:String(o.name??``),input:o.type===`function_call`?Sn(o.arguments):{input:o.input??``}}):o.type===`function_call_output`||o.type===`custom_tool_call_output`?a(`user`,{type:`tool_result`,tool_use_id:String(o.call_id??``),content:Cn(o.output)}):o.type===`local_shell_call`&&a(`assistant`,{type:`tool_use`,id:String(o.call_id??o.id??``),name:`shell`,input:o.action??{}})}}return{agent:`codex`,agentVersion:r,model:n,cwd:i,events:[{type:`system`,subtype:`init`,agent:`Codex`,agent_version:r,model:n},...t],loaded:[...new Set(t.flatMap(Vt))]}}function bn(e){try{let t=JSON.parse(e);return t.type===`session_meta`?Q(t.payload?.cwd):null}catch{return null}}const Q=e=>typeof e==`string`&&e?e:null;function xn(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>typeof e.text==`string`?e.text:``).filter(Boolean).join(`
114
+ `):``}function Sn(e){if(typeof e!=`string`)return e??{};try{return JSON.parse(e)}catch{return{arguments:e}}}function Cn(e){if(typeof e==`string`){try{let t=JSON.parse(e);if(typeof t?.output==`string`)return t.output}catch{}return e}if(Array.isArray(e))return xn(e);if(typeof e==`object`&&e){let{content:t,output:n}=e;if(typeof n==`string`)return n;if(t!==void 0)return Cn(t)}return JSON.stringify(e??``)}const wn=()=>process.env.CLAUDE_CONFIG_DIR??d(m(),`.claude`),Tn=()=>process.env.CODEX_HOME??d(m(),`.codex`),En=(e,t=wn())=>d(t,`projects`,e.replace(/[^A-Za-z0-9]/g,`-`));async function Dn(e,t,n=process.cwd()){if(t&&c(t))return p(t);let r=e===`claude-code`?await An(t,n):await jn(t,n);if(r)return r.file;throw Error(t?`No ${kn(e)} session "${t}" on this machine.`:`No ${kn(e)} session for ${n}. Run this from the folder the session runs in, or pass --session <id or path>.`)}async function On(e=process.cwd()){if(process.env.CLAUDECODE===`1`)return`claude-code`;if(Object.keys(process.env).some(e=>e.startsWith(`CODEX_`)))return`codex`;let[t,n]=await Promise.all([An(void 0,e),jn(void 0,e)]);if(t&&(!n||t.mtime>=n.mtime))return`claude-code`;if(n)return`codex`;throw Error(`No Claude Code or Codex session for ${e}. Pass --agent and --session.`)}const kn=e=>e===`claude-code`?`Claude Code`:`Codex`;async function An(e,t){if(e){let t=d(wn(),`projects`),n=await $(t);for(let r of n){let n=d(t,r,`${e}.jsonl`);if(c(n))return{file:n,mtime:0}}return null}for(let e of In(t)){let t=En(e),n=(await $(t)).filter(e=>e.endsWith(`.jsonl`));if(n.length>0)return Fn(n.map(e=>d(t,e)))}return null}async function jn(e,t){let n=d(Tn(),`sessions`),r=[],i=0;outer:for(let e of Mn(await $(n)))for(let t of Mn(await $(d(n,e))))for(let a of Mn(await $(d(n,e,t)))){let o=d(n,e,t,a);for(let e of await $(o))e.startsWith(`rollout-`)&&e.endsWith(`.jsonl`)&&r.push(d(o,e));if(r.length>=300||++i>=14)break outer}return Nn(r,e,t)}const Mn=e=>e.sort().reverse();async function Nn(e,t,n){if(t){let n=e.find(e=>l(e).includes(t));return n?{file:n,mtime:0}:null}let r=In(n),i=/* @__PURE__ */ new Map;for(let t of e){let e=await Pn(t);e&&r.includes(e)&&i.set(e,[...i.get(e)??[],t])}for(let e of r){let t=i.get(e);if(t)return Fn(t)}return null}async function Pn(e){let t=await S(e,`r`);try{let e=Buffer.alloc(262144),{bytesRead:n}=await t.read(e,0,e.length,0),r=e.subarray(0,n).toString(`utf8`),i=r.indexOf(`
115
+ `);return bn(i===-1?r:r.slice(0,i))??(JSON.parse(`"${r.match(/"cwd":"((?:[^"\\]|\\.)*)"/)?.[1]??``}"`)||null)}finally{await t.close()}}async function Fn(e){let t=null;for(let n of e){let{mtimeMs:e}=await te(n);(!t||e>t.mtime)&&(t={file:n,mtime:e})}return t}async function $(e){try{return await ee(e)}catch{return[]}}function In(e){let t=[p(e)];for(;u(t.at(-1))!==t.at(-1);)t.push(u(t.at(-1)));return t}const Ln=2e3;function Rn(e){let t=[...e.map],n=Vn(()=>_().username);n&&n.length>=3&&t.push({find:n,replace:`user`});let r=Vn(()=>h());r&&r.length>=3&&r!==`localhost`&&t.push({find:r,replace:`host`});let i=zn();if(i){t.push({find:i,replace:`acme/app`});let e=i.split(`/`)[0];e.length>=3&&t.push({find:e,replace:`acme`})}let a=Vn(()=>v(`git`,[`rev-parse`,`--show-toplevel`],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim());return{replacements:t,paths:[...[...new Set([...e.cwds,a].filter(Boolean))].map(e=>({path:e,as:`<repo>`})),{path:m(),as:`~`}],maxToolText:e.fullOutputs?null:Ln}}function zn(){return Vn(()=>v(`git`,[`remote`,`get-url`,`origin`],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim())?.match(/[:/]([^/:]+\/[^/]+?)(?:\.git)?$/)?.[1]??null}function Bn(e){let t;try{t=JSON.parse(e)}catch{throw Error(`--map isn't valid JSON.`)}let n=Array.isArray(t)?t.map(e=>[e?.find,e?.replace]):typeof t==`object`&&t?Object.entries(t):null;if(!n||!n.every(([e,t])=>typeof e==`string`&&typeof t==`string`))throw Error(`--map must be an object of words to replace, like {"Acme Corp": "Example Inc"}.`);return n.map(([e,t])=>({find:e,replace:t}))}function Vn(e){try{return e()}catch{return null}}function Hn(e,t,n){let r=new Set(t),i=/* @__PURE__ */ new Map;for(let t of n)for(let[n,a]of Object.entries(t.skills))Wn(a.agents,e)&&(i.has(n)||i.set(n,{name:n,skillId:a.id,version:a.version,triggered:r.has(n)}));for(let e of t)e===`report-session-issue`||i.has(e)||i.set(e,{name:e,skillId:null,version:null,triggered:!0});return i.delete(Ft),[...i.values()]}const Un=[`codex`,`cursor`,`gemini-cli`],Wn=(e,t)=>e.length===0||e.includes(t)||Un.includes(t)&&e.some(e=>Un.includes(e));async function Gn(e){z(`agent kit report`);let t=await Kn(e.agent[0]),n=await Dn(t,e.session||void 0),r=await C(n,`utf8`),i=zt(t===`claude-code`?hn(r):yn(r));if(i.events.length<2)throw Error(`${n} has no conversation to report.`);let a=pn(Rn({map:e.map?Bn(await qn(e.map)):[],cwds:i.cwd?[i.cwd]:[],fullOutputs:e.fullOutputs})),o=a.text(Yn(e.title,`--title`,`a short title`)),s=a.text(Yn(e.note,`--note`,`what went wrong`)),c=e.expected?a.text(e.expected):null,l=mn(a.events(i.events)),u=await Promise.all([Z(X(`project`)),Z(X(`global`))]),f=Hn(t,i.loaded,u),p={title:o,note:s,expected:c,agent:t,agentVersion:i.agentVersion,model:i.model,skills:f,transcript:l},m=d(g(),`a-kit-report-${Date.now()}.jsonl`);if(await T(m,l),R.info([`${kn(t)} session: ${n}`,`Model: ${i.model??`unknown`}, ${i.events.length-1} messages`,`Skills: ${Zn(f)}`,`Taken out: ${Qn(a.counts)}`,`Scrubbed transcript: ${m}`].join(`
116
+ `)),Buffer.byteLength(l)>on.maxTranscriptBytes)throw Error(`The transcript is over ${on.maxTranscriptBytes/1024/1024} MB.${e.fullOutputs?` Leave out --full-outputs.`:``}`);if(e.dryRun){B(`Nothing was sent. Check the file above, then run it again without --dry-run.`);return}if(!e.yes){if(!W())throw Error(`Check the scrubbed transcript, then pass --yes to send it.`);if(!G(await st({message:`Send this report to agent kit?`}))){B(`Not sent.`);return}}let{api:h,credentials:_}=await Pt(),[v,y]=await Promise.all([h.listOrganizations(),h.listSkills()]),b=Xn(e.org,v,y,f),x=await h.createReport(b.id,p);B(`Reported: ${_.webUrl}/app/orgs/${b.id}/reports/${x.id}`)}async function Kn(e){if(e===void 0)return On();if(e===`claude-code`||e===`codex`)return e;throw Error(`a-kit report reads Claude Code and Codex sessions; --agent must be claude-code or codex.`)}const qn=e=>e===`-`?Jn():C(e,`utf8`);async function Jn(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString(`utf8`)}function Yn(e,t,n){if(!e?.trim())throw Error(`Pass ${t} with ${n}.`);return e}function Xn(e,t,n,r){let i=()=>t.map(e=>`${e.name} (${e.id})`).join(`, `);if(e){let n=t.filter(t=>t.id===e||t.name===e);if(n.length===1)return n[0];throw Error(`--org: none of your organizations is "${e}". Yours: ${i()}`)}let a=new Set(r.map(e=>e.skillId).filter(Boolean)),o=new Set(n.filter(e=>a.has(e.id)).map(e=>e.organizationId));if(o.size===1){let e=t.find(e=>o.has(e.id));if(e)return e}if(t.length===1)return t[0];throw Error(`Which organization is it for? Pass --org with one of: ${i()}`)}function Zn(e){return e.length===0?`none`:e.map(e=>`${e.name}${e.version?` v${e.version}`:``}${e.triggered?` (loaded)`:``}`).join(`, `)}function Qn(e){let t=Object.entries(e);return t.length===0?`nothing`:t.map(([e,t])=>e===`cut`?`${t} tool outputs cut to ${Ln} characters`:`${e} ×${t}`).join(`, `)}async function $n(e){z(`agent kit`);let t=e.global?`global`:`project`,n=X(t),r=await Z(n),i=Object.entries(r.skills);if(i.length===0){B(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 Pt(),o=i.flatMap(([,e])=>vt(e.agents.map(e=>U(e)).filter(e=>e!==void 0),t));await Ut([...new Set(o)]);let s=0;for(let[e,o]of i){let i;try{i=await a.getSkill(o.id)}catch(t){if(t instanceof q&&t.status===404){R.warn(`${e} isn't in your agent kit anymore; left it as it is.`);continue}throw t}if(i.version===o.version)continue;let c=vt(o.agents.map(e=>U(e)).filter(e=>e!==void 0),t);if(await Jt(a,o.id,c),i.name!==e){for(let t of c)await w(d(t,e),{recursive:!0,force:!0});delete r.skills[e]}r.skills[i.name]={...o,version:i.version},await Yt(n,r),R.success(`${i.name}: v${o.version} → v${i.version}`+(i.name===e?``:` (was ${e})`)),s++}B(s===0?`Everything is up to date.`:`Updated ${s} skill${s===1?``:`s`}.`)}const er=`a-kit ${ht}: your agent kit skills, in your agents.
62
117
 
63
118
  Usage
64
119
  a-kit init Log in and pick skills to install
65
120
  a-kit add [skill...] Install skills (asks which when none is named)
66
121
  a-kit update Update the installed skills to their latest version
67
122
  a-kit list Your skills, and where they're installed
123
+ a-kit report Send an agent session that went wrong, scrubbed
68
124
  a-kit login Log in through the browser
69
125
  a-kit logout Log out
70
126
  a-kit whoami Who you're logged in as
71
127
 
72
128
  Options
73
129
  -g, --global Install in your home folder instead of this project
74
- -a, --agent <id> Install for this agent (repeatable): ${W.map(e=>e.id).join(`, `)}
130
+ -a, --agent <id> Install for this agent (repeatable): ${H.map(e=>e.id).join(`, `)}
75
131
  -y, --yes Don't ask; use the defaults
76
132
  -h, --help Show this help
133
+
134
+ Report options (the report-session-issue skill passes them for you)
135
+ --title <text> A short title
136
+ --note <text> What went wrong
137
+ --expected <text> What should have happened
138
+ --session <id|path> The session; defaults to this folder's latest
139
+ --map <file|-> JSON of private words to replace: {"Acme": "Example"}
140
+ --org <id|name> The organization, when it can't tell
141
+ --full-outputs Keep tool outputs whole (they're cut to 2,000 characters)
142
+ --dry-run Scrub and show what would be sent, without sending
77
143
  -v, --version Show the version
78
- `;async function Lt(){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(It);let a={global:t.global,agent:t.agent.flatMap(e=>e.split(`,`)).filter(Boolean),yes:t.yes};switch(r){case`init`:return kt(a);case`add`:case`install`:return Ot(i,a);case`update`:return Ft(a);case`list`:case`ls`:return At();case`login`:return Mt();case`logout`:return Nt();case`whoami`:return Pt();default:throw Error(`Unknown command "${r}". Run \`a-kit --help\`.`)}}Lt().catch(e=>{B.error(e instanceof Error?e.message:String(e)),process.exitCode=1});export{};
144
+ `;async function tr(){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},session:{type:`string`},title:{type:`string`},note:{type:`string`},expected:{type:`string`},map:{type:`string`},org:{type:`string`},"full-outputs":{type:`boolean`,default:!1},"dry-run":{type:`boolean`,default:!1}}});if(t.version)return console.log(ht);let[r,...i]=n;if(t.help||!r)return console.log(er);let a={global:t.global,agent:t.agent.flatMap(e=>e.split(`,`)).filter(Boolean),yes:t.yes};switch(r){case`init`:return $t(a);case`add`:case`install`:return Qt(i,a);case`update`:return $n(a);case`list`:case`ls`:return en();case`login`:return nn();case`logout`:return rn();case`whoami`:return an();case`report`:return Gn({...a,session:t.session,title:t.title,note:t.note,expected:t.expected,map:t.map,org:t.org,fullOutputs:t[`full-outputs`],dryRun:t[`dry-run`]});default:throw Error(`Unknown command "${r}". Run \`a-kit --help\`.`)}}tr().catch(e=>{R.error(e instanceof Error?e.message:String(e)),process.exitCode=1});export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "useakit",
3
- "version": "0.1.0-dev.9",
3
+ "version": "0.2.0-dev.15",
4
4
  "description": "Install your agent kit skills into Claude Code, Codex, Cursor and Gemini CLI.",
5
5
  "keywords": [
6
6
  "agent-kit",