tenicli 0.1.5 → 0.1.6
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/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ RULES:
|
|
|
13
13
|
`);$=G.pop();for(let X of G)if(X.startsWith("data: ")){let K=X.slice(6).trim();if(K==="[DONE]")return;try{yield JSON.parse(K)}catch{}}}}import{readFileSync as p,writeFileSync as e,existsSync as x,readdirSync as Q0,statSync as Y0,mkdirSync as I0}from"fs";import{resolve as D0,relative as w,join as Z0,dirname as j0}from"path";var r=(Q)=>`\x1B[${Q}m`,k=(Q,Y)=>(Z)=>`${r(Q)}${Z}${r(Y)}`,I=(Q)=>(Y)=>`\x1B[38;5;${Q}m${Y}\x1B[39m`,z={bold:k("1","22"),dim:k("2","22"),italic:k("3","23"),under:k("4","24"),blue:I(111),purple:I(141),green:I(149),yellow:I(179),pink:I(210),cyan:I(117),gray:I(60),text:I(146),orange:I(215)};var B={prompt:z.blue("❯"),ai:z.purple("◆"),tool:z.yellow("⚙"),ok:z.green("✓"),err:z.pink("✗"),warn:z.yellow("⚠"),arrow:z.gray("→"),dot:z.gray("•"),spinner:["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]};function E0(){let Q=[" ██ ██ ","██████████","███ ██ █","██████████","██████████"," ██ ██ ██ "],Y={T:["█████"," █ "," █ "," █ "," █ "],E:["████ ","█ ","███ ","█ ","████ "],N:["█ █ ","██ █ ","█ ██ ","█ █ ","█ █ "],I:["███"," █ "," █ "," █ ","███"],space:[" "," "," "," "," "],C:[" ███","█ ","█ ","█ "," ███"],L:["█ ","█ ","█ ","█ ","████"]},Z=[Y.T,Y.E,Y.N,Y.I,Y.space,Y.C,Y.L,Y.I],$=["","","","",""];for(let G=0;G<5;G++)$[G]=Z.map((X)=>X[G]).join(" ");let q=Q.map((G)=>z.cyan(G.padEnd(14," "))),V=[" ".repeat($[0].length),...$].map((G)=>z.blue(G));return q.map((G,X)=>`${G} ${V[X]||""}`).join(`
|
|
14
14
|
`)}var A={h:"─",v:"│",tl:"╭",tr:"╮",bl:"╰",br:"╯",line:(Q)=>"─".repeat(Q)};function g(Q,Y=60){let Z=($,q)=>{let V=$.replace(/\x1b\[[0-9;]*m/g,""),G=q-V.length;return G>0?$+" ".repeat(G):$};console.log(z.gray(` ${A.tl}${A.line(Y)}${A.tr}`));for(let $ of Q)console.log(z.gray(` ${A.v}`)+` ${Z($,Y-2)} `+z.gray(A.v));console.log(z.gray(` ${A.bl}${A.line(Y)}${A.br}`))}function o(){console.clear(),console.log(),console.log(E0()),console.log(),g([z.gray("type to chat")+` ${B.dot} `+z.gray("/help for commands")+` ${B.dot} `+z.gray("v0.1.0")],60),console.log()}class S{i=0;timer=null;msg;constructor(Q="Thinking"){this.msg=Q}start(){return this.timer=setInterval(()=>{process.stdout.write(`\x1B[2K\r ${z.blue(B.spinner[this.i%B.spinner.length])} ${z.gray(this.msg)}`),this.i++},80),this}stop(){if(this.timer)clearInterval(this.timer),this.timer=null;process.stdout.write("\x1B[2K\r")}}var c=["/model","/auth","/mode","/compact","/diff","/undo","/init","/update","/clear","/cost","/help","/exit"];function D(Q,Y=!1){return new Promise((Z,$)=>{if(process.stdout.write(Q),!Y||!process.stdin.isTTY){let N="",J=(_)=>{let E=typeof _==="string"?_:_.toString("utf8");if(E.charCodeAt(0)===3)process.stdout.write(`
|
|
15
15
|
`),process.exit(0);if(E.charCodeAt(0)===4){R(),$(Error("EOF"));return}N+=E;let H=N.indexOf(`
|
|
16
|
-
`);if(H!==-1)R(),Z(N.slice(0,H).replace(/\r$/,""))},R=()=>{process.stdin.removeListener("data",J)};if(!process.stdin.readableEncoding)process.stdin.setEncoding("utf8");process.stdin.on("data",J),process.stdin.resume();return}let q="",V=0,G=process.stdin.isRaw;if(process.stdin.setRawMode(!0),!process.stdin.readableEncoding)process.stdin.setEncoding("utf8");process.stdin.resume();let X=()=>{if(V>0)process.stdout.write(
|
|
16
|
+
`);if(H!==-1)R(),Z(N.slice(0,H).replace(/\r$/,""))},R=()=>{process.stdin.removeListener("data",J)};if(!process.stdin.readableEncoding)process.stdin.setEncoding("utf8");process.stdin.on("data",J),process.stdin.resume();return}let q="",V=0,G=process.stdin.isRaw;if(process.stdin.setRawMode(!0),!process.stdin.readableEncoding)process.stdin.setEncoding("utf8");process.stdin.resume();let X=()=>{if(V>0)process.stdout.write("\x1B[0K"),V=0},K=()=>{if(X(),q.startsWith("/")&&q.length>1){let N=c.filter((J)=>J.startsWith(q));if(N.length>0){let J=N[0].slice(q.length);if(J){let R=z.gray(J);process.stdout.write(R),V=J.length,process.stdout.write(`\x1B[${J.length}D`)}}}},W=(N)=>{let J=typeof N==="string"?N:N.toString("utf8");for(let R of J){let _=R.charCodeAt(0);if(_===3)process.stdin.setRawMode(G),process.stdout.write(`
|
|
17
17
|
`),process.exit(0);if(_===4){X(),process.stdin.setRawMode(G),U(),$(Error("EOF"));return}if(_===13||_===10){X(),process.stdin.setRawMode(G),process.stdout.write(`
|
|
18
18
|
`),U(),Z(q);return}if(_===127||_===8){if(q.length>0)X(),q=q.slice(0,-1),process.stdout.write("\b \b"),K();continue}if(_===9){if(q.startsWith("/")){let E=c.filter((H)=>H.startsWith(q));if(E.length>0){X();let H=E[0].slice(q.length);q=E[0],process.stdout.write(H)}}continue}if(_<32)continue;X(),q+=R,process.stdout.write(R),K()}},U=()=>{process.stdin.removeListener("data",W)};process.stdin.on("data",W)})}async function t(){let Q=[],Y=!0;while(!0){let Z=Y?`
|
|
19
19
|
${z.gray(A.tl+A.line(3))} ${B.prompt} `:` ${z.gray(A.v)} `,$=await D(Z,Y);if(Y=!1,$.endsWith("\\"))Q.push($.slice(0,-1));else{Q.push($);break}}return Q.join(`
|
|
@@ -41,7 +41,7 @@ RULES:
|
|
|
41
41
|
`}let Z=this.messages.length,$=`Summarize this conversation concisely. Keep key decisions, file changes, and current state. Be brief:
|
|
42
42
|
|
|
43
43
|
${Y.slice(0,6000)}`;this.messages=[{role:"user",content:$},{role:"assistant",content:`[Conversation compacted from ${Z} messages. Summary of what happened:]`}];let q=v(this.cfg.provider,[{role:"user",content:$}],"You are a conversation summarizer. Create a brief summary preserving key facts, decisions, and file changes.",[],this.cfg.maxTokens),V="";for await(let G of q){if(G.type==="text"&&G.text)V+=G.text;if(G.type==="usage")this.tokens.input+=G.input,this.tokens.output+=G.output}this.messages=[{role:"user",content:`[Previous conversation summary]
|
|
44
|
-
${V}`},{role:"assistant",content:"Understood. I have the context from our previous conversation. How can I continue helping you?"}],Q.stop(),console.log(` ${B.ok} Compacted ${Z} messages → 2 ${z.gray(`(saved ~${Math.round(Y.length/4)} tokens)`)}`)}catch(Y){Q.stop(),j(`Compact failed: ${Y.message}`)}}get stats(){return this.tokens}get messageCount(){return this.messages.length}clear(){this.messages=[],this.tokens={input:0,output:0}}}import{writeFileSync as b0,existsSync as k0}from"fs";import{join as S0,relative as X0}from"path";var V0={name:"tenicli",version:"0.1.
|
|
44
|
+
${V}`},{role:"assistant",content:"Understood. I have the context from our previous conversation. How can I continue helping you?"}],Q.stop(),console.log(` ${B.ok} Compacted ${Z} messages → 2 ${z.gray(`(saved ~${Math.round(Y.length/4)} tokens)`)}`)}catch(Y){Q.stop(),j(`Compact failed: ${Y.message}`)}}get stats(){return this.tokens}get messageCount(){return this.messages.length}clear(){this.messages=[],this.tokens={input:0,output:0}}}import{writeFileSync as b0,existsSync as k0}from"fs";import{join as S0,relative as X0}from"path";var V0={name:"tenicli",version:"0.1.6",description:"Lightweight AI coding CLI — fast, compact, multi-provider",type:"module",bin:{teni:"./dist/index.js"},files:["dist/","README.md","LICENSE"],scripts:{dev:"bun run src/index.ts","build:npm":"bun build src/index.ts --outfile dist/index.js --target node --minify",build:"bun build --compile --minify src/index.ts --outfile teni","build:win":"bun build --compile --minify --target=bun-windows-x64 src/index.ts --outfile teni.exe","build:linux":"bun build --compile --minify --target=bun-linux-x64 src/index.ts --outfile teni","build:mac":"bun build --compile --minify --target=bun-darwin-x64 src/index.ts --outfile teni",prepublishOnly:"bun run build:npm"},keywords:["ai","cli","coding","agent","anthropic","openai","terminal"],author:"Yan Tenica",license:"MIT",repository:{type:"git",url:"https://github.com/Nhqvu2005/TeniCli.git"},homepage:"https://github.com/Nhqvu2005/TeniCli",engines:{node:">=18"},dependencies:{},devDependencies:{"@types/bun":"latest","@types/figlet":"^1.7.0",figlet:"^1.11.0"}};var w0=V0.version;function x0(Q){let Y={prompt:"",print:!1},Z=0;while(Z<Q.length){switch(Q[Z]){case"-p":case"--print":if(Y.print=!0,Z+1<Q.length&&!Q[Z+1].startsWith("-"))Y.prompt=Q[++Z];break;case"-m":case"--model":Y.model=Q[++Z];break;case"--base-url":Y.baseUrl=Q[++Z];break;case"-v":case"--version":console.log(`teni v${w0}`),process.exit(0);case"-h":case"--help":h0(),process.exit(0);default:if(!Q[Z].startsWith("-"))Y.prompt=Q.slice(Z).join(" "),Z=Q.length}Z++}return Y}function h0(){console.log(`
|
|
45
45
|
${z.bold(z.blue("TeniCLI"))} — Lightweight AI Coding Agent
|
|
46
46
|
|
|
47
47
|
${z.bold("USAGE")}
|