forge-terminal 0.5.6 → 0.5.8

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.
Files changed (55) hide show
  1. package/README.md +14 -9
  2. package/dist/chunks/{about-credits-TM34J3IS.js → about-credits-PQSIWSE2.js} +1 -1
  3. package/dist/chunks/{args-7OJGCKH4.js → args-J5JEHQLE.js} +1 -1
  4. package/dist/chunks/{boot-5KSVFF4C.js → boot-ETZUHG3U.js} +1 -1
  5. package/dist/chunks/{chunk-QV27SER6.js → chunk-2M5PPZIS.js} +2 -2
  6. package/dist/chunks/{chunk-WNYM6NSV.js → chunk-4OSMYHKQ.js} +1 -1
  7. package/dist/chunks/{chunk-W43SUVWN.js → chunk-6TTONCYR.js} +1 -1
  8. package/dist/chunks/{chunk-XZZCVJ64.js → chunk-BP6CVOQR.js} +2 -2
  9. package/dist/chunks/{chunk-QYAJFKQL.js → chunk-DD5Z6NSH.js} +1 -1
  10. package/dist/chunks/{chunk-WBV6I7UP.js → chunk-DHW72U6X.js} +1 -1
  11. package/dist/chunks/{chunk-2HGBB3DQ.js → chunk-FEFNS6YZ.js} +1 -1
  12. package/dist/chunks/{chunk-UB6YVCIS.js → chunk-H3KW7HTC.js} +1 -1
  13. package/dist/chunks/{chunk-ZJ45XUJW.js → chunk-J7Z7ULLN.js} +1 -1
  14. package/dist/chunks/{chunk-3RH2AXJW.js → chunk-JI7YY44M.js} +1 -1
  15. package/dist/chunks/{chunk-LAJAXLGQ.js → chunk-KTCHWHQB.js} +1 -1
  16. package/dist/chunks/chunk-NAE3AJ3M.js +3 -0
  17. package/dist/chunks/{chunk-XY7C5I5T.js → chunk-NUW4YOJ6.js} +1 -1
  18. package/dist/chunks/{chunk-7R7KDE3R.js → chunk-OXDRJO4V.js} +1 -1
  19. package/dist/chunks/{chunk-KQ2AHGLK.js → chunk-RQWWUCGQ.js} +1 -1
  20. package/dist/chunks/{chunk-75GYDNAQ.js → chunk-RT6EXB2P.js} +1 -1
  21. package/dist/chunks/{chunk-LM4K7CZQ.js → chunk-SM735FG7.js} +7 -6
  22. package/dist/chunks/{chunk-RUAEBL2F.js → chunk-T4CLHCLJ.js} +2 -2
  23. package/dist/chunks/{chunk-37U22UEW.js → chunk-TJ5YBJEO.js} +1 -1
  24. package/dist/chunks/{chunk-U2XQL7AA.js → chunk-VBDRWNEG.js} +1 -1
  25. package/dist/chunks/{chunk-CZDI37SI.js → chunk-XGG3NYQN.js} +1 -1
  26. package/dist/chunks/{chunk-2BPH3IL6.js → chunk-YISJTRB6.js} +1 -1
  27. package/dist/chunks/chunk-YPAFAG4W.js +6 -0
  28. package/dist/chunks/{chunk-JDTDXCZE.js → chunk-Z6IQV737.js} +1 -1
  29. package/dist/chunks/{clip-command-3JBZK6Q3.js → clip-command-QIMH2U7N.js} +1 -1
  30. package/dist/chunks/{clipboard-XOIVXPVL.js → clipboard-IZJTBTSW.js} +1 -1
  31. package/dist/chunks/colour-3MFAFJNN.js +3 -0
  32. package/dist/chunks/{entry-64GTSHV2.js → entry-HGEJC7CZ.js} +1 -1
  33. package/dist/chunks/{execute-3J755YKG.js → execute-MRVDAKZO.js} +1 -1
  34. package/dist/chunks/{extensions-QQT6OD7W.js → extensions-ONARRS5Q.js} +1 -1
  35. package/dist/chunks/{extensions-command-FV3N7CBV.js → extensions-command-65QEMN2L.js} +1 -1
  36. package/dist/chunks/{ffmpeg-VGE2QCC7.js → ffmpeg-RTFJS67A.js} +1 -1
  37. package/dist/chunks/{launch-ATJNO6ZO.js → launch-T7YOO7BQ.js} +5 -5
  38. package/dist/chunks/{manager-ROCFK7AS.js → manager-5EJGANFW.js} +1 -1
  39. package/dist/chunks/{needed-T722HOKD.js → needed-6GCBKP3S.js} +1 -1
  40. package/dist/chunks/{own-CX3EJ2AH.js → own-KMIT2CXF.js} +1 -1
  41. package/dist/chunks/{preset-command-M7SESD5C.js → preset-command-3ILRQZSJ.js} +1 -1
  42. package/dist/chunks/{registry-7BJ4J2SD.js → registry-K245FDI2.js} +1 -1
  43. package/dist/chunks/server-M5YGJHOL.js +77 -0
  44. package/dist/chunks/{theme-S234JXQH.js → theme-XKWZV7OX.js} +1 -1
  45. package/dist/chunks/{transcribe-L64JHZ3U.js → transcribe-SQC6QTV5.js} +1 -1
  46. package/dist/chunks/transcribe-command-PAHSXMWG.js +3 -0
  47. package/dist/chunks/{update-note-YQD2W5B2.js → update-note-NRPILOCL.js} +1 -1
  48. package/dist/chunks/{watch-command-B2Z4KSWR.js → watch-command-QOMMDISG.js} +1 -1
  49. package/dist/index.js +6 -6
  50. package/package.json +5 -5
  51. package/skills/forge/SKILL.md +67 -4
  52. package/dist/chunks/chunk-YR7QRQ5F.js +0 -6
  53. package/dist/chunks/colour-CEKEW7RV.js +0 -3
  54. package/dist/chunks/server-64H64DIC.js +0 -74
  55. package/dist/chunks/transcribe-command-Y3AHXLVA.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-WNYM6NSV.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};
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-4OSMYHKQ.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-QV27SER6.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-HZDYZ5RD.js";import"./chunk-W43SUVWN.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};
3
+ import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n}from"./chunk-2M5PPZIS.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-HZDYZ5RD.js";import"./chunk-6TTONCYR.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};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{a as _,c as tt}from"./chunk-NAE3AJ3M.js";import{a as S,b as Y,c as Z,d as x}from"./chunk-YPAFAG4W.js";import{c as X}from"./chunk-RT6EXB2P.js";import"./chunk-XGG3NYQN.js";import{a as M,b as B,c as H,d as K,f as q,g as z,k,o as G,p as J,q as Q,r as V,s as W}from"./chunk-2M5PPZIS.js";import"./chunk-VBDRWNEG.js";import"./chunk-MF3KKEFB.js";import"./chunk-I25E2XDH.js";import"./chunk-KTCHWHQB.js";import"./chunk-HZDYZ5RD.js";import"./chunk-O7DK3GJT.js";import"./chunk-RQWWUCGQ.js";import"./chunk-EEQSUBBL.js";import"./chunk-6TTONCYR.js";import"./chunk-FAUL5L2W.js";import{a as j,d as D}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 A,a as I,b as U,oa as L,qa as O,ra as y,ta as R,ua as C,va as N,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 $}from"node:fs";import{stat as it}from"node:fs/promises";import{basename as l,dirname as rt,extname as w,join as et,resolve as p}from"node:path";function at(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 j.find(n=>n.ext===r)?.id??"md"}function h(t,e,r,n){let i=`${t}${D(n)}`;return r===void 0?et(e,i):T(r)?et(p(r),i):p(r)}var nt=t=>t.split(/\s+/).filter(Boolean).length,st=t=>t.segments.reduce((e,r)=>e+nt(r.text),0);async function ct(t){let{probe:e}=await import("./registry-K245FDI2.js"),r=await e(t).catch(()=>{throw L(t)});return _(r)}async function dt(t,e,r,n){if(e.to!==void 0)throw A("--to is for video and sound: a picture or PDF gives its text as it is.",`Try: forge transcribe ${l(t.path)}`);if(!(await k())?.read)throw await Q();let o=h(l(t.path,w(t.path)),rt(t.path),e.output,n);if($(o)&&!e.force)throw g(o);let c=await J(t.path,{language:e.language,signal:r.signal,onEvent:r.onProgress}),a=M(c);if(!B(a))throw R(t.path);await P(o,await V(a,n,l(t.path),{signal:r.signal,lang:e.language})),r.document?.({path:o,markdown:H(a)});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 ${nt(K(a)).toLocaleString("en-US")} words`),r.finished?.({made:[{from:[t.path],to:[o]}],failed:[]}),0}async function xt(t,e){try{let r=S(t.input);if(r?.kind==="playlist")throw O("This is a playlist.",void 0,{hint:"Pass one video's link.",shellHint:"Paste one video's link."});let n,i,o,c,a=at(t);if(r===void 0){if(n=p(t.input),!(await it(n).catch(()=>{}))?.isFile())throw U(n);let d=await X(n);if(d!=="video"&&d!=="audio"){let u=await ct(n);if(u)return await dt(u,t,e,a)}}let s=await k(t.language?{locale:t.language}:{});if(s===void 0||!s.speech)throw y(q(process.platform,s?.missing));let E=t.notes&&s.notes==="available";if(t.notes&&!E){if(!t.transcript)throw y(z(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,rt(n),t.output,a),$(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 tt(r.url,{signal:m.signal,onEvent:u=>{u.kind==="facts"&&(d=h(x(u.facts.title),process.cwd(),t.output,a),$(d)&&!t.force&&m.abort(g(d)))}}),n=c.path,i={title:c.facts.title,from:r.url},o=d??h(x(c.facts.title),process.cwd(),t.output,a)}let f;try{f=await G(n,{notes:E,detail:t.detail,locale:t.language,signal:e.signal,onEvent:e.onProgress})}finally{await c?.dispose()}let F=Z(f,i,{transcript:t.transcript});await P(o,await W(F,a,{signal:e.signal,lang:f.locale})),e.document?.({path:o,markdown:F});let b=f.notes?.parts.length,ot=b===void 0?"":` \xB7 ${b} ${b===1?"part":"parts"}`;return e.out(`\u2713 ${v(o)} ${Y(f.seconds)} \u2192 ${st(f).toLocaleString("en-US")} words${ot}`),e.finished?.({made:[{from:[r===void 0?n:i.title],to:[o]}],failed:[]}),0}catch(r){let n=I(r)?r:C(r);for(let o of N(n,{debug:t.debug}))e.err(o);let i=S(t.input)===void 0?p(t.input):"";return e.finished?.({made:[],failed:[{path:i,message:n.message}]}),1}}export{xt 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-WNYM6NSV.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};
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-4OSMYHKQ.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-QYAJFKQL.js";import{a as W,d as N}from"./chunk-75GYDNAQ.js";import"./chunk-2HGBB3DQ.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-XY7C5I5T.js";import"./chunk-U2XQL7AA.js";import"./chunk-WBV6I7UP.js";import"./chunk-LAJAXLGQ.js";import{d as w,e as h}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as S}from"./chunk-WNYM6NSV.js";import"./chunk-O7DK3GJT.js";import"./chunk-KQ2AHGLK.js";import"./chunk-EEQSUBBL.js";import"./chunk-W43SUVWN.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};
3
+ import{c as R,d as k}from"./chunk-DD5Z6NSH.js";import{a as W,d as N}from"./chunk-RT6EXB2P.js";import"./chunk-FEFNS6YZ.js";import"./chunk-Q6KQWJ4J.js";import"./chunk-NUW4YOJ6.js";import"./chunk-VBDRWNEG.js";import"./chunk-DHW72U6X.js";import"./chunk-KTCHWHQB.js";import{d as w,e as h}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as S}from"./chunk-4OSMYHKQ.js";import"./chunk-O7DK3GJT.js";import"./chunk-RQWWUCGQ.js";import"./chunk-EEQSUBBL.js";import"./chunk-6TTONCYR.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-2BPH3IL6.js";import{b as g,d as C}from"./chunks/chunk-IBPGC4N2.js";import"./chunks/chunk-WBV6I7UP.js";import"./chunks/chunk-LAJAXLGQ.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-WNYM6NSV.js";import{b as E}from"./chunks/chunk-O7DK3GJT.js";import"./chunks/chunk-KQ2AHGLK.js";import"./chunks/chunk-EEQSUBBL.js";import"./chunks/chunk-W43SUVWN.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
4
+ import{e as x,f as S}from"./chunks/chunk-YISJTRB6.js";import{b as g,d as C}from"./chunks/chunk-IBPGC4N2.js";import"./chunks/chunk-DHW72U6X.js";import"./chunks/chunk-KTCHWHQB.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-4OSMYHKQ.js";import{b as E}from"./chunks/chunk-O7DK3GJT.js";import"./chunks/chunk-RQWWUCGQ.js";import"./chunks/chunk-EEQSUBBL.js";import"./chunks/chunk-6TTONCYR.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-S234JXQH.js");h();let{bootShell:I}=await import("./chunks/boot-5KSVFF4C.js");await I(void 0,{opened:await r(s.action,s.paths)});return}let{runMenuCommand:c}=await import("./chunks/entry-64GTSHV2.js");process.exitCode=await c(s,p);return}if(e[0]==="mcp"){let{runMcpServer:r}=await import("./chunks/server-64H64DIC.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.
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-XKWZV7OX.js");h();let{bootShell:I}=await import("./chunks/boot-ETZUHG3U.js");await I(void 0,{opened:await r(s.action,s.paths)});return}let{runMenuCommand:c}=await import("./chunks/entry-HGEJC7CZ.js");process.exitCode=await c(s,p);return}if(e[0]==="mcp"){let{runMcpServer:r}=await import("./chunks/server-M5YGJHOL.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-S234JXQH.js");r();let{bootShell:t}=await import("./chunks/boot-5KSVFF4C.js");await t(void 0,{menuNote:async()=>(await import("./chunks/entry-64GTSHV2.js")).menuAtStart(p)});return}if(o.kind==="watch"){let{runWatch:r}=await import("./chunks/watch-command-B2Z4KSWR.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-64GTSHV2.js");process.exitCode=await r(p,t=>process.stdout.write(`${t}
10
- `));return}let{execute:l}=await import("./chunks/execute-3J755YKG.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?`
8
+ `),process.exitCode=2;return}let{applyColourPreference:r}=await import("./chunks/theme-XKWZV7OX.js");r();let{bootShell:t}=await import("./chunks/boot-ETZUHG3U.js");await t(void 0,{menuNote:async()=>(await import("./chunks/entry-HGEJC7CZ.js")).menuAtStart(p)});return}if(o.kind==="watch"){let{runWatch:r}=await import("./chunks/watch-command-QOMMDISG.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-HGEJC7CZ.js");process.exitCode=await r(p,t=>process.stdout.write(`${t}
10
+ `));return}let{execute:l}=await import("./chunks/execute-MRVDAKZO.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-YQD2W5B2.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(`
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-NRPILOCL.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.6",
3
+ "version": "0.5.8",
4
4
  "description": "A terminal-native file converter for macOS, Windows and Linux",
5
5
  "whatsNew": [
6
6
  {
7
- "title": "Colour cards for Figma",
8
- "text": "forge card turns a palette file (design tokens, CSV, CSS or one colour a line) into a card of swatches. Paste it into Figma and each colour is its own layer, named as written."
7
+ "title": "Agents hear recordings",
8
+ "text": "AI agents using Forge can now get the notes and transcript of a video, sound file or YouTube link, made on your computer."
9
9
  },
10
10
  {
11
- "title": "Agents can draw cards",
12
- "text": "Forge's MCP server has forge_card, so an AI agent can turn a colour system it wrote into the same card for you to paste."
11
+ "title": "Agents read pictures",
12
+ "text": "Agents can also get the text in a picture, screenshot, scan or PDF, with headings, lists and tables kept."
13
13
  }
14
14
  ],
15
15
  "keywords": [
@@ -1,11 +1,24 @@
1
1
  ---
2
2
  name: forge
3
- description: Convert, compress and edit local files on macOS with the Forge CLI (`forge`) — images (HEIC, JPEG, PNG, WebP, AVIF, GIF, TIFF), PDFs and Word documents. Use when the user wants a file in another format, smaller or under a size, or cropped to a shape, or a PDF merged, split, trimmed or rotated, or an image's colour palette or a tonal scale from a colour, and `forge` is installed (`npm i -g forge-terminal`).
3
+ description: Convert, compress and edit local files with the Forge CLI (`forge`) — images (HEIC, camera RAW, JPEG, PNG, WebP, AVIF, GIF, TIFF), PDFs, Word documents, video and sound — and hear or read what an agent cannot. Use when the user wants a file in another format, smaller or under a size limit, or cropped to a shape; a PDF merged, split, trimmed or rotated; what a recording, meeting or YouTube video says; the text in a picture, scan or PDF; or a colour palette, tonal scale or named colours as a card to paste into Figma — and `forge` is installed (`npm i -g forge-terminal`).
4
4
  ---
5
5
 
6
6
  # Forge
7
7
 
8
- Forge converts files on this Mac. Nothing is uploaded.
8
+ Forge converts files on this computer. Nothing is uploaded.
9
+
10
+ ## When to reach for it
11
+
12
+ - **A file must fit a limit** (an upload under 5 MB, an email, a form):
13
+ `--max-size 5mb`. A set width: `--width 1200`.
14
+ - **A format you cannot open** (HEIC, camera RAW, Word): convert it to PNG,
15
+ JPEG or PDF and read that.
16
+ - **What a recording, meeting or YouTube video says:** `forge transcribe`,
17
+ then read the Markdown file it writes.
18
+ - **The text in a picture, screenshot, scan or PDF:** `forge transcribe` on
19
+ it reads the text instead.
20
+ - **Colours for Figma:** `forge card`, `forge scale` or `forge palette` with
21
+ `--svg`, piped to `pbcopy`. The user presses ⌘V in Figma.
9
22
 
10
23
  ## Always
11
24
 
@@ -55,6 +68,10 @@ forge --formats --json
55
68
  forge palette photo.jpg --json # an image's main colours
56
69
  forge palette photo.jpg --inside F96363 --json # one colour's shades
57
70
  forge scale 6579FD --json # 50–950, the colour at 500
71
+ forge card palette.csv --json # named colours, as read
72
+ forge card palette.csv --svg | pbcopy # a card to paste into Figma
73
+ forge transcribe talk.mp4 # notes and transcript -> talk.md
74
+ forge transcribe scan.pdf # a picture's or PDF's text -> scan.md
58
75
  ```
59
76
 
60
77
  For a colour, pass the hex without `#`, or quote it: an unquoted `#` starts
@@ -76,6 +93,47 @@ Outputs go beside the source unless `-o` names a folder (or, for one file, a
76
93
  filename). Page operations always write beside the source, take no `-o`, and
77
94
  never edit the original.
78
95
 
96
+ ## Transcribe and read text
97
+
98
+ ```bash
99
+ forge transcribe meeting.m4a # summary, notes and transcript -> meeting.md
100
+ forge transcribe talk.mp4 --to transcript # no notes; --to notes: no transcript
101
+ forge transcribe 'https://youtu.be/…' # a YouTube link, into this folder
102
+ forge transcribe talk.mp4 --detail brief --format pdf -o ~/Notes/
103
+ forge transcribe whiteboard.jpg # the text in a picture -> whiteboard.md
104
+ ```
105
+
106
+ It takes one file or link at a time and has **no `--json`**: on success it
107
+ prints one line, `✓ <file> 1:15 → 812 words · 4 parts`, and exits 0. Read
108
+ the file it names. A video or sound file gives notes and a transcript; a
109
+ picture, screenshot or PDF gives its text, with headings, lists and tables
110
+ kept (`--to` is refused for those). What it is is read from the content, not
111
+ the name. `--language fr-FR` when the speech or text is not in the
112
+ computer's own language. Notes need Apple Intelligence on a Mac; elsewhere
113
+ `--to all` gives the transcript alone. A long recording takes minutes.
114
+ Without `--force` an existing file is refused (`output-exists`).
115
+
116
+ Failure codes: `transcribe-unavailable` (the hint names what to install or
117
+ turn on), `read-unavailable` (reading text needs macOS 26, or the read-text
118
+ extension on Windows and Linux), `no-text` (nothing to read),
119
+ `link-unavailable` (a playlist, or a video yt-dlp could not fetch),
120
+ `extension-missing` (a link needs yt-dlp: the hint is the install command;
121
+ ask the user first, it downloads), `output-exists`.
122
+
123
+ ## Colour cards for Figma
124
+
125
+ ```bash
126
+ forge card palette.csv --svg | pbcopy # design tokens, CSV, CSS variables or "bg #F8F1E6" lines
127
+ pbpaste | forge card - --svg --title 'Brand' | pbcopy # colours you wrote, from stdin
128
+ forge scale 6579FD --svg | pbcopy # a 50–950 scale
129
+ ```
130
+
131
+ Pasted into Figma, the card is one layer per colour, named as written, with
132
+ its exact fill. `forge card` reads the file by content. If any line is not a
133
+ colour it draws nothing, names every bad line and exits 1. Write your colours
134
+ one a line as `name colour` and pipe them in with `-`. If `pbcopy` fails (a
135
+ sandbox may block the clipboard), give the user the command to run instead.
136
+
79
137
  ## Resize and trim edges
80
138
 
81
139
  Built in, images only, format kept unless `--to` is given:
@@ -167,8 +225,13 @@ exit 1 and a hint; a wrong password has its own hint.
167
225
  ## MCP
168
226
 
169
227
  If a `forge` MCP server is connected (tools `forge_probe`, `forge_formats`,
170
- `forge_convert`, `forge_compress`, `forge_pdf`, `forge_palette`,
171
- `forge_scale`), prefer it. It takes absolute
228
+ `forge_convert`, `forge_compress`, `forge_pdf`, `forge_clip`, `forge_palette`,
229
+ `forge_scale`, `forge_card`, `forge_transcribe`, `forge_read_text`), prefer it.
230
+ `forge_transcribe` and `forge_read_text` write the file and also return its
231
+ text as Markdown, so there is nothing more to read. `forge_card`,
232
+ `forge_scale` and `forge_palette` take `copy: true`, which puts the card on
233
+ the user's clipboard from Forge itself, with no shell needed; `svg: true`
234
+ returns it. It takes absolute
172
235
  paths and returns the same JSON as `structuredContent`. It never overwrites
173
236
  unless you pass `overwrite: true`, and an encrypted PDF takes a `password`
174
237
  argument. `forge_convert` also takes `sharpen: true`, `boost: 2 | 3 | 4` and `removeBackground: true`
@@ -1,6 +0,0 @@
1
- import { createRequire as __forgeCreateRequire } from 'node:module';
2
- const require = __forgeCreateRequire(import.meta.url);
3
- import{l as P}from"./chunk-CZDI37SI.js";import{c as k,e as I,f as $}from"./chunk-I25E2XDH.js";import{K as S,oa as E,qa as m,x}from"./chunk-ZBMJTIYR.js";var D=new Set(["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com"]),M=/^[A-Za-z0-9_-]{11}$/,w=t=>t&&M.test(t)?{kind:"video",id:t,url:`https://www.youtube.com/watch?v=${t}`}:void 0;function Z(t){let r=t.trim();if(r==="")return;let e;try{e=new URL(/^[a-z]+:\/\//i.test(r)?r:`https://${r}`)}catch{return}let n=e.hostname.toLowerCase();if(n==="youtu.be")return w(e.pathname.slice(1).split("/")[0]);if(!D.has(n))return;let[s,o]=e.pathname.split("/").filter(Boolean);if(s==="watch")return w(e.searchParams.get("v"));if(s==="shorts"||s==="live")return w(o);if(s==="playlist"&&e.searchParams.get("list"))return{kind:"playlist"}}var R="Summary and notes by Apple Intelligence. They may contain mistakes.";function N(t){let r=Math.floor(t),e=o=>String(o).padStart(2,"0"),n=Math.floor(r/3600),s=Math.floor(r/60)%60;return n>0?`${n}:${e(s)}:${e(r%60)}`:`${s}:${e(r%60)}`}var L=t=>t.split(/\s+/).filter(Boolean).length,V=60,j=140,Y=1,W=10;function H(t){let r=[],e;for(let n of t){if(e){let s=n.start-e.end;if(!(s>W||s>Y&&e.words>=V||e.words>=j)){e.text+=` ${n.text}`,e.end=n.end,e.words+=L(n.text);continue}r.push({start:e.start,text:e.text})}e={start:n.start,end:n.end,text:n.text,words:L(n.text)}}return e&&r.push({start:e.start,text:e.text}),r}var T=t=>H(t).flatMap(r=>[`**${N(r.start)}** ${r.text}`,""]),B=t=>/^https?:\/\/\S+$/.test(t)?`<${t}>`:t;function Q(t,r,{transcript:e=!0}={}){let n=[`# ${r.title}`,"",B(r.from),""],s=t.notes;if(!s)return[...n,...T(t.segments)].join(`
4
- `);let o=s.parts,p=a=>{let d=o[a];return d?`### ${d.refused?`Part ${a+1}`:d.heading} \xB7 ${N(d.start)}`:""};n.push(s.summary,"","## Notes",""),o.forEach((a,d)=>{n.push(p(d),""),a.points.length>0&&n.push(...a.points.map(l=>`- ${l}`),"")});let c=[`_${R}_`,""];return e?(n.push("## Transcript",""),o.forEach((a,d)=>{let l=o[d+1]?.start??Number.POSITIVE_INFINITY,b=t.segments.filter(h=>h.start>=a.start&&h.start<l);n.push(p(d),"",...T(b))}),[...n,...c].join(`
5
- `)):[...n,...c].join(`
6
- `)}function tt(t){let r=[...t].map(e=>(e.codePointAt(0)??0)<32?" ":e).join("").replace(/[/\\:*?"<>|]/g,"-").replace(/\s+/g," ").trim().slice(0,120).replace(/^\.+/,"");return r===""?"transcript":r}function nt(t){if(t.kind!=="media"){if(t.kind==="image"){let{path:r,format:e,bytes:n,width:s,height:o}=t;return{what:"image",path:r,format:e,bytes:n,width:s,height:o}}if(t.format!=="pdf")throw E(t.path);if(t.encrypted)throw x(t.path);return{what:"pdf",path:t.path,bytes:t.bytes,pages:t.pages}}}import{spawn as _}from"node:child_process";import{mkdtemp as C,rm as K}from"node:fs/promises";import{tmpdir as U}from"node:os";import{join as A}from"node:path";import{createInterface as G}from"node:readline";var z=[[/private video/i,"This video is private."],[/confirm your age/i,"This video is age-restricted."],[/members-only|join this channel/i,"This video is for channel members only."],[/live event will begin|premieres in/i,"This video has not started yet."],[/unavailable|has been removed|does not exist/i,"This video is unavailable."]],g=class extends Error{};function J(t=process.platform,r=process.arch){let e=I("yt-dlp");return e!==void 0&&$(e,t,r)!==void 0?S("yt-dlp"):m(`YouTube links on ${k(t)} need yt-dlp on your PATH.`,void 0,{hint:"Install yt-dlp (https://github.com/yt-dlp/yt-dlp) and put it on your PATH.",shellHint:"Install yt-dlp and put it on your PATH."})}async function ft(t,r={}){let e=await P();if(e===void 0)throw J();let n=await C(A(U(),"forge-yt-"));r.onDir?.(n);let s=()=>K(n,{recursive:!0,force:!0});try{let o;try{o=await F(e.entry,t,n,r)}catch(p){if(!(p instanceof g))throw p;if(e.own)throw m(`yt-dlp could not fetch this video: ${p.message}`,p);await X(e.entry,r.signal);try{o=await F(e.entry,t,n,r)}catch(c){throw c instanceof g?m(`yt-dlp could not fetch this video: ${c.message}`,c):c}}return{...o,dispose:s}}catch(o){throw await s(),o}}function F(t,r,e,n){let{signal:s}=n;if(s?.aborted)return Promise.reject(s.reason??new Error("aborted"));let o=["--js-runtimes",`node:${process.execPath}`,"--no-playlist","--no-warnings","--newline","--progress","-f","bestaudio[ext=m4a]/bestaudio","--print","before_dl:forge-facts %(.{title,uploader,duration,is_live})j","--progress-template","download:forge-bytes %(progress.downloaded_bytes)s %(progress.total_bytes,progress.total_bytes_estimate)s","--print","after_move:forge-file %(filepath)s","--no-simulate","-o",A(e,"sound.%(ext)s"),r];return new Promise((p,c)=>{let a=_(t,o,{stdio:["ignore","pipe","pipe"]}),d,l,b="",h=!1,y=i=>{h||(h=!0,s?.removeEventListener("abort",v),i())},v=()=>{a.kill("SIGKILL"),y(()=>c(s?.reason??new Error("aborted")))};s?.addEventListener("abort",v,{once:!0}),G({input:a.stdout}).on("line",i=>{if(i.startsWith("forge-facts ")){let u=JSON.parse(i.slice(12));if(u.is_live===!0){a.kill("SIGKILL"),y(()=>c(m("Live streams cannot be transcribed.")));return}d={title:String(u.title??""),uploader:String(u.uploader??""),seconds:Number(u.duration??0)},n.onEvent?.({kind:"facts",facts:d})}else if(i.startsWith("forge-bytes ")){let[u,f]=i.slice(12).split(" ").map(Number);Number.isFinite(u)&&Number.isFinite(f)&&(f??0)>0&&n.onEvent?.({kind:"bytes",done:u,total:f})}else i.startsWith("forge-file ")&&(l=i.slice(11))}),a.stderr.on("data",i=>{b+=i.toString()}),a.on("error",i=>y(()=>c(new g(i.message)))),a.on("close",i=>y(()=>{if(i===0&&d!==void 0&&l!==void 0)return p({path:l,facts:d});let u=b.match(/ERROR: (?:\[[^\]]*\] )?(?:[\w-]+: )?(.*)/)?.[1]?.trim()??"",f=z.find(([O])=>O.test(u));c(f?m(f[1]):new g(u||`yt-dlp exited ${i}`))}))})}function X(t,r){return new Promise((e,n)=>{let s=_(t,["--update"],{stdio:"ignore"}),o=()=>s.kill("SIGKILL");r?.addEventListener("abort",o,{once:!0}),s.on("error",()=>e()),s.on("close",()=>{r?.removeEventListener("abort",o),r?.aborted?n(r.reason??new Error("aborted")):e()})})}export{Z as a,N as b,Q as c,tt as d,nt as e,J as f,ft as g};
@@ -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};