@eloqnt/cli 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # `@eloqnt/cli`
2
+
3
+ Lint and translate your app with [eloqnt/studio](https://studio.eloqnt.dev).
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import e from"node:process";import{defineCommand as t,runMain as n}from"citty";try{e.loadEnvFile()}catch{}n(t({meta:{name:`eloqnt`,description:`AI-powered translations for developers`},subCommands:{status:r(()=>import(`../status-B4lvo1TO.mjs`)),lint:r(()=>import(`../lint-Der-f_t7.mjs`)),translate:r(()=>import(`../translate-Cz-hJ6Gv.mjs`)),login:r(()=>import(`../login-qJXHaxC9.mjs`)),logout:r(()=>import(`../logout-Dv-YLq8P.mjs`)),whoami:r(()=>import(`../whoami-CR34U7uT.mjs`))}}));function r(e){return()=>e().then(e=>e.default)}export{};
2
+ import e from"node:process";import{defineCommand as t,runMain as n}from"citty";try{e.loadEnvFile()}catch{}n(t({meta:{name:`eloqnt`,description:`AI-powered translations for developers`},subCommands:{status:r(()=>import(`../status-B4lvo1TO.mjs`)),lint:r(()=>import(`../lint-BGq3Vdt3.mjs`)),translate:r(()=>import(`../translate-Cz-hJ6Gv.mjs`)),login:r(()=>import(`../login-qJXHaxC9.mjs`)),logout:r(()=>import(`../logout-Dv-YLq8P.mjs`)),whoami:r(()=>import(`../whoami-CR34U7uT.mjs`))}}));function r(e){return()=>e().then(e=>e.default)}export{};
@@ -1,4 +1,4 @@
1
1
  import{t as e}from"./defineEloqntCommand-CsM_g_XS.mjs";import{lint as t}from"@eloqnt/sdk";import n from"node:process";import{relative as r,resolve as i}from"node:path";import a from"picocolors";const o=new Intl.Segmenter,s=[[4352,4447],[9001,9002],[11904,12350],[12353,13311],[13312,19903],[19968,40959],[40960,42191],[44032,55203],[63744,64255],[65040,65049],[65072,65135],[65280,65376],[65504,65510],[126976,127743],[127744,129791],[131072,262141]];function c(e){let t=[];for(let{segment:n}of o.segment(e))t.push({text:n,width:u(n)});return t}function l(e){let t=0;for(let{segment:n}of o.segment(e))t+=u(n);return t}function u(e){let t=e.codePointAt(0)??0;return d(t)?0:s.some(([e,n])=>t>=e&&t<=n)?2:1}function d(e){return e<=31||e>=127&&e<=159||e>=768&&e<=879||e>=8203&&e<=8207||e>=8232&&e<=8238||e>=8288&&e<=8292||e===65279}var f=e({meta:{name:`lint`,description:`Statically analyze your source code and messages for common problems.`},async execute({config:e,rootDir:a}){let{messages:o,srcPath:s}=e;function c(e){return(Array.isArray(e)?e:[e]).map(e=>i(a,e))}let l=await t({messagesPath:c(o.path),sourceLocale:o.sourceLocale,format:o.format,locales:o.locales,srcPath:s?c(s):void 0,cwd:a}),u=n.cwd();return{issues:l.map(e=>e.location?{...e,location:{...e.location,file:r(u,e.location.file)}}:e),sourceLocale:o.sourceLocale}},render:({issues:e,sourceLocale:t})=>p(e,t),ok:({issues:e})=>e.length===0,json:({issues:e})=>e});function p(e,t){if(e.length===0)return`\n${a.green(`No issues found`)}`;let n=Object.groupBy(e,e=>e.location?.file??e.locale),r=m(Object.entries(n),t).map(([e,n])=>h(e,n,n[0].locale===t)),i=`${e.length} ${e.length===1?`issue`:`issues`}`,o=a.bold(a.red(`${i} found`));return`\n${[...r,o].join(`
2
2
 
3
3
  `)}`}function m(e,t){let n=e.findIndex(([,e])=>e[0].locale===t);if(n<=0)return e;let r=[...e],[i]=r.splice(n,1);return[i,...r]}function h(e,t,n){let r=[n?`${a.cyan(e)} ${a.dim(`(source locale)`)}`:a.cyan(e)];for(let e of t){r.push(a.dim(`│`));let{content:t,span:n}=g(e);r.push(y(t)),r.push(...v(n,e.message,e.rule))}return r.join(`
4
- `)}function g(e){let t=`"${e.key}"`,n=e.targetMessage??e.sourceMessage,r=_(t),i=e.highlight?.type===`value`||e.highlight?.type===`argument`,o=i?a.dim(t):t,s=a.dim(`: `),c=l(t);if(n!==void 0&&e.highlight?.type===`argument`){let t=w(n),i=`{${e.highlight.name}}`,a=t.indexOf(i);if(a>=0){let{inner:e,offset:n}=b(t,a,i.length,r);return{content:`${o}${s}"${e}"`,span:{column:c+3+n,length:l(i)}}}}let u=n===void 0?`"…"`:`"${T(w(n),r)}"`,d=`${o}${s}${i?u:a.dim(u)}`;return n!==void 0&&e.highlight?.type===`value`?{content:d,span:{column:c+2,length:l(u)}}:{content:d,span:{column:0,length:c}}}function _(e){let t=3+l(e)+2+2;return Math.max(24,Math.min(48,80-t))}function v(e,t,n){let r=Math.min(1,e.length-1),i=`─`.repeat(r)+`┬`+`─`.repeat(e.length-1-r),o=`${t} ${a.dim(`(${n})`)}`;return[y(` `.repeat(e.column)+a.yellow(i)),y(`${` `.repeat(e.column+r)}${a.yellow(`╰─`)} ${o}`)]}function y(e){return a.dim(`│ `)+e}function b(e,t,n,r){let i=c(e),a=i.reduce((e,t)=>e+t.width,0),o=x(i,t),s=x(i,t+n);if(a<=r)return{inner:e,offset:S(i,0,o)};let l=Math.max(S(i,o,s),r-2),u=o,d=0;for(;u>0&&d+i[u-1].width<=16;)u--,d+=i[u].width;let f=o;for(;f<i.length&&d+i[f].width<=l;)d+=i[f].width,f++;for(;u>0&&d+i[u-1].width<=l;)u--,d+=i[u].width;let p=u>0?`…`:``,m=f<i.length?`…`:``;return{inner:p+i.slice(u,f).map(e=>e.text).join(``)+m,offset:S(i,u,o)+p.length}}function x(e,t){let n=0;for(let r=0;r<e.length;r++){if(n>=t)return r;n+=e[r].text.length}return e.length}function S(e,t,n){let r=0;for(let i=t;i<n;i++)r+=e[i].width;return r}const C=RegExp(`[\0--Ÿ]`,`g`);function w(e){return e.replace(/\s+/g,` `).replace(C,``).trim()}function T(e,t){if(l(e)<=t)return e;let n=``,r=0;for(let i of c(e)){if(r+i.width>t-1)break;n+=i.text,r+=i.width}return`${n}…`}export{f as default,p as formatLint};
4
+ `)}function g(e){let t=`"${e.key}"`,n=e.targetMessage??e.sourceMessage,r=_(t),i=e.highlight?.type===`value`||e.highlight?.type===`argument`,o=i?a.dim(t):t,s=a.dim(`: `),c=l(t);if(n!==void 0&&e.highlight?.type===`argument`){let t=w(n),i=e.highlight.token,a=t.indexOf(i);if(a>=0){let{inner:e,offset:n}=b(t,a,i.length,r);return{content:`${o}${s}"${e}"`,span:{column:c+3+n,length:l(i)}}}}let u=n===void 0?`"…"`:`"${T(w(n),r)}"`,d=`${o}${s}${i?u:a.dim(u)}`;return n!==void 0&&e.highlight?.type===`value`?{content:d,span:{column:c+2,length:l(u)}}:{content:d,span:{column:0,length:c}}}function _(e){let t=3+l(e)+2+2;return Math.max(24,Math.min(48,80-t))}function v(e,t,n){let r=Math.min(1,e.length-1),i=`─`.repeat(r)+`┬`+`─`.repeat(e.length-1-r),o=`${t} ${a.dim(`(${n})`)}`;return[y(` `.repeat(e.column)+a.yellow(i)),y(`${` `.repeat(e.column+r)}${a.yellow(`╰─`)} ${o}`)]}function y(e){return a.dim(`│ `)+e}function b(e,t,n,r){let i=c(e),a=i.reduce((e,t)=>e+t.width,0),o=x(i,t),s=x(i,t+n);if(a<=r)return{inner:e,offset:S(i,0,o)};let l=Math.max(S(i,o,s),r-2),u=o,d=0;for(;u>0&&d+i[u-1].width<=16;)u--,d+=i[u].width;let f=o;for(;f<i.length&&d+i[f].width<=l;)d+=i[f].width,f++;for(;u>0&&d+i[u-1].width<=l;)u--,d+=i[u].width;let p=u>0?`…`:``,m=f<i.length?`…`:``;return{inner:p+i.slice(u,f).map(e=>e.text).join(``)+m,offset:S(i,u,o)+p.length}}function x(e,t){let n=0;for(let r=0;r<e.length;r++){if(n>=t)return r;n+=e[r].text.length}return e.length}function S(e,t,n){let r=0;for(let i=t;i<n;i++)r+=e[i].width;return r}const C=RegExp(`[\0--Ÿ]`,`g`);function w(e){return e.replace(/\s+/g,` `).replace(C,``).trim()}function T(e,t){if(l(e)<=t)return e;let n=``,r=0;for(let i of c(e)){if(r+i.width>t-1)break;n+=i.text,r+=i.width}return`${n}…`}export{f as default,p as formatLint};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eloqnt/cli",
3
- "version": "0.0.2",
4
- "description": "eloqnt CLI",
3
+ "version": "0.0.3",
4
+ "description": "CLI for eloqnt/studio",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/eloqnt/studio.git",
@@ -29,7 +29,7 @@
29
29
  "citty": "^0.1.6",
30
30
  "open": "^11.0.0",
31
31
  "picocolors": "^1.1.1",
32
- "@eloqnt/sdk": "0.0.2"
32
+ "@eloqnt/sdk": "0.0.3"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^25.9.1"