@chief-clancy/terminal 0.1.3 → 0.1.4

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.
@@ -1 +1 @@
1
- "use strict";var i=require("node:fs"),s=require("node:os"),C=require("node:process");var $=require("node:stream/consumers");function d(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var f={},O=3e3;function R(t){try{let n=JSON.parse(t);return d(n)?n:f}catch{return f}}function F(t){return new Promise(n=>{setTimeout(()=>n(f),t)})}function m(t){let n=t.timeoutMs??O,e=(0,$.text)(t.stdin).then(R);return Promise.race([e,F(n)])}var b=require("node:path");function y(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"")}function p(t,n){return(0,b.join)(n.tmpdir(),`clancy-ctx-${y(t)}.json`)}var c=require("node:path");var g=16.5,h=10,v="\u2588",w="\u2591",a="\x1B[0m",x="\x1B[2m",B="\x1B[32m",S="\x1B[33m",j="\x1B[38;5;208m",N="\x1B[5;31m",U=" \u2502 ";function _(t){let n=Math.max(0,(t-g)/(100-g)*100),e=Math.max(0,Math.min(100,Math.round(100-n)));return{usableRemaining:n,usedPct:e}}function A(t,n,e){let{usedPct:r}=_(n);return{session_id:t,remaining_percentage:n,used_pct:r,timestamp:e}}function L(t){let n=Math.max(0,Math.min(h,Math.floor(t/h))),e=v.repeat(n)+w.repeat(h-n),r=t<50,o=t>=50&&t<65,u=t>=65&&t<80;return r?`${B}${e} ${t}%${a}`:o?`${S}${e} ${t}%${a}`:u?`${j}${e} ${t}%${a}`:`${N}\u{1F480} ${e} ${t}%${a}`}function I(t,n){try{let e=JSON.parse(n.readFileSync(t,"utf8"));return d(e)?e.update_available===!0:!1}catch{return!1}}function E(t){let n=t.env??(0,c.join)(t.homedir(),".claude");return(0,c.join)(n,"cache","clancy-update-check.json")}function M(t,n,e){let r=(0,c.join)(t,".claude","commands","clancy","VERSION"),o=(0,c.join)(n,".claude","commands","clancy","VERSION");return P(r,e)??P(o,e)}function P(t,n){try{return n.readFileSync(t,"utf8").trim()||void 0}catch{return}}function T(t,n,e){let r=t?`${S}\u2B06 /clancy:update${a}`:void 0,o=e?` ${x}v${e}${a}`:"",l=n!==void 0?`${x}Clancy${a}${o} ${L(_(n).usedPct)}`:`${x}Clancy${a}${o}`;return[r,l].filter(Boolean).join(U)}m({stdin:process.stdin}).then(H).catch(()=>{});function H(t){let n=t.session_id??"",e=t.context_window?.remaining_percentage;n!==""&&e!==void 0&&V(n,e);let o=E({env:process.env.CLAUDE_CONFIG_DIR,homedir:s.homedir}),u=I(o,{readFileSync:i.readFileSync}),l=M((0,C.cwd)(),(0,s.homedir)(),{readFileSync:i.readFileSync}),D=T(u,e,l);process.stdout.write(D)}function V(t,n){try{let e=p(t,{tmpdir:s.tmpdir}),r=A(t,n,Math.floor(Date.now()/1e3));(0,i.writeFileSync)(e,JSON.stringify(r))}catch{}}
1
+ "use strict";var i=require("node:fs"),s=require("node:os"),T=require("node:process");var $=require("node:stream/consumers");function d(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var f={},O=3e3;function F(t){try{let n=JSON.parse(t);return d(n)?n:f}catch{return f}}function v(t){return new Promise(n=>{setTimeout(()=>n(f),t)})}function m(t){let n=t.timeoutMs??O,e=(0,$.text)(t.stdin).then(F);return Promise.race([e,v(n)])}var b=require("node:path");function y(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"")}function p(t,n){return(0,b.join)(n.tmpdir(),`clancy-ctx-${y(t)}.json`)}var c=require("node:path");var g=16.5,h=10,w="\u2588",B="\u2591",o="\x1B[0m",x="\x1B[2m",j="\x1B[32m",S="\x1B[33m",N="\x1B[38;5;208m",U="\x1B[5;31m",L=" \u2502 ";function _(t){let n=Math.max(0,(t-g)/(100-g)*100),e=Math.max(0,Math.min(100,Math.round(100-n)));return{usableRemaining:n,usedPct:e}}function A(t,n,e){let{usedPct:r}=_(n);return{session_id:t,remaining_percentage:n,used_pct:r,timestamp:e}}function H(t){let n=Math.max(0,Math.min(h,Math.floor(t/h))),e=w.repeat(n)+B.repeat(h-n),r=t<50,a=t>=50&&t<65,u=t>=65&&t<80;return r?`${j}${e} ${t}%${o}`:a?`${S}${e} ${t}%${o}`:u?`${N}${e} ${t}%${o}`:`${U}\u{1F480} ${e} ${t}%${o}`}function I(t,n){try{let e=JSON.parse(n.readFileSync(t,"utf8"));return d(e)?e.update_available===!0:!1}catch{return!1}}function E(t){let n=t.env??(0,c.join)(t.homedir(),".claude");return(0,c.join)(n,"cache","clancy-update-check.json")}function M(t,n,e){let r=(0,c.join)(t,".claude","commands","clancy","VERSION"),a=(0,c.join)(n,".claude","commands","clancy","VERSION");return P(r,e)??P(a,e)}function P(t,n){try{return n.readFileSync(t,"utf8").trim()||void 0}catch{return}}function R(t,n,e){let r=t?`${S}\u2B06 /clancy:update${o}`:void 0,a=e?` ${x}v${e}${o}`:"",l=n!==void 0?`${x}Clancy${o}${a} ${H(_(n).usedPct)}`:`${x}Clancy${o}${a}`;return[r,l].filter(Boolean).join(L)}m({stdin:process.stdin}).then(V).catch(()=>{});function V(t){let n=t.session_id??"",e=t.context_window?.remaining_percentage,r=e===0?void 0:e;n!==""&&r!==void 0&&k(n,r);let u=E({env:process.env.CLAUDE_CONFIG_DIR,homedir:s.homedir}),l=I(u,{readFileSync:i.readFileSync}),C=M((0,T.cwd)(),(0,s.homedir)(),{readFileSync:i.readFileSync}),D=R(l,r,C);process.stdout.write(D)}function k(t,n){try{let e=p(t,{tmpdir:s.tmpdir}),r=A(t,n,Math.floor(Date.now()/1e3));(0,i.writeFileSync)(e,JSON.stringify(r))}catch{}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chief-clancy/terminal",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Installer, slash commands, hooks, AFK runner, agents, Claude CLI bridge",
5
5
  "author": "Alex Clapperton",
6
6
  "license": "MIT",