forge-terminal 0.3.0 → 0.3.2
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 +24 -3
- package/dist/chunks/about-credits-U3MMRRXR.js +4 -0
- package/dist/chunks/{boot-ISMRSTLL.js → boot-FBULFF7S.js} +1 -1
- package/dist/chunks/{check-DN7SEN44.js → check-BRP6EKSA.js} +1 -1
- package/dist/chunks/{chunk-OIZCRBLT.js → chunk-32VJ2RDH.js} +1 -1
- package/dist/chunks/{chunk-VNAIHACR.js → chunk-3GVFOZ7M.js} +1 -1
- package/dist/chunks/{chunk-W42HVOBD.js → chunk-4QQEJ6YG.js} +1 -1
- package/dist/chunks/chunk-6HCXF53X.js +64 -0
- package/dist/chunks/chunk-6OMZ6PFV.js +4 -0
- package/dist/chunks/chunk-ASXMESA4.js +4 -0
- package/dist/chunks/{chunk-LI2JPLF7.js → chunk-GGBNT4WI.js} +1 -1
- package/dist/chunks/chunk-GNLE6JXL.js +3 -0
- package/dist/chunks/chunk-H2IUSPAK.js +4 -0
- package/dist/chunks/chunk-HBVSGQOK.js +10 -0
- package/dist/chunks/chunk-HHBJZMKO.js +3 -0
- package/dist/chunks/{chunk-Q45MSMTN.js → chunk-I6QBBRCE.js} +1 -1
- package/dist/chunks/{chunk-M6LD6DHO.js → chunk-LW2QEXDT.js} +1 -1
- package/dist/chunks/{chunk-E5QDHFKQ.js → chunk-MMRDELHW.js} +1 -1
- package/dist/chunks/chunk-QXTXBMTM.js +3 -0
- package/dist/chunks/{chunk-NY6BX7QS.js → chunk-SAWVMQAD.js} +1 -1
- package/dist/chunks/{chunk-6ZEGAH36.js → chunk-TEO2EUS3.js} +1 -1
- package/dist/chunks/{chunk-YZG5A3GA.js → chunk-X54KIHCN.js} +1 -1
- package/dist/chunks/chunk-YVWRISPE.js +3 -0
- package/dist/chunks/colour-SRIDFG7U.js +3 -0
- package/dist/chunks/{config-command-UW6BYQ2K.js → config-command-TXQUYFA6.js} +1 -1
- package/dist/chunks/execute-T6VXZC33.js +3 -0
- package/dist/chunks/extensions-2XAKBZ43.js +3 -0
- package/dist/chunks/{extensions-command-5QO6YX6O.js → extensions-command-UGXZIFRI.js} +1 -1
- package/dist/chunks/image-F5D73JPQ.js +3 -0
- package/dist/chunks/{install-HCF5BIA6.js → install-YG43OJ7P.js} +1 -1
- package/dist/chunks/launch-UICFGGX4.js +4 -0
- package/dist/chunks/{lock-RZ6NVZFD.js → lock-6KTGUFBY.js} +1 -1
- package/dist/chunks/{manager-7HNOLCYH.js → manager-XN7WNMEW.js} +1 -1
- package/dist/chunks/{preferences-AKDCPHJ5.js → preferences-YL6SRNZR.js} +1 -1
- package/dist/chunks/{restart-6ONEYN6T.js → restart-RO6DM5N3.js} +1 -1
- package/dist/chunks/reveal-L6TBFOMV.js +3 -0
- package/dist/chunks/{run-C475RRUL.js → run-XQYPVWFI.js} +1 -1
- package/dist/chunks/{server-A327QWB6.js → server-3L4NCTNR.js} +15 -15
- package/dist/chunks/theme-JJC6JKR3.js +3 -0
- package/dist/chunks/{update-command-HT2RBFLR.js → update-command-6VNVMAYO.js} +1 -1
- package/dist/chunks/{update-note-6GBF5AE4.js → update-note-X6FJOR5C.js} +1 -1
- package/dist/index.js +24 -24
- package/package.json +1 -1
- package/skills/forge/SKILL.md +17 -1
- package/dist/chunks/chunk-4L6HNYSN.js +0 -4
- package/dist/chunks/chunk-775ILWZI.js +0 -3
- package/dist/chunks/chunk-CKWYIU2N.js +0 -4
- package/dist/chunks/chunk-CXVYIBCA.js +0 -4
- package/dist/chunks/chunk-GDQQDHXJ.js +0 -10
- package/dist/chunks/chunk-RE7E6NA7.js +0 -3
- package/dist/chunks/colour-LZ7EJ6H4.js +0 -3
- package/dist/chunks/execute-JRS6RQZA.js +0 -3
- package/dist/chunks/image-ESDL7GZU.js +0 -3
- package/dist/chunks/launch-BWYE27OQ.js +0 -65
- package/dist/chunks/theme-YG3CRJBG.js +0 -3
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.
|
|
46
|
+
# 0.3.2
|
|
47
47
|
|
|
48
48
|
forge photo.jpg --to webp
|
|
49
49
|
```
|
|
@@ -265,6 +265,27 @@ warns. `forge_convert` takes
|
|
|
265
265
|
`trim: true` and `resize: { percent } | { width } | { height }`, and then `to`
|
|
266
266
|
is optional.
|
|
267
267
|
|
|
268
|
+
## Crop to shape
|
|
269
|
+
|
|
270
|
+
Cut a photo to a shape — the largest box of that shape it holds, placed to
|
|
271
|
+
keep the subject. Built in, images only, and the format is kept unless `--to`
|
|
272
|
+
says otherwise:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
forge photo.jpg --crop 1:1 # photo-cropped-1x1.jpg
|
|
276
|
+
forge photo.jpg --crop 4:5 --width 1080 --to webp # photo-cropped-4x5-1080x1350.webp
|
|
277
|
+
forge *.jpg --crop 16:9 -o out/
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
The shape is `W:H`, two whole numbers from 1 to 100. A `--resize`, `--width`
|
|
281
|
+
or `--height` applies to the cropped image. `--crop` combines with the same
|
|
282
|
+
flags resize does, and is refused with the same ones — and with `--trim`: run
|
|
283
|
+
one, then the other. Cropping an animated image is refused; so is cropping one
|
|
284
|
+
that already has the shape, unless it is also resized, which then only warns.
|
|
285
|
+
`forge_convert` takes `crop: "1:1"` (any `W:H`), and then `to` is optional.
|
|
286
|
+
In the app, Crop to shape is an Enhance row with a preview you can move and
|
|
287
|
+
zoom.
|
|
288
|
+
|
|
268
289
|
## Boost resolution and remove background
|
|
269
290
|
|
|
270
291
|
Two image operations that need a model, so they are optional extensions rather
|
|
@@ -891,7 +912,7 @@ photo.png · PNG · 122 KB · 2756×774
|
|
|
891
912
|
With `--json`:
|
|
892
913
|
|
|
893
914
|
```json
|
|
894
|
-
{"forge":"0.3.
|
|
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":[]}
|
|
895
916
|
```
|
|
896
917
|
|
|
897
918
|
`targets` and `actions` come from the engines' own capabilities, so they are
|
|
@@ -917,7 +938,7 @@ succeeded) and `failures`. A conversion, compression or page operation adds
|
|
|
917
938
|
|
|
918
939
|
```jsonc
|
|
919
940
|
{
|
|
920
|
-
"forge": "0.3.
|
|
941
|
+
"forge": "0.3.2",
|
|
921
942
|
"ok": false,
|
|
922
943
|
"results": [
|
|
923
944
|
{
|
|
@@ -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 h}from"node:fs/promises";import{dirname as m,join as f}from"node:path";import{fileURLToPath as x}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"}];function p(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 l({bundled:n,extensions:t}){let e=new Set(c.flatMap(s=>s.packages)),i=[...n.filter(s=>!e.has(s.name)),...g].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 u="third-party-licenses.txt";function C(n){let t=[],e=m(n);for(let i=0;i<4;i++)t.push(f(e,u),f(e,"dist",u)),e=m(e);return t}async function y(n){for(let t of C(x(n))){let e=await h(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([y(n),t().catch(()=>[])]),{extensionCredits:s}=await import("./extensions-2XAKBZ43.js"),r=i.filter(a=>a.installed!==void 0).flatMap(a=>s(a.entry)),o=l({bundled:p(e?.text??""),extensions:r});return e?{sections:o,file:e.path}:{sections:o}}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{
|
|
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};
|
|
@@ -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}from"./chunk-
|
|
3
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-X54KIHCN.js";import"./chunk-H2IUSPAK.js";import"./chunk-HON4OV7M.js";import"./chunk-TMUK2DD3.js";export{b as CHECK_EVERY_MS,a as REGISTRY_URL,k as availableUpdate,e as cachePath,j as checkNow,i as fetchLatest,c as isNewer,h as isStale,f as readCache,d as updateChecksEnabled,g as writeCache};
|
|
@@ -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 s,F as a,G as m}from"./chunk-
|
|
3
|
+
import{E as s,F as a,G as m}from"./chunk-MMRDELHW.js";import{randomBytes as f}from"node:crypto";import{constants as u}from"node:fs";import{access as d,mkdir as p,rename as w,rm as S,writeFile as h}from"node:fs/promises";import{dirname as y}from"node:path";async function P(t){let e=y(t);try{await p(e,{recursive:!0})}catch(r){let i=a(t,r);throw i===r?m(t,r):i}try{await d(e,u.W_OK)}catch(r){throw s(t,r)}}var A=new Set(["EPERM","EBUSY","EACCES"]),N=5,M=9;async function T(t,e,r=process.platform,i=o=>new Promise(n=>setTimeout(n,o)),E=N){if(r!=="win32"){await w(t,e);return}for(let o=1;;o++)try{await w(t,e);return}catch(n){let c=n.code;if(o>=E||!c||!A.has(c))throw n;await i(Math.min(50*2**(o-1),1e3))}}async function O(t,e){await P(t);let r=`${t}.${f(6).toString("hex")}.tmp`;try{return await h(r,e),await T(r,t),e.byteLength}catch(i){throw await S(r,{force:!0}).catch(()=>{}),a(t,i)}}export{P as a,M as b,T as c,O as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{j as t}from"./chunk-
|
|
3
|
+
import{j as t}from"./chunk-GGBNT4WI.js";import{resolve as s}from"node:path";function c(r,e){return{forge:r,ok:!0,palette:e,failures:[]}}function f(r,e){return{forge:r,ok:!0,scale:e,failures:[]}}function a(r){let e=t(r),n=e.sources.map(o=>s(o.path));return{op:r.job.op,source:n[0]??"",sources:n,outputs:e.outputs.map(o=>s(o)),inputBytes:e.sources.reduce((o,u)=>o+u.bytes,0),outputBytes:e.outputBytes,warnings:e.warnings.map(o=>({code:o.code,message:o.message}))}}function i(r){let{error:e}=r;return{...r.path?{path:s(r.path)}:{},code:e.code,title:e.title,detail:e.detail,...e.hint===void 0?{}:{hint:e.hint}}}function l(r,e){return{forge:r,ok:e.failures.length===0,results:e.results.map(a),failures:e.failures.map(i)}}function J(r,e){return l(r,{results:[],failures:[{error:e}]})}function m(r,e){return{forge:r,ok:!0,formats:e,failures:[]}}function b(r,e){return{forge:r,ok:e.failures.length===0,probes:e.probes,failures:e.failures.map(i)}}function x(r,e,n){return{forge:r,ok:!0,config:e,warnings:n.map(o=>({code:o.code,message:o.message})),failures:[]}}function d(r,e){return{forge:r,ok:!0,extensions:e.extensions,...e.changed?{changed:e.changed}:{},failures:[]}}export{c as a,f as b,l as c,J as d,m as e,b as f,x as g,d as h};
|
|
@@ -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 t}from"./chunk-
|
|
3
|
+
import{b as t}from"./chunk-SAWVMQAD.js";import{spawnSync as n}from"node:child_process";var r=!1;function c(){r=!0}function p(){return r}function u(){let e=t(process.argv[1]);if(e===void 0)return;let o=n(process.execPath,[...process.execArgv,e],{stdio:"inherit"});process.exitCode=o.status??0}export{c as a,p as b,u as c};
|