gridity 0.1.0 → 0.2.0

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
@@ -6,12 +6,13 @@ sized so an LLM can understand many pages or moments from a single image.
6
6
  ```sh
7
7
  gridity probe report.pdf # pages, sizes, sheet estimates, text size
8
8
  gridity probe report.pdf --per-page # which pages need to be seen
9
- gridity text report.pdf # visible text of each page
10
9
  gridity render report.pdf # prints absolute paths of the sheets
11
10
  gridity render report.pdf --pages 3-8 --json # manifest with cell coordinates
12
11
  gridity render report.pdf --pages 7 --crop 0,0.5,1,0.5 # close-up of the bottom half
13
12
  gridity render talk.mp4 --start 1:00 --end 2:30 --every 10s
14
13
  gridity render screenshots/ --cols 3
14
+ gridity render report.pdf --pages 7 --ruler # read --crop values off the sheet
15
+ gridity export report.pdf --pages 7 --crop 0.1,0.55,0.8,0.3 -o fig.png # one file per item
15
16
  gridity guide # documentation for agents
16
17
  ```
17
18
 
@@ -23,6 +24,7 @@ evenly across sheets when they do not fit on one.
23
24
 
24
25
  ```sh
25
26
  npx gridity --help # prebuilt: macOS and Linux (x64, arm64), Windows (x64)
27
+ cargo binstall gridity # same prebuilt binaries, installed like cargo install
26
28
  cargo install gridity # build from crates.io with Rust
27
29
  cargo install --path . # build this checkout
28
30
  ```
@@ -32,7 +34,7 @@ Video input needs `ffmpeg` and `ffprobe` on `PATH` (`brew install ffmpeg`), or
32
34
 
33
35
  ## MCP server
34
36
 
35
- `gridity mcp` exposes `render`, `probe`, `text` and `guide` as Model Context Protocol
37
+ `gridity mcp` exposes `render`, `probe` and `guide` as Model Context Protocol
36
38
  tools; `render` returns the sheets as images.
37
39
 
38
40
  ```sh
@@ -45,7 +47,7 @@ See `gridity guide mcp` for other clients, parameters and limits.
45
47
  ## Documentation
46
48
 
47
49
  `gridity guide [topic]` prints the bundled guide (`docs/guide/*.md`):
48
- `recipes`, `pdf`, `text`, `video`, `images`, `layout`, `output`, `mcp`. JSON Schemas of
50
+ `recipes`, `pdf`, `pages`, `video`, `images`, `layout`, `output`, `mcp`. JSON Schemas of
49
51
  every JSON output are in [`docs/schema/`](docs/schema/).
50
52
 
51
53
  ## License
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+ import { existsSync } from "node:fs";
4
+ import { fileURLToPath } from "node:url";
5
+ // src/gridity.ts
6
+ const platform = `${process.platform}-${process.arch}`;
7
+ const name = process.platform === "win32" ? "gridity.exe" : "gridity";
8
+ const binary = fileURLToPath(new URL(`../vendor/${platform}/${name}`, import.meta.url));
9
+ if (!existsSync(binary)) {
10
+ console.error(`error: gridity has no prebuilt binary for ${platform}\nhint: install it with \`cargo install gridity\``);
11
+ process.exit(4);
12
+ }
13
+ const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
14
+ if (result.error) {
15
+ console.error(`error: cannot run ${binary}: ${result.error.message}`);
16
+ process.exit(1);
17
+ }
18
+ if (result.signal) process.kill(process.pid, result.signal);
19
+ process.exit(result.status ?? 1);
20
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridity",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Arrange PDF pages, video frames and images into labeled grid sheets for LLM vision",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": {
@@ -16,8 +16,9 @@
16
16
  "contact-sheet",
17
17
  "mcp"
18
18
  ],
19
+ "type": "module",
19
20
  "bin": {
20
- "gridity": "bin/gridity.js"
21
+ "gridity": "bin/gridity.mjs"
21
22
  },
22
23
  "files": [
23
24
  "bin",
Binary file
Binary file
Binary file
Binary file
Binary file
package/bin/gridity.js DELETED
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
- // Runs the prebuilt gridity binary for this platform with the same arguments, stdio and
3
- // exit code, so `npx gridity mcp` works as an MCP server.
4
- "use strict";
5
-
6
- const { spawnSync } = require("node:child_process");
7
- const fs = require("node:fs");
8
- const path = require("node:path");
9
-
10
- const platform = `${process.platform}-${process.arch}`;
11
- const name = process.platform === "win32" ? "gridity.exe" : "gridity";
12
- const binary = path.join(__dirname, "..", "vendor", platform, name);
13
-
14
- if (!fs.existsSync(binary)) {
15
- console.error(
16
- `error: gridity has no prebuilt binary for ${platform}\n` +
17
- "hint: install it with `cargo install gridity`",
18
- );
19
- process.exit(4);
20
- }
21
-
22
- const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
23
- if (result.error) {
24
- console.error(`error: cannot run ${binary}: ${result.error.message}`);
25
- process.exit(1);
26
- }
27
- if (result.signal) {
28
- process.kill(process.pid, result.signal);
29
- }
30
- process.exit(result.status ?? 1);