glance-cli 0.16.1 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cli.js +2 -3
- package/package.json +4 -2
- package/src/cli/commands.ts +4 -1
- package/src/cli/config.ts +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/glance-cli)
|
|
6
6
|
[](https://www.npmjs.com/package/glance-cli)
|
|
7
|
+
[](https://github.com/jkenley/glance-cli/actions/workflows/test.yml)
|
|
7
8
|
[](https://opensource.org/licenses/MIT)
|
|
8
9
|
|
|
9
10
|
---
|
package/dist/cli.js
CHANGED
|
@@ -338,7 +338,7 @@ ${X}`,Z}async function n3(_,$){rB($.language);let q=i3($.model),Z=tB(_,$);switch
|
|
|
338
338
|
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}async listVoices(_){let $=process.platform;if(this.client&&this.apiKey)try{let q=await this.client.voices.getAll(),Z=[];if(Z.push("\uD83C\uDFA4 Available Voices (use name or voice ID):"),Z.push(""),Z.push("\uD83C\uDDFA\uD83C\uDDF8 ENGLISH VOICES:"),Object.entries(D0.en).forEach(([Q,X])=>{if(Q!=="default"){if(q.voices.find((Y)=>Y.voiceId===X))Z.push(` • ${Q} → ${this.getVoiceDescription(Q)}`)}}),Z.push(""),D0.fr){let Q=[];if(Object.entries(D0.fr).forEach(([X,J])=>{if(X!=="default"){if(q.voices.find((K)=>K.voiceId===J))Q.push(` • ${X} → ${this.getVoiceDescription(X)}`)}}),Q.length>0)Z.push("\uD83C\uDDEB\uD83C\uDDF7 FRENCH VOICES:"),Z.push(...Q),Z.push("")}if(D0.es){let Q=[];if(Object.entries(D0.es).forEach(([X,J])=>{if(X!=="default"){if(q.voices.find((K)=>K.voiceId===J))Q.push(` • ${X} → ${this.getVoiceDescription(X)}`)}}),Q.length>0)Z.push("\uD83C\uDDEA\uD83C\uDDF8 SPANISH VOICES:"),Z.push(...Q),Z.push("")}if(D0.ht)Z.push("\uD83C\uDDED\uD83C\uDDF9 HAITIAN CREOLE:"),Z.push(" • Uses English voice with optimized settings"),Z.push("");return Z.push("\uD83D\uDCA1 USAGE EXAMPLES:"),Z.push(" glance https://example.com --voice nova --read"),Z.push(" glance https://example.com --voice antoine -l fr --read"),Z.push(" glance https://example.com --voice isabella -l es --read"),Z.push(""),Z.push("⚠️ NOTE: Only the voices listed above work with simple names."),Z.push(" For other voices, use the full voice ID (long string)."),Z.push(""),Z.push("\uD83D\uDD0D ALL AVAILABLE VOICES IN YOUR ACCOUNT:"),q.voices.forEach((Q)=>{Z.push(` ${Q.name} (${Q.voiceId})`)}),Z}catch(q){console.warn("Failed to fetch ElevenLabs voices:",q)}if($==="darwin")return new Promise((q)=>{let Z=R0("say",["-v","?"]),Q="";Z.stdout.on("data",(X)=>{Q+=X.toString()}),Z.on("close",()=>{let X=Q.split(`
|
|
339
339
|
`).filter((J)=>J.trim()).map((J)=>{let Y=J.split(/\s+/),K=Y[0],H=Y.slice(1).join(" ");return`${K} - ${H} [LOCAL]`});q(X)}),Z.on("error",()=>{q([])})});return[]}}function o3(_){return new Cq(_)}function Tq(_){let $=_.replace(/#{1,6}\s/g,"").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/^[-*+]\s/gm,"").replace(/^\d+\.\s/gm,"");$=$.replace(/\n{3,}/g,`
|
|
340
340
|
|
|
341
|
-
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}var e={VERSION:"0.16.
|
|
341
|
+
`).trim();let q=5000;if($.length>q)$=`${$.substring(0,q)}...`;return $}var e={VERSION:"0.16.2",MAX_CONTENT_SIZE:10485760,FETCH_TIMEOUT:30000,RETRY_ATTEMPTS:3,RETRY_DELAY:1000,OLLAMA_ENDPOINT:process.env.OLLAMA_ENDPOINT||"http://localhost:11434"},r0={en:"English",fr:"French",es:"Spanish",ht:"Haitian Creole"},zw=Object.keys(r0);function kq(){console.log(`
|
|
342
342
|
${B.bold("glance")} v${e.VERSION} – AI-powered web reader
|
|
343
343
|
|
|
344
344
|
${B.bold("Usage:")}
|
|
@@ -453,8 +453,7 @@ Navigation Links (${X.navigation.length} total):`));X.navigation.forEach((F)=>{l
|
|
|
453
453
|
External Links (${X.external.length} total):`));X.external.forEach((F)=>{let L=F.text||"Link";console.log(B.cyan(` ${U}. `)+B.blue.underline(F.href)),W.set(U,{href:F.href,text:F.text}),U++})}}return W},V=null,G=null;while(!0){console.clear(),console.log(B.bold.cyan(`
|
|
454
454
|
Current Page: ${q}`));let U=H(),W=U.size;if(G&&V)console.log(""),console.log(B.dim("─".repeat(60))),console.log(B.cyan("Last command: ")+B.yellow(G)),console.log(""),console.log(V),console.log(B.dim("─".repeat(60)));console.log(B.dim(`
|
|
455
455
|
Commands:`)),console.log(B.dim(` 1-${W}: Navigate to link`)),console.log(B.dim(" 'n': Show only navigation links")),console.log(B.dim(" 'e': Show only external links")),console.log(B.dim(" 'a': Show all links")),console.log(B.dim(" 'b': Go back")),console.log(B.dim(" 'h': History")),console.log(B.dim(" 'q': Quit")),console.log(B.dim(`
|
|
456
|
-
Enhanced Commands:`)),console.log(B.dim(" '1 --read -l fr': Navigate to link 1 and read in French")),console.log(B.dim(" '2 --tldr --copy': Navigate to link 2, get TLDR and copy")),console.log(B.dim(" '3 --eli5 -m gemini': Navigate to link 3, ELI5 with Gemini"));let F;try{F=await new Promise((D,j)=>{if(Z.question(B.yellow(`
|
|
457
|
-
> `),(P)=>{D(P)}),Z.closed)j(new Error("Readline interface was closed"))})}catch(D){console.log(B.yellow("Browse mode ended"));break}let L=F.trim().toLowerCase();if(L==="q"||L==="quit"){console.log(B.green(`
|
|
456
|
+
Enhanced Commands:`)),console.log(B.dim(" '1 --read -l fr': Navigate to link 1 and read in French")),console.log(B.dim(" '2 --tldr --copy': Navigate to link 2, get TLDR and copy")),console.log(B.dim(" '3 --eli5 -m gemini': Navigate to link 3, ELI5 with Gemini")),console.log("");let F;try{F=await new Promise((D,j)=>{if(Z.question(B.green(" >>> "),(P)=>{D(P)}),Z.closed)j(new Error("Readline interface was closed"))})}catch(D){console.log(B.yellow("Browse mode ended"));break}let L=F.trim().toLowerCase();if(L==="q"||L==="quit"){console.log(B.green(`
|
|
458
457
|
\uD83D\uDC4B Exiting browse mode`));break}if(L==="n"){K="nav",G=null,V=null;continue}if(L==="e"){K="external",G=null,V=null;continue}if(L==="a"){K="all",G=null,V=null;continue}if(L==="b"||L==="back"){if(Q.length>1){Q.pop();let D=Q[Q.length-1];try{let j=await L1(D,{fullRender:!1});X=G5(j,D),J=D,K="all",Y=z1(j).title||J,q=Y,G=null,V=null}catch(j){G="b",V=B.red("Failed to go back to previous page"),Q.push(J)}}else G="b",V=B.yellow("No previous page in history");continue}if(L==="h"||L==="history"){let D=B.bold(`\uD83D\uDCDA Browsing History:
|
|
459
458
|
`);Q.forEach((j,P)=>{let R=P===Q.length-1?"→ ":" ";D+=B.cyan(R)+B.white(j)+`
|
|
460
459
|
`}),G="h",V=D.trim();continue}let A=F.trim().split(/\s+/),z=Number.parseInt(A[0]||"");if(z>=1&&z<=W){let D=U.get(z);if(D){let j=new URL(D.href,J).href;if(A.length>1)try{let P=A.slice(1),{values:R}=vV({args:P,allowPositionals:!1,options:{tldr:{type:"boolean"},"key-points":{type:"boolean"},eli5:{type:"boolean"},full:{type:"boolean"},ask:{type:"string",short:"q"},language:{type:"string",short:"l"},read:{type:"boolean",short:"r"},voice:{type:"string"},"audio-output":{type:"string"},model:{type:"string",short:"m"},stream:{type:"boolean"},"max-tokens":{type:"string"},"free-only":{type:"boolean"},"prefer-quality":{type:"boolean"},format:{type:"string"},output:{type:"string",short:"o"},copy:{type:"boolean",short:"c"},"full-render":{type:"boolean"},screenshot:{type:"string"},metadata:{type:"boolean"},links:{type:"boolean"}}});console.log(B.blue(`\uD83D\uDCCD Processing: ${j}`));let k=[];if(R.tldr)k.push("TLDR");if(R.eli5)k.push("ELI5");if(R["key-points"])k.push("Key Points");if(R.full)k.push("Full Content");if(R.read)k.push("Read Aloud");if(R.language)k.push(`Language: ${R.language}`);if(R.copy)k.push("Copy to Clipboard");if(R.model)k.push(`Model: ${R.model}`);if(k.length>0)console.log(B.dim(`\uD83D\uDD27 Options: ${k.join(", ")}`));console.log("");let y={model:R.model,language:R.language,tldr:R.tldr,keyPoints:R["key-points"],eli5:R.eli5,full:R.full,customQuestion:R.ask,stream:R.stream,maxTokens:R["max-tokens"]?Number.parseInt(R["max-tokens"]):void 0,format:R.format,output:R.output,screenshot:R.screenshot,fullRender:R["full-render"],metadata:R.metadata,links:R.links,read:R.read,voice:R.voice,audioOutput:R["audio-output"],freeOnly:R["free-only"],preferQuality:R["prefer-quality"],copy:R.copy,disableStdinHandling:!0},i=await e2(j,y);if(G=A[0]+" "+A.slice(1).join(" "),y.output)V=B.green(`✅ Content saved to ${y.output}`);else if(!y.stream&&!y.read&&!y.audioOutput)V=B.bold.green(`\uD83C\uDFAF Result:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "glance-cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Kenley Jean",
|
|
6
6
|
"email": "alo@jkenley.me",
|
|
@@ -76,7 +76,9 @@
|
|
|
76
76
|
"web-reader",
|
|
77
77
|
"read-speak",
|
|
78
78
|
"terminal",
|
|
79
|
-
"screenshot"
|
|
79
|
+
"screenshot",
|
|
80
|
+
"browse",
|
|
81
|
+
"interactive"
|
|
80
82
|
],
|
|
81
83
|
"license": "MIT",
|
|
82
84
|
"publishConfig": {
|
package/src/cli/commands.ts
CHANGED
|
@@ -1184,12 +1184,15 @@ async function interactiveLinkNavigation(
|
|
|
1184
1184
|
chalk.dim(" '3 --eli5 -m gemini': Navigate to link 3, ELI5 with Gemini"),
|
|
1185
1185
|
);
|
|
1186
1186
|
|
|
1187
|
+
console.log("");
|
|
1188
|
+
|
|
1187
1189
|
let input: string;
|
|
1188
1190
|
try {
|
|
1189
1191
|
input = await new Promise<string>((resolve, reject) => {
|
|
1190
|
-
rl.question(chalk.
|
|
1192
|
+
rl.question(chalk.green(" >>> "), (answer) => {
|
|
1191
1193
|
resolve(answer);
|
|
1192
1194
|
});
|
|
1195
|
+
|
|
1193
1196
|
// Check if readline was closed
|
|
1194
1197
|
if ((rl as any).closed) {
|
|
1195
1198
|
reject(new Error("Readline interface was closed"));
|