@bernatch22/aldus 0.1.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 +59 -0
- package/dist/cli.js +3250 -0
- package/dist/index.js +3070 -0
- package/package.json +29 -0
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @bernatch22/aldus
|
|
2
|
+
|
|
3
|
+
Pixel-perfect **PDF editing** over a PDF's real content graph, plus an **LLM
|
|
4
|
+
agent** that reads, edits, highlights, links, and **fills/builds forms** — from
|
|
5
|
+
code or the `aldus` CLI. The agent runs on your **Claude Code subscription** or
|
|
6
|
+
on **OpenRouter** (for headless/public use).
|
|
7
|
+
|
|
8
|
+
> Bundled build of the [`aldus`](https://github.com/bernatch22/aldus) monorepo
|
|
9
|
+
> (`@aldus/core` + `@aldus/agent`) → one self-contained package. Powers the demo
|
|
10
|
+
> at [bernardocastro.dev/aldus](https://bernardocastro.dev/aldus).
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm i @bernatch22/aldus # library + the `aldus` CLI
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## CLI
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
aldus doc.pdf "Describe the content" # ask (LLM)
|
|
22
|
+
aldus doc.pdf "Highlight the totals" -o out.pdf --open
|
|
23
|
+
aldus form.pdf --fields # dump fields + values + positions (no LLM)
|
|
24
|
+
aldus form.pdf --fill '{"name":"Ana"}' -o filled.pdf # fill by field name (no LLM)
|
|
25
|
+
aldus doc.pdf # interactive chat
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`--fields` / `--fill` are **deterministic** (no LLM). The agentic prompts need a
|
|
29
|
+
provider (below).
|
|
30
|
+
|
|
31
|
+
## Provider
|
|
32
|
+
|
|
33
|
+
- **Subscription** (default): run **without** `ANTHROPIC_API_KEY` — bills your
|
|
34
|
+
Claude Code subscription.
|
|
35
|
+
- **OpenRouter** (headless / servers): `ALDUS_PROVIDER=openrouter` +
|
|
36
|
+
`OPENROUTER_API_KEY` (or an `OPENROUTER_BASE_URL` pointing at an
|
|
37
|
+
OpenAI-compatible proxy). Model via `ALDUS_OPENROUTER_MODEL`.
|
|
38
|
+
|
|
39
|
+
## Library
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { loadDoc, EditSession, runTurn, serializeDoc } from '@bernatch22/aldus';
|
|
43
|
+
import { readFormFields, setFieldValues } from '@bernatch22/aldus'; // deterministic form I/O
|
|
44
|
+
|
|
45
|
+
const doc = await loadDoc('form.pdf');
|
|
46
|
+
const session = new EditSession(doc);
|
|
47
|
+
await runTurn({ doc, session, prompt: 'Fill the form: name Ana, plan Pro' });
|
|
48
|
+
await session.save('filled.pdf');
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## What the agent can do
|
|
52
|
+
|
|
53
|
+
Text edit/move/color/size/delete · images move/delete/insert · highlight (create/
|
|
54
|
+
recolor/remove) · links · watermark · header/footer · **form fields**: create any
|
|
55
|
+
type (text/checkbox/radio/select/list/button/signature), move/delete, **read
|
|
56
|
+
values + positions**, and **fill** (by field name or by the `[[id]]` of the
|
|
57
|
+
reading view). It's aware of the full geometry & style of every element.
|
|
58
|
+
|
|
59
|
+
MIT · [source](https://github.com/bernatch22/aldus)
|