@eloqnt/cli 0.6.3 → 0.6.5
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @eloqnt/cli
|
|
2
2
|
|
|
3
|
+
## 0.6.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 934ab84: `eloqnt lint` now links the docs for the rules it reports (also for `--json` and GitHub Actions annotations)
|
|
8
|
+
|
|
9
|
+
## 0.6.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [042cbc4]
|
|
14
|
+
- @eloqnt/sdk@0.6.4
|
|
15
|
+
|
|
3
16
|
## 0.6.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/bin/eloqnt.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import e from"node:process";import{defineCommand as t,renderUsage as n,runMain as r}from"citty";import i from"picocolors";var a=`0.6.
|
|
2
|
+
import e from"node:process";import{defineCommand as t,renderUsage as n,runMain as r}from"citty";import i from"picocolors";var a=`0.6.5`;try{e.loadEnvFile()}catch{}const o=t({meta:{name:`eloqnt`,version:a,description:`AI-powered translations for developers`},subCommands:{lint:d(()=>import(`../lint-BHoQowEL.mjs`)),review:d(()=>import(`../review-C_Op7_7I.mjs`)),translate:d(()=>import(`../translate-0d7JNq0l.mjs`)),crowdin:d(()=>import(`../crowdin-BXlNSsuT.mjs`)),login:d(()=>import(`../login-CeogRhyV.mjs`)),logout:d(()=>import(`../logout-BjdvLusP.mjs`)),whoami:d(()=>import(`../whoami-CTueGAHT.mjs`))}}),s=e.argv.slice(2);r(o,{rawArgs:s.length===1&&s[0]===`-v`?[`--version`]:s,async showUsage(e,t){console.log(await n(e,t)),console.log(i.dim(`Docs: ${await c(e,t)}`))}});async function c(e,t){let n=(await u(e.meta))?.name,r=(await u(t?.meta))?.name,i=r===void 0||r===`eloqnt`?n:r;return i===void 0||i===`eloqnt`?`https://studio.eloqnt.dev/docs`:`https://studio.eloqnt.dev/docs/cli/${await l(i)}`}async function l(e){let t=o.subCommands??{};if(e in t)return e;for(let[n,r]of Object.entries(t)){let t=(await u(r))?.subCommands;if(t&&e in t)return n}return e}function u(e){return typeof e==`function`?e():e}function d(e){return()=>e().then(e=>e.default)}export{a as t};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import{t as e}from"./defineEloqntCommand-BNNDggcZ.mjs";import{a as t,i as n,o as r,r as i,s as a,t as o}from"./stringWidth-Ba8f3rhS.mjs";import{t as s}from"./resolvePaths-Bc7dGH8a.mjs";import{lint as c}from"@eloqnt/sdk";import l from"node:process";import u from"picocolors";import{basename as d,relative as f,resolve as p}from"node:path";var m=e({meta:{name:`lint`,description:`Statically analyze your source code and messages for common problems.`},args:{strict:{type:`boolean`,description:`Exit with a non-zero code when warnings are found`,default:!1}},async execute({config:e,rootDir:t,args:n}){let{messages:r,srcPath:i}=e,a=await c({messagesPath:s(r.path,t),sourceLocale:r.sourceLocale,format:r.format,locales:r.locales,srcPath:i?s(i,t):void 0,cwd:t}),o=l.cwd();return{issues:a.map(e=>{let t=e;if(t.location&&(t={...t,location:{...t.location,file:f(o,t.location.file)}}),t.rule===`undefined-key`&&t.sourceReferences?.length){let e=t.sourceReferences.map(e=>({...e,path:f(o,e.path)})),n=e[0].line?`${e[0].path}:${e[0].line}`:e[0].path,r=e.length>1?` (+${e.length-1} more)`:``,i=t.location?d(t.location.file):`the source catalog`;t={...t,sourceReferences:e,message:`Used in ${n}${r} but not defined in ${i}`}}return t}),sourceLocale:r.sourceLocale,noSrcPath:!i,strict:!!n.strict}},render:({issues:e,sourceLocale:t,noSrcPath:n})=>{let r=
|
|
2
|
-
`),s=e.filter(e=>e.rule===`missing-translation`).length,c=s
|
|
1
|
+
import{t as e}from"./defineEloqntCommand-BNNDggcZ.mjs";import{a as t,i as n,o as r,r as i,s as a,t as o}from"./stringWidth-Ba8f3rhS.mjs";import{t as s}from"./resolvePaths-Bc7dGH8a.mjs";import{lint as c}from"@eloqnt/sdk";import l from"node:process";import u from"picocolors";import{basename as d,relative as f,resolve as p}from"node:path";var m=e({meta:{name:`lint`,description:`Statically analyze your source code and messages for common problems.`},args:{strict:{type:`boolean`,description:`Exit with a non-zero code when warnings are found`,default:!1}},async execute({config:e,rootDir:t,args:n}){let{messages:r,srcPath:i}=e,a=await c({messagesPath:s(r.path,t),sourceLocale:r.sourceLocale,format:r.format,locales:r.locales,srcPath:i?s(i,t):void 0,cwd:t}),o=l.cwd();return{issues:a.map(e=>{let t=e;if(t.location&&(t={...t,location:{...t.location,file:f(o,t.location.file)}}),t.rule===`undefined-key`&&t.sourceReferences?.length){let e=t.sourceReferences.map(e=>({...e,path:f(o,e.path)})),n=e[0].line?`${e[0].path}:${e[0].line}`:e[0].path,r=e.length>1?` (+${e.length-1} more)`:``,i=t.location?d(t.location.file):`the source catalog`;t={...t,sourceReferences:e,message:`Used in ${n}${r} but not defined in ${i}`}}return t}),sourceLocale:r.sourceLocale,noSrcPath:!i,strict:!!n.strict}},render:({issues:e,sourceLocale:t,noSrcPath:n})=>{let r=g(e,t),i=n?`\n${u.dim("– Skipped source code analysis due to absent `srcPath`")}\n${r}`:r;return l.env.GITHUB_ACTIONS&&e.length>0?`${i}\n${v(e)}`:i},ok:({issues:e,strict:t})=>t?e.length===0:!e.some(e=>e.severity===`error`),json:({issues:e})=>e.map(e=>({...e,docsUrl:h(e.rule)}))});function h(e){return`https://studio.eloqnt.dev/docs/lint-rules/${e}`}function g(e,t){if(e.length===0)return`\n${u.green(`No issues found`)}\n`;let n=Object.groupBy(e,e=>e.location?.file??e.locale),r=S(Object.entries(n),t).map(([e,n])=>C(e,n,n[0].locale===t)),i=e.filter(e=>e.severity===`error`).length,a=e.length-i,o=[i>0&&u.bold(u.red(`✗ ${_(i,`error`)}`)),a>0&&u.bold(u.yellow(`! ${_(a,`warning`)}`))].filter(Boolean).join(`
|
|
2
|
+
`),s=e.filter(e=>e.rule===`missing-translation`).length,c=[e.some(e=>e.rule!==`missing-translation`)&&u.dim(`→ Rule details: ${h(`<rule>`)}`),s>0&&u.dim(`→ Run \`eloqnt translate\` to fill in ${s} missing ${s===1?`translation`:`translations`}`)].filter(Boolean).join(`
|
|
3
|
+
`);return`\n${[...r,o,c].filter(Boolean).join(`
|
|
3
4
|
|
|
4
|
-
`)}\n`}function
|
|
5
|
-
`)}function
|
|
6
|
-
`)}function
|
|
5
|
+
`)}\n`}function _(e,t){return`${e} ${e===1?t:`${t}s`}`}function v(e){return e.map(e=>{let t=e.rule===`undefined-key`&&e.sourceReferences?.length?e.sourceReferences[0]:void 0,n=t?.path??e.location?.file,r=[n&&`file=${x(y(n))}`,t?.line&&`line=${t.line}`,`title=${x(e.rule)}`].filter(Boolean).join(`,`),i=b(`"${e.key}": ${e.message}\n${h(e.rule)}`);return`::${e.severity} ${r}::${i}`}).join(`
|
|
6
|
+
`)}function y(e){let t=l.env.GITHUB_WORKSPACE;return t?f(t,p(e)):e}function b(e){return e.replace(/%/g,`%25`).replace(/\r/g,`%0D`).replace(/\n/g,`%0A`)}function x(e){return b(e).replace(/:/g,`%3A`).replace(/,/g,`%2C`)}function S(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 C(e,t,n){let i=[n?`${u.cyan(e)} ${u.dim(`(source locale)`)}`:u.cyan(e)];for(let e of t){i.push(u.dim(`│`));let{content:t,span:n}=w(e);i.push(r(t)),i.push(...E(n,e))}return i.join(`
|
|
7
|
+
`)}function w(e){let n=`"${e.key}"`,r=e.targetMessage??e.sourceMessage,o=T(n),s=e.highlight?.type===`value`||e.highlight?.type===`argument`,c=s?u.dim(n):n,l=u.dim(`: `),d=i(n);if(r!==void 0&&e.highlight?.type===`argument`){let t=a(r),n=e.highlight.token,s=t.indexOf(n);if(s>=0){let{inner:e,offset:r}=D(t,s,n.length,o);return{content:`${c}${l}"${e}"`,span:{column:d+3+r,length:i(n)}}}}let f=r===void 0?`"…"`:`"${t(a(r),o)}"`,p=`${c}${l}${s?f:u.dim(f)}`;return r!==void 0&&e.highlight?.type===`value`?{content:p,span:{column:d+2,length:i(f)}}:{content:p,span:{column:0,length:d}}}function T(e){let t=3+i(e)+2+2;return Math.max(24,Math.min(48,n()-t))}function E(e,t){let n=t.severity===`error`?u.red:u.yellow,i=Math.min(1,e.length-1),a=`─`.repeat(i)+`┬`+`─`.repeat(e.length-1-i),o=`${t.message} ${u.dim(`(${t.rule})`)}`;return[r(` `.repeat(e.column)+n(a)),r(`${` `.repeat(e.column+i)}${n(`╰─`)} ${o}`)]}function D(e,t,n,r){let i=o(e),a=i.reduce((e,t)=>e+t.width,0),s=O(i,t),c=O(i,t+n);if(a<=r)return{inner:e,offset:k(i,0,s)};let l=Math.max(k(i,s,c),r-2),u=s,d=0;for(;u>0&&d+i[u-1].width<=16;)u--,d+=i[u].width;let f=s;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:k(i,u,s)+p.length}}function O(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 k(e,t,n){let r=0;for(let i=t;i<n;i++)r+=e[i].width;return r}export{m as default,v as formatGithubAnnotations,g as formatLint};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eloqnt/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "CLI for eloqnt/studio",
|
|
5
5
|
"homepage": "https://studio.eloqnt.dev",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"citty": "^0.1.6",
|
|
27
27
|
"open": "^11.0.0",
|
|
28
28
|
"picocolors": "^1.1.1",
|
|
29
|
-
"@eloqnt/sdk": "0.6.
|
|
29
|
+
"@eloqnt/sdk": "0.6.4"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^25.9.1"
|