forge-terminal 0.3.2 → 0.3.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.
package/README.md CHANGED
@@ -43,7 +43,7 @@ That puts `forge` on your `PATH`, so it works from any directory. Verify:
43
43
 
44
44
  ```bash
45
45
  forge --version
46
- # 0.3.2
46
+ # 0.3.4
47
47
 
48
48
  forge photo.jpg --to webp
49
49
  ```
@@ -605,28 +605,47 @@ colour. Both are in the shell as its fourth mode, and on the command line.
605
605
 
606
606
  ### In the shell
607
607
 
608
- Press **4** (or type `/colour`). Home shows two cards, **Palette** and
609
- **Scale**. Choose one with ←→ and open it with ↵. You can also drop an image
610
- straight onto colour's home, or press `#` to type a colour.
608
+ Press **5** (or type `/colour`). Home shows three cards: **Extract**,
609
+ **Scale** and **Palette**. Choose one with ←→ and open it with ↵. You can
610
+ also drop an image straight onto colour's home, or press `#` (or paste a
611
+ colour) to type one.
611
612
 
612
- - **Palette.** Drop an image, or type its path into the field at the top. The
613
+ The colour box takes a hex code, `rgb()`, `hsl()`, `oklch()` or a colour
614
+ name: CSS's 148 and the xkcd colour survey's 949 everyday ones, so
615
+ `cherry red` works. Something it can't read turns red, marked `wrong input`.
616
+
617
+ - **Extract.** Drop an image, or type its path into the field at the top. The
613
618
  photo is drawn in its own colours next to the list, with each colour's share
614
619
  of the image.
615
620
  - ↑↓ choose a colour; it stays lit in the photo and the rest dim.
616
621
  - → goes inside a colour: its shades, lit where they are in the photo.
617
622
  ← comes back.
618
623
  - `s` makes a scale from the chosen colour.
619
- - **Scale.** Type a hex code. You get 50–950 with your colour at 500, and a
624
+ - **Scale.** Type a colour. You get 50–950 with your colour at 500, and a
620
625
  preview of the chosen step: "Aa" in white and black, with each rated
621
626
  (AAA, AA, large, fails).
622
- - ←→ choose a step.
627
+ - ←→ choose a step; `s` chooses the steps (Tailwind, Even, Radix).
628
+ - `tab` switches between three tabs. **Colour** is the scale itself.
629
+ **Neutral** is a grey scale tinted with your colour's hue (tint: none,
630
+ faint, soft, strong). **Alpha** is each step as the most see-through
631
+ `#RRGGBBAA` that looks the same over white (or black), drawn over a
632
+ checkerboard with its opacity on it.
623
633
  - `r` makes that step the new centre and rebuilds the scale around it.
624
- - `#` types a new colour.
625
-
626
- On both screens, ↵ copies the chosen hex and `c` copies the whole set. Paste
634
+ - `→` at the end of a colour in the box asks for a second: ↵ **mixes**
635
+ the two, in OKLab or OKLCH, in 3 to 21 steps.
636
+ - **Palette.** Type one colour and get a whole palette that goes with it:
637
+ red, orange, yellow, green, teal, blue, purple and pink, each a 50–950
638
+ scale, and a neutral.
639
+ - `m` chooses a mode: Full set, Monochromatic, Analogous, Complementary,
640
+ Split complementary, Triadic or Pastel.
641
+ - `t` tweaks the whole palette: brightness, saturation and contrast from
642
+ −100 to +100, hue from −180° to +180°. ←→ moves by 1, ⇧←→ by 10, and `r`
643
+ resets.
644
+
645
+ On every screen, ↵ copies the chosen hex and `c` copies the whole set. Paste
627
646
  it into Figma with ⌘V: you get real shapes and text layers, named
628
647
  `blue-500` and so on. esc goes back one step, and the bar at the top shows
629
- the way back. Under `NO_COLOR`, both screens are plain text with every key
648
+ the way back. Under `NO_COLOR`, the screens are plain text with every key
630
649
  still working.
631
650
 
632
651
  ### On the command line
@@ -657,8 +676,10 @@ $ forge scale 6579FD
657
676
  - **`forge scale <colour>`** gives 50–950 built in OKLCH, with your colour
658
677
  exactly at 500. Each step is rated for white and black text (WCAG: AAA, AA,
659
678
  large, fails). Ratios are rounded down, so 4.48:1 shows as `4.4 large` and
660
- is never passed off as AA. Pass the colour without the `#`, or quote it (`'#6579FD'`):
661
- an unquoted `#` starts a comment in the shell.
679
+ is never passed off as AA. The colour can be written as the colour box
680
+ takes it (`forge scale crimson`, `forge scale 'rgb(210 4 45)'`). Pass a hex
681
+ without the `#`, or quote it (`'#6579FD'`): an unquoted `#` starts a
682
+ comment in the shell.
662
683
  - **`--svg`** prints a card of swatches. Pipe it to `pbcopy` and press ⌘V in
663
684
  Figma to get real shapes and text layers: `forge scale 6579FD --svg | pbcopy`.
664
685
  - **`--json`** returns `palette` (`source`, `colours[]` with `hex`, `rgb`,
@@ -868,11 +889,11 @@ Seven tools, deliberately few:
868
889
  | --- | --- |
869
890
  | `forge_probe` | what files are and what Forge can do with them |
870
891
  | `forge_formats` | the capability matrix |
871
- | `forge_convert` | convert to a target format (`quality`, `dpi`, `pages`, `background`, `password`, `overwrite`; images also `sharpen`, `boost: 2 \| 3 \| 4` and `removeBackground`, which need the optional extensions) |
892
+ | `forge_convert` | convert to a target format (`quality`, `dpi`, `pages`, `background`, `password`, `overwrite`; images also `trim`, `crop`, `resize`, `sharpen`, `boost: 2 \| 3 \| 4` and `removeBackground`, the last two needing the optional extensions) |
872
893
  | `forge_compress` | compress by `quality` or to a `maxSize` (also `dpi` for PDFs, `output`, `overwrite`; no `password`: compression refuses encrypted PDFs) |
873
894
  | `forge_pdf` | `merge`, `split`, `extract`, `delete`, `rotate` |
874
895
  | `forge_palette` | an image's main colours with their shares; `inside` gives one colour's shades (read-only) |
875
- | `forge_scale` | a 50–950 tonal scale with the colour at 500, rated for white and black text (read-only) |
896
+ | `forge_scale` | a 50–950 tonal scale with the colour at 500, rated for white and black text; the colour as hex, `rgb()`, `hsl()`, `oklch()` or a name (read-only) |
876
897
 
877
898
  Paths must be absolute. Results come back as structured content in the
878
899
  `--json` shape below, with a `file://` link to every output, and never as
@@ -912,7 +933,7 @@ photo.png · PNG · 122 KB · 2756×774
912
933
  With `--json`:
913
934
 
914
935
  ```json
915
- {"forge":"0.3.2","ok":true,"probes":[{"path":"/Users/me/photo.png","kind":"image","format":"png","bytes":122449,"width":2756,"height":774,"targets":["jpeg","png","webp","avif","gif","tiff","pdf"],"actions":["convert"]}],"failures":[]}
936
+ {"forge":"0.3.4","ok":true,"probes":[{"path":"/Users/me/photo.png","kind":"image","format":"png","bytes":122449,"width":2756,"height":774,"targets":["jpeg","png","webp","avif","gif","tiff","pdf"],"actions":["convert"]}],"failures":[]}
916
937
  ```
917
938
 
918
939
  `targets` and `actions` come from the engines' own capabilities, so they are
@@ -938,7 +959,7 @@ succeeded) and `failures`. A conversion, compression or page operation adds
938
959
 
939
960
  ```jsonc
940
961
  {
941
- "forge": "0.3.2",
962
+ "forge": "0.3.4",
942
963
  "ok": false,
943
964
  "results": [
944
965
  {
@@ -0,0 +1,4 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import"./chunk-TMUK2DD3.js";import{readFile as x}from"node:fs/promises";import{dirname as m,join as u}from"node:path";import{fileURLToPath as C}from"node:url";var c=[{name:"sharp \xB7 libvips",licence:"Apache-2.0 \xB7 LGPL-3.0",does:"images",packages:["sharp"]},{name:"PDFium",licence:"BSD-3-Clause",does:"PDF pages",packages:[]},{name:"pdf-lib",licence:"MIT",does:"writing PDFs",packages:["pdf-lib"]},{name:"mammoth \xB7 docx",licence:"BSD-2-Clause \xB7 MIT",does:"Word documents",packages:["mammoth","docx"]},{name:"Ink \xB7 React",licence:"MIT",does:"this screen",packages:["ink","react"]}],g=[{name:"@hyzyla/pdfium",licence:"MIT"}],h=[{name:"xkcd colour survey",licence:"CC0-1.0"}];function l(n){let t=[];for(let e of n.split(`
4
+ `)){let i=/^((?:@[^/\s]+\/)?[^@\s]+)@\S+ — (.+)$/.exec(e);i&&t.push({name:i[1],licence:i[2].replace(/^\((.*)\)$/,"$1")})}return t}var d=n=>n.name.replace(/^@/,"");function p({bundled:n,extensions:t}){let e=new Set(c.flatMap(s=>s.packages)),i=[...n.filter(s=>!e.has(s.name)),...g,...h].sort((s,r)=>d(s).localeCompare(d(r)));return[{title:"App",credits:c.map(({packages:s,...r})=>r)},...t.length>0?[{title:"Extensions",credits:t}]:[],{title:"Others",credits:i}]}var f="third-party-licenses.txt";function y(n){let t=[],e=m(n);for(let i=0;i<4;i++)t.push(u(e,f),u(e,"dist",f)),e=m(e);return t}async function k(n){for(let t of y(C(n))){let e=await x(t,"utf8").catch(()=>{});if(e!==void 0)return{path:t,text:e}}}async function I({from:n=import.meta.url,list:t=async()=>(await import("./manager-XN7WNMEW.js")).listExtensions()}={}){let[e,i]=await Promise.all([k(n),t().catch(()=>[])]),{extensionCredits:s}=await import("./extensions-DRFI4IBF.js"),r=i.filter(o=>o.installed!==void 0).flatMap(o=>s(o.entry)),a=p({bundled:l(e?.text??""),extensions:r});return e?{sections:a,file:e.path}:{sections:a}}export{I as loadCredits};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- import{r as l}from"./chunk-6OMZ6PFV.js";import{e as a}from"./chunk-H2IUSPAK.js";import"./chunk-HON4OV7M.js";import"./chunk-TMUK2DD3.js";var i={loadPreferences:a,loadShell:()=>import("./launch-UICFGGX4.js")};async function p(e=i){let o=e.loadShell();o.catch(()=>{});let{prefs:t,warning:r}=await e.loadPreferences(),n=l(t.theme),{launchShell:s}=await o;await s({prefs:t,palette:n,...r===void 0?{}:{warning:r}})}export{p as bootShell};
3
+ import{r as l}from"./chunk-7TUTDL4W.js";import{e as a}from"./chunk-H2IUSPAK.js";import"./chunk-HON4OV7M.js";import"./chunk-TMUK2DD3.js";var i={loadPreferences:a,loadShell:()=>import("./launch-JLMP3NAI.js")};async function p(e=i){let o=e.loadShell();o.catch(()=>{});let{prefs:t,warning:r}=await e.loadPreferences(),n=l(t.theme),{launchShell:s}=await o;await s({prefs:t,palette:n,...r===void 0?{}:{warning:r}})}export{p as bootShell};
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __forgeCreateRequire } from 'node:module';
2
2
  const require = __forgeCreateRequire(import.meta.url);
3
- var C="0.3.2",T={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
3
+ var C="0.3.4",T={ok:"\u2713",fail:"\u2715",warn:"\u26A0",cursor:"\u276F",strip:"\u258C",star:"\u2605",arrow:"\u2192",tip:"\u2727",longArrow:"\u2500\u2500\u2192",longArrowDown:`\u2502
4
4
  \u25BC`,dotFilled:"\u25CF",dotEmpty:"\u25CB"},o={name:"dark",fg:"#e7e7e7",dim:"#b0b0b0",accent:"#e5a23c",ok:"#6fcf7f",warn:"#e5c07b",fail:"#e8796d",failTint:"#2e2020",failTintDim:"#b0b0b0",larger:"#f2994a",shedHatch:"#47774f",grownFill:"#403225",tag:"#63c1d8",label:"#a68ce0",modeConvert:"#55c7d9",modeConvertBg:"#122c33",modeCompress:"#79c98b",modeCompressBg:"#182c1e",modePdf:"#ff6b4a",modePdfBg:"#361c16",modeColour:"#f27ba8",modeColourBg:"#3a1e2b",modeEnhance:"#b39ae8",modeEnhanceBg:"#2a2238",border:"#808080",selectionBg:"#2c2c2c",band:"#2c2c2c",canvas:"#1e1e1e",textSelectionBg:"#3f5c86",brand:"#e5a23c",keycapBg:"#333333",violet:"#a68ce0",faint:"#4d4d4d",listBand:"#323232",shelf:"#242424",tabChip:"#262626",panelBand:"#404040",ink:"#0c1d22",track:"#2e2e2e",trackFill:"#515151",thumb:"#e7e7e7",folderChip:"#414141",pill:"#e7e7e7",fieldBand:"#3d3d3d",defaultTagBg:"#33261a",defaultTag:"#c98a4b",newTagBg:"#2a3448",newTag:"#4f77c5"},r={name:"light",fg:"#262626",dim:"#4f4f4f",accent:"#915a01",ok:"#0e702c",warn:"#8a6100",fail:"#a43c32",failTint:"#f9e3df",failTintDim:"#4a4a4a",larger:"#8b4d01",shedHatch:"#87b896",grownFill:"#ece3d6",tag:"#0a6b86",label:"#5e4b99",modeConvert:"#036b7b",modeConvertBg:"#e6f7fa",modeCompress:"#24733a",modeCompressBg:"#eaf5ec",modePdf:"#b82a06",modePdfBg:"#fceee9",modeColour:"#b0306a",modeColourBg:"#f7e3ec",modeEnhance:"#64569f",modeEnhanceBg:"#f0ebfa",border:"#767676",selectionBg:"#e4e4e4",band:"#e4e4e4",canvas:"#ffffff",textSelectionBg:"#b9cfe8",brand:"#915a01",keycapBg:"#e1e1e1",violet:"#5e4b99",faint:"#b2b2b2",listBand:"#dcdcdc",shelf:"#f3f3f3",tabChip:"#f0f0f0",panelBand:"#d5d5d5",ink:"#ffffff",track:"#e4e4e4",trackFill:"#afafaf",thumb:"#262626",folderChip:"#d0d0d0",pill:"#262626",fieldBand:"#d7d7d7",defaultTagBg:"#f5e2cc",defaultTag:"#8f5000",newTagBg:"#e1e7f4",newTag:"#3358a3"},f={name:"neutral",fg:"",dim:"gray",accent:"yellow",ok:"green",warn:"yellow",fail:"red",failTint:"",failTintDim:"gray",larger:"yellow",shedHatch:"green",grownFill:"",tag:"cyan",label:"magenta",modeConvert:"cyan",modeConvertBg:"",modeCompress:"green",modeCompressBg:"",modePdf:"red",modePdfBg:"",modeColour:"magenta",modeColourBg:"",modeEnhance:"magenta",modeEnhanceBg:"",border:"gray",selectionBg:"",band:"",canvas:"",textSelectionBg:"",brand:"yellow",keycapBg:"",violet:"magenta",faint:"gray",listBand:"",shelf:"",tabChip:"",panelBand:"",ink:"",track:"",trackFill:"",thumb:"",folderChip:"",pill:"",fieldBand:"",defaultTagBg:"",defaultTag:"",newTagBg:"",newTag:""},a=["convert","compress","pdf","enhance","colour"],v=`1\u2013${a.length}`;function S(e,n){let t=[...a,"commands"];return t[(t.indexOf(e)+n+t.length)%t.length]}function x(e){return/^[1-9]$/.test(e)?a[Number(e)-1]:void 0}var P={convert:"\u2194",compress:"\u2193",pdf:"\u25A3",colour:"\u25D0",enhance:"\u2726"},c="#7d6ad0";function l(e,n){return n==="compress"?{fg:e.modeCompress,bg:e.modeCompressBg}:n==="pdf"?{fg:e.modePdf,bg:e.modePdfBg}:n==="colour"?{fg:e.modeColour,bg:e.modeColourBg}:n==="enhance"?{fg:e.modeEnhance,bg:e.modeEnhanceBg}:{fg:e.modeConvert,bg:e.modeConvertBg}}var i=["#f26e69","#e5a23c","#ace02c","#55c7d9","#6579fd","#ad95e9"],g=["#e5a23c","#f2cf6b"],s={convert:["#1e96a7","#1e94b3","#1e92c0","#1d8ed2","#1b86ef","#4a7df8","#6974f8","#816af8","#995cf8"],compress:["#24b459","#22ab6d","#21a479","#209f81","#1f9c89","#1f9a91","#1e9998","#1e97a0","#1e96a7"],pdf:["#eb4319","#e3541a","#de601b","#db6a1c","#d9731d","#d87c1e","#d8841f","#d98c20","#d99522"],enhance:["#9b5af8","#985cf8","#965ef8","#945ff8","#9161f8","#8f62f8","#8d64f8","#8a65f8","#8867f8"],colour:["#f42335","#e05b1a","#d87d1e","#da9b23","#d2b427","#b4c027","#5bbf23","#20a27c","#1e989b","#1e94b6","#1c8cd9","#577af8","#7371f8","#8568f8","#965df8"]},m=["#d99522","#da9822","#da9b23","#da9f24","#d9a224","#d9a525","#d8a825","#d7ab26","#d6ad26"],b={convert:["#d6f7fd","#ddf5fe","#e1f4fe","#e4f2fe","#e7f1fe","#eaf0fe","#eceffe","#efeefe","#f1edfe"],compress:["#e0f7e4","#def8e7","#dcf8ea","#daf8ed","#d8f8f1","#d7f8f4","#d6f8f7","#d6f8fa","#d6f7fd"],pdf:["#feece7","#feece6","#feece5","#feece3","#feece2","#feede0","#feedde","#feeddc","#feeed9"],enhance:["#f2edfe","#f1edfe","#f1edfe","#f1eefe","#f0eefe","#f0eefe","#f0eefe","#f0eefe","#efeefe"],colour:["#feebe9","#feece5","#feede0","#feeed7","#f7f1d6","#eff3d9","#e5f6df","#dbf8eb","#d6f8f8","#def5fe","#e5f2fe","#ebf0fe","#edeffe","#efeefe","#f1edfe"]},u=["#feeed9","#feeed8","#feeed7","#fdeed6","#fcefd6","#fbefd6","#fbefd6","#faefd6","#f9f0d6"],h={convert:["#138291","#8467bd"],compress:["#2b8748","#138291"],pdf:["#d54322","#a06c10"],enhance:["#8567bc","#7b67cd"],colour:["#cb4b49","#a06c10","#618110","#138291","#5869ec","#8268bd"]};function p(e,n){return e.name==="light"?n==="commands"?m:s[n]:n==="commands"?e.name==="dark"?g:[e.brand]:n==="compress"?[e.modeCompress,e.modeConvert]:n==="pdf"?[e.modePdf,e.brand]:n==="colour"?e.name==="dark"?i:[e.modeColour,e.violet]:n==="enhance"?[e.modeEnhance,e.name==="dark"?c:e.violet]:[e.modeConvert,e.violet]}function k(e,n){if(e.name==="light")return n==="commands"?u:b[n]}function y(e,n){return e.name==="light"?h[n]:p(e,n)}function E(e){return{...e,accent:e.brand,tag:e.brand,label:e.brand}}function w(e,n){let{fg:t,bg:d}=l(e,n);return{...e,accent:t,tag:t,label:t,band:d===""?e.band:d}}function M(e){return e.canvas!==""}function O(e){return e==="dark"?o:e==="light"?r:f}function H(e){return e===""?void 0:e}var R={filled:"\u2501",empty:"\u2501",knob:"\u25CF"};function B(){return process.env.NO_COLOR!==void 0&&process.env.NO_COLOR!==""?!1:process.stdout.isTTY===!0}function D(){B()||(process.env.FORCE_COLOR="0")}export{C as a,T as b,o as c,r as d,f as e,a as f,v as g,S as h,x as i,P as j,l as k,p as l,k as m,y as n,E as o,w as p,M as q,O as r,H as s,R as t,B as u,D as v};
@@ -0,0 +1,3 @@
1
+ import { createRequire as __forgeCreateRequire } from 'node:module';
2
+ const require = __forgeCreateRequire(import.meta.url);
3
+ import{win32 as r}from"node:path";function o(n,e=process.platform){return e==="win32"?r.basename(n):n.split("/").pop()}export{o as a};