forge-terminal 0.5.6 → 0.5.7
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 +6 -6
- package/dist/chunks/{about-credits-TM34J3IS.js → about-credits-4DHA4HMT.js} +1 -1
- package/dist/chunks/{args-7OJGCKH4.js → args-5CQKOHYO.js} +1 -1
- package/dist/chunks/{boot-5KSVFF4C.js → boot-XX2TLD3Q.js} +1 -1
- package/dist/chunks/{chunk-UB6YVCIS.js → chunk-4YK4XWYS.js} +1 -1
- package/dist/chunks/{chunk-75GYDNAQ.js → chunk-6FXF6ALB.js} +1 -1
- package/dist/chunks/{chunk-WBV6I7UP.js → chunk-6HQKTDGG.js} +1 -1
- package/dist/chunks/{chunk-37U22UEW.js → chunk-7MC3LDNP.js} +1 -1
- package/dist/chunks/{chunk-3RH2AXJW.js → chunk-AET63NOB.js} +1 -1
- package/dist/chunks/{chunk-YR7QRQ5F.js → chunk-GBA5DFEO.js} +1 -1
- package/dist/chunks/{chunk-RUAEBL2F.js → chunk-GYERZAZU.js} +2 -2
- package/dist/chunks/{chunk-QV27SER6.js → chunk-JMIKUWLY.js} +2 -2
- package/dist/chunks/{chunk-XZZCVJ64.js → chunk-L57UZTYE.js} +2 -2
- package/dist/chunks/{chunk-W43SUVWN.js → chunk-MPSLPE4C.js} +1 -1
- package/dist/chunks/{chunk-2BPH3IL6.js → chunk-NRMLO5TP.js} +1 -1
- package/dist/chunks/{chunk-7R7KDE3R.js → chunk-OXDRJO4V.js} +1 -1
- package/dist/chunks/{chunk-WNYM6NSV.js → chunk-P6JX5ZQT.js} +1 -1
- package/dist/chunks/{chunk-JDTDXCZE.js → chunk-PUGNBNSV.js} +1 -1
- package/dist/chunks/{chunk-ZJ45XUJW.js → chunk-RM3XA72H.js} +1 -1
- package/dist/chunks/{chunk-KQ2AHGLK.js → chunk-RRVD63NF.js} +1 -1
- package/dist/chunks/{chunk-LM4K7CZQ.js → chunk-SM735FG7.js} +7 -6
- package/dist/chunks/{chunk-QYAJFKQL.js → chunk-SUB2JM7G.js} +1 -1
- package/dist/chunks/{chunk-LAJAXLGQ.js → chunk-U3D3EU33.js} +1 -1
- package/dist/chunks/{chunk-U2XQL7AA.js → chunk-UGYBXR4V.js} +1 -1
- package/dist/chunks/{chunk-2HGBB3DQ.js → chunk-VDQMK2B2.js} +1 -1
- package/dist/chunks/{chunk-CZDI37SI.js → chunk-WMK3IKW6.js} +1 -1
- package/dist/chunks/{chunk-XY7C5I5T.js → chunk-X6PZIFFX.js} +1 -1
- package/dist/chunks/{clip-command-3JBZK6Q3.js → clip-command-3CMQ6A5D.js} +1 -1
- package/dist/chunks/{clipboard-XOIVXPVL.js → clipboard-IZJTBTSW.js} +1 -1
- package/dist/chunks/colour-VBHJAKAX.js +3 -0
- package/dist/chunks/{entry-64GTSHV2.js → entry-SOHEQPXT.js} +1 -1
- package/dist/chunks/{execute-3J755YKG.js → execute-KTLXJTU2.js} +1 -1
- package/dist/chunks/{extensions-QQT6OD7W.js → extensions-YF2KGD66.js} +1 -1
- package/dist/chunks/{extensions-command-FV3N7CBV.js → extensions-command-VT4M2JQW.js} +1 -1
- package/dist/chunks/{ffmpeg-VGE2QCC7.js → ffmpeg-Q2WJH2OP.js} +1 -1
- package/dist/chunks/{launch-ATJNO6ZO.js → launch-SOQTCV2D.js} +5 -5
- package/dist/chunks/{manager-ROCFK7AS.js → manager-HBAXHJL4.js} +1 -1
- package/dist/chunks/{needed-T722HOKD.js → needed-GMZEKBH4.js} +1 -1
- package/dist/chunks/{own-CX3EJ2AH.js → own-IICGHC4K.js} +1 -1
- package/dist/chunks/{preset-command-M7SESD5C.js → preset-command-4OVFEH7Y.js} +1 -1
- package/dist/chunks/{registry-7BJ4J2SD.js → registry-TO6HJQJ4.js} +1 -1
- package/dist/chunks/{server-64H64DIC.js → server-6275TY3O.js} +17 -17
- package/dist/chunks/{theme-S234JXQH.js → theme-ISNQEBTS.js} +1 -1
- package/dist/chunks/{transcribe-L64JHZ3U.js → transcribe-QC2E7ETQ.js} +1 -1
- package/dist/chunks/{transcribe-command-Y3AHXLVA.js → transcribe-command-GAKYFBWQ.js} +1 -1
- package/dist/chunks/{update-note-YQD2W5B2.js → update-note-T4LVCD25.js} +1 -1
- package/dist/chunks/{watch-command-B2Z4KSWR.js → watch-command-EYEZKROF.js} +1 -1
- package/dist/index.js +6 -6
- package/package.json +5 -5
- package/dist/chunks/colour-CEKEW7RV.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v}from"./chunk-
|
|
3
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v}from"./chunk-P6JX5ZQT.js";import"./chunk-TMUK2DD3.js";export{t as BAR,c as DARK,d as LIGHT,g as MODE_KEYS,j as MODE_MARKERS,f as MODE_ORDER,e as NEUTRAL,b as SYMBOLS,a as VERSION,v as applyColourPreference,u as colourEnabled,s as colourProp,n as dotGradient,o as menuPalette,k as modeColours,i as modeForKey,l as modeGradient,p as modePalette,m as modeWash,q as paintsCanvas,r as paletteFor,h as tabStep};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m,r as n}from"./chunk-
|
|
3
|
+
import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h,m as i,n as j,o as k,p as l,q as m,r as n}from"./chunk-JMIKUWLY.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-HZDYZ5RD.js";import"./chunk-MPSLPE4C.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";export{h as appleDoes,e as chooseHearing,c as helperPaths,d as helpers,b as notesNeed,i as probeSound,l as readRefusal,m as renderPages,n as renderTranscript,k as runRead,j as runTranscribe,a as transcribeNeeds,f as transcribeStatus,g as whisperUseful};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as x,b as W,c as X,d as $,e as Y,g as Z}from"./chunk-
|
|
3
|
+
import{a as x,b as W,c as X,d as $,e as Y,g as Z}from"./chunk-GBA5DFEO.js";import{c as V}from"./chunk-6FXF6ALB.js";import"./chunk-WMK3IKW6.js";import{a as D,b as B,c as H,e as K,f as M,j as S,n as q,o as z,p as G,q as J,r as Q}from"./chunk-JMIKUWLY.js";import"./chunk-UGYBXR4V.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-U3D3EU33.js";import"./chunk-HZDYZ5RD.js";import"./chunk-O7DK3GJT.js";import"./chunk-RRVD63NF.js";import"./chunk-EEQSUBBL.js";import"./chunk-MPSLPE4C.js";import"./chunk-FAUL5L2W.js";import{a as N,d as j}from"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import{a as T,r as P}from"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import{G as U,a as F,b as I,oa as A,qa as L,ra as y,ta as O,ua as R,va as C,y as g}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import{c as v}from"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{existsSync as E}from"node:fs";import{stat as ot}from"node:fs/promises";import{basename as l,dirname as tt,extname as w,join as _,resolve as p}from"node:path";function it(t){if(t.format)return t.format;let e=t.output;if(e===void 0||T(e))return"md";let r=w(e).toLowerCase();return N.find(n=>n.ext===r)?.id??"md"}function h(t,e,r,n){let i=`${t}${j(n)}`;return r===void 0?_(e,i):T(r)?_(p(r),i):p(r)}var et=t=>t.split(/\s+/).filter(Boolean).length,at=t=>t.segments.reduce((e,r)=>e+et(r.text),0);async function st(t){let{probe:e}=await import("./registry-TO6HJQJ4.js"),r=await e(t).catch(()=>{throw A(t)});return Y(r)}async function ct(t,e,r,n){if(e.to!==void 0)throw U("--to is for video and sound: a picture or PDF gives its text as it is.",`Try: forge transcribe ${l(t.path)}`);if(!(await S())?.read)throw await G();let o=h(l(t.path,w(t.path)),tt(t.path),e.output,n);if(E(o)&&!e.force)throw g(o);let c=await z(t.path,{language:e.language,signal:r.signal,onEvent:r.onProgress}),a=D(c);if(!B(a))throw O(t.path);await P(o,await J(a,n,l(t.path),{signal:r.signal,lang:e.language}));let s=t.what==="pdf"?`${t.pages} ${t.pages===1?"page":"pages"}`:w(t.path).slice(1).toUpperCase()||"picture";return r.out(`\u2713 ${v(o)} ${s} \u2192 ${et(H(a)).toLocaleString("en-US")} words`),r.finished?.({made:[{from:[t.path],to:[o]}],failed:[]}),0}async function $t(t,e){try{let r=x(t.input);if(r?.kind==="playlist")throw L("This is a playlist.",void 0,{hint:"Pass one video's link.",shellHint:"Paste one video's link."});let n,i,o,c,a=it(t);if(r===void 0){if(n=p(t.input),!(await ot(n).catch(()=>{}))?.isFile())throw I(n);let d=await V(n);if(d!=="video"&&d!=="audio"){let u=await st(n);if(u)return await ct(u,t,e,a)}}let s=await S(t.language?{locale:t.language}:{});if(s===void 0||!s.speech)throw y(K(process.platform,s?.missing));let k=t.notes&&s.notes==="available";if(t.notes&&!k){if(!t.transcript)throw y(M(process.platform,s.notes));s.notes==="off"&&e.err("\u26A0 Apple Intelligence is off, so this is the transcript only.")}if(r===void 0){if(n=p(t.input),i={title:l(n,w(n)),from:l(n)},o=h(i.title,tt(n),t.output,a),E(o)&&!t.force)throw g(o)}else{let m=new AbortController;e.signal?.addEventListener("abort",()=>m.abort(e.signal?.reason),{once:!0});let d;c=await Z(r.url,{signal:m.signal,onEvent:u=>{u.kind==="facts"&&(d=h($(u.facts.title),process.cwd(),t.output,a),E(d)&&!t.force&&m.abort(g(d)))}}),n=c.path,i={title:c.facts.title,from:r.url},o=d??h($(c.facts.title),process.cwd(),t.output,a)}let f;try{f=await q(n,{notes:k,detail:t.detail,locale:t.language,signal:e.signal,onEvent:e.onProgress})}finally{await c?.dispose()}let rt=X(f,i,{transcript:t.transcript});await P(o,await Q(rt,a,{signal:e.signal,lang:f.locale}));let b=f.notes?.parts.length,nt=b===void 0?"":` \xB7 ${b} ${b===1?"part":"parts"}`;return e.out(`\u2713 ${v(o)} ${W(f.seconds)} \u2192 ${at(f).toLocaleString("en-US")} words${nt}`),e.finished?.({made:[{from:[r===void 0?n:i.title],to:[o]}],failed:[]}),0}catch(r){let n=F(r)?r:R(r);for(let o of C(n,{debug:t.debug}))e.err(o);let i=x(t.input)===void 0?p(t.input):"";return e.finished?.({made:[],failed:[{path:i,message:n.message}]}),1}}export{$t as runTranscribeCommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{b as m,c as w,d as h,i as l,j as p,k as b}from"./chunk-SZRSAL64.js";import{c as $,d as g}from"./chunk-
|
|
3
|
+
import{b as m,c as w,d as h,i as l,j as p,k as b}from"./chunk-SZRSAL64.js";import{c as $,d as g}from"./chunk-P6JX5ZQT.js";import{e as u}from"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-H3DIRJFE.js";import"./chunk-TMUK2DD3.js";import{spawn as x}from"node:child_process";var P=60;function v(t,n){let e=Number.parseInt(t.slice(1),16);return`\x1B[${n};2;${e>>16&255};${e>>8&255};${e&255}m`}function C(t,n,e){let i=[" \u2191 ",`Forge ${t} is available`,` \xB7 your version ${n}`],r=[" In terminal: ","forge update"];if(e===void 0)return[i.join(""),r.join("")];let s=v(e.newTagBg,48),o=f=>v(f,38),c="\x1B[1m",a="\x1B[0m",d=f=>" ".repeat(Math.max(0,P-f.join("").length));return[`${s}${o(e.newTag)}${c}${i[0]}${o(e.fg)}${i[1]}${a}${s}${o(e.dim)}${i[2]}${d(i)}${a}`,`${s}${o(e.dim)}${r[0]}${o(e.fg)}${c}${r[1]}${a}${s}${d(r)}${a}`]}async function I(t,n){let e=n.now??Date.now(),{prefs:i}=await u();if(!h(i,n.env??process.env))return[];let r=await l();b(r,e)&&n.refresh();let s=r?.latest;if(r===void 0||s===void 0||!w(s,t))return[];let o=r.notifiedAt;if(o!==void 0&&o<=e&&e-o<=m)return[];await p({...r,notifiedAt:e}).catch(()=>{});let c=n.colour?i.theme==="light"?g:$:void 0;return C(s,t,c)}function N(t,n=process.platform,e=x){if(t!==void 0)try{e(process.execPath,[...process.execArgv,t,"__update-check"],{detached:!0,stdio:"ignore",...n==="win32"?{windowsHide:!0}:{}}).unref()}catch{}}export{I as afterCommand,C as noteLines,N as spawnRefresh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{c as R,d as k}from"./chunk-
|
|
3
|
+
import{c as R,d as k}from"./chunk-SUB2JM7G.js";import{a as W,d as N}from"./chunk-6FXF6ALB.js";import"./chunk-VDQMK2B2.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-X6PZIFFX.js";import"./chunk-UGYBXR4V.js";import"./chunk-6HQKTDGG.js";import"./chunk-U3D3EU33.js";import{d as w,e as h}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as S}from"./chunk-P6JX5ZQT.js";import"./chunk-O7DK3GJT.js";import"./chunk-RRVD63NF.js";import"./chunk-EEQSUBBL.js";import"./chunk-MPSLPE4C.js";import"./chunk-FAUL5L2W.js";import"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import{G as L,a as M,b as I,va as E}from"./chunk-ZBMJTIYR.js";import{a as A}from"./chunk-J7FLFHQJ.js";import{c as a}from"./chunk-VLVNA4T3.js";import{a as F}from"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{readdir as T,stat as B}from"node:fs/promises";import{join as C,resolve as y}from"node:path";function K(r,t,s,n){return[`\u2713 ${r} converted${n?` to ${n}`:""}`,...t?[`${t} failed`]:[],...s?[`${s} left alone`]:[]].join(" \xB7 ")}var P=r=>{let[t,...s]=r.job.outputs,n=`${a(t??"")}${s.length?` + ${s.length} more`:""}`;return`\u2713 ${a(r.job.sources[0].path)} \u2192 ${n} ${A(r.outputBytes)}`},O=(r,t)=>`\u2715 ${a(r)} ${t.title.toLowerCase()}`,D=r=>`\u2013 ${a(r.path)} ${r.reason}`;async function v(r,t){let s=y(r.folder),n=(e,o)=>t.out(JSON.stringify({forge:S,event:e,...o}));try{let e=await B(s).catch(()=>{});if(!e)throw I(s);if(!e.isDirectory())throw L(`${a(s)} is not a folder.`,`forge watch watches a folder. Try: forge watch ${a(y(s,".."))} --to ${r.target}`)}catch(e){if(!M(e))throw e;if(t.json)n("error",{ok:!1,failures:[h({error:e})]});else for(let o of E(e,{debug:r.debug}))t.out(o);return 2}let m={target:r.target,...r.quality===void 0?{}:{quality:r.quality},dpi:r.dpi??150},$={images:m,pdfs:m,documents:m},c=r.output===void 0?void 0:y(r.output),q=F[r.target].label,p=0,i=[],u=[],b=new Set,g;if(r.newOnly)g=(await T(s,{withFileTypes:!0})).filter(o=>o.isFile()&&!W(o.name)).map(o=>C(s,o.name));else{let e=await N(s);g=e.paths;let o=await R(e,$,{destination:c});b=o.claimed;let f=[...e.failures,...o.outcome.refusals,...o.outcome.failures],j=e.kinds.flatMap(l=>l.why?[{count:l.count,why:l.why}]:[]),J=o.left.length+j.reduce((l,d)=>l+d.count,0);if(p+=o.outcome.results.length,i.push(...f),u.push(...o.left),t.json)n("converted-existing",{ok:f.length===0,results:o.outcome.results.map(w),failures:f.map(h),leftAlone:o.left});else if(e.paths.length>0){t.out(K(o.outcome.results.length,f.length,J,q));for(let l of f)t.out(O(l.path,l.error))}for(let l of j)for(let d=0;d<l.count;d++)u.push({path:"",reason:l.why})}t.json?n("watching",{folder:s,...c?{output:c}:{}}):t.out(`Watching ${a(s)} \xB7 any new files you add will be converted \xB7 ctrl-c to stop`);let x=k({dir:s,answers:$,known:g,claimed:b,destination:c,...t.settleMs===void 0?{}:{settleMs:t.settleMs},...t.pollMs===void 0?{}:{pollMs:t.pollMs},onEvent:e=>{e.type==="converted"?(p++,t.json?n("converted",{result:w(e.result)}):t.out(P(e.result))):e.type==="failed"?(i.push({path:e.path,error:e.error}),t.json?n("failed",{failure:h({path:e.path,error:e.error})}):t.out(O(e.path,e.error))):e.type==="left"&&(u.push({path:e.path,reason:e.reason}),t.json?n("left-alone",{path:e.path,reason:e.reason}):t.out(D({path:e.path,reason:e.reason})))}});return await new Promise(e=>{t.signal.aborted?e():t.signal.addEventListener("abort",()=>e(),{once:!0})}),await x.stop(),t.json?n("stopped",{converted:p,failed:i.length,leftAlone:u.length}):t.out(K(p,i.length,u.length)),i.length>0?1:0}export{v as runWatch};
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
3
3
|
const require = __forgeCreateRequire(import.meta.url);
|
|
4
|
-
import{e as x,f as S}from"./chunks/chunk-
|
|
4
|
+
import{e as x,f as S}from"./chunks/chunk-NRMLO5TP.js";import{b as g,d as C}from"./chunks/chunk-IBPGC4N2.js";import"./chunks/chunk-6HQKTDGG.js";import"./chunks/chunk-U3D3EU33.js";import"./chunks/chunk-HZDYZ5RD.js";import"./chunks/chunk-N32JL4UI.js";import{g as b}from"./chunks/chunk-YJ6XLDRA.js";import"./chunks/chunk-63XCSYHM.js";import{a as p}from"./chunks/chunk-P6JX5ZQT.js";import{b as E}from"./chunks/chunk-O7DK3GJT.js";import"./chunks/chunk-RRVD63NF.js";import"./chunks/chunk-EEQSUBBL.js";import"./chunks/chunk-MPSLPE4C.js";import"./chunks/chunk-FAUL5L2W.js";import"./chunks/chunk-HTA25PO2.js";import"./chunks/chunk-N6RCLJE6.js";import"./chunks/chunk-WE6KP4FR.js";import"./chunks/chunk-KH5DHZ2U.js";import"./chunks/chunk-HON4OV7M.js";import"./chunks/chunk-TLHUFIXD.js";import"./chunks/chunk-4MJEEEFA.js";import"./chunks/chunk-V6GWPR2A.js";import"./chunks/chunk-WBW6G4N6.js";import{G as $,a as w,ua as k,va as m}from"./chunks/chunk-ZBMJTIYR.js";import"./chunks/chunk-J7FLFHQJ.js";import"./chunks/chunk-VLVNA4T3.js";import"./chunks/chunk-H3DIRJFE.js";import"./chunks/chunk-KXKQDFHX.js";import"./chunks/chunk-TMUK2DD3.js";import*as j from"node:module";function v(e){return w(e)?e:k(e)}function T(e,n){return m(v(e),{debug:n})}function F(e,n){process.once("beforeExit",()=>{e()||(n(new Error("Forge stopped before it finished: it was waiting for input that never came.")),process.exitCode=1)})}E();j.enableCompileCache?.();function M({completed:e,total:n}){e===0?process.stderr.write(`Converting ${n} files
|
|
5
5
|
`):process.stderr.write(` ${e}/${n}
|
|
6
|
-
`)}async function D(){let e=process.argv.slice(2),n=e.includes("--debug"),d=x(e);try{if(e[0]==="__update-check"){let{checkNow:r}=await import("./chunks/check-B6NP7BEM.js");await r();return}if(e[0]==="menu"){let{openedForClick:r,parseMenuArgs:t}=await import("./chunks/command-GAGAD65W.js"),s=t(e.slice(1));if(s.kind==="open"){let{applyColourPreference:h}=await import("./chunks/theme-
|
|
6
|
+
`)}async function D(){let e=process.argv.slice(2),n=e.includes("--debug"),d=x(e);try{if(e[0]==="__update-check"){let{checkNow:r}=await import("./chunks/check-B6NP7BEM.js");await r();return}if(e[0]==="menu"){let{openedForClick:r,parseMenuArgs:t}=await import("./chunks/command-GAGAD65W.js"),s=t(e.slice(1));if(s.kind==="open"){let{applyColourPreference:h}=await import("./chunks/theme-ISNQEBTS.js");h();let{bootShell:I}=await import("./chunks/boot-XX2TLD3Q.js");await I(void 0,{opened:await r(s.action,s.paths)});return}let{runMenuCommand:c}=await import("./chunks/entry-SOHEQPXT.js");process.exitCode=await c(s,p);return}if(e[0]==="mcp"){let{runMcpServer:r}=await import("./chunks/server-6275TY3O.js");await r(e.slice(1));return}let o=S(e);if(o.kind==="shell"){if(d)throw $("No files given.","Name a file, for example: forge photo.jpg --to webp --json");if(!process.stdout.isTTY||!process.stdin.isTTY){process.stderr.write(`Forge needs a file and a target format.
|
|
7
7
|
Try: forge photo.jpg --to webp
|
|
8
|
-
`),process.exitCode=2;return}let{applyColourPreference:r}=await import("./chunks/theme-
|
|
9
|
-
`),json:d,signal:t.signal});return}if(o.kind==="uninstall"){let{runUninstall:r}=await import("./chunks/entry-
|
|
10
|
-
`));return}let{execute:l}=await import("./chunks/execute-
|
|
8
|
+
`),process.exitCode=2;return}let{applyColourPreference:r}=await import("./chunks/theme-ISNQEBTS.js");r();let{bootShell:t}=await import("./chunks/boot-XX2TLD3Q.js");await t(void 0,{menuNote:async()=>(await import("./chunks/entry-SOHEQPXT.js")).menuAtStart(p)});return}if(o.kind==="watch"){let{runWatch:r}=await import("./chunks/watch-command-EYEZKROF.js"),t=new AbortController;process.once("SIGINT",()=>t.abort()),process.exitCode=await r(o,{out:s=>process.stdout.write(`${s}
|
|
9
|
+
`),json:d,signal:t.signal});return}if(o.kind==="uninstall"){let{runUninstall:r}=await import("./chunks/entry-SOHEQPXT.js");process.exitCode=await r(p,t=>process.stdout.write(`${t}
|
|
10
|
+
`));return}let{execute:l}=await import("./chunks/execute-KTLXJTU2.js"),i,y=0,A=(r,t)=>{let s=Date.now();if(r<t&&s-y<100)return;y=s;let c=h=>(h/1e6).toFixed(1);process.stderr.write(`\r downloading ${c(r)} / ${c(t)} MB${r>=t?`
|
|
11
11
|
`:""}`)},u=!!process.stderr.isTTY&&!d,f=new AbortController;o.kind==="extension-op"&&process.once("SIGINT",()=>f.abort());let B=Date.now(),a=await l(o,{json:d,...u?{onInstalling:r=>{i=g(process.stderr,`installing Forge ${r}`)}}:{},signal:f.signal,...u?{onDownload:A}:{},colour:!!process.stdout.isTTY&&!d&&C(),onProgress:u?r=>{r.completed>0&&i?.stop(),M(r)}:void 0,...u?{onSearch:r=>{i??=g(process.stderr,"finding the smallest that fits"),i.update(r)},onEncode:r=>{i??=g(process.stderr,"encoding"),i.update(r)}}:{}});if(i?.stop(),a.stdout.length>0&&process.stdout.write(`${a.stdout.join(`
|
|
12
12
|
`)}
|
|
13
13
|
`),a.stderr.length>0&&process.stderr.write(`${a.stderr.join(`
|
|
14
14
|
`)}
|
|
15
|
-
`),process.exitCode=f.signal.aborted?130:a.exitCode,u&&a.notice&&!f.signal.aborted){let{postFinishNotice:r}=await import("./chunks/notify-NQNNOBFC.js");await r(a.notice,Date.now()-B)}if(u&&process.stdout.isTTY&&o.kind!=="update")try{let{afterCommand:r,spawnRefresh:t}=await import("./chunks/update-note-
|
|
15
|
+
`),process.exitCode=f.signal.aborted?130:a.exitCode,u&&a.notice&&!f.signal.aborted){let{postFinishNotice:r}=await import("./chunks/notify-NQNNOBFC.js");await r(a.notice,Date.now()-B)}if(u&&process.stdout.isTTY&&o.kind!=="update")try{let{afterCommand:r,spawnRefresh:t}=await import("./chunks/update-note-T4LVCD25.js"),{runningScript:s}=await import("./chunks/install-MFYGS5TG.js"),c=await r(p,{refresh:()=>t(s(process.argv[1])),colour:C()});c.length>0&&process.stderr.write(`
|
|
16
16
|
${c.join(`
|
|
17
17
|
`)}
|
|
18
18
|
`)}catch{}}catch(o){if(w(o)){d?process.stdout.write(`${JSON.stringify(b(p,o))}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forge-terminal",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "A terminal-native file converter for macOS, Windows and Linux",
|
|
5
5
|
"whatsNew": [
|
|
6
6
|
{
|
|
7
|
-
"title": "
|
|
8
|
-
"text": "
|
|
7
|
+
"title": "Agents copy the card",
|
|
8
|
+
"text": "An AI agent using Forge can now put a colour card straight on your clipboard, the same card c copies in the app, ready to paste into Figma."
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
"title": "
|
|
12
|
-
"text": "
|
|
11
|
+
"title": "Cards from any colour",
|
|
12
|
+
"text": "Agents can now get the card for a scale or an image's palette too, not only the numbers."
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"keywords": [
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
|
-
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as V}from"./chunk-ZJ45XUJW.js";import{g as F,h as B,i as G}from"./chunk-TFGK7IRZ.js";import{b as O,c as H}from"./chunk-POM7FXIV.js";import{i as D,l as _,m as M,o as U}from"./chunk-7XFLG32B.js";import{b,c as E,h as v,i as y,j as h}from"./chunk-N32JL4UI.js";import{a as J,b as T,c as W}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as x}from"./chunk-WNYM6NSV.js";import"./chunk-KQ2AHGLK.js";import"./chunk-EEQSUBBL.js";import"./chunk-W43SUVWN.js";import"./chunk-FAUL5L2W.js";import"./chunk-TLHUFIXD.js";import"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import{b as N,c as j,d as I,h as L,k as R,l as A,m as P}from"./chunk-ZBMJTIYR.js";import"./chunk-J7FLFHQJ.js";import{c as w}from"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import"./chunk-TMUK2DD3.js";import{readFile as nt}from"node:fs/promises";import{basename as st,resolve as z}from"node:path";function p(t,e){let n=h(e);if(!n)return;let i=n.alpha!==void 0&&n.alpha<1?n.alpha:void 0;return{name:t,hex:b(n.rgb),...i===void 0?{}:{alpha:i}}}function Y(t){let e=t.replace(/^/,"").trim();if(e==="")return{colours:[],bad:[]};if(e.startsWith("{")||e.startsWith("["))try{return X(JSON.parse(e))}catch{}return rt(e.split(/\r?\n/))}var m=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),Q=["hex","colour","color","value","$value"];function X(t){let e={colours:[],bad:[]};if(Array.isArray(t)){for(let c of t){if(!m(c))continue;let s=typeof c.name=="string"?c.name:void 0,d=Q.find(a=>typeof c[a]=="string");if(!s||!d)continue;let l=c[d],f=p(s,l);f?e.colours.push(f):e.bad.push(`${s}: ${l}`)}return e}if(!m(t))return e;let n=Object.keys(t).filter(c=>!c.startsWith("$")),i=n.length===1?t[n[0]]:void 0,o=m(i)&&!("$value"in i)?i:t,r=(c,s=0)=>{let d=/^\{(.+)\}$/.exec(c.trim());if(!d||s>8)return c;let l=t;for(let f of d[1].split("."))l=m(l)?l[f]:void 0;return m(l)&&typeof l.$value=="string"?r(l.$value,s+1):typeof l=="string"?r(l,s+1):c},u=(c,s,d)=>{let l=c.$type??d;for(let[f,a]of Object.entries(c)){if(f.startsWith("$"))continue;let C=[...s,f].join("/");if(m(a)&&"$value"in a){let g=a.$type??l,$=a.$value;if(typeof $!="string")continue;let S=p(C,r($));S?e.colours.push(S):g==="color"&&e.bad.push(`${C}: ${$}`)}else if(m(a))u(a,[...s,f],l);else if(typeof a=="string"){let g=p(C,r(a));g&&e.colours.push(g)}}};return u(o,[]),e}function q(t){let e=[],n="",i=!1;for(let o=0;o<t.length;o++){let r=t[o];i?r==='"'&&t[o+1]==='"'?(n+='"',o++):r==='"'?i=!1:n+=r:r==='"'?i=!0:r===","?(e.push(n.trim()),n=""):n+=r}return e.push(n.trim()),e}var Z=["name","token","label"],tt=["hex","colour","color","value","rgb"];function et(t,e,n){let i={colours:[],bad:[]};for(let o of t){if(o.trim()==="")continue;let r=q(o),u=r[e]??"",c=r[n]??"",s=u?p(u,c):void 0;s?i.colours.push(s):i.bad.push(o.trim())}return i}function ot(t){let e=t.replace(/^[-*•]\s+/,"").replace(/[;,]$/,"").trim();for(let o of[" ",":","=",","]){let r=e.indexOf(o);if(r<=0)continue;let u=p(e.slice(0,r).trim(),e.slice(r+1).trim());if(u?.name)return u}let n=e.split(/\s+/);for(let o=1;o<n.length;o++){let r=p(n.slice(0,o).join(" "),n.slice(o).join(" "));if(r)return r}for(let o=n.length-1;o>=1;o--){let r=p(n.slice(o).join(" "),n.slice(0,o).join(" "));if(r)return r}let i=p("",e);return i?{...i,name:i.hex}:void 0}function rt(t){let e=q(t[0]??"").map(c=>c.toLowerCase()),n=e.findIndex(c=>Z.includes(c)),i=e.findIndex(c=>tt.includes(c));if(e.length>1&&n!==-1&&i!==-1)return et(t.slice(1),n,i);let o=t.some(c=>/^\s*--[\w-]+\s*:/.test(c)),r={colours:[],bad:[]},u=!1;for(let c of t){let s=c.replace(/\/\*.*?\*\//g,"");if(u){let f=s.indexOf("*/");if(f===-1)continue;s=s.slice(f+2),u=!1}let d=s.indexOf("/*");if(d!==-1&&(s=s.slice(0,d),u=!0),s=s.trim(),s===""||s.startsWith("//"))continue;if(o){let f=/^--([\w-]+)\s*:\s*(.+?)\s*;?$/.exec(s);if(!f)continue;let a=p(f[1],f[2]);a&&r.colours.push(a);continue}if(s.startsWith("#")&&!h(s.split(/\s+/)[0]))continue;let l=ot(s);l?r.colours.push(l):r.bad.push(s)}return r}var k=({r:t,g:e,b:n},i)=>i?`\x1B[38;2;${t};${e};${n}m\u2588\u2588\x1B[39m `:"";function it(t,e){let n=E(e),i,o=Number.POSITIVE_INFINITY;for(let r of t){let u=(r.centre.L-n.L)**2+(r.centre.a-n.a)**2+(r.centre.b-n.b)**2;u<o&&(o=u,i=r)}return i}async function Et(t,e){let{pixels:n}=await V(t.input),i=_(n);if(i.length===0)throw R(t.input);let o=t.inside?it(i,t.inside):void 0,r=o?M(n,o):i;if(t.svg)return{exitCode:0,stdout:[B(w(t.input),r,"light",o?.hex)],stderr:[]};if(e.json){let c=T(x,{source:z(t.input),...o?{inside:o.hex}:{},colours:r.map(s=>({hex:s.hex,rgb:v(s.rgb),oklch:y(s.rgb),share:s.share}))});return{exitCode:0,stdout:[JSON.stringify(c)],stderr:[]}}let u=U(r.map(c=>c.share));return{exitCode:0,stdout:r.map((c,s)=>`${k(c.rgb,e.colour)}${c.hex} ${String(u[s]).padStart(3)}%`),stderr:[]}}async function vt(t,e){let n=D(t.colour);if(t.svg)return{exitCode:0,stdout:[G(t.colour,n)],stderr:[]};let i=n.map(o=>({...o,...H(o.rgb)}));if(e.json){let o=W(x,{reference:b(t.colour),steps:i.map(r=>({step:r.step,hex:r.hex,oklch:y(r.rgb),white:r.white,black:r.black}))});return{exitCode:0,stdout:[JSON.stringify(o)],stderr:[]}}return{exitCode:0,stdout:i.map(o=>`${String(o.step).padStart(4)} ${k(o.rgb,e.colour)}${o.hex} white ${o.white.toFixed(1)} ${O(o.white)} \xB7 black ${o.black.toFixed(1)} ${O(o.black)}`),stderr:[]}}async function ct(){let t=[];for await(let e of process.stdin)t.push(Buffer.from(e));return Buffer.concat(t).toString("utf8")}async function ut(t){try{return await nt(t,"utf8")}catch(e){let n=e.code;throw n==="ENOENT"||n==="ENOTDIR"?N(t):n==="EISDIR"?j(t):n==="EACCES"||n==="EPERM"?I(t):L(t,e)}}var K=t=>t.alpha===void 0?t.hex:`${t.hex} ${Math.round(t.alpha*100)}%`;async function Nt(t,e,n=ct){let i=t.input==="-",o=i?await n():await ut(t.input),r=i?"the text from stdin":w(t.input),{colours:u,bad:c}=Y(o);if(c.length>0)throw P(r,c);if(u.length===0)throw A(r);if(t.svg){let s=t.title??(i?"Colours":st(t.input).replace(/\..*$/,"")||"Colours"),d=u.length,l=u.map(a=>({id:a.name,name:a.name,value:K(a),hex:a.hex,...a.alpha===void 0?{}:{alpha:a.alpha}}));return{exitCode:0,stdout:[F(s,`${d} colour${d===1?"":"s"}`,l,"light",{perRow:8})],stderr:[]}}if(e.json){let s=J(x,{source:i?"-":z(t.input),colours:u});return{exitCode:0,stdout:[JSON.stringify(s)],stderr:[]}}return{exitCode:0,stdout:u.map(s=>{let d=h(s.hex)?.rgb??{r:0,g:0,b:0};return`${k(d,e.colour)}${K(s)} ${s.name}`}),stderr:[]}}export{Nt as runCard,Et as runPalette,vt as runScale};
|